array( 'label' => __( 'Nightly AI writing (SEO, General): page titles and content to DataForSEO and, through rooster.systems, to Claude', 'ai-eshop-optimizer' ), 'url' => $dmm . '&dmm_tab=seo_general#aieo-seo-ai-write-nightly', 'on' => static function () use ( $seo ) { return $seo( 'seo.ai_write_nightly' ); }, ), 'dfs_weekly' => array( 'label' => __( 'Weekly rankings pull (SEO, General): this site’s address to DataForSEO, billed within your monthly budget', 'ai-eshop-optimizer' ), 'url' => $dmm . '&dmm_tab=seo_general#aieo-dfs-weekly', 'on' => static function () use ( $seo ) { return $seo( 'seo.dfs_weekly_pull' ); }, ), 'proposals_narrate' => array( 'label' => __( 'Name proposals with AI (Proposals): each new proposal’s figures, through rooster.systems, to Claude', 'ai-eshop-optimizer' ), 'url' => $dmm . '&dmm_tab=proposals#aieo-prop-narrate', 'on' => static function () { return 'yes' === (string) get_option( 'aieo_proposals_narrate', '' ); }, ), 'chat_index' => array( 'label' => __( 'Index products and courses for the chat (AI Chat, Step 1): the text of your products, courses and pages, through rooster.systems, to Voyage AI', 'ai-eshop-optimizer' ), 'url' => class_exists( 'AIEO_Chat_Indexing' ) ? AIEO_Chat_Indexing::settings_url() : admin_url( 'admin.php?page=ai-eshop-chat' ), 'on' => static function () { return class_exists( 'AIEO_Chat_Indexing' ) && '1' === (string) get_option( AIEO_Chat_Indexing::OPTION, '0' ); }, ), 'competition_consent' => array( 'label' => __( 'Competition entry forms show a newsletter consent box, ticked to start with: only entrants who leave it ticked are subscribed. The Competitions setting can start it unticked.', 'ai-eshop-optimizer' ), 'url' => $dmm . '&dmm_tab=competitions#aieo-comp-consent', ), ); } public static function render() { $page = isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : ''; if ( 0 !== strpos( $page, 'ai-eshop' ) && 0 !== strpos( $page, 'rooster-one' ) ) { return; } $items = self::fold_chat_legacy( get_option( self::OPTION, array() ) ); if ( ! is_array( $items ) || ! $items || ! current_user_can( 'manage_options' ) || ! self::existing_shop() ) { return; } $defs = self::items(); $rows = ''; foreach ( $items as $key => $state ) { if ( ! isset( $defs[ $key ] ) ) { continue; } if ( self::NOTE !== $state && ( 'on' !== $state || ( isset( $defs[ $key ]['on'] ) && ! call_user_func( $defs[ $key ]['on'] ) ) ) ) { continue; } $link = '' . esc_html( $defs[ $key ]['label'] ) . ''; $rows .= '
  • ' . $link . ( self::NOTE === $state ? '' : ': ' . esc_html__( 'on, because this shop uses it', 'ai-eshop-optimizer' ) ) . '
  • '; } if ( '' === $rows ) { return; } $dismiss = wp_nonce_url( admin_url( 'admin-post.php?action=aieo_outbound_notice_dismiss' ), 'aieo_outbound_notice', 'aieo_nonce' ); echo '

    ' . esc_html__( 'Your data and consent settings', 'ai-eshop-optimizer' ) . '

    ' . esc_html__( 'Each of these features has a setting of its own. On this shop they are set as below; change any of them from its link.', 'ai-eshop-optimizer' ) . '

    ' . '' . esc_html__( 'Got it', 'ai-eshop-optimizer' ) . '

    '; } private static function fold_chat_legacy( $items ) { $items = is_array( $items ) ? $items : array(); $all = wp_load_alloptions(); if ( ! isset( $all[ self::CHAT_LEGACY ] ) ) { return $items; } if ( 'on' === $all[ self::CHAT_LEGACY ] ) { $items['chat_index'] = 'on'; update_option( self::OPTION, $items, true ); } delete_option( self::CHAT_LEGACY ); return $items; } public static function dismiss() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'Insufficient permissions.', 'ai-eshop-optimizer' ) ); } check_admin_referer( 'aieo_outbound_notice', 'aieo_nonce' ); update_option( self::OPTION, array(), true ); wp_safe_redirect( wp_get_referer() ? wp_get_referer() : admin_url() ); exit; } }