register(); add_filter( 'wpat_debug_config', array( $this, 'script_config' ) ); add_filter( 'wpat_debug_allowed', array( $this, 'grant_access' ) ); } /** * Tell the capture script where to ask about access. * * @param array|null $config Existing configuration. * @return array */ public function script_config( ?array $config ): array { return array( 'endpoint' => DebugAccess::url(), 'labels' => Channels::labels(), ); } /** * Administrators always qualify. Everyone else only when the site opted in, * which keeps the panel away from normal visitors by default. * * @param bool $allowed Whether access has already been granted. */ public function grant_access( bool $allowed ): bool { return $allowed || current_user_can( 'manage_options' ) || (bool) Settings::get( 'public_debug' ); } }