WP_Plugin_Dependencies
- Source
wp-includes/class-wp-plugin-dependencies.php:16
Core class for installing plugin dependencies.
Description
It is designed to add plugin dependencies as designated in the Requires Plugins header to a new view in the plugins install page.
Compatibility
- WordPress
- core
- 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).
Hooks and filters fired · 1
Every hook that fires from inside WP_Plugin_Dependencies, in the order it appears in the class, grouped by the method that fires it.
Properties · 10
$pluginsarrayprotected static- Holds 'get_plugins()'.
$plugin_dirnamesarrayprotected static- Holds plugin directory names to compare with cache.
$dependenciesarrayprotected static- Holds sanitized plugin dependency slugs.
$dependency_slugsarrayprotected static- Holds an array of sanitized plugin dependency slugs.
$dependent_slugsarrayprotected static- Holds an array of dependent plugin slugs.
$dependency_api_dataarrayprotected static- Holds 'plugins_api()' data for plugin dependencies.
$dependency_filepathsstring[]protected static- Holds plugin dependency filepaths, relative to the plugins directory.
$circular_dependencies_pairsarray[]protected static- An array of circular dependency pairings.
$circular_dependencies_slugsstring[]protected static- An array of circular dependency slugs.
$initializedboolprotected static- Whether Plugin Dependencies have been initialized.
Methods · 25
- initialize()Initializes by fetching plugin header and plugin API data.
- has_dependents()Determines whether the plugin has plugins that depend on it.
- has_dependencies()Determines whether the plugin has plugin dependencies.
- has_active_dependents()Determines whether the plugin has active dependents.
- get_dependents()Gets filepaths of plugins that require the dependency.
- get_dependencies()Gets the slugs of plugins that the dependent requires.
- get_dependent_filepath()Gets a dependent plugin's filepath.
- has_unmet_dependencies()Determines whether the plugin has unmet dependencies.
- has_circular_dependency()Determines whether the plugin has a circular dependency.
- get_dependent_names()Gets the names of plugins that require the plugin.
- get_dependency_names()Gets the names of plugins required by the plugin.
- get_dependency_filepath()Gets the filepath for a dependency, relative to the plugin's directory.
- get_dependency_data()Returns API data for the dependency.
- display_admin_notice_for_unmet_dependencies()Displays an admin notice if dependencies are not installed.
- display_admin_notice_for_circular_dependencies()Displays an admin notice if circular dependencies are installed.
- check_plugin_dependencies_during_ajax()Checks plugin dependencies after a plugin is installed via AJAX.
- get_plugins()Gets data for installed plugins.
- read_dependencies_from_plugin_headers()Reads and stores dependency slugs from a plugin's 'Requires Plugins' header.
- sanitize_dependency_slugs()Sanitizes slugs.
- get_dependency_filepaths()Gets the filepath of installed dependencies.
- get_dependency_api_data()Retrieves and stores dependency plugin data from the WordPress.org Plugin API.
- get_plugin_dirnames()Gets plugin directory names.
- get_circular_dependencies()Gets circular dependency data.
- check_for_circular_dependencies()Checks for circular dependencies.
- convert_to_slug()Converts a plugin filepath to a slug.
Source code
class WP_Plugin_Dependencies { /** * Holds 'get_plugins()'. * * @since 6.5.0 * * @var array */ protected static $plugins; /** * Holds plugin directory names to compare with cache. * * @since 6.5.0 * * @var array */ protected static $plugin_dirnames; /** * Holds sanitized plugin dependency slugs. * * Keyed on the dependent plugin's filepath, * relative to the plugins directory. * * @since 6.5.0 * * @var array */ protected static $dependencies; /** * Holds an array of sanitized plugin dependency slugs. * * @since 6.5.0 * * @var array */ protected static $dependency_slugs; /** * Holds an array of dependent plugin slugs. * * Keyed on the dependent plugin's filepath, * relative to the plugins directory. * * @since 6.5.0 * * @var array */ protected static $dependent_slugs; /** * Holds 'plugins_api()' data for plugin dependencies. * * @since 6.5.0 * * @var array */ protected static $dependency_api_data; /** * Holds plugin dependency filepaths, relative to the plugins directory. * * Keyed on the dependency's slug. * * @since 6.5.0 * * @var string[] */ protected static $dependency_filepaths; /** * An array of circular dependency pairings. * * @since 6.5.0 * * @var array[] */Changelog
Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/class-wp-plugin-dependencies.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.