Commit Graph

34681 Commits

Author SHA1 Message Date
Boone Gorges becae4f492 Query: Allow plugins to supply post results instead of having `WP_Query` fetch them from the database.
Returning a non-null value from the new `posts_pre_query` filter will cause
`WP_Query` to skip its database query, so that posts data can be provided from
elsewhere. This is useful in cases where post data may be mirrored in a
separate location, such as an external search application.

Developers should note that the `WP_Query` properties generally used to
calculate pagination - specifically, `found_posts` and `max_num_pages`, which
are determined by default in `set_found_posts()` - must be provided explicitly
when using the `posts_pre_query` filter; since `WP_Query` will not be
contacting the database, it will have no access to `SELECT FOUND_ROWS()`.
The `WP_Query` instance is passed to `posts_pre_query` by reference, so that
these properties can be set manually if needed.

Props jpdavoutian, tlovett1.
Fixes #36687.

git-svn-id: https://develop.svn.wordpress.org/trunk@37692 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-14 01:59:25 +00:00
Boone Gorges 3132836080 Taxonomy: More specific cap check when processing category data on post save.
Props dlh.
Fixes #36379.

git-svn-id: https://develop.svn.wordpress.org/trunk@37691 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-14 01:36:59 +00:00
Aaron Jorbin 84a19f4a93 Bootstrap/Load. Adjust filters added in [37626].
These adjustments improve the documentation for the filters and adjust the names make them more consistent with other filters already in core.

See #34936.
Props DrewAPicture, ocean90, jorbin


git-svn-id: https://develop.svn.wordpress.org/trunk@37690 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-12 02:42:02 +00:00
Jeremy Felt 2b2dde968b Login: Fire `wp_no_robots()` in `wp_die()` only if function exists.
This covers cases where `wp_die()` is used before `general-template.php` is loaded.

Fixes #34401.


git-svn-id: https://develop.svn.wordpress.org/trunk@37689 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-12 00:33:27 +00:00
Drew Jaynes 034b6c025d Docs: Improve first-order clause documentation for the `$meta_query` parameter in the constructor for `WP_Meta_Query`.
First-order meta query clauses are defined as clauses that have either a 'key' or 'value' array key. When using named first-order clauses in meta queries to order results in the parent query, `WP_Meta_Query` can additionally accept first-order clauses at the sub-clause level, which was not previous documented.

Fixes #32659.


git-svn-id: https://develop.svn.wordpress.org/trunk@37688 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-12 00:01:54 +00:00
Dominik Schilling (ocean90) 0461e41927 Upgrade: Trigger the `upgrader_process_complete` action for translation updates.
This brings `Language_Pack_Upgrader` in line with the core, theme, and plugin upgrader.

Props ronalfy.
Fixes #36872.

git-svn-id: https://develop.svn.wordpress.org/trunk@37687 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-11 17:43:17 +00:00
Drew Jaynes 3348efa466 Docs: Improve the return description for `wp_get_post_categories()` to include more information about possible return values.
Props jeherve for the initial patch.
Fixes #37002.


git-svn-id: https://develop.svn.wordpress.org/trunk@37686 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-11 17:07:35 +00:00
Dominik Schilling (ocean90) 979660717e Canonical: Introduce `wp_get_canonical_url()`.
`wp_get_canonical_url()` encapsulates the URL logic of `rel_canonical()` to provide a consistent way to retrieve the canonical URL for a post.
The new filter `get_canonical_url` allows to customize the canonical URL.

Props joostdevalk, jipmoors, DrewAPicture, ocean90.
Fixes #36168.

git-svn-id: https://develop.svn.wordpress.org/trunk@37685 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-11 13:30:23 +00:00
Andrew Ozz e65a667c9c Editor: prevent jumping when using the backspace button in the Text editor in Firefox and IE.
Fixes #37072.

git-svn-id: https://develop.svn.wordpress.org/trunk@37684 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-11 05:14:18 +00:00
Boone Gorges b9d46425c0 Introduce `term_taxonomy_id` parameter for `WP_Term_Query`.
Allows the fetching of terms based on `term_taxonomy_id`, or an array of
`term_taxonomy_ids`.

Props spacedmonkey.
Fixes #37074.

git-svn-id: https://develop.svn.wordpress.org/trunk@37683 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-11 03:48:03 +00:00
Boone Gorges beebded867 Tests: Move `WP_Tax_Query` tests to a more appropriate file.
The file they were living in is the rightful home of `WP_Term_Query` tests.

See #37074.


git-svn-id: https://develop.svn.wordpress.org/trunk@37682 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-11 03:26:07 +00:00
Andrea Fercia 2aebf33f9d Plugin Install: fix edge-case where the tab=upload page can be accessed directly.
The `?tab=upload` page still exists for no-js support and for users who may
access it directly (e.g. from bookmarks or history) or plugins doing the same.
In this page, the "Browse plugins" link should always behave like a link.

Fixes #35429.

git-svn-id: https://develop.svn.wordpress.org/trunk@37681 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-10 22:38:57 +00:00
Andrea Fercia 18ef7d6225 Accessibility: Help text improvements.
Avoid references to "visual" positions in favour of positions in the document
structure. The help text shouldn't assume users can see.

Also, in the Posts screen don't mention specific types of posts and use a more
generic text instead.

Props odysseygate, pansotdev, zakb8.
Fixes #34761.

git-svn-id: https://develop.svn.wordpress.org/trunk@37680 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-10 21:42:05 +00:00
Andrea Fercia a177094f56 Accessibility: Customizer, make the menu items "clear search results" a button.
For Web standards and accessibility, always prefer native controls instead of
`span` or `div` elements.

Fixes #36903.

git-svn-id: https://develop.svn.wordpress.org/trunk@37679 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-10 21:21:09 +00:00
Joe McGill 0d020faa68 Media: Fix rendering of incorrect toolbar in the Edit view.
This switches event binding in `wp.media.controller.EditImage` to use `on`
instead of `listenTo` to restore rendering of the correct toolbar when the
`toolbar:render:edit-image` event fires. The existing listeners broke
when we upgraded Backbone in [36546].

Props adamsilverstein.
Fixes #36861 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@37678 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-10 21:11:28 +00:00
Drew Jaynes 831a186108 Boostrap: Move `is_ssl()` to wp-includes/load.php.
Moving to load.php introduces parity with other commonly evaluated `is_*()` functions such as `is_admin()` or `is_multisite()`.  It also makes `is_ssl()` available much earlier in the loading process, such as for use in drop-ins like advanced-cache.php.

Props johnjamesjacoby.
Fixes #35844.


git-svn-id: https://develop.svn.wordpress.org/trunk@37677 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-10 18:55:33 +00:00
Joe McGill 73eb2c9cd4 Media: remove `_wp_upload_dir_baseurl()`.
`_wp_upload_dir_baseurl()` is a private function introduced in 4.4
as part of the "responsive images" feature. It was for runtime
caching of the URL to the uploads directory. It is deprecated in
4.5 with the introduction of `wp_get_upload_dir()`.

Outside core, it's only used as part of a back-compat shim in the
original feature plugin for responsive images (ricg-responsive-images),
which includes its own version of the function definition, so it's
safe to remove from core.

Fixes #36375.

git-svn-id: https://develop.svn.wordpress.org/trunk@37676 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-10 16:51:15 +00:00
Dominik Schilling (ocean90) 72c0d63d05 I18N: Simplify the WordPress update notice for translators.
* Make codex URL and accessibility text separate strings.
* Add translator comments.

Props ramiy for initial patch.
Fixes #35721.

git-svn-id: https://develop.svn.wordpress.org/trunk@37675 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-10 15:53:27 +00:00
Peter Wilson db0195c936 DOCS: Replace HTTP links with HTTPS.
Replaces unsecure links in documentation and translator comments with their secure versions.

Props johnpgreen, netweb

Fixes #36993


git-svn-id: https://develop.svn.wordpress.org/trunk@37674 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-10 04:49:09 +00:00
Drew Jaynes d470bd22dc Docs: Improve the DocBlock summary for `add_theme_support()`.
See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@37673 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-10 00:06:07 +00:00
Drew Jaynes d008c4e088 Docs: Add documentation for the variadic second parameter, `$args`, accepted by `add_theme_support()`.
h/t kevinwhoffman
Fixes #37067.


git-svn-id: https://develop.svn.wordpress.org/trunk@37672 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-10 00:02:34 +00:00
Drew Jaynes 5c645d8cde Docs: Improve documentation for the `$feature` parameter in the DocBlock for `add_theme_support()`.
See #32246. See #37067.


git-svn-id: https://develop.svn.wordpress.org/trunk@37671 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 20:33:57 +00:00
Jeremy Felt 15a12ce4f0 Multisite: Introduce `get_current_network_id()`
Similar to `get_current_blog_id`, this can be used to get the ID of the `$current_site` global. If not available, it will fallback to the main network ID. In single site, this will return 1.

Props spacedmonkey, flixos90.
Fixes #33900.


git-svn-id: https://develop.svn.wordpress.org/trunk@37670 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 20:33:35 +00:00
Drew Jaynes 8f79db7e54 Docs: Add extensive documentation to the `remove_accents()` DocBlock outlining the accented characters core replaces.
Covers:
* Currency signs
* Decompositions for Latin-1 Supplement
* Decompositions for Latin Extended-A
* Decompositions for Latin Extended-B
* Vowels with diacritic (Chinese, Hanyu Pinyin)
* Characters replaced for the `de_DE`, `de_DE_formal`, and `da_DK` locales 

Props john_schlick for the initial work.
Props DrewAPicture, ocean90.

See #34677.


git-svn-id: https://develop.svn.wordpress.org/trunk@37669 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 19:13:09 +00:00
Ella Iseulde Van Dorpe 644795a9dc TinyMCE: wptextpattern: fix for fast typing
Props jnylen0, iseulde.

Fixes #36585.



git-svn-id: https://develop.svn.wordpress.org/trunk@37668 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 19:06:25 +00:00
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