!empty($_POST['ring']) ? 'yes' : 'no', 'fill' => in_array($fill, array('page', 'none', 'theme', 'white'), true) ? $fill : 'page', 'card_box' => isset($_POST['card_box']) ? max(32, min(56, (int) $_POST['card_box'])) : 44, 'line' => 'embossed' === $line ? 'embossed' : 'plain', 'color_empty' => sanitize_hex_color(wp_unslash($_POST['color_empty'] ?? '')) ?: '#c0c4c9', 'color_filled' => sanitize_hex_color(wp_unslash($_POST['color_filled'] ?? '')) ?: '#dd1419', 'color_hover' => sanitize_hex_color(wp_unslash($_POST['color_hover'] ?? '')) ?: '#b3101a', 'size' => isset($_POST['size']) ? max(12, min(60, (int) $_POST['size'])) : 22, 'size_mobile' => isset($_POST['size_mobile']) ? ((int) $_POST['size_mobile'] <= 0 ? 0 : max(12, min(60, (int) $_POST['size_mobile']))) : 18, 'tooltip_add' => isset($_POST['tooltip_add']) ? sanitize_text_field(wp_unslash($_POST['tooltip_add'])) : '', 'tooltip_remove' => isset($_POST['tooltip_remove']) ? sanitize_text_field(wp_unslash($_POST['tooltip_remove'])) : '', 'show_tooltip' => !empty($_POST['show_tooltip']) ? 'yes' : 'no', 'single_label_add' => isset($_POST['single_label_add']) ? sanitize_text_field(wp_unslash($_POST['single_label_add'])) : '', 'single_label_view' => isset($_POST['single_label_view']) ? sanitize_text_field(wp_unslash($_POST['single_label_view'])) : '', 'single_show_label' => !empty($_POST['single_show_label']) ? 'yes' : 'no', 'show_on_single' => !empty($_POST['show_on_single']) ? 'yes' : 'no', 'show_on_archive' => !empty($_POST['show_on_archive']) ? 'yes' : 'no', 'single_placement'=> $placement, 'archive_position'=> $archive_pos, 'wishlist_page_id'=> isset($_POST['wishlist_page_id']) ? max(0, (int) $_POST['wishlist_page_id']) : 0, 'wishlist_type_product' => !empty($_POST['wishlist_type_product']) ? 'yes' : 'no', 'wishlist_type_brand' => !empty($_POST['wishlist_type_brand']) ? 'yes' : 'no', 'wishlist_type_category' => !empty($_POST['wishlist_type_category']) ? 'yes' : 'no', 'wishlist_type_need' => !empty($_POST['wishlist_type_need']) ? 'yes' : 'no', 'wishlist_type_blogpost' => !empty($_POST['wishlist_type_blogpost']) ? 'yes' : 'no', ); update_option(AIEO_Wishlist::DISPLAY_OPTION, $data, false); wp_send_json_success(array('message' => __('Wishlist display settings saved.', 'ai-eshop-optimizer'))); } public function render_subtab() { global $wpdb; $table = $wpdb->prefix . 'aieo_wishlist'; $exists = $wpdb->get_var($wpdb->prepare('SHOW TABLES LIKE %s', $table)); if ($exists !== $table) { list($aieo_wlx_open, $aieo_wlx_close) = AIEO_DMM_UI::card(array('icon' => 'book-marked', 'title' => $this->get_label())); echo $aieo_wlx_open; $aieo_wlx_state = \Rooster\Admin\States::state('not-set-up', array( 'feature' => __('Wishlist analytics', 'ai-eshop-optimizer'), 'text' => __('No wishlist table found. The Rooster One wishlist module may not be active yet — activate it and the analytics will appear here.', 'ai-eshop-optimizer'), )); echo $aieo_wlx_state; echo $aieo_wlx_close; return; } $total = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$table}"); $unique = (int) $wpdb->get_var("SELECT COUNT(DISTINCT item_id) FROM {$table}"); $unique_logged_in = (int) $wpdb->get_var( "SELECT COUNT(DISTINCT user_id) FROM {$table} WHERE user_id > 0" ); $unique_anonymous = (int) $wpdb->get_var( "SELECT COUNT(DISTINCT session_id) FROM {$table} WHERE user_id = 0 AND session_id <> ''" ); $unique_customers = $unique_logged_in + $unique_anonymous; $popular = $wpdb->get_results("SELECT item_id, COUNT(*) AS c FROM {$table} GROUP BY item_id ORDER BY c DESC LIMIT 20"); $by_source = $wpdb->get_results("SELECT source_type, COUNT(*) AS c FROM {$table} WHERE source_type <> '' GROUP BY source_type ORDER BY c DESC LIMIT 10"); $breakdown = $wpdb->get_results("SELECT source_type, source_id, source_name, COUNT(*) AS c FROM {$table} WHERE source_type <> '' GROUP BY source_type, source_id, source_name ORDER BY c DESC LIMIT 20"); $total_with_source = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$table} WHERE source_type <> ''"); if (function_exists('rooster_admin_band_open')) { rooster_admin_band_open(array('cols' => 1)); } list($aieo_wlx_open, $aieo_wlx_close) = AIEO_DMM_UI::card(array( 'anchor' => 'wishlist-overview', 'icon' => 'layout-dashboard', 'title' => __('Wishlist totals', 'ai-eshop-optimizer'), 'description' => __('Counts saved items and the unique products behind them, customers with a list split into logged-in and anonymous, and how many items carry a known source.', 'ai-eshop-optimizer'), )); echo $aieo_wlx_open; $aieo_wlx_pointer = wp_kses_post(sprintf( __('Looking for the heart-button styling (placement, colors, labels)? It now lives under %1$sVisual Display → Wishlist Display%2$s.', 'ai-eshop-optimizer'), '', '' )); echo \Rooster\Admin\Ui::notice($aieo_wlx_pointer, 'mono', array('inline' => true)); if (0 === $total) { $aieo_wlx_first = \Rooster\Admin\States::state('first-use', array( 'title' => __('No wishlist items yet', 'ai-eshop-optimizer'), 'text' => __('Items will appear once customers start adding them.', 'ai-eshop-optimizer'), )); echo $aieo_wlx_first; echo $aieo_wlx_close; if (function_exists('rooster_admin_band_close')) { rooster_admin_band_close(); } return; } echo '
'; $this->tile(__('Total items in wishlists', 'ai-eshop-optimizer'), number_format_i18n($total)); $this->tile(__('Unique products', 'ai-eshop-optimizer'), number_format_i18n($unique)); $this->tile(__('Customers with a list', 'ai-eshop-optimizer'), number_format_i18n($unique_customers)); $this->tile(__('… logged in', 'ai-eshop-optimizer'), number_format_i18n($unique_logged_in)); $this->tile(__('… anonymous', 'ai-eshop-optimizer'), number_format_i18n($unique_anonymous)); $this->tile(__('Items with a known source', 'ai-eshop-optimizer'), number_format_i18n($total_with_source)); echo '
'; echo $aieo_wlx_close; if (function_exists('rooster_admin_band_close')) { rooster_admin_band_close(); } if (function_exists('rooster_admin_band_open')) { rooster_admin_band_open(array('cols' => 2)); } $this->render_source_stats_card($by_source, $total_with_source); $this->render_source_breakdown_card($breakdown); $this->render_popular_products_card($popular); if (function_exists('rooster_admin_band_close')) { rooster_admin_band_close(); } } public function render_display_settings_card($intro = '') { $d = AIEO_Wishlist::get_display_settings(true); $d_hint = array( 'tooltip_add' => __('Add to wishlist', 'ai-eshop-optimizer'), 'tooltip_remove' => __('Remove from wishlist', 'ai-eshop-optimizer'), 'single_label_add' => __('Add to your favourites', 'ai-eshop-optimizer'), 'single_label_view' => __('See your favourites', 'ai-eshop-optimizer'), ); $placements = array( 'before_title' => __('Before title', 'ai-eshop-optimizer'), 'after_title' => __('After title', 'ai-eshop-optimizer'), 'after_price' => __('After price', 'ai-eshop-optimizer'), 'after_excerpt' => __('After short description', 'ai-eshop-optimizer'), 'before_add_to_cart' => __('Before Add to Cart form', 'ai-eshop-optimizer'), 'after_add_to_cart_btn'=> __('Next to Add to Cart button', 'ai-eshop-optimizer'), 'after_add_to_cart' => __('After Add to Cart (default)', 'ai-eshop-optimizer'), 'after_meta' => __('After product meta', 'ai-eshop-optimizer'), ); $archive_positions = array( 'top-right' => __('Top right', 'ai-eshop-optimizer'), 'top-left' => __('Top left', 'ai-eshop-optimizer'), 'bottom-right' => __('Bottom right', 'ai-eshop-optimizer'), 'bottom-left' => __('Bottom left', 'ai-eshop-optimizer'), ); $where_desc = __('Puts the heart on product pages at one of eight positions and in a chosen corner of catalogue cards, and sets the page a filled heart opens instead of un-wishlisting.', 'ai-eshop-optimizer'); $id_of = static function ($name) { return 'aieo-wl-' . str_replace('_', '-', $name); }; $row = static function ($name, $label, $control, $help = '') use ($id_of) { $field = array('id' => $id_of($name), 'label' => $label, 'control' => $control); if ('' !== $help) { $field['help'] = $help; } return \Rooster\Admin\Ui::field_row($field); }; $switch = static function ($name, $text) use ($d, $id_of) { $on = !isset($d[$name]) || 'yes' === $d[$name]; return \Rooster\Admin\Ui::toggle($name, $on, array('id' => $id_of($name), 'hidden' => false, 'label' => $text)); }; $yes = static function ($name, $text) use ($d, $id_of) { return \Rooster\Admin\Ui::toggle($name, 'yes' === ($d[$name] ?? ''), array('id' => $id_of($name), 'hidden' => false, 'label' => $text)); }; $text = static function ($name) use ($d, $d_hint, $id_of) { return \Rooster\Admin\Ui::input($name, (string) $d[$name], array('id' => $id_of($name), 'medium' => true, 'placeholder' => $d_hint[$name])); }; $colour = static function ($name, $fallback) use ($d, $id_of) { return \Rooster\Admin\Fields::color($name, (string) $d[$name], array('id' => $id_of($name), 'default' => $fallback)); }; $card = static function ($anchor, $icon, $title, $fields, $extra = array()) { $form_id = 'aieo-card-' . $anchor . '-form'; list($open, $close) = AIEO_DMM_UI::card(array( 'anchor' => $anchor, 'icon' => $icon, 'title' => $title, 'footer' => class_exists('\Rooster\Admin\States') ? \Rooster\Admin\States::save_button($form_id) : '', ) + $extra); echo $open; echo AIEO_DMM_UI::card_form('aieo_dmm_wishlist_save_display', 'wishlist_display', $form_id, '
' . $fields . '
'); echo $close; }; rooster_admin_band_open(array('cols' => 2)); $page_select = wp_dropdown_pages(array( 'name' => 'wishlist_page_id', 'id' => $id_of('wishlist_page_id'), 'selected' => (int) $d['wishlist_page_id'], 'show_option_none' => esc_html__('— none —', 'ai-eshop-optimizer'), 'option_none_value'=> 0, 'echo' => 0, )); $fields = $row('show_on_single', __('Show on single product', 'ai-eshop-optimizer'), $yes('show_on_single', __('Render the heart on product pages', 'ai-eshop-optimizer'))); $fields .= $row('single_placement', __('Placement on single product', 'ai-eshop-optimizer'), \Rooster\Admin\Ui::select('single_placement', $placements, (string) $d['single_placement'], array('id' => $id_of('single_placement')))); $fields .= $row('show_on_archive', __('Show on archive cards', 'ai-eshop-optimizer'), $yes('show_on_archive', __('Render on shop / category pages', 'ai-eshop-optimizer'))); $fields .= $row('archive_position', __('Archive corner', 'ai-eshop-optimizer'), \Rooster\Admin\Ui::select('archive_position', $archive_positions, (string) $d['archive_position'], array('id' => $id_of('archive_position'), 'short' => true))); if ('' !== trim((string) $page_select)) { $fields .= $row('wishlist_page_id', __('Wishlist page', 'ai-eshop-optimizer'), preg_replace('/^ $id_of('wishlist_page_id'), 'label' => __('Wishlist page', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::select('wishlist_page_id', array('0' => __('— none —', 'ai-eshop-optimizer')), '0', array('id' => $id_of('wishlist_page_id'), 'disabled' => true)), 'help' => __('When set, clicking a filled heart navigates to this page instead of un-wishlisting.', 'ai-eshop-optimizer'), 'reason' => __('No published page yet. Publish one to choose it here.', 'ai-eshop-optimizer'), )); } $extra = array('description' => '' !== (string) $intro ? (string) $intro : $where_desc); if ('' !== (string) $intro) { $fields = \Rooster\Admin\Guidance::text($where_desc) . $fields; } $card('wishlist-where-it-appears', 'pin', __('Heart button placement', 'ai-eshop-optimizer'), $fields, $extra); $fields = $row('tooltip_add', __('Tooltip — not yet in list', 'ai-eshop-optimizer'), $text('tooltip_add')); $fields .= $row('tooltip_remove', __('Tooltip — when in list', 'ai-eshop-optimizer'), $text('tooltip_remove')); $fields .= $row('show_tooltip', __('Show tooltip on hover', 'ai-eshop-optimizer'), $yes('show_tooltip', __('Display the tooltip pill above the heart on hover. (Single product page uses the inline labels below instead.)', 'ai-eshop-optimizer'))); $card('wishlist-text', 'text-cursor-input', __('Heart text and tooltips', 'ai-eshop-optimizer'), $fields, array('description' => __('Sets the two hover tooltips and the two inline labels next to the heart on the product page, where the second label opens the side cart\'s Favourites tab.', 'ai-eshop-optimizer'))); $fields = $row('single_show_label', __('Show inline label', 'ai-eshop-optimizer'), $yes('single_show_label', __('Render a clickable text label next to the heart on the single product page.', 'ai-eshop-optimizer'))); $fields .= $row('single_label_add', __('Label — not yet in list', 'ai-eshop-optimizer'), $text('single_label_add'), __('Clicking either the heart or this label adds the product.', 'ai-eshop-optimizer')); $fields .= $row('single_label_view', __('Label — when in list', 'ai-eshop-optimizer'), $text('single_label_view'), __('Clicking this label opens the side cart\'s Favorites tab so the shopper can see what they\'ve saved.', 'ai-eshop-optimizer')); $card('wishlist-inline-labels', 'tag', __('Inline labels (single product page only)', 'ai-eshop-optimizer'), $fields, array('description' => __('Show a clickable text next to the heart on the product page, one to save the product and one to open the saved favourites.', 'ai-eshop-optimizer'))); $px = static function ($name, $min, $max) use ($d, $id_of) { return \Rooster\Admin\Ui::input($name, (string) (int) ($d[$name] ?? 0), array('id' => $id_of($name), 'type' => 'number', 'xs' => true, 'unit' => 'px', 'min' => $min, 'max' => $max)); }; $fills = array( 'page' => __('The page\'s colour, slightly see-through: it reads on any photo', 'ai-eshop-optimizer'), 'none' => __('Nothing: the card or the photo shows through', 'ai-eshop-optimizer'), 'theme' => __('The theme\'s background colour', 'ai-eshop-optimizer'), 'white' => __('White', 'ai-eshop-optimizer'), ); $fields = $row('ring', __('Round border', 'ai-eshop-optimizer'), $switch('ring', __('A circle around the heart, red with it once added', 'ai-eshop-optimizer'))); $fields .= $row('fill', __('The heart\'s background', 'ai-eshop-optimizer'), \Rooster\Admin\Ui::select('fill', $fills, (string) $d['fill'], array('id' => $id_of('fill'))), __('Behind the heart on product cards, and inside the circle.', 'ai-eshop-optimizer')); $fields .= $row('card_box', __('The background\'s size on cards', 'ai-eshop-optimizer'), $px('card_box', 32, 56), __('The square behind a card\'s heart, its corners the theme\'s. 44 px by default, the size of a comfortable touch.', 'ai-eshop-optimizer')); $fields .= $row('line', __('Heart line', 'ai-eshop-optimizer'), \Rooster\Admin\Ui::select('line', array( 'plain' => __('A plain black line, no shadow', 'ai-eshop-optimizer'), 'embossed' => __('Its colour, edged in black (embossed)', 'ai-eshop-optimizer'), ), 'embossed' === (string) ($d['line'] ?? 'plain') ? 'embossed' : 'plain', array('id' => $id_of('line'))), __('The heart on product cards, without the circle.', 'ai-eshop-optimizer')); $fields .= $row('color_empty', __('Empty (outline) color', 'ai-eshop-optimizer'), $colour('color_empty', '#c0c4c9')); $fields .= $row('color_filled', __('Filled (active) color', 'ai-eshop-optimizer'), $colour('color_filled', '#dd1419')); $fields .= $row('color_hover', __('Hover color', 'ai-eshop-optimizer'), $colour('color_hover', '#b3101a')); $fields .= $row('size', __('Icon size on desktop', 'ai-eshop-optimizer'), $px('size', 12, 60), __('Default heart size used everywhere. Range 12–60px.', 'ai-eshop-optimizer')); $fields .= $row('size_mobile', __('Icon size on mobile', 'ai-eshop-optimizer'), $px('size_mobile', 0, 60), __('Applied on viewports ≤ 768px wide. Set 0 to inherit the desktop size. Default 18px keeps the archive heart proportional to mobile card images.', 'ai-eshop-optimizer')); $card('wishlist-appearance', 'palette', __('Heart colours and size', 'ai-eshop-optimizer'), $fields, array('description' => __('Set the heart\'s colours for empty, saved and hover, its round border and fill, and its size on computers and phones.', 'ai-eshop-optimizer'))); $fields = ''; foreach (array( 'wishlist_type_product' => __('Products', 'ai-eshop-optimizer'), 'wishlist_type_brand' => __('Brands', 'ai-eshop-optimizer'), 'wishlist_type_category' => __('Categories', 'ai-eshop-optimizer'), 'wishlist_type_need' => __('Needs', 'ai-eshop-optimizer'), 'wishlist_type_blogpost' => __('Blogposts', 'ai-eshop-optimizer'), ) as $tkey => $tlabel) { $fields .= $row($tkey, $tlabel, $switch($tkey, __('Enabled', 'ai-eshop-optimizer'))); } $card('wishlist-enabled-wishlist-types', 'shapes', __('Enabled wishlist types', 'ai-eshop-optimizer'), $fields, array('description' => __('Choose which kinds of things shoppers can add to their favourites. Disabling a type hides its add-to-wishlist control, blocks its add endpoint, and removes its tab from the side-cart favourites panel. Saved favourites of a disabled type are kept (just hidden) and reappear if you re-enable it.', 'ai-eshop-optimizer'))); rooster_admin_band_close(); } private function tile($label, $value) { echo \Rooster\Admin\Ui::stat((string) $label, (string) $value); } private function render_source_stats_card($rows, $total) { $stats = array(); foreach ((array) $rows as $r) { $stats[] = array( 'source_type' => (string) $r->source_type, 'label' => $this->source_type_label((string) $r->source_type), 'added' => (int) $r->c, 'pct' => $total > 0 ? round(100 * ((int) $r->c) / $total, 1) : 0, ); } AIEO_Table::card(array( 'anchor' => 'wishlist-where-products-are-added-from', 'icon' => 'door-open', 'heading' => 'h2', 'title' => __('Where products are added from', 'ai-eshop-optimizer'), 'description' => __('Source-type breakdown: which surface the shopper was on when they hit the heart.', 'ai-eshop-optimizer'), 'col' => 1, 'page_id' => $this->get_id(), 'row_key' => 'source_type', 'density' => 'compact', 'rows' => $stats, 'empty' => __('No source-typed wishlist entries yet.', 'ai-eshop-optimizer'), 'columns' => array( array('key' => 'label', 'label' => __('Source type', 'ai-eshop-optimizer'), 'type' => 'text', 'subline' => 'source_type'), array('key' => 'added', 'label' => __('Times added', 'ai-eshop-optimizer'), 'type' => 'integer'), array( 'key' => 'pct', 'label' => __('Percentage', 'ai-eshop-optimizer'), 'type' => 'bar', 'format' => array('max' => 100, 'precision' => 1), 'suffix' => '%', ), ), )); } private function render_source_breakdown_card($rows) { $breakdown = array(); foreach ((array) $rows as $r) { $breakdown[] = array( 'source_id' => (int) $r->source_id, 'name' => $r->source_name ? (string) $r->source_name : __('(No name)', 'ai-eshop-optimizer'), 'id_line' => (int) $r->source_id > 0 ? 'ID: ' . (int) $r->source_id : '', 'source_type' => (string) $r->source_type, 'count' => (int) $r->c, ); } AIEO_Table::card(array( 'anchor' => 'wishlist-detailed-source-breakdown', 'icon' => 'table', 'heading' => 'h2', 'title' => __('Detailed source breakdown', 'ai-eshop-optimizer'), 'description' => __('Specific pages / categories where wishlist adds happened.', 'ai-eshop-optimizer'), 'col' => 1, 'page_id' => $this->get_id(), 'row_key' => array('source_type', 'source_id'), 'density' => 'compact', 'rows' => $breakdown, 'cap' => 20, 'capped' => count($breakdown) >= 20, 'empty' => __('No detailed source data yet.', 'ai-eshop-optimizer'), 'columns' => array( array('key' => 'name', 'label' => __('Source', 'ai-eshop-optimizer'), 'type' => 'text', 'subline' => 'id_line'), array('key' => 'source_type', 'label' => __('Type', 'ai-eshop-optimizer'), 'type' => 'code'), array('key' => 'count', 'label' => __('Count', 'ai-eshop-optimizer'), 'type' => 'integer'), ), )); } private function render_popular_products_card($rows) { $popular = array(); foreach ((array) $rows as $i => $r) { $pid = (int) $r->item_id; $title = $pid > 0 ? (string) get_the_title($pid) : ''; if ('' === $title) { $title = '#' . $pid . ' ' . __('(deleted)', 'ai-eshop-optimizer'); } $popular[] = array( 'n' => $i + 1, 'item_id' => $pid, 'title' => $title, 'id_line' => 'ID: ' . $pid, 'edit_url' => $pid > 0 ? admin_url('post.php?post=' . $pid . '&action=edit') : '', 'permalink' => $pid > 0 ? (string) get_permalink($pid) : '', 'added' => (int) $r->c, ); } AIEO_Table::card(array( 'anchor' => 'wishlist-most-popular-products', 'icon' => 'package', 'heading' => 'h2', 'title' => __('Most popular products', 'ai-eshop-optimizer'), 'description' => __('Top 20 products by wishlist additions — the demand signal your merch team can use to decide stock reorders.', 'ai-eshop-optimizer'), 'col' => 2, 'page_id' => $this->get_id(), 'row_key' => 'item_id', 'density' => 'compact', 'rows' => $popular, 'cap' => 20, 'capped' => count($popular) >= 20, 'empty' => __('No wishlist data yet — items will appear once customers start adding them.', 'ai-eshop-optimizer'), 'columns' => array( array('key' => 'n', 'label' => __('#', 'ai-eshop-optimizer'), 'type' => 'integer', 'width' => '50px'), array( 'key' => 'title', 'label' => __('Product', 'ai-eshop-optimizer'), 'type' => 'link', 'format' => array('href' => 'edit_url'), 'subline' => 'id_line', ), array('key' => 'added', 'label' => __('Times added', 'ai-eshop-optimizer'), 'type' => 'integer'), ), 'actions' => array( array( 'id' => 'view', 'label' => __('View', 'ai-eshop-optimizer'), 'visible' => static function ( $row ) { return '' !== $row['permalink']; }, 'href' => static function ( $row ) { return $row['permalink']; }, ), ), )); } private function source_type_label($key) { $map = array( 'single_product' => __('Product page', 'ai-eshop-optimizer'), 'archive' => __('Shop / category listing', 'ai-eshop-optimizer'), 'home' => __('Home page', 'ai-eshop-optimizer'), 'sidecart' => __('Side cart', 'ai-eshop-optimizer'), 'quickview' => __('Quick view', 'ai-eshop-optimizer'), 'cart' => __('Cart', 'ai-eshop-optimizer'), 'checkout' => __('Checkout', 'ai-eshop-optimizer'), 'related' => __('Related products', 'ai-eshop-optimizer'), 'upsells' => __('Upsells', 'ai-eshop-optimizer'), 'cross-sells' => __('Cross-sells', 'ai-eshop-optimizer'), 'same-needs' => __('Product needs', 'ai-eshop-optimizer'), 'recently_viewed' => __('Recently viewed', 'ai-eshop-optimizer'), 'search' => __('Search results', 'ai-eshop-optimizer'), ); return isset($map[$key]) ? $map[$key] : $key; } }