Commit Graph

34456 Commits

Author SHA1 Message Date
Jeremy Felt 363533d9b3 Multisite: Use `to_array()` method on `WP_Site` objects in `wp_get_sites()`
When an object with private properties is cast directly to an array, those properties are no longer available with their original keys.

Props @flixos90.
See #36717.


git-svn-id: https://develop.svn.wordpress.org/trunk@37667 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 18:09:25 +00:00
Jeremy Felt 56c98dd30a Tests: Split `get_blog_details()` test into individual tests
* One test per method
* Clarify existing tests.
* Add test for passing a "blog slug" string to `get_blog_details()`.
* Shared fixture of sites.
* Reduce number of sites created to only those necessary.
* Remove unnecessary networks creation.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37666 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 15:57:37 +00:00
Jeremy Felt ead348053b Tests: Move `get_blog_details()` tests to their own file
See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37665 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 05:40:45 +00:00
Rachel Baker 8910870205 Comments: Fix pagination totals in the response of the inline delete actions when filtering the List Table by comment_type.
Within the Ajax action `_wp_ajax_delete_comment_response()` if the comment_type query var is set, fallback to the previous `$total - 1` value instead of getting an incorrect value from `wp_comment_count()`.

Fixes #36991.

git-svn-id: https://develop.svn.wordpress.org/trunk@37664 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 02:21:27 +00:00
Rachel Baker 0c990ffb73 Users: Stop WP_List_Table notices from persisting on pagination navigation.
Adds the keyboard navigation query vars to `wp_removable_query_args()` and passes the results of said function to remove_query_var() inside the WP_List_Table pagination method.

Props EFAREM for the initial patch.
Fixes #35620.

git-svn-id: https://develop.svn.wordpress.org/trunk@37663 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 01:55:40 +00:00
Jeremy Felt 8de500d493 Tests: User a data provider for `wp_get_sites()` tests.
* Convert existing tests into a data provider and clarify expectations.
* Add shared test fixtures in preparation for future tests.

This passes with the `wp_get_sites()` from 4.5 and the deprecated version in trunk.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37662 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 00:27:46 +00:00
Andrew Ozz 510cff5fe6 Editor quickTags: when the user selects some text by triple-clicking, then wraps it in a tag, and the last selected char is `\n`, insert the closing tag before the line break.
Props JoshuaGoodwin azaozz.
Fixes #29571.

git-svn-id: https://develop.svn.wordpress.org/trunk@37661 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 00:24:56 +00:00
Jeremy Felt 8e380e50d8 Tests: Move `wp_get_sites()` tests to their own file
See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37660 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 22:46:38 +00:00
Andrew Ozz 0861054ca2 Editor, editor-expand: adjust the sidebar position when moving a postbox from one column to another.
Fixes #35230.

git-svn-id: https://develop.svn.wordpress.org/trunk@37659 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 22:36:47 +00:00
Jeremy Felt 91f24a7b4e Multisite: Fix `switch(` spacing after [37657]
Fixes #36717.


git-svn-id: https://develop.svn.wordpress.org/trunk@37658 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 04:47:52 +00:00
Jeremy Felt c64d63e51a Multisite: Allow access to network and site properties using current naming conventions
* Add magic `__get()`, `__set()`, and `__isset()` methods to `WP_Site` and `WP_Network.
* Provide `(int) $network->site_id` for `(string) $network->blog_id`
* Provide `(int) $site->id` for `(string) $site->blog_id`
* Provide `(int) $site->network_id` for `(string) $site->site_id`

Props flixos90, jeremyfelt.
Fixes #36717.


git-svn-id: https://develop.svn.wordpress.org/trunk@37657 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 04:13:04 +00:00
Boone Gorges 1eaf38088f Add a note about uniqueness to the doc block for `get_term_by()`.
`get_term_by()` always returns a single term, even when more than one term
matches the query parameters. The new note warns developers to use
`get_terms()` when such ambiguity may result.

Fixes #36878.

git-svn-id: https://develop.svn.wordpress.org/trunk@37656 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 04:07:47 +00:00
Boone Gorges ca05a4b43d Comments: In `wp_list_comments()`, queries with custom pagination params should obey default `comment_status` logic.
When custom pagination parameters are passed to `wp_list_comments()`, a
secondary query must be performed to fetch the proper comments. See [36157].
This query should show comments of the same `comment_status` as the default
query initialized in `comments_template()`: show only comments that are
approved, or those that are unapproved but belong to the current user.

Props smerriman.
Fixes #37048.

git-svn-id: https://develop.svn.wordpress.org/trunk@37655 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 04:00:18 +00:00
Gary Pendergast 5c4a15d0fc Tests: Disable `foreign_key_checks` while dropping existing tables.
To ensure a clean run, the test suite drops all tables before installing, by simply looping over the table list and dropping them if they exist. This works well for Core, but may fail when a plugin has created a table with foreign key constraints in a previous test run.

Many plugins choose to base their test suite on the Core setup, so making life easier for them is a plus, even if Core doesn't directly need this change.

Props javorszky.

Fixes #37046.



git-svn-id: https://develop.svn.wordpress.org/trunk@37654 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 03:03:16 +00:00
Jeremy Felt 6da085cfe4 Multisite: Deprecate `wp_get_sites()`
Defer to the new `get_sites()` replacement, offering fresh (...or cached) `WP_Site` objects via the new `WP_Site_Query`.

Props flixos90.
Fixes #36994.


git-svn-id: https://develop.svn.wordpress.org/trunk@37653 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 03:02:34 +00:00
Jeremy Felt 53ec2e744d Multisite: Remove the output parameter from `get_site()`
Full `WP_Site` objects should be expected from `get_site()` rather than arrays.

In the single (soon to be deprecated) use of arrays for this in core, we can cast the result to `(array)` for back-compat.

See #35791.


git-svn-id: https://develop.svn.wordpress.org/trunk@37652 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 02:47:48 +00:00
Jeremy Felt 727a94b710 Admin: Allow for the consistent filtering of `auth_redirect_scheme`
Fixes #37047.


git-svn-id: https://develop.svn.wordpress.org/trunk@37651 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-07 20:48:24 +00:00
Aaron Jorbin 8ad4a72960 Build/Test Tools: Run prerelease as the precommit task for configuration file changes
Whenever package.json or Gruntfile.js is updated, we should assume that it affects everything and run the full monty of tasks.

Fixes #36528.
Props iseulde.



git-svn-id: https://develop.svn.wordpress.org/trunk@37650 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-07 03:32:22 +00:00
Boone Gorges a1e19248a3 Tests: Compare `wp_set_object_terms()` results using `term_taxonomy_id`.
`term_id` and `term_taxonomy_id` become offset when running the entire test
suite.

Introduced in [37647].

See #37009.

git-svn-id: https://develop.svn.wordpress.org/trunk@37649 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 23:42:43 +00:00
Dominik Schilling (ocean90) 30b1f09c21 Widgets: Revert [37425] and [37427].
The change can cause fatal errors under certain conditions, like when the subclass has a different function signature for `widget()` or doesn't even implement the method.

See #35981.

git-svn-id: https://develop.svn.wordpress.org/trunk@37648 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 21:50:29 +00:00
Boone Gorges 8d40956f7a Tests: Add tests demonstrating `wp_set_object_terms()` behavior when matching `$terms`.
See #37009.

git-svn-id: https://develop.svn.wordpress.org/trunk@37647 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 21:34:22 +00:00
Rachel Baker 25c3618138 REST API: Create the general `wp_check_jsonp_callback()` function for validating JSONP callback functions.
Move the REST API JSONP callback validation check into a separate function named `wp_check_jsonp_callback()`. This allows plugins to use the built-in validation when handling JSONP callbacks.
Extremely Important Note: If you send JSONP in your custom response, make sure you prefix the response with `/**/`. This will mitigate the Rosetta Flash exploit. You should also send the `X-Content-Type-Options:nosniff` header, or even better, use the REST API infrastructure.

Props rmccue.
Fixes #28523.

git-svn-id: https://develop.svn.wordpress.org/trunk@37646 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 21:33:30 +00:00
Dominik Schilling (ocean90) 9da22fc4d9 Template: Pass `$blog_id` to the `get_custom_logo` filter.
Props achbed, juanfra.
Fixes #36639.

git-svn-id: https://develop.svn.wordpress.org/trunk@37645 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 21:23:38 +00:00
Boone Gorges cc7d91f141 Tests: Move `wp_set_object_terms()` tests to their own file.
This is a redo of [37642], this time not done in the not right place.

See #37009.


git-svn-id: https://develop.svn.wordpress.org/trunk@37644 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 21:22:43 +00:00
Boone Gorges b189d26960 Add test demonstrating that `wp_insert_term()` will suffix a slug if the new term's auto-generated slug matches that of an existing term.
See #37009.

git-svn-id: https://develop.svn.wordpress.org/trunk@37641 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 21:03:34 +00:00
Drew Jaynes 885d38edc8 Nav Menus: Move the `Walker_Nav_Menu` class to its own file.
The new class-walker-nav-menu.php file is loaded in nav-menu-template.php for backward compatibility purposes.

Fixes #37035. See #33413.


git-svn-id: https://develop.svn.wordpress.org/trunk@37640 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 15:17:46 +00:00
Drew Jaynes 9b5026a06e Docs: Relocate some `@see` tags and add missing `@access` tags to method and property DocBlocks in `Walker_Nav_Menu`.
See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@37639 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 05:46:20 +00:00
Drew Jaynes bc4136f6db Docs: Reformat several parameter descriptions in `Walker_Nav_Menu` to directly reference `wp_nav_menu()` rather than use inline `@see` tags.
See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@37638 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 05:44:29 +00:00
Ryan McCue f08e167be8 Autoload: Add missed @since tags to SPL shim.
See #36926.


git-svn-id: https://develop.svn.wordpress.org/trunk@37637 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 03:58:10 +00:00
Ryan McCue e6092b8b07 Autoload: Introduce shim for SPL autoloading.
For PHP 5.2, SPL can be disabled. As SPL provides the support for multiple autoloaders, this needs to be shimmed if not available.

Fixes #36926.


git-svn-id: https://develop.svn.wordpress.org/trunk@37636 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 03:23:38 +00:00
Dominik Schilling (ocean90) 5259f34578 Upgrader: Don't use `Language_Pack_Upgrader_Skin::before()` and `Language_Pack_Upgrader_Skin::after()` when translations are up to date.
Avoids a PHP notice since `Language_Pack_Upgrader_Skin::before()` tries to access a non-existent update.
Also, change the `up_to_date` string to use the plural form because translations are only updated in bulk mode.

Fixes #36615.

git-svn-id: https://develop.svn.wordpress.org/trunk@37635 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-05 12:21:38 +00:00
Boone Gorges a77ffd8e83 Taxonomy: No, really, don't pass results of 'count' query through 'get_terms' filter.
[37623] used the wrong parameter name (count=true instead of fields=count).

For greater flexibility and forward compatibility with other potential changes
to the return value of `get_terms()`, we now do a looser check: any non-array
value is excluded from the filter.

Fixes #36992.

git-svn-id: https://develop.svn.wordpress.org/trunk@37634 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-04 12:19:15 +00:00
Jeremy Felt 91859d2098 Multisite: Add initial tests for `WP_MS_Sites_List_Table`
Different tests are used for subdomain and subdirectory installs as domain and path are searched differently for each. Only trailing wildcard searches are tested because leading wildcards are not yet supported.

See #36675.


git-svn-id: https://develop.svn.wordpress.org/trunk@37633 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-03 14:38:01 +00:00
Gary Pendergast e7bbb482d6 Editor: 'undefined' !== 'undefiend'
Fix a typo in [37630].

See #36662.



git-svn-id: https://develop.svn.wordpress.org/trunk@37632 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-03 04:53:21 +00:00
Boone Gorges 9f21bd49bc Add tests for `remove_query_arg()`.
Props borgesbruno.
Fixes #37008.

git-svn-id: https://develop.svn.wordpress.org/trunk@37631 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-03 04:30:23 +00:00
Andrew Ozz 7d82fb2ee0 Editor: do not use the `modal-open` class to determine when the wpLink modal is open. This is a class used in Bootstrap and may be present when wpLink is not open. Store the open/closed state instead.
Fixes #36662.

git-svn-id: https://develop.svn.wordpress.org/trunk@37630 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 23:57:32 +00:00
Jeremy Felt 6792df6fab Multisite: Remove superfluous code from `network_edit_site_nav()`
* Remove output buffering.
* Remove `esc_attr()` when outputting hard coded class names.
* Update documentation.

Fixes #15800.


git-svn-id: https://develop.svn.wordpress.org/trunk@37629 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 22:28:17 +00:00
Jeremy Felt 9bbc0df8d8 Multisite: Replace `$wpdb->blog` queries in `get_site_by_path()` with `get_sites()`
Props spacedmonkey, DrewAPicture.
See #35791.


git-svn-id: https://develop.svn.wordpress.org/trunk@37628 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 21:45:20 +00:00
Andrew Ozz 245709dcd1 Auto-embedding:
- We already match URLs on their own line, add another regex to match URLs in their own paragraphs.
- Always exclude the `\s<>"` characters when matching.
- Add more unit tests.

Props iseulde, azaozz.
Fixes #25387.

git-svn-id: https://develop.svn.wordpress.org/trunk@37627 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 21:23:43 +00:00
Aaron Jorbin f1fdf6a1e8 Introduce filters for skipping parts of the bootstrap process
Non web interfaces with WordPress (such as wp-cli) need to be able to bypass certain checks in the bootstrap process. This introduces three new filters to allow for those checks to be skipped.

1. Provides a way of forcefully bypassing wp_maintenance().
2. Provides a way of forcefully bypassing wp_debug_mode(). See https://github.com/wp-cli/wp-cli/issues/177
3. Provide a way of forcefully skipping loading wp-content/advance-cache.php. See https://github.com/wp-cli/wp-cli/pull/164

These filters should not be used by plugins (in fact, they run before plugins are loaded, so they can't be used by plugins). In general, they should only be used in non-web interactions with WordPress.

See #34936.
Props jorbin, DrewAPicture.


git-svn-id: https://develop.svn.wordpress.org/trunk@37626 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 18:46:51 +00:00
Boone Gorges 1f5147bf83 Comments: Improve caching for hierarchical queries.
Hierarchical comment queries work by first fetching the IDs of top-level
comments, and then filling the descendant tree one level at a time based on the
top-level results. When top-level comment IDs are found in the cache,
`WP_Comment_Query` does not generate the SQL used to fetch these comments. In
this case, the `fill_descendants()` query does not have enough information
to fill children. As a result, descendant comments were failing to be filled
in cases where the top-level comments were found in the cache.

This was a minor bug previously, because comment caches were not maintained
between pageloads. Since comment caches are now persistent [37613], the problem
becomes evident anywhere that a persistent object cache is in use.

The solution is to cache parent-child relationships, so that when top-level
comments are found in the cache, descendant comments should be found there as
well.

Fixes #36487.

git-svn-id: https://develop.svn.wordpress.org/trunk@37625 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 18:27:43 +00:00
Rachel Baker 230f2986fb Comments: Remove debugging code left in `WP_Comments_List_Table->get_views()`.
Originally introduced in [9556] and leftover from [15578].

Props dabnpits.
Fixes #36938.

git-svn-id: https://develop.svn.wordpress.org/trunk@37624 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 15:06:29 +00:00
Boone Gorges f6a2067d37 Taxonomy: Don't pass results of 'count' query through 'get_terms' filter.
Use of the 'get_terms' filter was consolidated in [37572], with the
introduction of `WP_Term_Query`. At that time, the result of 'count=true'
queries began being filtered by 'get_terms'. This breaks existing 'get_terms'
callbacks, which often assume that the returned value will be an array or a
`WP_Error` object.

Props JustinSainton.
Fixes #36992.

git-svn-id: https://develop.svn.wordpress.org/trunk@37623 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 14:37:55 +00:00
Boone Gorges ab228ff84d Remove unused variable from `get_terms()`.
Missed in [37572]. See #35381.

Props JustinSainton.
See #36992.

git-svn-id: https://develop.svn.wordpress.org/trunk@37622 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 14:28:35 +00:00
Andrew Ozz 5f4b2877f9 Editor wpLink: swap the order of `innerText` and `textContent` to avoid getting styled text in IE.
Props dougwollison.
Fixes #36783.

git-svn-id: https://develop.svn.wordpress.org/trunk@37621 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 03:08:02 +00:00
Jeremy Felt 21fa6e2e9b Multisite: Replace `$wpdb->blog` queries in `ms-functions.php` with `get_sites()`
`get_sites()` is now used in:
* `domain_exists()`
* `wp_update_network_site_counts()`
* `get_blog_id_from_url()`

Props spacedmonkey, jeremyfelt.
See #35791.


git-svn-id: https://develop.svn.wordpress.org/trunk@37620 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 02:25:56 +00:00
Andrew Ozz 3afb9f4839 Editor: ensure the page is refreshed when the users navigate to it with the Back or Forward buttons. In these cases the browsers usually load the page from (memory) cache and it contains the old editor content.
Fixes #35852.

git-svn-id: https://develop.svn.wordpress.org/trunk@37619 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 01:29:25 +00:00
Jeremy Felt 014fda7a20 Multisite: Bump `last_changed` cache on site update and creation
When a site is added, updated, or deleted, the `site_ids` cache for a query will no longer be reliable. Bumping `last_changed` will force a new query for site IDs.

See #35791.


git-svn-id: https://develop.svn.wordpress.org/trunk@37618 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 00:58:40 +00:00
Jeremy Felt caf0e9a151 Multisite: Replace `wp_get_sites()` internals with `get_sites()`
`get_sites()` should be considered a replacement for `wp_get_sites()`. Backward compatibility is maintained in the meantime by using `get_site()` to populate the return data with associative arrays rather than `WP_Site` objects.

Props spacedmonkey, flixos90.
See #35791.


git-svn-id: https://develop.svn.wordpress.org/trunk@37617 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-01 23:38:40 +00:00
Jeremy Felt e97e6bce70 Multisite: Introduce get_sites()
`get_sites()` is a wrapper for `WP_Site_Query`.

Props spacedmonkey, DrewAPicture.
See #35791.


git-svn-id: https://develop.svn.wordpress.org/trunk@37616 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-01 23:20:39 +00:00