Plugin_Upgrader::plugin_info()

最后更新于:2021-11-25 20:39:21

Plugin_Upgrader::plugin_info()

Retrieve the path to the file that contains the plugin info.

响应

(string|false) The full path to the main plugin file, or false.

源文件

文件: gc-admin/includes/class-plugin-upgrader.php

	public function plugin_info() {
		if ( ! is_array( $this->result ) ) {
			return false;
		}
		if ( empty( $this->result['destination_name'] ) ) {
			return false;
		}

		// Ensure to pass with leading slash.
		$plugin = get_plugins( '/' . $this->result['destination_name'] );
		if ( empty( $plugin ) ) {
			return false;
		}

		// Assume the requested plugin is the first in the list.
		$pluginfiles = array_keys( $plugin );

		return $this->result['destination_name'] . '/' . $pluginfiles[0];
	}