| 1 |
<?php |
| 2 |
|
| 3 |
use Imagify\User\User; |
| 4 |
|
| 5 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); |
| 6 |
?> |
| 7 |
<div class="wrap imagify-settings imagify-bulk"> |
| 8 |
|
| 9 |
<?php $this->print_template( 'part-bulk-optimization-header' ); ?> |
| 10 |
|
| 11 |
<div class="imagify-settings-section"> |
| 12 |
|
| 13 |
<div class="imagify-columns"> |
| 14 |
<div class="imagify-col col-overview"> |
| 15 |
<h2 class="imagify-h2-like"> |
| 16 |
<span class="dashicons dashicons-chart-line"></span> |
| 17 |
<?php esc_html_e( 'Overview', 'imagify' ); ?> |
| 18 |
</h2> |
| 19 |
|
| 20 |
<div class="imagify-columns"> |
| 21 |
<div class="imagify-col col-statistics"> |
| 22 |
<h3 class="screen-reader-text"><?php esc_html_e( 'Statistics', 'imagify' ); ?></h3> |
| 23 |
|
| 24 |
<div class="imagify-number-you-optimized"> |
| 25 |
<p> |
| 26 |
<span id="imagify-total-optimized-attachments" class="number"><?php echo esc_html( $data['already_optimized_attachments'] ); ?></span> |
| 27 |
<span class="text"> |
| 28 |
<?php |
| 29 |
printf( |
| 30 |
/* translators: you can use %s to include a line break. */ |
| 31 |
esc_html__( 'that\'s the number of original images%s you optimized with Imagify', 'imagify' ), |
| 32 |
'<br>' |
| 33 |
); |
| 34 |
?> |
| 35 |
</span> |
| 36 |
</p> |
| 37 |
</div> |
| 38 |
|
| 39 |
<div class="imagify-bars"> |
| 40 |
<p><?php esc_html_e( 'Original size', 'imagify' ); ?></p> |
| 41 |
<div class="imagify-bar-negative base-transparent right-outside-number"> |
| 42 |
<div id="imagify-original-bar" class="imagify-progress" style="width: 100%"><span class="imagify-barnb"><?php echo esc_html( $data['original_human'] ); ?></span></div> |
| 43 |
</div> |
| 44 |
|
| 45 |
<p><?php esc_html_e( 'Optimized size', 'imagify' ); ?></p> |
| 46 |
<div class="imagify-bar-primary base-transparent right-outside-number"> |
| 47 |
<div id="imagify-optimized-bar" class="imagify-progress" style="width: <?php echo max( 100 - $data['optimized_percent'], 0 ); ?>%"><span class="imagify-barnb"><?php echo esc_html( $data['optimized_human'] ); ?></span></div> |
| 48 |
</div> |
| 49 |
|
| 50 |
</div> |
| 51 |
|
| 52 |
<div class="imagify-number-you-optimized"> |
| 53 |
<p> |
| 54 |
<span id="imagify-total-optimized-attachments-pct" class="number"><?php echo esc_html( number_format_i18n( $data['optimized_percent'] ) ); ?>%</span> |
| 55 |
<span class="text"> |
| 56 |
<?php |
| 57 |
printf( |
| 58 |
/* translators: %s is a line break. */ |
| 59 |
esc_html__( 'that\'s the size you saved %sby using Imagify', 'imagify' ), |
| 60 |
'<br>' |
| 61 |
); |
| 62 |
?> |
| 63 |
</span> |
| 64 |
</p> |
| 65 |
</div> |
| 66 |
</div><!-- .imagify-col.col-statistics --> |
| 67 |
|
| 68 |
<div class="imagify-col col-chart"> |
| 69 |
<div class="imagify-chart-container imagify-overview-chart-container"> |
| 70 |
<canvas id="imagify-overview-chart" width="180" height="180" data-unoptimized="<?php echo esc_attr( $data['unoptimized_attachments'] ); ?>" data-optimized="<?php echo esc_attr( $data['optimized_attachments'] ); ?>" data-errors="<?php echo esc_attr( $data['errors_attachments'] ); ?>"></canvas> |
| 71 |
<div id="imagify-overview-chart-percent" class="imagify-chart-percent"><?php echo esc_html( min( $data['optimized_attachments_percent'], 100 ) ); ?><span>%</span></div> |
| 72 |
</div> |
| 73 |
<div id="imagify-overview-chart-legend"></div> |
| 74 |
|
| 75 |
<p class="imagify-global-optim-phrase imagify-clear"> |
| 76 |
<?php |
| 77 |
printf( |
| 78 |
/* translators: %s is a percentage. */ |
| 79 |
esc_html__( 'You optimized %s of your website\'s images', 'imagify' ), |
| 80 |
'<span class="imagify-total-percent">' . esc_html( min( $data['optimized_attachments_percent'], 100 ) ) . '%</span>' |
| 81 |
); |
| 82 |
?> |
| 83 |
</p> |
| 84 |
</div><!-- .imagify-col --> |
| 85 |
</div> |
| 86 |
</div><!-- .imagify-col.col-overview --> |
| 87 |
|
| 88 |
<div class="imagify-col imagify-account-info-col"> |
| 89 |
|
| 90 |
<?php |
| 91 |
if ( |
| 92 |
( ! defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) || ! IMAGIFY_HIDDEN_ACCOUNT ) |
| 93 |
&& |
| 94 |
Imagify_Requirements::is_api_key_valid() |
| 95 |
) { |
| 96 |
?> |
| 97 |
<div class="imagify-options-title"> |
| 98 |
<div class="imagify-th-titles imagify-flex imagify-vcenter"> |
| 99 |
<span class="dashicons dashicons-admin-users"></span> |
| 100 |
<p class="imagify-meteo-title"> |
| 101 |
<?php esc_html_e( 'Your Account', 'imagify' ); ?> |
| 102 |
</p> |
| 103 |
</div> |
| 104 |
<a href="<?php echo esc_url( imagify_get_external_url( 'subscription' ) ); ?>" target="_blank"><?php _e( 'View your profile', 'imagify' ); ?></a> |
| 105 |
</div> |
| 106 |
<?php $this->print_template( 'part-upsell' ); ?> |
| 107 |
<?php } // End if(). ?> |
| 108 |
|
| 109 |
</div><!-- .imagify-account-info-col --> |
| 110 |
|
| 111 |
</div><!-- .imagify-columns --> |
| 112 |
|
| 113 |
<?php |
| 114 |
$this->print_template( 'part-bulk-optimization-success' ); |
| 115 |
|
| 116 |
$this->print_template( 'part-bulk-optimization-table', $data ); |
| 117 |
|
| 118 |
// New Feature! |
| 119 |
if ( ! empty( $data['no-custom-folders'] ) ) { |
| 120 |
$this->print_template( 'part-bulk-optimization-newbie' ); |
| 121 |
} |
| 122 |
?> |
| 123 |
|
| 124 |
<div class="imagify-bulk-submit imagify-flex imagify-vcenter"> |
| 125 |
<div class="imagify-pr2"> |
| 126 |
<p> |
| 127 |
<?php wp_nonce_field( 'imagify-bulk-optimize', 'imagifybulkuploadnonce' ); ?> |
| 128 |
<?php |
| 129 |
$disabled = ''; |
| 130 |
$class = ''; |
| 131 |
|
| 132 |
if ( |
| 133 |
false !== get_transient( 'imagify_wp_optimize_running' ) |
| 134 |
|| |
| 135 |
false !== get_transient( 'imagify_custom-folders_optimize_running' ) |
| 136 |
) { |
| 137 |
$disabled = 'disabled="disabled"'; |
| 138 |
$class = 'rotate'; |
| 139 |
} |
| 140 |
|
| 141 |
?> |
| 142 |
<button id="imagify-bulk-action" type="button" class="button button-primary" <?php echo $disabled; ?>> |
| 143 |
<span class="dashicons dashicons-admin-generic <?php echo $class; ?>"></span> |
| 144 |
<span class="button-text"><?php _e( 'Imagif’em all', 'imagify' ); ?></span> |
| 145 |
</button> |
| 146 |
</p> |
| 147 |
</div> |
| 148 |
<?php if ( ! is_wp_error( get_imagify_max_image_size() ) ) { ?> |
| 149 |
<p> |
| 150 |
<?php |
| 151 |
printf( |
| 152 |
/* translators: %s is a file size. */ |
| 153 |
esc_html__( 'All images greater than %s (after resizing, if any) will be optimized when using a paid plan.', 'imagify' ), |
| 154 |
esc_html( imagify_size_format( get_imagify_max_image_size() ) ) |
| 155 |
); |
| 156 |
?> |
| 157 |
</p> |
| 158 |
<?php } ?> |
| 159 |
</div><!-- .imagify-bulk-submit --> |
| 160 |
</div><!-- .imagify-settings-section --> |
| 161 |
|
| 162 |
<?php |
| 163 |
$this->print_template( 'modal-payment' ); |
| 164 |
|
| 165 |
if ( Imagify_Requirements::is_api_key_valid() ) { |
| 166 |
$display_infos = get_transient( 'imagify_bulk_optimization_infos' ); |
| 167 |
|
| 168 |
?> |
| 169 |
<script type="text/html" id="tmpl-imagify-overquota-alert"> |
| 170 |
<?php $this->print_template( 'part-bulk-optimization-overquota-alert' ); ?> |
| 171 |
</script> |
| 172 |
<?php |
| 173 |
|
| 174 |
if ( ! $display_infos ) { |
| 175 |
?> |
| 176 |
<script type="text/html" id="tmpl-imagify-bulk-infos"> |
| 177 |
<?php |
| 178 |
$this->print_template( 'part-bulk-optimization-infos', array( |
| 179 |
'quota' => $data['unconsumed_quota'], |
| 180 |
'quota_class' => $data['quota_class'], |
| 181 |
'library' => ! empty( $data['groups']['library'] ), |
| 182 |
) ); |
| 183 |
?> |
| 184 |
</script> |
| 185 |
<?php |
| 186 |
} |
| 187 |
} |
| 188 |
?> |
| 189 |
</div> |
| 190 |
<?php |
| 191 |
|