| 1 |
<?php |
| 2 |
|
| 3 |
use ButtonGenerator\Admin\Link; |
| 4 |
|
| 5 |
defined( 'ABSPATH' ) || exit; |
| 6 |
|
| 7 |
$prefix = 'button_generator'; |
| 8 |
// Counters |
| 9 |
$option_name_view = '_' . $prefix . '_view_counter_' . $id; |
| 10 |
$option_name_action = '_' . $prefix . '_action_counter_' . $id; |
| 11 |
$tool_view = get_option( $option_name_view, '0' ); |
| 12 |
$tool_action = get_option( $option_name_action, '0' ); |
| 13 |
if ( ! empty( $tool_view ) ) { |
| 14 |
$conversion = round( $tool_action / $tool_view * 100, 2 ) . '%'; |
| 15 |
} else { |
| 16 |
$conversion = '0%'; |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
?> |
| 21 |
|
| 22 |
<div class="wpie-sidebar"> |
| 23 |
|
| 24 |
<h2 class="wpie-title"><?php esc_html_e( 'Analytics', 'button-generation' ); ?></h2> |
| 25 |
<div class="wpie-fields__box"> |
| 26 |
<div class="wpie-field"> |
| 27 |
<div class="wpie-field__title"><?php esc_html_e( 'Views', 'button-generation' ); ?></div> |
| 28 |
<label class="wpie-field__label has-icon"> |
| 29 |
<span class="wpie-icon wpie_icon-eye-open"></span> |
| 30 |
<input type="text" id="tool_view" value="<?php echo absint( $tool_view ); ?>" readonly> |
| 31 |
</label> |
| 32 |
</div> |
| 33 |
|
| 34 |
<div class="wpie-field"> |
| 35 |
<div class="wpie-field__title"><?php esc_html_e( 'Actions', 'button-generation' ); ?></div> |
| 36 |
<label class="wpie-field__label has-icon"> |
| 37 |
<span class="wpie-icon wpie_icon-target"></span> |
| 38 |
<input type="text" id="tool_action" value="<?php echo absint( $tool_action ); ?>" readonly> |
| 39 |
</label> |
| 40 |
</div> |
| 41 |
|
| 42 |
<div class="wpie-field"> |
| 43 |
<div class="wpie-field__title"><?php esc_html_e( 'Conversion', 'button-generation' ); ?></div> |
| 44 |
<label class="wpie-field__label has-icon"> |
| 45 |
<span class="wpie-icon wpie_icon-filter"></span> |
| 46 |
<input type="text" id="conversion" value="<?php echo esc_attr( $conversion ); ?>" readonly> |
| 47 |
</label> |
| 48 |
</div> |
| 49 |
</div> |
| 50 |
|
| 51 |
<div class="wpie-actions__box"> |
| 52 |
<div class="wpie-action__link"> |
| 53 |
<?php if ( ! empty( $options['id'] ) ): ?> |
| 54 |
<a class="wpie-link-reset-static" href="<?php echo esc_url( Link::reset_count( $options['id'] ) ); ?>"> |
| 55 |
<?php esc_html_e( 'Reset', 'button-generation' ); ?> |
| 56 |
</a> |
| 57 |
<?php endif; ?> |
| 58 |
</div> |
| 59 |
</div> |
| 60 |
</div> |
| 61 |
<?php |
| 62 |
|