v1.2.2
This commit is contained in:
parent
b9029e62fe
commit
9cd3bb6cb2
11 changed files with 69 additions and 61 deletions
|
|
@ -25,14 +25,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
*/
|
||||
class Robotstxt_OG_Manager_Notice {
|
||||
|
||||
/**
|
||||
* Basename of the Manager (by ROBOTSTXT) plugin.
|
||||
*
|
||||
* @since 1.2.1
|
||||
* @var string
|
||||
*/
|
||||
const MANAGER_BASENAME = 'robotstxt-manager/robotstxt-manager.php';
|
||||
|
||||
/**
|
||||
* Query argument used to dismiss the notice.
|
||||
*
|
||||
|
|
@ -66,14 +58,38 @@ class Robotstxt_OG_Manager_Notice {
|
|||
const MANAGER_URL = 'https://www.robotstxt.software/plugins/robotstxt-manager/';
|
||||
|
||||
/**
|
||||
* Whether the Manager (by ROBOTSTXT) plugin is installed and active.
|
||||
* Returns whether Manager (by ROBOTSTXT) is installed and active.
|
||||
*
|
||||
* @since 1.2.1
|
||||
* Uses the ecosystem presence constant (Manager 1.6.2+) and falls back
|
||||
* to a plugin-list scan for older Manager versions.
|
||||
*
|
||||
* @return bool True if the Manager plugin is active.
|
||||
* @since 1.2.1 Introduced as a basename is_plugin_active() check.
|
||||
* @since 1.2.2 Constant check first; plugin-list scan only as fallback.
|
||||
*
|
||||
* @return bool True when Manager is present and activated.
|
||||
*/
|
||||
public static function is_manager_active(): bool {
|
||||
return is_plugin_active( self::MANAGER_BASENAME );
|
||||
if ( defined( 'ROBOTSTXT_MANAGER_NOTICED' ) && ROBOTSTXT_MANAGER_NOTICED ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'get_plugins' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
}
|
||||
|
||||
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