Use the primary `meta_query` clause when parsing `orderby` in `WP_Query`.

When using legacy `meta_key`, `meta_value`, etc. arguments in `WP_Query`,
they're converted into the first clause of a `meta_query`. By using that
clause instead of the original arguments, we make sure that behavior is
consistent between the two available formats.

props boonebgorges.
fixes #16814.

Built from https://develop.svn.wordpress.org/trunk@29855


git-svn-id: http://core.svn.wordpress.org/trunk@29618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Language packs: Remove translations when deleting a theme or a plugin.

This is for translation files in WP_LANG_DIR which are installed through a language pack.
Change `wp_get_installed_translations()` to only return a translation if the .mo file also exists.

fixes #29860.
Built from https://develop.svn.wordpress.org/trunk@29856


git-svn-id: http://core.svn.wordpress.org/trunk@29619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Explicitly declare hierarchical=false for post_tag in create_initial_taxonomies().

In certain edge cases, such as during the automated test suite,
create_initial_taxonomies() can be called in a situation where a non-default
permastruct setting has been saved outside of wp-admin. This causes the
'hierarchical' setting for the post_tag taxonomy to remain unset, leading to
PHP notices in get_term_link().

See #29827.
Built from https://develop.svn.wordpress.org/trunk@29859


git-svn-id: http://core.svn.wordpress.org/trunk@29620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Handle deficiencies in PHP's parse_url in older versions of PHP (<5.4.7) in WP_HTTP::make_absolute_url().

In older versions of PHP:
- parse_url() will fail to parse a url where the scheme break (://) is present in a relative URL's path
- parse_url() will include the hostname of a schemeless URL in the path component

This handles those two types of URL's by correcting the response from parse_url().

Fixes #28001, #29886

Built from https://develop.svn.wordpress.org/trunk@29861


git-svn-id: http://core.svn.wordpress.org/trunk@29621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Improve 'alias_of' handling in wp_insert_term() and wp_update_term().

Using get_term_by() rather than direct SQL queries to fetch the alias term
fixes a number of issues:

* Object cache for aliased term is properly cleared after update.
* If the aliased term is in the object cache, it's served from there, saving a database query.
* Duplicate 'edit_terms' and 'edited_terms' hooks can be removed.
* Fix a PHP notice when the 'alias_of' term is not found.
* Prevent the incorrect creation of a new term group for the primary term when the 'alias_of' term is not found.

Adds unit tests for 'alias_of' functionality in both functions.

Fixes #29848.
Built from https://develop.svn.wordpress.org/trunk@29862


git-svn-id: http://core.svn.wordpress.org/trunk@29622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fix term_exists() for parent = 0.

Passing a 0 (or '0') as the 'parent' param of term_exists() should limit
results to terms with no parent.

Adds unit test.

Fixes #29851.
Built from https://develop.svn.wordpress.org/trunk@29863


git-svn-id: http://core.svn.wordpress.org/trunk@29623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add some unit tests for WP_HTTP::parse_url() to cover the <PHP 5.4.7 compatibility alterations.

These unit tests cover the expected vehaviour of certain combinations of URL's, but makes no attempt to test invalid URL structures, as PHP's behavious for invalid URL's is undefined (Some will be treated as paths, others fail, and it varies between PHP 5.4.7+ and <5.4.7).
This change also makes WP_HTTP::parse_url() protected in order to allow unit testing.
See #28001, #29886

Built from https://develop.svn.wordpress.org/trunk@29864


git-svn-id: http://core.svn.wordpress.org/trunk@29624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Don't bail out of term_exists() when term sanitizes to an empty string.

This change brings return values for failures of this sort in line with other
failed lookups in term_exists(): a null value is now returned in all cases
where the queried term is not found.

Adds unit test for the sanitization issue. Modifies existing unit test to
reflect the change in return value for empty term strings.

Props boonebgorges, georgestephanis.
Fixes #29589.
Built from https://develop.svn.wordpress.org/trunk@29865


git-svn-id: http://core.svn.wordpress.org/trunk@29625 1a063a9b-81f0-0310-95a4-ce76da25c4cd