builder = $builder; } public function register(): void { add_management_page( __( 'IntelliLanz', 'intellilanz' ), __( 'IntelliLanz', 'intellilanz' ), 'manage_options', 'intellilanz', array( $this, 'render' ) ); } public function enqueueAssets( string $hook ): void { if ( $hook !== 'tools_page_intellilanz' || ! current_user_can( 'manage_options' ) ) { return; } $plugin_file = dirname( __DIR__, 2 ) . '/intellilanz.php'; wp_enqueue_style( 'intellilanz-admin', plugins_url( 'assets/admin.css', $plugin_file ), array(), \MazlanHalim\IntelliLanz\Plugin::VERSION ); wp_enqueue_script( 'intellilanz-dashboard', plugins_url( 'assets/admin-dashboard.js', $plugin_file ), array(), \MazlanHalim\IntelliLanz\Plugin::VERSION, true ); wp_localize_script( 'intellilanz-dashboard', 'intelliLanz', array( 'restUrl' => esc_url_raw( rest_url( 'intellilanz/v1/graph?display=1' ) ), 'analysisUrl' => esc_url_raw( rest_url( 'intellilanz/v1/analysis' ) ), 'runAnalysisUrl' => esc_url_raw( rest_url( 'intellilanz/v1/analysis/run' ) ), 'cleanupPluginUrl' => esc_url_raw( rest_url( 'intellilanz/v1/cleanup/plugin' ) ), 'cleanupThemeUrl' => esc_url_raw( rest_url( 'intellilanz/v1/cleanup/theme' ) ), 'connectionsUrl' => esc_url_raw( rest_url( 'intellilanz/v1/graph/connections' ) ), 'acknowledgementUrl' => esc_url_raw( rest_url( 'intellilanz/v1/acknowledge' ) ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'adminUrl' => esc_url_raw( admin_url() ), 'canDeletePlugins' => current_user_can( 'manage_options' ) && current_user_can( 'delete_plugins' ) && wp_is_file_mod_allowed( 'intellilanz_cleanup' ), 'canDeleteThemes' => current_user_can( 'manage_options' ) && current_user_can( 'delete_themes' ) && wp_is_file_mod_allowed( 'intellilanz_cleanup' ), ) ); } public function render(): void { if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'You cannot access this graph.', 'intellilanz' ), '', array( 'response' => 403 ) ); return; } $plan = apply_filters( 'intellilanz_plan_badge', null ); $plan = is_array( $plan ) && ! empty( $plan['label'] ) ? array( 'label' => sanitize_text_field( (string) $plan['label'] ), 'variant' => in_array( $plan['variant'] ?? '', array( 'pro', 'free' ), true ) ? $plan['variant'] : 'free' ) : null; echo '
' . esc_html__( 'Understand the site’s health at a glance, then explore the technical detail when needed.', 'intellilanz' ) . '
' . esc_html__( 'Review infrastructure, subsystems and their components in plain language.', 'intellilanz' ) . '
' . esc_html__( 'Inspect the complete administrator-only component inventory.', 'intellilanz' ) . '
' . esc_html__( 'The Free edition remains fully usable for interactive site analysis. Pro adds portable reporting and notifications.', 'intellilanz' ) . '
| ' . esc_html__( 'Feature', 'intellilanz' ) . ' | ' . esc_html__( 'Free', 'intellilanz' ) . ' | ' . esc_html__( 'Pro', 'intellilanz' ) . ' |
|---|---|---|
| ' . esc_html( $row[0] ) . ' | '; if ( $row[1] ) { echo '✓ ' . esc_html__( 'Included', 'intellilanz' ) . ''; } else { echo '— ' . esc_html__( 'Not included', 'intellilanz' ) . ''; } echo ' | ✓ ' . esc_html__( 'Included', 'intellilanz' ) . ' |