Commit Graph

35079 Commits

Author SHA1 Message Date
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
Scott Taylor
4225e71a6b Bootstrap: after r38409 and r38410, revert r38402 which reverted r38399.
This fixes the paths in `wp-vendor/` that were including `src`. I want to drop this in so we can find out what else will break.

See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38411 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 22:31:11 +00:00
Scott Taylor
06b6097bca Bootstrap: run composer install after r38409.
See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38410 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 19:08:18 +00:00
Scott Taylor
7b0cd0ac85 Bootstrap: move composer.{json|lock} into src.
See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38409 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 19:05:28 +00:00
John Blackbourn
551fa31b5a Media: Add a $wp_error parameter to wp_insert_attachment() to give it parity with wp_insert_post().
Fixes #37813
Props grapplerulrich, mrahmadawais


git-svn-id: https://develop.svn.wordpress.org/trunk@38408 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 17:24:58 +00:00
John Blackbourn
f59a3b54c8 Build/Test tools: Ensure the Tests_Query_Conditionals tests set up the environment correctly before re-registering initial taxonomies.
Fixes #37851


git-svn-id: https://develop.svn.wordpress.org/trunk@38407 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 17:02:54 +00:00
John Blackbourn
fccaf594c7 Users: Correct the documentation for the wp_dropdown_users_args filter description and its parameters.
See #37770


git-svn-id: https://develop.svn.wordpress.org/trunk@38406 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 16:53:08 +00:00
John Blackbourn
417de45c08 Build/Test Tools: Add support for is_front_page() to assertQueryTrue() and assert that all the tested conditions are supported by the method.
Fixes #37849


git-svn-id: https://develop.svn.wordpress.org/trunk@38405 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 15:27:35 +00:00
Dion Hulse
7b275f6a07 i18n: Retire another remaining wp-includes/locale.php require, and instead load the required WP_Locale class directly.
See #37827.


git-svn-id: https://develop.svn.wordpress.org/trunk@38404 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 15:12:18 +00:00
John Blackbourn
52acaaad50 Themes: Remove failing tests introduced in [38390].
See #14310


git-svn-id: https://develop.svn.wordpress.org/trunk@38403 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 14:52:56 +00:00
Dion Hulse
e353179ce5 Bootstrap: Revert [38399] as it's broken /build/ and subsequently core.svn.wordpress.org.
The generated classmaps reference `/src/` files and operates in the assumption that the base directory is one level above `wp-settings.php`, which it isn't after our build processes are run.

See #36335


git-svn-id: https://develop.svn.wordpress.org/trunk@38402 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 14:36:42 +00:00
Pascal Birchler
68175f94c3 After [38399], update the .gitignore file accordingly.
The following files have been added to `svn:ignore` already as they are not compatible with PHP 5.2:

* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php

See #36335.

git-svn-id: https://develop.svn.wordpress.org/trunk@38401 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 11:28:11 +00:00
Peter Wilson
b8f88aa597 Unit tests: Enforce $args object in wp_nav_menu() & Walker_Nav_Menu.
WordPress always* passes $args to filters as an array of arugments. A exception is made in `wp_nav_menu()` and the associated walker where these are passed to filters as an object, this has been the case for seven years (since [13368]).

These new tests enforce the use of an object in these filters to ensure backward compatibility is maintained.

See #24587.


git-svn-id: https://develop.svn.wordpress.org/trunk@38400 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 11:27:17 +00:00
Scott Taylor
388690382c Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.
* `wp-admin` and `wp-includes` are scanned for classes to autoload
* Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see `composer.json`: `autoload.exclude-from-classmap`
* `wp-vendor/autoload_52.php` is included at the top of `wp-settings.php` - no changes need to be made to unit tests to include the autoloader
* An avalanche of `require()` and `require_once()` calls that loaded class files have been removed from the codebase.

The following files have been added to `svn:ignore` - they are not 5.2-compatible and fail during pre-commit:
* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php

We favor these files instead:
* src/wp-vendor/autoload_52.php
* src/wp-vendor/composer/autoload_real_52.php
* src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run `composer install` or `composer update` from the project root to update the autoloader.

The future is now.

See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38399 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 09:15:01 +00:00
Scott Taylor
02319efa71 Unit Tests:
* Automatically delete objects that we were created during `wpSetUpBeforeClass` - posts, comments, terms (except 1), and user (except 1)
* The amount of leftover data between tests was breathtaking - use the new function: `_delete_all_data()`
* Commit database transactions for all `TestCase`s, not just those that implement `wpSetUpBeforeClass` and `wpTearDownAfterClass`
* The tests run 10-20 seconds faster now

See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38398 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 08:35:16 +00:00
Scott Taylor
f0af25bd80 Press This: the file for the WP_Press_This class should not produce side effects. Similar to what we did in r38355 for WP_Site_Icon, drop the instances of global instantiation for $wp_press_this via loading the file. The variable can be set inline when necessary. In most of those places, if the global is already set, the file does not load and stomp it currently.
See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38397 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 06:06:50 +00:00
Weston Ruter
a8b98b7924 Customize: Circumvent the customizer attempting to preview links to static assets (such as uploaded images).
The customizer's preview POST requests to static assets result in 405 Method Not Allowed responses.

Fixes #37828.


git-svn-id: https://develop.svn.wordpress.org/trunk@38396 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 06:04:42 +00:00
Scott Taylor
5d4485b184 Bootstrap: exclude more files from the autoloader.classmap in composer.json.
See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38395 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 05:39:31 +00:00
Scott Taylor
0da2aa2434 Bootstrap: add composer.lock and src/wp-vendor files. Nothing is using this code yet, just going through the motions. Ignore the files in src/wp-vendor/composer that will explode in PHP 5.2.
See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38394 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 03:48:08 +00:00
Scott Taylor
1c52ad1196 Bootstrap: run composer require xrstf/composer-php52 to get the updated suggested version. Change the vendor-dir to wp-vendor.
See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38393 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-27 03:35:35 +00:00
Scott Taylor
c6731b76ac List Tables: move _WP_List_Table_Compat into its own file.
See #37827.


git-svn-id: https://develop.svn.wordpress.org/trunk@38392 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 22:22:58 +00:00