> $log_entries Recent failures, newest first. * @var bool $is_connected Whether server-side calls are possible. * @var array $roles Site roles, slug => display name. * @var array> $excluded Excluded posts, each with id, title and type. * @var bool $can_edit_code Whether this user may edit the raw code fields. * @var string $reset_action admin-post action that restores defaults. * @var string $mode "simple" or "advanced". * @var string $mode_action admin-post action that switches the mode. * @var string $mode_field Form field telling the sanitizer which mode drew the form. * @var string $logo_url URL of the AdPix mark. * @var string $version Plugin version. */ defined( 'ABSPATH' ) || exit; // Simple mode leaves out what most sites never touch. The sanitizer keeps those values as they were // when a simple form is saved, so switching modes never changes a setting by itself. $adpix_advanced = 'advanced' === $mode; /* * Tab labels are declared once and read twice - by the tab strip and by the heading of the panel it * opens - so a button and its section cannot drift apart. */ $adpix_tabs = array( 'connection' => array( 'label' => __( 'Connection', 'adpix-analytics' ), 'icon' => 'dashicons-admin-links', ), 'measure' => array( 'label' => __( 'What to measure', 'adpix-analytics' ), 'icon' => 'dashicons-chart-bar', ), 'tag' => array( 'label' => __( 'Page tag', 'adpix-analytics' ), 'icon' => 'dashicons-media-code', ), 'code' => array( 'label' => __( 'Custom code', 'adpix-analytics' ), 'icon' => 'dashicons-editor-code', ), 'privacy' => array( 'label' => __( 'Privacy', 'adpix-analytics' ), 'icon' => 'dashicons-privacy', ), 'advanced' => array( 'label' => __( 'Advanced', 'adpix-analytics' ), 'icon' => 'dashicons-admin-generic', ), ); if ( ! $adpix_advanced ) { unset( $adpix_tabs['code'] ); } ?>

_x( 'Simple', 'settings screen mode', 'adpix-analytics' ), 'advanced' => _x( 'Advanced', 'settings screen mode', 'adpix-analytics' ), ); ?> $adpix_mode_label ) : ?>

$adpix_tab ) : ?>

render( 'fields/text', array( 'option_name' => $option_name, 'name' => 'measurement_id', 'label' => __( 'Measurement ID', 'adpix-analytics' ), 'value' => $settings->str( 'measurement_id' ), 'type' => 'text', 'placeholder' => 'AP-XXXXXXXX', 'description' => __( 'Public. This is the only credential that appears in the page source.', 'adpix-analytics' ), 'locked' => $settings->is_locked( 'measurement_id' ), ) ); $this->render( 'fields/text', array( 'option_name' => $option_name, 'name' => 'property_id', 'label' => __( 'Property ID', 'adpix-analytics' ), 'value' => $settings->str( 'property_id' ), 'type' => 'text', 'placeholder' => '', 'description' => __( 'Identifies this property on server-to-server calls and on the Site statistics screen. It is the long ID after /properties/ in the Quickstart example under Admin → API & MCP → REST API.', 'adpix-analytics' ), 'locked' => $settings->is_locked( 'property_id' ), ) ); $this->render( 'fields/secret', array( 'option_name' => $option_name, 'name' => 'server_key', 'label' => __( 'Server key', 'adpix-analytics' ), 'masked' => $masked_key, 'placeholder' => 'sk_…', 'description' => __( 'Secret. It can write to your whole property, so it is never sent to the browser - and it is safest of all in wp-config.php, where no database backup can carry it.', 'adpix-analytics' ), 'locked' => $settings->is_locked( 'server_key' ), ) ); if ( $adpix_advanced ) { $this->render( 'fields/checkbox', array( 'option_name' => $option_name, 'name' => 'use_hmac', 'label' => __( 'Sign requests', 'adpix-analytics' ), 'text' => __( 'Sign every server-to-server request', 'adpix-analytics' ), 'checked' => $settings->flag( 'use_hmac' ), 'description' => __( 'Required on properties configured to reject unsigned requests. Harmless everywhere else.', 'adpix-analytics' ), ) ); $this->render( 'fields/checkbox', array( 'option_name' => $option_name, 'name' => 'force_ssl', 'label' => __( 'Force SSL', 'adpix-analytics' ), 'text' => __( 'Always contact AdPix over HTTPS', 'adpix-analytics' ), 'checked' => $settings->flag( 'force_ssl' ), 'description' => __( 'The AdPix addresses are always https. This only upgrades an address set in wp-config.php for a self-hosted AdPix.', 'adpix-analytics' ), ) ); } $this->render( 'fields/reporting', array( 'ready' => $settings->can_report(), 'has_token' => '' !== $masked_token, 'stats_url' => $stats_url, ) ); $this->render( 'fields/secret', array( 'option_name' => $option_name, 'name' => 'api_token', 'label' => __( 'API token', 'adpix-analytics' ), 'masked' => $masked_token, 'placeholder' => 'adpx_live_…', 'description' => __( 'Starts with adpx_live_. It can only read reports, so it is far less risky to lose than the server key.', 'adpix-analytics' ), 'locked' => $settings->is_locked( 'api_token' ), ) ); ?>

'button button-secondary adpix-reset-submit' ) ); ?>

0 ) { echo esc_html( sprintf( /* translators: %s: human-readable time difference, e.g. "2 hours". */ __( '%s ago', 'adpix-analytics' ), human_time_diff( $adpix_time ) ) ); } else { echo '—'; } ?> $adpix_value ) { $adpix_pairs[] = $adpix_key . '=' . $adpix_value; } echo esc_html( implode( ' ', $adpix_pairs ) ); ?>