Commit Graph

1852 Commits

Author SHA1 Message Date
Konstantin Obenland 6d951b3c5d Customize: Only add custom logo’s header text control if needed.
Dissolves `WP_CustomLogo` and adopts a structure similar to custom header and background (See `_delete_attachment_theme_mod()`).
The option to hide header text only gets added if it’s not already part of custom header, and only if selectors have been registered when theme support for custom logos was declared. Themes can add `postMessage` support for it as well.

Example:
{{{
add_theme_support( 'custom-logo', array(
    'size' => ‘large’,
    'header-text' => array( 'site-title', 'site-description' ),
) );
}}}

See #33755.


git-svn-id: https://develop.svn.wordpress.org/trunk@36915 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-09 23:43:49 +00:00
Konstantin Obenland 4286a3e63b Tests: Let's not reinvent `wp_get_attachment_image()`.
See https://travis-ci.org/aaronjorbin/develop.wordpress/builds/114913862
See #36086.


git-svn-id: https://develop.svn.wordpress.org/trunk@36914 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-09 23:27:28 +00:00
Konstantin Obenland bf852575e2 Tests: Account for expected attachemnt size in custom logo output.
Fixes #36086.


git-svn-id: https://develop.svn.wordpress.org/trunk@36911 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-09 21:56:57 +00:00
Aaron Jorbin 6adbde9340 Add Automated Tests for custom logo support
[36698] introduced custom logos, this tests the API. 

Fixes #36086. See #33755.
Props obenland.



git-svn-id: https://develop.svn.wordpress.org/trunk@36905 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-09 20:43:28 +00:00
Weston Ruter dcbbeffc57 Customize: Fix regressions and harden implementation of selective refresh for nav menus.
* Request full refresh if there are nav menu instances that lack partials for a changed setting.
* Restore `WP_Customize_Nav_Menus::$preview_nav_menu_instance_args` and `WP_Customize_Nav_Menus::export_preview_data()` from 4.3, and keeping a tally of all `wp_nav_menu()` calls regardless of whether they can use selective refresh.
* Ensure that all instances of `wp_nav_menu()` are tallied, regardless of whether they are made during the initial preview call or during subsequent partial renderings. Export `nav_menu_instance_args` with each partial rendering response just as they are returned when rendering the preview as a whole.
* Fix issues with Custom Menu widget where nav menu items would fail to render when switching between menus when a menu lacked items to begin with.
* Make sure the fallback behavior is invoked when the partial is no longer associated with a menu.
* Do fallback behavior to refresh preview when all menu items are removed from a menu.

Follows [36586].
See #27355.
Fixes #35362.


git-svn-id: https://develop.svn.wordpress.org/trunk@36889 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-09 00:08:51 +00:00
Drew Jaynes f07f2252fe Menus: Avoid a notice when outputting a description for an existing archive menu item for a post type that doesn't.
Props bradyvercher.
See [36859]. Fixes #35324.


git-svn-id: https://develop.svn.wordpress.org/trunk@36888 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-08 18:24:50 +00:00
Dominik Schilling (ocean90) 5064747619 Tests: Remove `test_new_files_are_not_in_old_files_array()` from [36843].
The test assumes that if a CSS file was added to `$_old_files` all three files (.css, .min.css, -rtl.min.css; it's actually missing the fourth case, -rtl.css) don't exist anymore. But this isn't always the case. The test is also incredible slow because it does three `file_exists()` checks for each file — the global contains 646 files currently.

It's important what we have in the /build directory and that's covered by `test_new_files_are_not_in_old_files_array_compiled()`.

Fixes #36083.

git-svn-id: https://develop.svn.wordpress.org/trunk@36885 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-08 16:44:25 +00:00
Dion Hulse 11082eea97 Tests: Remove debug from [36882].
git-svn-id: https://develop.svn.wordpress.org/trunk@36883 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-08 07:07:56 +00:00
Dion Hulse adcb0b5a4a Tests: Merge the two different `wp_normalize_path()` tests.
See #35996, [36881].


git-svn-id: https://develop.svn.wordpress.org/trunk@36882 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-08 07:06:12 +00:00
Dion Hulse 8d9b0a9d22 Filesystem: Support Windows shares/DFS roots in `wp_normalize_path()`.
Props rilwis for initial patch.
Fixes #35996.


git-svn-id: https://develop.svn.wordpress.org/trunk@36881 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-08 05:59:45 +00:00
Pascal Birchler 3a51ff4d2e Taxonomy: Improve backward compatibility on the `wp-admin/term.php` page.
Specifically, run `do_action( 'edit-tags.php' );` on this new term edit page introduced in [36308]. Changes the GET param back to `tag_ID` and properly sets the screen base in `WP_Screen`.

See #34988.

git-svn-id: https://develop.svn.wordpress.org/trunk@36874 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-07 12:55:04 +00:00
Pascal Birchler afdf1c9ec1 Embeds: Adjust the iframe title attribute for improved accessibility.
Changes the title attribute from `Embedded WordPress Post` to `"Post name" — site title`.

Props ramiy.
Fixes #35804.

git-svn-id: https://develop.svn.wordpress.org/trunk@36873 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-07 09:59:02 +00:00
Dominik Schilling (ocean90) 00e87b40c8 Dependencies: Improve group processing of script dependencies.
This is a follow-up to [36604].

When processing dependencies `$this->group` will be the minimum of the script's registered group and all preceding siblings. This is wrong because only a scripts ancestors in the dependency chain should affect where it is loaded. Effectively `$this->group` introduced a form of global state which potentially corrupted the group of dependencies. Sorting covers up this problem.
The issue in #35873 was that script were not moving their dependencies to a lower group when necessary.

The fix:
* In `WP_Dependencies::all_deps()` pass the new `$group` value to `WP_Dependencies::all_deps()`. Previously the wrong value was passed because the parent script could have moved with `WP_Scripts::set_group()`.
* In `WP_Scripts::all_deps()` pass the `$group` parameter to `WP_Dependencies::all_deps()` so it doesn't always use `false` for `$group`. Same for `WP_Styles::all_deps()`.

Props stephenharris, gitlost.
Fixes #35956.

git-svn-id: https://develop.svn.wordpress.org/trunk@36871 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-06 19:49:54 +00:00
Aaron Jorbin 4af0645ae8 Ensure Description is respected in post type archive menu items.
Tested scenarios include: using the default (which is the post type description), Setting a custom description for that individual menu item, and setting a custom description that is blank. Introduced in r35382.

Props Toro_Unit, mayukojpn, extendwings, jorbin.
Fixes #35324. See #16075.



git-svn-id: https://develop.svn.wordpress.org/trunk@36859 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-05 22:56:31 +00:00
Aaron Jorbin 57d8c6668a Fix License test
Broken in r36855

Fixes #35278



git-svn-id: https://develop.svn.wordpress.org/trunk@36856 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-05 20:21:23 +00:00
ericlewis 59c8ba7871 Build/Test Tools: Document PHP unit test classes.
Props boonebgorges.
Fixes #35494.


git-svn-id: https://develop.svn.wordpress.org/trunk@36854 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-05 19:47:41 +00:00
John Blackbourn 48959ec76e Posts, Post Types: Ensure that non-ASCII characters in attachment slugs aren't shown in urlencoded form in the sample permalink UI.
Fixes #35980


git-svn-id: https://develop.svn.wordpress.org/trunk@36853 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-05 03:55:33 +00:00
Sergey Biryukov fb7ada9e9a Comment out some CSS files in `$_old_files` that were added back as a result of [36341].
Add a unit test to make sure the `$_old_files` array does not contain any current project files.

Props joemcgill, swissspidy.
Fixes #36083.

git-svn-id: https://develop.svn.wordpress.org/trunk@36843 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-04 07:55:21 +00:00
Sergey Biryukov 95f12701fb Date/Time: Add a unit test for `mysql_to_rfc3339()`.
Props borgesbruno.
Fixes #36054.

git-svn-id: https://develop.svn.wordpress.org/trunk@36832 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-03 13:16:31 +00:00
Joe Hoyle fc0ed5e1ca REST API: Unit test for OPTIONS request should call rest_send_allow_header
In [36829] we moved this logic to rest_send_allow_header()

See #36829.


git-svn-id: https://develop.svn.wordpress.org/trunk@36831 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-03 11:37:48 +00:00
Joe Hoyle b38ea44e9a OPTIONS requests to REST API should return Allow header.
An OPTIONS request was incorrectly returning an "Accept" header which
was a typo of "Allow". This meant Accept was showing "GET, POST" for example,
however it was also not running the permission checks on the endpoints.

Instead, the correct route needs to be set on the request object, which means
the normal handling for the Allow header will kick in. This technically
breaks backwards compatibility, however given the value of Accept was also wrong
then this should not be an issue.

Fixes #35975.


git-svn-id: https://develop.svn.wordpress.org/trunk@36829 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-03 09:54:32 +00:00
John Blackbourn dfb666f7cf Uploads: Add tests for device upload capabilities based on user agent.
Fixes #35976
Props borgesbruno


git-svn-id: https://develop.svn.wordpress.org/trunk@36810 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-03 02:00:06 +00:00
Weston Ruter 0c3716670a Customize: Define params on `WP_Customize_Partial::render_callback()` for the sake of subclasses overriding this method.
Fixes a strict standards notice regarding the method signature needing to be compatible.

See #27355.


git-svn-id: https://develop.svn.wordpress.org/trunk@36801 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-02 06:08:38 +00:00
Andrew Ozz b4db71a2f8 TinyMCE: update to 4.3.6. Changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt.
Fixes #36035.

git-svn-id: https://develop.svn.wordpress.org/trunk@36798 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-01 23:12:43 +00:00
Pascal Birchler 4bad4cd246 Tests: Add unit tests for `number_format_i18n()`.
Props pbearne for initial patch.
Fixes #36029.

git-svn-id: https://develop.svn.wordpress.org/trunk@36795 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-01 21:19:20 +00:00
Boone Gorges c67a463427 Use `markTestSkipped()` to skip a multisite-only test.
See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36791 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 22:55:56 +00:00
Boone Gorges 26a8cbdb44 Ensure that user `__unset()` tests make assertions.
See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36790 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 22:49:15 +00:00
Boone Gorges 1fb24d9e8d Remove erroneous `return` in `date_query` test.
Introduced in [34989].

See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36789 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 22:40:20 +00:00
Boone Gorges 2b19ef7b76 mbstring.func_overload test should be skipped properly.
This avoids PHPUnit notices related to "risky" tests.

See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36788 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 22:37:42 +00:00
Boone Gorges 7e55710025 Remove tests related to `wp_*_post_meta()` functions.
These tests functions were introduced as part of the attempt to straighten out
metadata slashing. See [23416]. The functions were later pulled out [23554],
but the tests were not removed at the same time. Since that point, they've
done nothing, so they can safely be removed.

See #21767. See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36787 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 22:13:28 +00:00
Boone Gorges 0a1e0cd7d6 Tests: Make sure that `test_wp_mail_break_it()` makes an assertion.
Let's make what is possibly the oddest test in WordPress even a bit odder.

See https://core.trac.wordpress.org/ticket/28909#comment:47 for backstory on
the test.

See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36786 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 22:04:32 +00:00
Boone Gorges 7505593ab8 Tests: `setExpectedDeprecated` and `setExpectedIncorrectUsage` tests should make assertions.
Introduced in [31306].

See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36785 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 21:55:41 +00:00
Boone Gorges 603fee5749 More specific test for a bad callback in `WP_Customize_Partial` test.
The 'render_callback' passed to `WP_Customize_Partial` must either echo or
return a result - not both. When it's detected that the callback echoes and
returns a value, the return value takes precedence. This is now reflected in
the corresponding unit test.

Introduced in [36586].

See #27355. See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36784 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 21:53:18 +00:00
Boone Gorges 8b7fdc982f Remove test related to deprecated Customizer `export_preview_data()` method.
The method was gutted and deprecated in [36586], so there's no reason to keep
the test.

See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36782 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 21:07:00 +00:00
Boone Gorges 070b8a6154 Put an assertion in `test_nonexistent_array()` test.
The point of the test is to demonstrate that PHP doesn't throw a notice when
calling `unset()` on an undefined array key. To placate PHPUnit's useless test
detection, we add a redundant assertion.

Introduced in [25240].

See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36779 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 20:34:48 +00:00
Boone Gorges 60b307b941 Make sure an assertion takes place in 'visited' test for `get_category_parents()`.
See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36778 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 20:30:04 +00:00
Sergey Biryukov 13e409ac15 Formatting: In `sanitize_title_with_dashes()`, convert `&nbsp`, `&ndash`, and `&mdash` HTML entities to hyphens on save.
Props polevaultweb for initial patch.
Fixes #31790.

git-svn-id: https://develop.svn.wordpress.org/trunk@36775 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 04:41:03 +00:00
Drew Jaynes 92dbe29078 Posts: Add tests for the cascading fallback behavior of several 'public'-related arguments in `register_post_type()`.
Covers the 'exclude_from_search', 'publicly_queryable', 'show_ui', 'show_in_menu', 'show_in_nav_menus', and 'show_in_admin_bar' arguments, all of which eventually inherit from 'public' if not set.

Fixes #35985.


git-svn-id: https://develop.svn.wordpress.org/trunk@36768 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-28 22:58:45 +00:00
Sergey Biryukov 4f91aae382 L10n: Add unit tests for `_n_noop()` and `_nx_noop()`.
Props realloc.
Fixes #35961.

git-svn-id: https://develop.svn.wordpress.org/trunk@36766 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-28 20:48:58 +00:00
Sergey Biryukov a18e7ae7c3 Ad a unit test for `bool_from_yn()`.
Props borgesbruno.
Fixes #35972.

git-svn-id: https://develop.svn.wordpress.org/trunk@36764 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-28 19:55:48 +00:00
John Blackbourn 54adcce28d Rewrite Rules: Ensure `url_to_postid()` operates as expected when it's used in the context of another site within a Multisite network that uses mixed URL schemes.
Fixes #35531


git-svn-id: https://develop.svn.wordpress.org/trunk@36750 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-28 02:12:13 +00:00
John Blackbourn 717c1c4041 HTTP API: Add the missing `1xx` HTTP response codes as constants of the `WP_Http` class, and add tests to ensure all available response codes are covered.
Fixes #36294


git-svn-id: https://develop.svn.wordpress.org/trunk@36749 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-28 01:45:24 +00:00
Boone Gorges 3d8cade8c8 Tests: Don't modify global state before checking whether to skip `get_locale()` tests.
Introduced in [36740].

Props ocean90.
See #35965.

git-svn-id: https://develop.svn.wordpress.org/trunk@36741 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 20:28:07 +00:00
Boone Gorges da128bc5e3 Add tests for `get_locale()`.
Props realloc.
Fixes #35965.

git-svn-id: https://develop.svn.wordpress.org/trunk@36740 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 20:21:11 +00:00
John Blackbourn 48aa555ced Refactor some janky URL tests into data providers for clarity and better error reporting.
See #35954


git-svn-id: https://develop.svn.wordpress.org/trunk@36722 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 02:10:32 +00:00
John Blackbourn 1ebe4658f1 Remove (or at least reduce) the need to reset common `$_SERVER` variables before assertions or between tests, by introducing a method which automatically resets them during test setup.
See #35954


git-svn-id: https://develop.svn.wordpress.org/trunk@36721 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 02:08:47 +00:00
Ella Iseulde Van Dorpe 37fda5a8b9 TinyMCE: textpattern: clean up
* Use editor.once instead of storing into variables.
* Add pattern for hr.

See #33300.


git-svn-id: https://develop.svn.wordpress.org/trunk@36719 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 00:51:01 +00:00
Sergey Biryukov 918da6f8c2 L10n: Add test for `get_available_languages()`.
Props realloc.
Fixes #35950.

git-svn-id: https://develop.svn.wordpress.org/trunk@36718 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 00:38:25 +00:00
John Blackbourn 701f639e30 Correct some more tests which were using `example.org` instead of `WP_TESTS_DOMAIN`.
See #34000


git-svn-id: https://develop.svn.wordpress.org/trunk@36717 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 00:25:10 +00:00
John Blackbourn 6cf0caf13e Unify the initialisation of `$_SERVER` variables during test bootstrap. This abstracts the (re-)initialisation into a function that can be used inside of tests too, before assertions are performed.
See #35954


git-svn-id: https://develop.svn.wordpress.org/trunk@36715 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-25 21:59:56 +00:00
John Blackbourn fd03f6ec19 Canonical: Improve the method names and inline docs for canonical redirect tests.
git-svn-id: https://develop.svn.wordpress.org/trunk@36714 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-25 21:55:57 +00:00
John Blackbourn fd8e31e3b2 Move some assertions in HTTPS related tests, so failures that occur before the environment reset don't result in a contaminated test environment.
See #35954


git-svn-id: https://develop.svn.wordpress.org/trunk@36711 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-25 21:17:34 +00:00
Dominik Schilling (ocean90) d30e49fa60 L10n: Add test for `wp_get_pomo_file_data()`.
Props realloc.
See #35284.

git-svn-id: https://develop.svn.wordpress.org/trunk@36710 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-25 15:01:23 +00:00
Pascal Birchler a57b5c8ce5 Embeds: Use a more accessible way to initially hide the iframe.
This fixes a bug in Firefox where assets inside the iframe aren't being displayed because they have no computed style.

See #35894.

git-svn-id: https://develop.svn.wordpress.org/trunk@36708 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-25 10:22:43 +00:00
Drew Jaynes 138b55c16e Embeds: Update embed template paths and messages in tests, missed in [36693].
Props ocean90
See #34561.


git-svn-id: https://develop.svn.wordpress.org/trunk@36694 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 21:20:41 +00:00
Boone Gorges 036bac45bc Improve 'offset' calculation when querying for hierarchical terms.
When querying for terms in hierarchical taxonomies, `get_terms()` initially
queries for all matching terms, and then trims the located results based on the
`$number` and `$offset` arguments passed to the function. See #8832. However,
a flaw in the original logic meant that results were failing to be trimmed
properly in cases where `$offset` exceeds the total number of matching terms;
in these cases, we should force an empty array.

Props danielbachhuber.
Fixes #35935.

git-svn-id: https://develop.svn.wordpress.org/trunk@36691 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 19:12:45 +00:00
Weston Ruter d80ef26b48 Customize: Allow controls to be registered without any associated settings.
* Improves parity between partials and controls. A partial or control can be settingless if instantiated with `settings` param as empty array (otherwise, if null, then the partial/control ID is used). 
* Eliminate need to create dummy settings that serve no purpose except to place a control in the UI.
* Removes dummy settings for `create_new_menu` and `new_menu_name`.
* Introduces `WP_Customize_Control::$capability` and `WP_Customize_Partial::$capability`, and if set checks them in the respective `check_capabilities()` methods.
* Prevents PHP fatal error from happening when non-existing settings are provided to control: "Call to a member function `check_capabilities()` on a non-object".
* Fixes issue where nav menu items and widgets were no longer working with selective refresh because cap check was failing.

See #27355.
Fixes #35926.


git-svn-id: https://develop.svn.wordpress.org/trunk@36689 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 18:27:45 +00:00
Ryan McCue b464a4ba3a REST API: Fix error in Request tests.
On the 21st of November, 2014, I committed tests for WP_REST_Request
to the API plugin. Although I didn't realise at the time, I was
causing my future self to go through hours of sufferring.

Unfortunately, I forgot to call parent::setUp() which would break
the tests in subtle ways in the future and would ruin the good part
of my day.

Let this be a warning to all of you who write future unit tests.

See f0396be17e
for the original commit.


git-svn-id: https://develop.svn.wordpress.org/trunk@36678 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 08:28:12 +00:00
Weston Ruter 407a2bd076 Customize: Introduce `customize_nav_menu_searched_items` filter for modifying results of nav menu item searches.
This new filter can be used in conjunction with the `customize_nav_menu_available_items` and `customize_nav_menu_available_item_types` filters.

Props TimothyBlynJacobs, westonruter.
Fixes #34947.


git-svn-id: https://develop.svn.wordpress.org/trunk@36676 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 05:56:40 +00:00
Ryan McCue c3c445c0c9 REST API: Use WP_REST_Request::from_url() when embedding.
See #35803.


git-svn-id: https://develop.svn.wordpress.org/trunk@36674 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 04:19:44 +00:00
Ryan McCue 92d2be6a3d REST API: Add WP_REST_Request::from_url()
Allows converting a REST URL into a Request object.

Props danielbachhuber.
Fixes #35803.


git-svn-id: https://develop.svn.wordpress.org/trunk@36673 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 04:00:12 +00:00
Sergey Biryukov 45017abf02 Revisions: Clean up `_wp_post_revision_fields()`:
* Move the array processing to a new function, `_wp_post_revision_data()`.
* Make both functions accept a post array or a `WP_Post` object. 
* Always apply the `_wp_post_revision_fields` filter and pass the post data to it.

Fixes #13382.

git-svn-id: https://develop.svn.wordpress.org/trunk@36659 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 00:43:31 +00:00
Pascal Birchler 9fb4d30ada Posts: Introduce `get_post_types_by_support()`.
Similar to `get_post_types()`, this new function returns a list of post type names that support a specific feature.

Props wpsmith, barryceelen, swissspidy.
Fixes #34010.

git-svn-id: https://develop.svn.wordpress.org/trunk@36652 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 22:49:17 +00:00
Weston Ruter fd46fad1c8 Customize: Fix and extend broken ajax unit tests to account for partials being skipped from rendering.
Fixes regression introduced in [36643].

See #35914.


git-svn-id: https://develop.svn.wordpress.org/trunk@36650 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 21:45:51 +00:00
Dominik Schilling (ocean90) 3a836ea224 Styles: Clarify the allowed values for the `$media` parameter of `wp_register_style()`/`wp_enqueue_style()`.
Adds unit test.

Fixes #35921.

git-svn-id: https://develop.svn.wordpress.org/trunk@36649 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 20:40:43 +00:00
Boone Gorges 245e40f384 Query: Search should match `post_excerpt` in addition to title and content.
When ordering search results, exact matches in the post excerpt are weighted
above those in post content, but below those in the post title.

Props swissspidy, sebastian.pisula.
FIxes #35762.

git-svn-id: https://develop.svn.wordpress.org/trunk@36647 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 20:13:22 +00:00
Boone Gorges 193196a552 Make `$taxonomy` parameter optional in `get_edit_term_link()`.
Props nicdford, sc0ttkclark.
Fixes #35922.

git-svn-id: https://develop.svn.wordpress.org/trunk@36646 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 20:06:25 +00:00
Weston Ruter c9b47e9d92 Customize: Skip exporting partials to client and handling rendering requests if user can't modify associated settings.
Introduces `WP_Customize_Partial::check_capabilities()` for parity with `WP_Customize_Control::check_capabilities()`.
 
See #27355.
Fixes #35914.


git-svn-id: https://develop.svn.wordpress.org/trunk@36643 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 18:13:30 +00:00
Pascal Birchler 0e13a57288 Script Loader: Introduce `wp_add_inline_script()`.
This new function can be used to add inline JavaScript before and after enqueued scripts, just like `wp_add_inline_style()` works for CSS.

Props atimmer, abiralneupane, ocean90, swissspidy.
Fixes #14853.

git-svn-id: https://develop.svn.wordpress.org/trunk@36633 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 16:43:41 +00:00
Boone Gorges 0338c8b3a3 Query: Allow a seed value to be passed when using 'rand' `$orderby`.
`WP_Query` allows random ordering; `'orderby' => 'rand'` translates to
`ORDER BY RAND()`. This syntax results in random ordering that is not
consistent from request to request. MySQL supports the passing of a seed value
to random sorts, such as `ORDER BY RAND(3)`, which will return the same
random value each time it's called. `WP_Query` now supports this syntax, by
passing `RAND(3)` (or whatever integer seed value you'd like) as the value
of `'orderby'`.

Props hlashbrooke.
Fixes #35692.

git-svn-id: https://develop.svn.wordpress.org/trunk@36632 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 16:39:50 +00:00
Dominik Schilling (ocean90) 7b1c4151dd L10n: Add test for `wp_dropdown_languages()`.
Props realloc.
Fixes #35294.

git-svn-id: https://develop.svn.wordpress.org/trunk@36631 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 16:27:36 +00:00
Ella Iseulde Van Dorpe 7040b4d932 TinyMCE: inline text patterns
First run.

See #33300.


git-svn-id: https://develop.svn.wordpress.org/trunk@36627 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 08:32:34 +00:00
Boone Gorges 0809037f61 Query: `is_*( $int )` should not falsely match strings starting with "$int".
Another chapter in the Storied Annals of Weird `in_array()` Behavior:
`in_array( 4, array( "4-cool-dudes" ) );` resolves to `true`, such that
`is_page( 4 )` was returning true for posts with the name `'4-cool-dudes'`.

We work around this behavior by ensuring that values passed to the `is_`
methods are cast to strings before the `in_array()` checks. ID checks still
work as expected; see #24674.

Props mikejolley, swissspidy, boonebgorges.
Fixes #35902.

git-svn-id: https://develop.svn.wordpress.org/trunk@36625 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 02:20:28 +00:00
Weston Ruter d14b188c42 Customize: Prevent dropping backslashes from input on general settings and settings for nav menus and some widgets.
Ensures that intentional backslashes (e.g. "\o/") can be used in:

* Site title
* Site description
* Nav menu name
* Custom Menu widget title
* Tag Cloud widget title
* Text widget body if can't `unfiltered_html`

The latter three are also fixed on the widgets admin page.

Fixes #35898.


git-svn-id: https://develop.svn.wordpress.org/trunk@36622 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 01:01:43 +00:00
Dominik Schilling (ocean90) 12cf07c669 Authentication: Allow users to log in using their email address.
Introduces `wp_authenticate_email_password()` which is hooked into `authenticate` after `wp_authenticate_username_password()`.

Props Denis-de-Bernardy, ericlewis, vhomenko, MikeHansenMe, swissspidy, ocean90.
Fixes #9568.

git-svn-id: https://develop.svn.wordpress.org/trunk@36617 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 23:14:27 +00:00
Mike Schroder cde3d4c399 Media: Update unit tests after change to default image quality.
Updates unit tests to reflect new default quality setting of '82' after [36615].

See #33642.

git-svn-id: https://develop.svn.wordpress.org/trunk@36616 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 23:13:27 +00:00
Boone Gorges 408fb37f2b Allow `get_terms()` to fetch terms regardless of taxonomy.
`get_terms()` has historically required that a taxonomy be specified when
querying terms. This requirement is related to the fact that terms could
formerly be shared between taxonomies, making `$taxonomies` critical for
disambiguation. Since terms can no longer be shared as of 4.4, it'
s desirable to be able to query for terms regardless of what taxonomy they're in.

Because it's now optional to pass taxonomies, it's no longer necessary to have
`$taxonomies` as the first (and required) parameter for `get_terms()`. The new
function signature is `get_terms( $args )`, where 'taxonomy' can (optionally) be
passed as part of the `$args` array. This syntax is more consistent with
functions like `get_users()` and `get_posts()`.

We've maintained backward compatibility by always giving precedence to the old
argument format. If a second parameter is detected, or if it's detected that
the first parameter is a list of taxonomy names rather than an `$args` array,
`get_terms()` will parse the function arguments in the legacy fashion.

Props flixos90, swissspidy, DrewAPicture, boonebgorges.
Fixes #35495.

git-svn-id: https://develop.svn.wordpress.org/trunk@36614 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 22:16:37 +00:00
Weston Ruter 56598b5f90 Customize: Prevent PHP notice and JS error caused by widgets and nav menus components if user only has `customize` capability.
Short-circuits components from initializing their hooks needlessly if current user lacks required capability.

Fixes #35895.


git-svn-id: https://develop.svn.wordpress.org/trunk@36611 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 05:30:30 +00:00
Weston Ruter bd09cddfc1 Customize: Update unit test for `WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()` to account for slashing if user can't `unfiltered_html`.
Fixes unit tests which broke under multisite config after [36608].

Fixes #35869.


git-svn-id: https://develop.svn.wordpress.org/trunk@36610 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 05:09:34 +00:00
Weston Ruter d06329d035 Customize: Fix previewing and updating of nav menu items containing slashed/slashable characters.
Prevents slashes from being added when a user without `unfiltered_html` previews a nav menu item containing an apostrophe or some other slashable character, and prevents the loss of an intentional slash (e.g. "\o/") when saving a nav menu item, regardless of capability.

Fixes #35869.


git-svn-id: https://develop.svn.wordpress.org/trunk@36608 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 00:13:53 +00:00
Eric Andrew Lewis c592a7262e Posts: Non-trashed posts should take slug priority over trashed posts.
When determining a unique post slug, trashed posts are taken into account. Previously, new posts would add suffixes to their slugs (e.g. `about-2`) when a post in the trash had the desired slug (e.g. `about`). 

To avoid this behavior, when a post is trashed its slug (i.e. `post_name`) is now suffixed with `-%trashed%`. The post's pre-trash slug is stored as post meta, and if the post is restored from trash, its desired slug is reapplied. 

For existing trashed posts which don't have the `-%trashed%` suffix, the suffix is added when a post with its desired slug is created.

Props ocean90, boonebgorges, ryan, SergeyBiryukov, coffee2code, helen, williamsba1.
See #11863.


git-svn-id: https://develop.svn.wordpress.org/trunk@36607 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-21 21:44:14 +00:00
Dominik Schilling (ocean90) 6e493b1713 Script Loader: Fix missing script output when the groups of dependencies are different.
Aka: Don't lose the grandchild.

Props gitlost, ocean90.
Fixes #35873.

git-svn-id: https://develop.svn.wordpress.org/trunk@36604 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-20 22:10:01 +00:00
Dominik Schilling (ocean90) 5f9d1fa799 Tests: Test that jQuery can be moved into footer after [36550].
Props gitlost.
See #25247.

git-svn-id: https://develop.svn.wordpress.org/trunk@36596 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-20 16:16:35 +00:00
Boone Gorges c43fc5ac2b Tests: Add decorators to PHPMailer mock object.
The new `get_recipient()` and `get_sent()` methods greatly simplify the
syntax required when writing tests for `wp_mail()`.

Props welcher.
Fixes #34161.

git-svn-id: https://develop.svn.wordpress.org/trunk@36594 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-20 03:40:49 +00:00
Andrew Ozz 218c1240b8 TinyMCE: update to 4.3.4. Changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt.
Fixes #35876.

git-svn-id: https://develop.svn.wordpress.org/trunk@36589 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-19 19:18:59 +00:00
Weston Ruter 03360d143d Customize: Add selective refresh framework with implementation for widgets and re-implementation for nav menus.
See https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/.

Props westonruter, valendesigns, DrewAPicture, ocean90.
Fixes #27355.


git-svn-id: https://develop.svn.wordpress.org/trunk@36586 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-19 18:40:06 +00:00
Dominik Schilling (ocean90) 2d7150e40d Formatting: Avoid a PHP warning when `wptexturize()` is called with a trailing less-than symbol.
Props westonruter.
Fixes #35864.

git-svn-id: https://develop.svn.wordpress.org/trunk@36578 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-18 20:30:54 +00:00
Dominik Schilling (ocean90) 9f5eb3c604 Add missing test changes for [36573].
See #34755.

git-svn-id: https://develop.svn.wordpress.org/trunk@36574 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-18 17:43:56 +00:00
Boone Gorges 0e9ff07da5 Reintroduce term meta unit test accidentally removed in [36566].
git-svn-id: https://develop.svn.wordpress.org/trunk@36567 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 23:01:05 +00:00
Boone Gorges 28fad09b61 More performance improvements to metadata lazyloading.
Comment and term meta lazyloading for `WP_Query` loops, introduced in 4.4,
depended on filter callback methods belonging to `WP_Query` objects. This meant
storing `WP_Query` objects in the `$wp_filter` global (via `add_filter()`),
requiring that PHP retain the objects in memory, even when the local variables
would typically be expunged during normal garbage collection. In cases where a
large number of `WP_Query` objects were instantiated on a single pageload,
and/or where the contents of the `WP_Query` objects were quite large, serious
performance issues could result.

We skirt this problem by moving metadata lazyloading out of `WP_Query`. The
new `WP_Metadata_Lazyloader` class acts as a lazyload queue. Query instances
register items whose metadata should be lazyloaded - such as post terms, or
comments - and a `WP_Metadata_Lazyloader` method will intercept comment and
term meta requests to perform the cache priming. Since `WP_Metadata_Lazyloader`
instances are far smaller than `WP_Query` (containing only object IDs), and
clean up after themselves far better than the previous `WP_Query` methods (bp
only running their callbacks a single time for a given set of queued objects),
the resource use is decreased dramatically.

See [36525] for an earlier step in this direction.

Props lpawlik, stevegrunwell, boonebgorges.
Fixes #35816.

git-svn-id: https://develop.svn.wordpress.org/trunk@36566 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 22:57:33 +00:00
Andrew Ozz c7936b8785 Improve the performance of `wp_upload_dir()`:
- Cache the output in non-persistent cache.
- Cache the result from `wp_mkdir_p()` in persistent cache (when present).
- Introduce `wp_get_upload_dir()` for use when not uploading files. It is equivalent to `wp_upload_dir()` but does not check for the existence or create the upload directory.
- Change tests to use the non-cached `_wp_upload_dir()`. They change options on the fly (should never be used in production) to simulate different environments.
- Introduce `_upload_dir_no_subdir()` and `_upload_dir_https()` to facilitate testing. These use the proper `upload_dir` filter to simulate different environments.

Props kovshenin, azaozz.
See #34359.

git-svn-id: https://develop.svn.wordpress.org/trunk@36565 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 22:51:01 +00:00
Dominik Schilling (ocean90) bc95fd2884 Tests: Add test for `wp_get_installed_translations()`.
Introduces language files in /tests/phpunit/data/language. Each file includes the header and 5 translations.

Props realloc for initial patch.
Fixes #35284.

git-svn-id: https://develop.svn.wordpress.org/trunk@36563 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 22:01:11 +00:00
Dominik Schilling (ocean90) 548a18059c Tests: Add a test for testing `wp_enqueue_script()` with an alias handle in the footer.
Props kovshenin.
See #35643.

git-svn-id: https://develop.svn.wordpress.org/trunk@36559 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 19:52:42 +00:00
Dominik Schilling (ocean90) 653e0b0827 Tests: Add `Tests_dbDelta::assertTableHasPrimaryKey()`.
Also fix a typo in the name for the compound key.

Props charlestonsw.
Fixes #34877.

git-svn-id: https://develop.svn.wordpress.org/trunk@36552 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 18:54:27 +00:00
Dominik Schilling (ocean90) 59747aa6b9 Script/Style Dependencies: Make sure that inline styles for handles without a source are printed.
This prevents breaking plugins which are adding inline styles to the `wp-admin` handle after [36341].

Props dd32, ocean90.
Fixes #35229.

git-svn-id: https://develop.svn.wordpress.org/trunk@36550 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 17:10:53 +00:00
Dominik Schilling (ocean90) 149686b424 Tests: Indent `test_wp_register_script()` with tabs.
git-svn-id: https://develop.svn.wordpress.org/trunk@36549 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 16:07:01 +00:00
Dominik Schilling (ocean90) de9d091e76 Tests: Indent `test_wp_register_style()` with tabs.
git-svn-id: https://develop.svn.wordpress.org/trunk@36547 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 15:36:20 +00:00
Dominik Schilling (ocean90) 35579fa786 i18n: Prevent `is_textdomain_loaded()` from returning true even if there are no translations for the domain.
In `get_translations_for_domain()` don't fill the global `$l10n` with `NOOP_Translations` instances, return a `NOOP_Translations` instance instead.

Props nacin, jrf.
Fixes #21319.

git-svn-id: https://develop.svn.wordpress.org/trunk@36538 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-16 21:14:45 +00:00
Ryan McCue 10bfe70f06 REST API: Allow explicit HEAD callbacks.
HEAD callbacks can now be registered independently, with the GET
callback still used as a fallback.

Fixes #34841.


git-svn-id: https://develop.svn.wordpress.org/trunk@36535 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-16 05:50:21 +00:00
Ryan McCue d7e7c0b81b REST API: Add support for CURIEs.
CURIEs are Compact URIs, which provide a more usable way to use
custom relations in the API. The `wp` CURIE is registered by default
for `https://api.w.org/` URI relations.

Fixes #34729.
Props joehoyle.


git-svn-id: https://develop.svn.wordpress.org/trunk@36533 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-16 02:18:34 +00:00
Weston Ruter 6dd1dd61a1 Customize: Add a user-friendly way to preview site responsiveness for desktop, tablet, and mobile.
Introduces `WP_Customize_Manager::get_previewable_devices()` with a `customize_previewable_devices` filter to change the default device and which devices are available for previewing. This is a feature that was first pioneered on WordPress.com.

Props celloexpressions, folletto, valendesigns, westonruter, welcher, adamsilverstein, michaelarestad, Fab1en.
Fixes #31195.


git-svn-id: https://develop.svn.wordpress.org/trunk@36532 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-16 01:56:13 +00:00
Ryan McCue 5534474cef REST API: Fix tests from r36529.
See #35329.


git-svn-id: https://develop.svn.wordpress.org/trunk@36531 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-16 01:50:06 +00:00
Ryan McCue b32aaf603e REST API: Add helper function to get server instance.
This allows using rest_do_request() outside of the API itself easily.

Props danielbachhuber, swissspidy.


git-svn-id: https://develop.svn.wordpress.org/trunk@36529 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-16 01:11:31 +00:00
Boone Gorges 7f87a14808 Introduce `publicly_queryable` taxonomy argument.
Taxonomies registered as `publicly_queryable` can be queried as taxonomy
archives.

If not provided explicitly, the value of `publicly_queryable` is inherited
from `public`.

Props Chouby.
Fixes #34491.

git-svn-id: https://develop.svn.wordpress.org/trunk@36525 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-13 03:50:37 +00:00
Boone Gorges 3a0234982c Make sure fixtures have empty `post_content` in search test.
The generator sequence was causing false positives when the search terms
('1' and '0') happened to match the current sequence number (eg,
'Post content 190').

Introduced in [36278].

See #31025.

git-svn-id: https://develop.svn.wordpress.org/trunk@36520 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-12 21:06:41 +00:00
Aaron Jorbin 0e6951b7aa Improve Automated Feed Tests
Multiple improvements to the RSS2 automated tests along with the addition of Atom tests.
1. General whitespace cleanup (since the rss2 file serves as the base of the atom file).
2. Adds an author and category to the tests.
3. Since the content of the posts is the same, we don't need to test all of the post content.
4. Adds many posts so that the post count can be checked

Props stevenkword
Fixes #35160.



git-svn-id: https://develop.svn.wordpress.org/trunk@36519 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-12 19:02:25 +00:00
Rachel Baker cff37450eb Comments: Unit test for `wp_get_comment_fields_max_lengths().
This adds tests for the comment form field lengths returned by `wp_get_comment_fields_max_lengths()`. Replaces unit test removed in r36514. 

See #10377.

git-svn-id: https://develop.svn.wordpress.org/trunk@36515 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-12 14:17:13 +00:00
Rachel Baker 8718eb2536 Comments: Change `wp_get_comment_column_max_length()` function to `wp_get_comment_fields_max_lengths()` for consolidation and better fallbacks.
Instead of returning a value for each of the related table column lengths, return an array of all of the column lengths used in the comment form.
Better fallback handling, where each field falls back to the expected max_length instead of an arbitrary number.

Props azaozz.

Fixes #10377.

git-svn-id: https://develop.svn.wordpress.org/trunk@36514 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-12 13:54:50 +00:00
Boone Gorges 0ae22e5f4c In `delete_metadata()`, only invalidate cache for affected objects.
The `$delete_all` flag in `delete_metadata()` triggers cache invalidation for
multiple objects. Previously, invalidation took place for all objects matching
the `$meta_key` parameter, regardless of whether `$meta_value` was also set.
This resulted in overly aggressive invalidation.

Props rahal.aboulfeth.
Fixes #35797.

git-svn-id: https://develop.svn.wordpress.org/trunk@36511 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-12 02:46:28 +00:00
Boone Gorges 71060260a1 Don't double-unslash meta key when `update_metadata()` falls back on `add_metadata()`.
Props jdgrimes.
Fixes #35795.

git-svn-id: https://develop.svn.wordpress.org/trunk@36509 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-11 17:34:59 +00:00
Boone Gorges ddc9f3dccb Allow comments to be queried by 'any' `post_type` or `post_status`.
Props kouratoras.
Fixes #35512.

git-svn-id: https://develop.svn.wordpress.org/trunk@36486 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-06 04:50:05 +00:00
Boone Gorges eb8e2fb6ed Allow `get_terms()` results to ordered by metadata.
The `$orderby` parameter of `get_terms()` now accepts the following values,
related to term meta:

* 'meta_value'
* 'meta_value_num'
* the value of the `$meta_key` parameter
* any key from the `$meta_query` array

This brings order-by-meta support for terms in line with post, comment, and
user queries.

As a byproduct of these improvements, `$meta_key` and `$meta_value` parameters
have been introduced to `get_terms()`. They interact with `$meta_query` in the
same way as in `WP_Query` and other query classes.

Props jadpm, eherman24.
Fixes #34996.

git-svn-id: https://develop.svn.wordpress.org/trunk@36485 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-06 04:41:26 +00:00
Boone Gorges 0673904ddf `WP_Query` taxonomy query vars should be set to first of multiple taxonomies.
This provides better parity with `get_queried_object()`, which will return the
first taxonomy/term matched by the current query.

[29891] introduced the abnormal behavior for the 'taxonomy' and 'term'
query vars.

Props Chouby.
Fixes #35619.

git-svn-id: https://develop.svn.wordpress.org/trunk@36484 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-06 03:57:33 +00:00
Boone Gorges 3ed7c823c9 When updating a user, invalidate its 'userslugs' cache.
`user_nicename` can be changed via `wp_update_user()`, so we invalidate just
to be safe.

Props thebrandonallen.
Fixes #35750.

git-svn-id: https://develop.svn.wordpress.org/trunk@36482 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-05 19:02:51 +00:00
Boone Gorges ef99ae21be Comments: Restore the ability to bypass post_id filter using 0 or '0'.
The changes introduced in [36381], while logical and clearly awesome, introduce
the potential for much breakage. Those who want to query for comments with a
null `comment_post_ID` should use `'post_in' => array( 0 )` instead.

Reverts [36381], [36387].
See #35090.


git-svn-id: https://develop.svn.wordpress.org/trunk@36480 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-05 18:49:46 +00:00
Boone Gorges 3ec4faf6e3 Comments: Add 'parent__in' and 'parent__not_in' to query var defaults.
Query var defaults are used to calculate a cache key. The fact that these
params were not listed among the defaults was causing cache keys to be
insufficiently specific.

Props danielbachhuber.
Fixes #35677.

git-svn-id: https://develop.svn.wordpress.org/trunk@36479 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-05 18:35:47 +00:00
Gary Pendergast cdf27d383d Tests: Use the new `wpdb::close()` method for closing the DB connection.
Props markoheijnen.

Fixes #34903.



git-svn-id: https://develop.svn.wordpress.org/trunk@36478 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-05 01:05:47 +00:00
Dominik Schilling (ocean90) ce68dd0ec5 Better validation of the URL used in HTTP redirects.
git-svn-id: https://develop.svn.wordpress.org/trunk@36444 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-02 15:10:09 +00:00
Gary Pendergast 2918cca22c WPDB: Add a `close()` method to `wpdb`, for when the connection needs to be manually closed.
In the event that it was closed prematurely, `wpdb::query()` will re-open the connection automatically.

Fixes #34903.



git-svn-id: https://develop.svn.wordpress.org/trunk@36433 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-02 00:12:28 +00:00
Boone Gorges 7c1854aeb0 Fix set up/tear down of post types in comment query test.
Introduced in [31015].

Props kouratoras.
Fixes #35633.

git-svn-id: https://develop.svn.wordpress.org/trunk@36415 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-27 23:12:07 +00:00
Weston Ruter 304ab7c0e4 Customizer: Export `nonce`, `theme`, and `url` app settings in preview as exported in pane.
* Introduce `WP_Customize_Manager::get_nonces()` to consolidate logic for retrieving nonces.
* Export nonces centrally in `wp.customize.settings.nonce` with each request and update nav menus preview to utilize.
* Send updated nonces to preview upon `nonce-refresh`.
* Request full preview refresh if Nav Menu selective refresh request fails (e.g. due to bad nonce).
* Update nav menus and widgets in Customizer to utilize `customize_refresh_nonces` for exporting nonces and keeping them up to date.

See #27355.
Fixes #35617.


git-svn-id: https://develop.svn.wordpress.org/trunk@36414 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-27 17:54:39 +00:00
Eric Andrew Lewis 8d562e0d04 Build/Test Tools: Move class `WP_UnitTest_Factory` into its own file.
In [36347] we moved all PHP factory classes into their own files except the main class. The main class is now in its own file, and `factory.php` is solely an include manifest for all factory classes.


git-svn-id: https://develop.svn.wordpress.org/trunk@36409 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-27 03:26:15 +00:00
Boone Gorges 746f545f9a Query: Respect 'suppress_filters' when filtering search-related SQL.
Props 5um17.
Fixes #35594.

git-svn-id: https://develop.svn.wordpress.org/trunk@36404 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-26 03:11:12 +00:00
Boone Gorges 14b6dbebd2 Introduce `$comment_status` and `$ping_status` params for `WP_Query`.
Props birgire.
Fixes #35601.

git-svn-id: https://develop.svn.wordpress.org/trunk@36403 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-26 02:55:15 +00:00
Boone Gorges af5a3b663f Allow `is_post_type_viewable()` to accept a post type name.
Previously, it accepted only a post type object.

Props spacedmonkey.
Fixes #35609.

git-svn-id: https://develop.svn.wordpress.org/trunk@36402 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-26 02:36:32 +00:00
Boone Gorges 81d3d79c1f Add tests for `is_post_type_viewable()`.
See #35609.

git-svn-id: https://develop.svn.wordpress.org/trunk@36401 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-26 02:26:21 +00:00
Boone Gorges dbac8968ed Allow comment query results to be limited to comments with comment_post_ID = 0.
Previously, this was not possible due to an overly broad `empty()` check.

Passing `null`, `false`, or `''` to 'post_id', or omitting 'post_id'
altogether, will continue to return comments regardless of `comment_post_ID`,
as before. Passing `0` or `'0'` will limit results to comments with no
associated post.

Props danielbachhuber.
Fixes #35090.

git-svn-id: https://develop.svn.wordpress.org/trunk@36381 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-22 20:19:49 +00:00
Jeremy Felt 77f8c5fc07 Themes: Enhance filtering options for allowed themes on a network.
* Move the legacy `allowed_themes` filter to `WP_Theme::get_allowed_on_network()`, where it will continue to filter themes allowed on the network.
* Add `network_allowed_themes` filter to `WP_Theme::get_allowed()` and pass `$blog_id` to provide context.
* Add `site_allowed_themes` filter to `WP_Theme::get_allowed_on_site()` and pass `$blog_id` to provide context.

Props pauldewouters, lamosty, michalzuber, dmsnell, johnnypea, rob.
Fixes #28436.


git-svn-id: https://develop.svn.wordpress.org/trunk@36366 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-20 18:28:33 +00:00
Andrew Ozz 1d82f671a3 TinyMCE: update to 4.3.3. Update the QUnit tests and revert back to testing the non-minified files in /src.
Fixes #35539.

git-svn-id: https://develop.svn.wordpress.org/trunk@36352 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-20 04:17:22 +00:00
Jeremy Felt 18d9640a5a Themes: Add initial tests for the `allowed_themes` filter.
We'll be adjusting the placement of this filter and adding two other related filters, so we should make sure it continues to work as expected after the change.

See #28436.


git-svn-id: https://develop.svn.wordpress.org/trunk@36350 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-19 23:57:46 +00:00
Boone Gorges 5eee5cfc3c Don't double-escape the 'name' param in `get_terms()`.
[32353] changed the way the 'name' param in `get_terms()` is sanitized, by
running it through `sanitize_term_field( 'name' )` before performing the SQL
query. An unintentional side effect of this change was that the string is
double-escaped: once by `wp_filter_kses()`, and once by `esc_sql()`. The
double-escaping was causing 'name' queries to fail when the param contained
apostrophes or other escaped characters.

Fixes #35493.

git-svn-id: https://develop.svn.wordpress.org/trunk@36348 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-19 04:09:32 +00:00
Eric Andrew Lewis d36d6cc630 Build/Test Tools: Move PHP factory classes into their own files.
This makes the code easier to browse.

`factory.php` loads the new files, so this is backwards compatible in case `factory.php` is loaded directly for access to one of the classes.

See #35492.


git-svn-id: https://develop.svn.wordpress.org/trunk@36347 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-19 03:55:19 +00:00
Boone Gorges 7ae3adfb80 Share post fixture in `WP_Comment_Query` tests.
See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@36346 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-19 03:02:42 +00:00
Boone Gorges 1b8e03bd89 Ignore false values of 'search' in `WP_Comment_Query`.
Props danielbachhuber.
Fixes #35513.

git-svn-id: https://develop.svn.wordpress.org/trunk@36345 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-19 02:54:28 +00:00
Ella Iseulde Van Dorpe 342d132b37 Fix unit tests after [36336]
git-svn-id: https://develop.svn.wordpress.org/trunk@36337 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-17 23:37:51 +00:00
Pascal Birchler 3541f7b90b Posts: Correctly pass `$post` to `post_password_required()` in `get_the_excerpt()`.
Corrects the relevant test.

Props sebastian.pisula for initial patch.
Fixes #35486.

git-svn-id: https://develop.svn.wordpress.org/trunk@36329 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-16 10:13:27 +00:00
Boone Gorges ac9e991dc8 Respect all post-related filters in `WP_Comment_Query`.
The refactor of `WP_Comment_Query`'s SQL generation in [34542] introduced a bug
that caused only the last post-related filter to be respected in comment
queries. In other words, if querying for comments using params
`post_status=draft&post_author=3`, only the last-processed of these params
would be respected. The current changeset fixes the logic so that these clauses
don't overwrite each other.

Props chriscct7.
Fixes #35478.

git-svn-id: https://develop.svn.wordpress.org/trunk@36326 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-15 20:09:36 +00:00
Rachel Baker 63e9eb7e5e Comments: Use TEXT column type in fallback for `wp_get_comment_column_max_length()`.
Fixes #10377.


git-svn-id: https://develop.svn.wordpress.org/trunk@36325 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-15 20:09:08 +00:00
Boone Gorges 4d17d22a47 Populate term cache with proper clone of term objects.
[34999] modified the cache strategy for terms in the context of
`wp_get_object_terms()`. As part of these changes, the `object_id` property of
term objects had to be unset before being cached. To avoid modifying passed-by-
reference terms, `update_term_cache()` attempted to make a copy of the terms
passed to the function; however, it failed to use the `clone` keyword, and thus
only created a reference instead of a copy.

Props berengerzyla.
Fixes #35462.

git-svn-id: https://develop.svn.wordpress.org/trunk@36323 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-15 19:34:16 +00:00
Pascal Birchler 13e7e78ddd Add tests missed and announced in [36319].
See #27246.

git-svn-id: https://develop.svn.wordpress.org/trunk@36320 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-15 14:49:54 +00:00
Pascal Birchler 63e442bbb8 Comments: Add a new `pre_wp_update_comment_count_now` filter.
This allows filtering a post's comment count before it is queried and updated in the database.

Props peterwilsoncc for initial patch.
Fixes #35060.

git-svn-id: https://develop.svn.wordpress.org/trunk@36318 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-15 13:41:35 +00:00
Pascal Birchler a111eafd41 Post Types: Introduce `unregister_post_type()`.
This new function can be used to completely unregister non built-in post types.

Fixes #14761.

git-svn-id: https://develop.svn.wordpress.org/trunk@36316 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-15 12:19:15 +00:00
Pascal Birchler c7ae3fb3ee Users: Deprecate the `get_currentuserinfo()` pluggable function.
It encourages an ugly pattern like `global $userdata; get_currentuserinfo();` in plugins/themes. `wp_get_current_user()` should be used instead, e.g. `$current_user = wp_get_current_user();`.

Props scribu for initial patch.
Fixes #19615.

git-svn-id: https://develop.svn.wordpress.org/trunk@36311 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-15 10:15:21 +00:00
Pascal Birchler 44db9bccf4 Taxonomy: Fix unit tests after [36308].
See #34988.

git-svn-id: https://develop.svn.wordpress.org/trunk@36309 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-15 09:12:18 +00:00
Pascal Birchler d80a3c7ccd Embeds: Allow embedding static front pages and pages having a child page with an `embed` slug.
This makes `embed` a special slug that can't be used for new pages/posts. When `https://example.com/foo/embed/` is an existing page, embeds fall back to `https://example.com/foo/?embed=true`.
Adds unit tests.

Fixes #34971.

git-svn-id: https://develop.svn.wordpress.org/trunk@36307 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-15 07:55:19 +00:00
John Blackbourn b8b68a6a9e I18N: Introduce tests for `WP_Locale`.
Props realloc, swissspidy
Fixes #34688


git-svn-id: https://develop.svn.wordpress.org/trunk@36292 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-13 23:49:52 +00:00
Boone Gorges 5a545bbe90 Use `assertEqualSets()` in `comment_author` test.
The previous assertion was too specific, resulting in race conditions.

See #35377.

git-svn-id: https://develop.svn.wordpress.org/trunk@36279 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-13 04:42:59 +00:00
Boone Gorges 0b564d48df Support searching for `'0'` in `WP_Query`.
Props swissspidy.
See #31025.

git-svn-id: https://develop.svn.wordpress.org/trunk@36278 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-13 04:36:54 +00:00
Boone Gorges bf2f6f8104 Use the post-filter WHERE clause when querying for comment descendants.
The descendant query in `WP_Comment_Query::fill_descendants()` uses the clauses
of the main `get_comment_ids()` query as a basis, discarding the `parent`,
`parent__in`, and `parent__not_in` clauses. As implemented in WP 4.4 [34546],
the WHERE clause was assembled in such a way that any modifications applied
using the `comments_clauses` filter were not inherited by `fill_descendants()`.
This resulted in descendant queries that did not always properly filter
results, and sometimes contained syntax errors.

The current changeset fixes the problem by using the post-filter WHERE clause
as the basis for the `fill_descendants()` query. This change requires a new
approach for eliminating the unneeded parent-related clauses: instead of
eliminating values in an associative array, we must use regular expressions.

Props boonebgorges, firebird75.
Fixes #35192.

git-svn-id: https://develop.svn.wordpress.org/trunk@36277 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-13 04:00:36 +00:00
Boone Gorges 1880b466c7 Always respect `$comments` array passed to `wp_list_comments()`.
[36157] fixed a bug whereby `wp_list_comments()` would not properly recognize
custom pagination arguments. See #35175. However, it inadvertently introduced
a bug that caused any `$comments` array explicitly passed to the function to be
ignored, when that array was accompanied by pagination arguments that differ
from those in `$wp_query`. We address this bug by moving the logic introduced
in [36157] inside a block that only fires when no `$comments` array has been
provided to the function.

Props ivankristianto.
Fixes #35356.

git-svn-id: https://develop.svn.wordpress.org/trunk@36276 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-13 03:26:31 +00:00
Boone Gorges f7d238dfe3 Ignore hierarchy in pagination calculation when comment threading is disabled.
In order to calculate comment pagination when newest comments are displayed
first, `comments_template()` must perform a separate query to determine the
total number of paginating comments available on a post. See [34729], #8071,
pagination calculation - can be defined as a top-level comment, or a comment
with `parent=0`. However, when comment threading is disabled, yet comments
exist in the database that have parents, all comments - even those with a
parent - are "paginating". (This typically happens when comments threading was
once enabled, but has since been turned off.) As such, the total-paginating-
comments query should only be limited to top-level comments when
'thread_comments' is disabled.

Props jmdodd.
Fixes #35419.

git-svn-id: https://develop.svn.wordpress.org/trunk@36275 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-13 03:12:34 +00:00
Rachel Baker 0e85f45cb4 Comments: Restrict the maximum characters for input fields within the comments template.
Added hardcoded maxlength attributes on the author, author_email, author_url, and comment_field input markup. These can be modified via the comment_form_defaults filter. Added logic in wp_handle_comment_submission() to return a WP_Error when the comment_author, comment_author_url, or comment_content values exceed the max length of their columns. Introduces wp_get_comment_column_max_length() which returns the max column length for a given column name, and is filterable. Unit tests included for the error conditions in wp_handle_comment_submission()

Fixes #10377.

Props westonruter rachelbaker.


git-svn-id: https://develop.svn.wordpress.org/trunk@36272 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-13 01:24:46 +00:00
Pascal Birchler 3a358c33d3 Introduce `wp_get_raw_referer()` to retrieve unvalidated referer.
For things like redirects `wp_get_referer()` should be used instead.

Props voldemortensen for initial patch.
Fixes #27152.

git-svn-id: https://develop.svn.wordpress.org/trunk@36266 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-12 08:31:10 +00:00
Weston Ruter 2fa620e4c3 Customizer: Prevent erroneously directing user to login screen when closing.
Fixes issue where user gets stuck at login screen after trying to close the app if previously they had to first login to access the Customizer. Prevents `WP_Customize_Manager::get_return_url()` from using `wp-login.php` as a referer.

Props chandrapatel.
See #32637.
Fixes #35355.


git-svn-id: https://develop.svn.wordpress.org/trunk@36261 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-11 18:50:30 +00:00
Pascal Birchler 94992e25ae Rewrite: Ensure `WP_Rewrite::flush_rules()` does not delete the 'rewrite_rules' option.
Instead, the option gets updated to an empty string.
Adds unit tests.

Props SergeyBiryukov, jesin, voldemortensen.
Fixes #29107.

git-svn-id: https://develop.svn.wordpress.org/trunk@36254 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-10 19:01:13 +00:00
Pascal Birchler 519051b305 Permalinks: Ensure the page hierarchy is correct for sample permalinks.
Fixes #35368.

git-svn-id: https://develop.svn.wordpress.org/trunk@36253 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-10 18:27:06 +00:00
Boone Gorges 28818255c2 Don't reset index keys when trimming results of term queries.
`array_slice()` must be told to preserve keys when the query results exceed the
limit specified the 'number' parameter, so that `id=>parent` and other
id-indexed return value formats don't get mangled.

Props fantasyworld, wpdelighter.
Fixes #35382.

git-svn-id: https://develop.svn.wordpress.org/trunk@36252 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-10 04:05:26 +00:00
Boone Gorges e75a1f5ab3 Avoid invalid SQL when building ORDER BY clause using long search strings.
The introduction of negative search terms in 4.4 [34934] introduced the
possibility that the ORDER BY clause of a search query could be assembled in
such a way as to create invalid syntax. The current changeset fixes this by
ensuring that the ORDER BY clause corresponding to the search terms is
excluded when it would otherwise be empty.

Props salvoaranzulla.
Fixes #35361.

git-svn-id: https://develop.svn.wordpress.org/trunk@36251 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-10 03:25:15 +00:00
John Blackbourn 6681e9701c Taxonomy: More tests for `unregister_taxonomy()`.
See #35227


git-svn-id: https://develop.svn.wordpress.org/trunk@36247 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-09 23:34:27 +00:00
Pascal Birchler eafbcb3b6e Taxonomy: Introduce `unregister_taxonomy()`.
This new function can be used to completely unregister non built-in taxonomies.

Fixes #35227.

git-svn-id: https://develop.svn.wordpress.org/trunk@36243 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-09 14:57:22 +00:00
Pascal Birchler d92ead50c8 Ensure `wp_get_referer()` returns `false` when the referrer URL is the current URL.
Adds unit tests.

Fixes #19856.

git-svn-id: https://develop.svn.wordpress.org/trunk@36242 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-09 14:35:03 +00:00
Pascal Birchler 54134dd49b Media: Fix `wp_audio_shortcode` and `wp_video_shortcode` attributes handling.
Although documented, the `class` and `style` attributes were simply ignored.
Adds unit tests.

Fixes #35367.

git-svn-id: https://develop.svn.wordpress.org/trunk@36240 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-09 14:17:02 +00:00
Dion Hulse 0e73cc3da4 Tests: Add more paged canonical tests for page_on_front.
See #35344.


git-svn-id: https://develop.svn.wordpress.org/trunk@36238 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-09 08:08:47 +00:00
Dion Hulse 5f55910b5c Tests: Remove some debug that's slipped in at some point.
git-svn-id: https://develop.svn.wordpress.org/trunk@36236 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-09 06:11:58 +00:00
Boone Gorges 8dbc62d267 In `comments_template()`, don't run hierarchical queries if comment threading is disabled.
When hierarchical=true, `WP_Comment_Query` will always fetch comments according
to the comment hierarchy, even if 'thread_comments' is disabled for the site.
This can cause problems when comment threading is disabled after threaded
comments have been recorded on the site; comments will no longer be returned in
a strictly chronological order.

We address the issue by refraining from querying hierarchically when comment
threading is disabled.

Props jmdodd.
Fixes #35378.

git-svn-id: https://develop.svn.wordpress.org/trunk@36226 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-08 22:16:11 +00:00
Eric Andrew Lewis 5304745be0 Permalinks: Make `get_post_type_archive_link()` work for the 'post' post type.
Props jjj.
See #19902. 


git-svn-id: https://develop.svn.wordpress.org/trunk@36225 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-08 22:00:48 +00:00
Boone Gorges b5a4504f7e Introduce 'author_url' param to `WP_Comment_Query`.
Props swissspidy.
Fixes #35377.

git-svn-id: https://develop.svn.wordpress.org/trunk@36224 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-08 21:51:50 +00:00
Pascal Birchler 1f47f9c5f5 Tests: Fix unit tests after [36217].
See #35236.

git-svn-id: https://develop.svn.wordpress.org/trunk@36218 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-07 10:16:47 +00:00
Pascal Birchler 79f2e50ca5 Rewrite: Add a `remove_rewrite_tag()` helper function.
It can be used to properly remove registered rewrite tags. Adds unit tests.

Fixes #35236.

git-svn-id: https://develop.svn.wordpress.org/trunk@36217 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-07 09:38:06 +00:00
Boone Gorges e49c8b425c Allow comment agent and author IP to be set via `wp_update_comment()`.
Props adamsilverstein, welcher.
Fixes #35276.

git-svn-id: https://develop.svn.wordpress.org/trunk@36215 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-07 03:54:05 +00:00
Boone Gorges 3a9bc32949 Ensure 'description' is a string in `wp_insert_term()`.
Passing `'description' => null` when creating a term can cause MySQL notices,
as the description column in the terms table does not allow for null values.
We correct this by intepreting a `null` description as an empty string.

Props TimothyBlynJacobs.
Fixes #35321.

git-svn-id: https://develop.svn.wordpress.org/trunk@36214 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-07 03:31:48 +00:00
Dion Hulse 549c4fdd1d Unit Tests: Fix the unit test added in [36181] to include the index in the comparison.
See #35235


git-svn-id: https://develop.svn.wordpress.org/trunk@36183 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-06 08:09:51 +00:00
Pascal Birchler e055e5b80e Rewrite: Add a `remove_permastruct()` helper function.
It can be used to remove permastructs that were added using `add_permastruct()`.

Fixes #35235.

git-svn-id: https://develop.svn.wordpress.org/trunk@36181 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-06 07:39:29 +00:00
Pascal Birchler e50296de48 Query: Add a `WP::remove_query_var()` helper function.
This makes cleaning up public query vars easier.

Fixes #35234.

git-svn-id: https://develop.svn.wordpress.org/trunk@36177 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-05 20:56:10 +00:00
Konstantin Obenland 0d6514b28b Template: Always display the site title on the front page.
Limits using the page title to the blog page when the site has a static front page,
bringing it N’Sync with `wp_title()`.

Props peterwilsoncc.
Fixes #34962.



git-svn-id: https://develop.svn.wordpress.org/trunk@36168 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-04 17:15:31 +00:00
Andrew Nacin 5699c64a56 XML-RPC: Revert [34681] as it broke date handling.
props dossy, hnle, redsweater.
see #35053, #30429 (original ticket).


git-svn-id: https://develop.svn.wordpress.org/trunk@36163 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-03 19:48:07 +00:00
Boone Gorges 23b10789d4 Fix incorrect `@covers` annotation in `get_adjacent_post()` tests.
Introduced in [36077].

Props netweb.
Fixes #35211.

git-svn-id: https://develop.svn.wordpress.org/trunk@36159 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-03 02:43:18 +00:00
Boone Gorges 1b8c0d611a Ensure that non-default pagination values work in `wp_list_comments()`.
Prior to 4.4, it was possible to pass 'page' and 'per_page' values to
`wp_list_comments()` that do not match the corresponding global query vars.
This ability was lost in 4.4 with the refactor of how `comments_template()`
queries for comments; when the main comment query started fetching only the
comments that ought to appear on a page, instead of all of a post's comments,
it became impossible for the comment walker to select comments corresponding to
custom pagination parameters. See #8071.

We restore the previous behavior by (a) detecting when a 'page' or 'per_page'
parameter has been passed to `wp_list_comments()` that does not match the
corresponding query vars (so that the desired comments will not be found in
`$wp_query`), and if so, then (b) querying for all of the post's comments and
passing them to the comment walker for pagination, as was the case before 4.4.

Props boonebgorges, smerriman.
Fixes #35175.

git-svn-id: https://develop.svn.wordpress.org/trunk@36157 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-03 02:02:59 +00:00
Rachel Baker 21a4585cd1 Feeds: Comments on attachments display in the site-wide comments RSS feed.
Individual attachment pages already have their own RSS comment feed, and would be expected to be included in the site-wide comments RSS feed.

Props jbrinley. 
Fixes #15610



git-svn-id: https://develop.svn.wordpress.org/trunk@36138 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-31 17:15:23 +00:00
Sergey Biryukov c04ae32ff9 Widgets: Revert [34465], as it introduced a regression, making the `$index` argument of `dynamic_sidebar()` case-sensitive.
Fixes #34995 for trunk. See #23423.

git-svn-id: https://develop.svn.wordpress.org/trunk@36130 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-31 03:12:36 +00:00
Gary Pendergast a9dcce7060 Redirects: Prevent redirects if a queried object exists.
After [34659], it became possible to cause an incorrect redirect, by changing the slug of a post, then creating a new post with the old slug. The correct behaviour is to prevent redirecting to the old post.

Props dd32, pento.

Fixes #35031 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@36128 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-31 03:00:33 +00:00
Pascal Birchler aae9afe5aa Comments: Don't nofollow links within the site.
Fixes #11360.

git-svn-id: https://develop.svn.wordpress.org/trunk@36125 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-30 23:19:11 +00:00
Andrew Ozz 8686ab4a7a Responsive images: fix the check whether the attachment meta matches the image src to work with http/https and CDNs.
Props webaware, joemcgill, azaozz.
Fixes #35045 and #35102 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@36121 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-30 01:03:11 +00:00
Andrew Ozz f39a799718 Responsive images: add compatibility for versions < 2.7 when the full image path was stored in the metadata. Introduces `_wp_get_attachment_relative_path()` and uses it in `wp_get_attachment_url()`.
Props dd32, SergeyBiryukov.
Fixes #35106 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@36120 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-30 00:05:07 +00:00
Aaron Jorbin d65a4e6498 Ensure only approved comments trigger post author notifications
Posts that are trashed shouldn't trigger post author notifications.  Adds unit tests to enforce this.

Props scottbrownconsulting, peterwilsoncc, swissspidy
Fixes #35006



git-svn-id: https://develop.svn.wordpress.org/trunk@36119 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-29 17:53:23 +00:00
Dion Hulse 18a6a047bd Tests: After [36100] use an object style which is compatible with PHP5 `get_object_vars()`.
See #35058.


git-svn-id: https://develop.svn.wordpress.org/trunk@36117 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-29 05:43:05 +00:00
Gary Pendergast f46c0a637b Tests: When testing the `utf8mb4` charset, ensure that the current MySQL server has `utf8mb4` support.
See #35249.



git-svn-id: https://develop.svn.wordpress.org/trunk@36116 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-29 04:39:02 +00:00
Sergey Biryukov 26d7619306 Import: Add a missing space to `post_exists()`.
The lack of space resulted in SQL error when searching for posts by content.

Props yetAnotherDaniel, johnbillion.
Fixes #35246.

git-svn-id: https://develop.svn.wordpress.org/trunk@36113 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-28 19:06:05 +00:00
John Blackbourn a9b9aa65b9 Themes: Add `singular` to the list of body classes when viewing a single post object.
Adds tests

Fixes #35164
Props danielpataki, johnbillion


git-svn-id: https://develop.svn.wordpress.org/trunk@36112 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-28 17:20:07 +00:00
Andrew Ozz 9b9d310c74 Responsive images: when creating `srcset` do not exclude the image size which is in the `src` attribute even when it is larger than `max_srcset_image_width`.
Props joemcgill.
Fixes #35108 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@36110 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-28 02:28:53 +00:00
Boone Gorges ba1f056a26 Force non-public taxonomies to have a query_var of `false`.
[35333] implemented `public=false` for taxonomies. The implementation prevented
non-public taxonomies from having their archives accessed via query_var during
a normal request. But it didn't prevent non-public taxonomies from registering
their query vars in the `$wp_taxonomies` global. The latter implementation
details causes problems specifically when a taxonomy is registered with
`query_var=true`; for public taxonomies, `register_taxonomy()` translates this
into a query_var equivalent to the taxonomy name, but in the case of non-public
taxonomies, the query_var was set to the boolean itself. The boolean then
causes problems when using non-strict comparison to filter taxonomy objects by
query_var, as when using `get_taxonomies()`.

This changeset addresses the issue by forcing the query_var property of
non-public taxonomies to `false`.

Fixes #35089.

git-svn-id: https://develop.svn.wordpress.org/trunk@36108 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-27 16:40:13 +00:00
Dion Hulse 0ce64dd122 Allow `map_deep()` to work with object properties containing a reference. Restores the previous behaviour of `stripslashes_deep()`.
Props jeff@pyebrook.com, swissspidy.
See #22300, [35252].
Fixes #35058.


git-svn-id: https://develop.svn.wordpress.org/trunk@36100 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-26 05:21:14 +00:00
Dion Hulse 42aeb0af8b Tests: Use the correct URL in some shortcode tests.
git-svn-id: https://develop.svn.wordpress.org/trunk@36099 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-26 04:50:23 +00:00
Dion Hulse a1cd9049d9 Shortcodes: `=` is a reserved character in shortcode names, mark it as such.
This allows for shortcodes such as `[shortcode=attribute]` to work, which while never intentionally supported were widely used in the pre-shortcode days.

Props aaroncampbell.
Fixes #34939 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@36097 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-26 04:45:26 +00:00
Dion Hulse 1d2904bf2a Pages: `get_page_uri()` should return the URI at which the resource being accessed is available at, this may include non-'publish' status posts.
Reverts [34001] and fixes the original issue in #15963 - avoiding a PHP Notice for when the post doesn't exist.

Props tharsheblows.
See #15963.
Fixes #35084.


git-svn-id: https://develop.svn.wordpress.org/trunk@36094 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-26 03:45:28 +00:00
Aaron Jorbin bc01ead655 Help Tab Order should be based on the Priority Argument
[34370] made the order that tabs are returned respect the order they are added, however it broke the respect of priority. By using a ksort instead of a sort, we can restore that default behavior. This adjusts the unit tests so that both order added and priority are tested.

Props meitar,  swissspidy, jorbin
Fixes #35215. See #33941.


git-svn-id: https://develop.svn.wordpress.org/trunk@36089 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-25 22:43:41 +00:00
Konstantin Obenland 1d68393907 Taxonomy: Pass object ids to delete_* actions.
Allows for more targeted updates to affected posts in callbacks.
Disambiguates `$objects` variable and amends unit tests.

Fixes #35213.


git-svn-id: https://develop.svn.wordpress.org/trunk@36080 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-23 23:43:03 +00:00
Boone Gorges fff6412f91 Move excluded_terms filter in `get_adjacent_post()`.
The filter was added in 4.4 [34528] #9571, but in a place where it could not
affect the adjacent post query.

Fixes #35211.

git-svn-id: https://develop.svn.wordpress.org/trunk@36078 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-23 19:56:32 +00:00
Boone Gorges 7d03711fc8 Move `get_adjacent_post()` tests to their own file.
See #35211.


git-svn-id: https://develop.svn.wordpress.org/trunk@36077 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-23 19:38:29 +00:00
Gary Pendergast 0b9d32a614 Embeds: Don't show embed discovery link on a static front page.
There's currently no iframe content being generated for a static front page. Giving out a link to that isn't an ideal user experience.

Props peterwilsoncc.

Fixes #35194 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@36059 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-22 10:49:20 +00:00