Commit Graph

169 Commits

Author SHA1 Message Date
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
Pascal Birchler 214d92191d Build/Test Tools: Remove unneeded commas to fix JSHint error introduced
in [41271].

See #30666.


git-svn-id: https://develop.svn.wordpress.org/trunk@41277 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-20 09:12:36 +00:00
Aaron Jorbin 7ac4e811b4 Build/Test Tools: Add banner to minified CSS files
Patches occasionally come in on generated files. We should be kind to new contributors and give them a hint that these files are auto generated.

Props drewapicture, samuelsidler, netweb, valendesigns, kpdesign, nacin, jorbin
Fixes #30666


git-svn-id: https://develop.svn.wordpress.org/trunk@41271 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-19 20:09:31 +00:00
Aaron Jorbin eb78c8e092 Update autoprefixer browser support matrix
WordPress no longer supports many old old browsers: https://make.wordpress.org/core/2017/04/23/target-browser-coverage/

This also removes alot of no longer necessary CSS. It served us well, but we are never getting back together with IE8,9,10.

So, in the (paraphrased) words of Taylor Swift:

I remember when we dropped support  the first time
Saying, "This is it, I've had enough, " 'cause like
We hadn't seen many users in a month
When you said you needed flexbox. (What?)
Then you postMessage again and say
"IE8, I miss you and I swear I'm gonna change, trust me."
Remember how that lasted for a day?
I say, "I hate the box model, " we break up, you call me, "I love css-grids."
Ooh, we called it off again last night
But ooh, this time I'm telling you, I'm telling you

We are never ever ever supporting IE 8,9,10,
We are never ever ever supporting IE 8,9,10,
You go talk to EDGE, talk to my FIREFOX, talk to CHROME
But we are never ever ever ever getting back together
Like, ever...

Fixes #37651.
Props stunnedbeast, netweb, jorbin.




git-svn-id: https://develop.svn.wordpress.org/trunk@41062 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-16 01:14:36 +00:00
Gary Pendergast f780ce0a49 Emoji: Port the Twemoji regex to PHP.
Previously, `wp_encode_emoji()` and `wp_staticize_emoji()` used inaccurate regular expressions to find emoji, and transform then into HTML entities or `<img>`s, respectively. This would result in emoji not being correctly transformed, or occasionally, non-emoji being incorrectly transformed.

This commit adds a new `grunt` task - `grunt precommit:emoji`. It finds the regex in `twemoji.js`, transforms it into a PHP-friendly version, and adds it to `formatting.php`. This task is also automatically run by `grunt precommit`, when it detects that `twemoji.js` has changed.

The new regex requires features introduced in PCRE 8.32, which was introduced in PHP 5.4.14, though it was also backported to later releases of the PHP 5.3 series. For versions of PHP that don't support this, it will fall back to an updated version of the loose-matching regex.

For short posts, the performance difference between the old and new regex is negligible. As the posts get longer, however, the new method is exponentially faster.

Fixes #35293.



git-svn-id: https://develop.svn.wordpress.org/trunk@41043 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-14 05:46:19 +00:00
Weston Ruter 016dc58620 Widgets: Introduce `isHostedVideo` method on `VideoWidgetControl` to allow plugins to extend for recognizing services beyond YouTube and Vimeo.
Also update jshint configuration in Gruntfile to include the widget scripts among the JS files linted.

Props timmydcrawford.
See #39994.
Fixes #40808.


git-svn-id: https://develop.svn.wordpress.org/trunk@40810 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-20 04:17:33 +00:00
Weston Ruter 5eb62b94ad Widgets: Extend the Text widget with TinyMCE.
Introduces rich text formatting: bold, italic, lists, links.

Props westonruter, azaozz, timmydcrawford, obenland, melchoyce.
See #35760.
Fixes #35243.


git-svn-id: https://develop.svn.wordpress.org/trunk@40631 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 18:54:24 +00:00
John Blackbourn 5d58054f35 Build/Test Tools: Enable verbose mode in PHPUnit so we can see which tests are being skipped, and now that the number of skipped tests has been lowered.
See #40533, #40531


git-svn-id: https://develop.svn.wordpress.org/trunk@40527 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 20:24:11 +00:00
Adam Silverstein e3d5e1c6c8 REST API: improve test fixture generation, normalizing data.
Add a data normalization pass when generating data fixtures for the REST API endpoints. Ensures that the `wp-api-generated.js` fixture won't change between test runs. Set more default properties and use fixed values for any properties that can't be easily controlled (object IDs and derivatives like link). Generate the fixture file with JSON_PRETTY_PRINT so that future diffs are easier to follow.

Props jnylen0, netweb.
Fixes #39264.


git-svn-id: https://develop.svn.wordpress.org/trunk@40061 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-15 17:58:14 +00:00
Adam Silverstein 1879140548 REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.

The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.

Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.

Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.

Props jnylen0, welcher.
Fixes #39264.



git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 04:22:32 +00:00
Aaron Jorbin 8b464c7140 Build/Test tools: Add "apply" as alias for "patch"
The command applies a patch, so apply makes just as much sense. Additionally, this is to help translate dev tools into Australian.

Props netweb.
Fixes #38724.


git-svn-id: https://develop.svn.wordpress.org/trunk@39195 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-10 03:21:39 +00:00
Aaron Jorbin 2c0e24babf Bump grunt-contrib-uglify from 1.0.1 to 2.0.0
Sets `screwIE8` to false as it is now enabled by default

Files Changed:
build/wp-admin/js/customize-nav-menus.min.js
build/wp-admin/js/customize-widgets.min.js
build/wp-includes/js/customize-loader.min.js

Changelog:
2016-07-19   v2.0.0   Update uglify-js to v2.7.0. screwIE8 is enabled by default.
2016-07-19   v1.0.2   Update grunt to ^1.0.0. Fix beautify when passed as an object. Fix docs about report values.

See #38199.



git-svn-id: https://develop.svn.wordpress.org/trunk@39117 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-03 05:39:10 +00:00
Aaron Jorbin ce21d8210a Build/Test Tools: Allow Minimal Builds
Builds can hang or get very slow on copy when you have alot of files. Alot of files can suddenly appear when you are developing new themes or plugins. Often, it's nice to have a minimal build, especially if you are preparing a commit.

This adds a new flag `--minimal-copy` that can be added to any task which does a copy. These tasks include build, test, and copy. This flag will cause no plugins to be copied and only the twenty series of default themes to be copied. Everything else remains the same.

Fixes #38423.


git-svn-id: https://develop.svn.wordpress.org/trunk@38848 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-20 22:23:21 +00:00
John Blackbourn 29cfd0b336 oEmbed: Remove the oEmbed provider unit tests.
This reverts [38454] along with its follow-up commits, [38512], [38514], and [38692]. These tests are currently not pass
ing, and maybe they never will. The tests are in a group which does not run by default without a flag, making them quest
ionably useful.

We can re-visit this at a later date.

See #32360


git-svn-id: https://develop.svn.wordpress.org/trunk@38840 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-20 09:15:10 +00:00