PluginProbe
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder / 51.1.78
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder v51.1.78
51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 51.1.46 51.1.47 51.1.49 All 37 releases
king-addons / includes / extensions / Smart_Links / templates / view-dashboard.php

view-dashboard.php in King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder 51.1.78, at includes/extensions/Smart_Links/templates/view-dashboard.php

125 lines 5.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Smart Links dashboard view.
4 *
5 * @package King_Addons
6 */
7
8 if (!defined('ABSPATH')) {
9 exit;
10 }
11
12 $total_links = 0;
13 $count = wp_count_posts(\King_Addons\Smart_Links\Smart_Links::POST_TYPE);
14 if ($count && isset($count->publish)) {
15 $total_links = (int) $count->publish;
16 }
17
18 $totals = $service->get_totals(7);
19 $top_link = $service->get_top_link(7);
20 $recent_links = get_posts([
21 'post_type' => \King_Addons\Smart_Links\Smart_Links::POST_TYPE,
22 'post_status' => 'publish',
23 'posts_per_page' => 5,
24 'orderby' => 'date',
25 'order' => 'DESC',
26 ]);
27 ?>
28
29 <div class="ka-stats-grid">
30 <div class="ka-stat-card">
31 <div class="ka-stat-label"><?php esc_html_e('Total Links', 'king-addons'); ?></div>
32 <div class="ka-stat-value"><?php echo esc_html(number_format_i18n($total_links)); ?></div>
33 </div>
34 <div class="ka-stat-card">
35 <div class="ka-stat-label"><?php esc_html_e('Clicks (7 days)', 'king-addons'); ?></div>
36 <div class="ka-stat-value"><?php echo esc_html(number_format_i18n($totals['clicks'])); ?></div>
37 </div>
38 <div class="ka-stat-card">
39 <div class="ka-stat-label"><?php esc_html_e('Unique (7 days)', 'king-addons'); ?></div>
40 <div class="ka-stat-value"><?php echo esc_html(number_format_i18n($totals['unique_clicks'])); ?></div>
41 </div>
42 <div class="ka-stat-card">
43 <div class="ka-stat-label"><?php esc_html_e('Top Link', 'king-addons'); ?></div>
44 <?php if ($top_link && !empty($top_link['link'])) :
45 $slug = (string) get_post_meta($top_link['link']->ID, \King_Addons\Smart_Links\Smart_Links::META_SLUG, true);
46 $short_url = $service->build_short_url($slug);
47 ?>
48 <div class="ka-stat-value" style="font-size:16px;line-height:1.3">
49 <div><?php echo esc_html($top_link['link']->post_title); ?></div>
50 <small><?php echo esc_html($short_url); ?> · <?php echo esc_html(number_format_i18n($top_link['clicks'])); ?></small>
51 </div>
52 <?php else : ?>
53 <div class="ka-stat-value" style="font-size:16px;line-height:1.3">
54 <?php esc_html_e('No data yet', 'king-addons'); ?>
55 </div>
56 <?php endif; ?>
57 </div>
58 </div>
59
60 <div class="ka-card">
61 <div class="ka-card-header">
62 <span class="dashicons dashicons-clock green"></span>
63 <h2><?php esc_html_e('Latest Links', 'king-addons'); ?></h2>
64 </div>
65 <div class="ka-card-body" style="padding:0;">
66 <?php if (empty($recent_links)) : ?>
67 <div class="ka-empty">
68 <span class="dashicons dashicons-admin-links"></span>
69 <p><?php esc_html_e('Create your first smart link to start tracking clicks.', 'king-addons'); ?></p>
70 </div>
71 <?php else : ?>
72 <table class="ka-table">
73 <thead>
74 <tr>
75 <th><?php esc_html_e('Link', 'king-addons'); ?></th>
76 <th><?php esc_html_e('Short URL', 'king-addons'); ?></th>
77 <th class="text-center"><?php esc_html_e('Clicks', 'king-addons'); ?></th>
78 <th><?php esc_html_e('Status', 'king-addons'); ?></th>
79 </tr>
80 </thead>
81 <tbody>
82 <?php foreach ($recent_links as $link) :
83 $slug = (string) get_post_meta($link->ID, \King_Addons\Smart_Links\Smart_Links::META_SLUG, true);
84 $short_url = $service->build_short_url($slug);
85 $status = (string) get_post_meta($link->ID, \King_Addons\Smart_Links\Smart_Links::META_STATUS, true);
86 $clicks = (int) get_post_meta($link->ID, \King_Addons\Smart_Links\Smart_Links::META_CLICKS, true);
87 ?>
88 <tr>
89 <td class="ka-link-list-title">
90 <strong><?php echo esc_html($link->post_title); ?></strong>
91 <small><?php echo esc_html($slug); ?></small>
92 </td>
93 <td>
94 <a href="<?php echo esc_url($short_url); ?>" class="ka-short-url-text" target="_blank" rel="noopener">
95 <?php echo esc_html($short_url); ?>
96 </a>
97 </td>
98 <td class="text-center"><?php echo esc_html(number_format_i18n($clicks)); ?></td>
99 <td>
100 <span class="ka-status <?php echo $status === 'disabled' ? 'ka-status-disabled' : 'ka-status-enabled'; ?>">
101 <span class="ka-status-dot"></span>
102 <?php echo $status === 'disabled' ? esc_html__('Disabled', 'king-addons') : esc_html__('Active', 'king-addons'); ?>
103 </span>
104 </td>
105 </tr>
106 <?php endforeach; ?>
107 </tbody>
108 </table>
109 <?php endif; ?>
110 </div>
111 </div>
112
113 <div class="ka-upgrade-card">
114 <h2><?php esc_html_e('Unlock Pro Analytics', 'king-addons'); ?></h2>
115 <p><?php esc_html_e('Get geo insights, device breakdowns, referrer domains, A/B rotation, and automation rules.', 'king-addons'); ?></p>
116 <ul>
117 <li><?php esc_html_e('Country, device, and browser analytics', 'king-addons'); ?></li>
118 <li><?php esc_html_e('A/B destination testing and rules engine', 'king-addons'); ?></li>
119 <li><?php esc_html_e('Expiration, password protection, and deep links', 'king-addons'); ?></li>
120 </ul>
121 <a href="https://kingaddons.com/pricing/" target="_blank" class="ka-btn ka-btn-pink">
122 <?php esc_html_e('Upgrade to Pro', 'king-addons'); ?>
123 </a>
124 </div>
125