$widget ), $dashboard ); } } /** * Enqueue widget assets only on the dashboard page. * * @param string $hook_suffix The current admin page hook. */ public function enqueue_assets( $hook_suffix ) { if ( 'index.php' !== $hook_suffix ) { return; } if ( ! current_user_can( 'manage_options' ) ) { return; } $options = CookieFrame::get_options(); if ( empty( $options['domain_id'] ) ) { return; } wp_enqueue_style( 'cookieframe-admin', COOKIEFRAME_PLUGIN_URL . 'assets/css/admin.css', array(), COOKIEFRAME_VERSION ); wp_enqueue_script( 'cookieframe-dashboard', COOKIEFRAME_PLUGIN_URL . 'assets/js/dashboard-widget.js', array( 'jquery' ), COOKIEFRAME_VERSION, true ); wp_localize_script( 'cookieframe-dashboard', 'cookieframeDashboard', array( 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'cookieframe_admin_nonce' ), 'hasApiKey' => ! empty( CookieFrame::get_api_key() ), 'settingsUrl' => admin_url( 'options-general.php?page=cookieframe' ), 'dashboardUrl' => COOKIEFRAME_API_URL . '/app', 'i18n' => array( 'cookies' => __( 'Cookies', 'cookieframe' ), 'categories' => __( 'Categories', 'cookieframe' ), 'consents' => __( 'Consents', 'cookieframe' ), 'lastScan' => __( 'Last Scan', 'cookieframe' ), 'noData' => __( 'No data yet', 'cookieframe' ), 'uncategorized' => __( 'uncategorized', 'cookieframe' ), 'consentRate' => __( 'Consent Rate', 'cookieframe' ), 'acceptAll' => __( 'Accept All', 'cookieframe' ), 'rejectAll' => __( 'Reject All', 'cookieframe' ), 'visitors' => __( 'visitors', 'cookieframe' ), 'compliance' => __( 'Compliance Health', 'cookieframe' ), 'outOf100' => __( 'out of 100', 'cookieframe' ), 'last30Days' => __( 'Last 30 days', 'cookieframe' ), 'settings' => __( 'Manage Settings', 'cookieframe' ), 'dashboard' => __( 'Open Dashboard', 'cookieframe' ), 'installed' => __( 'Connected', 'cookieframe' ), 'notInstalled' => __( 'Not installed', 'cookieframe' ), 'unreachable' => __( 'Unreachable', 'cookieframe' ), 'pendingVerification' => __( 'Pending', 'cookieframe' ), 'installationError' => __( 'Error', 'cookieframe' ), 'bannerActive' => __( 'Active', 'cookieframe' ), 'bannerDisabled' => __( 'Disabled', 'cookieframe' ), ), ) ); } /** * Render the dashboard widget HTML. */ public function render_widget() { ?>
0
—
—
—
—