WP_Plugins_List_Table::get_views(): array

In this article

Return

array

Source

protected function get_views() {
	global $totals, $status;

	$status_links = array();
	foreach ( $totals as $type => $count ) {
		if ( ! $count ) {
			continue;
		}

		switch ( $type ) {
			case 'all':
				/* translators: %s: Number of plugins. */
				$text = _nx(
					'All <span class="count">(%s)</span>',
					'All <span class="count">(%s)</span>',
					$count,
					'plugins'
				);
				break;
			case 'active':
				/* translators: %s: Number of plugins. */
				$text = _n(
					'Active <span class="count">(%s)</span>',
					'Active <span class="count">(%s)</span>',
					$count
				);
				break;
			case 'recently_activated':
				/* translators: %s: Number of plugins. */
				$text = _n(
					'Recently Active <span class="count">(%s)</span>',
					'Recently Active <span class="count">(%s)</span>',
					$count
				);
				break;
			case 'inactive':
				/* translators: %s: Number of plugins. */
				$text = _n(
					'Inactive <span class="count">(%s)</span>',
					'Inactive <span class="count">(%s)</span>',
					$count
				);
				break;
			case 'mustuse':
				/* translators: %s: Number of plugins. */
				$text = _n(
					'Must-Use <span class="count">(%s)</span>',
					'Must-Use <span class="count">(%s)</span>',
					$count
				);
				break;
			case 'dropins':
				/* translators: %s: Number of plugins. */
				$text = _n(
					'Drop-in <span class="count">(%s)</span>',
					'Drop-ins <span class="count">(%s)</span>',
					$count
				);
				break;
			case 'paused':
				/* translators: %s: Number of plugins. */
				$text = _n(
					'Paused <span class="count">(%s)</span>',
					'Paused <span class="count">(%s)</span>',
					$count
				);
				break;
			case 'upgrade':
				/* translators: %s: Number of plugins. */
				$text = _n(
					'Update Available <span class="count">(%s)</span>',
					'Update Available <span class="count">(%s)</span>',
					$count
				);
				break;
			case 'auto-update-enabled':
				/* translators: %s: Number of plugins. */
				$text = _n(
					'Auto-updates Enabled <span class="count">(%s)</span>',
					'Auto-updates Enabled <span class="count">(%s)</span>',
					$count
				);
				break;
			case 'auto-update-disabled':
				/* translators: %s: Number of plugins. */
				$text = _n(
					'Auto-updates Disabled <span class="count">(%s)</span>',
					'Auto-updates Disabled <span class="count">(%s)</span>',
					$count
				);
				break;
		}

		if ( 'search' !== $type ) {
			$status_links[ $type ] = array(
				'url'     => add_query_arg( 'plugin_status', $type, 'plugins.php' ),
				'label'   => sprintf( $text, number_format_i18n( $count ) ),
				'current' => $type === $status,
			);
		}
	}

	return $this->get_views_links( $status_links );
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.