auto-patch 638-dev-dev01-2024-05-14T20_44_36
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
* @package WPSEO\Plugin_Availability
|
||||
*/
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Conditional;
|
||||
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
|
||||
|
||||
/**
|
||||
* Class WPSEO_Plugin_Availability
|
||||
*/
|
||||
@@ -88,7 +91,8 @@ class WPSEO_Plugin_Availability {
|
||||
),
|
||||
'_dependencies' => [
|
||||
'WooCommerce' => [
|
||||
'slug' => 'woocommerce/woocommerce.php',
|
||||
'slug' => 'woocommerce/woocommerce.php', // Kept for backwards compatibility, in case external code uses get_dependencies(). Deprecated in 22.4.
|
||||
'conditional' => new WooCommerce_Conditional(),
|
||||
],
|
||||
],
|
||||
'installed' => false,
|
||||
@@ -208,10 +212,10 @@ class WPSEO_Plugin_Availability {
|
||||
return true;
|
||||
}
|
||||
|
||||
$dependencies = $this->get_dependencies( $plugin );
|
||||
$installed_dependencies = array_filter( $dependencies, [ $this, 'is_dependency_available' ] );
|
||||
$dependencies = $this->get_dependencies( $plugin );
|
||||
$active_dependencies = array_filter( $dependencies, [ $this, 'is_dependency_active' ] );
|
||||
|
||||
return count( $installed_dependencies ) === count( $dependencies );
|
||||
return count( $active_dependencies ) === count( $dependencies );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,14 +261,30 @@ class WPSEO_Plugin_Availability {
|
||||
return isset( $plugin['installed'] ) && $plugin['installed'] === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a dependency is active.
|
||||
*
|
||||
* @param array<string, Conditional> $dependency The information about the dependency to look for.
|
||||
*
|
||||
* @return bool Whether or not the dependency is active.
|
||||
*/
|
||||
public function is_dependency_active( $dependency ) {
|
||||
return $dependency['conditional']->is_met();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a dependency is available.
|
||||
*
|
||||
* @deprecated 22.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param array $dependency The information about the dependency to look for.
|
||||
*
|
||||
* @return bool Whether or not the dependency is available.
|
||||
*/
|
||||
public function is_dependency_available( $dependency ) {
|
||||
_deprecated_function( __METHOD__, 'Yoast SEO 22.4' );
|
||||
|
||||
return isset( get_plugins()[ $dependency['slug'] ] );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user