Commit Graph

35349 Commits

Author SHA1 Message Date
Scott Taylor 2748d489f0 Press This: in `wp_ajax_press_this_save_post()` and `wp_ajax_press_this_add_category()`, don't check for a global instance. `WP_Press_This` is a Controller, but not really a Singleton. This also keeps it from being a pluggable class, which it is right now.
See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38465 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-31 06:24:57 +00:00
Weston Ruter f9feaf1778 Customize: Improve handling of active state for dynamically-created controls/sections/panels.
When a customizer construct (panel, section, control) is not added in PHP, the JS has interpreted this to mean that a given construct should be deactivated (because it is gone). This is problematic for dynamically-created constructs in JS, as it has meant that the construct would also have to be created in PHP to ensure the `active` callback is called, or else a hack would be required to add a `construct.active.validate = function() { return true };` to forcibly prevent the construct from getting deactivated. 

These workarounds can be eliminated by treating constructs differently when they are created dynamically in JS (after page load) as opposed to being created statically in PHP (on the server). Namely, if a construct is dynamically-created then its absence in a preview refresh should not signal that the construct should be deactivated. Rather, a dynamic construct should only have its activation state toggled if it has a corresponding construct created in PHP when the preview refreshes to explicitly indicate its `active` state. Otherwise, the management of the `active` state for a construct created in JS should also be the responsibility of client-side code.

Props westonruter, sayedwp.
Fixes #37270.


git-svn-id: https://develop.svn.wordpress.org/trunk@38464 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-31 06:20:33 +00:00
wonderboymusic 9851ab5ded Query: in `wp_old_slug_redirect()`, use `get_query_var()` instead of importing and touching the global `$wp_query` directly.
See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38463 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-31 06:20:03 +00:00
wonderboymusic 988752b138 Press This: in `get_shortcut_link()`, just check a class constant on `WP_Press_This` instead of instantiating the object and reading an instance prop.
See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38462 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-31 06:07:01 +00:00
Scott Taylor 1825eff382 General: use `get_bloginfo( 'version' )` instead of `global $wp_version` in several locations - excluding those locations which reload `version.php` mid-flight.
See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38459 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-31 05:48:49 +00:00
Scott Taylor 2078dda129 Multisite: use `get_current_site()` instead of `$GLOBALS['current_site']` (stop yelling!) in a few remaining spots.
See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38458 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-31 05:03:37 +00:00
Scott Taylor 3605bd7633 Multisite: use `get_current_blog_id()` where applicable, in lieu of plucking the `$blog_id` global from outer space.
See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38457 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-31 04:55:01 +00:00
John Blackbourn 84c2742175 HTTP API: Revert changes to `wp_parse_url()` while PHP 5.2 errors are investigated.
See #36356


git-svn-id: https://develop.svn.wordpress.org/trunk@38456 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-31 00:23:26 +00:00
Scott Taylor 6d894b4274 List Tables: AJAX actions for List Tables do not need to declare `global $wp_list_table`. List tables on admin screens are in global scope, and they contain hooks that don't pass the the list table as context, hence using globals there so that functions can import them. That problem does not exist in the AJAX actions, which are virtually impossible to hook into as is.
See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38455 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 20:06:30 +00:00
Scott Taylor 7ca480cc4e OEmbed: add unit tests. `@group external-oembed` is not run by default.
Props johnbillion, wonderboymusic.
See #32360.


git-svn-id: https://develop.svn.wordpress.org/trunk@38454 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 18:54:53 +00:00
John Blackbourn 7734c6ac24 HTTP API: Separate the test for `wp_parse_url()` with `-1` as its component into a separate test, so the remaining tests can use strict type checking. This helps avoid gotches with the potentially empty values (ie. `null`) that we're testing for.
See #36356


git-svn-id: https://develop.svn.wordpress.org/trunk@38453 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 18:30:51 +00:00
John Blackbourn 8a6568945a HTTP API: The tests for `wp_parse_url()` can't be strict on type because this causes the tests to fail on PHP 5.2 which, bizarrely, returns the results of `parse_url()` (when called with a `$component` parameter) in a different order to later PHP versions.
Fixes #36356


git-svn-id: https://develop.svn.wordpress.org/trunk@38452 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 17:48:06 +00:00
John Blackbourn 1135308324 Posts, Post Types: Introduce a missing private query var that should have been introduced as part of #15459.
This private query var allows the hierarchical page query on the Pages listing screen to query for `wp_posts.ID, wp_posts.post_parent` instead of `wp_posts.*`. This introduces large memory and time savings when the site contains a large number of Pages. Combined with the processing time savings introduced in [31730] this makes the Pages listing screen considerably more performant.

Fixes #34982
Props rodrigosprimo


git-svn-id: https://develop.svn.wordpress.org/trunk@38451 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 17:39:38 +00:00
John Blackbourn ba5803c16e HTTP API: Prevent a fatal error on PHP < 5.4.7 due to changes introduced in [38449].
Fixes #36356


git-svn-id: https://develop.svn.wordpress.org/trunk@38450 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 17:15:54 +00:00
John Blackbourn 48f389015e HTTP API: Add a `$component` parameter to `wp_parse_url()` to give it parity with PHP's `parse_url()` function.
Fixes #36356
Props jrf


git-svn-id: https://develop.svn.wordpress.org/trunk@38449 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 16:35:33 +00:00
Andrea Fercia dd8591044a Accessibility: Hide the "No activity yet" smiley from assistive technologies.
Fixes #37511.


git-svn-id: https://develop.svn.wordpress.org/trunk@38448 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 16:13:31 +00:00
Pascal Birchler 19b838af8b Script Loader: Properly adjust tests missed in [38443].
See #37800.

git-svn-id: https://develop.svn.wordpress.org/trunk@38447 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 14:50:14 +00:00
Boone Gorges 2fc4e48d07 Comments: Don't do direct SQL query when fetching decendants.
The SQL query was built using the clauses compiled when querying for
top-level comments. But in cases where the top-level comment query
results are already in the cache, the SQL clauses are not built, and
so are unavailable for `fill_descendants()`. Instead, we call
`get_comments()`, using modified versions of the parameters passed
to the main `WP_Comment_Query` class.

Props Akeif, Rarst for testing.
Fixes #37696.

git-svn-id: https://develop.svn.wordpress.org/trunk@38446 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 14:48:00 +00:00
Boone Gorges f80068e75b Tests: Require `Basic_Object` and `Basic_Subclass` files earlier in call stack.
This ensures compatibility with third-party tools using these classes
in their test suites, after [38285].

Props DylanAuty, Frank Klein, TimothyBlynJacobs.
Fixes #37523.

git-svn-id: https://develop.svn.wordpress.org/trunk@38445 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 14:32:04 +00:00
Boone Gorges caf0e90b30 Tests: Add docblocks for `Basic_Object` and `Basic_Subclass` classes.
Props DylanAuty.
See #37523.

git-svn-id: https://develop.svn.wordpress.org/trunk@38444 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 14:31:56 +00:00
Sergey Biryukov bf41a5dc23 Script Loader: Close the `<link>` tag in `wp_resource_hints()`.
Props Chaos Engine.
Fixes #37800 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@38443 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 11:19:13 +00:00
Gary Pendergast 7fc579eec9 Database: Don't force an unsupported character set that previously would've silently failed.
[37320] corrected some behaviour in how PHP and MySQL character sets are matched up. This was correct, but had the side effect of causing some incorrectly configured sites to start failing.

Prior to [37320], if `DB_CHARSET` was set to `utf8mb4`, but the PHP version didn't support `utf8mb4`, it would fall back to the default character set - usually `latin1`. After [37320], the `SET NAMES` query would force MySQL to treat the connection character set as `utf8mb4`, even if PHP wasn't able to understand it.

By checking if `mysqli_set_charset()` succeeded, we can simulate the old behaviour, while maintaining the fix in [37320].

Props danielkanchev fo helping to diagnose this issue.
Fixes #37689 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@38441 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 07:37:59 +00:00
Gary Pendergast fd7979ad63 Database: Ensure that variables are defined correctly.
There were some cases where some local variables in `wpdb::init_charset()` could be undefined when they were used.

Props Frozzare.
Fixes #37683 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@38439 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 07:13:31 +00:00
Scott Taylor 003616dbd9 i18n: after r38364, check that `global $wp_locale` is an instance of `WP_Locale` before calling `->is_rtle()` in `is_rtl()`.
See #37827.


git-svn-id: https://develop.svn.wordpress.org/trunk@38438 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 05:56:13 +00:00
Boone Gorges 53016dd3aa Remove unnecessary uniqueness check in `get_attachment_taxonomies()`.
Running the taxonomy array through `array_unique()` is unnecessary
when the function returns objects, because the associative keys already
ensure uniqueness.

This also fixes a bug when running `get_attachment_taxonomies()` in
HHVM, which doesn't like casting objects to strings for the purposes
of `array_unique()`.

Props swissspidy.
See #37368.

git-svn-id: https://develop.svn.wordpress.org/trunk@38437 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 03:06:06 +00:00
Weston Ruter 7105787ced Customize: Allow users to more seamlessly create page-based nav menus during customization.
Introduces the ability to create stubs for the various post types to add to a given menu. This eliminates the need to leave the customizer to first create the post in the admin and then return to managing menus. Only the title of the newly-created post can be supplied; the post content will be blank and will need to be provided in the normal edit post screen outside the customizer, unless a plugin enables a post editing in the customizer experience. When a post is created and added to a nav menu in the customizer, the newly created post that is added to a menu is given the `auto-draft` status, and if the changes are not published, the `auto-draft` post will be automatically deleted within 7 days via `wp_delete_auto_drafts()`. However, if the customizer changes are saved, then these nav menu item `auto-draft` post stubs will be transitioned to `publish`.

Includes portions of code from the Customize Posts <https://github.com/xwp/wp-customize-posts> and Front-end Editor <https://github.com/iseulde/wp-front-end-editor> plugins.

For more information, see https://make.wordpress.org/core/2016/06/16/feature-proposal-content-authorship-in-menus-with-live-preview/

Props celloexpressions, westonruter, valendesigns, afercia, melchoyce, mapk, iseulde, mrahmadawais.
Fixes #34923.


git-svn-id: https://develop.svn.wordpress.org/trunk@38436 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-29 22:58:32 +00:00
Andrea Fercia 2936068f96 Accessibility: Improve the file upload inputs styling.
Though browsers implement `cursor: pointer` on this kind of controls a bit 
inconsistently, the `pointer` cursor styling makes more clear the button and
label are actionable controls.

Props Ankit K Gupta.
Fixes #35552.


git-svn-id: https://develop.svn.wordpress.org/trunk@38435 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-29 21:07:31 +00:00
John Blackbourn 88de856e57 Themes: Correct the type for the `$name` parameter of the `get_header`, `get_footer`, `get_sidebar`, and `get_template_part_{$slug}` hooks.
See #37770


git-svn-id: https://develop.svn.wordpress.org/trunk@38434 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-29 20:41:42 +00:00
Joe McGill 142fefb269 Post Thumbnails: Prevent post thumbnail previews from spilling into other images.
After [38118], when previewing a page with a secondary loop, all post
thumbnails would be filtered to display the post thumbnail for the
page being previewed. This ensures `_wp_preview_post_thumbnail_filter()`
is only applied if the `$post_id` of the post meta being filtered is
equal to the post or page being previewed.

Props swisspidy, joemcgill.
Fixes #37697.

git-svn-id: https://develop.svn.wordpress.org/trunk@38433 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-29 12:24:09 +00:00
John Blackbourn 6b23bbb92b Comments: Add support for all HTTP protocol versions when returning a 405 from `wp-comments-post.php`.
Fixes #37863
Props tnash


git-svn-id: https://develop.svn.wordpress.org/trunk@38432 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-29 11:59:45 +00:00
Dion Hulse 9d70a4495d Bootstrap: Check that `ini_get_all()` exists before calling it, allows us to work around hosts who disable the function for "security purposes".
Fixes #37680 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@38431 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-29 02:58:25 +00:00
Dion Hulse e916b9e14c HTTP: Accept non-string values in cookies, fixing a regression since 4.5.
Props swissspidy.
Fixes #37768 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@38430 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-29 02:41:56 +00:00
Dion Hulse 7f2a81061a HTTP: Handle an edgecase within the URI parsing library included in Requests, where if a double slash exists at the start of the path the URL is passed to cURL malformed.
Props flixos90 for initial patch.
Fixes #37733 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@38429 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-29 02:32:48 +00:00
John Blackbourn 3b723b31ee Themes: Correct the list of possible values for the dynamic portion of the `{$type}_template_hierarchy` and `{$type}_template` filters.
See #14310


git-svn-id: https://develop.svn.wordpress.org/trunk@38428 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 23:56:04 +00:00
Andrew Ozz 92802bfd23 TinyMCE: change the default font for the `vi` locale to the same stack as `he_IL`.
Props nmt90 for reporting and testing this.
Fixes #37755 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@38427 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 18:51:44 +00:00
Andrew Ozz 22ff75ac5e Editor: fix jumpiness on pressing backspace and delete in the Text editor.
Fixes #37690 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@38426 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 18:40:00 +00:00
Ella Iseulde Van Dorpe 99bc5e7fb6 Editor: Use Beacon API over sync request
See https://www.w3.org/TR/beacon/ for more information.



git-svn-id: https://develop.svn.wordpress.org/trunk@38425 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 18:28:52 +00:00
John Blackbourn 16bb82eb76 I18N: Correct various instances of incorrect usage of `esc_attr_e()`.
Fixes #37457
Props henry.wright, afercia


git-svn-id: https://develop.svn.wordpress.org/trunk@38424 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 18:05:02 +00:00
John Blackbourn 9033b02e43 Upgrade/Install: Don't display PHP errors during installation.
If a user is installing WordPress for the first time and has set `WP_DEBUG` to true, a PHP error during installation makes for a visually jarring experience.

Fixes #37358


git-svn-id: https://develop.svn.wordpress.org/trunk@38423 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 17:49:05 +00:00
John Blackbourn da865e68b7 Formatting: Add a parameter to `wp_send_json_error()`, `wp_send_json_success()`, and `wp_send_json()` for specifying the HTTP response code.
Defaults to `200` in all cases, but can be used, for example, to return a `403` when using `wp_send_json_error()`.

Fixes #35666
Props stephenharris


git-svn-id: https://develop.svn.wordpress.org/trunk@38422 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 17:41:25 +00:00
John Blackbourn 289581e280 Security: Return a `403` instead of a `200` HTTP status when `check_ajax_referer()` fails.
This is, unfortunately, untestable in the current test suite, even in the AJAX tests.

Fixes #36362


git-svn-id: https://develop.svn.wordpress.org/trunk@38421 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 17:30:29 +00:00
John Blackbourn a03376e798 Security: Trigger a `_doing_it_wrong()` when `check_ajax_referer()` is called without its first parameter. This brings it inline with `check_admin_referer()`.
Fixes #36361


git-svn-id: https://develop.svn.wordpress.org/trunk@38420 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 17:14:52 +00:00
John Blackbourn c786774d21 Themes: Introduce tests for the theme template hierarchy.
See #14310


git-svn-id: https://develop.svn.wordpress.org/trunk@38419 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 16:18:51 +00:00
John Blackbourn 6ab9dc2dba Themes: Update filter names in the inline documentation for the `get_*_template()` functions.
See #14310, #37770


git-svn-id: https://develop.svn.wordpress.org/trunk@38418 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 16:14:53 +00:00
John Blackbourn 58956ecf2d Permalinks: Correct an invalid peramstructure tag in a test.
Fixes #37858


git-svn-id: https://develop.svn.wordpress.org/trunk@38417 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 12:52:23 +00:00
Pascal Birchler 9701c29b90 Bootstrap: Fix failing external HTTP tests after [38411].
When testing the transports, the transport name needs to be capitalized for the class name to be correct (`WP_Http_Curl` vs. `WP_Http_curl` ).

See #36335.

git-svn-id: https://develop.svn.wordpress.org/trunk@38416 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 10:33:24 +00:00
swissspidy 536d18babb Upgrade/Install: After [37687], fix the number of params passed to the upgrade hooks.
`wp_version_check()`, `wp_update_plugins()` and `wp_update_themes()` are all originally hooked to the `upgrader_process_complete` action with zero arguments passed to them. Zero arguments should be passed when re-adding them after translation updates, otherwise the sky will fall.

Props ionutst, gitlost.
Fixes #37731.

git-svn-id: https://develop.svn.wordpress.org/trunk@38415 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 10:03:02 +00:00
Scott Taylor 5f7706e5e8 Admin: allow `WP_Screen` to be checked via autoload in `convert_to_screen()`.
Props kraftbj.
See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38414 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 02:24:14 +00:00
John Blackbourn 7bb34dc5d9 Query: Add and improve tests for query conditionals on the front page and home page.
See #37851


git-svn-id: https://develop.svn.wordpress.org/trunk@38413 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 02:01:53 +00:00
Scott Taylor 20dae52ec9 Script Loader: autoload in `load-{scripts|styles}.php`.
Props JohnPBloch.
See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38412 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-28 00:06:45 +00:00