'WPForms', 'slug' => 'wpforms-lite', 'description' => __( 'The most beginner-friendly WordPress form plugin.', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), 'icon' => 'wpforms.png', ], [ 'name' => 'WP Mail SMTP', 'slug' => 'wp-mail-smtp', 'description' => __( 'Fix email deliverability issues for WordPress.', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), 'icon' => 'wp-mail-smtp.png', ], [ 'name' => 'MonsterInsights', 'slug' => 'google-analytics-for-wordpress', 'description' => __( 'The best Google Analytics plugin for WordPress.', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), 'icon' => 'monsterinsights.png', ], [ 'name' => 'All in One SEO', 'slug' => 'all-in-one-seo-pack', 'description' => __( 'The best WordPress SEO plugin and toolkit.', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), 'icon' => 'all-in-one-seo.png', ], [ 'name' => 'OptinMonster', 'slug' => 'optinmonster', 'description' => __( 'Powerful lead generation and conversion optimization.', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), 'icon' => 'optinmonster.png', ], [ 'name' => 'SeedProd', 'slug' => 'coming-soon', 'description' => __( 'The best drag-and-drop landing page builder.', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), 'icon' => 'seedprod.png', ], ]; } /** * Get Quick Access links for the sidebar. * * Returned from a method instead of a constant so labels are translatable. * * @since 1.1.0 * * @return array[] */ private function get_quick_access_links(): array { $locale = get_locale(); return [ [ 'label' => __( 'Getting Started', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), 'url' => 'https://activelayer.com/docs/wordpress-plugin/?utm_campaign=plugin&utm_source=WordPress&utm_medium=dashboard_quick_access&utm_content=getting_started&utm_locale=' . $locale, 'icon' => 'dashicons-book', ], [ 'label' => __( 'API Documentation', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), 'url' => 'https://activelayer.com/docs/api/?utm_campaign=plugin&utm_source=WordPress&utm_medium=dashboard_quick_access&utm_content=api_docs&utm_locale=' . $locale, 'icon' => 'dashicons-media-code', ], [ 'label' => __( 'Support', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), 'url' => 'https://activelayer.com/contact/?utm_campaign=plugin&utm_source=WordPress&utm_medium=dashboard_quick_access&utm_content=support&utm_locale=' . $locale, 'icon' => 'dashicons-sos', ], [ 'label' => __( 'Account Dashboard', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), 'url' => 'https://app.activelayer.com/?utm_campaign=plugin&utm_source=WordPress&utm_medium=dashboard_quick_access&utm_content=account_dashboard&utm_locale=' . $locale, 'icon' => 'dashicons-admin-users', ], [ 'label' => __( 'ActiveLayer Status', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), 'url' => 'https://status.activelayer.com/', 'icon' => 'dashicons-heart', ], ]; } /** * Get Upgrade to Pro feature list. * * Returned from a method instead of a constant so strings are translatable. * * @since 1.1.0 * * @return string[] */ private function get_pro_features(): array { return [ __( '25,000 checks/month', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), __( 'Full API access', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), __( 'Email support', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), __( 'Unlimited sites', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), __( 'Priority queue', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), __( 'Advanced analytics', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), ]; } /** * Enqueue chart assets for the dashboard page. * * @since 1.1.0 * * @param string $hook Current admin page hook suffix. */ public function enqueue_chart_assets( string $hook ): void { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh if ( strpos( $hook, 'activelayer-dashboard' ) === false ) { return; } $suffix = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'activelayer-dash-widget', ACTIVELAYER_PLUGIN_URL . 'assets/js/dashboard-widget' . $suffix . '.js', [], ACTIVELAYER_PLUGIN_VERSION, true ); $daily = Storage::get_instance()->get_daily_counts( DashboardWidget::DEFAULT_DAYS ); $stats = Storage::get_instance()->get_queue_stats(); wp_localize_script( 'activelayer-dash-widget', 'activelayerDashWidget', [ 'daily' => $daily, 'stats' => [ 'total' => $stats['total'] ?? 0, 'clean' => $stats['clean'] ?? 0, 'spam' => $stats['spam'] ?? 0, 'failed' => $stats['failed'] ?? 0, ], 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( DashboardWidget::NONCE_ACTION ), ] ); } /** * Render the dashboard page. * * @since 1.1.0 * @since 1.8.0 Include local observations separately from spam-check analytics. */ public function render(): void { $has_api_key = SettingsHelper::has_api_key(); ?>

render_onboarding_banner(); ?>
dashboard(); $this->render_stats_section(); $this->render_integrations_overview( $has_api_key ); $this->render_upgrade_banner(); ?>
render_cross_promote(); $this->render_quick_access(); ?>
get_queue_stats(); $total = (int) ( $stats['total'] ?? 0 ); $spam = (int) ( $stats['spam'] ?? 0 ); $clean = (int) ( $stats['clean'] ?? 0 ); $spam_pct = $total > 0 ? round( ( $spam / $total ) * 100, 1 ) : 0; $clean_pct = $total > 0 ? round( ( $clean / $total ) * 100, 1 ) : 0; ?>
render_stat_card( esc_html__( 'Total Requests', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), $total, '', 'total' ); $this->render_stat_card( esc_html__( 'Spam', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), $spam, $total > 0 ? sprintf( '%s%%', number_format_i18n( $spam_pct, 1 ) ) : '', 'spam' ); $this->render_stat_card( esc_html__( 'Clean', 'activelayer-anti-spam-spam-protection-for-forms-comments' ), $clean, $total > 0 ? sprintf( '%s%%', number_format_i18n( $clean_pct, 1 ) ) : '', 'clean' ); ?>
render(); } /** * Render the integrations overview widget. * * Shows a compact list of available integrations with their status * and links to the Integrations page for configuration. * * @since 1.1.0 * @since 1.3.0 Added BuddyPress icon mapping. * @since 1.3.0 Added BuddyBoss icon mapping (assets/images/icons/BuddyBoss.png). * @since 1.4.0 Added AffiliateWP icon mapping (assets/images/icons/AffiliateWP.png). * @since 1.4.0 Added MemberPress and WS Form icon mappings. * @since 1.8.0 Added the CubeWP Forms icon. * * @param bool $has_api_key Whether an API key is configured. */ private function render_integrations_overview( bool $has_api_key ): void { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh, Generic.Metrics.CyclomaticComplexity.MaxExceeded $registry = IntegrationRegistry::get_instance(); $status = $registry->get_status(); $integrations = $status['integrations'] ?? []; $integrations_page_url = admin_url( 'admin.php?page=activelayer-integrations' ); // Icon map matching IntegrationsPage. $icon_map = [ 'WP Comments' => 'WPComments.png', 'WooCommerce' => 'WooCommerceReviews.png', 'WPForms' => 'WPF.png', 'Contact Form 7' => 'contactform7.png', 'Ninja Forms' => 'NinjaForms.png', 'Formidable Forms' => 'FormiForms.png', 'Forminator' => 'Forminator.png', 'Fluent Forms' => 'FluentForms.png', 'SureForms' => 'SureForms.png', 'CubeWP Forms' => 'CubeWPForms.gif', 'Gravity Forms' => 'GravityForms.png', 'Elementor Forms' => 'ElementorForms.png', 'BuddyPress' => 'BuddyPress.png', 'BuddyBoss' => 'BuddyBoss.png', 'AffiliateWP' => 'AffiliateWP.png', 'MemberPress' => 'MemberPress.png', 'WS Form' => 'WSForm.png', ]; ?>

<?php echo esc_attr( $name ); ?>

→
get_sister_plugins() as $plugin ) { if ( $shown >= self::CROSS_PROMOTE_MAX ) { break; } $is_installed = false; $is_active = false; // Check every known variant (e.g. WPForms Lite and WPForms Pro). foreach ( PluginInstaller::get_plugin_files( $plugin['slug'] ) as $plugin_file ) { $is_installed = $is_installed || $this->is_plugin_installed( $plugin_file, $all_plugins ); $is_active = $is_active || is_plugin_active( $plugin_file ); } $icon_url = $plugin_url . 'assets/images/icons/plugins/' . $plugin['icon']; ob_start(); ?>
<?php echo esc_attr( $plugin['name'] ); ?>

get_quick_access_links() as $link ) : ?>