This commit is contained in:
Javier Casares 2026-06-08 18:01:39 +00:00
commit b6a55a7f04
27 changed files with 2221 additions and 45 deletions

View file

@ -118,6 +118,20 @@ class Plugin {
* @return void
*/
public function register_admin_pages(): void {
// In central mode, replace the full admin UI with a placeholder notice.
if ( is_multisite() && 'central' === get_site_option( 'robotstxt_mediaaudit_network_mode', 'per_site' ) ) {
add_menu_page(
__( 'Media Audit', 'robotstxt-mediaaudit' ),
__( 'Media Audit', 'robotstxt-mediaaudit' ),
'edit_others_posts',
'robotstxt-mediaaudit',
array( $this, 'render_central_mode_notice' ),
'dashicons-camera',
11
);
return;
}
$suffix = add_menu_page(
__( 'Media Audit', 'robotstxt-mediaaudit' ),
__( 'Media Audit', 'robotstxt-mediaaudit' ),
@ -233,8 +247,7 @@ class Plugin {
* @return bool
*/
private function is_provider_configured( string $slug ): bool {
$raw = get_option( Settings::OPTION_NAME, array() );
$opts = is_array( $raw ) ? $raw : array();
$opts = Settings::get_effective_settings();
if ( 'picdefense' === $slug ) {
$uid = $opts['picdefense_user_id'] ?? '';
@ -245,6 +258,33 @@ class Plugin {
return false;
}
/**
* Renders the central-mode placeholder shown on each site's admin pages.
*
* Replaces the full per-site admin UI when the network is operating in
* central mode, directing users to the network admin panel instead.
*
* @return void
*/
public function render_central_mode_notice(): void {
$network_url = network_admin_url( 'admin.php?page=robotstxt-mediaaudit-network' );
?>
<div class="wrap">
<h1><?php esc_html_e( 'Media Audit', 'robotstxt-mediaaudit' ); ?></h1>
<div class="notice notice-info" style="margin-top:1em;">
<p>
<?php esc_html_e( 'This plugin is managed at the network level. Media data for this site is collected and stored here, but viewed and managed from the Network Admin panel.', 'robotstxt-mediaaudit' ); ?>
</p>
<p>
<a href="<?php echo esc_url( $network_url ); ?>" class="button button-primary">
<?php esc_html_e( 'Go to Network Media Audit →', 'robotstxt-mediaaudit' ); ?>
</a>
</p>
</div>
</div>
<?php
}
/**
* Registers WP-CLI commands when running in CLI context.
*