__('Star Ratings settings saved.', 'ai-eshop-optimizer'))); } public function ajax_save_appearance() { AIEO_DMM::verify_ajax_request(); $cur = AIEO_Ratings::get_settings(); foreach (array('color_empty', 'color_filled', 'color_hover', 'color_pre_rated') as $k) { if (isset($_POST[$k])) { $v = sanitize_hex_color(wp_unslash((string) $_POST[$k])); if ($v !== null && $v !== '') { $cur[$k] = $v; } } } if (isset($_POST['size'])) { $cur['size'] = max(8, min(96, (int) wp_unslash($_POST['size']))); } foreach (array('size_mobile', 'size_single') as $k) { if (isset($_POST[$k])) { $v = (int) wp_unslash($_POST[$k]); if ($v <= 0) { $cur[$k] = 0; } else { $cur[$k] = max(8, min(96, $v)); } } } if (isset($_POST['gap'])) { $cur['gap'] = max(0, min(20, (int) wp_unslash($_POST['gap']))); } if (isset($_POST['gap_mobile'])) { $v = (int) wp_unslash($_POST['gap_mobile']); $cur['gap_mobile'] = $v <= 0 ? 0 : max(0, min(20, $v)); } if (isset($_POST['size_archive'])) { $v = (int) wp_unslash($_POST['size_archive']); $cur['size_archive'] = $v <= 0 ? 0 : max(8, min(96, $v)); } if (isset($_POST['gap_archive'])) { $cur['gap_archive'] = max(0, min(20, (int) wp_unslash($_POST['gap_archive']))); } if (isset($_POST['gap_single'])) { $cur['gap_single'] = max(0, min(20, (int) wp_unslash($_POST['gap_single']))); } foreach (array('caption_size', 'caption_size_mobile', 'caption_size_archive', 'caption_size_archive_mobile') as $k) { if (isset($_POST[$k])) { $cur[$k] = max(8, min(48, (int) wp_unslash($_POST[$k]))); } } update_option(AIEO_Ratings::SETTINGS_OPTION, $cur, false); wp_send_json_success(array('message' => __('Star Ratings appearance saved.', 'ai-eshop-optimizer'))); } public function render_subtab() { global $wpdb; $events = $wpdb->prefix . 'aieo_ratings'; $stats = $wpdb->prefix . 'aieo_rating_stats'; $events_exists = $wpdb->get_var($wpdb->prepare('SHOW TABLES LIKE %s', $events)) === $events; $stats_exists = $wpdb->get_var($wpdb->prepare('SHOW TABLES LIKE %s', $stats)) === $stats; $moved = wp_kses_post(sprintf( __('Looking for the Star Ratings display settings (behavior, captions, colors, sizes)? They now live under %1$sVisual Display → Star Ratings Display%2$s.', 'ai-eshop-optimizer'), '', '' )); if (!$events_exists || !$stats_exists) { $close = $this->card_open(array( 'anchor' => 'ratings-overview', 'icon' => 'layout-dashboard', 'title' => __('Overview', 'ai-eshop-optimizer'), 'description' => __('Totals of the star ratings shoppers gave your products: how many ratings, rated products and voters.', 'ai-eshop-optimizer'), )); $this->state('not-set-up', __('No rating tables yet — they install lazily on the next frontend hit. Visit any frontend page once and the analytics will appear here.', 'ai-eshop-optimizer')); $this->note($moved, 'mono'); echo $close; return; } $total_events = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$events}"); $unique_voters_u = (int) $wpdb->get_var("SELECT COUNT(DISTINCT user_id) FROM {$events} WHERE user_id > 0"); $unique_voters_s = (int) $wpdb->get_var("SELECT COUNT(DISTINCT session_token) FROM {$events} WHERE user_id = 0 AND session_token <> ''"); $rated_products = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$stats} WHERE count_total > 0"); $row_global = $wpdb->get_row("SELECT SUM(sum_total) AS s, SUM(count_total) AS c FROM {$stats}", ARRAY_A); $global_avg = ($row_global && (int) $row_global['c'] > 0) ? round((float) $row_global['s'] / (int) $row_global['c'], 2) : 0; $top = $wpdb->get_results("SELECT product_id, count_total, sum_total FROM {$stats} WHERE count_total >= 3 ORDER BY (sum_total / count_total) DESC, count_total DESC LIMIT 20"); $bottom = $wpdb->get_results("SELECT product_id, count_total, sum_total FROM {$stats} WHERE count_total >= 3 ORDER BY (sum_total / count_total) ASC, count_total DESC LIMIT 20"); $most = $wpdb->get_results("SELECT product_id, count_total, sum_total FROM {$stats} ORDER BY count_total DESC LIMIT 20"); $by_source = $wpdb->get_results("SELECT source, COUNT(*) AS c FROM {$events} WHERE source <> '' GROUP BY source ORDER BY c DESC LIMIT 10"); $row_dist = $wpdb->get_row("SELECT SUM(n1) AS n1, SUM(n2) AS n2, SUM(n3) AS n3, SUM(n4) AS n4, SUM(n5) AS n5 FROM {$stats}", ARRAY_A); $this->band_open(array('cols' => 1)); $close = $this->card_open(array( 'anchor' => 'ratings-overview', 'icon' => 'layout-dashboard', 'title' => __('Overview', 'ai-eshop-optimizer'), 'description' => __('Totals of the star ratings shoppers gave your products: how many ratings, rated products and voters.', 'ai-eshop-optimizer'), )); echo '
'; echo wp_kses_post(sprintf( __('%1$s of %2$s published products carry at least one rating — %3$s of the catalogue.', 'ai-eshop-optimizer'), '' . esc_html(number_format_i18n($covered)) . '', '' . esc_html(number_format_i18n($total_published)) . '', esc_html($this->share_label($covered, $total_published)) )); echo ' '; if ($verdict === 'healthy') { $this->echo_pill(__('Healthy coverage', 'ai-eshop-optimizer'), true); } elseif ($verdict === 'building') { $this->echo_pill(__('Building', 'ai-eshop-optimizer'), false); } else { $this->echo_pill(__('Too thin to rank on', 'ai-eshop-optimizer'), false); } echo '
'; $unlocks = array( 1 => __('A star average appears on the product for shoppers.', 'ai-eshop-optimizer'), 3 => __('Enough votes to show up in the Top rated / Lowest rated tables below.', 'ai-eshop-optimizer'), $prior_votes => __('The product\'s own rating starts to outweigh the shop average when we rank it — and the low-rating safety check can apply.', 'ai-eshop-optimizer'), 10 => __('A steady signal: one unhappy customer no longer moves the average much.', 'ai-eshop-optimizer'), ); $ladder = array(); foreach ($rungs as $n) { $cnt = isset($at[$n]) ? (int) $at[$n] : 0; $ladder[] = array( 'depth' => sprintf( _n('%s vote or more', '%s votes or more', $n, 'ai-eshop-optimizer'), number_format_i18n($n) ), 'products' => $cnt, 'share' => $this->share_label($cnt, $total_published), 'share_pct' => $total_published > 0 ? round(100 * $cnt / $total_published, 1) : 0.0, 'unlocks' => isset($unlocks[$n]) ? $unlocks[$n] : '', ); } AIEO_Table::render(array( 'caption' => __('Catalogue rating coverage', 'ai-eshop-optimizer'), 'page_id' => $this->get_id(), 'row_key' => 'depth', 'sortable' => false, 'density' => 'compact', 'rows' => $ladder, 'empty' => __('No published products to measure.', 'ai-eshop-optimizer'), 'columns' => array( array('key' => 'depth', 'label' => __('Vote depth', 'ai-eshop-optimizer'), 'type' => 'text', 'width' => '180px'), array('key' => 'products', 'label' => __('Products', 'ai-eshop-optimizer'), 'type' => 'integer', 'width' => '110px'), array( 'key' => 'share', 'label' => __('Of catalogue', 'ai-eshop-optimizer'), 'type' => 'text', 'width' => '150px', 'sort_key' => 'share_pct', ), array('key' => 'unlocks', 'label' => __('What that unlocks', 'ai-eshop-optimizer'), 'type' => 'text', 'tone' => 'muted'), ), )); $orphans = (int) $rated_rows_all - $covered; if ($orphans > 0) { $this->note(esc_html(sprintf( _n( '%s rating record points at something that is not a published product (a draft, a deleted product, or a brand) and is left out of the figures above.', '%s rating records point at something that is not a published product (drafts, deleted products, or brands) and are left out of the figures above.', $orphans, 'ai-eshop-optimizer' ), number_format_i18n($orphans) )), 'mono'); } ob_start(); if ($verdict === 'healthy') { echo '' . esc_html__('This is working.', 'ai-eshop-optimizer') . ' ' . esc_html(sprintf( _n( '%1$s product has %2$s votes or more, which is enough for ratings to genuinely tell your catalogue apart when we rank it. Nothing to fix here — just keep the votes coming in.', '%1$s products have %2$s votes or more, which is enough for ratings to genuinely tell your catalogue apart when we rank it. Nothing to fix here — just keep the votes coming in.', $deep, 'ai-eshop-optimizer' ), number_format_i18n($deep), number_format_i18n($prior_votes) )) . '
'; } else { echo '' . esc_html__('What this means for ranking.', 'ai-eshop-optimizer') . ' ' . esc_html(sprintf( __('Until a product has about %s votes we treat its rating as "probably average" and lean on the shop-wide average instead. That is deliberate: one 5-star click should not outrank a product a hundred people liked.', 'ai-eshop-optimizer'), number_format_i18n($prior_votes) )) . '
'; echo '' . esc_html(sprintf( _n( 'Right now %1$s product out of %3$s clears that bar, so ratings have almost nothing to sort — they are still doing their job on the page as social proof, they just are not ordering your catalogue yet.', 'Right now %1$s products out of %3$s clear that bar, so ratings have almost nothing to sort — they are still doing their job on the page as social proof, they just are not ordering your catalogue yet.', $deep, 'ai-eshop-optimizer' ), number_format_i18n($deep), number_format_i18n($prior_votes), number_format_i18n($total_published) )) . '
'; echo '' . esc_html(sprintf( _n( 'The safety check that stops us promoting a badly-rated product also needs %1$s votes — today it can act on %2$s product.', 'The safety check that stops us promoting a badly-rated product also needs %1$s votes — today it can act on %2$s products.', isset($at[$veto_votes]) ? (int) $at[$veto_votes] : 0, 'ai-eshop-optimizer' ), number_format_i18n($veto_votes), number_format_i18n(isset($at[$veto_votes]) ? (int) $at[$veto_votes] : 0) )) . '
'; echo '' . esc_html__('None of this is broken.', 'ai-eshop-optimizer') . ' ' . esc_html(sprintf( _n( 'Thin ratings are where every shop starts — you have %s vote so far. The fix is not a setting, it is asking more customers to rate.', 'Thin ratings are where every shop starts — you have %s votes so far. The fix is not a setting, it is asking more customers to rate.', $votes_total, 'ai-eshop-optimizer' ), number_format_i18n($votes_total) )) . '
'; } $consequence = (string) ob_get_clean(); $first = strpos($consequence, ''); $head = substr($consequence, 3, $first - 3); $rest = substr($consequence, $first + 4); echo AIEO_DMM_UI::notice($head, 'healthy' === $verdict ? 'success' : 'info', array('detail' => $rest)); $wc_slug = defined('AIEO_Ratings::SOURCE_WC_REVIEW') ? (string) constant('AIEO_Ratings::SOURCE_WC_REVIEW') : 'wc_review'; $wc_mirrored = 0; foreach ((array) $by_source as $s) { $slug = is_object($s) ? (string) $s->source : (is_array($s) && isset($s['source']) ? (string) $s['source'] : ''); if ($slug === $wc_slug) { $wc_mirrored = is_object($s) ? (int) $s->c : (int) $s['c']; break; } } if (class_exists('WooCommerce') && get_option('woocommerce_enable_reviews') !== 'yes') { if ($wc_mirrored > 0) { $wc_off = esc_html(sprintf( _n( 'Note: WooCommerce product reviews are switched off on this shop (WooCommerce → Settings → Products → Enable product reviews), so no new review can come in through that route. The %s review already approved here is still counted in the figures above.', 'Note: WooCommerce product reviews are switched off on this shop (WooCommerce → Settings → Products → Enable product reviews), so no new review can come in through that route. The %s reviews already approved here are still counted in the figures above.', $wc_mirrored, 'ai-eshop-optimizer' ), number_format_i18n($wc_mirrored) )); } else { $wc_off = esc_html__('Note: WooCommerce product reviews are switched off on this shop (WooCommerce → Settings → Products → Enable product reviews), so no new ratings can be collected through the native review route — the default rating source on most shops.', 'ai-eshop-optimizer'); } $this->note($wc_off, 'warning'); } echo $close; } private function render_needs_ratings_card() { $result = $this->fetch_products_needing_ratings(15); $rows = is_array($result) && empty($result['note']) && isset($result['rows']) && is_array($result['rows']) ? $result['rows'] : array(); $close = $this->card_open(array( 'anchor' => 'ratings-where-to-ask-first', 'icon' => 'target', 'title' => __('Where to ask first', 'ai-eshop-optimizer'), 'description' => __('Products shoppers are already adding to the basket that carry no rating (or just one). Asking these buyers is the cheapest way to turn a flat rating signal into a useful one — the same shortlist the AI assistant builds from aieo/find-products-needing-ratings.', 'ai-eshop-optimizer'), 'flush' => !empty($rows), )); if ($result === null) { $this->state('not-set-up', __('The shortlist could not be built on this install — the ability that defines it is not available here.', 'ai-eshop-optimizer')); echo $close; return; } if (!empty($result['note'])) { $this->note(esc_html((string) $result['note'])); echo $close; return; } if (empty($rows)) { $this->state('first-use', __('No cart-adds recorded in the last 90 days, so there is no targeted shortlist to show. Ask on your best sellers instead.', 'ai-eshop-optimizer')); echo $close; return; } $shortlist = array(); $i = 0; foreach ($rows as $r) { $i++; $pid = isset($r['product_id']) ? (int) $r['product_id'] : 0; $title = isset($r['title']) ? (string) $r['title'] : ''; if ($title === '') { $title = '#' . $pid . ' ' . __('(deleted)', 'ai-eshop-optimizer'); } $votes = isset($r['votes']) ? (int) $r['votes'] : 0; $shortlist[] = array( 'n' => $i, 'product_id' => $pid, 'title' => $this->shorten($title), 'title_full' => $title, 'id_line' => 'ID: ' . $pid, 'cart_adds' => isset($r['cart_adds']) ? (int) $r['cart_adds'] : 0, 'votes' => $votes, 'votes_label' => $votes > 0 ? sprintf( _n('%s vote', '%s votes', $votes, 'ai-eshop-optimizer'), number_format_i18n($votes) ) : __('no ratings', 'ai-eshop-optimizer'), 'edit_url' => $pid > 0 ? admin_url('post.php?post=' . $pid . '&action=edit') : '', 'permalink' => isset($r['permalink']) ? (string) $r['permalink'] : '', ); } AIEO_Table::render(array( 'caption' => __('Where to ask first', 'ai-eshop-optimizer'), 'page_id' => $this->get_id(), 'row_key' => 'product_id', 'density' => 'compact', 'rows' => $shortlist, 'caps' => array('search' => true), 'filters' => array(array('key' => 'votes_label', 'label' => __('Votes', 'ai-eshop-optimizer'), 'kind' => 'values', 'control' => 'select')), 'per_page' => 0, 'empty' => __('No cart-adds recorded in the last 90 days.', 'ai-eshop-optimizer'), 'columns' => array( array('key' => 'n', 'label' => '#', 'type' => 'integer', 'width' => '50px'), array( 'key' => 'title', 'label' => __('Product', 'ai-eshop-optimizer'), 'type' => 'link', 'format' => array('href' => 'edit_url'), 'subline' => 'id_line', 'sort_key' => 'title_full', 'tooltip' => 'title_full', ), array('key' => 'title_full', 'label' => __('Product', 'ai-eshop-optimizer'), 'type' => 'text', 'hidden' => true), array('key' => 'cart_adds', 'label' => __('Cart adds (90 days)', 'ai-eshop-optimizer'), 'type' => 'integer'), array( 'key' => 'votes_label', 'label' => __('Votes', 'ai-eshop-optimizer'), 'type' => 'badge', 'sort_key' => 'votes', ), array('key' => 'votes', 'label' => __('Votes', 'ai-eshop-optimizer'), 'type' => 'integer', 'hidden' => true), ), 'actions' => array( array( 'id' => 'view', 'label' => __('View', 'ai-eshop-optimizer'), 'description' => __('Opens the product on the shop.', 'ai-eshop-optimizer'), 'href' => static function ($row) { return isset($row['permalink']) ? (string) $row['permalink'] : ''; }, 'visible' => static function ($row) { return ! empty($row['permalink']); }, ), ), )); echo $close; } private function fetch_products_needing_ratings($limit) { $cls = 'AIEO\\Claude\\Abilities\\FindProductsNeedingRatingsAbility'; if (!class_exists($cls)) { $base = AIEO_DIR . 'includes/claude/abilities/'; foreach (array('class-period-helper.php', 'class-find-products-needing-ratings-ability.php') as $file) { if (file_exists($base . $file)) { require_once $base . $file; } } } if (!class_exists($cls) || !is_callable(array($cls, 'execute'))) { return null; } $out = call_user_func(array($cls, 'execute'), array( 'period' => 'last_90_days', 'min_cart_adds' => 1, 'max_votes' => 1, 'limit' => max(1, (int) $limit), )); return is_array($out) ? $out : null; } private function stats_has_object_type() { static $has = null; if ($has !== null) { return $has; } global $wpdb; $has = ((int) $wpdb->get_var($wpdb->prepare( "SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = %s AND COLUMN_NAME = 'object_type'", $wpdb->prefix . 'aieo_rating_stats' ))) > 0; return $has; } private function share_label($count, $total) { $count = (int) $count; $total = (int) $total; if ($total <= 0) { return number_format_i18n(0, 1) . '%'; } $pct = 100 * $count / $total; if ($count > 0 && $pct < 0.05) { return '< ' . number_format_i18n(0.1, 1) . '%'; } return number_format_i18n(round($pct, 1), 1) . '%'; } private function echo_pill($text, $good = false) { if (class_exists('\Rooster\Admin\Ui')) { echo \Rooster\Admin\Ui::badge((string) $text, $good ? 'success' : 'mono'); return; } echo '' . esc_html((string) $text) . ''; } private function shorten($text, $len = 70) { $text = (string) $text; if (function_exists('mb_strlen') && function_exists('mb_substr')) { return mb_strlen($text, 'UTF-8') > $len ? mb_substr($text, 0, $len, 'UTF-8') . '…' : $text; } return strlen($text) > $len ? substr($text, 0, $len) . '…' : $text; } private function render_distribution_card($row) { $row = is_array($row) ? $row : array(); $n = array( 1 => (int) ($row['n1'] ?? 0), 2 => (int) ($row['n2'] ?? 0), 3 => (int) ($row['n3'] ?? 0), 4 => (int) ($row['n4'] ?? 0), 5 => (int) ($row['n5'] ?? 0), ); $total = array_sum($n); $close = $this->card_open(array( 'anchor' => 'ratings-site-wide-rating-distribution', 'icon' => 'chart-column', 'title' => __('Vote distribution per star', 'ai-eshop-optimizer'), 'description' => __('How votes break down across the 5 stars. Bigger 4–5 buckets vs 1–2 = healthy product mix.', 'ai-eshop-optimizer'), 'flush' => true, )); $dist = array(); for ($i = 5; $i >= 1; $i--) { $dist[] = array( 'rating' => $i, 'stars' => \Rooster\Admin\Ui::stars($i, array('sm' => true)), 'share' => $total > 0 ? round(100 * $n[$i] / $total, 1) : 0, 'votes' => $n[$i], ); } AIEO_Table::render(array( 'caption' => __('Vote distribution per star', 'ai-eshop-optimizer'), 'page_id' => $this->get_id(), 'row_key' => 'rating', 'sortable' => false, 'density' => 'compact', 'rows' => $dist, 'empty' => __('No votes yet.', 'ai-eshop-optimizer'), 'columns' => array( array('key' => 'stars', 'label' => __('Rating', 'ai-eshop-optimizer'), 'type' => 'html', 'width' => 'xs', 'nowrap' => true), array( 'key' => 'share', 'label' => __('Distribution', 'ai-eshop-optimizer'), 'type' => 'bar', 'format' => array('max' => 100, 'precision' => 1), 'suffix' => '%', ), array('key' => 'votes', 'label' => __('Votes', 'ai-eshop-optimizer'), 'type' => 'integer', 'width' => '120px'), ), )); echo $close; } private function render_source_card($rows, $total_events) { $close = $this->card_open(array( 'anchor' => 'ratings-where-ratings-come-from', 'icon' => 'door-open', 'title' => __('Where ratings come from', 'ai-eshop-optimizer'), 'description' => __('Source breakdown: which surface the shopper was on when they rated.', 'ai-eshop-optimizer'), 'flush' => true, )); $sources = array(); foreach ((array) $rows as $r) { $sources[] = array( 'source' => (string) $r->source, 'events' => (int) $r->c, 'share' => $total_events > 0 ? round(100 * ((int) $r->c) / $total_events, 1) : 0, ); } AIEO_Table::render(array( 'caption' => __('Where ratings come from', 'ai-eshop-optimizer'), 'page_id' => $this->get_id(), 'row_key' => 'source', 'density' => 'compact', 'rows' => $sources, 'empty' => __('No rating events yet.', 'ai-eshop-optimizer'), 'columns' => array( array('key' => 'source', 'label' => __('Source', 'ai-eshop-optimizer'), 'type' => 'code'), array('key' => 'events', 'label' => __('Events', 'ai-eshop-optimizer'), 'type' => 'integer'), array( 'key' => 'share', 'label' => __('Percentage', 'ai-eshop-optimizer'), 'type' => 'bar', 'format' => array('max' => 100, 'precision' => 1), 'suffix' => '%', ), ), )); echo $close; } private function render_top_card($title, $rows, $show_avg, $anchor = '', $icon = '', $description = '') { $close = $this->card_open(array( 'anchor' => (string) $anchor, 'icon' => (string) $icon, 'title' => (string) $title, 'description' => (string) $description, 'flush' => !empty($rows), )); if (empty($rows)) { $this->state('first-use', __('Not enough rating data yet (each product needs at least 3 votes to appear here).', 'ai-eshop-optimizer')); echo $close; return; } $list = array(); foreach ($rows as $i => $r) { $pid = (int) $r->product_id; $count = (int) $r->count_total; $sum = (int) $r->sum_total; $title = $pid > 0 ? get_the_title($pid) : ''; if ($title === '' || $title === null) { $title = '#' . $pid . ' ' . __('(deleted)', 'ai-eshop-optimizer'); } $list[] = array( 'n' => $i + 1, 'product_id' => $pid, 'title' => $title, 'id_line' => 'ID: ' . $pid, 'avg' => $count > 0 ? round($sum / $count, 2) : 0, 'votes' => $count, 'edit_url' => $pid > 0 ? admin_url('post.php?post=' . $pid . '&action=edit') : '', 'permalink' => $pid > 0 ? get_permalink($pid) : '', ); } AIEO_Table::render(array( 'caption' => (string) $title, 'page_id' => $this->get_id(), 'row_key' => 'product_id', 'density' => 'compact', 'rows' => $list, 'caps' => array('search' => true), 'per_page' => 0, 'empty' => __('No rated products in this list yet.', 'ai-eshop-optimizer'), 'columns' => array( array('key' => 'n', 'label' => '#', 'type' => 'integer', 'width' => '50px'), array( 'key' => 'title', 'label' => __('Product', 'ai-eshop-optimizer'), 'type' => 'link', 'format' => array('href' => 'edit_url'), 'subline' => 'id_line', 'truncate' => 70, 'tooltip' => true, ), array('key' => 'avg', 'label' => __('Avg', 'ai-eshop-optimizer'), 'type' => 'decimal', 'format' => array('precision' => 2)), array('key' => 'votes', 'label' => __('Votes', 'ai-eshop-optimizer'), 'type' => 'integer'), ), 'actions' => array( array( 'id' => 'view', 'label' => __('View', 'ai-eshop-optimizer'), 'description' => __('Opens the product on the shop.', 'ai-eshop-optimizer'), 'href' => static function ($row) { return isset($row['permalink']) ? (string) $row['permalink'] : ''; }, 'visible' => static function ($row) { return ! empty($row['permalink']); }, ), ), )); echo $close; unset($show_avg); } private function card_open(array $c) { list($open, $close) = AIEO_DMM_UI::card($c); echo $open; return $close; } private function band_open(array $opts) { if (function_exists('rooster_admin_band_open')) { rooster_admin_band_open($opts); } } private function band_close() { if (function_exists('rooster_admin_band_close')) { rooster_admin_band_close(); } } private function note($html, $tone = 'info') { if (class_exists('\Rooster\Admin\Ui')) { echo \Rooster\Admin\Ui::notice($html, $tone, array('inline' => true)); return; } echo '' . $html . '
'; } private function state($kind, $title) { if (class_exists('\Rooster\Admin\States')) { echo \Rooster\Admin\States::state((string) $kind, array('title' => (string) $title, 'compact' => true)); return; } echo '' . esc_html((string) $title) . '
'; } private function tile($label, $value) { if (class_exists('\Rooster\Admin\Ui')) { echo \Rooster\Admin\Ui::stat((string) $label, (string) $value); return; } echo '