Changeset 2541619
- Timestamp:
- 06/02/2021 10:17:35 PM (5 years ago)
- Location:
- megaoptim-image-optimizer/trunk
- Files:
-
- 12 edited
-
assets/css/megaoptim.css (modified) (4 diffs)
-
includes/classes/Adapters/MGO_FileLibrary.php (modified) (1 diff)
-
includes/classes/Adapters/MGO_MediaLibrary.php (modified) (1 diff)
-
includes/classes/MGO_CLI.php (modified) (3 diffs)
-
includes/compat/nextgen-gallery/classes/MGO_NGGLibrary.php (modified) (1 diff)
-
includes/functions/bootstrap.php (modified) (1 diff)
-
includes/functions/helpers.php (modified) (2 diffs)
-
includes/libraries/megaoptim-php/src/Optimizer.php (modified) (1 diff)
-
includes/views/parts/footer.php (modified) (1 diff)
-
includes/views/parts/header.php (modified) (1 diff)
-
megaoptim.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
megaoptim-image-optimizer/trunk/assets/css/megaoptim.css
r2262804 r2541619 2 2 * Misc 3 3 */ 4 5 .megaoptim * { 6 box-sizing: border-box !important; 7 } 8 9 4 10 .megaoptim-container { 5 max-width: 1200px; 11 width: 80%; 12 float: left; 13 } 14 15 .megaoptim-sidebar { 16 width: 20%; 17 float: left; 18 } 19 .megaoptim-sidebar .megaoptim-widget { 20 background: #fff; 21 float: left; 22 width: 100%; 23 padding: 0; 24 box-sizing: border-box; 25 border: 1px solid #e5e5e5; 26 box-shadow: 0 1px 1px rgba(0, 0, 0, .04); 27 } 28 .megaoptim-sidebar .megaoptim-widget-title { 29 padding: 8px 12px; 30 border-bottom: 1px solid #e5e5e5; 31 } 32 .megaoptim-sidebar .megaoptim-widget-title h3 { 33 padding: 0; 34 margin:0; 35 font-size: 14px; 36 line-height: 1.4; 37 } 38 .megaoptim-sidebar .megaoptim-widget-content { 39 padding: 8px 12px; 40 } 41 .megaoptim-sidebar .megaoptim-widget-content p, .megaoptim-sidebar .megaoptim-widget-content ul { 42 margin-top: 0; 43 margin-bottom: 10px; 44 } 45 .megaoptim-sidebar .megaoptim-widget-content p:last-child { 46 margin-bottom: 0; 47 } 48 49 .megaoptim-sidebar .megaoptim-widget-content h4 { 50 margin-top:0; 51 margin-bottom: 5px; 52 } 53 .megaoptim-widget-resource:last-child { 54 border-bottom: 0; 55 } 56 57 .megaoptim-widget-resource { 58 margin-bottom: 10px; 59 padding-bottom: 10px; 60 border-bottom: 1px solid #e5e5e5; 61 } 62 63 @media(max-width: 768px) { 64 .megaoptim-container { 65 width: 100%; 66 margin-bottom: 20px; 67 } 68 .megaoptim-sidebar { 69 width: 100%; 70 } 71 6 72 } 7 73 … … 314 380 } 315 381 316 .megaoptim-header-logo { 317 max-width: 18%; 318 margin-right: 2%; 319 padding: 2% 2%; 382 .megaoptim-optimizer-switcher { 383 padding-top: 3.0%; 384 padding-bottom: 3.0%; 385 float: right; 386 } 387 .megaoptim-optimizer-switcher label { 388 color: #fff; 389 } 390 391 392 @media(max-width: 767px) { 393 394 .megaoptim-optimizer-switcher { 395 float:none; 396 margin: 0 auto; 397 } 398 399 .megaoptim-header-logo { 400 padding-top: 20px; 401 width: 100%; 402 } 403 .megaoptim-header-logo img { 404 max-width: 250px !important; 405 } 406 } 407 @media(min-width: 768px) { 408 .megaoptim-header-logo { 409 max-width: 20%; 410 margin-right: 2%; 411 padding: 1.6% 1.6%; 412 } 320 413 } 321 414 … … 332 425 333 426 .megaoptim-menu { 334 padding-top: 4.7%;335 padding-bottom: 4.7%;427 padding-top: 3.8%; 428 padding-bottom: 3.7%; 336 429 margin: 0; 337 430 list-style: none; … … 666 759 .megaoptim-table th.column { 667 760 width: auto; 668 }669 670 .optimizer-switcher {671 padding-top: 3.5%;672 padding-bottom: 3.5%;673 float: right;674 }675 676 .optimizer-switcher label {677 color: #fff;678 761 } 679 762 -
megaoptim-image-optimizer/trunk/includes/classes/Adapters/MGO_FileLibrary.php
r2539116 r2541619 150 150 return $result; 151 151 } catch ( Exception $e ) { 152 throw new MGO_Exception( $e->getMessage() . ' in ' . $e->getFile() ); 152 $attachment_object->unlock(); 153 megaoptim_log( '--- Optimizer Exception: ' . sprintf( '%s in %s', $e->getMessage(), $e->getFile() ) ); 154 throw $e; 153 155 } 154 156 } -
megaoptim-image-optimizer/trunk/includes/classes/Adapters/MGO_MediaLibrary.php
r2539116 r2541619 231 231 232 232 return $result; 233 } catch ( Exception $e ) {233 } catch ( \Exception $e ) { 234 234 $attachment_object->unlock(); 235 235 megaoptim_log( '--- Optimizer Exception: ' . sprintf( '%s in %s', $e->getMessage(), $e->getFile() ) ); 236 throw new MGO_Exception( $e->getMessage() );236 throw $e; 237 237 } 238 238 } -
megaoptim-image-optimizer/trunk/includes/classes/MGO_CLI.php
r2539128 r2541619 236 236 $total_saved = 0; 237 237 $total_optimized = 0; 238 $api_errors = 0; 238 239 foreach ( $images as $image ) { 239 240 try { … … 252 253 } 253 254 \WP_CLI::success( $message ); 255 $api_errors = 0; 254 256 } catch ( \MGO_Exception $e ) { 255 257 if ( $e instanceof MGO_Attachment_Already_Optimized_Exception ) { … … 258 260 \WP_CLI::warning( sprintf( __( 'Attachment %s not optimized. Reason: %s', 'megaoptim-image-optimizer' ), $image['ID'], $e->getMessage() ) ); 259 261 } else if ( $e instanceof MGO_API_Response_Exception ) { 262 $api_errors ++; 260 263 \WP_CLI::warning( sprintf( __( 'Attachment %s not optimized. Reason: %s', 'megaoptim-image-optimizer' ), $image['ID'], $e->getMessage() ) ); 261 break; 264 if ( $api_errors > 10 ) { 265 \WP_CLI::error( sprintf( __( 'We found %d consecutive erroneous API responses. Please fix the problem before continuing.' ), $api_errors ) ); 266 break; 267 } 262 268 } else { 263 269 \WP_CLI::warning( sprintf( __( 'Attachment %s not optimized. Reason: %s', 'megaoptim-image-optimizer' ), $image['ID'], $e->getMessage() ) ); -
megaoptim-image-optimizer/trunk/includes/compat/nextgen-gallery/classes/MGO_NGGLibrary.php
r2539116 r2541619 170 170 } catch ( Exception $e ) { 171 171 $attachment_object->unlock(); 172 megaoptim_log( '--- Optimizer Exception: ' . $e->getMessage() );173 throw new MGO_Exception( $e->getMessage() . ' in ' . $e->getFile() );172 megaoptim_log( '--- Optimizer Exception: ' . sprintf( '%s in %s', $e->getMessage(), $e->getFile() ) ); 173 throw $e; 174 174 } 175 175 } -
megaoptim-image-optimizer/trunk/includes/functions/bootstrap.php
r2202391 r2541619 86 86 global $wp_version; 87 87 require_once( WP_MEGAOPTIM_LIBRARIES_PATH . 'megaoptim-php' . DIRECTORY_SEPARATOR . 'loadnoncomposer.php' ); 88 $type = ( defined( 'WP_CLI' ) && WP_CLI ) ? ' / CLI' . ( defined( 'WP_CLI_VERSION' ) ? ' ' . WP_CLI_VERSION : '' ) : ''; 88 89 \MegaOptim\Http\BaseClient::$api_url = WP_MEGAOPTIM_API_BASE_URL; 89 \MegaOptim\Http\BaseClient::set_user_agent( 'WordPress ' . $wp_version . ' / Plugin ' . WP_MEGAOPTIM_VER);90 \MegaOptim\Http\BaseClient::set_user_agent( sprintf( 'WordPress %s / Plugin %s%s', $wp_version, WP_MEGAOPTIM_VER, $type ) ); 90 91 } 91 92 -
megaoptim-image-optimizer/trunk/includes/functions/helpers.php
r2432752 r2541619 55 55 fwrite( $fp, $contents . "\n" ); 56 56 } 57 fclose( $fp ); 57 if ( is_resource( $fp ) ) { 58 fclose( $fp ); 59 } 58 60 } 59 61 … … 697 699 function megaoptim_get_excluded_custom_dir_paths() { 698 700 $uploads = wp_upload_dir(); 701 699 702 return array( $uploads['basedir'] ); 700 703 } -
megaoptim-image-optimizer/trunk/includes/libraries/megaoptim-php/src/Optimizer.php
r2201007 r2541619 213 213 $is_file = 0; 214 214 foreach ( $resource as $file ) { 215 216 215 if ( file_exists( $file ) && is_file( $file ) ) { 217 216 $is_file = 1; -
megaoptim-image-optimizer/trunk/includes/views/parts/footer.php
r1952089 r2541619 1 </div> 2 </div> <!-- megaoptim-cotnainer --> 1 </div> 2 </div> <!-- megaoptim-cotnainer --> 3 4 5 <?php 6 $links = array( 7 array( 8 'name' => __( 'Manage your support', 'megaoptim-image-optimizer' ), 9 'title' => __( 'Place where you can manage your MegaOptim account, api key and subscription.' ), 10 'link' => 'https://app.megaoptim.com/', 11 ), 12 array( 13 'name' => __( 'Technical support', 'megaoptim-image-optimizer' ), 14 'title' => __( 'Place where you can manage your MegaOptim account, api key and subscription.', 'megaoptim-image-optimizer' ), 15 'link' => 'https://wordpress.org/support/plugin/megaoptim-image-optimizer/', 16 ), 17 array( 18 'name' => __( 'How to use WP-CLI', 'megaoptim-image-optimizer' ), 19 'title' => __( 'Learn how to use MegaOptim WP-CLI commands to make your life easier with the command line.', 'megaoptim-image-optimizer' ), 20 'link' => 'https://megaoptim.com/blog/how-to-optimize-wordpress-images-with-wp-cli-and-megaoptim/', 21 ), 22 ); 23 ?> 24 25 <div class="megaoptim-sidebar"> 26 <div class="megaoptim-widget"> 27 <div class="megaoptim-widget-title"> 28 <h3><?php _e( 'Resources', 'megaoptim-image-optimizer' ); ?></h3> 29 </div> 30 <div class="megaoptim-widget-content"> 31 <div class="megaoptim-widget-resource"> 32 <h4><?php _e( 'Some useful links', 'megaoptim-image-optimizer' ); ?></h4> 33 <ul> 34 <?php 35 foreach ( $links as $link ) { 36 echo sprintf( '<li><a href="%s" title="%s" target="_blank">%s</a></li>', $link['link'], $link['title'], $link['name'] ); 37 } 38 ?> 39 </ul> 40 </div> 41 <div class="megaoptim-widget-resource"> 42 <h4><?php _e( 'Liked MegaOptim?', 'megaoptim-image-optimizer' ); ?></h4> 43 <p><?php _e( 'Give us <a target="_blank" href="https://wordpress.org/support/plugin/megaoptim-image-optimizer/reviews/#new-post">5 star rating</a> and <a target="_blank" href="https://megaoptim.com/claim-free-tokens/">claim your <strong>1500 tokens for free</strong></a>', 'megaoptim-image-optimizer' ); ?></p> 44 </div> 45 </div> 46 </div> 47 48 </div> 49 50 3 51 </div> <!-- .wrap.megaoptim --> -
megaoptim-image-optimizer/trunk/includes/views/parts/header.php
r2432752 r2541619 40 40 <?php elseif ( $menu === 'optimizer' ): ?> 41 41 <div class="megaoptim-header-menu"> 42 <form class=" optimizer-switcher" method="GET" action="<?php echo admin_url( "upload.php" ); ?>">42 <form class="megaoptim-optimizer-switcher" method="GET" action="<?php echo admin_url( "upload.php" ); ?>"> 43 43 <input type="hidden" name="page" value="megaoptim_bulk_optimizer"/> 44 44 <label for="module"><?php _e( 'Select tool', 'megaoptim-image-optimizer' ); ?></label> -
megaoptim-image-optimizer/trunk/megaoptim.php
r2539128 r2541619 6 6 Author: MegaOptim 7 7 Author URI: https://megaoptim.com 8 Version: 1.4.1 38 Version: 1.4.14 9 9 Text Domain: megaoptim-image-optimizer 10 10 Domain Path: /languages … … 15 15 } 16 16 17 define( 'WP_MEGAOPTIM_VER', '1.4.1 3' );17 define( 'WP_MEGAOPTIM_VER', '1.4.14' ); 18 18 define( 'WP_MEGAOPTIM_PATH', plugin_dir_path( __FILE__ ) ); 19 19 define( 'WP_MEGAOPTIM_URL', plugin_dir_url( __FILE__ ) ); -
megaoptim-image-optimizer/trunk/readme.txt
r2539128 r2541619 5 5 Tested up to: 5.7 6 6 Requires PHP: 5.3 7 Stable tag: 1.4.1 37 Stable tag: 1.4.14 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 138 138 == Changelog == 139 139 140 = 1.4.14 = 141 - Added UI sidebar for links and other information 142 - Added free tokens promo link 143 - Added various responsive UI fixes 144 - Fixed problem with CLI. Allow up to 10 consecutive errors before terminating bulk upload. 145 140 146 = 1.4.13 = 141 147 - Terminate the WP CLI Bulk process only if API problem is found e.g. Insufficuent tokens.
Note: See TracChangeset
for help on using the changeset viewer.