get( 'license' ); return $license->is_feature_available( $feature ); } /** * Resolve the capability required to use the AI/MCP integration. * * Driven by the `webcal_mcp_audience` setting: `admins` (default) requires * `manage_options`; `all` requires `webcal_can_view`, so any calendar user can * connect their own assistant. Access stays scoped either way — every tool has * its own `permission_callback` and SQL-level access filtering still applies. * * @return string A WordPress capability slug. */ function webcal_mcp_capability(): string { $audience = get_option( 'webcal_mcp_audience', 'admins' ); return ( is_scalar( $audience ) && (string) $audience === 'all' ) ? 'webcal_can_view' : 'manage_options'; } /** * Render an upgrade notice for a gated feature. * * @param string $feature Feature identifier. */ function webcal_upgrade_notice( string $feature ): void { if ( webcal_feature_available( $feature ) ) { return; } /** @var \WebCalendar\WP\License\License */ $license = Container::get_instance()->get( 'license' ); $tier = $license->get_tier(); $upgrade_url = 'https://github.com/craigk5n/webcalendar-wp/pricing'; if ( $license->is_freemius_active() ) { $fs = $license->get_freemius(); if ( $fs !== null ) { $upgrade_url = $fs->get_upgrade_url(); } } printf( '
%s %s