__( 'Accept all', 'ai-eshop-optimizer' ), 'decline' => __( 'Decline', 'ai-eshop-optimizer' ), 'customize' => __( 'Customize', 'ai-eshop-optimizer' ), ); $cat_labels = array( 'necessary' => __( 'Strictly necessary', 'ai-eshop-optimizer' ), 'functional' => __( 'Functional', 'ai-eshop-optimizer' ), 'analytics' => __( 'Analytics', 'ai-eshop-optimizer' ), 'marketing' => __( 'Marketing', 'ai-eshop-optimizer' ), 'unclassified' => __( 'Unclassified', 'ai-eshop-optimizer' ), ); ?> $aieo_cmp_id( $name ), 'label' => $label, 'control' => $control, ); if ( '' !== $help ) { $field['help'] = $help; } return \Rooster\Admin\Ui::field_row( $extra + $field ); }; $aieo_cmp_switch = static function ( $name, $on, $label ) use ( $aieo_cmp_id ) { return \Rooster\Admin\Ui::toggle( $name, (bool) $on, array( 'id' => $aieo_cmp_id( $name ), 'hidden' => false, 'label' => $label, ) ); }; $aieo_cmp_color = static function ( $name, $label ) use ( $s, $aieo_cmp_id, $aieo_cmp_row ) { $val = isset( $s[ $name ] ) ? (string) $s[ $name ] : ''; return $aieo_cmp_row( $name, $label, \Rooster\Admin\Fields::color( $name, $val, array( 'id' => $aieo_cmp_id( $name ), 'alpha' => true, 'default' => $val ) ) ); }; $aieo_cmp_card = static function ( $anchor, $icon, $title, $description, $fields, $opts = array() ) use ( $aieo_cmp_out ) { $form_id = 'aieo-card-' . $anchor . '-form'; $before = isset( $opts['before'] ) ? (string) $opts['before'] : ''; unset( $opts['before'] ); $card = array( 'anchor' => $anchor, 'icon' => $icon, 'title' => $title, 'footer' => \Rooster\Admin\States::save_button( $form_id ), ) + $opts; if ( '' !== $description ) { $card['description'] = $description; } list( $open, $close ) = AIEO_DMM_UI::card( $card ); $aieo_cmp_out( $open . $before . AIEO_DMM_UI::card_form( 'aieo_dmm_consent_save', 'consent', $form_id, $fields ) . $close ); }; ?> sprintf( __( '%s is handling consent on this site, and Rooster One is reading it.', 'ai-eshop-optimizer' ), $aieo_ext_cmp ), 'inline' => true, ) ); } elseif ( '' !== $aieo_ext_cmp && $enabled ) { $aieo_cmp_note = \Rooster\Admin\Ui::notice( esc_html( sprintf( __( 'This is worth fixing, and it is not a belt-and-braces situation. Each banner records its own answer, so a shopper can accept in one and decline in the other, and there is then no way to say which choice governs your site. Pick one. Our recommendation is to keep %s and switch the banner below off: Rooster One already reads %s for both analytics and marketing consent, so you lose nothing by doing that. If you would rather use ours, turn %s off in its own settings first. Rooster One will not change it for you.', 'ai-eshop-optimizer' ), $aieo_ext_cmp, $aieo_ext_cmp, $aieo_ext_cmp ) ), 'warning', array( 'title' => sprintf( __( 'Two consent banners are switched on: %s and this one.', 'ai-eshop-optimizer' ), $aieo_ext_cmp ), 'inline' => true, ) ); } if ( function_exists( 'rooster_admin_band_open' ) ) { rooster_admin_band_open( array( 'cols' => 2, 'min' => 35, ) ); } $aieo_logo = isset( $s['logo'] ) ? (string) $s['logo'] : ''; ob_start(); wp_editor( isset( $s['message'] ) ? (string) $s['message'] : '', 'aieo_consent_message', array( 'textarea_name' => 'message', 'media_buttons' => false, 'teeny' => true, 'textarea_rows' => 5, 'quicktags' => true, ) ); $aieo_cmp_editor = (string) ob_get_clean(); $aieo_cmp_fields = '
' . $aieo_cmp_row( 'enabled', __( 'Show banner', 'ai-eshop-optimizer' ), $aieo_cmp_switch( 'enabled', $enabled, __( 'Show the first-party consent banner', 'ai-eshop-optimizer' ) ) ) . $aieo_cmp_row( 'mode', __( 'Mode', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::select( 'mode', array( 'full' => __( 'Full consent everywhere (opt-in, GDPR)', 'ai-eshop-optimizer' ), 'light' => __( 'Light notice everywhere (notice and opt-out, US)', 'ai-eshop-optimizer' ), 'light_eea_full' => __( 'Light notice, full consent in the EEA, UK and Switzerland', 'ai-eshop-optimizer' ), ), $mode, array( 'id' => $aieo_cmp_id( 'mode' ) ) ), __( 'The light notice offers OK and "Do not sell or share my personal information", honours Global Privacy Control, and adds a "Your privacy choices" link to the footer (or use the [aieo_privacy_choices] shortcode, or a menu link to #aieo-privacy-choices). The region is told in the browser through Cloudflare; without Cloudflare every visitor gets the full consent. Scope and Default apply to the full consent. Have your legal adviser confirm the wording.', 'ai-eshop-optimizer' ) ) . $aieo_cmp_row( 'eea_only', __( 'Scope', 'ai-eshop-optimizer' ), $aieo_cmp_switch( 'eea_only', $eea, __( 'EEA / UK only (deny-by-default there; elsewhere use the default below)', 'ai-eshop-optimizer' ) ) ) . $aieo_cmp_row( 'default_state', __( 'Default (before choice / outside EEA)', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::select( 'default_state', array( 'denied' => __( 'Denied (opt-in)', 'ai-eshop-optimizer' ), 'granted' => __( 'Granted (opt-out)', 'ai-eshop-optimizer' ), ), 'granted' === $default ? 'granted' : 'denied', array( 'id' => $aieo_cmp_id( 'default_state' ) ) ) ) . $aieo_cmp_row( 'layout', __( 'Layout', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::select( 'layout', array( 'bar' => __( 'Bar (bottom of screen)', 'ai-eshop-optimizer' ), 'modal' => __( 'Pop-up (centre, glass)', 'ai-eshop-optimizer' ), ), $layout, array( 'id' => $aieo_cmp_id( 'layout' ) ) ), __( 'Bar (default) converts best and is least intrusive. The centre pop-up with a glass blur is more prominent but tends to raise bounce — pick it consciously.', 'ai-eshop-optimizer' ) ) . $aieo_cmp_row( 'title', __( 'Title', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'title', isset( $s['title'] ) ? (string) $s['title'] : '', array( 'id' => $aieo_cmp_id( 'title' ), 'medium' => true, 'placeholder' => __( 'We value your privacy', 'ai-eshop-optimizer' ), ) ) ) . $aieo_cmp_row( 'logo', __( 'Logo / image', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'logo', $aieo_logo, array( 'id' => 'aieo-cmp-logo', 'type' => 'url', 'placeholder' => 'https://…', ) ) . '

' . \Rooster\Admin\Ui::button( __( 'Choose image', 'ai-eshop-optimizer' ), array( 'size' => 'sm', 'attrs' => array( 'id' => 'aieo-cmp-logo-btn' ) ) ) . \Rooster\Admin\Ui::button( __( 'Remove', 'ai-eshop-optimizer' ), array( 'size' => 'sm', 'variant' => 'ghost', 'attrs' => array( 'id' => 'aieo-cmp-logo-clear' ) ) ) . '

' . '', __( 'Shown at the top of the pop-up (and the bar). Your store logo works well.', 'ai-eshop-optimizer' ) ) . $aieo_cmp_row( 'message', __( 'Message', 'ai-eshop-optimizer' ), $aieo_cmp_editor, __( 'Rich text. Links and basic formatting are allowed; scripts are stripped on save.', 'ai-eshop-optimizer' ), array( 'id' => 'aieo_consent_message' ) ) . $aieo_cmp_row( 'light_message', __( 'Light notice text', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::textarea( 'light_message', isset( $s['light_message'] ) ? (string) $s['light_message'] : '', array( 'id' => $aieo_cmp_id( 'light_message' ), 'rows' => 3, ) ), __( 'The light notice\'s text. Leave blank for the default, which links the privacy policy. Links and basic formatting are allowed.', 'ai-eshop-optimizer' ) ) . '
'; $aieo_cmp_card( 'consent-banner', 'megaphone', __( 'Banner', 'ai-eshop-optimizer' ), __( "Rooster One's own lightweight cookie banner: a first-party alternative to a heavy consent management platform. It powers Google Consent Mode v2 and gates Rooster One analytics plus the Facebook and GA4 senders. Measurement scope (advertiser) by design, with no IAB TCF. Leave the banner off to defer to an external platform you already run.", 'ai-eshop-optimizer' ), $aieo_cmp_fields, array( 'col' => 1, 'before' => $aieo_cmp_note, ) ); $aieo_otd = ( isset( $s['one_tap_consent_default'] ) && 'checked' === $s['one_tap_consent_default'] ) ? 'checked' : 'unchecked'; $aieo_otd_warn = \Rooster\Admin\Ui::notice( esc_html( preg_replace( '/^\x{26A0}\x{FE0F}?\s*/u', '', __( '⚠ A pre-ticked consent box is rejected by the GDPR (Recital 32 / Planet49). Only use it if your legal review confirms it for your jurisdiction — your responsibility.', 'ai-eshop-optimizer' ) ) ), 'warning', array( 'inline' => true, 'id' => 'aieo-onetap-gdpr-warn', ) ); $aieo_cmp_fields = '
' . $aieo_cmp_row( 'one_tap_enabled', __( 'Enable One Tap', 'ai-eshop-optimizer' ), $aieo_cmp_switch( 'one_tap_enabled', ! empty( $s['one_tap_enabled'] ) && 'yes' === $s['one_tap_enabled'], __( 'Show the One Tap prompt to consenting, logged-out visitors', 'ai-eshop-optimizer' ) ) ) . $aieo_cmp_row( 'one_tap_consent_default', __( 'Consent line default', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::select( 'one_tap_consent_default', array( 'unchecked' => __( 'Unticked (recommended)', 'ai-eshop-optimizer' ), 'checked' => __( 'Pre-ticked', 'ai-eshop-optimizer' ), ), $aieo_otd, array( 'id' => 'aieo-onetap-default' ) ), __( 'Default state of the "Personalise with my Google profile" line shown in the consent banner.', 'ai-eshop-optimizer' ), array( 'id' => 'aieo-onetap-default' ) ) . \Rooster\Admin\States::depends( $aieo_otd_warn, 'aieo-onetap-default', 'checked' === $aieo_otd, array( 'value' => 'checked' ) ) . '
'; $aieo_cmp_card( 'consent-google-one-tap-personalisation', 'circle-user', __( 'Google One Tap personalisation', 'ai-eshop-optimizer' ), __( 'Show visitors who are signed into Google a one-tap "Continue as…" prompt to recognise them (name + email) for personalised recommendations. Recognise-only — it never logs them in or creates an account; sign-in stays at checkout. Requires your Google client ID under Social Login.', 'ai-eshop-optimizer' ), $aieo_cmp_fields, array( 'col' => 2 ) ); $aieo_cmp_fields = '
'; $aieo_cmp_fields .= $aieo_cmp_row( 'reopen_enabled', __( 'Re-open button', 'ai-eshop-optimizer' ), $aieo_cmp_switch( 'reopen_enabled', $reopen, __( 'Show a floating "Cookie settings" button so visitors can change or withdraw consent', 'ai-eshop-optimizer' ) ) ); $aieo_cmp_fields .= $aieo_cmp_row( 'reopen_label', __( 'Button text', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'reopen_label', isset( $s['reopen_label'] ) ? (string) $s['reopen_label'] : '', array( 'id' => $aieo_cmp_id( 'reopen_label' ), 'medium' => true, 'placeholder' => __( 'Cookie settings', 'ai-eshop-optimizer' ), ) ) ); $aieo_pos_fields = array( 'desktop' => __( 'Desktop position', 'ai-eshop-optimizer' ), 'mobile' => __( 'Mobile position', 'ai-eshop-optimizer' ), ); foreach ( $aieo_pos_fields as $aieo_dev => $aieo_devlabel ) { $aieo_pos = isset( $s[ 'reopen_pos_' . $aieo_dev ] ) ? (string) $s[ 'reopen_pos_' . $aieo_dev ] : 'left'; $aieo_x = isset( $s[ 'reopen_x_' . $aieo_dev ] ) ? (int) $s[ 'reopen_x_' . $aieo_dev ] : 86; $aieo_b = isset( $s[ 'reopen_bottom_' . $aieo_dev ] ) ? (int) $s[ 'reopen_bottom_' . $aieo_dev ] : 20; $aieo_num = static function ( $name, $value ) use ( $aieo_cmp_id ) { return \Rooster\Admin\Ui::input( $name, (string) $value, array( 'id' => $aieo_cmp_id( $name ), 'type' => 'number', 'min' => '0', 'max' => '2000', 'step' => '1', 'xs' => true, 'unit' => 'px', ) ); }; $aieo_cmp_fields .= \Rooster\Admin\Ui::field_row( array( 'id' => $aieo_cmp_id( 'reopen_' . $aieo_dev ), 'label' => $aieo_devlabel, 'parts' => array( array( 'label' => __( 'Position', 'ai-eshop-optimizer' ), 'control' => \Rooster\Admin\Fields::segmented( 'reopen_pos_' . $aieo_dev, array( 'left' => __( 'Left', 'ai-eshop-optimizer' ), 'center' => __( 'Centre', 'ai-eshop-optimizer' ), 'right' => __( 'Right', 'ai-eshop-optimizer' ), ), in_array( $aieo_pos, array( 'left', 'center', 'right' ), true ) ? $aieo_pos : 'left', array( 'id' => $aieo_cmp_id( 'reopen_pos_' . $aieo_dev ), 'label' => $aieo_devlabel . ', ' . __( 'Position', 'ai-eshop-optimizer' ), ) ), ), array( 'label' => __( 'Edge offset', 'ai-eshop-optimizer' ), 'id' => $aieo_cmp_id( 'reopen_x_' . $aieo_dev ), 'control' => $aieo_num( 'reopen_x_' . $aieo_dev, $aieo_x ), ), array( 'label' => __( 'Bottom offset', 'ai-eshop-optimizer' ), 'id' => $aieo_cmp_id( 'reopen_bottom_' . $aieo_dev ), 'control' => $aieo_num( 'reopen_bottom_' . $aieo_dev, $aieo_b ), ), ), ) ); } $aieo_cmp_fields .= '
'; $aieo_cmp_fields .= \Rooster\Admin\Guidance::text( __( 'Position of the floating cookie button per device, so it can be aligned with other floating widgets (WhatsApp, scroll-to-top). Edge offset applies from the chosen side; ignored for Centre. When the Side Cart bottom navigator is active, its coordinated styling SUPERSEDES the mobile settings here (the navigator owns the mobile bottom edge and includes its own cookie item).', 'ai-eshop-optimizer' ) ); $aieo_cmp_fields .= '
'; $aieo_cmp_fields .= $aieo_cmp_row( 'cookie_scan', __( 'Cookie scanning', 'ai-eshop-optimizer' ), $aieo_cmp_switch( 'cookie_scan', ! isset( $s['cookie_scan'] ) || 'no' !== $s['cookie_scan'], __( 'Discover cookies live from storefront visitors (sweep)', 'ai-eshop-optimizer' ) ), __( 'Lightweight and privacy-safe: sends cookie NAMES + detected service hosts only (never values), via sendBeacon, AFTER the page has loaded, and only once per 30 days per visitor. Leave it on while building your cookie inventory (or briefly after adding a new third-party script). Turn it OFF once the inventory is complete — the storefront then makes NO scan request at all (fully static), removing a per-visitor server hit on every visit.', 'ai-eshop-optimizer' ) ); $aieo_cmp_fields .= $aieo_cmp_row( 'cookie_scan_days', __( 'Re-scan each visitor at most once every', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'cookie_scan_days', (string) (int) ( isset( $s['cookie_scan_days'] ) ? $s['cookie_scan_days'] : 30 ), array( 'id' => $aieo_cmp_id( 'cookie_scan_days' ), 'type' => 'number', 'min' => '1', 'max' => '365', 'step' => '1', 'xs' => true, 'unit' => __( 'days', 'ai-eshop-optimizer' ), ) ) ); $aieo_cmp_fields .= $aieo_cmp_row( 'policy_version', __( 'Policy version', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'policy_version', (string) ( isset( $s['policy_version'] ) ? max( 1, (int) $s['policy_version'] ) : 1 ), array( 'id' => $aieo_cmp_id( 'policy_version' ), 'type' => 'number', 'min' => '1', 'step' => '1', 'xs' => true, ) ), __( 'Bump this number after a material change to your cookie/privacy policy to re-ask every visitor (existing choices below this version are treated as no choice).', 'ai-eshop-optimizer' ) ); $aieo_cmp_fields .= '
'; $aieo_cmp_card( 'consent-re-open-policy', 'rotate-ccw', __( 'Re-open and policy', 'ai-eshop-optimizer' ), __( 'Place the floating cookie button that reopens the choices, decide how cookies are discovered, and re-ask visitors after a policy change.', 'ai-eshop-optimizer' ), $aieo_cmp_fields, array( 'col' => 2 ) ); $aieo_cmp_fields = '
'; foreach ( array( 'necessary', 'functional', 'analytics', 'marketing' ) as $cat ) { $aieo_cmp_fields .= $aieo_cmp_row( 'desc_' . $cat, $cat_labels[ $cat ], \Rooster\Admin\Ui::textarea( 'desc_' . $cat, isset( $s[ 'desc_' . $cat ] ) ? (string) $s[ 'desc_' . $cat ] : '', array( 'id' => $aieo_cmp_id( 'desc_' . $cat ), 'rows' => 2, ) ) ); } $aieo_cmp_fields .= '
'; $aieo_cmp_card( 'consent-category-descriptions', 'list', __( 'Category descriptions', 'ai-eshop-optimizer' ), __( 'Shown next to each toggle in the preferences panel (Customize). Leave blank to use the defaults.', 'ai-eshop-optimizer' ), $aieo_cmp_fields, array( 'col' => 1 ) ); $aieo_cmp_size = static function ( $name, $label, $placeholder ) use ( $s, $aieo_cmp_id, $aieo_cmp_row ) { return $aieo_cmp_row( $name, $label, \Rooster\Admin\Ui::input( $name, isset( $s[ $name ] ) ? (string) $s[ $name ] : '', array( 'id' => $aieo_cmp_id( $name ), 'xs' => true, 'placeholder' => $placeholder, ) ) ); }; $aieo_cmp_fields = '
' . $aieo_cmp_color( 'bar_bg', __( 'Background', 'ai-eshop-optimizer' ) ) . $aieo_cmp_color( 'bar_link_color', __( 'Links (Yes / No)', 'ai-eshop-optimizer' ) ) . $aieo_cmp_color( 'bar_text_color', __( 'Main text', 'ai-eshop-optimizer' ) ) . $aieo_cmp_color( 'bar_desc_color', __( 'Description', 'ai-eshop-optimizer' ) ) . $aieo_cmp_size( 'bar_text_size', __( 'Main text size', 'ai-eshop-optimizer' ), '18px' ) . $aieo_cmp_size( 'bar_desc_size', __( 'Description size', 'ai-eshop-optimizer' ), '14px' ) . '
'; $aieo_cmp_card( 'consent-bottom-bar-appearance', 'palette', __( 'Bottom-bar appearance', 'ai-eshop-optimizer' ), __( 'Colours + text sizes for the horizontal bottom-bar layout (BBC-style title | description | links).', 'ai-eshop-optimizer' ), $aieo_cmp_fields, array( 'col' => 2 ) ); $aieo_cmp_btn_grid = static function ( $suffix, $colours ) use ( $btn_groups, $aieo_cmp_id, $aieo_cmp_color ) { $html = '
'; foreach ( $btn_groups as $btn => $glabel ) { $hid = $aieo_cmp_id( 'btn_' . $btn ) . $suffix . '-h'; $html .= '
' . '

' . esc_html( $glabel ) . '

' . '
'; foreach ( $colours as $field => $label ) { $html .= $aieo_cmp_color( 'btn_' . $btn . '_' . $field, $label ); } $html .= '
'; } return $html . '
'; }; $aieo_cmp_fields = $aieo_cmp_btn_grid( '', array( 'bg' => __( 'Background', 'ai-eshop-optimizer' ), 'fg' => __( 'Text', 'ai-eshop-optimizer' ), 'border' => __( 'Border', 'ai-eshop-optimizer' ), ) ) . \Rooster\Admin\Ui::fold( __( 'Hover colours', 'ai-eshop-optimizer' ), $aieo_cmp_btn_grid( '-hover', array( 'bg_hover' => __( 'Hover background', 'ai-eshop-optimizer' ), 'fg_hover' => __( 'Hover text', 'ai-eshop-optimizer' ), 'border_hover' => __( 'Hover border', 'ai-eshop-optimizer' ), ) ) ); $aieo_cmp_card( 'consent-button-colours', 'sliders-horizontal', __( 'Button colours', 'ai-eshop-optimizer' ), __( 'Accept and Decline keep the same size and shape by design (equal prominence). Don\'t hide Decline — regulators treat a faint "reject" as a dark pattern. Customize may be lighter. Use "transparent" for a see-through background.', 'ai-eshop-optimizer' ), $aieo_cmp_fields, array( 'span' => 'all', 'essential' => true, ) ); if ( function_exists( 'rooster_admin_band_close' ) ) { rooster_admin_band_close(); } ?> 1 ) ); } $aieo_inv_clear = ''; if ( 0 !== $total ) { $aieo_inv_clear = \Rooster\Admin\Ui::button( __( 'Clear inventory', 'ai-eshop-optimizer' ), array( 'attrs' => array( 'id' => 'aieo-cmp-inv-clear' ) + \Rooster\Admin\States::confirm_attrs( 'aieo-cmp-inv-clear-confirm' ) ) ) . ' '; } list( $aieo_cmp_open, $aieo_cmp_close ) = AIEO_DMM_UI::card( array( 'anchor' => 'consent-cookie-inventory-scanner', 'icon' => 'search', 'title' => __( 'Cookie inventory (scanner)', 'ai-eshop-optimizer' ), 'description' => __( 'Cookies and third-party services seen on your storefront, classified against a built-in database. Re-assign anything in the "Unclassified" bucket so the categories your visitors see are accurate; your choices override the built-in database. Use "Re-scan storefront now" to refresh this list on demand — handy when live scanning is off.', 'ai-eshop-optimizer' ), 'footer' => $aieo_inv_clear, ) ); $aieo_cmp_out( $aieo_cmp_open ); if ( 0 !== $total ) { $aieo_cmp_out( \Rooster\Admin\States::confirm( 'aieo-cmp-inv-clear-confirm', 'reset', __( 'Clear the whole cookie inventory? It will repopulate as visitors browse.', 'ai-eshop-optimizer' ), esc_html( sprintf( _n( '%s cookie seen so far is removed from this list. The categories you chose are kept and apply again when it is seen.', '%s cookies seen so far are removed from this list. The categories you chose are kept and apply again when they are seen.', $total, 'ai-eshop-optimizer' ), number_format_i18n( $total ) ) ), array( 'confirm' => __( 'Clear inventory', 'ai-eshop-optimizer' ) ) ) ); } $aieo_cmp_out( \Rooster\Admin\States::job( array( 'id' => 'aieo-cmp-rescan-job', 'state' => 'idle', 'run' => __( 'Re-scan storefront now', 'ai-eshop-optimizer' ), 'run_attrs' => array( 'id' => 'aieo-cmp-rescan' ), 'primary' => false, 'progress_label' => __( 'Scanning', 'ai-eshop-optimizer' ), ) ) ); $aieo_cmp_out( \Rooster\Admin\Guidance::text( __( 'Loads your storefront in the background (homepage, cart, checkout, shop) and refreshes this list with the cookies + services currently set — even when live scanning is off. Run it after adding a new third-party script. Tip: grant consent once on the storefront first so consent-gated cookies are included.', 'ai-eshop-optimizer' ) ) ); $aieo_rescan_urls = array( home_url( '/' ) ); if ( function_exists( 'wc_get_cart_url' ) ) { $aieo_rescan_urls[] = wc_get_cart_url(); } if ( function_exists( 'wc_get_checkout_url' ) ) { $aieo_rescan_urls[] = wc_get_checkout_url(); } if ( function_exists( 'wc_get_page_permalink' ) ) { $aieo_shop = wc_get_page_permalink( 'shop' ); if ( $aieo_shop ) { $aieo_rescan_urls[] = $aieo_shop; } } $aieo_rescan_urls = array_values( array_unique( array_filter( $aieo_rescan_urls ) ) ); ?> __( 'Nothing scanned yet. Enable the banner and visit the storefront — the inventory fills as pages load.', 'ai-eshop-optimizer' ) ) ) ); ?> last_seen ) ? (string) $aieo_row->last_seen : ''; if ( $aieo_ls > $aieo_inv_latest ) { $aieo_inv_latest = $aieo_ls; } } } if ( '' !== $aieo_inv_latest ) { $aieo_cmp_out( \Rooster\Admin\Guidance::text( sprintf( __( 'This is a record of everything ever seen, not only what the site sets today — nothing is removed until you clear the inventory. The most recent scan ran %s ago; anything older was not seen in it. Note the scan reads the cookies of whichever browser performs it, so a cookie left over from a plugin you have since removed can still appear.', 'ai-eshop-optimizer' ), human_time_diff( strtotime( $aieo_inv_latest . ' +00:00' ), time() ) ) ) ); } ?> last_seen ) ? (string) $r->last_seen : ''; $aieo_fresh = ( '' !== $aieo_last && '' !== $aieo_inv_latest && $aieo_last === $aieo_inv_latest ); if ( '' === $aieo_last ) { $seen_label = ''; } elseif ( $aieo_fresh ) { $seen_label = __( 'this scan', 'ai-eshop-optimizer' ); } else { $seen_label = sprintf( __( '%s ago', 'ai-eshop-optimizer' ), human_time_diff( strtotime( $aieo_last . ' +00:00' ), time() ) ); } $aieo_inv_rows[] = array( 'name' => isset( $r->name ) ? (string) $r->name : '', 'category' => isset( $r->category ) ? (string) $r->category : '', 'service' => isset( $r->service ) ? (string) $r->service : '', 'reviewed' => ( isset( $r->status ) && 'reviewed' === $r->status ), 'description' => isset( $r->description ) ? (string) $r->description : '', 'hits' => (int) ( isset( $r->hits ) ? $r->hits : 0 ), 'seen' => $seen_label, 'seen_tone' => $aieo_fresh ? 'success' : 'muted', 'pre_consent' => ! empty( $r->pre_consent ) ? __( 'yes', 'ai-eshop-optimizer' ) : '', ); } AIEO_Table::render( array( 'columns' => array( array( 'key' => 'name', 'label' => __( 'Name', 'ai-eshop-optimizer' ), 'type' => 'control', 'format' => array( 'render' => static function ( $row ) { $out = '' . esc_html( $row['name'] ) . ''; if ( $row['reviewed'] ) { $out .= ' ' . \Rooster\Admin\Ui::badge( __( 'Reviewed', 'ai-eshop-optimizer' ), 'success', array( 'sm' => true ) ); } if ( '' !== $row['description'] ) { $out .= '
' . esc_html( $row['description'] ) . ''; } return $out; }, ), ), array( 'key' => 'service', 'label' => __( 'Service', 'ai-eshop-optimizer' ), 'type' => 'control', 'format' => array( 'render' => static function ( $row ) { return ''; }, ), ), array( 'key' => 'hits', 'label' => __( 'Hits', 'ai-eshop-optimizer' ), 'type' => 'integer', ), array( 'key' => 'seen', 'label' => __( 'Last seen', 'ai-eshop-optimizer' ), 'type' => 'badge', 'nowrap' => true, 'format' => array( 'tone_key' => 'seen_tone' ), ), array( 'key' => 'pre_consent', 'label' => __( 'Pre-consent', 'ai-eshop-optimizer' ), 'type' => 'text', 'tone' => 'danger', ), array( 'key' => 'category', 'label' => __( 'Category', 'ai-eshop-optimizer' ), 'type' => 'control', 'format' => array( 'render' => static function ( $row ) { $opts = array( '' => __( '— unclassified —', 'ai-eshop-optimizer' ), 'necessary' => __( 'Strictly necessary', 'ai-eshop-optimizer' ), 'functional' => __( 'Functional', 'ai-eshop-optimizer' ), 'analytics' => __( 'Analytics', 'ai-eshop-optimizer' ), 'marketing' => __( 'Marketing', 'ai-eshop-optimizer' ), ); $out = ''; }, ), ), array( 'key' => 'save', 'label' => '', 'type' => 'control', 'format' => array( 'render' => static function () { return ''; }, ), ), ), 'rows' => $aieo_inv_rows, 'row_key' => 'name', 'row_data' => array( 'name' => 'name' ), 'page_id' => 'consent', ) ); ?>