Make WordPress Core

Changeset 58188


Ignore:
Timestamp:
05/23/2024 07:54:17 PM (4 weeks ago)
Author:
dmsnell
Message:

Introduce Token Map: An optimized static translation class.

This patch introduces a new class: WP_Token_Map, designed for efficient
lookup and translation of static mappings between string keys or tokens, and
string replacements (for example, HTML character references).

The Token Map imposes certain restrictions on the byte length of the lookup
tokens and their replacements, but is a highly-optimized data structure for
mappings with a very high number of tokens.

Developed in https://github.com/WordPress/wordpress-develop/pull/5373
Discussed in https://core.trac.wordpress.org/ticket/60698

Fixes #60698.
Props: dmsnell, gziolo, jonsurrell, jorbin.

Location:
trunk
Files:
8 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-settings.php

    r58169 r58188  
    108108// Load early WordPress files.
    109109require ABSPATH . WPINC . '/class-wp-list-util.php';
     110require ABSPATH . WPINC . '/class-wp-token-map.php';
    110111require ABSPATH . WPINC . '/formatting.php';
    111112require ABSPATH . WPINC . '/meta.php';
     
    249250require ABSPATH . WPINC . '/media.php';
    250251require ABSPATH . WPINC . '/http.php';
     252require ABSPATH . WPINC . '/html-api/html5-named-character-references.php';
    251253require ABSPATH . WPINC . '/html-api/class-wp-html-attribute-token.php';
    252254require ABSPATH . WPINC . '/html-api/class-wp-html-span.php';
Note: See TracChangeset for help on using the changeset viewer.