account-status-connected.php
8 years ago
account-status-create-advanced.php
9 years ago
account-status-create-simple.php
8 years ago
account-status-loading.php
9 years ago
bulk-optimization-chart.php
9 years ago
bulk-optimization-form.php
9 years ago
bulk-optimization.php
8 years ago
compress-details-processing.php
9 years ago
compress-details.php
8 years ago
dashboard-widget.php
8 years ago
bulk-optimization.php
262 lines
| 1 | <style> |
| 2 | |
| 3 | /* Admin color scheme colors */ |
| 4 | |
| 5 | div.tiny-bulk-optimization div.available div.tooltip span.dashicons { |
| 6 | color: <?php echo $admin_colors[3] ?>; |
| 7 | } |
| 8 | div.tiny-bulk-optimization div.savings div.chart div.value { |
| 9 | color: <?php echo $admin_colors[2] ?>; |
| 10 | } |
| 11 | div.tiny-bulk-optimization div.savings div.chart svg circle.main { |
| 12 | stroke: <?php echo $admin_colors[2] ?>; |
| 13 | } |
| 14 | div.tiny-bulk-optimization div.savings table td.emphasize { |
| 15 | color: <?php echo $admin_colors[2] ?>; |
| 16 | } |
| 17 | div.tiny-bulk-optimization div.dashboard div.optimize div.progressbar div.progress { |
| 18 | background-color: <?php echo $admin_colors[0] ?>; |
| 19 | background-image: linear-gradient( |
| 20 | -63deg, |
| 21 | <?php echo $admin_colors[0] ?> 0%, |
| 22 | <?php echo $admin_colors[0] ?> 25%, |
| 23 | <?php echo $admin_colors[1] ?> 25%, |
| 24 | <?php echo $admin_colors[1] ?> 50%, |
| 25 | <?php echo $admin_colors[0] ?> 50%, |
| 26 | <?php echo $admin_colors[0] ?> 75%, |
| 27 | <?php echo $admin_colors[1] ?> 75%, |
| 28 | <?php echo $admin_colors[1] ?> 100% |
| 29 | ); |
| 30 | } |
| 31 | |
| 32 | </style> |
| 33 | |
| 34 | <div class="wrap tiny-bulk-optimization tiny-compress-images" id="tiny-bulk-optimization"> |
| 35 | <div class="icon32" id="icon-upload"><br></div> |
| 36 | <h2><?php esc_html_e( 'Bulk Optimization', 'tiny-compress-images' ) ?></h2> |
| 37 | <div class="dashboard"> |
| 38 | <div class="statistics"> |
| 39 | <div class="available"> |
| 40 | <div class="inner"> |
| 41 | <h3><?php esc_html_e( 'Available Images', 'tiny-compress-images' ) ?></h3> |
| 42 | <p> |
| 43 | <?php |
| 44 | if ( 0 == $stats['optimized-image-sizes'] + $stats['available-unoptimised-sizes'] ) { |
| 45 | $percentage = 0; |
| 46 | } else { |
| 47 | $percentage_of_files = round( $stats['optimized-image-sizes'] / ( $stats['optimized-image-sizes'] + $stats['available-unoptimised-sizes'] ) * 100, 2 ); |
| 48 | } |
| 49 | if ( 0 == $stats['uploaded-images'] + $stats['available-unoptimised-sizes'] ) { |
| 50 | esc_html_e( 'This page is designed to bulk optimize all your images.', 'tiny-compress-images' ); |
| 51 | echo ' '; |
| 52 | esc_html_e( 'You do not seem to have uploaded any JPEG or PNG images yet.', 'tiny-compress-images' ); |
| 53 | } elseif ( 0 == sizeof( $active_tinify_sizes ) ) { |
| 54 | esc_html_e( 'Based on your current settings, nothing will be optimized. There are no active sizes selected for optimization.', 'tiny-compress-images' ); |
| 55 | } elseif ( 0 == $stats['available-unoptimised-sizes'] ) { |
| 56 | printf( esc_html__( '%s, this is great! Your entire library is optimized!', 'tiny-compress-images' ), $this->friendly_user_name() ); |
| 57 | } elseif ( $stats['optimized-image-sizes'] > 0 ) { |
| 58 | if ( $percentage_of_files > 75 ) { |
| 59 | printf( esc_html__( '%s, you are doing great!', 'tiny-compress-images' ), $this->friendly_user_name() ); |
| 60 | } else { |
| 61 | printf( esc_html__( '%s, you are doing good.', 'tiny-compress-images' ), $this->friendly_user_name() ); |
| 62 | } |
| 63 | echo ' '; |
| 64 | printf( esc_html__( '%1$d %2$s of your image library is optimized.', 'tiny-compress-images' ), $percentage_of_files, '%' ); |
| 65 | echo ' '; |
| 66 | printf( esc_html__( 'Start the %s to optimize the remainder of your library.', 'tiny-compress-images' ), esc_html__( 'bulk optimization', 'tiny-compress-images' ) ); |
| 67 | } else { |
| 68 | esc_html_e( 'Here you can start optimizing your entire library. Press the big button to start improving your website speed instantly!', 'tiny-compress-images' ); |
| 69 | } |
| 70 | ?> |
| 71 | </p> |
| 72 | <?php if ( Tiny_Settings::wr2x_active() ) { ?> |
| 73 | <p> |
| 74 | <?php esc_html_e( 'Notice that the WP Retina 2x sizes will not be compressed using this page. You will need to bulk generate the retina sizes separately from the WP Retina 2x page.', 'tiny-compress-images' ); ?> |
| 75 | </p> |
| 76 | <?php } ?> |
| 77 | <table class="totals"> |
| 78 | <tr> |
| 79 | <td class="item"> |
| 80 | <h3> |
| 81 | <?php echo wp_kses( __( 'Uploaded <br> images', 'tiny-compress-images' ), array( |
| 82 | 'br' => array(), |
| 83 | ) ) ?> |
| 84 | </h3> |
| 85 | <span id="uploaded-images"> |
| 86 | <?php echo $stats['uploaded-images']; ?> |
| 87 | </span> |
| 88 | </td> |
| 89 | <td class="item"> |
| 90 | <h3> |
| 91 | <?php echo wp_kses( __( 'Uncompressed image sizes', 'tiny-compress-images' ), array( |
| 92 | 'br' => array(), |
| 93 | ) ) ?> |
| 94 | </h3> |
| 95 | <span id="optimizable-image-sizes"> |
| 96 | <?php echo $stats['available-unoptimised-sizes'] ?> |
| 97 | </span> |
| 98 | <div class="tooltip"> |
| 99 | <span class="dashicons dashicons-info"></span> |
| 100 | <div class="tip"> |
| 101 | <?php if ( $stats['uploaded-images'] > 0 && sizeof( $active_tinify_sizes ) > 0 && $stats['available-unoptimised-sizes'] > 0 ) { ?> |
| 102 | <p> |
| 103 | <?php |
| 104 | printf( esc_html__( 'With your current settings you can still optimize %1$s image sizes from your %2$s uploaded JPEG and PNG images.', |
| 105 | 'tiny-compress-images'), $stats['available-unoptimised-sizes'], $stats['uploaded-images'] ); |
| 106 | ?> |
| 107 | </p> |
| 108 | <?php } ?> |
| 109 | <p> |
| 110 | <?php |
| 111 | if ( 0 == sizeof( $active_tinify_sizes ) ) { |
| 112 | esc_html_e( 'Based on your current settings, nothing will be optimized. There are no active sizes selected for optimization.', 'tiny-compress-images' ); |
| 113 | } else { |
| 114 | esc_html_e( 'These sizes are currently activated for compression:', 'tiny-compress-images' ); |
| 115 | echo '<ul>'; |
| 116 | for ( $i = 0; $i < sizeof( $active_tinify_sizes ); ++$i ) { |
| 117 | $name = $active_tinify_sizes[ $i ]; |
| 118 | if ( '0' == $name ) { |
| 119 | echo '<li>- ' . esc_html__( 'Original image', 'tiny-compress-images' ) . '</li>'; |
| 120 | } else { |
| 121 | echo '<li>- ' . esc_html( ucfirst( $name ) ) . '</li>'; |
| 122 | } |
| 123 | } |
| 124 | echo '</ul>'; |
| 125 | } |
| 126 | ?> |
| 127 | </p> |
| 128 | <p> |
| 129 | <?php if ( sizeof( $active_tinify_sizes ) > 0 ) { ?> |
| 130 | <?php printf( wp_kses( _n( 'For each uploaded image <strong>%d size</strong> is compressed.', 'For each uploaded image <strong>%d sizes</strong> are compressed.', count( $active_tinify_sizes ), 'tiny-compress-images' ), array( |
| 131 | 'strong' => array(), |
| 132 | ) ), count( $active_tinify_sizes ) ) ?> |
| 133 | <?php } ?> |
| 134 | <?php printf( wp_kses( __( 'You can change these settings %s.', 'tiny-compress-images' ), array( |
| 135 | 'a' => array( |
| 136 | 'href' => array(), |
| 137 | ), |
| 138 | ) ), '<a href=' . admin_url( 'options-media.php#tiny-compress-images' ) . '>' . __( 'here', 'tiny-compress-images' ) . '</a>' )?> |
| 139 | </p> |
| 140 | </div> |
| 141 | </div> |
| 142 | </td> |
| 143 | <td class="item costs"> |
| 144 | <h3> |
| 145 | <?php echo wp_kses( __( 'Estimated <br> cost', 'tiny-compress-images' ), array( |
| 146 | 'br' => array(), |
| 147 | ) ) ?> |
| 148 | </h3> |
| 149 | <span id="estimated-cost">$ <?php echo number_format( $estimated_costs, 2 ) ?></span> |
| 150 | USD |
| 151 | <?php if ( $estimated_costs > 0 ) { ?> |
| 152 | <div class="tooltip"> |
| 153 | <span class="dashicons dashicons-info"></span> |
| 154 | <div class="tip"> |
| 155 | <p><?php |
| 156 | printf( wp_kses( __( 'If you wish to compress more than <strong>%1$d %2$s</strong> a month and you are still on a free account %3$s.', 'tiny-compress-images' ), |
| 157 | array( |
| 158 | 'strong' => array(), |
| 159 | 'a' => array( |
| 160 | 'href' => array(), |
| 161 | ), |
| 162 | ) ), Tiny_Config::MONTHLY_FREE_COMPRESSIONS, esc_html__( 'image sizes', 'tiny-compress-images' ), '<a href="https://tinypng.com/dashboard/developers">' . esc_html__( ' upgrade here', 'tiny-compress-images' ) . '</a>' ); |
| 163 | ?></p> |
| 164 | </div> |
| 165 | </div> |
| 166 | <?php } ?> |
| 167 | </td> |
| 168 | </tr> |
| 169 | </table> |
| 170 | <div class="notes"> |
| 171 | <h4><?php esc_html_e( 'Remember', 'tiny-compress-images' ) ?></h4> |
| 172 | <p> |
| 173 | <?php esc_html_e( 'For the plugin to do the work, you need to keep this page open. But no worries: when stopped, you can continue where you left off!', 'tiny-compress-images' ); ?> |
| 174 | </p> |
| 175 | </div> |
| 176 | </div> |
| 177 | </div> |
| 178 | <div class="savings"> |
| 179 | <div class="inner"> |
| 180 | <h3><?php esc_html_e( 'Total Savings', 'tiny-compress-images' ) ?></h3> |
| 181 | <p> |
| 182 | <?php esc_html_e( 'Statistics based on all available JPEG and PNG images in your media library.', 'tiny-compress-images' ); ?> |
| 183 | </p> |
| 184 | <?php |
| 185 | require_once dirname( __FILE__ ) . '/bulk-optimization-chart.php'; |
| 186 | ?> |
| 187 | <div class="legend"> |
| 188 | <table> |
| 189 | <tr> |
| 190 | <td id="optimized-image-sizes" class="value emphasize"> |
| 191 | <?php echo $stats['optimized-image-sizes']; ?> |
| 192 | </td> |
| 193 | <td class="description"> |
| 194 | <?php echo _n( 'image size optimized', 'image sizes optimized', $stats['optimized-image-sizes'], 'tiny-compress-images' ) ?> |
| 195 | </td> |
| 196 | </tr> |
| 197 | <tr> |
| 198 | <td id="unoptimized-library-size" class="value" data-bytes="<?php echo $stats['unoptimized-library-size']; ?>" > |
| 199 | <?php echo ( $stats['unoptimized-library-size'] ? size_format( $stats['unoptimized-library-size'], 2 ) : '-'); ?> |
| 200 | </td> |
| 201 | <td class="description"> |
| 202 | <?php esc_html_e( 'initial size', 'tiny-compress-images' ) ?> |
| 203 | </td> |
| 204 | </tr> |
| 205 | <tr> |
| 206 | <td id="optimized-library-size" class="value emphasize" data-bytes="<?php echo $stats['optimized-library-size'] ?>" class="green"> |
| 207 | <?php echo ($stats['optimized-library-size'] ? size_format( $stats['optimized-library-size'], 2 ) : '-') ?> |
| 208 | </td> |
| 209 | <td class="description"> |
| 210 | <?php esc_html_e( 'current size', 'tiny-compress-images' ) ?> |
| 211 | </td> |
| 212 | </tr> |
| 213 | </table> |
| 214 | </div> |
| 215 | </div> |
| 216 | </div> |
| 217 | </div> |
| 218 | <div class="optimize"> |
| 219 | <div class="progressbar" id="compression-progress-bar" data-number-to-optimize="<?php echo $stats['optimized-image-sizes'] + $stats['available-unoptimised-sizes'] ?>" data-amount-optimized="0"> |
| 220 | <div id="progress-size" class="progress"> |
| 221 | </div> |
| 222 | <div class="numbers" > |
| 223 | <span id="optimized-so-far"><?php echo $stats['optimized-image-sizes'] ?></span> |
| 224 | / |
| 225 | <span><?php echo $stats['optimized-image-sizes'] + $stats['available-unoptimised-sizes'] ?></span> |
| 226 | <span id="percentage"></span> |
| 227 | </div> |
| 228 | </div> |
| 229 | <?php |
| 230 | if ( $stats['available-unoptimised-sizes'] > 0 ) { |
| 231 | require_once dirname( __FILE__ ) . '/bulk-optimization-form.php'; |
| 232 | } |
| 233 | ?> |
| 234 | </div> |
| 235 | </div> |
| 236 | <script type="text/javascript"> |
| 237 | <?php |
| 238 | if ( $auto_start_bulk ) { |
| 239 | echo 'jQuery(function() { bulkOptimizationAutorun(' . json_encode( $this->get_ids_to_compress() ) . ')})'; |
| 240 | } else { |
| 241 | echo 'jQuery(function() { bulkOptimization(' . json_encode( $stats['available-for-optimization'] ) . ')})'; |
| 242 | } |
| 243 | ?> |
| 244 | </script> |
| 245 | <table class="wp-list-table widefat fixed striped media whitebox" id="optimization-items" > |
| 246 | <thead> |
| 247 | <tr> |
| 248 | <?php // column-author WP 3.8-4.2 mobile view ?> |
| 249 | <th class="thumbnail"></th> |
| 250 | <th class="column-primary" ><?php esc_html_e( 'File', 'tiny-compress-images' ) ?></th> |
| 251 | <th class="column-author"><?php esc_html_e( 'Sizes Optimized', 'tiny-compress-images' ) ?></th> |
| 252 | <th class="column-author"><?php esc_html_e( 'Initial Size', 'tiny-compress-images' ) ?></th> |
| 253 | <th class="column-author"><?php esc_html_e( 'Current Size', 'tiny-compress-images' ) ?></th> |
| 254 | <th class="column-author savings" ><?php esc_html_e( 'Savings', 'tiny-compress-images' ) ?></th> |
| 255 | <th class="status" ><?php esc_html_e( 'Status', 'tiny-compress-images' ) ?></th> |
| 256 | </tr> |
| 257 | </thead> |
| 258 | <tbody> |
| 259 | </tbody> |
| 260 | </table> |
| 261 | </div> |
| 262 |