Commit Graph

182 Commits

Author SHA1 Message Date
Gary Pendergast c645936163 Emoji: Upgrade Twemoji to 12.1.2.
This upgrade adds support for the transgender flag: 🏳️‍⚧️

There's some additional housekeeping in this commit:

- Twemoji recently rearranged their repository and package, so `Gruntfile.js` needed tweaking to allow for that.
- As only new files were added in this Twemoji release, the CDN version didn't need updating.

Fixes #47852.



git-svn-id: https://develop.svn.wordpress.org/trunk@45769 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-08 04:04:15 +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 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
Andrew Ozz 9fcb362fa0 Privacy tools: Organize privacy functions into logical files and classes.
Props xkon, birgire, desrosj, garrett-eclipse, azaozz.
See #43895.

git-svn-id: https://develop.svn.wordpress.org/trunk@45448 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-26 20:49:04 +00:00
Andrew Ozz 14066540c0 jQuery: bring jquery.js back into the WordPress SVN repo and backport the patch from 3.4.0.
Props MikeNGarrett, peterwilsoncc, azaozz.
Fixes #47020 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@45342 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-17 04:24:44 +00:00
Andrew Ozz d2e3a1f1a0 Build tools: fix generating `*-rtl.css` files in `wp-includes/css` after `grunt --dev` was used.
Fixes #47078.

git-svn-id: https://develop.svn.wordpress.org/trunk@45317 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-16 02:24:58 +00:00
Sergey Biryukov de91abb11f Build/Test Tools: Exclude `twentynineteen/node_modules` from `jsvalidate:build` task.
Fixes #46706.

git-svn-id: https://develop.svn.wordpress.org/trunk@45060 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-28 21:16:48 +00:00
Gary Pendergast 1ab6f67ef5 Site Health: Improve the "Copy to clipboard" button.
The previous method for copying the debug report to the clipboard involved having a hidden `<textarea>`, but this shows up in screen readers and can't be reliably hidden.

To work around this, the button now uses the `clipboard.js` library, which automatically handles browser differences in the Clipboard API, and can load the text to copy from a `data-` attribute on the button.

Props pento, hedgefield, afercia.
Fixes #46647.



git-svn-id: https://develop.svn.wordpress.org/trunk@45044 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-27 22:30:26 +00:00
Gary Pendergast dad6b61cfb Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.

By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.

Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.


git-svn-id: https://develop.svn.wordpress.org/trunk@44986 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-23 03:54:16 +00:00
Peter Wilson 3ec3100195 Build: Remove source map from `jquery.form.min.js`.
Minimize jquery.form.js as part of build process to remove the source map reference. 

Modify source map tests to include all JavaScript files rather than testing Backbone and jQuery only.

Props pento.
Fixes #46218.



git-svn-id: https://develop.svn.wordpress.org/trunk@44740 602fd350-edb4-49c9-b593-d223f7449a82
2019-02-14 00:06:39 +00:00
Andrew Ozz 21e479d3a8 TinyMCE: retire wp-tinymce.php and remove pre-compression of wp-tinymce.js.
Fixes #45645.

git-svn-id: https://develop.svn.wordpress.org/trunk@44651 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-18 19:50:19 +00:00
Gary Pendergast 37dd83ab7e Build Tools: Uglify `underscore.min.js` while building.
This avoids a `sourceMappingURL` being in the minified file, as we don't ship source maps.

Props pento, laghee.
Fixes #44560.



git-svn-id: https://develop.svn.wordpress.org/trunk@44632 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-17 04:23:38 +00:00
Gary Pendergast 3e5aa4d4a5 Build Tools: Copy unminified JS files to `src`.
This allows `SCRIPT_DEBUG` to be set to `true` when running from `src`.

Fixes #45869.


git-svn-id: https://develop.svn.wordpress.org/trunk@44529 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-10 01:38:22 +00:00
Anton Timmermans 5faccb9683 Build tools: Fix the `travis:js` build.
After [44359] it is impossible to not use ES6 syntax for some logic in the `Gruntfile.js`, so adjust the `esversion` setting for the `Gruntfile.js` to 6. Because the previous setting in `.jshintrc` was not compatible with setting `esversion`, set the `esversion` in the `.jshintrc` explicitly.

See #44492.


git-svn-id: https://develop.svn.wordpress.org/trunk@44361 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-24 13:53:11 +00:00
Anton Timmermans 68dd26a4c0 Build tools: Fix the `grunt format:php` build.
Re-add variable that was removed on accident by [44359]. Also run `grunt format:php` to adjust the code style.
.--This line, and those below, will be ignored--

M    Gruntfile.js
M    src/index.php
M    src/wp-admin/index.php
M    src/wp-includes/class-wp-block-parser.php


git-svn-id: https://develop.svn.wordpress.org/trunk@44360 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-24 13:44:05 +00:00
Anton Timmermans d2d7243e80 Build tools: Allow building WordPress to `src`.
After the JavaScript reorganization in [43309], it was no longer possible to test WordPress from the `src` folder. That meant a build step was required to test PHP modifications. That is suboptimal as even a simple copy is slower than a web server just serving the new file.

We achieve building to `src` by setting a `WORKING_DIR` constant in the Gruntfile that is `build` by default, but changes to `src` when the `--dev` flag is present on any Grunt command. We provide sensible defaults so some commands, such as copying `version.php`, always build to `build`.

Because testing from `build` is no longer required, we change the messages present in `index.php` and `wp-admin/index.php` to be more broadly about building WordPress.

We also change the webpack config to have more straightforward behavior based on the `buildTarget` argument. It only determines the build target now and has no implicit behavior anymore. `grunt build` still works as it worked before, to make sure that the build server produces the same `wordpress.zip` we are used to.

We do all this instead of a symlink setup because symlinks don't work on every platform.

Props omarreiss, netweb, flixos90, SergeyBiryukov.
Fixes #44492.


git-svn-id: https://develop.svn.wordpress.org/trunk@44359 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-24 13:28:22 +00:00
Jonathan Desrosiers 30dcae9e2d External Libraries: zxcvbn library.
This reverts [44354] for more investigation into inconsistent password strength values that passed locally prior to commit.

Unprops omarreiss, netweb, desrosj.
See #43749.

git-svn-id: https://develop.svn.wordpress.org/trunk@44356 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-20 21:02:16 +00:00
Jonathan Desrosiers 691f79b76b External Libraries: Update zxcvbn to 4.2.2.
Version 4.2.2 of the zxcvbn password strength library has several bug fixes. A full list of changes can be seen here: https://github.com/dropbox/zxcvbn/compare/v4.4.1...v4.4.2.

This commit also adds the library as a project dependency, making it easier to update in the future. Because the dictionary within the library contains non-PG language, a `rot13:zxcvbn` task has been added to Grunt to perform a ROT-13 cipher on the library. This task has been added to `grunt build` and `grunt build:js`.

Props omarreiss, netweb, desrosj.
Fixes #43749.

git-svn-id: https://develop.svn.wordpress.org/trunk@44354 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-20 19:45:15 +00:00
Sergey Biryukov 62a5cd343c Build Tools: Don't include `.map` files in the build.
These files are fairly large, and while they're useful in development, they're not needed in the final build.

Props pento, mcsf.
Merges [43931] and [43932] to trunk.
See #45201.

git-svn-id: https://develop.svn.wordpress.org/trunk@44282 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-18 03:13:58 +00:00
Sergey Biryukov 2b8464c5e5 Build Tools: Minify the package CSS when building.
CSS coming from the `@wordpress` packages wasn't being minified in the build. This had the noteable side effect of causing RTL CSS to not be loaded when `SCRIPT_DEBUG` was set to `false`.

Props websupporter.
Merges [43905] to trunk.
Fixes #45330.

git-svn-id: https://develop.svn.wordpress.org/trunk@44252 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-17 00:36:36 +00:00
Sergey Biryukov 376d146378 Build Tools: Revert unrelated changes to `Gruntfile.js` added in [44245].
See #45156.

git-svn-id: https://develop.svn.wordpress.org/trunk@44246 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-16 23:33:38 +00:00
Sergey Biryukov caca9cb77b Build Tools: Add non-minified `@wordpress` scripts to the build output.
Props atimmer.
Merges [43886] to trunk.
See #45156.

git-svn-id: https://develop.svn.wordpress.org/trunk@44245 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-16 23:27:36 +00:00
Jeremy Felt c52b38b844 Build Tools: Update `grunt-sass` to v3 and add `node-sass` v4.
This fixes an error in the PHP 5.2 and 5.3 Travis builds after [44219].

Props netweb.
See #45241.
Fixes #45664.


git-svn-id: https://develop.svn.wordpress.org/trunk@44233 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-16 18:47:25 +00:00
Jonathan Desrosiers 6993b164b5 Build tools: Build webpack dev in grunt build.
For the WordPress zip we need both the minified and non-minified files. This is because of `SCRIPT_DEBUG`. So in grunt build we need to do both `grunt webpack:prod` and `grunt webpack:dev`.

Props bordoni, atimmer.

Merges [43817] to trunk.

Fixes #45156.

git-svn-id: https://develop.svn.wordpress.org/trunk@44161 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-14 04:35:59 +00:00
Gary Pendergast 934f0ca2b8 Build Tools: Copy package JavaScript and CSS into `wp-includes`.
- `grunt webpack:dev` now copies packages JS into `/src/wp-includes/js/dist`, and CSS into `/src/wp-includes/css/dist`.
- `grunt webpack:prod` does the same, but into `/build` instead of `/src`.
- `grunt build` now runs the `webpack:prod` task.

Merges [43760] from the 5.0 branch to trunk.

Props atimmer, pento.
Fixes #45119.



git-svn-id: https://develop.svn.wordpress.org/trunk@44159 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-14 04:10:26 +00:00
Jeremy Felt c125a50838 Build: Ignore the vendor directory during the jsvalidate:build task.
Merges [43783] from the 5.0 branch to trunk.

Props netweb.
Fixes #45119.


git-svn-id: https://develop.svn.wordpress.org/trunk@44135 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-14 01:37:40 +00:00
Anton Timmermans 7a2fa10e28 Build tools: Build @wordpress packages with webpack.
We decided to split the media webpack config into it's own file. The
main webpack config then combines this file with the packages config.

Include vendor scripts by copying them. We copy the minified files if
they are available. If they aren't available we minify the original
files ourselves.

Props omarreiss, herregroen, gziolo, youknowriad, netweb, adamsilverstein.
Merges [43719] to trunk.
See #45065.


git-svn-id: https://develop.svn.wordpress.org/trunk@44112 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-13 15:25:37 +00:00
Anton Timmermans f173141c5b Build tools: Combine webpack config files.
This prepares us for building the Gutenberg packages.

Merges [43687] to trunk.
See #45065.


git-svn-id: https://develop.svn.wordpress.org/trunk@43978 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-11 16:38:21 +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
Jeremy Felt 8d9cd406fb Build/Test Tools: Avoid running full PHPUnit test suite for every PHP file change.
Use `grunt watch --phpunit --group={testgroup}` to start `grunt watch` with a specific test group so that PHP file changes trigger a limited number of tests.

Props jeremyfelt, birgire for testing.
Fixes #44240.


git-svn-id: https://develop.svn.wordpress.org/trunk@43335 602fd350-edb4-49c9-b593-d223f7449a82
2018-06-08 04:40:18 +00:00
Gary Pendergast a26c24226c Build Tools: `grunt build` should only copy Core files.
Historically, `grunt build` has copied all files from the `src` directory to the `build` directory. This is usually fine, but can be super slow when there are lots of custom plugins or themes in the `src` directory.

To rectify this, we now only copy Core plugins and themes to `build`.

Props adamsilverstein, pento, johnbillion.
Fixes #44256.



git-svn-id: https://develop.svn.wordpress.org/trunk@43329 602fd350-edb4-49c9-b593-d223f7449a82
2018-06-01 01:28:53 +00:00
Andrew Ozz ccecd58f97 Build tools: Grunt:
- Normalize `filepath` in the the `watch` event.
- Throw a warning when `watch` fails to process a file because the destination path cannot be determined.

Fixes #44262.

git-svn-id: https://develop.svn.wordpress.org/trunk@43327 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-29 14:20:44 +00:00
Jeremy Felt 532d177b65 Built/Test Tools: Increase grunt watch interval on all files.
Significantly reduces Grunt's CPU usage when `grunt watch` is in an idle/watching state.

Props netweb.
Fixes #44241.


git-svn-id: https://develop.svn.wordpress.org/trunk@43324 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-27 18:46:15 +00:00
Gary Pendergast 386adbb8f8 Following [43309], I need to change one little line,
And delete some left over cruft, only then shall we prevail.
There are some things easily missed, when using Git, which does not persist—
Empty directories, though that didn't derail—
Our Travis-based tests, which now must prevail.
            Quoth Travis CI, “Build did fail.”

See #43055.



git-svn-id: https://develop.svn.wordpress.org/trunk@43310 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-23 11:02:28 +00:00
Gary Pendergast ef37f002ee Once upon a midnight dreary, while I coded, weak and weary,
In many a strange and curious file of forgotten lore—
While I pondered, blaming Nacin, my notifications suddenly awakened,
As of someone quietly DMing;—DMing me, I can’t ignore.
“’Tis some contributor,” I muttered, “DMing me an idea or four—
            Only this and nothing more.”

Ah, distinctly I remember, at WordCamp US, last December;
A mad proposal nearly laid me—down out cold—upon the floor.
Curious, I listened closely;—to a plan I agreed with, mostly—
A way to make our JavaScript—JavaScript which was a chore—
Maintainable, extendable, for the future, is what I saw.
            Guten-ready for evermore.

Open here I switch to Slack, when, with many a patch and hack,
In there stepped Omar, a JavaScript developer hardcore;
Pronouncing all the changes fit; ready now to be commit;
“There’s nothing else for us to do,” DMing me, “It’s done!” he swore—
“No longer random guessing at which file need next be explored—
            Let’s move on, we’re all aboard.”

Moved all together, grouped and managed, in folders all is packaged,
The code had all been cleaned and tidied, important parts moved to the fore,
“Though this change be useful here,” I said, “it is too large, I fear,
We couldn’t manage such a patch, we’ve done nothing like this before—
Tell me where doth go this change, change to make our codebase soar!”
            Quoth Omar, “In WordPress Core.”

Props omarreis for shepherding this significant change.
Props adamsilverstein, aduth, atimmer, dingo_bastard, frank-klein, gziolo, herregroen, jaswrks, jeremyfelt, jipmoors, jorbin, netweb, ocean90, pento, tjnowell, and youknowriad for testing, feedback, discussion, encouragement, commiserations, etc.
I make no apologies for this commit message.
Fixes #43055.



git-svn-id: https://develop.svn.wordpress.org/trunk@43309 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-23 10:04:22 +00:00
Dominik Schilling (ocean90) fd168e955c Media: Update minified version of imgAreaSelect after [42874].
Adds imgAreaSelect to the uglify grunt process.

Props adamsilverstein.
Fixes #41242.

git-svn-id: https://develop.svn.wordpress.org/trunk@42930 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-03 19:45:39 +00:00
Ian Dunn 2f68ec5750 Build/Test Tools: Add `watch:phpunit` task.
This allow PHPUnit test groups to run automatically when files are changed, rather than having to be ran manually throughout the development process. This creates a smoother developer experience, and a tighter feedback loop.

Props iandunn, netweb, pento
Fixes #42282


git-svn-id: https://develop.svn.wordpress.org/trunk@42760 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-27 00:31:33 +00:00
Gary Pendergast afb4f45e62 Emoji: Tweak the generated emoji arrays to not cause coding standards errors.
Props netweb, jrf.
Fixes #43150.



git-svn-id: https://develop.svn.wordpress.org/trunk@42610 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-25 01:05:01 +00:00
Weston Ruter 39031f5b5c Media: Add missing `mediaelement-migrate.js` script to get uglified.
Amends [41877].
See #42189, #39686.


git-svn-id: https://develop.svn.wordpress.org/trunk@41891 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-18 02:25:06 +00:00
Weston Ruter 97cde4e4e9 Media: Add MediaElement.js 2.2 back-compat for MediaElement.js 4.2
* Introduces `mediaelement-migrate.js`.
* Upgrades ME.js from 4.2.5-74e01a40 to 4.2.6-78496d1.

Props rafa8626, bradyvercher.
See #39686.
Fixes #42189.


git-svn-id: https://develop.svn.wordpress.org/trunk@41877 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-16 18:06:11 +00:00
Adam Silverstein 851d51ebd6 Build: Webpack instead of Browserify as JavaScript bundler.
Use Webpack as our bundler of choice, enabling improved JavaScript build chain capabilities.

Props aduth, netweb, kadamwhite, schlessera.
Fixes #40894. 


git-svn-id: https://develop.svn.wordpress.org/trunk@41752 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-04 21:00:15 +00:00
Adam Silverstein a500586603 Revert "Add `wp.hooks` - JavaScript actions and filters."
Revert `wp.hooks` for now as we continue to refine and test. 

Reverts [41375].


git-svn-id: https://develop.svn.wordpress.org/trunk@41751 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-04 20:24:52 +00:00
Andrew Ozz f3a3185bd4 Tools: enable Grunt precommit task to run without requiring SVN or GIT.
Fixes #41957

git-svn-id: https://develop.svn.wordpress.org/trunk@41708 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 15:19:23 +00:00
Gary Pendergast d3e0b4bc16 Emoji: Bring Twemoji compatibility to PHP.
This was previously attempted in [41043], which unfortunately had severe performance issues, the regex it used was fatally slow on long posts.

This version now uses an array of all emoji that Twemoji supports, which maintains the accuracy of [41043], while being the same speed or only a few ms slower than the code prior to [41043].

As with [41043], the `grunt precommit:emoji` task detects when `twemoji.js` has changed, and regenerates the array.

Props jmdodd for feedback, suggestions, and insults where appropriate.
Fixes #35293. 🤞🏻



git-svn-id: https://develop.svn.wordpress.org/trunk@41701 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-03 07:11:28 +00:00
Jeremy Felt 38d5112c25 Build/Test Tools: Add ms-files test group to sub-task list.
Previously, the `ms-files` test group would not run in any automatic configuration. This ensures it is always run as part of the test suite in Travis CI.

Props netweb.
Fixes #41698.


git-svn-id: https://develop.svn.wordpress.org/trunk@41659 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-01 22:15:16 +00:00
Andrew Ozz 27f3b55999 Retire Press This and extract it to a plugin. First run.
Props kraftbj, azaozz.
See #41689.

git-svn-id: https://develop.svn.wordpress.org/trunk@41584 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-24 14:21:42 +00:00
Andrew Ozz 6971f7565e Plupload: minify and load `plupload.js` and `moxie.js` separately to make them easier to debug.
Props gmariani405, azaozz.
Fixes #41755.

git-svn-id: https://develop.svn.wordpress.org/trunk@41570 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-22 20:09:49 +00:00
Weston Ruter dbace684e2 Editor: Add CodeMirror-powered code editor with syntax highlighting, linting, and auto-completion.
* Code editor is integrated into the Theme/Plugin Editor, Additional CSS in Customizer, and Custom HTML widget. Code editor is not yet integrated into the post editor, and it may not be until accessibility concerns are addressed.
* The CodeMirror component in the Custom HTML widget is integrated in a similar way to TinyMCE being integrated into the Text widget, adopting the same approach for integrating dynamic JavaScript-initialized fields.
* Linting is performed for JS, CSS, HTML, and JSON via JSHint, CSSLint, HTMLHint, and JSONLint respectively. Linting is not yet supported for PHP.
* When user lacks `unfiltered_html` the capability, the Custom HTML widget will report any Kses-invalid elements and attributes as errors via a custom Kses rule for HTMLHint.
* When linting errors are detected, the user will be prevented from saving the code until the errors are fixed, reducing instances of broken websites.
* The placeholder value is removed from Custom CSS in favor of a fleshed-out section description which now auto-expands when the CSS field is empty. See #39892.
* The CodeMirror library is included as `wp.CodeMirror` to prevent conflicts with any existing `CodeMirror` global.
* An `wp.codeEditor.initialize()` API in JS is provided to convert a `textarea` into CodeMirror, with a `wp_enqueue_code_editor()` function in PHP to manage enqueueing the assets and settings needed to edit a given type of code.
* A user preference is added to manage whether or not "syntax highlighting" is enabled. The feature is opt-out, being enabled by default.
* Allowed file extensions in the theme and plugin editors have been updated to include formats which CodeMirror has modes for: `conf`, `css`, `diff`, `patch`, `html`, `htm`, `http`, `js`, `json`, `jsx`, `less`, `md`, `php`, `phtml`, `php3`, `php4`, `php5`, `php7`, `phps`, `scss`, `sass`, `sh`, `bash`, `sql`, `svg`, `xml`, `yml`, `yaml`, `txt`.

Props westonruter, georgestephanis, obenland, melchoyce, pixolin, mizejewski, michelleweber, afercia, grahamarmfield, samikeijonen, rianrietveld, iseulde.
See #38707.
Fixes #12423, #39892.


git-svn-id: https://develop.svn.wordpress.org/trunk@41376 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-13 06:07:48 +00:00
Adam Silverstein 1b7475645a Add `wp.hooks` - JavaScript actions and filters.
Add a JavaScript hooks library with an API that mirrors the WordPress Plugin API; provides similar functionality and API to PHP hooks.

Called via the global `wp.hooks`, eg: `wp.hooks.addAction()`, etc. Adds:

* `addAction( 'hook', 'vendor/plugin/function', callback, priority )`
* `addFilter( 'hook', 'vendor/plugin/function', callback, priority )`
* `removeAction( 'hook', 'vendor/plugin/function' )`
* `removeFilter( 'hook',  'vendor/plugin/function' )`
* `removeAllActions( 'hook' )`
* `removeAllFilters( 'hook' )`
* `doAction( 'hook', arg1, arg2, moreArgs, finalArg )`
* `applyFilters( 'hook', content, arg1, arg2, moreArgs, finalArg )`
* `doingAction( 'hook' )`
* `doingFilter( 'hook' )`
* `didAction( 'hook' )`
* `didFilter( 'hook' )`
* `hasAction( 'hook' )`
* `hasFilter( 'hook' )`

Props adamsilverstein, jnylen0, aduth, kadamwhite, youknowriad, schlessera, mikeschinkel, azaozz, vhauri, CaptainN, scribu, carldanley, chetanchauhan, mgibbs189, stephenharris, justnorris, koopersmith, gcorne, TV productions, atimmer.

Fixes #21170.



git-svn-id: https://develop.svn.wordpress.org/trunk@41375 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-12 12:53:21 +00:00
Adam Silverstein 6e7053a6df Docs: JSDoc improvements for namespaces.
Improve JS parsing of our inline JSDocs by introducing `@namespace`, `@lends` and `@memberOf`. Helps set the way for showing our JavaScript documentation on developer.wordpress.org, see https://meta.trac.wordpress.org/ticket/3063.

* Define all used namespaces using @namespace.
* Correctly specify in which namespace each class is using @memberOf.
* Define each usage of the extend function as a prototype assignment using @lends.
* Some comment blocks were moved to correct the parsing of certain definitions. 

Props herregroen, atimmer, netweb, SergeyBiryukov.  
Fixes #41682.


git-svn-id: https://develop.svn.wordpress.org/trunk@41351 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-08 18:41:20 +00:00