Commit Graph

34 Commits

Author SHA1 Message Date
Sergey Biryukov c31a551273 Tests: Backport two changes from PHPUnit 9.3:
* Replace the `Match` interface with `ParametersMatch`, to avoid parse errors due to `match` being a reserved keyword in PHP 8.
* Replace `ReflectionParameter::getClass()` usage, which is deprecated in PHP 8.

This allows tests relying on the `getMockForAbstractClass()` and `getMockBuilder()` methods to run again on PHP 8.

When the test suite is updated for compatibility with PHPUnit 9.x, these overrides can be removed.

Follow-up to [48972].

See #50913, #50902.

git-svn-id: https://develop.svn.wordpress.org/trunk@49037 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-23 13:52:02 +00:00
Pascal Birchler b58973554d Sitemaps: Add XML sitemaps functionality to WordPress.
While web crawlers are able to discover pages from links within the site and from other sites, XML sitemaps supplement this approach by allowing crawlers to quickly and comprehensively identify all URLs included in the sitemap and learn other signals about those URLs using the associated metadata.

See https://make.wordpress.org/core/2020/06/10/merge-announcement-extensible-core-sitemaps/ for more details.

This feature exposes the sitemap index via `/wp-sitemap.xml` and exposes a variety of new filters and hooks for developers to modify the behavior. Users can disable sitemaps completely by turning off search engine visibility in WordPress admin.

This change also introduces a new `esc_xml()` function to escape strings for output in XML, as well as XML support to `wp_kses_normalize_entities()`.

Props Adrian McShane, afragen, adamsilverstein, casiepa, flixos90, garrett-eclipse, joemcgill, kburgoine, kraftbj, milana_cap, pacifika, pbiron, pfefferle, Ruxandra Gradina, swissspidy, szepeviktor, tangrufus, tweetythierry.
Fixes #50117.
See #3670. See #19998.


git-svn-id: https://develop.svn.wordpress.org/trunk@48072 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-17 15:22:49 +00:00
Sergey Biryukov a0742854fa Coding Standards: Exclude the whole PHPMailer directory from WPCS checks, for consistency with other external libraries in their own directory.
Follow-up to [48033].

See #41750.

git-svn-id: https://develop.svn.wordpress.org/trunk@48036 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-13 12:34:12 +00:00
Jonathan Desrosiers 0933882c6e External Libraries: Upgrade PHPMailer to version 6.1.6.
Now that WordPress Core supports PHP >= 5.6, the PHPMailer library can be updated to the latest version.

The PHPMailer files now reside in a new directory, `wp-includes/PHPMailer`. These files are copied verbatim from the library upstream and will make updating in the future easier. For backwards compatibility, the old files will remain and trigger deprecated file warnings.

The PHPMailer class is also now under the `PHPMailer\PHPMailer\PHPMailer` namespace. The `PHPMailer` class in the global namespace has been aliased for a seamless transition.

This upgrade also clears up a handful of PHP compatibility issues detailed in #49922.

For a full list of changes, see the PHPMailer GitHub: https://github.com/PHPMailer/PHPMailer/compare/v5.2.27...v6.1.6.

Props Synchro, SergeyBiryukov, desrosj, donmhico, ayeshrajans.
Fixes #41750.

git-svn-id: https://develop.svn.wordpress.org/trunk@48033 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-12 15:45:30 +00:00
John Blackbourn 578956abf6 Build/Test Tools: Exclude plugins and themes within `src`.
Just like the `build` directory, `src` can include plugins and themes which shouldn't be linted by PHPCS.

Fixes #49781

git-svn-id: https://develop.svn.wordpress.org/trunk@47742 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-02 18:15:30 +00:00
SergeyBiryukov 6b28c4d100 Coding Standards: Switch `WordPress.PHP.YodaConditions.NotYoda` back to error level.
This was marked as a warning in [45665] until all the issues associated with the sniff are addressed, so that linting on Travis could run across the entire codebase.

With all the instances now addressed, this override is no longer needed.

Follow-up to [47054], [47218], [47219].

See #49542.

git-svn-id: https://develop.svn.wordpress.org/trunk@47551 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-05 03:19:02 +00:00
Sergey Biryukov f8b2ff1b53 Coding Standards: Adjust coding standards to always omit parentheses for `include`/`require` statements.
These are language constructs, not function calls, so the parentheses are unnecessary.

This updates the PHPCS configuration file the enforce the sniff until it is moved from the `WordPress-Extra` ruleset to the `WordPress-Core` ruleset upstream.

Follow-up to [47198].

Props desrosj, jrf, GaryJ.
Fixes #49376.

git-svn-id: https://develop.svn.wordpress.org/trunk@47207 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-07 19:14:29 +00:00
Sergey Biryukov cfc3b57488 Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@47122 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-29 00:43:23 +00:00
Grzegorz (Greg) Ziółkowski a35e46a937 Build Tools: Integrate DependencyExtractionWebpackPlugin in the JS build.
This patch integrates DependencyExtractionWebpackPlugin which was battle-tested in Gutenberg. 

This will greatly simplify the process of upgrading npm packages which change after every Gutenberg release. It might even useful during the WordPress release cycle as we might need to publish more often as we discover critical bugs and regressions.

Props jonsurrell, adamsilverstein, youknowriad, ocean90, netweb.

Fixes #48154. 



git-svn-id: https://develop.svn.wordpress.org/trunk@47035 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-03 13:15:33 +00:00
Jonathan Desrosiers 2dbc7e087f Build/Test Tools: Move Composer script command line directives to the PHPCS ruleset.
Also, move all arguments up to the top of the custom ruleset to make it easier to understand the conditions the ruleset is run under.

Props desrosj, jrf.
See #46152.

git-svn-id: https://develop.svn.wordpress.org/trunk@46291 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-25 14:01:51 +00:00
Gary Pendergast 3d1714de71 Coding Standards: Move the remaining PHPCS errors to report as warnings, and add Travis tests.
The remaining error-level coding standards issues (specifically, associated with the sniffs `WordPress.PHP.YodaConditions.NotYoda`, `WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase`, `WordPress.DB.PreparedSQL.InterpolatedNotPrepared`, `WordPress.DB.PreparedSQL.NotPrepared`, and `WordPress.Files.FileName.InvalidClassFileName`) are marked as warnings, until they're all addressed.

This change allows us to run linting on Travis across the entire codebase, ensuring no other error-level violations can be introduced.

Additionally, PHPCS will now cache results locally, drastically improving performance for subsequent checks: scanning the entire codebase takes 1-2 minutes the first time, and less than one second for subsequent checks.

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45665 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-19 07:47:16 +00:00
Gary Pendergast ab26c9a2fb Coding Standards: Fix a filename replacement missed in [45663].
See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45664 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-19 04:42:00 +00:00
Gary Pendergast 968254f4f4 Coding Standards: Exclude a handful of incorrectly named files that won't be renamed.
See #47632.


git-svn-id: https://develop.svn.wordpress.org/trunk@45661 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-19 03:49:26 +00:00
Gary Pendergast 3686fd8c59 Coding Standards: Exclude some class names from checks when they can't be renamed.
Renaming the classes would likely cause back compat issues, so the safest option is to allow this handful to continue unchanged.

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45653 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-17 04:33:27 +00:00
Gary Pendergast d36eda33f7 Coding Standards: Fix instances of `WordPress.PHP.NoSilencedErrors.Discouraged`.
Noteable changes:
- The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set.
- Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors.
- Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4.
- Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested.

See #46732.


git-svn-id: https://develop.svn.wordpress.org/trunk@45611 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-09 05:44:42 +00:00
Gary Pendergast c6c78490e2 Coding Standards: Fix the remaining issues in `/tests`.
All PHP files in `/tests` now conform to the PHP coding standards, or have exceptions appropriately marked.

Travis now also runs `phpcs` on the `/tests` directory, any future changes to these files must conform entirely to the WordPress PHP coding standards. 🎉

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45607 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-08 00:55:20 +00:00
Gary Pendergast 272e5bb4e5 Coding Standards: Add missing translator comments.
Twentys Eleven, Sixteen, and Seventeen now have translator comments for all their strings.

Also, WPCS now doesn't show missing translator comment warnings for test files.

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45604 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-05 08:03:40 +00:00
Gary Pendergast 027c9dae90 Coding Standards: Fix all `WordPress.CodeAnalysis.AssignmentInCondition` issues.
`WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition` can be ignored, as this is allowed in Core.

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45601 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-05 03:13:31 +00:00
Gary Pendergast 4503f93961 Coding Standards: Fix the `Squiz.PHP.DisallowMultipleAssignments` violations in `wp-includes`.
See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45590 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-02 23:41:16 +00:00
Andrew Ozz 9ca38510d1 Build tools, WPCS: disable line ending check when running `phpcs` but fix them to `\n` whit `phpcfb`. Fixes (erroneous) reports on Windows about improper line endings in all files. They are managed directly by Git or SVN.
Fixes #47411.

git-svn-id: https://develop.svn.wordpress.org/trunk@45455 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-28 00:25:42 +00:00
Alex Shiels 722d0439f0 Coding Standards: exclude sodium_compat library.
Props dd32.
See #45806.


git-svn-id: https://develop.svn.wordpress.org/trunk@44955 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-21 05:55:05 +00:00
Gary Pendergast 992184cf73 Coding Standards: Upgrade WPCS to 1.2.1.
This upgrade fixes quite a few false positives, as well as auto-fixing some indenting issues.

Fixes #45956.



git-svn-id: https://develop.svn.wordpress.org/trunk@44574 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-12 06:40:16 +00:00
Gary Pendergast a139c8cbf7 Coding Standards: Fix and whitelist variable names.
From the `WordPress.NamingConventions.ValidVariableName` sniff, this commit fixes/whitelists all `NotSnakeCaseMemberVar`, `MemberNotSnakeCase`, and `StringNotSnakeCase` violations. It also fixes a handful of the `NotSnakeCase` violations.

See #45934.



git-svn-id: https://develop.svn.wordpress.org/trunk@44573 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-12 06:05:55 +00:00
Gary Pendergast c1d4ff496c Coding Standards: Exclude some external files.
- `class-wp-block-parser.php` and `wp-includes/blocks/*` are imported from the Gutenberg plugin.
- `speed-trap-listener.php` is a third party library.

See #45934.



git-svn-id: https://develop.svn.wordpress.org/trunk@44571 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-12 04:00:42 +00:00
Gary Pendergast d0f00b58e2 Coding Standards: Add exceptions for `WordPress.Files.FileName.NotHyphenatedLowercase`.
See #45934.



git-svn-id: https://develop.svn.wordpress.org/trunk@44564 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-11 06:16:35 +00:00
Gary Pendergast 8cc49330a4 Coding Standards: Fix the minor `WordPress.WP.I18n` violations.
`WordPress.WP.I18n.MissingTranslatorsComment` is in progress in #44360.

See #45934.



git-svn-id: https://develop.svn.wordpress.org/trunk@44562 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-11 06:03:46 +00:00
Gary Pendergast df771316d1 Coding Standards: `template.php` isn't a template tag file.
`WordPress.Files.FileName.InvalidTemplateTagFileName` shouldn't apply to it.

See #45934.



git-svn-id: https://develop.svn.wordpress.org/trunk@44561 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-11 04:59:23 +00:00
Dominik Schilling (ocean90) ed1b4dc41f Build/Tools: Fix typo in `phpcs.xml.dist`.
See #44366.

git-svn-id: https://develop.svn.wordpress.org/trunk@44507 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-09 10:01:32 +00:00
Felix Arntz c12a0cf4f3 Multisite: Fix coding standard errors after [43654].
See #41333.


git-svn-id: https://develop.svn.wordpress.org/trunk@43655 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-24 15:22:01 +00:00
Felix Arntz ffa16fa771 Upgrade/Install: Properly exclude the `admin/includesSchema.php` tests file for the `WordPress.DB.PreparedSQL.NotPrepared` sniff.
The way this was implemented in [43630] caused the file to be excluded for all sniffs, since PHPCS does not support file-wide ignores of a specific sniff at this point.

Props jrf.
See #44896.


git-svn-id: https://develop.svn.wordpress.org/trunk@43641 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-14 07:54:53 +00:00
Gary Pendergast a75d153eee Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.



git-svn-id: https://develop.svn.wordpress.org/trunk@43571 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-17 01:50:26 +00:00
jrf 3581d34bb0 Build/Tools: Update PHPCS ruleset for WP Core and related Composer setup.
`.gitignore` + `svn:ignore`:
* Add the typical filenames of overloaded PHPCS configs to `.gitignore`.

Composer:
* Use the `develop` (Packagist `dev-master`) version of WPCS as it contains lots of bugfixes.
* Remove the PHPCS dependency. This is a dependency of WPCS, not of WP Core itself. This will also make sure that the PHPCS version used is always one which is supported by WPCS.
* Refreshed the `composer.lock` file.

PHPCS ruleset:
* Removed a reference to a sniff which doesn't exist in WPCS yet.
* Use the PHPCS 3.x `basepath` option to clean up the file paths PHPCS shows in the reports.
* Use the PHPCS 3.x `parallel` option to enable parallel scanning whenever possible to speed up the scans.
* Whitelist the `wp-includes/l10n.php` file from issues being reported by the `WordPress.WP.I18n` sniff.

Fixes #44366.

git-svn-id: https://develop.svn.wordpress.org/trunk@43348 602fd350-edb4-49c9-b593-d223f7449a82
2018-06-15 15:56:58 +00:00
John Blackbourn 790f1ef5da Build/Test Tools: Don't trigger the global variable override PHPCS sniff for core.
Props jrf

Fixes #43776


git-svn-id: https://develop.svn.wordpress.org/trunk@43013 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-28 00:44:50 +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