WordPress/wp-includes
Gary Pendergast b13bab3e53 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.


Built from https://develop.svn.wordpress.org/trunk@41043


git-svn-id: http://core.svn.wordpress.org/trunk@40893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-14 05:47:49 +00:00
..
ID3
IXR XML-RPC: Fix truncated warning message added in [38883]. 2016-10-29 21:32:33 +00:00
Requests HTTP: Update Requests to master (0048f3c) which fixes a number of outstanding issues. 2016-10-05 03:24:37 +00:00
SimplePie
Text
certificates
css Accessibility: Improve the color contrast ratio of the dismiss notice buttons. 2017-05-04 22:32:46 +00:00
customize Docs: Improve phpdoc for `WP_Customize_Manager`, `WP_Customize_Control`, `WP_Customize_Setting`, and `WP_Customize_Selective_Refresh`. 2017-05-19 20:25:41 +00:00
fonts
images
js Shortcodes: Allow using single quotes for empty value attributes. 2017-07-11 00:54:41 +00:00
pomo General: Correctly detect trailing newline when prepending. 2016-12-13 02:48:41 +00:00
random_compat
rest-api REST API: Add a filter to allow modifying the response *after* embedded data is added. 2017-06-29 13:17:43 +00:00
theme-compat
widgets Widgets: Enqueue assets needed by media and text widgets in their `_register_one()` methods. 2017-07-11 22:47:43 +00:00
admin-bar.php Users: Update name in toolbar when changing user display name. 2017-05-12 20:06:42 +00:00
atomlib.php General: Remove most uses of create_function() 2016-12-13 01:49:39 +00:00
author-template.php Docs: List out accepted values for the `$field` parameter in `get_the_author_meta()`. 2017-06-26 18:24:40 +00:00
bookmark-template.php
bookmark.php General: Use interpolation instead of concatenation for all dynamic hook names. 2016-12-14 04:18:42 +00:00
cache.php Docs: Remove a few more superfluous `@package WordPress` and `@subpackage` notations outside of file headers missed in [40988]. 2017-07-01 17:11:41 +00:00
canonical.php Docs: Add a `@global` entry for `$wp` in `redirect_canonical()`. 2017-07-05 09:19:43 +00:00
capabilities.php Avoid PHP notices when checking termmeta capabilities against a non-existent term. 2017-07-04 19:59:40 +00:00
category-template.php Docs: Default for the `orderby` argument in `wp_list_categories()` is actually 'name', not 'ID'. 2017-07-12 22:06:39 +00:00
category.php I18N: Merge similar strings in `_deprecated_argument()` calls. 2017-01-29 11:50:41 +00:00
class-IXR.php Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389. 2016-08-31 16:31:29 +00:00
class-feed.php Load: Re-add `class-feed.php`. 2016-12-03 03:30:42 +00:00
class-http.php Docs: Add a missing quote in `user-agent` argument description in `WP_Http::request()`. 2017-06-25 07:00:42 +00:00
class-json.php
class-oembed.php Embeds: Update oEmbed endpoint URL for VideoPress. 2017-06-15 05:38:45 +00:00
class-phpass.php
class-phpmailer.php Update PHPMailer to 5.2.22. 2017-01-11 01:23:41 +00:00
class-pop3.php Docs: Fix multiple trivial typos throughout a variety of core files. 2016-10-31 06:28:32 +00:00
class-requests.php HTTP: Update Requests to master (0048f3c) which fixes a number of outstanding issues. 2016-10-05 03:24:37 +00:00
class-simplepie.php
class-smtp.php Update PHPMailer to 5.2.22. 2017-01-11 01:23:41 +00:00
class-snoopy.php
class-walker-category-dropdown.php
class-walker-category.php
class-walker-comment.php
class-walker-nav-menu.php Menus: Prevent empty class attribute following [40537]. 2017-05-14 03:38:48 +00:00
class-walker-page-dropdown.php
class-walker-page.php Menus: Introduce `page_menu_link_attributes` filter in `Walker_Page::start_el()` for the HTML attributes applied to a page menu item's anchor element. 2017-05-01 23:32:42 +00:00
class-wp-admin-bar.php Docs: Add missing deprecation, introduction, and summary information to the DocBlock for `WP_Admin_Bar::recursive_render()`. 2017-06-25 21:58:41 +00:00
class-wp-ajax-response.php
class-wp-comment-query.php Comments: Clean up unused code after [38446]. 2016-12-07 15:52:44 +00:00
class-wp-comment.php Revert to pre-4.7 behavior for fetching object instances by id. 2017-01-26 16:53:41 +00:00
class-wp-customize-control.php Docs: Improve phpdoc for `WP_Customize_Manager`, `WP_Customize_Control`, `WP_Customize_Setting`, and `WP_Customize_Selective_Refresh`. 2017-05-19 20:25:41 +00:00
class-wp-customize-manager.php Customize: Prevent edge case fatal error when attempting to save changes to a changeset that had previously been corrupted. 2017-07-06 07:05:43 +00:00
class-wp-customize-nav-menus.php Docs: Add a `@global` entry for `$wp_post_statuses` in `WP_Customize_Nav_Menus::make_auto_draft_status_previewable()`. 2017-07-05 09:21:41 +00:00
class-wp-customize-panel.php Customize: Auto-expand a widget area section when expanding the Widgets panel if there is only one registered sidebar and it is active. 2017-04-07 19:27:40 +00:00
class-wp-customize-section.php Customize: Introduce custom CSS for extending theme styles. 2016-10-19 18:15:31 +00:00
class-wp-customize-setting.php Docs: Improve phpdoc for `WP_Customize_Manager`, `WP_Customize_Control`, `WP_Customize_Setting`, and `WP_Customize_Selective_Refresh`. 2017-05-19 20:25:41 +00:00
class-wp-customize-widgets.php Docs: Add a `@global` entry for `$wp_widget_factory` in `WP_Customize_Widgets::get_selective_refreshable_widgets()`. 2017-07-05 08:23:41 +00:00
class-wp-dependency.php
class-wp-editor.php Docs: Add a `@global` entry for `$tinymce_version` in `_WP_Editors::editor_js()`. 2017-07-13 14:33:40 +00:00
class-wp-embed.php
class-wp-error.php Docs: Remove superfluous `@package WordPress` and `@subpackage` notations used outside of file headers in a variety of core files. 2017-07-01 16:58:42 +00:00
class-wp-feed-cache-transient.php
class-wp-feed-cache.php
class-wp-hook.php Docs: Replace a variety of http links referenced in inline docs with their https counterparts (where possible). 2017-06-25 22:06:41 +00:00
class-wp-http-cookie.php
class-wp-http-curl.php
class-wp-http-encoding.php
class-wp-http-ixr-client.php
class-wp-http-proxy.php
class-wp-http-requests-hooks.php Docs: Remove superfluous `@package WordPress` and `@subpackage` notations used outside of file headers in a variety of core files. 2017-07-01 16:58:42 +00:00
class-wp-http-requests-response.php HTTP: Document that the return value of `wp_remote_retrieve_headers()` changed from a simple array to an object which implements ArrayAccess. 2016-10-05 03:51:28 +00:00
class-wp-http-response.php
class-wp-http-streams.php
class-wp-image-editor-gd.php Docs: Remove superfluous `@package WordPress` and `@subpackage` notations used outside of file headers in a variety of core files. 2017-07-01 16:58:42 +00:00
class-wp-image-editor-imagick.php Docs: Remove superfluous `@package WordPress` and `@subpackage` notations used outside of file headers in a variety of core files. 2017-07-01 16:58:42 +00:00
class-wp-image-editor.php
class-wp-list-util.php General: Introduce a `wp_list_sort()` helper function, v2. 2016-10-25 21:26:32 +00:00
class-wp-locale-switcher.php I18N: Add an additional caching layer for `_load_textdomain_just_in_time()`. 2016-11-21 16:07:33 +00:00
class-wp-locale.php Docs: Correct `@access` entries for `WP_Locale::init()` and `WP_Locale::register_globals()`. 2017-01-06 22:11:16 +00:00
class-wp-matchesmapregex.php
class-wp-meta-query.php Docs: Remove superfluous `@package WordPress` and `@subpackage` notations used outside of file headers in a variety of core files. 2017-07-01 16:58:42 +00:00
class-wp-metadata-lazyloader.php
class-wp-network-query.php Docs: Add a `@global` entry for `$wpdb` in `WP_Network_Query::get_network_ids()`. 2017-07-05 09:23:42 +00:00
class-wp-network.php General: Always use colon instead of a semicolon in `switch()` control structures. 2017-07-04 09:52:41 +00:00
class-wp-oembed-controller.php REST API: Remove `_wpnonce` value from being used in hashed oEmbed proxy cache key. 2017-07-12 22:51:40 +00:00
class-wp-post-type.php Posts, Post Types: Add missing REST API properties to `WP_Post_Type` class. 2017-03-18 15:17:45 +00:00
class-wp-post.php Docs: Add missing `@since` tags for `WP_Post` properties and methods. 2017-07-13 12:08:41 +00:00
class-wp-query.php Docs: Improve the DocBlock summary for `WP_Query::parse_orderby()`. 2017-07-13 15:44:41 +00:00
class-wp-rewrite.php Make sure rewrite rules are not written until `wp_loaded` has fired 2016-10-07 19:44:28 +00:00
class-wp-role.php
class-wp-roles.php Roles: Fix a PHP error introduced in [39082]. 2016-11-02 05:55:30 +00:00
class-wp-session-tokens.php Docs: Add a missing return notation and to the DocBlock for `WP_Session_Tokens::get_instance()`. 2017-07-04 17:16:42 +00:00
class-wp-simplepie-file.php
class-wp-simplepie-sanitize-kses.php
class-wp-site-query.php Multisite: Add `lang_id` support to `WP_Site_Query`. 2017-03-27 19:48:52 +00:00
class-wp-site.php Multisite: After [37918] add support for retrieving custom site properties set by the `site_details` filter. 2017-04-19 18:52:44 +00:00
class-wp-tax-query.php Use `WP_Term_Query` when transforming tax queries. 2017-06-21 03:57:42 +00:00
class-wp-taxonomy.php Taxonomy: Add missing REST API properties to `WP_Taxonomy` class. 2017-03-18 15:25:43 +00:00
class-wp-term-query.php When querying for terms, do not assume that `$taxonomies` is a 0-indexed array. 2017-06-23 02:06:42 +00:00
class-wp-term.php Taxonomy: Ignore cached term value when it doesn't match the queried taxonomy. 2017-07-01 11:46:41 +00:00
class-wp-text-diff-renderer-inline.php
class-wp-text-diff-renderer-table.php Docs: Add full parameter and return documentation for `WP_Text_Diff_Renderer_Table::interleave_changed_lines()`. 2017-06-30 05:29:41 +00:00
class-wp-theme.php Themes: Add filter for excluding directories from being scanned for template files. 2017-03-18 03:54:41 +00:00
class-wp-user-meta-session-tokens.php
class-wp-user-query.php Allow user searches to match the `display_name` field. 2017-07-01 14:22:41 +00:00
class-wp-user.php Capabilities: Prevent users having the `do_not_allow` capability. 2017-07-02 05:16:45 +00:00
class-wp-walker.php Docs: Add missing `@since` entry for `Walker::unset_children()`. 2017-01-06 22:14:00 +00:00
class-wp-widget-factory.php
class-wp-widget.php Docs: Fix multiple trivial typos throughout a variety of core files. 2016-10-31 06:28:32 +00:00
class-wp-xmlrpc-server.php Docs: Remove superfluous `@package WordPress` and `@subpackage` notations used outside of file headers in a variety of core files. 2017-07-01 16:58:42 +00:00
class-wp.php Feeds: Always return a valid timestamp for the Last-Modified header of comment or post feeds. 2016-10-25 20:48:29 +00:00
class.wp-dependencies.php Docs: Remove superfluous `@package WordPress` and `@subpackage` notations used outside of file headers in a variety of core files. 2017-07-01 16:58:42 +00:00
class.wp-scripts.php Docs: Remove superfluous `@package WordPress` and `@subpackage` notations used outside of file headers in a variety of core files. 2017-07-01 16:58:42 +00:00
class.wp-styles.php Docs: Remove superfluous `@package WordPress` and `@subpackage` notations used outside of file headers in a variety of core files. 2017-07-01 16:58:42 +00:00
comment-template.php Comments: Correct the $post_id parameter passed to the 'comments_open' and 'pings_open' filters. 2017-05-14 03:50:42 +00:00
comment.php Allow metadata to be updated via `wp_update_comment()`. 2017-07-01 13:36:41 +00:00
compat.php
cron.php Docs: Use third-person singular verbs in the summaries for `wp_unschedule_hook()` and `wp_clear_scheduled_hook()`. 2017-06-30 04:54:41 +00:00
date.php General: Always use colon instead of a semicolon in `switch()` control structures. 2017-07-04 09:52:41 +00:00
default-constants.php Login and Registration: Avoid a potentially incorrect value for the cookie hash on multisite installations that don't have a value in the `siteurl` network option. 2017-03-23 19:01:42 +00:00
default-filters.php Widgets: Rename "HTML Code" widget to "Custom HTML" widget. 2017-06-24 00:00:45 +00:00
default-widgets.php Widgets: Rename "HTML Code" widget to "Custom HTML" widget. 2017-06-24 00:00:45 +00:00
deprecated.php Docs: Notate `format_for_editor()` as the replacement function in the DocBlock for the deprecated `wp_richedit_pre()`. 2017-06-25 22:10:41 +00:00
embed-template.php
embed.php Docs: Add a clarification to the description about what the `$output` parameter in the `embed_html` filter doc represents. 2017-06-25 21:46:39 +00:00
feed-atom-comments.php Feeds: Do not translate the `lastBuildDate` field in RSS feeds. 2016-12-16 06:39:41 +00:00
feed-atom.php Feeds: Do not translate the `lastBuildDate` field in RSS feeds. 2016-12-16 06:39:41 +00:00
feed-rdf.php Feeds: Always return a valid timestamp for the Last-Modified header of comment or post feeds. 2016-10-25 20:48:29 +00:00
feed-rss.php Feeds: Always return a valid timestamp for the Last-Modified header of comment or post feeds. 2016-10-25 20:48:29 +00:00
feed-rss2-comments.php Feeds: Do not translate the `lastBuildDate` field in RSS feeds. 2016-12-16 06:39:41 +00:00
feed-rss2.php Feeds: Replace the RSS2 `lastBuildDate` date field with the `r` date specifier. 2016-12-16 06:42:40 +00:00
feed.php Feeds: Don't override the Content-Type header inside fetc_feed() 2017-01-05 03:06:42 +00:00
formatting.php Emoji: Port the Twemoji regex to PHP. 2017-07-14 05:47:49 +00:00
functions.php Docs: Fix typo in `wp_suspend_cache_invalidation()` description. 2017-07-12 21:26:44 +00:00
functions.wp-scripts.php Customize: Implement customized state persistence with changesets. 2016-10-18 20:05:31 +00:00
functions.wp-styles.php Script Loader: Correct default value for `$src` in `wp_enqueue_script()` and `wp_enqueue_style()`. 2016-09-04 04:09:28 +00:00
general-template.php General: Ensure `$description` gets initialized in `get_the_archive_description()` if the post type archive conditional is true and the description isn't set. 2017-07-01 14:23:41 +00:00
http.php Docs: Replace a variety of http links referenced in inline docs with their https counterparts (where possible). 2017-06-25 22:06:41 +00:00
kses.php Docs: Adjust notation for the `$context` parameter in the DocBlocks for the `wp_kses_allowed_html()` function and its associated `wp_kses_allowed_html` filter. 2017-06-25 22:16:40 +00:00
l10n.php Docs: Clarify the description for `esc_html__()` to note that the original text will be escaped on return if there is no translation, or the text domain isn't loaded. 2017-06-25 06:41:41 +00:00
link-template.php Link Template: Clarify documentation for the `$id` parameter in `get_post_permalink()`, `get_edit_post_link()`, `edit_post_link()`, and `get_delete_post_link()`, to reflect that either a post ID or `WP_Post` object is accepted. 2017-07-01 03:29:42 +00:00
load.php Docs: Add a `@global` entry for `$wp_filter` in `wp_start_object_cache()`. 2017-07-01 22:13:41 +00:00
locale.php Load: No-op `locale.php` 2016-12-03 04:16:38 +00:00
media-template.php Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future. 2017-05-11 21:11:44 +00:00
media.php Media: Restrict appending `loop` parameter to Vimeo URLs specifically and not all external URLs in Video widget (via shortcode). 2017-06-09 19:29:43 +00:00
meta.php Options/Meta: Document valid types for registration. 2017-05-10 06:10:43 +00:00
ms-blogs.php Multisite: Correct documentation for site status change hooks. 2017-03-30 04:36:43 +00:00
ms-default-constants.php Multisite: Use `get_network()` and `get_current_network_id()` for current network data. 2016-10-19 04:47:30 +00:00
ms-default-filters.php Multisite: Fix filter hooks for the updating network count functions. 2017-05-09 17:15:43 +00:00
ms-deprecated.php Improve the usefulness of several `_deprecated_function()` calls by passing known replacement functions, methods, or hooks. 2017-06-25 00:05:44 +00:00
ms-files.php Multsite: Flush output buffer after `readfile()` in `ms-files.php`. 2016-09-27 20:05:28 +00:00
ms-functions.php Docs: Improve and clarify the DocBlock summary for `wpmu_log_new_registrations()`. 2017-06-26 18:05:41 +00:00
ms-load.php Multisite: Replace `get_blog_details()` in inline documentation. 2016-10-26 03:39:29 +00:00
ms-settings.php Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389. 2016-08-31 16:31:29 +00:00
nav-menu-template.php Menus: Make sure `current-menu-parent` and `current-menu-ancestor` classes are properly set for parent items of post type archive submenu items. 2017-07-05 21:31:44 +00:00
nav-menu.php Docs: Clarify accepted types and values for `$menu` parameters in several contexts: 2017-06-30 04:49:40 +00:00
option.php Options: Pass `$default` as a new parameter to the `pre_option_{$option}` and `pre_site_option_{$option}` filters. 2017-07-06 15:12:44 +00:00
pluggable-deprecated.php
pluggable.php Users: Clear the user settings cookies when clearing auth cookies. 2017-05-07 16:54:42 +00:00
plugin.php Bootstrap: Use `dirname()` when loading `class-wp-hook.php` from `plugin.php`. 2016-09-12 01:50:30 +00:00
post-formats.php
post-template.php Docs: Correct a typo in the `sort_column` argument description for `wp_page_menu()`. 2017-06-13 01:11:43 +00:00
post-thumbnail-template.php
post.php Docs: Use a hash notation for the `$args` parameter to describe the `fields` argument in the DocBlock for `wp_get_post_terms()`. 2017-07-12 22:21:41 +00:00
query.php Docs: Update the description of `is_singular()` and `WP_Query::is_singular()` to be parsed correctly by developer.wordpress.org. 2017-02-23 10:30:43 +00:00
registration-functions.php
registration.php
rest-api.php REST API: In the admin area, ensure the REST API endpoint URL is forced to `https` when necessary. 2017-05-25 18:02:41 +00:00
revision.php Docs: Improve the documentation for parameters which accept `OBJECT`, `ARRAY_A`, and `ARRAY_N` as parameters. 2016-11-09 23:00:32 +00:00
rewrite.php
rss-functions.php
rss.php Docs: Fix multiple trivial typos throughout a variety of core files. 2016-10-31 06:28:32 +00:00
script-loader.php Docs: Replace a variety of http links referenced in inline docs with their https counterparts (where possible). 2017-06-25 22:06:41 +00:00
session.php Load: Re-add `session.php`. 2016-12-03 03:51:41 +00:00
shortcodes.php Shortcodes: Allow using single quotes for empty value attributes. 2017-07-11 00:54:41 +00:00
taxonomy.php Taxonomy: Avoid duplicates when querying for terms in taxonomies registered with `$args` parameter. 2017-07-13 13:41:44 +00:00
template-loader.php Themes: Remove `paged.php` from the theme template hierarchy. 2016-10-07 21:03:31 +00:00
template.php Docs: Don't reference non-existent hooks inline in the DocBlock descriptions for the following template functions: 2017-06-29 16:05:41 +00:00
theme.php Customize: Keep alive auto-drafts created for page/post stubs when parent changeset is updated, and delete when changeset is garbage-collected. 2017-05-16 05:37:44 +00:00
update.php Cron API: Add a new `wp_doing_cron()` helper function. 2017-05-06 14:30:40 +00:00
user.php Docs: Add a `@global` entry for `$wpdb` in `is_user_member_of_blog()`. 2017-07-13 13:54:41 +00:00
vars.php General: Introduce a `wp_is_mobile` filter for controlling whether a request should be treated as coming from a mobile device. 2017-06-15 12:05:42 +00:00
version.php Emoji: Port the Twemoji regex to PHP. 2017-07-14 05:47:49 +00:00
widgets.php Widgets: Rename "HTML Code" widget to "Custom HTML" widget. 2017-06-24 00:00:45 +00:00
wlwmanifest.xml
wp-db.php Docs: Remove a few more superfluous `@package WordPress` and `@subpackage` notations outside of file headers missed in [40988]. 2017-07-01 17:11:41 +00:00
wp-diff.php Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389. 2016-08-31 16:31:29 +00:00