W3cubDocs

/WordPress

WP_Plugin_Dependencies::get_dependency_filepaths(): array

Gets the filepath of installed dependencies.

Description

If a dependency is not installed, the filepath defaults to false.

Return

array An array of install dependencies filepaths, relative to the plugins directory.

Source

protected static function get_dependency_filepaths() {
	if ( is_array( self::$dependency_filepaths ) ) {
		return self::$dependency_filepaths;
	}

	if ( null === self::$dependency_slugs ) {
		return array();
	}

	self::$dependency_filepaths = array();

	$plugin_dirnames = self::get_plugin_dirnames();
	foreach ( self::$dependency_slugs as $slug ) {
		if ( isset( $plugin_dirnames[ $slug ] ) ) {
			self::$dependency_filepaths[ $slug ] = $plugin_dirnames[ $slug ];
			continue;
		}

		self::$dependency_filepaths[ $slug ] = false;
	}

	return self::$dependency_filepaths;
}

Changelog

Version Description
6.5.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_plugin_dependencies/get_dependency_filepaths