v1.6.3
This commit is contained in:
parent
3e4433cd13
commit
511d2fefae
1 changed files with 103 additions and 50 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue