Skip to content

Commit 75840e8

Browse files
author
Marco Pereirinha
committed
Make sure that there is a value for stat before using it
1 parent 6b329b5 commit 75840e8

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/dashboard-content.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,29 @@
5050
<?php if ( false !== $connection->get_usage_stat( 'credits', 'limit' ) ) : ?>
5151
<span class="cloudinary-stat" title="<?php esc_attr_e( 'Credits', 'cloudinary' ); ?>">
5252
<span class="dashicons dashicons-marker"></span> <?php esc_html_e( number_format_i18n( $connection->get_usage_stat( 'credits', 'limit' ) ) ); ?>
53-
<span class="cloudinary-percent"> <?php esc_html_e( $connection->get_usage_stat( 'credits', 'used_percent' ) . '%' ); ?></span> |
53+
<?php if ( false !== $connection->get_usage_stat( 'credits', 'used_percent' ) ) : ?>
54+
<span class="cloudinary-percent"> <?php esc_html_e( $connection->get_usage_stat( 'credits', 'used_percent' ) . '%' ); ?></span> |
55+
<?php endif; ?>
5456
</span>
5557
<?php endif; ?>
5658

5759
<span class="cloudinary-stat" title="<?php esc_attr_e( 'Storage', 'cloudinary' ); ?>">
5860
<span class="dashicons dashicons-cloud"></span> <?php esc_html_e( size_format( $connection->get_usage_stat( 'storage', 'limit' ) ) ); ?>
59-
<span class="cloudinary-percent"> <?php esc_html_e( $connection->get_usage_stat( 'storage', 'used_percent' ) . '%' ); ?></span> |
61+
<?php if ( false !== $connection->get_usage_stat( 'storage', 'used_percent' ) ) : ?>
62+
<span class="cloudinary-percent"> <?php esc_html_e( $connection->get_usage_stat( 'storage', 'used_percent' ) . '%' ); ?></span> |
63+
<?php endif; ?>
6064
</span>
6165
<span class="cloudinary-stat" title="<?php esc_attr_e( 'Transformations', 'cloudinary' ); ?>">
6266
<span class="dashicons dashicons-image-filter"></span> <?php esc_html_e( number_format_i18n( $connection->get_usage_stat( 'transformations', 'limit' ) ) ); ?>
63-
<span class="cloudinary-percent success"> <?php esc_html_e( $connection->get_usage_stat( 'transformations', 'used_percent' ) . '%' ); ?></span> |
67+
<?php if ( false !== $connection->get_usage_stat( 'transformations', 'used_percent' ) ) : ?>
68+
<span class="cloudinary-percent success"> <?php esc_html_e( $connection->get_usage_stat( 'transformations', 'used_percent' ) . '%' ); ?></span> |
69+
<?php endif; ?>
6470
</span>
6571
<span class="cloudinary-stat" title="<?php esc_attr_e( 'Bandwidth', 'cloudinary' ); ?>">
6672
<span class="dashicons dashicons-dashboard"></span> <?php esc_html_e( size_format( $connection->get_usage_stat( 'bandwidth', 'limit' ) ) ); ?>
67-
<span class="cloudinary-percent success"> <?php esc_html_e( $connection->get_usage_stat( 'bandwidth', 'used_percent' ) . '%' ); ?></span>
73+
<?php if ( false !== $connection->get_usage_stat( 'bandwidth', 'used_percent' ) ) : ?>
74+
<span class="cloudinary-percent success"> <?php esc_html_e( $connection->get_usage_stat( 'bandwidth', 'used_percent' ) . '%' ); ?></span>
75+
<?php endif; ?>
6876
</span>
6977
</div>
7078
<hr>

0 commit comments

Comments
 (0)