layout
3 years ago
learn
3 years ago
pdf
3 years ago
settings
3 years ago
table
3 years ago
campaign_builder.php
3 years ago
migration_running.php
3 years ago
newer_database.php
3 years ago
quick_stats.php
3 years ago
real_time.php
3 years ago
quick_stats.php
45 lines
| 1 | <?php $class = $is_filtered ? 'quick-stats filtered' : 'quick-stats' ?> |
| 2 | <?php $class .= ' total-of-' . count($stats) ?> |
| 3 | <div id="quick-stats" class="<?php esc_attr_e($class); ?>"> |
| 4 | <?php foreach ($stats as $stat): ?> |
| 5 | <div class="stat <?php esc_attr_e($stat['class']); ?>"> |
| 6 | <div class="metric"> |
| 7 | <?php esc_html_e($stat['title']); ?> |
| 8 | <span class="dashicons dashicons-filter"></span> |
| 9 | <svg class="circle" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> |
| 10 | <circle cx="50" cy="50" r="50"/> |
| 11 | </svg> |
| 12 | </div> |
| 13 | <div class="values"> |
| 14 | <span class="count" test-value="<?php esc_attr_e(strip_tags($stat['count'])); ?>"> |
| 15 | <?php echo wp_kses($stat['count'], ['span' => []]); ?> |
| 16 | <?php if ($is_filtered) : ?> |
| 17 | <span class="unfiltered"> / <?php echo wp_kses($stat['unfiltered'], ['span' => []]); ?></span> |
| 18 | <?php endif; ?> |
| 19 | </span> |
| 20 | </div> |
| 21 | <span class="growth"> |
| 22 | <?php $direction = $stat['growth'] < 0 ? 'down' : null ?> |
| 23 | <?php |
| 24 | $is_growth_good = $stat['is_growth_good'] ?? true; |
| 25 | $is_growing = $stat['growth'] > 0; |
| 26 | $bad = ''; |
| 27 | |
| 28 | if ( ( $is_growth_good && ! $is_growing ) || ( ! $is_growth_good && $is_growing ) ) { |
| 29 | $bad = 'bad'; |
| 30 | } |
| 31 | |
| 32 | if ( $stat['growth'] == 0 ) { |
| 33 | $bad = ''; |
| 34 | } |
| 35 | ?> |
| 36 | <span class="percentage <?php esc_attr_e($direction) ?> <?php esc_attr_e($bad) ?>" |
| 37 | test-value="<?php esc_attr_e($stat['growth']); ?>"> |
| 38 | <span class="dashicons dashicons-arrow-up-alt growth-arrow"></span><?php echo absint(number_format($stat['growth'])); ?>% |
| 39 | </span> |
| 40 | <span class="period-label"><?php esc_html_e('vs. previous period', 'independent-analytics') ?></span> |
| 41 | </span> |
| 42 | </div> |
| 43 | <?php endforeach; ?> |
| 44 | </div> |
| 45 |