Commit Graph

35214 Commits

Author SHA1 Message Date
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
Scott Taylor 07fe41b23d Bootstrap: exclude some files from the Composer autoload setup via `exclude-from-classmap`.
See #36335.



git-svn-id: https://develop.svn.wordpress.org/trunk@38391 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 22:21:00 +00:00
johnbillion 8139765b1f Themes: Begin introducing unit tests for the expected theme template hierarchy. More to come.
See #14310


git-svn-id: https://develop.svn.wordpress.org/trunk@38390 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 22:19:16 +00:00
Scott Taylor 0ff32a41b0 XML-RPC: break up `class-IXR.php` into individual class files.
See #37827.


git-svn-id: https://develop.svn.wordpress.org/trunk@38389 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 22:07:14 +00:00
Scott Taylor 55f5577813 Multisite: move `get_current_site()` to `load.php` so that it can be used in more places, instead of importing `global $current_site`.
See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38388 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 21:34:36 +00:00
Scott Taylor aa2fcba472 Roles: set a property, `$db`, on `WP_Roles` to reduce global imports.
See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38387 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 21:15:22 +00:00
Scott Taylor 3586ac294f Bootstrap: load `option.php` in `wp-settings.php`, not in `functions.php`.
See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38386 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 21:10:30 +00:00
John Blackbourn 9df1424d88 Themes: Make the template hierarchy for a given template type filterable.
This introduces a `{$type}_template_hierarchy` filter that allows the hierarchy of candidate template filenames for a given template type to be filtered.

This allows the hierarchy to be added to or altered completely without resorting to re-building the hierarchy from scratch within the `template_include` filter, which is common and prone to conflicts between plugins and prone to getting out of sync with core's hierarchy.

Fixes #14310


git-svn-id: https://develop.svn.wordpress.org/trunk@38385 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 21:02:08 +00:00
Scott Taylor 39a145e0e1 Bootstrap: add a `composer.json` file to the project. No code relies on it (yet), and no `vendor` dir is checked in (yet). No autoloader is being used (yet). Taking this first step will hopefully encourage the perfectionists of our world to scrutinize each line.
To fiddle around with what it does, run `composer install` from the project root. If you do not have Composer installed:
https://getcomposer.org/doc/00-intro.md#locally

tl;dr for Mac/Homebrew users: `brew install composer`

Classes from `wp-includes` and `wp-admin` are eligible for autoloading via `autoload.classmap`. Through a tornado of recent commits, many unsuitable files have been transitioned into a more acceptable state for autoloading: 1 file per class, no side effects.

The file bootstrap in `wp-settings.php` can transition into `autoload.files`. This will be done with care and attention.

See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38384 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 20:59:54 +00:00
Scott Taylor db0e1ed0af Unit Tests: after r38303, replace usage of `global $_wp_additional_image_sizes` with `wp_get_additional_image_sizes()`.
See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38383 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 20:50:24 +00:00
John Blackbourn e795f6da1d Build/Test Tools: Remove many unnecessary calls to `rand_str()` which can, in theory, fail at random. Static strings are much more appropriate.
See #37371


git-svn-id: https://develop.svn.wordpress.org/trunk@38382 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 20:21:30 +00:00
Boone Gorges 6eaa56f3d4 Don't improperly cast IDs when fetching post, user, or term objects.
Blindly casting passed IDs to integers can generate false positives
when the ID is cast to `1`.

Props deeptiboddapati.
Fixes #37738.

git-svn-id: https://develop.svn.wordpress.org/trunk@38381 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 19:08:23 +00:00
Scott Taylor 8b431f6859 FTP: ensure that there is only one class named `ftp`, which is what is expected in the loading of this arcane library. This ensures that an autoload generator, something along the lines of Composer, won't hiccup when it gets to these files.
See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38380 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 18:46:17 +00:00
Scott Taylor a581574b3a Upgrade/Install: `wp-admin/includes/class-wp-upgrader-skins.php` is unused, remove it. All of the same includes are loaded in `class-wp-upgrader.php`.
See #37827.


git-svn-id: https://develop.svn.wordpress.org/trunk@38379 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 18:24:40 +00:00
John Blackbourn 5e71c349af Role/Capability: Only users who can manage options should be able to trash/delete the page for posts or the front page, as they are the only users who can restore it or subsequently alter the "Front page displays" setting.
Fixes #37580
Props JakePT


git-svn-id: https://develop.svn.wordpress.org/trunk@38378 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 18:22:28 +00:00
Boone Gorges f21f8c1076 Eliminate unnecessary variable in `WP_Term_Query`.
Props ocean90.
Fixes #37544.

git-svn-id: https://develop.svn.wordpress.org/trunk@38377 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 18:10:56 +00:00