wppaste
WordPress

_WP_Editors::get_translation(): array

Since
4.7.0
Source
wp-includes/class-wp-editor.php:1136

Compatibility

WordPress
since 4.7.0
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Return value

array

Performance profile

How much work a call to _WP_Editors::get_translation() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Light

Touches nothing outside its own arguments.

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
4–1089

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 1089.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
2

2 places in core call this, so the cost is paid more often than your own code shows.

What one call costs · 2 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost _WP_Editors::get_translation() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always4none
always1089__(), _x(), _x(), __(), __(), __(), __(), __(), __(), _x(), __(), __(), _x(), _x(), _x(), _x(), _x(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), _x(), _x(), _x(), _x(), _x(), _x(), _x(), _x(), _x(), _x(), _x(), _x(), __(), _x(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), _x(), _x(), __(), __(), __(), __(), _x(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), _x(), __(), _x(), _x(), _x(), __(), _x(), _x(), _x(), _x(), __(), _x(), _x(), _x(), __(), __(), _x(), _x(), _x(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), _x(), __(), _x(), _x(), _x(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), _x(), __(), __(), __(), _x(), _x(), __(), __(), __(), __(), __(), __(), __(), __(), __(), _x(), _x(), _x(), __(), __(), _x(), __(), __(), sprintf(), __(), __(), __(), __(), __(), __(), _x(), _x(), _x(), _x(), _x(), _x(), _x(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), _x(), _x(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __()

Across PHP versions

Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 1089 instructions, 4–1089 executed per call, 1 branch. The work does not change between versions.

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Uses · 2

  • __()Retrieves the translation of $text.
  • _x()Retrieves translated string with gettext context.

Used by · 2

Source code

	private static function get_translation() {		if ( empty( self::$translation ) ) {			self::$translation = array(				// Default TinyMCE strings.				'New document'                         => __( 'New document' ),				'Formats'                              => _x( 'Formats', 'TinyMCE' ), 				'Headings'                             => _x( 'Headings', 'TinyMCE' ),				'Heading 1'                            => array( __( 'Heading 1' ), 'access1' ),				'Heading 2'                            => array( __( 'Heading 2' ), 'access2' ),				'Heading 3'                            => array( __( 'Heading 3' ), 'access3' ),				'Heading 4'                            => array( __( 'Heading 4' ), 'access4' ),				'Heading 5'                            => array( __( 'Heading 5' ), 'access5' ),				'Heading 6'                            => array( __( 'Heading 6' ), 'access6' ), 				/* translators: Block tags. */				'Blocks'                               => _x( 'Blocks', 'TinyMCE' ),				'Paragraph'                            => array( __( 'Paragraph' ), 'access7' ),				'Blockquote'                           => array( __( 'Blockquote' ), 'accessQ' ),				'Div'                                  => _x( 'Div', 'HTML tag' ),				'Pre'                                  => _x( 'Pre', 'HTML tag' ),				'Preformatted'                         => _x( 'Preformatted', 'HTML tag' ),				'Address'                              => _x( 'Address', 'HTML tag' ), 				'Inline'                               => _x( 'Inline', 'HTML elements' ),				'Underline'                            => array( __( 'Underline' ), 'metaU' ),				'Strikethrough'                        => array( __( 'Strikethrough' ), 'accessD' ),				'Subscript'                            => __( 'Subscript' ),				'Superscript'                          => __( 'Superscript' ),				'Clear formatting'                     => __( 'Clear formatting' ),				'Bold'                                 => array( __( 'Bold' ), 'metaB' ),				'Italic'                               => array( __( 'Italic' ), 'metaI' ),				'Code'                                 => array( __( 'Code' ), 'accessX' ),				'Source code'                          => __( 'Source code' ),				'Font Family'                          => __( 'Font Family' ),				'Font Sizes'                           => __( 'Font Sizes' ), 				'Align center'                         => array( __( 'Align center' ), 'accessC' ),				'Align right'                          => array( __( 'Align right' ), 'accessR' ),				'Align left'                           => array( __( 'Align left' ), 'accessL' ),				'Justify'                              => array( __( 'Justify' ), 'accessJ' ),				'Increase indent'                      => __( 'Increase indent' ),				'Decrease indent'                      => __( 'Decrease indent' ), 				'Cut'                                  => array( __( 'Cut' ), 'metaX' ),				'Copy'                                 => array( __( 'Copy' ), 'metaC' ),				'Paste'                                => array( __( 'Paste' ), 'metaV' ),				'Select all'                           => array( __( 'Select all' ), 'metaA' ),				'Undo'                                 => array( __( 'Undo' ), 'metaZ' ),				'Redo'                                 => array( __( 'Redo' ), 'metaY' ), 				'Ok'                                   => __( 'OK' ),				'Cancel'                               => __( 'Cancel' ),				'Close'                                => __( 'Close' ),				'Visual aids'                          => __( 'Visual aids' ), 				'Bullet list'                          => array( __( 'Bulleted list' ), 'accessU' ),				'Numbered list'                        => array( __( 'Numbered list' ), 'accessO' ),				'Square'                               => _x( 'Square', 'list style' ),				'Default'                              => _x( 'Default', 'list style' ),				'Circle'                               => _x( 'Circle', 'list style' ),				'Disc'                                 => _x( 'Disc', 'list style' ),				'Lower Greek'                          => _x( 'Lower Greek', 'list style' ),				'Lower Alpha'                          => _x( 'Lower Alpha', 'list style' ),				'Upper Alpha'                          => _x( 'Upper Alpha', 'list style' ),				'Upper Roman'                          => _x( 'Upper Roman', 'list style' ),				'Lower Roman'                          => _x( 'Lower Roman', 'list style' ), 				// Anchor plugin.				'Name'                                 => _x( 'Name', 'Name of link anchor (TinyMCE)' ),				'Anchor'                               => _x( 'Anchor', 'Link anchor (TinyMCE)' ),				'Anchors'                              => _x( 'Anchors', 'Link anchors (TinyMCE)' ),				'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.' =>					__( 'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.' ),				'Id'                                   => _x( 'Id', 'Id for link anchor (TinyMCE)' ), 				// Fullpage plugin.				'Document properties'                  => __( 'Document properties' ),				'Robots'                               => __( 'Robots' ),				'Title'                                => __( 'Title' ),

Changelog

Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/class-wp-editor.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.