Automator_System_Report::format_plugin_data( string $plugin, array $data )

Format plugin data, including data on updates, into a standard format.


Parameters Parameters

$plugin

(string) (Required) Plugin directory/file.

$data

(array) (Required) Plugin data from WP.


Top ↑

Return Return

(array) Formatted data.


Source Source

File: src/core/lib/utilities/class-automator-system-report.php

	protected function format_plugin_data( $plugin, $data ) {
		require_once ABSPATH . 'wp-admin/includes/update.php';

		if ( ! function_exists( 'get_plugin_updates' ) ) {
			return array();
		}

		// Use WP API to lookup latest updates for plugins. Automator_Helper injects updates for premium plugins.
		if ( empty( $this->available_updates ) ) {
			$this->available_updates = get_plugin_updates();
		}

		$version_latest = $data['Version'];

		// Find latest version.
		if ( isset( $this->available_updates[ $plugin ]->update->new_version ) ) {
			$version_latest = $this->available_updates[ $plugin ]->update->new_version;
		}

		return array(
			'plugin'            => $plugin,
			'name'              => $data['Name'],
			'version'           => $data['Version'],
			'version_latest'    => $version_latest,
			'url'               => $data['PluginURI'],
			'author_name'       => $data['AuthorName'],
			'author_url'        => esc_url_raw( $data['AuthorURI'] ),
			'network_activated' => $data['Network'],
		);
	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.6.0 Introduced.