Commit Graph

37796 Commits

Author SHA1 Message Date
Boone Gorges
e9d828ce41 Don't do a strict taxonomy check in get_category_link().
Prior to version 4.9, a quirk in the implementation of `get_term()` caused
`get_category_link( 123 )` to fetch the taxonomy archive link for term 123
even if 123 is not in the 'category' taxonomy. The quirk was fixed in [40979];
see #40671. This bugfix introduced a regression for theme authors who were
expecting the old behavior.

By lifting the 'category' restriction, we allow the template function to work
in the old way.

Fixes #42717. See #42771.

git-svn-id: https://develop.svn.wordpress.org/trunk@42364 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 20:38:57 +00:00
Konstantin Obenland
6cb2a02695 Widgets: Don't try mapping empty sidebars.
Fixes a bug where the mapping logic would try mapping empty sidebars, resulting in PHP warnings.

Props ionvv, chetan200891 for initial patch.
Fixes #42603.



git-svn-id: https://develop.svn.wordpress.org/trunk@42362 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 20:11:11 +00:00
Sergey Biryukov
59612bff8b Docs: Add missing description for $weekday_name parameter and @return entry in WP_Locale::get_weekday_initial().
Props keesiemeijer, 1naveengiri.
Fixes #42793.

git-svn-id: https://develop.svn.wordpress.org/trunk@42361 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 15:58:03 +00:00
Peter Wilson
14dd35e62e Comments: Modernise JavaScript for comment reply links.
Update the comment reply JavaScript to be unobtrusive and use events rather than inline `onclick` attributes. 

Along with bringing the code into the 2010s this prevents an edge-case in which `addComment.moveForm()` could be called before the JavaScript has loaded.

Props peterwilsoncc, bradparbs.
Fixes #31590.


git-svn-id: https://develop.svn.wordpress.org/trunk@42360 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 22:36:15 +00:00
Joe Hoyle
d989b8e402 REST API: Include permalink_structure in the settings route.
There are situations where the REST API client wants to be able to read and set the permalink_structure option. Though this doesn’t fix the use case of front-end rendered unauthenticated websites, it still has utility as a setting in it’s own right.

Props aduth.
See #41014.


git-svn-id: https://develop.svn.wordpress.org/trunk@42359 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 22:28:33 +00:00
Aaron Jorbin
8842eba972 GENERAL: Update recommended PHP version to 7.2.
Props otto42, johnbillion, rachelbaker, jorbin.
Fixes 42789.


git-svn-id: https://develop.svn.wordpress.org/trunk@42358 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 21:57:13 +00:00
Aaron Jorbin
6f4f8b7928 CODING STANDARDS: Fix single/double quotation mark
Broken in [42351].
Unprops adamsilverstein.
Fixes 42679.


git-svn-id: https://develop.svn.wordpress.org/trunk@42357 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 21:18:01 +00:00
Joe Hoyle
63dc77a7fc REST API: Fix permissions error message in post statuses controller.
The permissions error message when a request tries to fetch post statuses unauthenticated is incorrect. It was a copy/paste from elsewhere, as indicated by the use of "in this post type" where this is no post type referenced.

Props schlessera.
Fixes #42303.

git-svn-id: https://develop.svn.wordpress.org/trunk@42356 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 20:48:35 +00:00
Aaron Jorbin
2a51e10611 Docs: Add description for is_day().
Props webdevmattcrom.
Fixes #42784.


git-svn-id: https://develop.svn.wordpress.org/trunk@42355 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 20:41:30 +00:00
Rachel Baker
59c31d2d74 REST API: Correct HTTP status code in error for requests to create a duplicate term.
The 409 error code is intended for situations where it is expected that the user will resolve the conflict and resubmit the same request. We use 400 error codes for other routes when a duplicate request is made. The 400 status code tells the user they need to modify their request for it to be successful.

Props shooper.
Fixes #42781. See #41370.

git-svn-id: https://develop.svn.wordpress.org/trunk@42354 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 19:08:23 +00:00
Adam Silverstein
0f0db92b0d Docs: Improve JSDocs for cropper.js.
Ammends r42352 - include the built media files.


git-svn-id: https://develop.svn.wordpress.org/trunk@42353 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 18:55:31 +00:00
Adam Silverstein
5fbba272df Docs: Improve JSDocs for cropper.js.
Props manuelaugustin, bramheijmink.
Fixes #42677.



git-svn-id: https://develop.svn.wordpress.org/trunk@42352 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 18:46:29 +00:00
Adam Silverstein
4619b059b1 Docs: Improve JSDocs for common.js.
Props andizer, rensw90, benvaassen, jipmoors, ireneyoast and nicollle.
Fixes 42679.



git-svn-id: https://develop.svn.wordpress.org/trunk@42351 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 18:10:21 +00:00
Rachel Baker
2b079e098a REST API: Add existing term_id to the error data object when attempting to create a duplicate term.
Props shooper, coleh.
Fixes #42597. See #41370.

git-svn-id: https://develop.svn.wordpress.org/trunk@42350 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 18:10:05 +00:00
Drew Jaynes
6b325e9916 Hooks: Standardize naming of dynamic hooks using values derived from superglobals to use interpolation vs concatenation.
This is a continuation of the work that happened in [38307] for #37748.

Props ramiy.
Fixes #42698.


git-svn-id: https://develop.svn.wordpress.org/trunk@42349 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-01 11:35:31 +00:00
Sergey Biryukov
5d45b61e6b Twenty Seventeen: Correct the number of recent posts in a comment in template-parts/page/content-front-page-panels.php.
Props skostadinov, marcelo2605.
Fixes #42621.

git-svn-id: https://develop.svn.wordpress.org/trunk@42348 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-01 03:46:43 +00:00
Sergey Biryukov
712739ee4f Twenty Seventeen: Use consistent wording when referring to the front page in inline docs.
Props chetan200891.
Fixes #42666.

git-svn-id: https://develop.svn.wordpress.org/trunk@42347 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-01 03:43:03 +00:00
Gary Pendergast
81a48c2924 Coding Standards: Add the phpcs.xml.dist file.
See #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42346 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-01 03:40:04 +00:00
Sergey Biryukov
2c325f64f4 Docs: Correct $attachment parameter type for wp_prepare_attachment_for_js filter.
Props danielbachhuber.
Fixes #42449.

git-svn-id: https://develop.svn.wordpress.org/trunk@42345 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-01 03:29:08 +00:00
Gary Pendergast
8f95800d52 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-30 23:09:33 +00:00
Gary Pendergast
ec6a089f98 Tests: Fix a couple of weirdly formatted comments.
See #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42342 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-30 16:22:15 +00:00
John Blackbourn
e2fdcb93f1 Hardening: Remove the ability to upload JavaScript files for users who do not have the unfiltered_html capability.
git-svn-id: https://develop.svn.wordpress.org/trunk@42261 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-29 15:59:41 +00:00
John Blackbourn
0b11b6ea36 Hardening: Ensure the attributes of enclosures are correctly escaped in RSS and Atom feeds.
git-svn-id: https://develop.svn.wordpress.org/trunk@42260 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-29 15:55:03 +00:00
John Blackbourn
3a4bf61804 Hardening: Add escaping to the language attributes used on html elements.
git-svn-id: https://develop.svn.wordpress.org/trunk@42259 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-29 15:54:05 +00:00
John Blackbourn
e2291664f1 Hardening: Use a properly generated hash for the newbloguser key instead of a determinate substring.
git-svn-id: https://develop.svn.wordpress.org/trunk@42258 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-29 15:51:19 +00:00
Sergey Biryukov
63f8e4d122 Users: After [42256], remove unnecessary double quotes around first_name and last_name properties.
See #42713.

git-svn-id: https://develop.svn.wordpress.org/trunk@42257 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-29 15:27:55 +00:00
Dion Hulse
c52f6ba995 Users: Display partial names in the user listing tables.
This allows showing a name when only the first or last name is provided.

Props shital-patel, antipole.
Fixes #42713.


git-svn-id: https://develop.svn.wordpress.org/trunk@42256 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-29 03:40:31 +00:00
Drew Jaynes
81b4e9a3a4 General: Add complete test coverage for WP_Error.
See #42742.


git-svn-id: https://develop.svn.wordpress.org/trunk@42255 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-29 02:18:25 +00:00
John Blackbourn
af52df0aa1 Media: Further improvements to the handling of language codes that get passed to MediaElement.
This change means that only the leading portion of a locale code gets passed to MediaElement, removing problems that arise from locales such as `de_DE_formal` and `pt_PT_ao90`.

Props erich_k4wp, blobfolio, flixos90, ocean90, joemcgill, SergeyBiryukov.

Fixes #42574


git-svn-id: https://develop.svn.wordpress.org/trunk@42251 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-28 14:51:33 +00:00
Ryan McCue
49852ed54f REST API: Ensure rest_url() consistently has leading slash.
`rest_url()` inconsistent addes slashes to the passed path depending on whether the site has pretty permalinks enabled. Apart from being inconsistent, this also caused the unit tests to fail when pretty permalinks are enabled.

Props frank-klein.
Fixes #42452. See #41451.


git-svn-id: https://develop.svn.wordpress.org/trunk@42250 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-28 07:09:43 +00:00
Gary Pendergast
209ede72de General: Add inline PHPCS options to leave regex indentation.
We have a handful of super long regexen that are written over multiple lines, as a collection of strings concatenated together. Each string is indented appropriately for the regex, but PHPCS doesn't recognised this, so defaults to removing the extra whitespace.

Disabling the `Squiz.Strings.ConcatenationSpacing.PaddingFound` rule for these blocks stops the extra whitespace from being removed.

See #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42249 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-28 04:23:11 +00:00
Dion Hulse
a825a181e1 Theme Editor: Translate the URL to the Child Themes Codex page.
Props odysseygate, johnpgreen.
Fixes #42454.


git-svn-id: https://develop.svn.wordpress.org/trunk@42247 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-27 03:51:25 +00:00
Dion Hulse
44c75415b3 Theme Editior: Base the nonce on a simpler combination of fields, for easier debugging & reading.
See #42609.
Fixes #42705.


git-svn-id: https://develop.svn.wordpress.org/trunk@42246 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-27 03:43:11 +00:00
Dion Hulse
6e0ba7864f Theme Editor: Validate files are editable based on their relative filenames, rather than full file path.
This fixes theme editing on Windows platforms where `validate_file()` will return `2` on a full file path.

Fixes #42609.


git-svn-id: https://develop.svn.wordpress.org/trunk@42244 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-27 03:27:19 +00:00
dd32
76f77416d6 Theme/Plugin Editor: Remove the caching added in [41806] as it causes more problems than it fixes.
While caching here seemed like a good idea in theory, in practice the cache would be often stale causing development issues.
We exclude common folders (such as `node_modules`) from the scanning to avoid directories which are not useful to the end-user, so as long as those exclusion lists are held up this shouldn't cause too much of a degredation in the future.
We may consider adding caching here again in the future if it's determined that it is really needed.

Props precies, ibenic, mariovalney, schlessera, and all the others who commented on the ticket(s).
This partually reverts [41806].
See #6531.
Fixes #42573.


git-svn-id: https://develop.svn.wordpress.org/trunk@42242 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-27 02:58:02 +00:00
Gary Pendergast
574821573a General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42228 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-26 23:56:25 +00:00
Dion Hulse
d00e74042b Docs: Update the documentation for get_post_meta() to clarify that $single has no effect when the $meta_key is not provided.
Props chetan200891, titodevera.
Fixes #42687.


git-svn-id: https://develop.svn.wordpress.org/trunk@42227 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-26 03:16:55 +00:00
Dion Hulse
b8c4faff72 WPDB: Fix the parsing of sockets which contain colons within the socket name (used on some cloud providers).
Props natacado.
Fixes #42634 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@42226 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-24 05:51:31 +00:00
Dion Hulse
555eab6391 Template: Don't output an empty <ul> in the_meta() when a post only has protected metas.
Props campusboy1987, birgire.
Fixes #42629.


git-svn-id: https://develop.svn.wordpress.org/trunk@42225 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-24 05:20:39 +00:00
Dion Hulse
26fb077862 Filesystem: Use a more unique filename in wp_tempnam() and get_filesystem_method().
Using a filename which was generated from `time()` could cause two processes to try to use the same filename, causing unexpected behaviour.

Props jrchamp, bikecrazyy.
Fixes #42265.


git-svn-id: https://develop.svn.wordpress.org/trunk@42224 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-24 03:04:35 +00:00
Weston Ruter
53eaf9f078 Themes: Prevent JS error on Themes admin screen when only one theme is installed.
Amends [42029].
Props chetan200891, afercia.
See #42348.
Fixes #42673.


git-svn-id: https://develop.svn.wordpress.org/trunk@42222 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-23 19:28:33 +00:00
John Blackbourn
a687253cce Users: Correct the value of the lang attribute in the admin area.
This corrects the value when the user's language is set to `English (United States)` but the site language is not.

Props ocean90, afercia

Fixes #42242


git-svn-id: https://develop.svn.wordpress.org/trunk@42220 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-23 19:03:44 +00:00
Gary Pendergast
da9953aa47 Setup: Allow for wp-config-sample.php to be formatted according to coding standards.
When the setup process reads `wp-config-sample.php`, it assumes that there are no spaces inside the brackes of the `define()`s. Unfortunately, this doesn't match our coding standards, so will no longer work correctly once we start enforcing them.

This also improves coding standards of the generated `wp-config.php` file.

See #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42218 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-23 05:23:01 +00:00
Gary Pendergast
f797c252d9 General: Reformat inline if () statements inside HTML tags.
This pattern occurs a handful of times across the codebase:

`<div class="foo<?php if ( $bar ) { echo ' baz'; } ?>">`

Unfortunately, it doesn't really play nicely with `phpcbf`, so all instances need to be removed in preperation for auto code formatting.

See #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42217 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-23 04:08:42 +00:00
John Blackbourn
d88bb052f0 Cron API: Improvements to docblocks for the event scheduling functions.
See #42505


git-svn-id: https://develop.svn.wordpress.org/trunk@42216 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-22 15:15:35 +00:00
Dion Hulse
2c1858a8c3 Upgrade: Fix updating plugins which include a numeric file/folder names.
The fix in [41821] caused numeric folder names to be reindexed to 0..n when in the root directory (for example, `my-plugin/24/`).

Props edo888.
See #41524.
Fixes #42628 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@42214 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-21 04:14:33 +00:00
Boone Gorges
4ec5d65dcc Introduce meta_box_sanitize_cb taxonomy argument.
The `meta_box_cb` argument was introduced in [25572] to allow plugin
authors to provide a custom callback for rendering their taxonomy's meta
box on the post edit screen. However, the routine used to handle the saving
of these custom taxonomy meta boxes was not customizable, but was instead
based simply on whether the taxonomy was hierarchicaly. See [13535].

The new `meta_box_sanitize_cb` argument defaults to the "tag" routine for
non-hierarchical taxonomies and the "category" routine for hierarchical ones,
thereby maintaining the current default behavior. Developers can override this
when the data passed from their `meta_box_cb` differs.

Props boonebgorges, ZaneMatthew, stephenharris.
Fixes #36514.

git-svn-id: https://develop.svn.wordpress.org/trunk@42211 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-21 03:14:52 +00:00
Felix Arntz
887214f7ce Multisite: Fix broken update blog_versions query after [41661].
Props Mista-Flo, lenasterg.
Fixes #42641.


git-svn-id: https://develop.svn.wordpress.org/trunk@42210 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-20 23:45:09 +00:00
Boone Gorges
576f78ac49 Improve data types returned from empty hierarchical term queries.
When querying for 'count', ensure that 0 is returned. Otherwise,
ensure that it's an array.

Props xParham, birgire.
Fixes #42327.

git-svn-id: https://develop.svn.wordpress.org/trunk@42209 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-20 22:45:29 +00:00
John Blackbourn
ff1d2b5ccb HTTP API: Add a WP_Http class constant for the HTTP status code 301.
Fixes #42490


git-svn-id: https://develop.svn.wordpress.org/trunk@42208 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-20 20:53:20 +00:00