Commit Graph

35300 Commits

Author SHA1 Message Date
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
Scott Taylor
d227752665 Load: move WP_MatchesMapRegex into its own file.
See #37827.


git-svn-id: https://develop.svn.wordpress.org/trunk@38376 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 18:10:23 +00:00
Scott Taylor
c82c1b828b Script Loader: move _WP_Dependency into its own file.
See #37827.


git-svn-id: https://develop.svn.wordpress.org/trunk@38375 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 18:05:29 +00:00
Scott Taylor
aad8b9805e Load: remove class-feed.php (There is no class named Feed or WP_Feed, it just loads other classes) and, instead, move the require calls to the only place they are ever included: inside fetch_feed(). This simplifies the include path.
Tested with this feed in a widget: `http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml`.

See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38374 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 17:52:05 +00:00
wonderboymusic
223b79162c Load: remove session.php and, instead, move the 2 require calls to wp-settings.php. This simplifies the include path.
See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38373 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 17:43:03 +00:00
Boone Gorges
ff0386b5c1 Use shared fixture in comment_exists() tests.
Props Frank Klein.
Fixes #37842.

git-svn-id: https://develop.svn.wordpress.org/trunk@38372 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 17:41:51 +00:00
Scott Taylor
3a4811afb4 Load: load class-phpass.php (PasswordHash class) early in wp-settings.php, instead of require_once()'ing it in several places.
See #36335.


git-svn-id: https://develop.svn.wordpress.org/trunk@38371 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 17:39:37 +00:00
John Blackbourn
dac30944ff Docs: Alignment after [38369].
See #37770


git-svn-id: https://develop.svn.wordpress.org/trunk@38370 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 16:50:58 +00:00
John Blackbourn
87c1b26ee7 Docs: Correct various documentation around object and stdClass types.
See #37770


git-svn-id: https://develop.svn.wordpress.org/trunk@38369 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 16:48:17 +00:00
John Blackbourn
bc38f711cf Embeds: Add a missing regex delimiter for Facebook URLs.
See #34737


git-svn-id: https://develop.svn.wordpress.org/trunk@38368 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 12:16:56 +00:00
John Blackbourn
cb0048a6c5 Embeds: Add support for embedding Facebook posts and videos via oEmbed.
Fixes #34737
Props pento, GaryJ


git-svn-id: https://develop.svn.wordpress.org/trunk@38367 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 11:56:47 +00:00
John Blackbourn
d9b3ae759a Embeds: Many of our oEmbed providers now default to HTTPS embeds, redirect to the HTTPS oEmbed endpoint, or have complete support for HTTPS even if they don't default to HTTPS.
This change defaults to using HTTPS endpoints for oEmbeds for those providers that have full HTTPS support and don't redirect back to HTTP when clicking through from the embed. It covers:

* Vimeo
* SmugMug
* Scribd
* WordPress.tv
* SoundCloud
* Meetup
* issuu
* Mixcloud
* TED

See #28507


git-svn-id: https://develop.svn.wordpress.org/trunk@38366 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 11:24:38 +00:00
John Blackbourn
acc91a60e0 Embeds: Always use the HTTPS endpoint for YouTube embeds. The scheme parameter is no longer required as all YouTube assets now use HTTPS.
See #36274, #28507
Props zsusag, tollmanz


git-svn-id: https://develop.svn.wordpress.org/trunk@38365 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 10:38:05 +00:00
Scott Taylor
4de1595d47 i18n: move is_rtl() to l10n.php (which loads way earlier). Load WP_Locale file in wp-settings.php. Retire wp-includes/locale.php - it only loaded the class and the one function, is_rtl(). If someone loaded this file for fun somewhere else, it would be a fatal error.
See #37827.


git-svn-id: https://develop.svn.wordpress.org/trunk@38364 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 10:19:26 +00:00
Scott Taylor
a048646021 Load: move is_wp_error() to load.php so that WP_Error is in a file by itself.
See #37827.


git-svn-id: https://develop.svn.wordpress.org/trunk@38363 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-26 09:57:47 +00:00