'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(); ?>