WP_Application_Passwords_List_Table::print_js_template_row()
- Since
- 5.6.0
- Source
wp-admin/includes/class-wp-application-passwords-list-table.php:200
Compatibility
- WordPress
- since 5.6.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.
Performance profile
How much work a call to WP_Application_Passwords_List_Table::print_js_template_row() 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
- Scaling
- Scales with input
- Instructions
- 11–12
- Plugin surface
- 1 hook
- Called by
- 0
Touches nothing outside its own arguments.
The body loops, so the work grows with how much data it finds.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 111.
Third-party callbacks on 'manage_{$this->screen->id}_custom_column_js_template' run inside this call, and their cost is not bounded by anything here.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
do_action()called directly
Further down the call graph this can also reach option, cache, serialize, query and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 1 distinct outcome
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Application_Passwords_List_Table::print_js_template_row() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 11–12 | ->get_column_info() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 112 | 11–12 | 11 | 1 more instruction than PHP 8.5 |
| 8.5 | 111 | 11–12 | 11 | |
| 8.4 | 111 | 11–12 | 11 | 3 fewer instructions than PHP 8.3 |
| 8.3 | 114 | 11–12 | 11 | |
| 8.2 | 114 | 11–12 | 11 | 2 fewer instructions than PHP 8.1 |
| 8.1 | 116 | 14–15 | 11 | |
| 7.4 | 116 | 14–15 | 11 |
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.
Hooks and filters fired · 1
One hook fires while WP_Application_Passwords_List_Table::print_js_template_row() runs, in this order:
- do_action( manage_{$this->screen->id}_custom_column_js_template )actionline 251 (+51 into the body)
Fires in the JavaScript row template for each custom column in the Application Passwords list table.
Uses · 7
- esc_attr()Escaping for HTML attributes.
- wp_strip_all_tags()Properly strips all HTML tags including 'script' and 'style'.
- wp_json_encode()Encodes a variable into JSON, with some confidence checks.
- __()Retrieves the translation of $text.
- esc_html__()Retrieves the translation of $text and escapes it for safe use in HTML output.
- do_action()Calls the callback functions that have been added to an action hook.
- WP_Application_Passwords_List_Table::get_column_info()
Source code
public function print_js_template_row() { list( $columns, $hidden, , $primary ) = $this->get_column_info(); echo '<tr data-uuid="{{ data.uuid }}">'; foreach ( $columns as $column_name => $display_name ) { $is_primary = $primary === $column_name; $classes = "{$column_name} column-{$column_name}"; if ( $is_primary ) { $classes .= ' has-row-actions column-primary'; } if ( in_array( $column_name, $hidden, true ) ) { $classes .= ' hidden'; } printf( '<td class="%s" data-colname="%s">', esc_attr( $classes ), esc_attr( wp_strip_all_tags( $display_name ) ) ); switch ( $column_name ) { case 'name': echo '{{ data.name }}'; break; case 'created': // JSON encoding automatically doubles backslashes to ensure they don't get lost when printing the inline JS. echo '<# print( wp.date.dateI18n( ' . wp_json_encode( __( 'F j, Y' ) ) . ', data.created ) ) #>'; break; case 'last_used': echo '<# print( data.last_used !== null ? wp.date.dateI18n( ' . wp_json_encode( __( 'F j, Y' ) ) . ", data.last_used ) : '—' ) #>"; break; case 'last_ip': echo "{{ data.last_ip || '—' }}"; break; case 'revoke': printf( '<button type="button" class="button delete" aria-label="%1$s">%2$s</button>', /* translators: %s: the application password's given name. */ esc_attr( sprintf( __( 'Revoke "%s"' ), '{{ data.name }}' ) ), esc_html__( 'Revoke' ) ); break; default: /** * Fires in the JavaScript row template for each custom column in the Application Passwords list table. * * Custom columns are registered using the {@see 'manage_application-passwords-user_columns'} filter. * * @since 5.6.0 * * @param string $column_name Name of the custom column. */ do_action( "manage_{$this->screen->id}_custom_column_js_template", $column_name ); break; } if ( $is_primary ) { echo '<button type="button" class="toggle-row"><span class="screen-reader-text">' . /* translators: Hidden accessibility text. */ __( 'Show more details' ) . '</span></button>'; } echo '</td>'; } echo '</tr>'; }Changelog
Introduced in 5.6.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-admin/includes/class-wp-application-passwords-list-table.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.