Commit Graph

931 Commits

Author SHA1 Message Date
Boone Gorges f0d6031d9b Streamline support for multiple post types in `get_posts_by_author_sql()`.
* Don't accept a comma-separated list, only a single post type or an array of post types. This is easier to document.
* Add changelog entries to all calling functions.

Props DrewAPicture.
Fixes #32243.

git-svn-id: https://develop.svn.wordpress.org/trunk@32524 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-21 19:48:19 +00:00
Boone Gorges e656053bce Support multiple post types in `count_user_posts()` and other functions that use `get_posts_by_author_sql()`.
Props nikonratm.
Fixes #32243.

git-svn-id: https://develop.svn.wordpress.org/trunk@32523 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-21 18:42:49 +00:00
Boone Gorges 15a0c621ea Add tests for `check_comment()`.
Props CalEvans, rachelbaker.
Fixes #31108.

git-svn-id: https://develop.svn.wordpress.org/trunk@32519 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-20 19:08:07 +00:00
John Blackbourn 064bed9792 Use the available user and blog factories in the `Tests_Multisite_Option::test_with_another_site()` test.
Fixes #32404


git-svn-id: https://develop.svn.wordpress.org/trunk@32518 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-20 19:02:42 +00:00
Jeremy Felt 6063b2c0f9 Use `WP_TESTS_DOMAIN` in `test_get_blogaddress_by_id_with_valid_id()`
A hard coded `example.org` would break the test if a custom `WP_TESTS_DOMAIN` was specified. We should defer to the configured default.

Fixes #32026.


git-svn-id: https://develop.svn.wordpress.org/trunk@32512 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-19 05:45:31 +00:00
Sergey Biryukov 09bd58b4c9 In `comment_form()`, ensure that filtered arguments contain all required default values.
props boonebgorges.
fixes #32312 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@32511 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-19 01:03:39 +00:00
Boone Gorges 0027615ed1 Improve unit tests for `wp_unique_term_slug()`.
See #20783.

git-svn-id: https://develop.svn.wordpress.org/trunk@32507 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-15 20:37:51 +00:00
Boone Gorges 1a8bd3bf07 In category dropdown, 'selected' should match against 'value_field'.
Props tlexcellent.
Fixes #32330.

git-svn-id: https://develop.svn.wordpress.org/trunk@32484 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-11 13:10:19 +00:00
John Blackbourn 39639c79da Add a return value to `wp_register_script()` and `wp_register_style()` which matches the return value of `WP_Dependencies::add()`.
Props katzwebdesign, pareshradadiya, DrewAPicture.

Fixes #31126


git-svn-id: https://develop.svn.wordpress.org/trunk@32483 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-10 19:56:15 +00:00
Boone Gorges 637bedeece Use table prefix for `comment__in` and `comment__not_in` SQL clauses of `WP_Comment_Query`.
The prefix prevents ambiguity when joining against other tables.

Props willgladstone.
Fixes #32081.

git-svn-id: https://develop.svn.wordpress.org/trunk@32461 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-08 19:44:06 +00:00
Gary Pendergast ed53ad2c53 WPDB: When sanity checking query character sets, there's no need to check queries that don't return user data.
See #32104.



git-svn-id: https://develop.svn.wordpress.org/trunk@32374 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-06 06:04:50 +00:00
Gary Pendergast 923c6c981b WPDB: Allow queries to reference tables in the `dbname.tablename` format, and allow table names to contain any valid character, rather than just ASCII.
Props pento, willstedt for the initial patch.

See #32090.



git-svn-id: https://develop.svn.wordpress.org/trunk@32368 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-06 05:00:39 +00:00
Gary Pendergast 2ce97b2984 WPDB: When checking that a string can be sent to MySQL, we shouldn't use `mb_convert_encoding()`, as it behaves differently to MySQL's character encoding conversion.
Props mdawaffe, pento, nbachiyski, jorbin, johnjamesjacoby, jeremyfelt.

See #32165.



git-svn-id: https://develop.svn.wordpress.org/trunk@32364 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-06 02:59:50 +00:00
Boone Gorges 35db6d722b In `paginate_links()`, improve handling of custom pagination query vars.
Custom pagination query vars, as provided in the 'base' parameter, must be
detected in the current page URL and removed before generating fresh pagination
links. The logic introduced in this changeset ensures that these custom
query vars are properly detected in cases where the 'format' param contains
a `#`.

This is a follow-up to [31203] #30831.

Fixes #31939.

git-svn-id: https://develop.svn.wordpress.org/trunk@32359 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-05 21:58:23 +00:00
Boone Gorges 70f530e238 youtube.com oEmbed test should always expect HTTPS.
YouTube recently changed its oEmbed endpoint so that the iframe markup always
contains an HTTPS URL, regardless of the scheme of the video URL originally
requested. This changeset fixes the corresponding unit test.

Fixes #32260.

git-svn-id: https://develop.svn.wordpress.org/trunk@32358 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-05 21:30:57 +00:00
Boone Gorges ba712c6789 Unit tests for `get_page_children()`.
Props santagada, boonebgorges.
See #10852.

git-svn-id: https://develop.svn.wordpress.org/trunk@32354 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-05 19:36:46 +00:00
Boone Gorges 1efe303ebf Improve sanitization of 'name' param in `get_terms()`.
Values of 'name' that contain db-encoded character on insert - like an
ampersand, which is HTML-encoded in the database - will only match if they go
through the same `sanitize_term_field()` routine.

Fixes #32248.

git-svn-id: https://develop.svn.wordpress.org/trunk@32353 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-05 11:13:51 +00:00
Aaron Jorbin d0567838e4 Update QUnit to v1.18.0
See https://github.com/jquery/qunit/blob/1.18.0/History.md for changes from 1.12.0 to now.  Mostly bug fixes and internal changes in preparation for QUnit v2.

See #30824



git-svn-id: https://develop.svn.wordpress.org/trunk@32343 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-04 19:43:38 +00:00
Boone Gorges 93a4bf15e4 Attachment URLs should only be forced to SSL on the front end.
Detecting SSL status on the Dashboard introduces problems when writing content
that is saved to the database and then displayed on the front end, where SSL
may be optional (or impossible, due to self-signed certificates). The new
approach parallels the logic in `get_home_url()` for forcing HTTPS.

See [31614] #15928 for background.

Fixes #32112 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@32342 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-04 13:09:14 +00:00
Boone Gorges e5e467a41b Allow metadata to be deleted when meta_value matches 0 or '0'.
In `delete_metadata()`, be stricter about when to ignore a falsey value of
`$meta_value`.

For backward compatibility, an empty string for `$meta_value` is equivalent to
`null` or `false`.

Props sc0ttkclark.
Fixes #32224.

git-svn-id: https://develop.svn.wordpress.org/trunk@32331 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-01 16:37:35 +00:00
Gary Pendergast 0152b8f49b In [32299], we should be using `mb_strlen()` for our string size checks.
git-svn-id: https://develop.svn.wordpress.org/trunk@32306 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-27 14:41:48 +00:00
Gary Pendergast 45b0abbef1 WPDB: Sanity check that any strings being stored in the DB are not too long to store correctly.
git-svn-id: https://develop.svn.wordpress.org/trunk@32299 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-27 14:02:45 +00:00
Boone Gorges c3ea088948 When priming the cache for taxonomy term nav items, don't fetch term descendants.
Descending the term tree causes unnecessary database queries when priming the
cache for a term with many descendants.

Fixes #31724.

git-svn-id: https://develop.svn.wordpress.org/trunk@32294 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-24 18:57:07 +00:00
Boone Gorges 7add279793 Allow rewrite endpoints to be registered without also registering query vars.
Passing `false` to `add_rewrite_endpoint()` will now allow you to take
advantage of the rewrite API without thereby modifying the way that WP sets up
the main query from the request URI.

This new functionality allows developers to work around certain edge-case bugs,
such as when a proper endpoint request (such as `/test/1/`) would short-
circuit `is_home()` calculation when a static front page is set.

Props mordauk, boonebgorges.
Fixes #25143.

git-svn-id: https://develop.svn.wordpress.org/trunk@32293 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-24 16:37:12 +00:00
Boone Gorges 000f4f98b4 In `wp_list_categories()`, 'All' link should point to post type archive if taxonomy is not registered for 'post' or 'page'.
Instead, we point to the post type archive of the first registered
object_type that supports archives.

Props stevegrunwell, hrishiv90, boonebgorges.
Fixes #21881.

git-svn-id: https://develop.svn.wordpress.org/trunk@32292 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-24 14:56:37 +00:00
Gary Pendergast cc8a9824c5 WPDB: When sanity checking a string by sending it to MySQL for conversion checks, the incorrect data structure was being returned from `wpdb::strip_invalid_text()`, causing all write queries to fail for some character sets when the query contained non-ASCII characters.
See #32051.



git-svn-id: https://develop.svn.wordpress.org/trunk@32261 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-22 15:01:25 +00:00
Gary Pendergast afe046a84c WPDB: When deciding if a query needs extra sanity checking based on collation, we can quickly return if the query is entirely ASCII characters.
See #32029.



git-svn-id: https://develop.svn.wordpress.org/trunk@32233 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-21 05:23:44 +00:00
Gary Pendergast 0fe5a64e56 WPDB: When deciding if a query needs extra sanity checking based on collation, we can quickly return if it's a query that will never return user data.
Fixes #32029.



git-svn-id: https://develop.svn.wordpress.org/trunk@32232 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-21 05:10:11 +00:00
Boone Gorges 80ca5b2b53 In term-splitting unit tests, correct incorrect wording in an inline comment.
Props dlh.
Fixes #32014.

git-svn-id: https://develop.svn.wordpress.org/trunk@32208 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 15:17:24 +00:00
Boone Gorges 1a38d95e83 Ensure that 'who' param is respected when generating meta_query in `WP_User_Query`.
Since [31669], the 'who' param had been parsed after meta_query was generated,
so that 'who' was effectively ignored.

Props imath.
Fixes #32019.

git-svn-id: https://develop.svn.wordpress.org/trunk@32207 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 15:15:14 +00:00
Gary Pendergast c9774eac69 Unit Tests: The `get_smilies_combinations` test was failing when the tests were run with a non-default domain.
Props netweb.

Fixes #32025.



git-svn-id: https://develop.svn.wordpress.org/trunk@32178 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 10:10:53 +00:00
Gary Pendergast 8453d41a44 Fix the unit test added in [32173] to run correctly in PHP 5.2.
git-svn-id: https://develop.svn.wordpress.org/trunk@32177 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 09:40:11 +00:00
Gary Pendergast 94f02ef8b1 In Multisite, prevent plugins from unintentionally switching sites.
Props mdawaffe.



git-svn-id: https://develop.svn.wordpress.org/trunk@32173 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 07:26:05 +00:00
Gary Pendergast 332750a40d Revert [30640], as it was incorrectly checking some filenames.
git-svn-id: https://develop.svn.wordpress.org/trunk@32171 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 06:38:08 +00:00
Gary Pendergast 96f12cc588 Clean up some edge cases in `sanitize_sql_orderby()`.
Props vortfu, dd32.



git-svn-id: https://develop.svn.wordpress.org/trunk@32164 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 05:41:37 +00:00
Gary Pendergast faa66d8145 WPDB: When sanity checking read queries, there are some collations we can skip, for improved performance.
Props pento, nacin.

See #21212.



git-svn-id: https://develop.svn.wordpress.org/trunk@32162 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 04:45:12 +00:00
Boone Gorges bf3773dbfb During PHPUnit tests, don't autodetect permalink structure during WP installation.
The unit tests expect non-pretty permalinks, so there's no benefit to detecting
the ability to have pretty permalinks. Moreover, the `wp_remote_get()` call can
cause installation to hang when there are DNS issues.

Fixes #31994.

git-svn-id: https://develop.svn.wordpress.org/trunk@32139 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-16 23:59:01 +00:00
Sergey Biryukov 3b6ff03136 `wp_update_term()` should check if `get_term()` returned null.
props dlh.
fixes #31954.

git-svn-id: https://develop.svn.wordpress.org/trunk@32117 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-13 01:20:57 +00:00
Gary Pendergast b806e118c6 When `dbDelta()` is checking whether an index is defined in a `CREATE TABLE` statement, don't worry if MySQL has a subpart defined on an index, but the `CREATE TABLE` doesn't.
Fixes #31869.



git-svn-id: https://develop.svn.wordpress.org/trunk@32108 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-11 10:39:49 +00:00
Gary Pendergast 1de9bc1670 Smilies: Tweak which smiley matches which emoji.
Props iseulde.

See #31709.



git-svn-id: https://develop.svn.wordpress.org/trunk@32105 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-10 06:29:49 +00:00
Gary Pendergast 3bd66eff61 Smilies: Update our few remaining smilies to better align with Twemoji, and add frownie.png until Twemoji provide a build containing it.
Props joen.

See #31709.



git-svn-id: https://develop.svn.wordpress.org/trunk@32104 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-10 06:19:39 +00:00
Boone Gorges bffb632183 Improve handling of incomplete From and Content-Type headers in `wp_mail()`.
When an incomplete header is provided (eg, 'From' with an email address but no
name), ensure that the WP defaults are filled in properly.

Props valendesigns.
Fixes #30266.

git-svn-id: https://develop.svn.wordpress.org/trunk@32070 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-07 20:09:46 +00:00
Boone Gorges ddb33c9aed After [31114] and [31323], 'View Post' generated in `get_sample_permalink_html()` should go to pretty permalink.
`get_permalink()` will return a non-pretty permalink for future posts, which
breaks some user workflows that expect View Post to lead to a page with the
pretty permalink.

Fixes #30910.

git-svn-id: https://develop.svn.wordpress.org/trunk@32002 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-04 01:26:08 +00:00
Boone Gorges 468da41811 `WP_User_Query`: When querying users with 'fields=all', ensure that caps and roles are filled for the current site.
See [15566] for a parallel fix for 'fields=all_with_meta'.

Fixes #31878.

git-svn-id: https://develop.svn.wordpress.org/trunk@32001 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-03 14:13:19 +00:00
Boone Gorges 86f074ffde Unit tests verifying the filling of the 'roles' and 'caps' user properties during `WP_User_Query`.
See #31878.

git-svn-id: https://develop.svn.wordpress.org/trunk@32000 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-03 14:13:11 +00:00
John Blackbourn d92cc07d91 Correctly set the post author in `wp_xmlrpc_server::mw_editPost()` when the current user is not the author of the post.
Props redsweater, markoheijnen, DrewAPicture
Fixes #24916


git-svn-id: https://develop.svn.wordpress.org/trunk@31983 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-02 15:48:41 +00:00
Sergey Biryukov 4738590d5e Avoid duplicate classes for different terms with UTF-8 slugs in `post_class()` and `body_class()`.
Fall back to term ID if the sanitized slug is numeric or only contains hyphens.

props SergeyBiryukov, A5hleyRich, sgrant, davideugenepratt.
fixes #30883.

git-svn-id: https://develop.svn.wordpress.org/trunk@31979 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-02 01:04:22 +00:00
Gary Pendergast b9537f9488 Unit Tests added in [31970] need to be restricted to run in Multisite only.
See #17904, #26784.



git-svn-id: https://develop.svn.wordpress.org/trunk@31978 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-02 00:12:07 +00:00
Boone Gorges 4201382267 Unit tests for `wpmu_validate_user_signup()`.
See #17904, #26784.

git-svn-id: https://develop.svn.wordpress.org/trunk@31970 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-01 21:37:34 +00:00
Scott Taylor d1235e323e Respect numerical keys in `add_query_arg()`, use `array_replace()` instead of `array_merge()`.
Adds unit test.

Props tyxla.
Fixes #31306.


git-svn-id: https://develop.svn.wordpress.org/trunk@31966 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-01 19:14:46 +00:00
Scott Taylor bcf98c7742 Alter the regex in `wptexturize()` to properly handle input like: `<> "Hello world" <>`.
Updates unit test data.

Props miqrogroove.
Fixes #30344.


git-svn-id: https://develop.svn.wordpress.org/trunk@31965 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-01 19:08:31 +00:00
Scott Taylor 2418711c47 When updating the email address for an existing user, make sure the email address is not already in use.
Adds unit tests.

Props rittesh.patel, DrewAPicture.
Fixes #30647.


git-svn-id: https://develop.svn.wordpress.org/trunk@31963 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-01 18:22:16 +00:00
Gary Pendergast ed374ae10e WPDB: Due to PHP 5.2's internal string handling, strings in Windows are encoded using UTF-16, instead of UTF-8. With the addition of the many character set tests in [30345], a couple of them were tripping up in PHP 5.2 under Windows, because of this behaviour.
This marks those tests as skipped.

See #31262 for more discussion.



git-svn-id: https://develop.svn.wordpress.org/trunk@31953 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-01 12:33:39 +00:00
Gary Pendergast 4e6cb8a5e2 Emoji: Fix a unit test which was incorrectly failing after [31926] fixed emoji being incorrectly encoded.
git-svn-id: https://develop.svn.wordpress.org/trunk@31940 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-31 09:36:29 +00:00
Dion Hulse 9ce354f534 Tests: Clean up the resulting /tmp/foo* files from the `tempnam` call.
git-svn-id: https://develop.svn.wordpress.org/trunk@31937 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-31 02:10:52 +00:00
Dion Hulse 842d6a9b39 Add some logic into `wp_tempnam` to prevent it creating 'falsey' directory names that might get used elsewhere within WordPress.
Although this logic looks a little strange at this low level, it's the best location within the Upgrades code for it to happen.
Fixes #31811


git-svn-id: https://develop.svn.wordpress.org/trunk@31936 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-31 02:10:06 +00:00
Gary Pendergast eced539d8b Emoji: [31864] changed emoji image's inline style from `height` to `max-height`. Unfortunately, anything using `feedparser.py` (for example, NewsBlur) strips out `max-height`, which gives us massive emoji in feeds.
This re-adds `height`, and also reminds us why we can't have nice things.

See #31719.



git-svn-id: https://develop.svn.wordpress.org/trunk@31909 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-27 02:11:45 +00:00
Gary Pendergast b3e3766233 Emoji: Gmail doesn't obey an `<img>`'s inline CSS `height` rule, transforming it to `min-height`. To avoid giant smiley faces everywhere, we're changing the `height` rule to `max-height`, which Gmail plays nicer with.
Props janhenckens.

Fixes #31719.



git-svn-id: https://develop.svn.wordpress.org/trunk@31864 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-23 12:07:47 +00:00
Boone Gorges 6d7c4f39f0 Use shared fixtures in RSS2 unit tests.
See #31705, #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@31848 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-20 12:34:28 +00:00
Boone Gorges bb2ddebec9 Enforce non-pretty permalinks in RSS2 tests.
Previously, the tests were using '/feed/' in their `go_to()` statements, but
testing nodes for URLs like '?p='. This mismatch created unpredictable results
when the run in certain sequences with other groups of unit tests.

See #31705.

git-svn-id: https://develop.svn.wordpress.org/trunk@31846 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-20 12:25:27 +00:00
Boone Gorges 6de5ae56dd Ensure that fixtures in RSS2 tests have an author.
This makes the 'dc:creator' assertions more meaningful.

Props ianmjones.
See #31705.

git-svn-id: https://develop.svn.wordpress.org/trunk@31845 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-20 12:25:18 +00:00
Boone Gorges 819ea5cabe Move and tests to their own files.
git-svn-id: https://develop.svn.wordpress.org/trunk@31812 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-18 13:27:15 +00:00
Boone Gorges 12784e13d4 Improve method consistency in `WP_Comment_Query`.
* Introduce a `__construct()` method, which can accept an array of query vars.
* Move query logic out of `query()` method and into a new `get_comments()` method.
* Ensure that `$this->comments` is set whenever `get_comments()` returns a value.
* Introduce a `parse_query()` method, where query vars are parsed with default values and the 'parse_comment_query' action is fired.

These changes bring `WP_Comment_Query` syntax closer to that of `WP_Query`.

Props westonruter, morganestes, boonebgorges.
Fixes #24826.

git-svn-id: https://develop.svn.wordpress.org/trunk@31793 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-16 14:23:33 +00:00
Boone Gorges ec49827b0b In `wp_insert_term()`, allow a term with an existing name if a unique `$slug` has been provided.
`wp_insert_term()` protects against the creation of terms with duplicate names
at the same level of a taxonomy hierarchy. However, it's historically been
possible to override this protection by explicitly providing a value of `$slug`
that is unique at the hierarchy tier. This ability was broken in [31734], and
the current changeset restores the original behavior.

A number of unit tests are added and refactored in support of these changes.

See #17689 for discussion of a fix that was superceded by [31734]. This commit
retains the fix for the underlying bug described in that ticket.

See #31328.

git-svn-id: https://develop.svn.wordpress.org/trunk@31792 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-16 11:15:34 +00:00
Gary Pendergast 1c63c533b1 Tests: Since [31733], we now encode emoji in posts, instead of removing them (when they're being stored in versions of MySQL that don't support `utf8mb4`).
git-svn-id: https://develop.svn.wordpress.org/trunk@31782 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-15 11:50:54 +00:00
Gary Pendergast 3503aa4820 Smilies: The new smilies added in [31733] and [31745] are larger than the old smilies. While this is taken care of by the CSS on normal pages, it means they're disproportionally large when seen in RSS and email.
By adding a little bit of inline style to them, we get pleasingly sized smilies everywhere. :-)

See #31242



git-svn-id: https://develop.svn.wordpress.org/trunk@31781 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-15 11:40:16 +00:00
Boone Gorges 13e66393f1 Don't run `wp_get_archives()` cache test on multisite.
The introduction of a Customizer test that creates a new blog [31707] causes
`WP_INSTALLING` to be set by the time the `wp_get_archives()` tests run. This,
in turn, causes the query counts to vary in unpredictable ways.

See #31130.

git-svn-id: https://develop.svn.wordpress.org/trunk@31764 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-12 23:29:21 +00:00
Helen Hou-Sandi 21134a0c89 Allow `is_page_template()` to accept an array, as many other conditional tags do.
props morganestes, tyxla, DrewAPicture.
fixes #31271.


git-svn-id: https://develop.svn.wordpress.org/trunk@31754 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-12 16:27:06 +00:00
Gary Pendergast 1357e7fc2e Add emoji URL support, and Twemoji fallback for displaying slugs in wp-admin, when the browser doesn't natively support emoji.
Props pento, SergeyBiryukov and boonebgorges.

Fixes #31328



git-svn-id: https://develop.svn.wordpress.org/trunk@31734 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-11 22:54:49 +00:00
Gary Pendergast ae391ec226 Add emoji support, with Twemoji fallback.
Replace exisiting smilies with equivalent emoji, or with shiny new smiley images where no emoji existed.

Props batmoo, joen and mkaz for the original plugin upon which this is based.

Props pento, iseulde, kraftbj and peterwilsoncc for making the internet's dreams come true.

See #31242



git-svn-id: https://develop.svn.wordpress.org/trunk@31733 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-11 22:48:16 +00:00
John Blackbourn 82ac76c0a7 Introduce a new algorithm for displaying a hierarchical list of post objects in the `WP_Posts_List_Table`. This reduces processing time, reduces database queries, and substantially reduces memory use on sites with a high number of Pages.
Props nofearinc, rodrigosprimo, nacin, johnbillion.
Fixes #15459


git-svn-id: https://develop.svn.wordpress.org/trunk@31730 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-11 20:45:17 +00:00
Helen Hou-Sandi 22f174c106 Fix a unit test after [31721].
props jipmoors.
see #22329.


git-svn-id: https://develop.svn.wordpress.org/trunk@31728 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-11 20:11:38 +00:00
Dominik Schilling (ocean90) 32a124a884 Customizer: Return the original value when filtering theme mods/options and the current blog has changed.
props westonruter.
fixes #31428.

git-svn-id: https://develop.svn.wordpress.org/trunk@31707 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-10 23:04:12 +00:00
Dominik Schilling (ocean90) 63502a8a01 Customizer: Fix previewing and applying widgets when previewing another theme.
* Unset `wp_get_sidebars_widgets()`' non-admin cache var `$_wp_sidebars_widgets` in Customize theme preview.
* Add `WP_Customize_Setting::$dirty` so that settings can be initially-dirty when the Customizer loads.
* Mark `old_sidebars_widgets_data` setting initially-dirty.
* Mark all `sidebars_widgets` settings as initially-dirty during theme switch.

props westonruter.
see #31484.

git-svn-id: https://develop.svn.wordpress.org/trunk@31705 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-10 22:38:30 +00:00
Andrew Ozz 9aba4766fc TinyMCE: update to 4.1.9. Fixes #31551.
git-svn-id: https://develop.svn.wordpress.org/trunk@31700 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-10 19:19:56 +00:00
Boone Gorges 8072fe7db6 Improved customizability for the Submit button in `comment_form()`.
The new 'submit_button' and 'submit_field' parameters for `comment_form()`
allow developers to modify the markup of the submit button and its wrapper.
These params are accompanied by targeted 'comment_form_submit_button' and
'comment_form_submit_field' filters on the concatenated markup.

Props coffee2code, morpheu5, DrewAPicture, boonebgorges.
Fixes #15015.

git-svn-id: https://develop.svn.wordpress.org/trunk@31699 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-10 19:07:31 +00:00
Sergey Biryukov 5fe8182c7f EXIF/IPTC captions should populate Caption (`post_excerpt`) on upload, not Description (`post_content`).
Make sure the caption is always set if found. Previously, if the caption was less than 80 characters, only the Title field would be set.

props beaulebens, ericlewis, bendoh, SergeyBiryukov.
fixes #22768.

git-svn-id: https://develop.svn.wordpress.org/trunk@31694 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-10 05:06:39 +00:00
Boone Gorges 969c850149 Share fixtures across `wp_list_authors()` tests.
See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@31676 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-08 15:57:02 +00:00
Boone Gorges 5bb3e71cc0 Whitelist 'psd' for uploads when testing `wp_attachment_is() on multisite.
It's not allowed by default, which causes the fixture not to be built.

See #25275 [31647].

git-svn-id: https://develop.svn.wordpress.org/trunk@31670 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 18:47:04 +00:00
Boone Gorges a11372afe1 Improved 'orderby' meta syntax in `WP_User_Query`.
Recent commits have added the ability to order query results by specific
clauses of the 'meta_query' parameter (comments [31467], posts [31312] and
[31340]). The current changeset ports the same functionality to `WP_User_Query`.

Also introduced is the ability to pass the value of `$meta_key` to 'orderby'.

The internals of `WP_User_Query::prepare_users()` had to be reordered
somewhat to support these changes, primarily to ensure that the `meta_query`
object generates its SQL clauses before the 'orderby' parameter is parsed.

See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31669 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 18:37:05 +00:00
Boone Gorges 6a4839bd83 User query `meta_vars` test must account for the 'blog_id' clause added in multisite.
See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31668 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 17:33:48 +00:00
Boone Gorges 0fb3e2566f Add tests for the conversion of 'meta_*' query vars to `$meta_query` objects in all query classes.
See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31666 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 16:34:50 +00:00
Boone Gorges 945fd67d7b Improve 'orderby' syntax for `WP_User_Query`.
This changeset ports a number of 'orderby' features from `WP_Query` and
`WP_Comment_Query`:

* Allow multiple 'orderby' values to be passed as a space-separated list.
* Allow multiple 'orderby' values to be passed as a flat array.
* Allow multi-dimensional 'orderby', with orderby fields as array keys and ASC/DESC as the corresponding values.

See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31663 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 16:05:11 +00:00
Boone Gorges 3262ff0cc8 Tests for some existing 'orderby' functionality in `WP_*_Query` classes.
* In `WP_Query` and `WP_Comment_Query`, ensure that 'orderby' can parse multiple values for 'orderby' when passed as a space-separated string.
* In `WP_User_Query`, ensure that "shorthand" orderbys (like 'login' and 'name') are converted to their full versions (like 'user_login' and 'display_name').

See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31662 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 15:44:28 +00:00
Boone Gorges b2332718a1 When passing `$full` to `get_posts_by_author_sql()`, make sure a 'post_type' clause is included in results.
This change makes the 'post_type' clause in `wp_list_authors()` redundant, so
we remove it. Third-party plugins using `get_posts_by_author_sql()` may have
similarly redundant clauses, but this won't change the results returned by the
SQL queries.

Also adds unit tests for `get_posts_by_author_sql()`.

Props pbearne.
Fixes #30354.

git-svn-id: https://develop.svn.wordpress.org/trunk@31653 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 01:14:31 +00:00
Scott Taylor 8a28e19808 Add unit tests for `wp_attachment_is()`, checks the whitelist and arbitrary extension.
See #25275.


git-svn-id: https://develop.svn.wordpress.org/trunk@31647 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-06 20:37:08 +00:00
Boone Gorges b9e222fd6a Allow `$autoload` setting to be changed for existing options using `update_option()`.
[31628] made it possible to pass an `$autoload` param to `update_option()` that
applies when the option does not yet exist in the database. The current
changeset introduces parity for existing options: the `$autoload` setting
for existing options can be changed via the `$autoload` parameter. For internal
simplicity, `$autoload` is ignored for existing options when `$value` is not
also changed.

This changeset also moves `update_option()` tests into their own class.

Props dd32.
Fixes #26394.

git-svn-id: https://develop.svn.wordpress.org/trunk@31640 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-06 13:56:44 +00:00
Boone Gorges 67324a9234 Introduce `$autoload` parameter to `update_option()`.
When creating an option via `add_option()`, the `$autoload` param allows you to
tell WP whether the option should be loaded as part of the 'alloptions' cache
during every pageload. `update_option()`, when used with a non-existent option
calls `add_option()` internally. The new `$autoload` param in `update_option()`
is passed along to `add_option()` in cases where the option does not yet exist.

The associated unit tests are skipped on multisite due to an issue that causes
`WP_INSTALLING` to force cache misses. See #31130.

Props codix, nofearinc, MikeHansenMe.
Fixes #26394.

git-svn-id: https://develop.svn.wordpress.org/trunk@31628 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-05 19:13:00 +00:00
Boone Gorges c4e9c64233 Pinking shears in unit test files.
git-svn-id: https://develop.svn.wordpress.org/trunk@31623 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-05 13:14:28 +00:00
Boone Gorges 067fa3702e In PHPUnit test classes, `parent::tearDown()` should be the last thing done in `tearDown()` methods.
`WP_UnitTestCase::tearDown()` restores the test environment to the default
conditions, including rolling back the MySQL transaction that the test takes
place in, resetting globals, and unhooking test-specific filters. As such, all
teardown routines for specific tests should happen before the parent class's
`tearDown()` method is called. Failure to do so can cause database locks on
certain configurations, among other problems.

See #31537.

git-svn-id: https://develop.svn.wordpress.org/trunk@31622 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-05 13:14:15 +00:00
Boone Gorges 07abae914e In `get_next_comments_link()`, ensure proper pagination when no 'cpage' query var is found.
The 'cpage' query var is only set when using `comments_template()` to display
comments. If displaying them in a context where 'cpage' is not yet set, the
default value should be 1, not 0.

Props MomDad, couturefreak.
Fixes #20319.

git-svn-id: https://develop.svn.wordpress.org/trunk@31617 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-05 03:56:21 +00:00
Boone Gorges c1b30747d5 Respect `comment_date` and `comment_date_gmt` params in `wp_new_comment()`.
Props solarissmoke, oso96_2000.
Fixes #14279.

git-svn-id: https://develop.svn.wordpress.org/trunk@31615 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-05 02:59:47 +00:00
Boone Gorges 1ee4d99972 In `wp_get_attachment_url()`, convert to HTTPS when possible.
`wp_get_attachment_url()`, via `wp_upload_dir()`, uses 'siteurl' to generate
attachment URLs. When a site is SSL-optional on the front end - ie, 'siteurl'
is non-HTTPS, but SSL is available - a number of situations can arise where
non-HTTPS attachment URLs cause browser mixed-content warnings:

a) SSL is forced in the admin and `wp_get_attachment_url()` is used to generate the `<img>` tag for an inserted image. In these cases, the post content will contain non-HTTPS. Viewing/editing this post in the Dashboard will result in non-HTTPS images being served in an SSL environment.
b) `wp_get_attachment_url()` is used in a theme to generate an `<img>` `src` attribute on a public page. When viewing that page over SSL, the images will have HTTP URLs.

This changeset switches attachment URLs to HTTPS when it's determined that the
host supports SSL. This happens when 'siteurl' is non-SSL, but the current page
request *is* over SSL, and the host of the current request matches the host of
the URL being generated.

Props joemcgill, boonebgorges.
Fixes #15928.

git-svn-id: https://develop.svn.wordpress.org/trunk@31614 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-05 02:38:59 +00:00
Gary Pendergast d258490653 When sanitizing a URL to redirect to, UTF-8 characters can be URL encoded, instead of being removed.
While RFC 3986 does not specify which character sets are allowed in URIs, Section 2.5 states that octects matching UTF-8 character encoding should be percent-encoded, then unreserved octets outside of the UTF-8 range should be percent-encoded. As browsers tend to only implement support for UTF-8 in URLs, this change only implements the UTF-8 encoding part. We may revisit the second part if it becomes an issue.

Fixes #31486



git-svn-id: https://develop.svn.wordpress.org/trunk@31587 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-28 02:20:52 +00:00
Scott Taylor 65c58832cb Improve `get_media_embedded_in_content()` so that it returns the media it finds in the same order that it appears in the content.
Adds unit test, updates another.

Props kopepasah.
See #26675.


git-svn-id: https://develop.svn.wordpress.org/trunk@31574 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-27 16:11:00 +00:00
Boone Gorges e365b3a364 Add 'orderby=description' support to `get_terms()`.
This fixes an interface inconsistency in edit-tags.php, where Description
appears as a sortable column header.

Props neil_pie.
Fixes #31364.

git-svn-id: https://develop.svn.wordpress.org/trunk@31532 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-24 16:36:26 +00:00
Sergey Biryukov 4d61c79ca1 Fix line endings after [31522].
fixes #31430.

git-svn-id: https://develop.svn.wordpress.org/trunk@31531 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-24 10:05:48 +00:00
Sergey Biryukov 0421ee26ec Add unit tests for `get_page_template_slug()`.
props tyxla.
fixes #31389.

git-svn-id: https://develop.svn.wordpress.org/trunk@31522 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-23 18:47:01 +00:00
Boone Gorges 129e5f5278 Ensure that a request URL is always set in `WP_UnitTestCase::go_to()`.
Failure to set this variable meant that passing the home URL to `go_to()`
(without a trailing slash) resulted in a PHP notice, and failed to reset the
globals properly.

Props joostdevalk.
Fixes #31417.

git-svn-id: https://develop.svn.wordpress.org/trunk@31515 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-23 01:07:18 +00:00
Boone Gorges 1beeccc96f Use PHP 5.2 compatible syntax in image tests.
T_PAAMAYIM_NEKUDOTAYIM, HAKUNA_MATATA, YOLO.

See [31510], #31124.

git-svn-id: https://develop.svn.wordpress.org/trunk@31512 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-22 21:41:22 +00:00