This commit is contained in:
Javier Casares 2026-08-24 11:42:10 +00:00
commit 80a2202d6e
18 changed files with 305 additions and 122 deletions

View file

@ -3,7 +3,7 @@
* Plugin Name: Documentation Markdown (by ROBOTSTXT)
* Plugin URI: https://www.robotstxt.software/plugins/robotstxt-documentation-markdown/
* Description: Synchronizes Markdown documentation from GitHub repositories to WordPress pages and posts automatically.
* Version: 1.2.1
* Version: 1.2.2
* Requires at least: 4.2
* Requires PHP: 8.0
* Security: robotstxt@robotstxt.es
@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
// Define plugin constants.
define( 'ROBOTSTXT_DOCMD_VERSION', '1.2.1' );
define( 'ROBOTSTXT_DOCMD_VERSION', '1.2.2' );
define( 'ROBOTSTXT_DOCMD_PLUGIN_FILE', __FILE__ );
define( 'ROBOTSTXT_DOCMD_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'ROBOTSTXT_DOCMD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
@ -1676,17 +1676,41 @@ function robotstxt_docmd_debug_fix_crons() {
}
/**
* Check whether the Manager (by ROBOTSTXT) plugin is active
* Check whether the Manager (by ROBOTSTXT) plugin is installed and active
*
* Updates for this plugin are delivered through the Manager plugin. This
* helper detects whether it is installed and active.
* helper detects whether it is installed and active: it uses the ecosystem
* presence constant (Manager 1.6.2+) and falls back to a plugin-list scan
* for older Manager versions.
*
* @since 1.2.1
* @since 1.2.2 Switched to the ROBOTSTXT_MANAGER_NOTICED presence constant
* with a plugin-list scan fallback for Manager < 1.6.2.
*
* @return bool True if Manager (by ROBOTSTXT) is active, false otherwise.
*/
function robotstxt_docmd_is_manager_active(): bool {
return defined( 'ROBOTSTXT_MANAGER_VERSION' );
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;
}
/**