This commit is contained in:
Javier Casares 2026-08-24 08:18:14 +00:00
commit 511d2fefae

View file

@ -20,11 +20,6 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
class Manager_Notice {
/**
* Basename of the Manager plugin main file.
*/
private const MANAGER_BASENAME = 'robotstxt-manager/robotstxt-manager.php';
/**
* URL of the Manager plugin page.
*/
@ -56,16 +51,35 @@ class Manager_Notice {
/**
* Whether the Manager (by ROBOTSTXT) plugin is active.
*
* Uses the ecosystem presence constant (Manager 1.6.2+) and falls back
* to a plugin-list scan for older Manager versions.
*
* @since 1.6.2
*
* @return bool True when the manager plugin is active.
* @return bool True when the Manager plugin is present and activated.
*/
public static function is_manager_active(): bool {
if ( ! function_exists( 'is_plugin_active' ) ) {
if ( defined( 'ROBOTSTXT_MANAGER_NOTICED' ) && ROBOTSTXT_MANAGER_NOTICED ) {
return true;
}
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
return is_plugin_active( self::MANAGER_BASENAME );
foreach ( get_plugins() as $file => $data ) {
$slug = dirname( $file );
if ( '.' === $slug ) {
$slug = basename( $file, '.php' );
}
if ( 'robotstxt-manager' === $slug ) {
return is_plugin_active( $file );
}
}
return false;
}
/**