' . esc_html__( 'Settings', '3task-doorman' ) . '' );
return $links;
}
/**
* URL of a tab.
*
* @param string $tab Tab.
* @param array $args Extra query args.
* @return string
*/
public static function url( $tab = 'overview', $args = array() ) {
return add_query_arg( array_merge( array( 'page' => self::SLUG, 'tab' => $tab ), $args ), admin_url( 'admin.php' ) );
}
/**
* The doors with label, explanation and whether an open door is a risk.
*
* @return array
*/
public static function doors() {
return array(
'users' => array( __( 'User list for guests', '3task-doorman' ), __( '/wp/v2/users lists the login names of all authors. Attackers use them to guess passwords. The block editor keeps working, it is used by logged-in users only.', '3task-doorman' ), true ),
'index' => array( __( 'Route directory for guests', '3task-doorman' ), __( '/wp-json/ and the root of every namespace list all routes, and with them most of your plugins.', '3task-doorman' ), true ),
'batch' => array( __( 'Batch endpoint for guests', '3task-doorman' ), __( '/batch/v1 runs several requests in one. In July 2026 it was the entry point of the core vulnerability wp2shell. Guests do not need it. Updates protect you, this switch is a second lock.', '3task-doorman' ), true ),
'ai_guest' => array( __( 'Hide AI access from guests', '3task-doorman' ), __( 'MCP servers and the Abilities API let AI agents work on your site. Guests never need them, logged-in agents keep their access.', '3task-doorman' ), true ),
'ai_off' => array( __( 'Switch off all AI access', '3task-doorman' ), __( 'Blocks MCP and Abilities for every machine access (application passwords and other logins). You in the browser keep access.', '3task-doorman' ), false ),
'app_readonly' => array( __( 'Application passwords: read only', '3task-doorman' ), __( 'Requests with an application password may read but not write, delete or publish. This also stops MCP tools, because they always send POST.', '3task-doorman' ), false ),
'app_passwords_off' => array( __( 'Switch off application passwords', '3task-doorman' ), __( 'Nobody can log in with an application password any more. Apps, backups or AI agents that use one stop working.', '3task-doorman' ), false ),
'xmlrpc' => array( __( 'Switch off XML-RPC', '3task-doorman' ), __( 'xmlrpc.php is an old interface, still used by some mobile apps and by Jetpack. Without them you do not need it.', '3task-doorman' ), false ),
'hide_discovery' => array( __( 'Remove REST hints from the page head', '3task-doorman' ), __( 'Removes the link to /wp-json/ from the HTML head and the Link header. The REST API itself stays available.', '3task-doorman' ), false ),
);
}
/**
* Main page.
*
* @return void
*/
public static function page() {
if ( ! current_user_can( self::CAP ) ) {
return;
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- tab selection only.
$tab = isset( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : 'overview';
$tabs = array(
'overview' => array( __( 'Overview', '3task-doorman' ), 'shield-check' ),
'namespaces' => array( __( 'Namespaces', '3task-doorman' ), 'stack-2' ),
'rules' => array( __( 'Rules', '3task-doorman' ), 'list-details' ),
'learn' => array( __( 'Learning mode', '3task-doorman' ), 'route' ),
'ai' => array( __( 'AI access', '3task-doorman' ), 'robot' ),
);
if ( ! isset( $tabs[ $tab ] ) ) {
$tab = 'overview';
}
$settings = ThreeDoor_Settings::get();
?>
define( \'THREEDOOR_DISABLE\', true );'
);
?>
ThreeDoor_Cache::state()['rest_cached'] ? __( 'Saved. The REST cache was emptied, the rules apply now.', '3task-doorman' ) : __( 'Saved. The rules apply now.', '3task-doorman' ),
'imported' => __( 'Rules of Disable REST API taken over. You can deactivate Disable REST API now.', '3task-doorman' ),
'applied' => __( 'Suggestion applied: guests now only reach the routes from the list.', '3task-doorman' ),
'reset' => __( 'Learning data deleted.', '3task-doorman' ),
'confirm' => __( 'Please confirm first that you have read the cache warning.', '3task-doorman' ),
);
if ( isset( $text[ $done ] ) ) {
$type = 'confirm' === $done ? 'warning' : 'success';
echo '