| 1 |
<?php |
| 2 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals. |
| 3 |
defined('ABSPATH') || die('Restricted Access'); |
| 4 |
foreach ($data['stats'] as $label => $stat) { |
| 5 |
$evolution = $stat['evolution']; |
| 6 |
$evolutionText = ($evolution !== 0 && !is_null($evolution)) ? (($evolution > 0 ? '+' : '').$evolution.' %') : ''; |
| 7 |
$colorClass = $evolution > 0 ? 'acym__color__green' : ($evolution < 0 ? 'acym__color__red' : ''); |
| 8 |
|
| 9 |
if ($stat['value'] == 0 && $evolution == 0 && $label === 'ACYM_BOUNCE_RATE') { |
| 10 |
continue; |
| 11 |
} |
| 12 |
?> |
| 13 |
<div class="acym__content acym__dashboard__stats__container cell text-center margin-bottom-2"> |
| 14 |
<div class="grid-x align-middle grid-container"> |
| 15 |
<div class="cell shrink acym__dashboard__stats__text__container"> |
| 16 |
<div class="acym__title acym__dashboard__stats__title"><?php echo esc_html(acym_translation($label)); ?></div> |
| 17 |
<span class="acym__dashboard__number"><?php echo esc_html($stat['value']); ?></span> |
| 18 |
<span class="acym__dashboard__percentage <?php echo esc_attr($colorClass); ?>"><?php echo esc_html($evolutionText); ?></span> |
| 19 |
</div> |
| 20 |
<div class="cell shrink"> |
| 21 |
<?php acym_tooltip( |
| 22 |
[ |
| 23 |
'hoveredText' => '<i class="'.$stat['icon'].' acym__dashboard__stats__icon"></i>', |
| 24 |
'textShownInTooltip' => acym_translation('ACYM_DASHBOARD_STATS_TOOLTIP'), |
| 25 |
] |
| 26 |
); ?> |
| 27 |
</div> |
| 28 |
</div> |
| 29 |
</div> |
| 30 |
<?php } ?> |
| 31 |
|