wppaste
WordPress

WP_Plugin_Install_List_Table::display_rows()

Since
3.1.0
Source
wp-admin/includes/class-wp-plugin-install-list-table.php:471
Generates the list table rows.

Compatibility

WordPress
since 3.1.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_Plugin_Install_List_Table::display_rows() 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
Heavy

Reads stored settings via get_option(), cached per request but not free on a cold cache.

Scaling
Scales with input

The body loops, so the work grows with how much data it finds.

Instructions
25–27

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

Plugin surface
2 hooks

Third-party callbacks on 'plugin_install_description', 'plugin_install_action_links' run inside this call, and their cost is not bounded by anything here.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • hookthird-party callbacksapply_filters()called directly
  • optionoption read or writeget_option()one call below WP_Plugin_Install_List_Table::display_rows()

Further down the call graph this can also reach cache, serialize, transient, query and http. 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_Plugin_Install_List_Table::display_rows() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always25–27_x(), _x(), _x()

This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev50425–2734
8.550425–2734
8.450425–27341 fewer instruction than PHP 8.3
8.350525–2734
8.250525–2734
8.150525–2734
7.450525–2734

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 · 2

2 hooks fire while WP_Plugin_Install_List_Table::display_rows() runs, in this order:

  1. apply_filters( plugin_install_description )filterline 541 (+70 into the body)

    Filters the plugin card description on the Add Plugins screen.

  2. apply_filters( plugin_install_action_links )filterline 598 (+127 into the body)

    Filters the install action links for a plugin.

Uses · 23

Show all 23

Source code

	public function display_rows() {		$plugins_allowedtags = array(			'a'       => array(				'href'   => array(),				'title'  => array(),				'target' => array(),			),			'abbr'    => array( 'title' => array() ),			'acronym' => array( 'title' => array() ),			'code'    => array(),			'pre'     => array(),			'em'      => array(),			'strong'  => array(),			'ul'      => array(),			'ol'      => array(),			'li'      => array(),			'p'       => array(),			'br'      => array(),		); 		$plugins_group_titles = array(			'Performance' => _x( 'Performance', 'Plugin installer group title' ),			'Social'      => _x( 'Social', 'Plugin installer group title' ),			'Tools'       => _x( 'Tools', 'Plugin installer group title' ),		); 		$group = null; 		foreach ( (array) $this->items as $plugin ) {			if ( is_object( $plugin ) ) {				$plugin = (array) $plugin;			} 			// Display the group heading if there is one.			if ( isset( $plugin['group'] ) && $plugin['group'] !== $group ) {				if ( isset( $this->groups[ $plugin['group'] ] ) ) {					$group_name = $this->groups[ $plugin['group'] ];					if ( isset( $plugins_group_titles[ $group_name ] ) ) {						$group_name = $plugins_group_titles[ $group_name ];					}				} else {					$group_name = $plugin['group'];				} 				// Starting a new group, close off the divs of the last one.				if ( ! empty( $group ) ) {					echo '</div></div>';				} 				echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>';				// Needs an extra wrapping div for nth-child selectors to work.				echo '<div class="plugin-items">'; 				$group = $plugin['group'];			} 			$title = wp_kses( $plugin['name'], $plugins_allowedtags ); 			// Remove any HTML from the description.			$description = strip_tags( $plugin['short_description'] ); 			/**			 * Filters the plugin card description on the Add Plugins screen.			 *			 * @since 6.0.0			 *			 * @param string $description Plugin card description.			 * @param array  $plugin      An array of plugin data. See {@see plugins_api()}			 *                            for the list of possible values.			 */			$description = apply_filters( 'plugin_install_description', $description, $plugin ); 			$version = wp_kses( $plugin['version'], $plugins_allowedtags ); 			$name = strip_tags( $title . ' ' . $version ); 			$author = wp_kses( $plugin['author'], $plugins_allowedtags );			if ( ! empty( $author ) ) {				/* translators: %s: Plugin author. */				$author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>';

Changelog

Introduced in 3.1.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-admin/includes/class-wp-plugin-install-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.