ShortPixel Image Optimizer - Version 4.22.0

Version Description

Release date April 28th, 2021 * New: ability to generate and serve the AVIF version of the images; * New: WebP and AVIF files can now be delivered without conditioning of the generation of such files; * Fix: Keep the loading=lazy attribute on IMG tags when delivering next-generation images using the picture method; * Fix: Custom database tables were created without primary keys and that caused issues in some cases; * Fix: Empty alt tag should not be stripped with WebP delivery; * Fix: bug when using S3-offload in combination with Webp delivery; * Fix: fixes, additions, and tweaks to the plugin notifications system; * Language: 9 new strings added, 14 updated, 0 fuzzed, and 0 obsoleted.

Download this release

Release Info

Developer petredobrescu
Plugin Icon 128x128 ShortPixel Image Optimizer
Version 4.22.0
Comparing to
See all releases

Code changes from version 4.21.2 to 4.22.0

class/Controller/AdminNoticesController.php CHANGED
@@ -29,6 +29,9 @@ class AdminNoticesController extends \ShortPixel\Controller
29
 
30
  const MSG_INTEGRATION_NGGALLERY = 'IntNotice400';
31
 
 
 
 
32
  public function __construct()
33
  {
34
  add_action('admin_notices', array($this, 'displayNotices'), 50); // notices occured before page load
@@ -96,8 +99,10 @@ class AdminNoticesController extends \ShortPixel\Controller
96
  public function displayNotices()
97
  {
98
  if (! \wpSPIO()->env()->is_screen_to_use)
99
- return; // suppress all when not our screen.
100
-
 
 
101
  $noticeControl = Notices::getInstance();
102
  $noticeControl->loadIcons(array(
103
  'normal' => '<img class="short-pixel-notice-icon" src="' . plugins_url('res/img/slider.png', SHORTPIXEL_PLUGIN_FILE) . '">',
@@ -136,17 +141,18 @@ class AdminNoticesController extends \ShortPixel\Controller
136
  public function check_admin_notices()
137
  {
138
  if (! \wpSPIO()->env()->is_screen_to_use)
139
- return; // suppress all when not our screen.
140
-
 
 
141
  $this->doFilePermNotice();
142
  $this->doAPINotices();
143
  $this->doCompatNotices();
144
  $this->doUnlistedNotices();
145
  $this->doQuotaNotices();
146
-
147
  $this->doIntegrationNotices();
148
-
149
  $this->doHelpOptInNotices();
 
150
  }
151
 
152
 
@@ -363,6 +369,51 @@ class AdminNoticesController extends \ShortPixel\Controller
363
  }
364
  }
365
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  // Callback to check if we are on the correct page.
367
  public function upgradeBulkCallback($notice)
368
  {
@@ -587,21 +638,73 @@ class AdminNoticesController extends \ShortPixel\Controller
587
  if( $message !== false && strlen(trim($message)) > 0) {
588
  $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
589
  printf(
590
- '<tr class="plugin-update-tr active"><td colspan="%s" class="plugin-update colspanchange"><div class="notice inline notice-warning notice-alt">%s</div></td></tr>',
591
- $wp_list_table->get_column_count(),
592
  wpautop( $message )
593
  );
594
  }
595
 
596
  }
597
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
  /**
599
  * Stolen from SPAI, Thanks.
600
  */
601
  private function get_update_notice($data, $response) {
602
- $transient_name = 'shortpixel_update_notice_' . $response->new_version;
 
 
 
 
 
 
603
  $update_notice = get_transient( $transient_name );
604
- $url = 'https://plugins.svn.wordpress.org/shortpixel-image-optimiser/trunk/readme.txt';
 
605
 
606
  if ( $update_notice === false || strlen( $update_notice ) == 0 ) {
607
  $readme_response = wp_safe_remote_request( $url );
@@ -611,10 +714,9 @@ class AdminNoticesController extends \ShortPixel\Controller
611
  $content = $readme_response['body'];
612
  }
613
 
614
-
615
  if ( !empty( $readme_response ) ) {
616
  $update_notice = $this->parse_update_notice( $content, $response );
617
- set_transient( $transient_name, $update_notice, DAY_IN_SECONDS );
618
  }
619
  }
620
 
@@ -632,21 +734,9 @@ class AdminNoticesController extends \ShortPixel\Controller
632
  * @return string
633
  */
634
  private function parse_update_notice( $content, $response ) {
635
- //$version_parts = explode( '.', $response->new_version );
636
- // var_dump($version_parts);
637
- // echo "<PRE>"; var_dump($content); echo "</PRE>";
638
-
639
- /* $check_for_notices = [
640
- $version_parts[ 0 ] . '.' . $version_parts[ 1 ] . '.' . $version_parts[ 2 ] . '.' . $version_parts[ 3 ], // build
641
- $version_parts[ 0 ] . '.' . $version_parts[ 1 ] . '.' . $version_parts[ 2 ], // patch (micro)
642
- $version_parts[ 0 ] . '.' . $version_parts[ 1 ] . '.0', // minor
643
- $version_parts[ 0 ] . '.' . $version_parts[ 1 ], // minor
644
- $version_parts[ 0 ] . '.0.0', // major
645
- $version_parts[ 0 ] . '.0', // major
646
- ]; */
647
  $new_version = $response->new_version;
648
 
649
- $update_notice = '';
650
 
651
  // foreach ( $check_for_notices as $id => $check_version ) {
652
  if ( version_compare( SHORTPIXEL_IMAGE_OPTIMISER_VERSION, $new_version, '>' ) ) {
@@ -655,7 +745,7 @@ class AdminNoticesController extends \ShortPixel\Controller
655
 
656
  $result = $this->parse_readme_content( $content, $new_version, $response );
657
 
658
- if ( !empty( $result ) ) {
659
  $update_notice = $result;
660
  }
661
  // }
@@ -686,7 +776,11 @@ class AdminNoticesController extends \ShortPixel\Controller
686
 
687
  if (! isset($matches[1]))
688
  return ''; // no update texts.
689
- $lines = str_split(trim($matches[1]));
 
 
 
 
690
  $versions = array();
691
  $inv = false;
692
  foreach($lines as $char)
@@ -709,10 +803,10 @@ class AdminNoticesController extends \ShortPixel\Controller
709
  }
710
  elseif(! $inv) // record the message
711
  {
712
- $versions[trim($curver)] .= $char;
 
713
  }
714
 
715
-
716
  }
717
 
718
  foreach($versions as $version => $line)
@@ -727,7 +821,8 @@ class AdminNoticesController extends \ShortPixel\Controller
727
 
728
  }
729
 
730
- return $notice;
 
731
  }
732
 
733
  /*private function replace_readme_constants( $content, $response ) {
@@ -738,7 +833,10 @@ class AdminNoticesController extends \ShortPixel\Controller
738
  } */
739
 
740
  private function markdown2html( $content ) {
741
- $patterns = [
 
 
 
742
  '/\*\*(.+)\*\*/U', // bold
743
  '/__(.+)__/U', // italic
744
  '/\[([^\]]*)\]\(([^\)]*)\)/U', // link
29
 
30
  const MSG_INTEGRATION_NGGALLERY = 'IntNotice400';
31
 
32
+ private $remote_message_endpoint = 'https://api.shortpixel.com/v2/notices.php';
33
+ private $remote_readme_endpoint = 'https://plugins.svn.wordpress.org/shortpixel-image-optimiser/trunk/readme.txt';
34
+
35
  public function __construct()
36
  {
37
  add_action('admin_notices', array($this, 'displayNotices'), 50); // notices occured before page load
99
  public function displayNotices()
100
  {
101
  if (! \wpSPIO()->env()->is_screen_to_use)
102
+ {
103
+ if(get_current_screen()->base !== 'dashboard') // ugly exception for dashboard.
104
+ return; // suppress all when not our screen.
105
+ }
106
  $noticeControl = Notices::getInstance();
107
  $noticeControl->loadIcons(array(
108
  'normal' => '<img class="short-pixel-notice-icon" src="' . plugins_url('res/img/slider.png', SHORTPIXEL_PLUGIN_FILE) . '">',
141
  public function check_admin_notices()
142
  {
143
  if (! \wpSPIO()->env()->is_screen_to_use)
144
+ {
145
+ if(get_current_screen()->base !== 'dashboard') // ugly exception for dashboard.
146
+ return; // suppress all when not our screen.
147
+ }
148
  $this->doFilePermNotice();
149
  $this->doAPINotices();
150
  $this->doCompatNotices();
151
  $this->doUnlistedNotices();
152
  $this->doQuotaNotices();
 
153
  $this->doIntegrationNotices();
 
154
  $this->doHelpOptInNotices();
155
+ $this->doRemoteNotices();
156
  }
157
 
158
 
369
  }
370
  }
371
 
372
+ protected function doRemoteNotices()
373
+ {
374
+ $notices = $this->get_remote_notices();
375
+
376
+ if ($notices == false)
377
+ return;
378
+
379
+ foreach($notices as $remoteNotice)
380
+ {
381
+ if (! isset($remoteNotice->id) && ! isset($remoteNotice->message))
382
+ return;
383
+
384
+ if (! isset($remoteNotice->type))
385
+ $remoteNotice->type = 'notice';
386
+
387
+ $message = esc_html($remoteNotice->message);
388
+ $id = sanitize_text_field($remoteNotice->id);
389
+
390
+ $noticeController = Notices::getInstance();
391
+ $noticeObj = $noticeController->getNoticeByID($id);
392
+
393
+ // not added to system yet
394
+ if ($noticeObj == false)
395
+ {
396
+ switch ($remoteNotice->type)
397
+ {
398
+ case 'warning':
399
+ $new_notice = Notices::addWarning($message);
400
+ break;
401
+ case 'error':
402
+ $new_notice = Notices::addError($message);
403
+ break;
404
+ case 'notice':
405
+ default:
406
+ $new_notice = Notices::addNormal($message);
407
+ break;
408
+ }
409
+
410
+ Notices::makePersistent($new_notice, $id, MONTH_IN_SECONDS);
411
+ }
412
+
413
+
414
+ }
415
+ }
416
+
417
  // Callback to check if we are on the correct page.
418
  public function upgradeBulkCallback($notice)
419
  {
638
  if( $message !== false && strlen(trim($message)) > 0) {
639
  $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
640
  printf(
641
+ '<tr class="plugin-update-tr active"><td colspan="%s" class="plugin-update colspanchange"><div class="notice inline notice-error notice-alt"><h4>%s</h4> %s</div></td></tr>',
642
+ $wp_list_table->get_column_count(), __('Version', 'shortpixel_image_optimiser') . ' ' . $response->new_version,
643
  wpautop( $message )
644
  );
645
  }
646
 
647
  }
648
 
649
+
650
+ private function get_remote_notices()
651
+ {
652
+ $transient_name = 'shortpixel_remote_notice';
653
+ $transient_duration = DAY_IN_SECONDS;
654
+
655
+ if (\wpSPIO()->env()->is_debug)
656
+ $transient_duration = 30;
657
+
658
+ $keyModel = new apiKeyModel();
659
+ $keyModel->loadKey();
660
+
661
+ $notices = get_transient($transient_name);
662
+ $url = $this->remote_message_endpoint;
663
+ $url = add_query_arg(array(
664
+ 'key' => $keyModel->getKey(),
665
+ 'version' => SHORTPIXEL_IMAGE_OPTIMISER_VERSION,
666
+ 'target' => 3,
667
+ ), $url);
668
+
669
+
670
+ if ( $notices === false ) {
671
+ $notices_response = wp_safe_remote_request( $url );
672
+ $content = false;
673
+ if (! is_wp_error( $notices_response ) )
674
+ {
675
+ Log::addTemp('Return Remote Notice', $notices_response);
676
+ $notices = json_decode($notices_response['body']);
677
+ Log::addTemp($notices);
678
+ Log::addTemp(json_last_error_msg());
679
+
680
+ if (! is_array($notices))
681
+ $notices = false;
682
+
683
+ // Save transient anywhere to prevent over-asking when nothing good is there.
684
+ set_transient( $transient_name, $notices, $transient_duration );
685
+ }
686
+ else
687
+ {
688
+ set_transient( $transient_name, false, $transient_duration );
689
+ }
690
+ }
691
+
692
+ return $notices;
693
+ }
694
  /**
695
  * Stolen from SPAI, Thanks.
696
  */
697
  private function get_update_notice($data, $response) {
698
+ $transient_name = 'shortpixel_update_notice_' . $response->new_version;
699
+
700
+ $transient_duration = DAY_IN_SECONDS;
701
+
702
+ if (\wpSPIO()->env()->is_debug)
703
+ $transient_duration = 30;
704
+
705
  $update_notice = get_transient( $transient_name );
706
+
707
+ $url = $this->remote_readme_endpoint;
708
 
709
  if ( $update_notice === false || strlen( $update_notice ) == 0 ) {
710
  $readme_response = wp_safe_remote_request( $url );
714
  $content = $readme_response['body'];
715
  }
716
 
 
717
  if ( !empty( $readme_response ) ) {
718
  $update_notice = $this->parse_update_notice( $content, $response );
719
+ set_transient( $transient_name, $update_notice, $transient_duration );
720
  }
721
  }
722
 
734
  * @return string
735
  */
736
  private function parse_update_notice( $content, $response ) {
 
 
 
 
 
 
 
 
 
 
 
 
737
  $new_version = $response->new_version;
738
 
739
+ $update_notice = false;
740
 
741
  // foreach ( $check_for_notices as $id => $check_version ) {
742
  if ( version_compare( SHORTPIXEL_IMAGE_OPTIMISER_VERSION, $new_version, '>' ) ) {
745
 
746
  $result = $this->parse_readme_content( $content, $new_version, $response );
747
 
748
+ if ( !empty( $result ) && strlen($result) > 0 ) {
749
  $update_notice = $result;
750
  }
751
  // }
776
 
777
  if (! isset($matches[1]))
778
  return ''; // no update texts.
779
+
780
+ $match = $matches[1];
781
+ // $match = str_replace('\n', '', $matches[1]);
782
+ $lines = str_split(trim($match));
783
+
784
  $versions = array();
785
  $inv = false;
786
  foreach($lines as $char)
803
  }
804
  elseif(! $inv) // record the message
805
  {
806
+ if (isset($curver))
807
+ $versions[trim($curver)] .= $char;
808
  }
809
 
 
810
  }
811
 
812
  foreach($versions as $version => $line)
821
 
822
  }
823
 
824
+
825
+ return trim($notice);
826
  }
827
 
828
  /*private function replace_readme_constants( $content, $response ) {
833
  } */
834
 
835
  private function markdown2html( $content ) {
836
+
837
+ $content = str_replace(array(PHP_EOL, '\n', '\n\r'), '<br>', $content);
838
+
839
+ $patterns = [
840
  '/\*\*(.+)\*\*/U', // bold
841
  '/__(.+)__/U', // italic
842
  '/\[([^\]]*)\]\(([^\)]*)\)/U', // link
class/Controller/EditMediaController.php CHANGED
@@ -149,6 +149,10 @@ class EditMediaController extends \ShortPixel\Controller
149
  {
150
  $stats[] = array(__(" WebP images", 'shortpixel-image-optimiser'), $data['webpCount']);
151
  }
 
 
 
 
152
  if ($data['exifKept'])
153
  $stats[] = array(__('EXIF kept', 'shortpixel-image-optimiser'), '');
154
  else {
149
  {
150
  $stats[] = array(__(" WebP images", 'shortpixel-image-optimiser'), $data['webpCount']);
151
  }
152
+ if ($data['avifCount'])
153
+ {
154
+ $stats[] = array(__(" Avif images", 'shortpixel-image-optimiser'), $data['avifCount']);
155
+ }
156
  if ($data['exifKept'])
157
  $stats[] = array(__('EXIF kept', 'shortpixel-image-optimiser'), '');
158
  else {
class/Controller/FrontController.php CHANGED
@@ -37,7 +37,7 @@ class FrontController extends \ShortPixel\Controller
37
  if ( $webp_option ) {
38
  if(\ShortPixelTools::shortPixelIsPluginActive('shortpixel-adaptive-images/short-pixel-ai.php')) {
39
  Notices::addWarning(__('Please deactivate the ShortPixel Image Optimizer\'s
40
- <a href="options-general.php?page=wp-shortpixel-settings&part=adv-settings">Deliver WebP using PICTURE tag</a>
41
  option when the ShortPixel Adaptive Images plugin is active.','shortpixel-image-optimiser'), true);
42
  }
43
  elseif( $webp_option == self::WEBP_GLOBAL ){
37
  if ( $webp_option ) {
38
  if(\ShortPixelTools::shortPixelIsPluginActive('shortpixel-adaptive-images/short-pixel-ai.php')) {
39
  Notices::addWarning(__('Please deactivate the ShortPixel Image Optimizer\'s
40
+ <a href="options-general.php?page=wp-shortpixel-settings&part=adv-settings">Deliver the next generation versions of the images in the front-end</a>
41
  option when the ShortPixel Adaptive Images plugin is active.','shortpixel-image-optimiser'), true);
42
  }
43
  elseif( $webp_option == self::WEBP_GLOBAL ){
class/Controller/SettingsController.php CHANGED
@@ -401,10 +401,15 @@ class SettingsController extends \ShortPixel\Controller
401
  {
402
  $deliverwebp = 0;
403
  if (! $this->is_nginx)
404
- \WPShortPixel::alterHtaccess(true); // always remove the statements.
405
-
406
- if (isset($post['createWebp']) && $post['createWebp'] == 1)
407
  {
 
 
 
 
 
 
 
 
408
  if (isset($post['deliverWebp']) && $post['deliverWebp'] == 1)
409
  {
410
  $type = isset($post['deliverWebpType']) ? $post['deliverWebpType'] : '';
@@ -425,17 +430,20 @@ class SettingsController extends \ShortPixel\Controller
425
  $deliverwebp = 3;
426
  }
427
  }
428
- }
 
429
 
430
  if (! $this->is_nginx && $deliverwebp == 3) // unaltered wepb via htaccess
431
  {
432
- \WPShortPixel::alterHtaccess();
433
  }
434
 
435
  $post['deliverWebp'] = $deliverwebp;
436
  unset($post['deliverWebpAlteringType']);
437
  unset($post['deliverWebpType']);
438
 
 
 
439
  return $post;
440
  }
441
 
401
  {
402
  $deliverwebp = 0;
403
  if (! $this->is_nginx)
 
 
 
404
  {
405
+ \WPShortPixel::alterHtaccess(false, false); // always remove the statements.
406
+ //\WPShortPixel::alterHtaccessForAvif(true); // always remove the statements.
407
+ }
408
+ $haswebp = (isset($post['createWebp']) && $post['createWebp'] == 1) ? true : false;
409
+ $hasavif = (isset($post['createAvif']) && $post['createAvif'] == 1) ? true : false;
410
+
411
+ // if ($haswebp || $hasavif)
412
+ // {
413
  if (isset($post['deliverWebp']) && $post['deliverWebp'] == 1)
414
  {
415
  $type = isset($post['deliverWebpType']) ? $post['deliverWebpType'] : '';
430
  $deliverwebp = 3;
431
  }
432
  }
433
+ // }
434
+
435
 
436
  if (! $this->is_nginx && $deliverwebp == 3) // unaltered wepb via htaccess
437
  {
438
+ \WPShortPixel::alterHtaccess(true, true); // write both.
439
  }
440
 
441
  $post['deliverWebp'] = $deliverwebp;
442
  unset($post['deliverWebpAlteringType']);
443
  unset($post['deliverWebpType']);
444
 
445
+ //echo "<PRE>"; var_dump($deliverwebp); print_r($post); echo "</PRE>"; exit();
446
+
447
  return $post;
448
  }
449
 
class/Controller/View/BulkViewController.php CHANGED
@@ -91,11 +91,16 @@ protected $selected_folders = array();
91
  $settings->processThumbnails = 0;
92
  }
93
 
94
- if ( isset($_POST['createWebp']) )
95
  $settings->createWebp = 1;
96
  else
97
  $settings->createWebp = 0;
98
 
 
 
 
 
 
99
  //clean the custom files errors in order to process them again
100
  if($settings->hasCustomFolders) {
101
  $spMetaDao->resetFailed();
91
  $settings->processThumbnails = 0;
92
  }
93
 
94
+ if (isset($_POST['createWebp']) )
95
  $settings->createWebp = 1;
96
  else
97
  $settings->createWebp = 0;
98
 
99
+ if (isset($_POST['createAvif']))
100
+ $settings->createAvif = 1;
101
+ else
102
+ $settings->createAvif = 0;
103
+
104
  //clean the custom files errors in order to process them again
105
  if($settings->hasCustomFolders) {
106
  $spMetaDao->resetFailed();
class/Controller/View/OtherMediaViewController.php CHANGED
@@ -92,7 +92,7 @@ class OtherMediaViewController extends \ShortPixel\Controller
92
  $actions = array(
93
  'optimize' => array('action' => 'optimize', '_wpnonce' => $nonce , 'text' => __('Optimize now','shortpixel-image-optimiser'), 'class' => ''),
94
 
95
- 'retry' => array('action' => 'optimize', '_wpnonce' => $nonce, 'text' => __('Retry','shortpixel-image-optimiser')),
96
 
97
  'redolossless' => array('action' => 'redo', '_wpnonce' => $nonce, 'type' => 'lossless', 'text' => __('Re-optimize lossless','shortpixel-image-optimiser')),
98
 
@@ -538,7 +538,7 @@ class OtherMediaViewController extends \ShortPixel\Controller
538
  }
539
  }
540
 
541
-
542
  if (count($thisActions) == 1)
543
  $thisActions[0]['class'] .= 'button-smaller button button-primary';
544
 
92
  $actions = array(
93
  'optimize' => array('action' => 'optimize', '_wpnonce' => $nonce , 'text' => __('Optimize now','shortpixel-image-optimiser'), 'class' => ''),
94
 
95
+ 'retry' => array('action' => 'optimize', '_wpnonce' => $nonce, 'text' => __('Retry','shortpixel-image-optimiser'), 'class' => ''),
96
 
97
  'redolossless' => array('action' => 'redo', '_wpnonce' => $nonce, 'type' => 'lossless', 'text' => __('Re-optimize lossless','shortpixel-image-optimiser')),
98
 
538
  }
539
  }
540
 
541
+
542
  if (count($thisActions) == 1)
543
  $thisActions[0]['class'] .= 'button-smaller button button-primary';
544
 
class/db/shortpixel-custom-meta-dao.php CHANGED
@@ -50,7 +50,7 @@ class ShortPixelCustomMetaDao {
50
  status SMALLINT NOT NULL DEFAULT 0,
51
  ts_updated timestamp,
52
  ts_created timestamp,
53
- UNIQUE KEY id (id)
54
  ) $charsetCollate;";
55
  // UNIQUE INDEX spf_path_md5 (path_md5)
56
  }
@@ -76,7 +76,7 @@ class ShortPixelCustomMetaDao {
76
  message varchar(255),
77
  ts_added timestamp,
78
  ts_optimized timestamp,
79
- UNIQUE KEY sp_id (id)
80
  ) $charsetCollate;";
81
  //UNIQUE INDEX sp_path_md5 (path_md5),
82
  //FOREIGN KEY fk_shortpixel_meta_folder(folder_id) REFERENCES {$tablePrefix}shortpixel_folders(id)
50
  status SMALLINT NOT NULL DEFAULT 0,
51
  ts_updated timestamp,
52
  ts_created timestamp,
53
+ PRIMARY KEY id (id)
54
  ) $charsetCollate;";
55
  // UNIQUE INDEX spf_path_md5 (path_md5)
56
  }
76
  message varchar(255),
77
  ts_added timestamp,
78
  ts_optimized timestamp,
79
+ PRIMARY KEY sp_id (id)
80
  ) $charsetCollate;";
81
  //UNIQUE INDEX sp_path_md5 (path_md5),
82
  //FOREIGN KEY fk_shortpixel_meta_folder(folder_id) REFERENCES {$tablePrefix}shortpixel_folders(id)
class/db/wp-shortpixel-media-library-adapter.php CHANGED
@@ -620,6 +620,7 @@ class WpShortPixelMediaLbraryAdapter {
620
  foreach($sizes as $key => $val) {
621
  if (strpos($key, ShortPixelMeta::WEBP_THUMB_PREFIX) === 0) continue;
622
  if (isset($val['mime-type']) && $val['mime-type'] == "image/webp") continue;
 
623
  if(!isset($val['file'])) continue;
624
  if (in_array($key, $exclude)) continue;
625
  $file = $val['file'];
620
  foreach($sizes as $key => $val) {
621
  if (strpos($key, ShortPixelMeta::WEBP_THUMB_PREFIX) === 0) continue;
622
  if (isset($val['mime-type']) && $val['mime-type'] == "image/webp") continue;
623
+ if (isset($val['mime-type']) && $val['mime-type'] == "image/avif") continue;
624
  if(!isset($val['file'])) continue;
625
  if (in_array($key, $exclude)) continue;
626
  $file = $val['file'];
class/external/wp-offload-media.php CHANGED
@@ -355,7 +355,7 @@ class wpOffload
355
  // GetbyURL can't find thumbnails, only the main image. We are going to assume, if imagebase is ok, the webp might be there.
356
  public function fixWebpRemotePath($bool, $file, $url, $imagebase)
357
  {
358
- if (strpos($url, $imagebase) !== false)
359
  return $file;
360
  else
361
  return $bool;
355
  // GetbyURL can't find thumbnails, only the main image. We are going to assume, if imagebase is ok, the webp might be there.
356
  public function fixWebpRemotePath($bool, $file, $url, $imagebase)
357
  {
358
+ if (strpos($url, $imagebase->getPath()) !== false)
359
  return $file;
360
  else
361
  return $bool;
class/front/img-to-picture-webp.php CHANGED
@@ -135,6 +135,7 @@ class ShortPixelImgToPictureWebp
135
  }
136
 
137
  $img = $this->get_attributes($match[0]);
 
138
 
139
  if(isset($img['style']) && strpos($img['style'], 'background') !== false) {
140
  //don't replace for <img>'s that have background
@@ -161,7 +162,8 @@ class ShortPixelImgToPictureWebp
161
  Log::addDebug('ImageBase'. $imageBase);
162
 
163
  //some attributes should not be moved from <img>
164
- $altAttr = isset($img['alt']) && strlen($img['alt']) ? ' alt="' . $img['alt'] . '"' : '';
 
165
  $idAttr = isset($img['id']) && strlen($img['id']) ? ' id="' . $img['id'] . '"' : '';
166
  $heightAttr = isset($img['height']) && strlen($img['height']) ? ' height="' . $img['height'] . '"' : '';
167
  $widthAttr = isset($img['width']) && strlen($img['width']) ? ' width="' . $img['width'] . '"' : '';
@@ -172,7 +174,7 @@ class ShortPixelImgToPictureWebp
172
  unset($img['data-src']);
173
  unset($img['data-lazy-src']);
174
  unset($img['srcset']);
175
- unset($img['loading']);
176
  // unset($img['data-srcset']); // lazyload - don't know if this solves anything.
177
  unset($img['sizes']);
178
 
@@ -184,6 +186,7 @@ class ShortPixelImgToPictureWebp
184
  unset($img['height']);
185
 
186
  $srcsetWebP = array();
 
187
 
188
  $imagePaths = array();
189
 
@@ -221,6 +224,8 @@ class ShortPixelImgToPictureWebp
221
  $fileurl_base = str_replace($fsFile->getFileName(), '', $fileurl);
222
  $files = array($fileWebp, $fileWebpCompat);
223
 
 
 
224
  foreach($files as $thisfile)
225
  {
226
  $fileWebp_exists = apply_filters('shortpixel_image_exists', $thisfile->exists(), $thisfile);
@@ -229,6 +234,7 @@ class ShortPixelImgToPictureWebp
229
  $thisfile = $fileWebp_exists = apply_filters('shortpixel/front/webp_notfound', false, $thisfile, $fileurl, $imageBase);
230
  }
231
 
 
232
  if ($thisfile !== false)
233
  {
234
  // base url + found filename + optional condition ( in case of sourceset, as in 1400w or similar)
@@ -237,44 +243,20 @@ class ShortPixelImgToPictureWebp
237
  break;
238
  }
239
  }
240
- }
241
 
242
- /* if () {
243
- $srcsetWebP .= (strlen($srcsetWebP) ? ',': '')
244
- . $parts[0].'.webp'
245
- . (isset($parts[1]) ? ' ' . $parts[1] : '');
246
- }
247
- if (apply_filters( 'shortpixel_image_exists', file_exists($fileWebPCompat), $fileWebPCompat)) {
248
- $srcsetWebP .= (strlen($srcsetWebP) ? ',': '')
249
- .preg_replace('/\.[a-zA-Z0-9]+$/', '.webp', $parts[0])
250
- .(isset($parts[1]) ? ' ' . $parts[1] : '');
251
- }
252
- else {
253
- $notfound = apply_filters('shortpixel/front/webp_notfound', false, $fileWebP, $fileWebpCompat, $item);
254
- Log::addDebug('Image srcset for webp doesn\'t exist', array($fileWebP));
255
- } */
256
- // }
257
- //$srcsetWebP = preg_replace('/\.[a-zA-Z0-9]+\s+/', '.webp ', $srcset);
258
- /* } else {
259
- $srcset = trim($src);
260
-
261
- $fileWebPCompat = $imageBase . wp_basename($srcset, '.' . pathinfo($srcset, PATHINFO_EXTENSION)) . '.webp';
262
- $fileWebP = $imageBase . wp_basename($srcset) . '.webp';
263
- if (apply_filters( 'shortpixel_image_exists', file_exists($fileWebP), $fileWebP)) {
264
- $srcsetWebP = $srcset.".webp";
265
- } else {
266
- if (apply_filters( 'shortpixel_image_exists', file_exists($fileWebPCompat), $fileWebPCompat) ) {
267
- $srcsetWebP = preg_replace('/\.[a-zA-Z0-9]+$/', '.webp', $srcset);
268
- }
269
- else {
270
- Log::addDebug('Image file for webp doesn\'t exist', array($fileWebP));
271
  }
272
- }
273
- } */
274
- //return($match[0]. "<!-- srcsetTZF:".$srcsetWebP." -->");
275
 
276
 
277
- if (count($srcsetWebP) == 0) {
 
 
 
 
278
  return $match[0]; //. (isset($_GET['SHORTPIXEL_DEBUG']) ? '<!-- SPDBG no srcsetWebP found (' . $srcsetWebP . ') -->' : '');
279
  Log::addInfo(' SPDBG no srcsetWebP found (' . $srcsetWebP . ')');
280
  }
@@ -283,6 +265,10 @@ class ShortPixelImgToPictureWebp
283
  $img['class'] = (isset($img['class']) ? $img['class'] . " " : "") . "sp-no-webp";
284
 
285
  $imgpicture = $img;
 
 
 
 
286
  // remove certain elements for the main picture element.
287
  $imgpicture = $this->filterForPicture($imgpicture);
288
 
@@ -297,14 +283,24 @@ class ShortPixelImgToPictureWebp
297
  $srcset = $src; // if not srcset ( it's a src ), replace those.
298
  $srcPrefix = $srcInfo['prefix'];
299
 
300
- $srcsetWebP = implode(',', $srcsetWebP);
301
 
302
- return '<picture ' . $this->create_attributes($imgpicture) . '>'
303
- .'<source ' . $srcsetPrefix . 'srcset="' . $srcsetWebP . '"' . ($sizes ? ' ' . $sizesPrefix . 'sizes="' . $sizes . '"' : '') . ' type="image/webp">'
304
- .'<source ' . $srcsetPrefix . 'srcset="' . $srcset . '"' . ($sizes ? ' ' . $sizesPrefix . 'sizes="' . $sizes . '"' : '') . ' type="' . $mime . '">'
 
 
 
 
 
 
 
 
305
  .'<img ' . $srcPrefix . 'src="' . $src . '" ' . $this->create_attributes($img) . $idAttr . $altAttr . $heightAttr . $widthAttr
306
  . (strlen($srcset) ? ' srcset="' . $srcset . '"': '') . (strlen($sizes) ? ' sizes="' . $sizes . '"': '') . '>'
307
  .'</picture>';
 
 
308
  }
309
 
310
  /** Check and remove elements that should not be in the picture tag. Especially items within attributes. */
135
  }
136
 
137
  $img = $this->get_attributes($match[0]);
138
+ // echo "<PRE>"; var_dump($img); echo "</PRE>";
139
 
140
  if(isset($img['style']) && strpos($img['style'], 'background') !== false) {
141
  //don't replace for <img>'s that have background
162
  Log::addDebug('ImageBase'. $imageBase);
163
 
164
  //some attributes should not be moved from <img>
165
+ // @todo Move these to unset on (imgpicture) and put via create_attributes back
166
+ $altAttr = isset($img['alt']) ? ' alt="' . $img['alt'] . '"' : '';
167
  $idAttr = isset($img['id']) && strlen($img['id']) ? ' id="' . $img['id'] . '"' : '';
168
  $heightAttr = isset($img['height']) && strlen($img['height']) ? ' height="' . $img['height'] . '"' : '';
169
  $widthAttr = isset($img['width']) && strlen($img['width']) ? ' width="' . $img['width'] . '"' : '';
174
  unset($img['data-src']);
175
  unset($img['data-lazy-src']);
176
  unset($img['srcset']);
177
+
178
  // unset($img['data-srcset']); // lazyload - don't know if this solves anything.
179
  unset($img['sizes']);
180
 
186
  unset($img['height']);
187
 
188
  $srcsetWebP = array();
189
+ $srcsetAvif = array();
190
 
191
  $imagePaths = array();
192
 
224
  $fileurl_base = str_replace($fsFile->getFileName(), '', $fileurl);
225
  $files = array($fileWebp, $fileWebpCompat);
226
 
227
+ $fileAvif = $fs->getFile($imageBase . $fsFile->getFileBase() . '.avif');
228
+
229
  foreach($files as $thisfile)
230
  {
231
  $fileWebp_exists = apply_filters('shortpixel_image_exists', $thisfile->exists(), $thisfile);
234
  $thisfile = $fileWebp_exists = apply_filters('shortpixel/front/webp_notfound', false, $thisfile, $fileurl, $imageBase);
235
  }
236
 
237
+
238
  if ($thisfile !== false)
239
  {
240
  // base url + found filename + optional condition ( in case of sourceset, as in 1400w or similar)
243
  break;
244
  }
245
  }
 
246
 
247
+ $fileAvif_exists = apply_filters('shortpixel_image_exists', $fileAvif->exists(), $fileAvif);
248
+ if ($fileAvif_exists !== false)
249
+ {
250
+ $fileurl_base = str_replace($fsFile->getFileName(), '', $fileurl);
251
+ $srcsetAvif[] = $fileurl_base . $fileAvif->getFileName() . $condition;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  }
 
 
 
253
 
254
 
255
+
256
+
257
+ }
258
+
259
+ if (count($srcsetWebP) == 0 && count($srcsetAvif) == 0) {
260
  return $match[0]; //. (isset($_GET['SHORTPIXEL_DEBUG']) ? '<!-- SPDBG no srcsetWebP found (' . $srcsetWebP . ') -->' : '');
261
  Log::addInfo(' SPDBG no srcsetWebP found (' . $srcsetWebP . ')');
262
  }
265
  $img['class'] = (isset($img['class']) ? $img['class'] . " " : "") . "sp-no-webp";
266
 
267
  $imgpicture = $img;
268
+
269
+ // Items that should not go on picture, but remain on img tag.
270
+ unset($imgpicture['loading']);
271
+
272
  // remove certain elements for the main picture element.
273
  $imgpicture = $this->filterForPicture($imgpicture);
274
 
283
  $srcset = $src; // if not srcset ( it's a src ), replace those.
284
  $srcPrefix = $srcInfo['prefix'];
285
 
286
+ $output = '<picture ' . $this->create_attributes($imgpicture) . '>';
287
 
288
+ if (count($srcsetAvif) > 0)
289
+ {
290
+ $srcsetAvif = implode(',', $srcsetAvif);
291
+ $output .= '<source ' . $srcsetPrefix . 'srcset="' . $srcsetAvif . '"' . ($sizes ? ' ' . $sizesPrefix . 'sizes="' . $sizes . '"' : '') . ' type="image/avif">';
292
+ }
293
+ if (count($srcsetWebP) > 0)
294
+ {
295
+ $srcsetWebP = implode(',', $srcsetWebP);
296
+ $output .= '<source ' . $srcsetPrefix . 'srcset="' . $srcsetWebP . '"' . ($sizes ? ' ' . $sizesPrefix . 'sizes="' . $sizes . '"' : '') . ' type="image/webp">';
297
+ }
298
+ $output .= '<source ' . $srcsetPrefix . 'srcset="' . $srcset . '"' . ($sizes ? ' ' . $sizesPrefix . 'sizes="' . $sizes . '"' : '') . ' type="' . $mime . '">'
299
  .'<img ' . $srcPrefix . 'src="' . $src . '" ' . $this->create_attributes($img) . $idAttr . $altAttr . $heightAttr . $widthAttr
300
  . (strlen($srcset) ? ' srcset="' . $srcset . '"': '') . (strlen($sizes) ? ' sizes="' . $sizes . '"': '') . '>'
301
  .'</picture>';
302
+
303
+ return $output;
304
  }
305
 
306
  /** Check and remove elements that should not be in the picture tag. Especially items within attributes. */
class/view/settings/part-advanced.php CHANGED
@@ -15,6 +15,7 @@ namespace ShortPixel;
15
  $deliverWebpUnaltered = ''; // Uncheck
16
  $deliverWebpUnalteredDisabled = 'disabled'; // Disable
17
  $deliverWebpUnalteredLabel = __('It looks like you\'re running your site on an NginX server. This means that you can only achieve this functionality by directly configuring the server config files. Please follow this link for instructions on how to achieve this:','shortpixel-image-optimiser')." <a href=\"https://help.shortpixel.com/article/111-configure-nginx-to-transparently-serve-webp-files-when-supported\" target=\"_blank\" data-beacon-article=\"5bfeb9de2c7d3a31944e78ee\">Open article</a>";
 
18
  } else {
19
  if( !$this->is_htaccess_writable ){
20
  $deliverWebpUnalteredDisabled = 'disabled'; // Disable
@@ -191,7 +192,7 @@ namespace ShortPixel;
191
  <tr class='exif_warning view-notice-row'>
192
  <th scope="row">&nbsp;</th>
193
  <td>
194
- <div class='view-notice warning'><p><?php printf(__('Warning - Converting from PNG to JPG will %s not %s keep the EXIF-information!'), "<strong>","</strong>"); ?></p></div>
195
  </td>
196
  </tr>
197
  <tr>
@@ -202,23 +203,41 @@ namespace ShortPixel;
202
  <p class="settings-info"><?php _e('Images for the web only need RGB format and converting them from CMYK to RGB makes them smaller.','shortpixel-image-optimiser');?></p>
203
  </td>
204
  </tr>
 
205
  <tr>
206
- <th scope="row"><?php _e('WebP Images:','shortpixel-image-optimiser');?></th>
207
  <td>
208
  <input name="createWebp" type="checkbox" id="createWebp" value="1" <?php checked( $view->data->createWebp, "1" );?>>
209
  <label for="createWebp">
210
- <?php _e('Also create <a href="http://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank">WebP versions</a> of the images, <strong>for free</strong>.','shortpixel-image-optimiser');?>
211
  </label>
212
  <p class="settings-info">
213
- <?php _e('WebP images can be up to three times smaller than PNGs and 25% smaller than JPGs. Choosing this option <strong>does not use up additional credits</strong>.','shortpixel-image-optimiser');?>
214
- <a href="http://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank" class="shortpixel-help-link">
 
 
 
 
 
 
 
 
 
 
215
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
216
  </a>
 
 
 
 
 
217
  </p>
 
 
218
  <div class="deliverWebpSettings">
219
  <input name="deliverWebp" type="checkbox" id="deliverWebp" value="1" <?php checked( ($view->data->deliverWebp > 0), true);?>>
220
  <label for="deliverWebp">
221
- <?php _e('Deliver the WebP versions of the images in the front-end:','shortpixel-image-optimiser');?>
222
  </label>
223
  <ul class="deliverWebpTypes">
224
  <li>
@@ -232,7 +251,7 @@ namespace ShortPixel;
232
  </p>
233
  <?php } ?>
234
  <p class="settings-info">
235
- <?php _e('Each &lt;img&gt; will be replaced with a &lt;picture&gt; tag that will also provide the WebP image as a choice for browsers that support it. Also loads the picturefill.js for browsers that don\'t support the &lt;picture&gt; tag. You don\'t need to activate this if you\'re using the Cache Enabler plugin because your WebP images are already handled by this plugin. <strong>Please make a test before using this option</strong>, as if the styles that your theme is using rely on the position of your &lt;img&gt; tag, you might experience display problems.','shortpixel-image-optimiser'); ?>
236
  <strong><?php _e('You can revert anytime to the previous state by just deactivating the option.','shortpixel-image-optimiser'); ?></strong>
237
  </p>
238
  <ul class="deliverWebpAlteringTypes">
@@ -265,6 +284,8 @@ namespace ShortPixel;
265
  </div>
266
  </td>
267
  </tr>
 
 
268
  <tr>
269
  <th scope="row"><?php _e('Optimize Retina images','shortpixel-image-optimiser');?></th>
270
  <td>
@@ -272,7 +293,7 @@ namespace ShortPixel;
272
  <label for="optimizeRetina"><?php _e('Also optimize the Retina images (@2x) if they exist.','shortpixel-image-optimiser');?></label>
273
  <p class="settings-info">
274
  <?php _e('If you have a Retina plugin that generates Retina-specific images (@2x), ShortPixel can optimize them too, alongside the regular Media Library images and thumbnails.','shortpixel-image-optimiser');?>
275
- <a href="http://blog.shortpixel.com/how-to-use-optimized-retina-images-on-your-wordpress-site-for-best-user-experience-on-apple-devices/" target="_blank" class="shortpixel-help-link">
276
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
277
  </a>
278
  </p>
@@ -312,7 +333,7 @@ namespace ShortPixel;
312
  <br>For the <strong>"size"</strong> type,
313
  which applies only to Media Library images, <strong>the main images (not thumbnails)</strong> that have the size in the specified range will be excluded.
314
  The format for the "size" exclude is: <strong>minWidth</strong>-<strong>maxWidth</strong>x<strong>minHeight</strong>-<strong>maxHeight</strong>, for example <strong>size:1000-1100x2000-2200</strong>. You can also specify a precise size, as <strong>1000x2000</strong>.','shortpixel-image-optimiser');?>
315
- <a href="http://blog.shortpixel.com/shortpixel-how-to-exclude-images-and-folders-from-optimization/" target="_blank" class="shortpixel-help-link">
316
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
317
  </a>
318
  </p>
15
  $deliverWebpUnaltered = ''; // Uncheck
16
  $deliverWebpUnalteredDisabled = 'disabled'; // Disable
17
  $deliverWebpUnalteredLabel = __('It looks like you\'re running your site on an NginX server. This means that you can only achieve this functionality by directly configuring the server config files. Please follow this link for instructions on how to achieve this:','shortpixel-image-optimiser')." <a href=\"https://help.shortpixel.com/article/111-configure-nginx-to-transparently-serve-webp-files-when-supported\" target=\"_blank\" data-beacon-article=\"5bfeb9de2c7d3a31944e78ee\">Open article</a>";
18
+ $deliverAVIFLabel = __('<strong>It looks like you\'re running your site on an NginX server. You might need additional configuration for AVIF delivery to work as expected</strong>','shortpixel-image-optimiser')." <a href=\"https://blog.shortpixel.com/avif-mime-type-delivery-nginx/\" target=\"_blank\">Read more</a>";
19
  } else {
20
  if( !$this->is_htaccess_writable ){
21
  $deliverWebpUnalteredDisabled = 'disabled'; // Disable
192
  <tr class='exif_warning view-notice-row'>
193
  <th scope="row">&nbsp;</th>
194
  <td>
195
+ <div class='view-notice warning'><p><?php printf(__('Warning - Converting from PNG to JPG will %s not %s keep the EXIF-information!', 'shortpixel-image-optimiser'), "<strong>","</strong>"); ?></p></div>
196
  </td>
197
  </tr>
198
  <tr>
203
  <p class="settings-info"><?php _e('Images for the web only need RGB format and converting them from CMYK to RGB makes them smaller.','shortpixel-image-optimiser');?></p>
204
  </td>
205
  </tr>
206
+
207
  <tr>
208
+ <th scope="row"><?php _e('Next Generation Images','shortpixel-image-optimiser');?></th>
209
  <td>
210
  <input name="createWebp" type="checkbox" id="createWebp" value="1" <?php checked( $view->data->createWebp, "1" );?>>
211
  <label for="createWebp">
212
+ <?php _e('Also create <a href="https://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank">WebP versions</a> of the images, with the additional cost of 1 credit = 1 image or thumbnail..','shortpixel-image-optimiser');?>
213
  </label>
214
  <p class="settings-info">
215
+ <?php _e('WebP images can be up to three times smaller than PNGs and 25% smaller than JPGs. <span class="red"><strong>Starting May 10th, 2021 this option will use additional credits (1 credit = 1 image or thumbnail)!</strong></span>','shortpixel-image-optimiser');?>
216
+ <a href="https://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank" class="shortpixel-help-link">
217
+ <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
218
+ </a>
219
+ </p>
220
+
221
+ <p>&nbsp;</p>
222
+ <input name="createAvif" type="checkbox" id="createAvif" value="1" <?php checked( $view->data->createAvif, "1"); ?>>
223
+ <label for="createAvif"><?php _e('Also create <a href="https://blog.shortpixel.com/what-is-avif-and-why-is-it-good/" target="_blank">AVIF versions</a> of the images, with the additional cost of 1 credit = 1 image or thumbnail.','shortpixel-image-optimiser');?></label>
224
+ <p class="settings-info">
225
+ <?php _e('AVIF is a new format (AV1 Image File Format) and the images can be up to 50% smaller than WebPs, on average. AVIF files are stored with the .avif file name extension ','shortpixel-image-optimiser');?>
226
+ <a href="https://blog.shortpixel.com/what-is-avif-and-why-is-it-good/" target="_blank" class="shortpixel-help-link">
227
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
228
  </a>
229
+ <?php if($deliverAVIFLabel){ ?>
230
+ <p class="sp-notice">
231
+ <?php echo( $deliverAVIFLabel );?>
232
+ </p>
233
+ <?php } ?>
234
  </p>
235
+ <p>&nbsp;</p>
236
+
237
  <div class="deliverWebpSettings">
238
  <input name="deliverWebp" type="checkbox" id="deliverWebp" value="1" <?php checked( ($view->data->deliverWebp > 0), true);?>>
239
  <label for="deliverWebp">
240
+ <?php _e('Deliver the next generation versions of the images in the front-end:','shortpixel-image-optimiser');?>
241
  </label>
242
  <ul class="deliverWebpTypes">
243
  <li>
251
  </p>
252
  <?php } ?>
253
  <p class="settings-info">
254
+ <?php _e('Each &lt;img&gt; will be replaced with a &lt;picture&gt; tag that will also provide AVIF and WebP images as a choice for browsers that support it. Also loads the picturefill.js for browsers that don\'t support the &lt;picture&gt; tag. You don\'t need to activate this if you\'re using the Cache Enabler plugin because your Avif\WebP images are already handled by this plugin. <strong>Please make a test before using this option</strong>, as if the styles that your theme is using rely on the position of your &lt;img&gt; tag, you might experience display problems.','shortpixel-image-optimiser'); ?>
255
  <strong><?php _e('You can revert anytime to the previous state by just deactivating the option.','shortpixel-image-optimiser'); ?></strong>
256
  </p>
257
  <ul class="deliverWebpAlteringTypes">
284
  </div>
285
  </td>
286
  </tr>
287
+
288
+
289
  <tr>
290
  <th scope="row"><?php _e('Optimize Retina images','shortpixel-image-optimiser');?></th>
291
  <td>
293
  <label for="optimizeRetina"><?php _e('Also optimize the Retina images (@2x) if they exist.','shortpixel-image-optimiser');?></label>
294
  <p class="settings-info">
295
  <?php _e('If you have a Retina plugin that generates Retina-specific images (@2x), ShortPixel can optimize them too, alongside the regular Media Library images and thumbnails.','shortpixel-image-optimiser');?>
296
+ <a href="https://blog.shortpixel.com/how-to-use-optimized-retina-images-on-your-wordpress-site-for-best-user-experience-on-apple-devices/" target="_blank" class="shortpixel-help-link">
297
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
298
  </a>
299
  </p>
333
  <br>For the <strong>"size"</strong> type,
334
  which applies only to Media Library images, <strong>the main images (not thumbnails)</strong> that have the size in the specified range will be excluded.
335
  The format for the "size" exclude is: <strong>minWidth</strong>-<strong>maxWidth</strong>x<strong>minHeight</strong>-<strong>maxHeight</strong>, for example <strong>size:1000-1100x2000-2200</strong>. You can also specify a precise size, as <strong>1000x2000</strong>.','shortpixel-image-optimiser');?>
336
+ <a href="https://blog.shortpixel.com/shortpixel-how-to-exclude-images-and-folders-from-optimization/" target="_blank" class="shortpixel-help-link">
337
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
338
  </a>
339
  </p>
class/view/settings/part-general.php CHANGED
@@ -82,7 +82,7 @@
82
  </p>
83
  <p class="settings-info shortpixel-radio-info shortpixel-radio-glossy" <?php echo( $view->data->compressionType == 2 ? "" : 'style="display:none"' );?>>
84
  <?php _e('<b>Glossy compression: </b>creates images that are almost pixel-perfect identical to the originals.</br> Best option for photographers and other professionals that use very high quality images on their sites and want best compression while keeping the quality untouched.','shortpixel-image-optimiser');?>
85
- <a href="http://blog.shortpixel.com/glossy-image-optimization-for-photographers/" target="_blank" class="shortpixel-help-link">
86
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info about glossy','shortpixel-image-optimiser');?>
87
  </a></p>
88
  <p class="settings-info shortpixel-radio-info shortpixel-radio-lossless" <?php echo( $view->data->compressionType == 0 ? "" : 'style="display:none"' );?>>
@@ -129,7 +129,7 @@
129
  <input name="removeExif" type="checkbox" id="removeExif" value="1" <?php checked($view->data->keepExif, 0);?>>
130
  <label for="removeExif"><?php _e('Remove the EXIF tag of the image (recommended).','shortpixel-image-optimiser');?></label>
131
  <p class="settings-info"> <?php _e('EXIF is a set of various pieces of information that are automatically embedded into the image upon creation. This can include GPS position, camera manufacturer, date and time, etc.
132
- Unless you really need that data to be preserved, we recommend removing it as it can lead to <a href="http://blog.shortpixel.com/how-much-smaller-can-be-images-without-exif-icc" target="_blank">better compression rates</a>.','shortpixel-image-optimiser');?></p>
133
 
134
  </td>
135
  </tr>
82
  </p>
83
  <p class="settings-info shortpixel-radio-info shortpixel-radio-glossy" <?php echo( $view->data->compressionType == 2 ? "" : 'style="display:none"' );?>>
84
  <?php _e('<b>Glossy compression: </b>creates images that are almost pixel-perfect identical to the originals.</br> Best option for photographers and other professionals that use very high quality images on their sites and want best compression while keeping the quality untouched.','shortpixel-image-optimiser');?>
85
+ <a href="https://blog.shortpixel.com/glossy-image-optimization-for-photographers/" target="_blank" class="shortpixel-help-link">
86
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info about glossy','shortpixel-image-optimiser');?>
87
  </a></p>
88
  <p class="settings-info shortpixel-radio-info shortpixel-radio-lossless" <?php echo( $view->data->compressionType == 0 ? "" : 'style="display:none"' );?>>
129
  <input name="removeExif" type="checkbox" id="removeExif" value="1" <?php checked($view->data->keepExif, 0);?>>
130
  <label for="removeExif"><?php _e('Remove the EXIF tag of the image (recommended).','shortpixel-image-optimiser');?></label>
131
  <p class="settings-info"> <?php _e('EXIF is a set of various pieces of information that are automatically embedded into the image upon creation. This can include GPS position, camera manufacturer, date and time, etc.
132
+ Unless you really need that data to be preserved, we recommend removing it as it can lead to <a href="https://blog.shortpixel.com/how-much-smaller-can-be-images-without-exif-icc" target="_blank">better compression rates</a>.','shortpixel-image-optimiser');?></p>
133
 
134
  </td>
135
  </tr>
class/view/settings/part-wso.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace ShortPixel;
3
+ ?>
4
+
5
+ <section class='wso banner'>
6
+ <span class="image">
7
+ <img src="<?php echo \wpSPIO()->plugin_url() ?>res/img/robo-winky.png" />
8
+ </span>
9
+ <span class="line"><h3>
10
+ <?php printf(__('ARE YOU CONCERNED WITH YOUR %s %s SITE SPEED? %s', 'enable-media-replace'),'<br>', '<span class="red">','</span>'); ?>
11
+ </h3>
12
+ </span>
13
+ <span class="line"><h3>
14
+ <?php printf(__('ALLOW ShortPixel SPECIALISTS TO %s FIND THE SOLUTION FOR YOU.', 'enable-media-replace'), '<br>'); ?>
15
+ </h3>
16
+ </span>
17
+ <span class="button-wrap">
18
+ <a href="https://wso.shortpixel.com/?utm_source=SPIO" target="_blank" class='button' ><?php _e('Find out more', 'shortpixel-image-optimiser'); ?></a>
19
+ </span>
20
+ </section>
class/view/shortpixel_view.php CHANGED
@@ -102,14 +102,25 @@ class ShortPixelView {
102
  <input type='checkbox' id='thumbnails' name='thumbnails' onclick='ShortPixel.checkThumbsUpdTotal(this)' <?php echo($this->ctrl->processThumbnails() ? "checked":"");?>>
103
  <?php _e('Include thumbnails','shortpixel-image-optimiser');?>
104
  </div><br><br>
 
105
  <div>
106
 
107
  <input name="createWebp" type="checkbox" id="createWebp" value="1" <?php checked( $settings->createWebp, "1" );?> >
108
  <label for="createWebp">
109
- <?php _e('Also create <a href="http://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank">WebP versions</a> of the images, <strong>for free</strong>.','shortpixel-image-optimiser');?>
110
  </label>
111
 
112
  </div><br>
 
 
 
 
 
 
 
 
 
 
113
  <?php if($quotaData["totalProcessedMlFiles"] > 0) { ?>
114
  <div class="bulk-label bulk-total"><?php _e('Total images','shortpixel-image-optimiser');?></div>
115
  <div class="bulk-val bulk-total"><?php echo(number_format($quotaData['totalMlFiles']));?></div>
@@ -145,7 +156,7 @@ class ShortPixelView {
145
  srcset='<?php echo(wpSPIO()->plugin_url('res/img/robo-slider.png' ));?> 1x, <?php echo(wpSPIO()->plugin_url('res/img/robo-slider@2x.png' ));?> 2x'/>
146
  </div>
147
  <div class="bulk-btn-txt">
148
- <?php printf(__('<span class="label">Start Optimizing</span><br> <span class="total">%s</span> images','shortpixel-image-optimiser'),
149
  $this->ctrl->processThumbnails() ?
150
  number_format(max(0, $quotaData['totalMlFiles'] - $quotaData['totalProcessedMlFiles']) + $customCount) :
151
  number_format(max(0, $quotaData['mainMlFiles'] - $quotaData['mainProcessedMlFiles']) + $customCount));?>
@@ -422,7 +433,7 @@ class ShortPixelView {
422
  printf(__('Already <strong>%s</strong> optimized images will not be reprocessed.','shortpixel-image-optimiser'), $todo ? ($optType) : '');
423
  if($reopt) { ?>
424
  <br><?php _e('Please note that reoptimizing images as <strong>lossy/lossless</strong> may use additional credits.','shortpixel-image-optimiser')?>
425
- <a href="http://blog.shortpixel.com/the-all-new-re-optimization-functions-in-shortpixel/" target="_blank" class="shortpixel-help-link">
426
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
427
  </a>
428
  <?php } ?>
@@ -433,14 +444,23 @@ class ShortPixelView {
433
  <input type='checkbox' id='bulk-thumbnails' name='thumbnails' <?php echo($this->ctrl->processThumbnails() ? "checked":"");?>
434
  onchange="ShortPixel.onBulkThumbsCheck(this)"> <?php _e('Include thumbnails','shortpixel-image-optimiser');?><br><br>
435
 
436
- <div>
 
 
 
 
 
 
 
 
 
437
 
438
- <input name="createWebp" type="checkbox" id="createWebp" value="1" <?php checked( $settings->createWebp, "1" );?> >
439
- <label for="createWebp">
440
- <?php _e('Also create <a href="http://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank">WebP versions</a> of the images, <strong>for free</strong>.','shortpixel-image-optimiser');?>
441
- </label>
442
 
443
- </div><br>
444
 
445
  <a class='button' style="float: right;" href='<?php echo add_query_arg('part','bulk-restore-all'); ?> '><?php _e('Bulk Restore Images','shortpixel-image-optimiser'); ?></a>
446
 
@@ -480,7 +500,7 @@ class ShortPixelView {
480
  <span class='icon' style="margin-right: 25px;"><img src="<?php echo(wpSPIO()->plugin_url('res/img/robo-winky.png' ));?>" ></span>
481
  <span class='content'>
482
  <p><?php _e('After you optimized all your images your site speed might still be improved. Allow ShortPixel Specialists to tell you how.', 'shortpixel-image-optimiser'); ?><p>
483
- <p style='font-size: 16px;'><a href="https://shortpixel.com/lp/wso/?utm_source=SPIO" target="_blank" style='font-weight: 700;'><?php _e('Get Your Site Assessment','shortpixel-image-optimiser'); ?></a></p>
484
  </span>
485
  </div>
486
  </div>
@@ -890,7 +910,7 @@ class ShortPixelView {
890
  </p>
891
  <p class="settings-info shortpixel-radio-info shortpixel-radio-glossy" <?php echo( $this->ctrl->getCompressionType() == 2 ? "" : 'style="display:none"' );?>>
892
  <?php _e('<b>Glossy compression: </b>creates images that are almost pixel-perfect identical to the originals.</br> Best option for photographers and other professionals that use very high quality images on their sites and want best compression while keeping the quality untouched.','shortpixel-image-optimiser');?>
893
- <a href="http://blog.shortpixel.com/glossy-image-optimization-for-photographers/" target="_blank" class="shortpixel-help-link">
894
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info about glossy','shortpixel-image-optimiser');?>
895
  </a></p>
896
  <p class="settings-info shortpixel-radio-info shortpixel-radio-lossless" <?php echo( $this->ctrl->getCompressionType() == 0 ? "" : 'style="display:none"' );?>>
@@ -932,7 +952,7 @@ class ShortPixelView {
932
  <input name="removeExif" type="checkbox" id="removeExif" <?php echo( $removeExif );?>>
933
  <label for="removeExif"><?php _e('Remove the EXIF tag of the image (recommended).','shortpixel-image-optimiser');?></label>
934
  <p class="settings-info"> <?php _e('EXIF is a set of various pieces of information that are automatically embedded into the image upon creation. This can include GPS position, camera manufacturer, date and time, etc.
935
- Unless you really need that data to be preserved, we recommend removing it as it can lead to <a href="http://blog.shortpixel.com/how-much-smaller-can-be-images-without-exif-icc" target="_blank">better compression rates</a>.','shortpixel-image-optimiser');?></p>
936
  </td>
937
  </tr>
938
  <tr>
@@ -1193,11 +1213,11 @@ class ShortPixelView {
1193
  <td>
1194
  <input name="createWebp" type="checkbox" id="createWebp" <?php echo( $createWebp );?>>
1195
  <label for="createWebp">
1196
- <?php _e('Also create <a href="http://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank">WebP versions</a> of the images, <strong>for free</strong>.','shortpixel-image-optimiser');?>
1197
  </label>
1198
  <p class="settings-info">
1199
  <?php _e('WebP images can be up to three times smaller than PNGs and 25% smaller than JPGs. Choosing this option <strong>does not use up additional credits</strong>.','shortpixel-image-optimiser');?>
1200
- <a href="http://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank" class="shortpixel-help-link">
1201
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
1202
  </a>
1203
  </p>
@@ -1258,7 +1278,7 @@ class ShortPixelView {
1258
  <label for="optimizeRetina"><?php _e('Also optimize the Retina images (@2x) if they exist.','shortpixel-image-optimiser');?></label>
1259
  <p class="settings-info">
1260
  <?php _e('If you have a Retina plugin that generates Retina-specific images (@2x), ShortPixel can optimize them too, alongside the regular Media Library images and thumbnails.','shortpixel-image-optimiser');?>
1261
- <a href="http://blog.shortpixel.com/how-to-use-optimized-retina-images-on-your-wordpress-site-for-best-user-experience-on-apple-devices/" target="_blank" class="shortpixel-help-link">
1262
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
1263
  </a>
1264
  </p>
@@ -1298,7 +1318,7 @@ class ShortPixelView {
1298
  <br>For the <strong>"size"</strong> type,
1299
  which applies only to Media Library images, <strong>the main images (not thumbnails)</strong> that have the size in the specified range will be excluded.
1300
  The format for the "size" exclude is: <strong>minWidth</strong>-<strong>maxWidth</strong>x<strong>minHeight</strong>-<strong>maxHeight</strong>, for example <strong>size:1000-1100x2000-2200</strong>. You can also specify a precise size, as <strong>1000x2000</strong>.','shortpixel-image-optimiser');?>
1301
- <a href="http://blog.shortpixel.com/shortpixel-how-to-exclude-images-and-folders-from-optimization/" target="_blank" class="shortpixel-help-link">
1302
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
1303
  </a>
1304
  </p>
102
  <input type='checkbox' id='thumbnails' name='thumbnails' onclick='ShortPixel.checkThumbsUpdTotal(this)' <?php echo($this->ctrl->processThumbnails() ? "checked":"");?>>
103
  <?php _e('Include thumbnails','shortpixel-image-optimiser');?>
104
  </div><br><br>
105
+
106
  <div>
107
 
108
  <input name="createWebp" type="checkbox" id="createWebp" value="1" <?php checked( $settings->createWebp, "1" );?> >
109
  <label for="createWebp">
110
+ <?php _e('Also create <a href="https://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank">WebP versions</a> of the images, with the additional cost of 1 credit = 1 image or thumbnail..','shortpixel-image-optimiser');?>
111
  </label>
112
 
113
  </div><br>
114
+
115
+ <div>
116
+
117
+ <input name="createAvif" type="checkbox" id="createAvif" value="1" <?php checked( $settings->createAvif, "1" );?> >
118
+ <label for="createAvif">
119
+ <?php _e('Also create <a href="https://blog.shortpixel.com/what-is-avif-and-why-is-it-good/" target="_blank">AVIF versions</a> of the images, with the additional cost of 1 credit = 1 image or thumbnail.','shortpixel-image-optimiser');?>
120
+ </label>
121
+
122
+ </div><br>
123
+
124
  <?php if($quotaData["totalProcessedMlFiles"] > 0) { ?>
125
  <div class="bulk-label bulk-total"><?php _e('Total images','shortpixel-image-optimiser');?></div>
126
  <div class="bulk-val bulk-total"><?php echo(number_format($quotaData['totalMlFiles']));?></div>
156
  srcset='<?php echo(wpSPIO()->plugin_url('res/img/robo-slider.png' ));?> 1x, <?php echo(wpSPIO()->plugin_url('res/img/robo-slider@2x.png' ));?> 2x'/>
157
  </div>
158
  <div class="bulk-btn-txt">
159
+ <?php printf(__('<span class="label">Start Optimizing</span><br> <span class="total">%s</span> images','shortpixel-image-. optimiser'),
160
  $this->ctrl->processThumbnails() ?
161
  number_format(max(0, $quotaData['totalMlFiles'] - $quotaData['totalProcessedMlFiles']) + $customCount) :
162
  number_format(max(0, $quotaData['mainMlFiles'] - $quotaData['mainProcessedMlFiles']) + $customCount));?>
433
  printf(__('Already <strong>%s</strong> optimized images will not be reprocessed.','shortpixel-image-optimiser'), $todo ? ($optType) : '');
434
  if($reopt) { ?>
435
  <br><?php _e('Please note that reoptimizing images as <strong>lossy/lossless</strong> may use additional credits.','shortpixel-image-optimiser')?>
436
+ <a href="https://blog.shortpixel.com/the-all-new-re-optimization-functions-in-shortpixel/" target="_blank" class="shortpixel-help-link">
437
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
438
  </a>
439
  <?php } ?>
444
  <input type='checkbox' id='bulk-thumbnails' name='thumbnails' <?php echo($this->ctrl->processThumbnails() ? "checked":"");?>
445
  onchange="ShortPixel.onBulkThumbsCheck(this)"> <?php _e('Include thumbnails','shortpixel-image-optimiser');?><br><br>
446
 
447
+ <div>
448
+
449
+ <input name="createWebp" type="checkbox" id="createWebp" value="1" <?php checked( $settings->createWebp, "1" );?> >
450
+ <label for="createWebp">
451
+ <?php _e('Also create <a href="https://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank">WebP versions</a> of the images, with the additional cost of 1 credit = 1 image or thumbnail..','shortpixel-image-optimiser');?>
452
+ </label>
453
+
454
+ </div><br>
455
+
456
+ <div>
457
 
458
+ <input name="createAvif" type="checkbox" id="createAvif" value="1" <?php checked( $settings->createAvif, "1" );?> >
459
+ <label for="createAvif">
460
+ <?php _e('Also create <a href="https://blog.shortpixel.com/what-is-avif-and-why-is-it-good/" target="_blank">AVIF versions</a> of the images, with the additional cost of 1 credit = 1 image or thumbnail.','shortpixel-image-optimiser');?>
461
+ </label>
462
 
463
+ </div><br>
464
 
465
  <a class='button' style="float: right;" href='<?php echo add_query_arg('part','bulk-restore-all'); ?> '><?php _e('Bulk Restore Images','shortpixel-image-optimiser'); ?></a>
466
 
500
  <span class='icon' style="margin-right: 25px;"><img src="<?php echo(wpSPIO()->plugin_url('res/img/robo-winky.png' ));?>" ></span>
501
  <span class='content'>
502
  <p><?php _e('After you optimized all your images your site speed might still be improved. Allow ShortPixel Specialists to tell you how.', 'shortpixel-image-optimiser'); ?><p>
503
+ <p style='font-size: 16px;'><a href="https://wso.shortpixel.com/?utm_source=SPIO" target="_blank" style='font-weight: 700;'><?php _e('Get Your Site Assessment','shortpixel-image-optimiser'); ?></a></p>
504
  </span>
505
  </div>
506
  </div>
910
  </p>
911
  <p class="settings-info shortpixel-radio-info shortpixel-radio-glossy" <?php echo( $this->ctrl->getCompressionType() == 2 ? "" : 'style="display:none"' );?>>
912
  <?php _e('<b>Glossy compression: </b>creates images that are almost pixel-perfect identical to the originals.</br> Best option for photographers and other professionals that use very high quality images on their sites and want best compression while keeping the quality untouched.','shortpixel-image-optimiser');?>
913
+ <a href="https://blog.shortpixel.com/glossy-image-optimization-for-photographers/" target="_blank" class="shortpixel-help-link">
914
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info about glossy','shortpixel-image-optimiser');?>
915
  </a></p>
916
  <p class="settings-info shortpixel-radio-info shortpixel-radio-lossless" <?php echo( $this->ctrl->getCompressionType() == 0 ? "" : 'style="display:none"' );?>>
952
  <input name="removeExif" type="checkbox" id="removeExif" <?php echo( $removeExif );?>>
953
  <label for="removeExif"><?php _e('Remove the EXIF tag of the image (recommended).','shortpixel-image-optimiser');?></label>
954
  <p class="settings-info"> <?php _e('EXIF is a set of various pieces of information that are automatically embedded into the image upon creation. This can include GPS position, camera manufacturer, date and time, etc.
955
+ Unless you really need that data to be preserved, we recommend removing it as it can lead to <a href="https://blog.shortpixel.com/how-much-smaller-can-be-images-without-exif-icc" target="_blank">better compression rates</a>.','shortpixel-image-optimiser');?></p>
956
  </td>
957
  </tr>
958
  <tr>
1213
  <td>
1214
  <input name="createWebp" type="checkbox" id="createWebp" <?php echo( $createWebp );?>>
1215
  <label for="createWebp">
1216
+ <?php _e('Also create <a href="https://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank">WebP versions</a> of the images, <strong>for free</strong>.','shortpixel-image-optimiser');?>
1217
  </label>
1218
  <p class="settings-info">
1219
  <?php _e('WebP images can be up to three times smaller than PNGs and 25% smaller than JPGs. Choosing this option <strong>does not use up additional credits</strong>.','shortpixel-image-optimiser');?>
1220
+ <a href="https://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank" class="shortpixel-help-link">
1221
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
1222
  </a>
1223
  </p>
1278
  <label for="optimizeRetina"><?php _e('Also optimize the Retina images (@2x) if they exist.','shortpixel-image-optimiser');?></label>
1279
  <p class="settings-info">
1280
  <?php _e('If you have a Retina plugin that generates Retina-specific images (@2x), ShortPixel can optimize them too, alongside the regular Media Library images and thumbnails.','shortpixel-image-optimiser');?>
1281
+ <a href="https://blog.shortpixel.com/how-to-use-optimized-retina-images-on-your-wordpress-site-for-best-user-experience-on-apple-devices/" target="_blank" class="shortpixel-help-link">
1282
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
1283
  </a>
1284
  </p>
1318
  <br>For the <strong>"size"</strong> type,
1319
  which applies only to Media Library images, <strong>the main images (not thumbnails)</strong> that have the size in the specified range will be excluded.
1320
  The format for the "size" exclude is: <strong>minWidth</strong>-<strong>maxWidth</strong>x<strong>minHeight</strong>-<strong>maxHeight</strong>, for example <strong>size:1000-1100x2000-2200</strong>. You can also specify a precise size, as <strong>1000x2000</strong>.','shortpixel-image-optimiser');?>
1321
+ <a href="https://blog.shortpixel.com/shortpixel-how-to-exclude-images-and-folders-from-optimization/" target="_blank" class="shortpixel-help-link">
1322
  <span class="dashicons dashicons-editor-help"></span><?php _e('More info','shortpixel-image-optimiser');?>
1323
  </a>
1324
  </p>
class/view/view-settings.php CHANGED
@@ -54,6 +54,8 @@ HelpScout::outputBeacon();
54
  ?>
55
 
56
  </article>
 
 
57
 
58
  <?php // @todo inline JS ?>
59
  <script>
54
  ?>
55
 
56
  </article>
57
+ <?php $this->loadView('settings/part-wso'); ?>
58
+
59
 
60
  <?php // @todo inline JS ?>
61
  <script>
class/wp-short-pixel.php CHANGED
@@ -96,6 +96,7 @@ class WPShortPixel {
96
  add_action( 'delete_attachment', array( &$this, 'onDeleteImage') );
97
 
98
  add_action('mime_types', array($this, 'addWebpMime'));
 
99
 
100
  // integration with WP/LR Sync plugin
101
  add_action( 'wplr_update_media', array( &$this, 'onWpLrUpdateMedia' ), 10, 2);
@@ -1717,6 +1718,14 @@ class WPShortPixel {
1717
 
1718
  }
1719
 
 
 
 
 
 
 
 
 
1720
  $shortPixelMeta["thumbsOpt"] = max(0, $shortPixelMeta["thumbsOpt"] - 1); // this is a complicated count of number of thumbnails
1721
  $shortPixelMeta["retinasOpt"] = max(0, $shortPixelMeta["retinasOpt"] - 1);
1722
  }
@@ -2201,7 +2210,7 @@ class WPShortPixel {
2201
 
2202
  if(isset($toUnlink['PATHs'])) foreach($toUnlink['PATHs'] as $unlink) {
2203
  if($png2jpgMain) {
2204
- WPShortPixel::log("PNG2JPG unlink $unlink");
2205
  $unlinkFile = $fs->getFile($unlink);
2206
  $unlinkFile->delete();
2207
 
@@ -2209,21 +2218,30 @@ class WPShortPixel {
2209
  //try also the .webp
2210
  $unlinkWebpSymlink = trailingslashit(dirname($unlink)) . wp_basename($unlink, '.' . pathinfo($unlink, PATHINFO_EXTENSION)) . '.webp';
2211
  $unlinkWebp = $unlink . '.webp';
2212
- WPShortPixel::log("DoRestore webp unlink $unlinkWebp");
2213
  //@unlink($unlinkWebpSymlink);
2214
 
 
2215
  $unlinkFile = $fs->getFile($unlinkWebpSymlink);
2216
  if ($unlinkFile->exists())
2217
  {
2218
- Log::addDebug('DoRestore, Deleting - ', $unlinkWebpSymlink );
2219
  $unlinkFile->delete();
2220
  }
2221
 
2222
- $unlinkFile = $fs->getFile($unlinkWebp);
2223
- if ($unlinkFile->exists())
2224
  {
2225
- Log::addDebug('DoRestore, Deleting - ', $unlinkWebp );
2226
- $unlinkFile->delete();
 
 
 
 
 
 
 
 
2227
  }
2228
 
2229
  }
@@ -2993,7 +3011,7 @@ class WPShortPixel {
2993
  /** Updates HTAccess files for Webp
2994
  * @param boolean $clear Clear removes all statements from htaccess. For disabling webp.
2995
  */
2996
- public static function alterHtaccess( $clear = false ){
2997
  // [BS] Backward compat. 11/03/2019 - remove possible settings from root .htaccess
2998
  /* Plugin init is before loading these admin scripts. So it can happen misc.php is not yet loaded */
2999
  if (! function_exists('insert_with_markers'))
@@ -3005,56 +3023,86 @@ class WPShortPixel {
3005
  $upload_dir = wp_upload_dir();
3006
  $upload_base = trailingslashit($upload_dir['basedir']);
3007
 
3008
- if ( $clear ) {
3009
  insert_with_markers( get_home_path() . '.htaccess', 'ShortPixelWebp', '');
3010
  insert_with_markers( $upload_base . '.htaccess', 'ShortPixelWebp', '');
3011
  insert_with_markers( trailingslashit(WP_CONTENT_DIR) . '.htaccess', 'ShortPixelWebp', '');
3012
  } else {
3013
 
3014
- $rules = '
3015
- <IfModule mod_rewrite.c>
3016
- RewriteEngine On
3017
-
3018
- ##### TRY FIRST the file appended with .webp (ex. test.jpg.webp) #####
3019
- # Does browser explicitly support webp?
3020
- RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
3021
- # OR Is request from Page Speed
3022
- RewriteCond %{HTTP_USER_AGENT} "Google Page Speed Insights" [OR]
3023
- # OR does this browser explicitly support webp
3024
- RewriteCond %{HTTP_ACCEPT} image/webp
3025
- # AND NOT MS EDGE 42/17 - doesnt work.
3026
- RewriteCond %{HTTP_USER_AGENT} !Edge/17
3027
- # AND is the request a jpg or png?
3028
- RewriteCond %{REQUEST_URI} ^(.+)\.(?:jpe?g|png)$
3029
- # AND does a .ext.webp image exist?
3030
- RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.webp -f
3031
- # THEN send the webp image and set the env var webp
3032
- RewriteRule ^(.+)$ $1.webp [NC,T=image/webp,E=webp,L]
3033
-
3034
- ##### IF NOT, try the file with replaced extension (test.webp) #####
3035
- RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
3036
- RewriteCond %{HTTP_USER_AGENT} "Google Page Speed Insights" [OR]
3037
- RewriteCond %{HTTP_ACCEPT} image/webp
3038
- RewriteCond %{HTTP_USER_AGENT} !Edge/17
3039
- # AND is the request a jpg or png? (also grab the basepath %1 to match in the next rule)
3040
- RewriteCond %{REQUEST_URI} ^(.+)\.(?:jpe?g|png)$
3041
- # AND does a .ext.webp image exist?
3042
- RewriteCond %{DOCUMENT_ROOT}/%1.webp -f
3043
- # THEN send the webp image and set the env var webp
3044
- RewriteRule (.+)\.(?:jpe?g|png)$ $1.webp [NC,T=image/webp,E=webp,L]
3045
-
3046
- </IfModule>
3047
- <IfModule mod_headers.c>
3048
- # If REDIRECT_webp env var exists, append Accept to the Vary header
3049
- Header append Vary Accept env=REDIRECT_webp
3050
- </IfModule>
3051
-
3052
- <IfModule mod_mime.c>
3053
- AddType image/webp .webp
3054
- </IfModule>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3055
  ' ;
3056
 
3057
- insert_with_markers( get_home_path() . '.htaccess', 'ShortPixelWebp', $rules);
 
 
 
 
 
 
3058
 
3059
  /** In uploads and on, it needs Inherit. Otherwise things such as the 404 error page will not be loaded properly
3060
  * since the WP rewrite will not be active at that point (overruled) **/
@@ -3066,6 +3114,7 @@ class WPShortPixel {
3066
  }
3067
  }
3068
 
 
3069
  /** Gets the average compression
3070
  * @return int Average compressions percentage
3071
  * @todo Move to utility (?)
@@ -3086,7 +3135,16 @@ class WPShortPixel {
3086
  if (! isset($mimes['webp']))
3087
  $mimes['webp'] = 'image/webp';
3088
  }
 
 
3089
 
 
 
 
 
 
 
 
3090
  return $mimes;
3091
  }
3092
 
@@ -3334,21 +3392,39 @@ Log::addDebug('GetQuotaInformation Result ', $dataArray);
3334
  $renderData['date'] = isset($data['ShortPixel']['date']) ? $data['ShortPixel']['date'] : null;
3335
  $renderData['quotaExceeded'] = $quotaExceeded;
3336
  $webP = 0;
 
3337
  if($extended) {
3338
  if(file_exists(dirname($file->getFullPath()) . '/' . ShortPixelAPI::MB_basename($file->getFullPath(), '.'.$fileExtension) . '.webp' )){
3339
  $webP++;
3340
  }
 
 
 
 
 
 
 
3341
  if(isset($data['sizes'])) {
3342
  foreach($data['sizes'] as $key => $size) {
3343
  if (strpos($key, ShortPixelMeta::WEBP_THUMB_PREFIX) === 0) continue;
3344
  $sizeName = $size['file'];
 
3345
  if(file_exists(dirname($file->getFullPath()) . '/' . ShortPixelAPI::MB_basename($sizeName, '.'.$fileExtension) . '.webp' )){
3346
  $webP++;
3347
  }
 
 
 
 
 
 
 
 
3348
  }
3349
  }
3350
  }
3351
  $renderData['webpCount'] = $webP;
 
3352
  }
3353
  /* elseif($data['ShortPixelImprovement'] == __('Optimization N/A','shortpixel-image-optimiser')) { //We don't optimize this
3354
  $renderData['status'] = 'n/a';
@@ -3604,6 +3680,10 @@ Log::addDebug('GetQuotaInformation Result ', $dataArray);
3604
 
3605
  $file = $fs->getFile($path . '.@2xwebp');
3606
  $file->delete();
 
 
 
 
3607
  }
3608
  //delte also the backups for image and retina correspondent
3609
  $fileName = $pathFile->getFileName();
96
  add_action( 'delete_attachment', array( &$this, 'onDeleteImage') );
97
 
98
  add_action('mime_types', array($this, 'addWebpMime'));
99
+ add_action('mime_types', array($this, 'addAvifMime'));
100
 
101
  // integration with WP/LR Sync plugin
102
  add_action( 'wplr_update_media', array( &$this, 'onWpLrUpdateMedia' ), 10, 2);
1718
 
1719
  }
1720
 
1721
+ if ($settings->createAvif)
1722
+ {
1723
+ $avifObj = $fs->getFile( (string) $fileObj->getFileDir() . $fileObj->getFileBase() . '.avif');
1724
+
1725
+ if ($avifObj->exists())
1726
+ $avifObj->delete();
1727
+ }
1728
+
1729
  $shortPixelMeta["thumbsOpt"] = max(0, $shortPixelMeta["thumbsOpt"] - 1); // this is a complicated count of number of thumbnails
1730
  $shortPixelMeta["retinasOpt"] = max(0, $shortPixelMeta["retinasOpt"] - 1);
1731
  }
2210
 
2211
  if(isset($toUnlink['PATHs'])) foreach($toUnlink['PATHs'] as $unlink) {
2212
  if($png2jpgMain) {
2213
+ Log::addDebug("PNG2JPG unlink $unlink");
2214
  $unlinkFile = $fs->getFile($unlink);
2215
  $unlinkFile->delete();
2216
 
2218
  //try also the .webp
2219
  $unlinkWebpSymlink = trailingslashit(dirname($unlink)) . wp_basename($unlink, '.' . pathinfo($unlink, PATHINFO_EXTENSION)) . '.webp';
2220
  $unlinkWebp = $unlink . '.webp';
2221
+ // WPShortPixel::log("DoRestore webp unlink $unlinkWebp");
2222
  //@unlink($unlinkWebpSymlink);
2223
 
2224
+
2225
  $unlinkFile = $fs->getFile($unlinkWebpSymlink);
2226
  if ($unlinkFile->exists())
2227
  {
2228
+ Log::addDebug('DoRestore, Deleting Webp - ', $unlinkWebpSymlink );
2229
  $unlinkFile->delete();
2230
  }
2231
 
2232
+ $unlinkFileDoubleExt = $fs->getFile($unlinkWebp);
2233
+ if ($unlinkFileDoubleExt->exists())
2234
  {
2235
+ Log::addDebug('DoRestore, Deleting DoubleWebp - ', $unlinkWebp );
2236
+ $unlinkFileDoubleExt->delete();
2237
+ }
2238
+
2239
+ $unlinkAvif = $fs->getFile($unlinkFile->getFileDir() . $unlinkFile->getFileBase() . '.avif');
2240
+
2241
+ if ($unlinkAvif->exists())
2242
+ {
2243
+ $unlinkAvif->delete();
2244
+ Log::addDebug('DoRestore, Deleting Avif :' . $unlinkAvif->getFullPath() );
2245
  }
2246
 
2247
  }
3011
  /** Updates HTAccess files for Webp
3012
  * @param boolean $clear Clear removes all statements from htaccess. For disabling webp.
3013
  */
3014
+ public static function alterHtaccess($webp = false, $avif = false){
3015
  // [BS] Backward compat. 11/03/2019 - remove possible settings from root .htaccess
3016
  /* Plugin init is before loading these admin scripts. So it can happen misc.php is not yet loaded */
3017
  if (! function_exists('insert_with_markers'))
3023
  $upload_dir = wp_upload_dir();
3024
  $upload_base = trailingslashit($upload_dir['basedir']);
3025
 
3026
+ if ( ! $webp && ! $avif ) {
3027
  insert_with_markers( get_home_path() . '.htaccess', 'ShortPixelWebp', '');
3028
  insert_with_markers( $upload_base . '.htaccess', 'ShortPixelWebp', '');
3029
  insert_with_markers( trailingslashit(WP_CONTENT_DIR) . '.htaccess', 'ShortPixelWebp', '');
3030
  } else {
3031
 
3032
+ $avif_rules = '
3033
+ <IfModule mod_rewrite.c>
3034
+ RewriteEngine On
3035
+
3036
+ ##### IF try the file with replaced extension (test.avif) #####
3037
+ RewriteCond %{HTTP_ACCEPT} image/avif
3038
+ # AND is the request a jpg or png? (also grab the basepath %1 to match in the next rule)
3039
+ RewriteCond %{REQUEST_URI} ^(.+)\.(?:jpe?g|png)$
3040
+ # AND does a .avif image exist?
3041
+ RewriteCond %{DOCUMENT_ROOT}/%1.avif -f
3042
+ # THEN send the webp image and set the env var avif
3043
+ RewriteRule (.+)\.(?:jpe?g|png)$ $1.avif [NC,T=image/avif,E=avif,L]
3044
+
3045
+ </IfModule>
3046
+ <IfModule mod_headers.c>
3047
+ # If REDIRECT_webp env var exists, append Accept to the Vary header
3048
+ Header append Vary Accept env=REDIRECT_avif
3049
+ </IfModule>
3050
+
3051
+ <IfModule mod_mime.c>
3052
+ AddType image/avif .avif
3053
+ </IfModule>
3054
+ ';
3055
+
3056
+ $webp_rules = '
3057
+ <IfModule mod_rewrite.c>
3058
+ RewriteEngine On
3059
+
3060
+ ##### TRY FIRST the file appended with .webp (ex. test.jpg.webp) #####
3061
+ # Does browser explicitly support webp?
3062
+ RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
3063
+ # OR Is request from Page Speed
3064
+ RewriteCond %{HTTP_USER_AGENT} "Google Page Speed Insights" [OR]
3065
+ # OR does this browser explicitly support webp
3066
+ RewriteCond %{HTTP_ACCEPT} image/webp
3067
+ # AND NOT MS EDGE 42/17 - doesnt work.
3068
+ RewriteCond %{HTTP_USER_AGENT} !Edge/17
3069
+ # AND is the request a jpg or png?
3070
+ RewriteCond %{REQUEST_URI} ^(.+)\.(?:jpe?g|png)$
3071
+ # AND does a .ext.webp image exist?
3072
+ RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.webp -f
3073
+ # THEN send the webp image and set the env var webp
3074
+ RewriteRule ^(.+)$ $1.webp [NC,T=image/webp,E=webp,L]
3075
+
3076
+ ##### IF NOT, try the file with replaced extension (test.webp) #####
3077
+ RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
3078
+ RewriteCond %{HTTP_USER_AGENT} "Google Page Speed Insights" [OR]
3079
+ RewriteCond %{HTTP_ACCEPT} image/webp
3080
+ RewriteCond %{HTTP_USER_AGENT} !Edge/17
3081
+ # AND is the request a jpg or png? (also grab the basepath %1 to match in the next rule)
3082
+ RewriteCond %{REQUEST_URI} ^(.+)\.(?:jpe?g|png)$
3083
+ # AND does a .ext.webp image exist?
3084
+ RewriteCond %{DOCUMENT_ROOT}/%1.webp -f
3085
+ # THEN send the webp image and set the env var webp
3086
+ RewriteRule (.+)\.(?:jpe?g|png)$ $1.webp [NC,T=image/webp,E=webp,L]
3087
+
3088
+ </IfModule>
3089
+ <IfModule mod_headers.c>
3090
+ # If REDIRECT_webp env var exists, append Accept to the Vary header
3091
+ Header append Vary Accept env=REDIRECT_webp
3092
+ </IfModule>
3093
+
3094
+ <IfModule mod_mime.c>
3095
+ AddType image/webp .webp
3096
+ </IfModule>
3097
  ' ;
3098
 
3099
+ $rules = '';
3100
+ // if ($avif)
3101
+ $rules .= $avif_rules;
3102
+ // if ($webp)
3103
+ $rules .= $webp_rules;
3104
+
3105
+ insert_with_markers( get_home_path() . '.htaccess', 'ShortPixelWebp', $rules);
3106
 
3107
  /** In uploads and on, it needs Inherit. Otherwise things such as the 404 error page will not be loaded properly
3108
  * since the WP rewrite will not be active at that point (overruled) **/
3114
  }
3115
  }
3116
 
3117
+
3118
  /** Gets the average compression
3119
  * @return int Average compressions percentage
3120
  * @todo Move to utility (?)
3135
  if (! isset($mimes['webp']))
3136
  $mimes['webp'] = 'image/webp';
3137
  }
3138
+ return $mimes;
3139
+ }
3140
 
3141
+ public function addAvifMime($mimes)
3142
+ {
3143
+ if ($this->_settings->createAvif)
3144
+ {
3145
+ if (! isset($mimes['avif']))
3146
+ $mimes['webp'] = 'image/avif';
3147
+ }
3148
  return $mimes;
3149
  }
3150
 
3392
  $renderData['date'] = isset($data['ShortPixel']['date']) ? $data['ShortPixel']['date'] : null;
3393
  $renderData['quotaExceeded'] = $quotaExceeded;
3394
  $webP = 0;
3395
+ $avif = 0;
3396
  if($extended) {
3397
  if(file_exists(dirname($file->getFullPath()) . '/' . ShortPixelAPI::MB_basename($file->getFullPath(), '.'.$fileExtension) . '.webp' )){
3398
  $webP++;
3399
  }
3400
+ elseif(file_exists($file->getFullPath() . '.webp'))
3401
+ {
3402
+ $webP++;
3403
+ }
3404
+ if(file_exists(dirname($file->getFullPath()) . '/' . ShortPixelAPI::MB_basename($file->getFullPath(), '.'.$fileExtension) . '.avif' )){
3405
+ $avif++;
3406
+ }
3407
  if(isset($data['sizes'])) {
3408
  foreach($data['sizes'] as $key => $size) {
3409
  if (strpos($key, ShortPixelMeta::WEBP_THUMB_PREFIX) === 0) continue;
3410
  $sizeName = $size['file'];
3411
+
3412
  if(file_exists(dirname($file->getFullPath()) . '/' . ShortPixelAPI::MB_basename($sizeName, '.'.$fileExtension) . '.webp' )){
3413
  $webP++;
3414
  }
3415
+ elseif(file_exists(dirname($file->getFullPath()) . '/' . $sizeName . '.webp'))
3416
+ {
3417
+ $webP++;
3418
+ }
3419
+
3420
+ if(file_exists(dirname($file->getFullPath()) . '/' . ShortPixelAPI::MB_basename($sizeName, '.'.$fileExtension) . '.avif' )){
3421
+ $avif++;
3422
+ }
3423
  }
3424
  }
3425
  }
3426
  $renderData['webpCount'] = $webP;
3427
+ $renderData['avifCount'] = $avif;
3428
  }
3429
  /* elseif($data['ShortPixelImprovement'] == __('Optimization N/A','shortpixel-image-optimiser')) { //We don't optimize this
3430
  $renderData['status'] = 'n/a';
3680
 
3681
  $file = $fs->getFile($path . '.@2xwebp');
3682
  $file->delete();
3683
+
3684
+ $file = $fs->getFile($path . '.avif');
3685
+ if ($file->exists())
3686
+ $file->delete();
3687
  }
3688
  //delte also the backups for image and retina correspondent
3689
  $fileName = $pathFile->getFileName();
class/wp-shortpixel-settings.php CHANGED
@@ -28,6 +28,7 @@ class WPShortPixelSettings extends \ShortPixel\Model {
28
  'CMYKtoRGBconversion' => array('key' => 'wp-short-pixel_cmyk2rgb', 'default' => 1, 'group' => 'options'),
29
  'createWebp' => array('key' => 'wp-short-create-webp', 'default' => null, 'group' => 'options'),
30
  'deliverWebp' => array('key' => 'wp-short-pixel-create-webp-markup', 'default' => 0, 'group' => 'options'),
 
31
  'optimizeRetina' => array('key' => 'wp-short-pixel-optimize-retina', 'default' => 1, 'group' => 'options'),
32
  'optimizeUnlisted' => array('key' => 'wp-short-pixel-optimize-unlisted', 'default' => 0, 'group' => 'options'),
33
  'backupImages' => array('key' => 'wp-short-backup_images', 'default' => 1, 'group' => 'options'),
@@ -124,6 +125,7 @@ class WPShortPixelSettings extends \ShortPixel\Model {
124
  'CMYKtoRGBconversion' => array('s' => 'boolean'), //checkbox
125
  'createWebp' => array('s' => 'boolean'), // checkbox
126
  'deliverWebp' => array('s' => 'int'), // checkbox
 
127
  'optimizeRetina' => array('s' => 'boolean'), // checkbox
128
  'optimizeUnlisted' => array('s' => 'boolean'), // $checkbox
129
  'optimizePdfs' => array('s' => 'boolean'), //checkbox
28
  'CMYKtoRGBconversion' => array('key' => 'wp-short-pixel_cmyk2rgb', 'default' => 1, 'group' => 'options'),
29
  'createWebp' => array('key' => 'wp-short-create-webp', 'default' => null, 'group' => 'options'),
30
  'deliverWebp' => array('key' => 'wp-short-pixel-create-webp-markup', 'default' => 0, 'group' => 'options'),
31
+ 'createAvif' => array('key' => 'wp-short-create-avif', 'default' => null, 'group' => 'options'),
32
  'optimizeRetina' => array('key' => 'wp-short-pixel-optimize-retina', 'default' => 1, 'group' => 'options'),
33
  'optimizeUnlisted' => array('key' => 'wp-short-pixel-optimize-unlisted', 'default' => 0, 'group' => 'options'),
34
  'backupImages' => array('key' => 'wp-short-backup_images', 'default' => 1, 'group' => 'options'),
125
  'CMYKtoRGBconversion' => array('s' => 'boolean'), //checkbox
126
  'createWebp' => array('s' => 'boolean'), // checkbox
127
  'deliverWebp' => array('s' => 'int'), // checkbox
128
+ 'createAvif' => array('s' => 'boolean'), // checkbox
129
  'optimizeRetina' => array('s' => 'boolean'), // checkbox
130
  'optimizeUnlisted' => array('s' => 'boolean'), // $checkbox
131
  'optimizePdfs' => array('s' => 'boolean'), //checkbox
readme.txt CHANGED
@@ -1,14 +1,14 @@
1
  === ShortPixel Image Optimizer ===
2
  Contributors: ShortPixel
3
- Tags: convert webp, optimize images, image optimization, resize, compressor, image, compression, optimize, image optimiser, image compression, compress pdf, compress jpg, compress png, performance, photography, smush, scale, pictures
4
- Requires at least: 3.2.0
5
  Tested up to: 5.7
6
  Requires PHP: 5.3
7
- Stable tag: 4.21.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Speed up your website & boost your SEO by compressing old & new images and PDFs. WebP convert and optimize support.
12
 
13
  == Description ==
14
 
@@ -22,20 +22,20 @@ Or you can create a staging copy of your site using <a href="https://wp-staging.
22
 
23
  Short Pixel uses minimal resources and works well with any shared, cloud, VPS or dedicated web hosting. It can optimize any image you have on your website even the images that aren't listed in Media Library like those in galleries like <a href="https://wordpress.org/plugins/nextgen-gallery/" target="_blank">NextGEN</a>, <a href="https://wordpress.org/plugins/modula-best-grid-gallery/" target="_blank">Modula</a> or added directly via FTP!
24
 
25
- Both lossy and lossless image compression are available for the most common image types (JPG, PNG, GIF and WebP) plus PDF files.
26
  We also offer **glossy** JPEG compression which is a very high quality lossy optimization algorithm. Specially designed for photographers!
27
  Optimized images mean better user experience, better PageSpeed Insights or GTmetrix results, better Google PageRank and more visitors.
28
 
29
- Make an instant <a href="http://shortpixel.com/image-compression-test" target="_blank">image compression test</a> of your site or <a href="http://shortpixel.com/online-image-compression" target="_blank">compress some images</a> to test our optimization algorithms.
30
 
31
  **Why is ShortPixel the best choice when it comes to image optimization or PDF compression?**
32
 
33
  * popular plugin with over 300,000 active installations - according to WordPress
34
  * compress JPG (and its variations JPEG, JPEG 2000, JPEG XR), PNG, GIF (still or animated) images and also PDF documents
35
- * option to freely convert any JPEG, PNG or GIF (even animated ones!) to **WebP** for more Google love. <a href="http://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank">How to enable WebP?</a>
36
  * option to automatically convert PNG to JPG if that will result in smaller images. Ideal for large images in PNG format
37
- * option to include the generated WebP images into the front-end pages by using the `<picture>` tag instead of `<img>`
38
- * compatible with WP Retina 2x - all **retina images** are automatically compressed. <a href="http://blog.shortpixel.com/how-to-use-optimized-retina-images-on-your-wordpress-site-for-best-user-experience-on-apple-devices/" target="_blank">How to benefit from Retina displays?</a>
39
  * optimize thumbnails as well as featured images. You can also **select individual thumbnails to exclude** from optimization
40
  * ability to optimize any image on your site including images in **NextGEN Gallery** and any other image galleries or sliders
41
  * option to scale images down, with 2 different options, which is very useful to automatically resize large images. This applies to the featured images and there is no need for additional plugins like Imsanity
@@ -43,7 +43,7 @@ Make an instant <a href="http://shortpixel.com/image-compression-test" target="_
43
  * skip already optimized images
44
  * **24h <a href="https://wordpress.org/support/plugin/shortpixel-image-optimiser/reviews/?filter=5" target="_blank">stellar support</a>** (24/7) directly from developers.
45
  * easily **test lossy/glossy/lossless** versions of the images with a single click in your Media Library
46
- * **great for photographers**: <a href="http://blog.shortpixel.com/how-much-smaller-can-be-images-without-exif-icc/" target="_blank">keep or remove EXIF</a> data from your images, compress photos with lossless option
47
  * works well with both HTTPS and HTTP websites
48
  * uses progressive JPEG for larger images in order to speed up the image display
49
  * you can run ShortPixel plugin on **multiple websites** or on a **multisite** with a **single API Key**
@@ -77,7 +77,7 @@ Check out <a href="https://shortpixel.com/pricing" target="_blank">our prices</a
77
 
78
  [youtube https://www.youtube.com/watch?v=5EbX0Hsy6j4]
79
 
80
- Help us spread the word by recommending ShortPixel to your friends and collect **100 lifetime monthly additional image credits for each referred active user**. Make money by promoting a great plugin with our <a href="https://shortpixel.com/free-sign-up-affiliate" target="_blank">50/50 affiliate program</a>.
81
 
82
  **Other plugins by ShortPixel**
83
 
@@ -91,7 +91,6 @@ Help us spread the word by recommending ShortPixel to your friends and collect *
91
 
92
  * Email <a href="https://shortpixel.com/contact" target="_blank">https://shortpixel.com/contact</a>
93
  * Twitter <a href="https://twitter.com/shortpixel" target="_blank">https://twitter.com/shortpixel</a>
94
- * Google+ <a href="https://www.google.com/+Shortpixelpage" target="_blank">https://www.google.com/+Shortpixelpage</a>
95
  * Facebook <a href="https://www.facebook.com/ShortPixel" target="_blank">https://www.facebook.com/ShortPixel</a>
96
  * LinkedIn <a href="https://www.linkedin.com/company/shortpixel" target="_blank">https://www.linkedin.com/company/shortpixel</a>
97
 
@@ -188,7 +187,7 @@ where `APIKEY` is the API Key received upon sign up.
188
  Please also note that usually images in your Media Library have 3-5 thumbs associated and a credit will be used for each featured image or associated thumbnail that is optimized.
189
 
190
  = Why shall I use a wordpress plugin and not an offline tool? =
191
- Because ShortPixel algorithms were perfected while optimizing over 2 billion real-life images.
192
  ShortPixel not only offers the best compression for JPEG, PNG, GIF and PDF files but it also saves you a lot of time. You just install it on your site and then ShortPixel will take care that all the images on your site are immediately optimized after upload.
193
 
194
  = Does optimizing images affect my ALT tags? =
@@ -225,7 +224,7 @@ where `APIKEY` is the API Key received upon sign up.
225
  Using this option you can safely upload original images safely without needing to apply any pre-processing to make them smaller.
226
 
227
  = Will ShortPixel work if my website is using CloudFare? =
228
- Absolutely! Sometimes you'll need to make sure you whitelist some IPs, just <a href="http://shortpixel.com/contact">contact us</a> and we'll assist you with that.
229
 
230
  = I’m stuck. What do I do? =
231
 
@@ -306,6 +305,18 @@ Hide the Cloudflare settings by defining these constants in wp-config.php:
306
  9. Check other optimized images status - themes or other plugins' images. (Media>Other Media)
307
 
308
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
309
  = 4.21.2 =
310
 
311
  Release date March 15th, 2021
1
  === ShortPixel Image Optimizer ===
2
  Contributors: ShortPixel
3
+ Tags: convert webp, optimize images, image optimization, resize, compressor, image, avif, compression, optimize, image optimiser, image compression, compress pdf, compress jpg, compress png, performance, photography, smush, scale, pictures
4
+ Requires at least: 4.2.0
5
  Tested up to: 5.7
6
  Requires PHP: 5.3
7
+ Stable tag: 4.22.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Speed up your website & boost your SEO by compressing old & new images and PDFs. AVIF & WebP convert and optimize support.
12
 
13
  == Description ==
14
 
22
 
23
  Short Pixel uses minimal resources and works well with any shared, cloud, VPS or dedicated web hosting. It can optimize any image you have on your website even the images that aren't listed in Media Library like those in galleries like <a href="https://wordpress.org/plugins/nextgen-gallery/" target="_blank">NextGEN</a>, <a href="https://wordpress.org/plugins/modula-best-grid-gallery/" target="_blank">Modula</a> or added directly via FTP!
24
 
25
+ Both lossy and lossless image compression are available for the most common image types (JPG, PNG, GIF, WebP and AVIF) plus PDF files.
26
  We also offer **glossy** JPEG compression which is a very high quality lossy optimization algorithm. Specially designed for photographers!
27
  Optimized images mean better user experience, better PageSpeed Insights or GTmetrix results, better Google PageRank and more visitors.
28
 
29
+ Make an instant <a href="https://shortpixel.com/image-compression-test" target="_blank">image compression test</a> of your site or <a href="https://shortpixel.com/online-image-compression" target="_blank">compress some images</a> to test our optimization algorithms.
30
 
31
  **Why is ShortPixel the best choice when it comes to image optimization or PDF compression?**
32
 
33
  * popular plugin with over 300,000 active installations - according to WordPress
34
  * compress JPG (and its variations JPEG, JPEG 2000, JPEG XR), PNG, GIF (still or animated) images and also PDF documents
35
+ * option to convert any JPEG, PNG or GIF (even animated ones!) to **WebP** and **AVIF** for more Google love. <a href="https://blog.shortpixel.com/how-webp-images-can-speed-up-your-site/" target="_blank">How to enable WebP?</a>. <a href="https://blog.shortpixel.com/what-is-avif-and-why-is-it-good/" target="_blank">What is AVIF and why is it good?</a>.
36
  * option to automatically convert PNG to JPG if that will result in smaller images. Ideal for large images in PNG format
37
+ * option to include the next generation images (WebP and AVIF) into the front-end pages by using the `<picture>` tag instead of `<img>`, independent from generating them through the plugin
38
+ * compatible with WP Retina 2x - all **retina images** are automatically compressed. <a href="https://blog.shortpixel.com/how-to-use-optimized-retina-images-on-your-wordpress-site-for-best-user-experience-on-apple-devices/" target="_blank">How to benefit from Retina displays?</a>
39
  * optimize thumbnails as well as featured images. You can also **select individual thumbnails to exclude** from optimization
40
  * ability to optimize any image on your site including images in **NextGEN Gallery** and any other image galleries or sliders
41
  * option to scale images down, with 2 different options, which is very useful to automatically resize large images. This applies to the featured images and there is no need for additional plugins like Imsanity
43
  * skip already optimized images
44
  * **24h <a href="https://wordpress.org/support/plugin/shortpixel-image-optimiser/reviews/?filter=5" target="_blank">stellar support</a>** (24/7) directly from developers.
45
  * easily **test lossy/glossy/lossless** versions of the images with a single click in your Media Library
46
+ * **great for photographers**: <a href="https://blog.shortpixel.com/how-much-smaller-can-be-images-without-exif-icc/" target="_blank">keep or remove EXIF</a> data from your images, compress photos with lossless option
47
  * works well with both HTTPS and HTTP websites
48
  * uses progressive JPEG for larger images in order to speed up the image display
49
  * you can run ShortPixel plugin on **multiple websites** or on a **multisite** with a **single API Key**
77
 
78
  [youtube https://www.youtube.com/watch?v=5EbX0Hsy6j4]
79
 
80
+ Help us spread the word by recommending ShortPixel to your friends and collect **100 lifetime monthly additional image credits for each referred active user**. Make money by promoting a great plugin with our <a href="https://shortpixel.com/free-sign-up-affiliate" target="_blank">30% commission affiliate program</a>.
81
 
82
  **Other plugins by ShortPixel**
83
 
91
 
92
  * Email <a href="https://shortpixel.com/contact" target="_blank">https://shortpixel.com/contact</a>
93
  * Twitter <a href="https://twitter.com/shortpixel" target="_blank">https://twitter.com/shortpixel</a>
 
94
  * Facebook <a href="https://www.facebook.com/ShortPixel" target="_blank">https://www.facebook.com/ShortPixel</a>
95
  * LinkedIn <a href="https://www.linkedin.com/company/shortpixel" target="_blank">https://www.linkedin.com/company/shortpixel</a>
96
 
187
  Please also note that usually images in your Media Library have 3-5 thumbs associated and a credit will be used for each featured image or associated thumbnail that is optimized.
188
 
189
  = Why shall I use a wordpress plugin and not an offline tool? =
190
+ Because ShortPixel algorithms were perfected while optimizing over 3.5 billion real-life images.
191
  ShortPixel not only offers the best compression for JPEG, PNG, GIF and PDF files but it also saves you a lot of time. You just install it on your site and then ShortPixel will take care that all the images on your site are immediately optimized after upload.
192
 
193
  = Does optimizing images affect my ALT tags? =
224
  Using this option you can safely upload original images safely without needing to apply any pre-processing to make them smaller.
225
 
226
  = Will ShortPixel work if my website is using CloudFare? =
227
+ Absolutely! Sometimes you'll need to make sure you whitelist some IPs, just <a href="https://shortpixel.com/contact">contact us</a> and we'll assist you with that.
228
 
229
  = I’m stuck. What do I do? =
230
 
305
  9. Check other optimized images status - themes or other plugins' images. (Media>Other Media)
306
 
307
  == Changelog ==
308
+
309
+ = 4.22.0 =
310
+ Release date April 28th, 2021
311
+ * New: ability to generate and serve the AVIF version of the images;
312
+ * New: WebP and AVIF files can now be delivered without conditioning of the generation of such files;
313
+ * Fix: Keep the `loading=lazy` attribute on `IMG` tags when delivering next-generation images using the `picture` method;
314
+ * Fix: Custom database tables were created without primary keys and that caused issues in some cases;
315
+ * Fix: Empty alt tag should not be stripped with WebP delivery;
316
+ * Fix: bug when using S3-offload in combination with Webp delivery;
317
+ * Fix: fixes, additions, and tweaks to the plugin notifications system;
318
+ * Language: 9 new strings added, 14 updated, 0 fuzzed, and 0 obsoleted.
319
+
320
  = 4.21.2 =
321
 
322
  Release date March 15th, 2021
res/css/short-pixel.css CHANGED
@@ -587,6 +587,7 @@ article.sp-tabs section {
587
  z-index: 0;
588
  }
589
  article.sp-tabs section.sel-tab {
 
590
  box-shadow: 0 3px 3px rgba(0,0,0,0.1);
591
  }
592
  article.sp-tabs section .wp-shortpixel-tab-content {
@@ -617,7 +618,7 @@ article.sp-tabs section.sel-tab h2 {
617
  z-index: 100;
618
  }
619
 
620
- .deliverWebpSettings, .deliverWebpTypes, .deliverWebpAlteringTypes {
621
  display: none;
622
  }
623
  .deliverWebpTypes .sp-notice {
@@ -639,8 +640,6 @@ article.sp-tabs section.sel-tab h2 {
639
  display: none;
640
  }
641
 
642
-
643
- article.sp-tabs section #createWebp:checked ~ .deliverWebpSettings,
644
  article.sp-tabs section #deliverWebp:checked ~ .deliverWebpTypes,
645
  article.sp-tabs section #deliverWebpAltered:checked ~ .deliverWebpAlteringTypes
646
  {
587
  z-index: 0;
588
  }
589
  article.sp-tabs section.sel-tab {
590
+ position: relative;
591
  box-shadow: 0 3px 3px rgba(0,0,0,0.1);
592
  }
593
  article.sp-tabs section .wp-shortpixel-tab-content {
618
  z-index: 100;
619
  }
620
 
621
+ .deliverWebpTypes, .deliverWebpAlteringTypes {
622
  display: none;
623
  }
624
  .deliverWebpTypes .sp-notice {
640
  display: none;
641
  }
642
 
 
 
643
  article.sp-tabs section #deliverWebp:checked ~ .deliverWebpTypes,
644
  article.sp-tabs section #deliverWebpAltered:checked ~ .deliverWebpAlteringTypes
645
  {
res/css/short-pixel.min.css CHANGED
@@ -1 +1,863 @@
1
- .reset{font-weight:400;font-style:normal}.shortpixel-hide{display:none}.clearfix:after,.clearfix:before{content:" ";display:table}.clearfix:after{clear:both}.clearfix{zoom:1}.resumeLabel{float:right;line-height:30px;margin-right:20px;font-size:16px}.sp-dropbtn.button{box-sizing:content-box;padding:0 5px;font-size:20px;line-height:20px;cursor:pointer}.sp-dropdown{position:relative;display:inline-block}.sp-dropdown-content{display:none;right:0;position:absolute;background-color:#f9f9f9;min-width:190px;box-shadow:0 8px 16px 0 rgba(0,0,0,.2);z-index:1}.rtl .sp-dropdown-content{right:auto;left:0}.sp-dropdown-content a{color:#000;padding:12px 16px;text-decoration:none;display:block}.sp-dropdown-content a:hover{background-color:#f1f1f1}.sp-dropdown.sp-show .sp-dropdown-content{display:block}div.fb-like{transform:scale(1.3);-ms-transform:scale(1.3);-webkit-transform:scale(1.3);-o-transform:scale(1.3);-moz-transform:scale(1.3);transform-origin:bottom left;-ms-transform-origin:bottom left;-webkit-transform-origin:bottom left;-moz-transform-origin:bottom left;-webkit-transform-origin:bottom left}.wp-core-ui .button.button-alert,.wp-core-ui .button.button-alert:hover{background:#f79797}.wp-core-ui .button.remove-folder-button{min-width:120px}.sp-notice{background:#fff;border-left:4px solid #fff;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);padding:1px 12px}.sp-notice img{vertical-align:bottom}@media(max-width:1249px){.sp-notice{margin:5px 15px 2px}}.sp-notice-info{border-left-color:#00a0d2}.sp-notice-success{border-left-color:#46b450}.sp-notice-warning{border-left-color:#f1e02a}div.short-pixel-bulk-page input.dial{font-size:16px!important}div.short-pixel-bulk-page h1{margin-bottom:20px}div.bulk-progress div.sp-h2{margin-top:0;margin-bottom:10px;font-size:23px;font-weight:400;padding:9px 15px 4px 0;line-height:29px}div.bulk-progress-partners{margin-top:20px}div.bulk-progress.bulk-progress-partners a div{display:inline-block;vertical-align:top;line-height:50px;margin-left:30px;font-size:1.2em}div.bulk-progress .bulk-progress-indicator,div.sp-quota-exceeded-alert .bulk-progress-indicator{display:inline-block;text-align:center;padding:0 10px;margin-left:10px;float:left;height:90px;overflow:hidden;border:1px solid #1caecb}div.wrap.short-pixel-bulk-page .bulk-notice-container{margin-top:15px;position:absolute;width:500px}div.wrap.short-pixel-bulk-page .bulk-notice-container .bulk-notice-msg{text-align:center;margin:10px 0 0 32px;overflow:hidden;border:1px solid #1caecb;background-color:#9ddbe0;border-radius:5px;padding:7px 10px 10px;display:none;max-width:600px;margin-right:20px}div.wrap.short-pixel-bulk-page .bulk-notice-container .bulk-notice-msg.bulk-error{border:1px solid #b5914d;background-color:#ffe996;margin-right:20px;position:relative;z-index:10}div.wrap.short-pixel-bulk-page .bulk-notice-container .bulk-notice-msg.bulk-error.bulk-error-fatal{border:1px solid #c32525;background-color:#ff969d}div.wrap.short-pixel-bulk-page .bulk-notice-msg img{float:left;margin-top:3px;margin-right:5px}div.sp-bulk-summary{float:right;margin:8px 5px 3px 20px}.sp-notice .bulk-error-show{cursor:pointer}.sp-notice div.bulk-error-list{background-color:#f1f1f1;padding:0 10px;display:none;max-height:200px;overflow-y:scroll}.sp-notice div.bulk-error-list ul{padding:3px 0 0;margin-top:5px}.sp-notice div.bulk-error-list ul>li:not(:last-child){border-bottom:1px solid #fff;padding-bottom:4px}input.dial{box-shadow:none}.shortpixel-table .column-filename{max-width:32em;width:40%}.shortpixel-table .column-folder{max-width:20em;width:20%}.shortpixel-table .column-media_type{max-width:8em;width:10%}.shortpixel-table .column-status{max-width:16em;width:15%}.shortpixel-table .column-options{max-width:16em;width:15%}.form-table th{width:220px}.form-table td{position:relative}div.shortpixel-rate-us{display:inline-block;margin-left:10px;vertical-align:top;font-weight:700}div.shortpixel-rate-us>a{vertical-align:middle;padding:1px 5px 0;text-align:center;display:inline-block}div.shortpixel-rate-us>a>span{display:inline-block;vertical-align:top;margin-top:5px}div.shortpixel-rate-us>a>img{padding-top:7px}div.shortpixel-rate-us>a:active,div.shortpixel-rate-us>a:focus,div.shortpixel-rate-us>a:hover{outline:0;border-style:none}.sp-loading-small{margin-top:2px;float:left;margin-right:5px}.twentytwenty-horizontal .twentytwenty-after-label:before,.twentytwenty-horizontal .twentytwenty-before-label:before{font-family:inherit;font-size:16px}.short-pixel-bulk-page p{margin:.6em 0}.short-pixel-bulk-page form.start{display:table;content:" ";width:98%;background-color:#fff;padding:10px 10px 0;position:relative}.bulk-stats-container{display:inline-block;min-width:450px;width:45%;float:left;padding-right:50px;font-size:1.1em;line-height:1.5em}.bulk-text-container{display:inline-block;min-width:440px;width:45%;float:left;padding-right:50px}.bulk-text-container h3{border-bottom:1px solid #a8a8a8;margin-bottom:.5em;padding-bottom:.5em}.bulk-wide{display:inline-block;width:90%;float:left;margin-top:25px}.bulk-stats-container .bulk-label{width:220px;display:inline-block}.bulk-stats-container .bulk-val{width:50px;display:inline-block;text-align:right}.bulk-stats-container .bulk-total{font-weight:700;margin-top:10px;margin-bottom:10px}.wp-core-ui .bulk-play{display:inline;width:310px;float:left;margin-bottom:20px}.wp-core-ui .bulk-play.bulk-nothing-optimize{font-weight:700;color:#0080b2;border:1px solid;border-radius:5px;margin-top:60px;padding:5px 12px}.wp-core-ui .bulk-play a.button{height:60px;margin-top:27px;overflow:hidden}.wp-core-ui .column-wp-shortPixel .sp-column-actions{max-width:140px;float:right;text-align:right}.wp-core-ui .column-wp-shortPixel .sp-column-actions .button.button-smaller{margin-right:0}.wp-core-ui .column-wp-shortPixel .button.button-smaller{font-size:13px;padding:0 5px;margin-bottom:4px;min-height:30px;float:right}.wp-core-ui.rtl .column-wp-shortPixel .button.button-smaller,.wp-core-ui.rtl .column-wp-shortPixel .sp-column-actions{float:left}th.sortable.column-wp-shortPixel a,th.sorted.column-wp-shortPixel a{display:inline-block}.column-wp-shortPixel .sorting-indicator{display:inline-block}.wp-core-ui .bulk-play a.button .bulk-btn-img{display:inline-block;padding-top:6px}.wp-core-ui .bulk-play a.button .bulk-btn-txt{display:inline-block;text-align:right;line-height:1.3em;margin:11px 10px}.wp-core-ui .bulk-play a.button .bulk-btn-txt span.label{font-size:1.6em}.wp-core-ui .bulk-play a.button .bulk-btn-txt span.total{font-size:1.4em}.bulk-progress{padding:20px 32px 17px;background-color:#fff}.bulk-progress.bulk-stats>div{display:inline-block}.bulk-progress.bulk-stats>div.label{width:320px}.bulk-progress.bulk-stats>div.stat-value{width:80px;text-align:right}.short-pixel-bulk-page .progress{background-color:#ecedee;height:30px;position:relative;width:60%;display:inline-block;margin-right:28px;overflow:visible}.progress .progress-img{position:absolute;top:-10px;z-index:2;margin-left:-35px;line-height:48px;font-size:22px;font-weight:700}.progress .progress-img span{vertical-align:top;margin-left:-7px}.progress .progress-left{background-color:#1cbecb;bottom:0;left:0;position:absolute;top:0;z-index:1;font-size:22px;font-weight:700;line-height:28px;text-align:center;color:#fff}.bulk-estimate{font-size:20px;line-height:30px;vertical-align:top;display:inline-block}.wp-core-ui .button-primary.bulk-cancel{float:right;height:30px}.short-pixel-block-title{font-size:22px;font-weight:700;text-align:center;margin-bottom:30px}.sp-floating-block.bulk-slider-container{display:none}.sp-floating-block.sp-notice.bulk-notices-parent{padding:0;margin:0;float:right;margin-right:500px!important}.bulk-slider-container{margin-top:20px;min-height:300px;overflow:hidden}.bulk-slider-container h2{margin-bottom:15px}.bulk-slider-container span.filename{font-weight:400}.bulk-slider{display:table;margin:0 auto}.bulk-slider .bulk-slide{margin:0 auto;padding-left:120px;display:inline-block;font-weight:700}.bulk-slider .img-optimized,.bulk-slider .img-original{display:inline-block;margin-right:20px;text-align:center}.bulk-slider .img-optimized div,.bulk-slider .img-original div{max-height:450px;overflow:hidden}.bulk-slider .img-optimized img,.bulk-slider .img-original img{max-width:300px}.bulk-slider .img-info{display:inline-block;vertical-align:top;font-size:48px;max-width:150px;padding:10px 0 0 20px}.bulk-slide-images{display:inline-block;border:1px solid #1caecb;padding:15px 0 0 20px}p.settings-info{padding-top:0;color:#818181;font-size:13px!important}p.settings-info.shortpixel-settings-error{color:#c32525}.shortpixel-key-valid{font-weight:700}.shortpixel-key-valid .dashicons-yes:before{font-size:2em;line-height:25px;color:#3485ba;margin-left:-20px}.shortpixel-compression .shortpixel-compression-options{color:#999}.shortpixel-compression strong{line-height:22px}.shortpixel-compression .shortpixel-compression-options{display:inline-block}.shortpixel-compression label{width:158px;margin:0 -2px;background-color:#e2faff;font-weight:700;display:inline-block}.shortpixel-compression label span{text-align:center;font-size:18px;padding:8px 0;display:block}.shortpixel-compression label input{display:none}.shortpixel-compression input:checked+span{background-color:#0085ba;color:#f7f7f7}.shortpixel-compression .shortpixel-radio-info{min-height:60px}article.sp-tabs{position:relative;display:block;width:100%;margin:2em auto}article.sp-tabs section{position:absolute;display:block;top:1.8em;left:0;width:100%;max-width:100%;box-sizing:border-box;padding:10px 20px;z-index:0}article.sp-tabs section.sel-tab{box-shadow:0 3px 3px rgba(0,0,0,.1)}article.sp-tabs section .wp-shortpixel-tab-content{visibility:hidden}article.sp-tabs section.sel-tab .wp-shortpixel-tab-content{visibility:visible!important}article.sp-tabs section:first-child{z-index:1}article.sp-tabs section h2 a:focus,article.sp-tabs section#tab-resources a:focus{box-shadow:none;outline:0}article.sp-tabs section.sel-tab,article.sp-tabs section.sel-tab h2{color:#333;background-color:#fff;z-index:2}#tab-stats .sp-bulk-summary{position:absolute;right:0;top:0;z-index:100}.deliverWebpAlteringTypes,.deliverWebpSettings,.deliverWebpTypes{display:none}.deliverWebpTypes .sp-notice{color:red}.deliverWebpSettings{margin:16px 0}.deliverWebpSettings input:disabled+label{color:#818181}.deliverWebpAlteringTypes,.deliverWebpTypes{margin:16px 0 16px 16px}#png2jpg:not(:checked)~#png2jpgForce,#png2jpg:not(:checked)~label[for=png2jpgForce]{display:none}article.sp-tabs section #createWebp:checked~.deliverWebpSettings,article.sp-tabs section #deliverWebp:checked~.deliverWebpTypes,article.sp-tabs section #deliverWebpAltered:checked~.deliverWebpAlteringTypes{display:block}.shortpixel-help-link span.dashicons{text-decoration:none;margin-top:-1px}@media(min-width:1000px){section#tab-resources .col-md-6{display:inline-block;width:45%}}@media(max-width:999px){section#tab-resources .col-sm-12{display:inline-block;width:100%}}section#tab-resources .text-center{text-align:center}section#tab-resources p{font-size:16px}.wrap.short-pixel-bulk-page{margin-right:0}.sp-container{overflow:hidden;display:block;width:100%}.sp-floating-block{overflow:hidden;display:inline-block;float:left;margin-right:1.1%!important}.sp-full-width{width:98.8%;box-sizing:border-box}.sp-double-width{width:65.52%;box-sizing:border-box}.sp-single-width{width:32.23%;box-sizing:border-box}@media(max-width:1759px){.sp-floating-block{margin-right:1.3%!important}.sp-double-width,.sp-full-width{width:98.65%}.sp-single-width{width:48.7%}}@media(max-width:1249px){.sp-floating-block{margin-right:2%!important}.sp-double-width,.sp-full-width,.sp-single-width{width:97%}}.sp-tabs h2:before{content:none}.sp-column-actions-template+.sp-column-info{display:none}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .reset {
2
+ font-weight: normal;
3
+ font-style: normal;
4
+ }
5
+
6
+ .shortpixel-hide {
7
+ display: none;
8
+ }
9
+
10
+ .clearfix:before, .clearfix:after {
11
+ content: " ";
12
+ /* 1 */
13
+ display: table;
14
+ /* 2 */
15
+ }
16
+
17
+ .clearfix:after {
18
+ clear: both;
19
+ }
20
+
21
+ .clearfix {
22
+ zoom: 1;
23
+ }
24
+
25
+ .resumeLabel {
26
+ float: right;
27
+ line-height: 30px;
28
+ margin-right: 20px;
29
+ font-size: 16px;
30
+ }
31
+
32
+ /* Dropdown Button */
33
+ .sp-dropbtn.button {
34
+ box-sizing: content-box;
35
+ padding: 0 5px;
36
+ font-size: 20px;
37
+ line-height: 20px;
38
+ /*background-color: #4CAF50;
39
+ color: white;
40
+ border: none;*/
41
+ cursor: pointer;
42
+ }
43
+
44
+ /* Dropdown button on hover & focus
45
+ .sp-dropbtn:hover, .sp-dropbtn:focus {
46
+ background-color: #3e8e41;
47
+ }
48
+ */
49
+ /* The container <div> - needed to position the dropdown content */
50
+ .sp-dropdown {
51
+ position: relative;
52
+ display: inline-block;
53
+ }
54
+
55
+ /* Dropdown Content (Hidden by Default) */
56
+ .sp-dropdown-content {
57
+ display: none;
58
+ right: 0;
59
+ position: absolute;
60
+ background-color: #f9f9f9;
61
+ min-width: 190px;
62
+ box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
63
+ z-index: 1;
64
+ }
65
+
66
+ .rtl .sp-dropdown-content {
67
+ right: auto;
68
+ left: 0;
69
+ }
70
+
71
+ /* Links inside the dropdown */
72
+ .sp-dropdown-content a {
73
+ color: black;
74
+ padding: 12px 16px;
75
+ text-decoration: none;
76
+ display: block;
77
+ }
78
+
79
+ /* Change color of dropdown links on hover */
80
+ .sp-dropdown-content a:hover {
81
+ background-color: #f1f1f1;
82
+ }
83
+
84
+ /* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */
85
+ .sp-dropdown.sp-show .sp-dropdown-content {
86
+ display: block;
87
+ }
88
+
89
+ div.fb-like {
90
+ transform: scale(1.3);
91
+ -ms-transform: scale(1.3);
92
+ -webkit-transform: scale(1.3);
93
+ -o-transform: scale(1.3);
94
+ -moz-transform: scale(1.3);
95
+ transform-origin: bottom left;
96
+ -ms-transform-origin: bottom left;
97
+ -webkit-transform-origin: bottom left;
98
+ -moz-transform-origin: bottom left;
99
+ -webkit-transform-origin: bottom left;
100
+ }
101
+
102
+ .wp-core-ui .button.button-alert, .wp-core-ui .button.button-alert:hover {
103
+ background: #f79797;
104
+ }
105
+
106
+ .wp-core-ui .button.remove-folder-button {
107
+ min-width: 120px;
108
+ }
109
+
110
+ /** In time this is not needed, new notice model **/
111
+ .sp-notice {
112
+ background: #fff;
113
+ border-left: 4px solid #fff;
114
+ -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
115
+ box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
116
+ padding: 1px 12px;
117
+ }
118
+
119
+ .sp-notice img {
120
+ vertical-align: bottom;
121
+ }
122
+
123
+ @media (max-width: 1249px) {
124
+ .sp-notice {
125
+ margin: 5px 15px 2px;
126
+ }
127
+ }
128
+ .sp-notice-info {
129
+ border-left-color: #00a0d2;
130
+ }
131
+
132
+ .sp-notice-success {
133
+ border-left-color: #46b450;
134
+ }
135
+
136
+ .sp-notice-warning {
137
+ border-left-color: #f1e02a;
138
+ }
139
+
140
+ div.short-pixel-bulk-page input.dial {
141
+ font-size: 16px !important;
142
+ }
143
+
144
+ div.short-pixel-bulk-page h1 {
145
+ margin-bottom: 20px;
146
+ }
147
+
148
+ div.bulk-progress div.sp-h2 {
149
+ margin-top: 0;
150
+ margin-bottom: 10px;
151
+ font-size: 23px;
152
+ font-weight: 400;
153
+ padding: 9px 15px 4px 0;
154
+ line-height: 29px;
155
+ }
156
+
157
+ div.bulk-progress-partners {
158
+ margin-top: 20px;
159
+ }
160
+
161
+ div.bulk-progress.bulk-progress-partners a div {
162
+ display: inline-block;
163
+ vertical-align: top;
164
+ line-height: 50px;
165
+ margin-left: 30px;
166
+ font-size: 1.2em;
167
+ }
168
+
169
+ div.bulk-progress .bulk-progress-indicator,
170
+ div.sp-quota-exceeded-alert .bulk-progress-indicator {
171
+ display: inline-block;
172
+ text-align: center;
173
+ padding: 0 10px;
174
+ margin-left: 10px;
175
+ float: left;
176
+ height: 90px;
177
+ overflow: hidden;
178
+ border: 1px solid #1CAECB;
179
+ }
180
+
181
+ div.wrap.short-pixel-bulk-page .bulk-notice-container {
182
+ margin-top: 15px;
183
+ position: absolute;
184
+ width: 500px;
185
+ }
186
+
187
+ div.wrap.short-pixel-bulk-page .bulk-notice-container .bulk-notice-msg {
188
+ text-align: center;
189
+ margin: 10px 0 0 32px;
190
+ overflow: hidden;
191
+ border: 1px solid #1CAECB;
192
+ background-color: #9ddbe0;
193
+ border-radius: 5px;
194
+ padding: 7px 10px 10px;
195
+ display: none;
196
+ max-width: 600px;
197
+ margin-right: 20px;
198
+ }
199
+
200
+ div.wrap.short-pixel-bulk-page .bulk-notice-container .bulk-notice-msg.bulk-error {
201
+ border: 1px solid #b5914d;
202
+ background-color: #ffe996;
203
+ margin-right: 20px;
204
+ position: relative;
205
+ z-index: 10;
206
+ }
207
+
208
+ div.wrap.short-pixel-bulk-page .bulk-notice-container .bulk-notice-msg.bulk-error.bulk-error-fatal {
209
+ border: 1px solid #c32525;
210
+ background-color: #ff969d;
211
+ }
212
+
213
+ div.wrap.short-pixel-bulk-page .bulk-notice-msg img {
214
+ float: left;
215
+ margin-top: 3px;
216
+ margin-right: 5px;
217
+ }
218
+
219
+ div.sp-bulk-summary {
220
+ float: right;
221
+ margin: 8px 5px 3px 20px;
222
+ }
223
+
224
+ .sp-notice .bulk-error-show {
225
+ cursor: pointer;
226
+ }
227
+
228
+ .sp-notice div.bulk-error-list {
229
+ background-color: #f1f1f1;
230
+ padding: 0 10px;
231
+ display: none;
232
+ max-height: 200px;
233
+ overflow-y: scroll;
234
+ }
235
+
236
+ .sp-notice div.bulk-error-list ul {
237
+ padding: 3px 0 0;
238
+ margin-top: 5px;
239
+ }
240
+
241
+ .sp-notice div.bulk-error-list ul > li:not(:last-child) {
242
+ border-bottom: 1px solid white;
243
+ padding-bottom: 4px;
244
+ }
245
+
246
+ input.dial {
247
+ box-shadow: none;
248
+ }
249
+
250
+ .shortpixel-table .column-filename {
251
+ max-width: 32em;
252
+ width: 40%;
253
+ }
254
+
255
+ .shortpixel-table .column-folder {
256
+ max-width: 20em;
257
+ width: 20%;
258
+ }
259
+
260
+ .shortpixel-table .column-media_type {
261
+ max-width: 8em;
262
+ width: 10%;
263
+ }
264
+
265
+ .shortpixel-table .column-status {
266
+ max-width: 16em;
267
+ width: 15%;
268
+ }
269
+
270
+ .shortpixel-table .column-options {
271
+ max-width: 16em;
272
+ width: 15%;
273
+ }
274
+
275
+ .form-table th {
276
+ width: 220px;
277
+ }
278
+
279
+ .form-table td {
280
+ position: relative;
281
+ }
282
+
283
+ div.shortpixel-rate-us {
284
+ display: inline-block;
285
+ margin-left: 10px;
286
+ vertical-align: top;
287
+ font-weight: bold;
288
+ }
289
+
290
+ div.shortpixel-rate-us > a {
291
+ vertical-align: middle;
292
+ padding: 1px 5px 0;
293
+ text-align: center;
294
+ display: inline-block;
295
+ }
296
+
297
+ div.shortpixel-rate-us > a > span {
298
+ display: inline-block;
299
+ vertical-align: top;
300
+ margin-top: 5px;
301
+ }
302
+
303
+ div.shortpixel-rate-us > a > img {
304
+ padding-top: 7px;
305
+ }
306
+
307
+ div.shortpixel-rate-us > a:active,
308
+ div.shortpixel-rate-us > a:hover,
309
+ div.shortpixel-rate-us > a:focus {
310
+ outline: 0;
311
+ border-style: none;
312
+ }
313
+
314
+ .sp-loading-small {
315
+ margin-top: 2px;
316
+ float: left;
317
+ margin-right: 5px;
318
+ }
319
+
320
+ .twentytwenty-horizontal .twentytwenty-before-label:before, .twentytwenty-horizontal .twentytwenty-after-label:before {
321
+ font-family: inherit;
322
+ font-size: 16px;
323
+ }
324
+
325
+ .short-pixel-bulk-page p {
326
+ margin: 0.6em 0;
327
+ }
328
+
329
+ .short-pixel-bulk-page form.start {
330
+ display: table;
331
+ content: " ";
332
+ width: 98%;
333
+ background-color: white;
334
+ padding: 10px 10px 0;
335
+ position: relative;
336
+ /*margin-top: 2em;*/
337
+ }
338
+
339
+ .bulk-stats-container {
340
+ display: inline-block;
341
+ min-width: 450px;
342
+ width: 45%;
343
+ float: left;
344
+ padding-right: 50px;
345
+ font-size: 1.1em;
346
+ line-height: 1.5em;
347
+ }
348
+
349
+ .bulk-text-container {
350
+ display: inline-block;
351
+ min-width: 440px;
352
+ width: 45%;
353
+ float: left;
354
+ padding-right: 50px;
355
+ }
356
+
357
+ .bulk-text-container h3 {
358
+ border-bottom: 1px solid #a8a8a8;
359
+ margin-bottom: 0.5em;
360
+ padding-bottom: 0.5em;
361
+ }
362
+
363
+ .bulk-wide {
364
+ display: inline-block;
365
+ width: 90%;
366
+ float: left;
367
+ margin-top: 25px;
368
+ }
369
+
370
+ .bulk-stats-container .bulk-label {
371
+ width: 220px;
372
+ display: inline-block;
373
+ }
374
+
375
+ .bulk-stats-container .bulk-val {
376
+ width: 50px;
377
+ display: inline-block;
378
+ text-align: right;
379
+ }
380
+
381
+ .bulk-stats-container .bulk-total {
382
+ font-weight: bold;
383
+ margin-top: 10px;
384
+ margin-bottom: 10px;
385
+ }
386
+
387
+ .wp-core-ui .bulk-play {
388
+ display: inline;
389
+ width: 310px;
390
+ float: left;
391
+ margin-bottom: 20px;
392
+ }
393
+
394
+ .wp-core-ui .bulk-play.bulk-nothing-optimize {
395
+ font-weight: bold;
396
+ color: #0080b2;
397
+ border: 1px solid;
398
+ border-radius: 5px;
399
+ margin-top: 60px;
400
+ padding: 5px 12px;
401
+ }
402
+
403
+ .wp-core-ui .bulk-play a.button {
404
+ height: 60px;
405
+ margin-top: 27px;
406
+ /*width: 290px;*/
407
+ overflow: hidden;
408
+ }
409
+
410
+ .wp-core-ui .column-wp-shortPixel .sp-column-actions {
411
+ max-width: 140px;
412
+ float: right;
413
+ text-align: right;
414
+ }
415
+
416
+ .wp-core-ui .column-wp-shortPixel .sp-column-actions .button.button-smaller {
417
+ margin-right: 0px;
418
+ }
419
+
420
+ .wp-core-ui .column-wp-shortPixel .button.button-smaller {
421
+ font-size: 13px;
422
+ padding: 0px 5px;
423
+ margin-bottom: 4px;
424
+ min-height: 30px;
425
+ float: right;
426
+ }
427
+
428
+ .wp-core-ui.rtl .column-wp-shortPixel .sp-column-actions,
429
+ .wp-core-ui.rtl .column-wp-shortPixel .button.button-smaller {
430
+ float: left;
431
+ }
432
+
433
+ th.sortable.column-wp-shortPixel a,
434
+ th.sorted.column-wp-shortPixel a {
435
+ display: inline-block;
436
+ }
437
+
438
+ .column-wp-shortPixel .sorting-indicator {
439
+ display: inline-block;
440
+ }
441
+
442
+ .wp-core-ui .bulk-play a.button .bulk-btn-img {
443
+ /*float:left;*/
444
+ display: inline-block;
445
+ padding-top: 6px;
446
+ }
447
+
448
+ .wp-core-ui .bulk-play a.button .bulk-btn-txt {
449
+ /*float:left;*/
450
+ display: inline-block;
451
+ text-align: right;
452
+ line-height: 1.3em;
453
+ margin: 11px 10px;
454
+ }
455
+
456
+ .wp-core-ui .bulk-play a.button .bulk-btn-txt span.label {
457
+ font-size: 1.6em;
458
+ }
459
+
460
+ .wp-core-ui .bulk-play a.button .bulk-btn-txt span.total {
461
+ font-size: 1.4em;
462
+ }
463
+
464
+ .bulk-progress {
465
+ padding: 20px 32px 17px;
466
+ background-color: #ffffff;
467
+ }
468
+
469
+ .bulk-progress.bulk-stats > div {
470
+ display: inline-block;
471
+ }
472
+
473
+ .bulk-progress.bulk-stats > div.label {
474
+ width: 320px;
475
+ }
476
+
477
+ .bulk-progress.bulk-stats > div.stat-value {
478
+ width: 80px;
479
+ text-align: right;
480
+ }
481
+
482
+ .short-pixel-bulk-page .progress {
483
+ background-color: #ecedee;
484
+ height: 30px;
485
+ position: relative;
486
+ width: 60%;
487
+ display: inline-block;
488
+ margin-right: 28px;
489
+ overflow: visible;
490
+ }
491
+
492
+ .progress .progress-img {
493
+ position: absolute;
494
+ top: -10px;
495
+ z-index: 2;
496
+ margin-left: -35px;
497
+ line-height: 48px;
498
+ font-size: 22px;
499
+ font-weight: bold;
500
+ }
501
+
502
+ .progress .progress-img span {
503
+ vertical-align: top;
504
+ margin-left: -7px;
505
+ }
506
+
507
+ .progress .progress-left {
508
+ background-color: #1cbecb;
509
+ bottom: 0;
510
+ left: 0;
511
+ position: absolute;
512
+ top: 0;
513
+ z-index: 1;
514
+ font-size: 22px;
515
+ font-weight: bold;
516
+ line-height: 28px;
517
+ text-align: center;
518
+ color: #ffffff;
519
+ }
520
+
521
+ .bulk-estimate {
522
+ font-size: 20px;
523
+ line-height: 30px;
524
+ vertical-align: top;
525
+ display: inline-block;
526
+ }
527
+
528
+ .wp-core-ui .button-primary.bulk-cancel {
529
+ float: right;
530
+ height: 30px;
531
+ }
532
+
533
+ .short-pixel-block-title {
534
+ font-size: 22px;
535
+ font-weight: bold;
536
+ text-align: center;
537
+ margin-bottom: 30px;
538
+ }
539
+
540
+ .sp-floating-block.bulk-slider-container {
541
+ display: none;
542
+ }
543
+
544
+ .sp-floating-block.sp-notice.bulk-notices-parent {
545
+ padding: 0;
546
+ margin: 0;
547
+ float: right;
548
+ margin-right: 500px !important;
549
+ }
550
+
551
+ .bulk-slider-container {
552
+ margin-top: 20px;
553
+ min-height: 300px;
554
+ overflow: hidden;
555
+ }
556
+
557
+ .bulk-slider-container h2 {
558
+ margin-bottom: 15px;
559
+ }
560
+
561
+ .bulk-slider-container span.filename {
562
+ font-weight: normal;
563
+ }
564
+
565
+ .bulk-slider {
566
+ display: table;
567
+ margin: 0 auto;
568
+ }
569
+
570
+ .bulk-slider .bulk-slide {
571
+ /*position: absolute;*/
572
+ margin: 0 auto;
573
+ padding-left: 120px;
574
+ display: inline-block;
575
+ font-weight: bold;
576
+ }
577
+
578
+ .bulk-slider .img-original,
579
+ .bulk-slider .img-optimized {
580
+ display: inline-block;
581
+ margin-right: 20px;
582
+ text-align: center;
583
+ }
584
+
585
+ .bulk-slider .img-original div,
586
+ .bulk-slider .img-optimized div {
587
+ max-height: 450px;
588
+ overflow: hidden;
589
+ }
590
+
591
+ .bulk-slider .img-original img,
592
+ .bulk-slider .img-optimized img {
593
+ max-width: 300px;
594
+ }
595
+
596
+ .bulk-slider .img-info {
597
+ display: inline-block;
598
+ vertical-align: top;
599
+ font-size: 48px;
600
+ max-width: 150px;
601
+ padding: 10px 0 0 20px;
602
+ }
603
+
604
+ .bulk-slide-images {
605
+ display: inline-block;
606
+ border: 1px solid #1CAECB;
607
+ padding: 15px 0 0 20px;
608
+ }
609
+
610
+ p.settings-info {
611
+ padding-top: 0px;
612
+ color: #818181;
613
+ font-size: 13px !important;
614
+ }
615
+
616
+ p.settings-info.shortpixel-settings-error {
617
+ color: #c32525;
618
+ }
619
+
620
+ .shortpixel-key-valid {
621
+ font-weight: bold;
622
+ }
623
+
624
+ .shortpixel-key-valid .dashicons-yes:before {
625
+ font-size: 2em;
626
+ line-height: 25px;
627
+ color: #3485ba;
628
+ margin-left: -20px;
629
+ }
630
+
631
+ .shortpixel-compression .shortpixel-compression-options {
632
+ color: #999;
633
+ }
634
+
635
+ .shortpixel-compression strong {
636
+ line-height: 22px;
637
+ }
638
+
639
+ .shortpixel-compression .shortpixel-compression-options {
640
+ display: inline-block;
641
+ }
642
+
643
+ .shortpixel-compression label {
644
+ width: 158px;
645
+ margin: 0 -2px;
646
+ background-color: #e2faff;
647
+ font-weight: bold;
648
+ display: inline-block;
649
+ }
650
+
651
+ .shortpixel-compression label span {
652
+ text-align: center;
653
+ font-size: 18px;
654
+ padding: 8px 0px;
655
+ display: block;
656
+ }
657
+
658
+ .shortpixel-compression label input {
659
+ display: none;
660
+ }
661
+
662
+ .shortpixel-compression input:checked + span {
663
+ background-color: #0085ba;
664
+ color: #F7F7F7;
665
+ }
666
+
667
+ .shortpixel-compression .shortpixel-radio-info {
668
+ min-height: 60px;
669
+ }
670
+
671
+ /* TABS CONTROLS */
672
+ article.sp-tabs {
673
+ position: relative;
674
+ display: block;
675
+ width: 100%;
676
+ /*height: 1100px;*/
677
+ margin: 2em auto;
678
+ }
679
+
680
+ article.sp-tabs section {
681
+ position: absolute;
682
+ display: block;
683
+ top: 1.8em;
684
+ left: 0;
685
+ /*height: 1100px;*/
686
+ width: 100%;
687
+ max-width: 100%;
688
+ box-sizing: border-box;
689
+ padding: 10px 20px;
690
+ /*background-color: #ddd;*/
691
+ /* border-radius: 5px; */
692
+ z-index: 0;
693
+ }
694
+
695
+ article.sp-tabs section.sel-tab {
696
+ position: relative;
697
+ box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1);
698
+ }
699
+
700
+ article.sp-tabs section .wp-shortpixel-tab-content {
701
+ visibility: hidden;
702
+ }
703
+
704
+ article.sp-tabs section.sel-tab .wp-shortpixel-tab-content {
705
+ visibility: visible !important;
706
+ }
707
+
708
+ article.sp-tabs section:first-child {
709
+ z-index: 1;
710
+ }
711
+
712
+ article.sp-tabs section h2 a:focus,
713
+ article.sp-tabs section#tab-resources a:focus {
714
+ box-shadow: none;
715
+ outline: none;
716
+ }
717
+
718
+ article.sp-tabs section.sel-tab,
719
+ article.sp-tabs section.sel-tab h2 {
720
+ color: #333;
721
+ background-color: #fff;
722
+ z-index: 2;
723
+ }
724
+
725
+ #tab-stats .sp-bulk-summary {
726
+ position: absolute;
727
+ right: 0;
728
+ top: 0;
729
+ z-index: 100;
730
+ }
731
+
732
+ .deliverWebpTypes, .deliverWebpAlteringTypes {
733
+ display: none;
734
+ }
735
+
736
+ .deliverWebpTypes .sp-notice {
737
+ color: red;
738
+ }
739
+
740
+ .deliverWebpSettings {
741
+ margin: 16px 0;
742
+ }
743
+
744
+ .deliverWebpSettings input:disabled + label {
745
+ color: #818181;
746
+ }
747
+
748
+ .deliverWebpTypes, .deliverWebpAlteringTypes {
749
+ margin: 16px 0 16px 16px;
750
+ }
751
+
752
+ #png2jpg:not(:checked) ~ #png2jpgForce,
753
+ #png2jpg:not(:checked) ~ label[for=png2jpgForce] {
754
+ /*pointer-events: none;
755
+ opacity: .5;*/
756
+ display: none;
757
+ }
758
+
759
+ article.sp-tabs section #deliverWebp:checked ~ .deliverWebpTypes,
760
+ article.sp-tabs section #deliverWebpAltered:checked ~ .deliverWebpAlteringTypes {
761
+ display: block;
762
+ }
763
+
764
+ /*article.sp-tabs section,
765
+ article.sp-tabs section h2 {
766
+ -webkit-transition: all 500ms ease;
767
+ -moz-transition: all 500ms ease;
768
+ -ms-transition: all 500ms ease;
769
+ -o-transition: all 500ms ease;
770
+ transition: all 500ms ease;
771
+ }
772
+ */
773
+ .shortpixel-help-link span.dashicons {
774
+ text-decoration: none;
775
+ margin-top: -1px;
776
+ }
777
+
778
+ /* Resources */
779
+ @media (min-width: 1000px) {
780
+ section#tab-resources .col-md-6 {
781
+ display: inline-block;
782
+ width: 45%;
783
+ }
784
+ }
785
+ @media (max-width: 999px) {
786
+ section#tab-resources .col-sm-12 {
787
+ display: inline-block;
788
+ width: 100%;
789
+ }
790
+ }
791
+ section#tab-resources .text-center {
792
+ text-align: center;
793
+ }
794
+
795
+ section#tab-resources p {
796
+ font-size: 16px;
797
+ }
798
+
799
+ /* ShortPixel columns layout */
800
+ .wrap.short-pixel-bulk-page {
801
+ margin-right: 0;
802
+ }
803
+
804
+ .sp-container {
805
+ overflow: hidden;
806
+ display: block;
807
+ width: 100%;
808
+ }
809
+
810
+ .sp-floating-block {
811
+ overflow: hidden;
812
+ display: inline-block;
813
+ float: left;
814
+ margin-right: 1.1% !important;
815
+ }
816
+
817
+ .sp-full-width {
818
+ width: 98.8%;
819
+ box-sizing: border-box;
820
+ }
821
+
822
+ .sp-double-width {
823
+ width: 65.52%;
824
+ box-sizing: border-box;
825
+ }
826
+
827
+ .sp-single-width {
828
+ width: 32.23%;
829
+ box-sizing: border-box;
830
+ }
831
+
832
+ @media (max-width: 1759px) {
833
+ .sp-floating-block {
834
+ margin-right: 1.3% !important;
835
+ }
836
+
837
+ .sp-double-width, .sp-full-width {
838
+ width: 98.65%;
839
+ }
840
+
841
+ .sp-single-width {
842
+ width: 48.7%;
843
+ }
844
+ }
845
+ @media (max-width: 1249px) {
846
+ .sp-floating-block {
847
+ margin-right: 2% !important;
848
+ }
849
+
850
+ .sp-double-width, .sp-full-width, .sp-single-width {
851
+ width: 97%;
852
+ }
853
+ }
854
+ /*workaround for bad style inline css in the plugin <<WooCommerce Remove /product & /product-category>> that's causing conflict*/
855
+ .sp-tabs h2:before {
856
+ content: none;
857
+ }
858
+
859
+ .sp-column-actions-template + .sp-column-info {
860
+ display: none;
861
+ }
862
+
863
+ /*# sourceMappingURL=short-pixel.min.css.map */
res/css/shortpixel-admin.css CHANGED
@@ -1,172 +1,268 @@
1
  .short-pixel-bulk-page.bulk-restore-all ol li {
2
- font-weight: 700; }
 
3
  .short-pixel-bulk-page.bulk-restore-all section.select_folders {
4
- margin: 20px 0; }
5
- .short-pixel-bulk-page.bulk-restore-all section.select_folders .input {
6
- margin: 10px 0 10px 15px;
7
- font-size: 16px;
8
- display: block;
9
- clear: both; }
10
- .short-pixel-bulk-page.bulk-restore-all section.select_folders .filecount {
11
- font-size: 12px; }
 
 
 
12
  .short-pixel-bulk-page.bulk-restore-all section.random_check .random_answer {
13
  font-size: 16px;
14
  font-weight: 700;
15
  padding: 8px;
16
  border: 1px solid #ccc;
17
- display: inline-block; }
 
18
  .short-pixel-bulk-page.bulk-restore-all section.random_check .inputs {
19
- margin: 15px 0; }
20
- .short-pixel-bulk-page.bulk-restore-all section.random_check .inputs span {
21
- margin-right: 8px; }
 
 
22
  .short-pixel-bulk-page.bulk-restore-all .button {
23
  margin: 10px 0;
24
- margin-right: 8px; }
 
25
 
26
  .short-pixel-bulk-page .sp-hidden {
27
- display: none; }
 
28
 
29
  /* Specific styles for advanced settings tab */
30
  #shortpixel-settings-tabs #tab-adv-settings .addCustomFolder {
31
- margin: 10px 0; }
32
- #shortpixel-settings-tabs #tab-adv-settings .addCustomFolder .add-folder-text {
33
- margin-left: 5px; }
34
- #shortpixel-settings-tabs #tab-adv-settings .addCustomFolder input[type="text"] {
35
- width: 50em;
36
- max-width: 70%; }
37
- #shortpixel-settings-tabs #tab-adv-settings .addCustomFolder input[name="saveAdv"] {
38
- margin-left: 8px; }
 
 
 
 
39
  #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list {
40
  display: table;
41
- border-collapse: separate; }
42
- #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list div.heading {
43
- width: auto;
44
- display: table-header-group;
45
- padding: 12px 16px 12px 12px; }
46
- #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list div.heading span {
47
- font-weight: 600;
48
- font-size: 14px; }
49
- #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list div {
50
- display: table-row; }
51
- #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list div > span {
52
- display: table-cell;
53
- padding: 5px 10px;
54
- vertical-align: middle;
55
- background-color: #eee; }
56
- #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list div > span.action {
57
- background-color: unset; }
58
- #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list .refresh-folder {
59
- text-decoration: none; }
60
- #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list .info-icon {
61
- cursor: pointer; }
 
 
 
 
 
 
 
 
62
 
63
  .cf_switch label {
64
  width: 100%;
65
  margin: 0 -2px;
66
  background-color: #e2faff;
67
- display: inline-block; }
68
- .cf_switch label span {
69
- padding: 8px 0px 8px 15px;
70
- display: block;
71
- font-size: 13px; }
72
- .cf_switch label input {
73
- display: none; }
74
- .cf_switch label input:checked + span {
75
- background-color: #0085ba;
76
- color: #F7F7F7; }
 
 
 
 
77
 
78
  .settings_page_wp-shortpixel-settings {
79
- /* In-view notice ( not on top, between the options ) - styled after WP notice */ }
80
- .settings_page_wp-shortpixel-settings .top-menu {
81
- font-size: 18px; }
82
- .settings_page_wp-shortpixel-settings .top-menu a {
83
- font-size: 18px; }
84
- .settings_page_wp-shortpixel-settings .wp-shortpixel-tab-content {
85
- transition: all 1000ms linear; }
86
- .settings_page_wp-shortpixel-settings article.sp-tabs section .wp-shortpixel-tab-content {
87
- opacity: 0; }
88
- .settings_page_wp-shortpixel-settings article.sp-tabs section.sel-tab .wp-shortpixel-tab-content {
89
- opacity: 1; }
90
- .settings_page_wp-shortpixel-settings article.sp-tabs section h2 {
91
- position: absolute;
92
- font-size: 1.3em;
93
- font-weight: normal;
94
- width: 180px;
95
- height: 1.8em;
96
- top: -1.8em;
97
- left: 10px;
98
- padding: 0;
99
- margin: 0;
100
- color: #999;
101
- background-color: #ddd;
102
- /* border-radius: 5px 5px 0 0; */ }
103
- .settings_page_wp-shortpixel-settings article.sp-tabs section h2 a {
104
- display: block;
105
- width: 100%;
106
- line-height: 1.8em;
107
- text-align: center;
108
- text-decoration: none;
109
- color: #23282d;
110
- outline: 0 none; }
111
- .settings_page_wp-shortpixel-settings article.sp-tabs section:nth-child(2) h2 {
112
- left: 192px; }
113
- .settings_page_wp-shortpixel-settings article.sp-tabs section:nth-child(3) h2 {
114
- left: 374px; }
115
- .settings_page_wp-shortpixel-settings article.sp-tabs section:nth-child(4) h2 {
116
- left: 556px; }
117
- .settings_page_wp-shortpixel-settings article.sp-tabs section:nth-child(5) h2 {
118
- left: 738px; }
119
- .settings_page_wp-shortpixel-settings article.sp-tabs section:nth-child(6) h2 {
120
- left: 920px; }
121
- .settings_page_wp-shortpixel-settings section#tab-debug .flex {
122
- display: flex; }
123
- .settings_page_wp-shortpixel-settings section#tab-debug .env .flex {
124
- flex-wrap: wrap;
125
- max-width: 450px; }
126
- .settings_page_wp-shortpixel-settings section#tab-debug .env .flex span {
127
- width: 45%;
128
- padding: 4px; }
129
- .settings_page_wp-shortpixel-settings .view-notice {
130
- box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
131
- border: 4px solid #fff;
132
- padding: 1px 12px; }
133
- .settings_page_wp-shortpixel-settings .view-notice p {
134
- margin: 1em 0 !important; }
135
- .settings_page_wp-shortpixel-settings .view-notice.warning {
136
- border-left-color: #ffb900; }
137
- .settings_page_wp-shortpixel-settings .view-notice-row {
138
- display: none; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
 
140
  .view-edit-media .debugInfo pre {
141
- font-size: 11px; }
 
142
  .view-edit-media .sp-column-stats {
143
- position: relative; }
144
- .view-edit-media .sp-column-stats .sp-column-actions {
145
- margin-right: 5px;
146
- margin-top: 16px; }
147
- .view-edit-media .sp-column-stats .edit-media-stats {
148
- border: 1px solid #ccc;
149
- padding: 16px; }
150
- .view-edit-media .sp-column-stats .edit-media-stats li {
151
- margin: 0;
152
- line-height: 20px; }
 
 
 
 
153
  .view-edit-media .main-actions {
154
  display: inline-block;
155
- width: 100%; }
156
- .view-edit-media .main-actions .button.button-smaller {
157
- padding: 6px 15px;
158
- height: auto;
159
- float: none; }
 
 
160
 
161
  body.debug-model-active {
162
- overflow: hidden; }
 
163
 
164
  .debugInfo .content.wrapper {
165
- display: none; }
166
- .debugInfo .content.wrapper li strong {
167
- margin-right: 15px; }
168
- .debugInfo .content.wrapper ul {
169
- margin: 25px 0; }
 
 
 
170
 
171
  .debug-modal {
172
  display: none;
@@ -182,45 +278,55 @@ body.debug-model-active {
182
  top: 10%;
183
  z-index: 10020;
184
  display: none;
185
- background: #ffffff; }
186
- .debug-modal.success {
187
- border: 4px solid green; }
188
- .debug-modal.error {
189
- border: 4px solid red; }
190
- .debug-modal.error h3 {
191
- background-color: #ff0000; }
192
- .debug-modal .content-area {
193
- background-color: #fff; }
194
- .debug-modal .modal_header {
195
- text-align: center;
196
- font-size: 16px;
197
- font-weight: 700;
198
- background-color: #f3f3f3;
199
- border-bottom: 1px solid #ccc;
200
- padding: 8px 5px;
201
- cursor: move; }
202
- .debug-modal .modal_header h3 {
203
- margin: 0;
204
- color: #444;
205
- font-weight: 400;
206
- padding: 0;
207
- text-align: center;
208
- text-shadow: none;
209
- font-size: 16px; }
210
- .debug-modal .modal_header .modal_close {
211
- position: absolute;
212
- right: 5px;
213
- top: 8px;
214
- width: 20px;
215
- height: 20px;
216
- cursor: pointer;
217
- color: #444; }
218
- .debug-modal .modal_header .modal_close:hover {
219
- cursor: pointer;
220
- color: #111; }
221
- .debug-modal .content, .debug-modal .modal_content {
222
- padding: 5px 15px 10px;
223
- overflow-y: auto; }
 
 
 
 
 
 
 
 
 
 
224
 
225
  .debugModal_overlay {
226
  background: #000;
@@ -232,4 +338,7 @@ body.debug-model-active {
232
  position: fixed;
233
  opacity: 0.7;
234
  z-index: 10000;
235
- display: none; }
 
 
 
1
  .short-pixel-bulk-page.bulk-restore-all ol li {
2
+ font-weight: 700;
3
+ }
4
  .short-pixel-bulk-page.bulk-restore-all section.select_folders {
5
+ margin: 20px 0;
6
+ }
7
+ .short-pixel-bulk-page.bulk-restore-all section.select_folders .input {
8
+ margin: 10px 0 10px 15px;
9
+ font-size: 16px;
10
+ display: block;
11
+ clear: both;
12
+ }
13
+ .short-pixel-bulk-page.bulk-restore-all section.select_folders .filecount {
14
+ font-size: 12px;
15
+ }
16
  .short-pixel-bulk-page.bulk-restore-all section.random_check .random_answer {
17
  font-size: 16px;
18
  font-weight: 700;
19
  padding: 8px;
20
  border: 1px solid #ccc;
21
+ display: inline-block;
22
+ }
23
  .short-pixel-bulk-page.bulk-restore-all section.random_check .inputs {
24
+ margin: 15px 0;
25
+ }
26
+ .short-pixel-bulk-page.bulk-restore-all section.random_check .inputs span {
27
+ margin-right: 8px;
28
+ }
29
  .short-pixel-bulk-page.bulk-restore-all .button {
30
  margin: 10px 0;
31
+ margin-right: 8px;
32
+ }
33
 
34
  .short-pixel-bulk-page .sp-hidden {
35
+ display: none;
36
+ }
37
 
38
  /* Specific styles for advanced settings tab */
39
  #shortpixel-settings-tabs #tab-adv-settings .addCustomFolder {
40
+ margin: 10px 0;
41
+ }
42
+ #shortpixel-settings-tabs #tab-adv-settings .addCustomFolder .add-folder-text {
43
+ margin-left: 5px;
44
+ }
45
+ #shortpixel-settings-tabs #tab-adv-settings .addCustomFolder input[type=text] {
46
+ width: 50em;
47
+ max-width: 70%;
48
+ }
49
+ #shortpixel-settings-tabs #tab-adv-settings .addCustomFolder input[name=saveAdv] {
50
+ margin-left: 8px;
51
+ }
52
  #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list {
53
  display: table;
54
+ border-collapse: separate;
55
+ }
56
+ #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list div.heading {
57
+ width: auto;
58
+ display: table-header-group;
59
+ padding: 12px 16px 12px 12px;
60
+ }
61
+ #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list div.heading span {
62
+ font-weight: 600;
63
+ font-size: 14px;
64
+ }
65
+ #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list div {
66
+ display: table-row;
67
+ }
68
+ #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list div > span {
69
+ display: table-cell;
70
+ padding: 5px 10px;
71
+ vertical-align: middle;
72
+ background-color: #eee;
73
+ }
74
+ #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list div > span.action {
75
+ background-color: unset;
76
+ }
77
+ #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list .refresh-folder {
78
+ text-decoration: none;
79
+ }
80
+ #shortpixel-settings-tabs #tab-adv-settings .shortpixel-folders-list .info-icon {
81
+ cursor: pointer;
82
+ }
83
 
84
  .cf_switch label {
85
  width: 100%;
86
  margin: 0 -2px;
87
  background-color: #e2faff;
88
+ display: inline-block;
89
+ }
90
+ .cf_switch label span {
91
+ padding: 8px 0px 8px 15px;
92
+ display: block;
93
+ font-size: 13px;
94
+ }
95
+ .cf_switch label input {
96
+ display: none;
97
+ }
98
+ .cf_switch label input:checked + span {
99
+ background-color: #0085ba;
100
+ color: #F7F7F7;
101
+ }
102
 
103
  .settings_page_wp-shortpixel-settings {
104
+ /* In-view notice ( not on top, between the options ) - styled after WP notice */
105
+ }
106
+ .settings_page_wp-shortpixel-settings .top-menu {
107
+ font-size: 18px;
108
+ }
109
+ .settings_page_wp-shortpixel-settings .top-menu a {
110
+ font-size: 18px;
111
+ }
112
+ .settings_page_wp-shortpixel-settings .wp-shortpixel-tab-content {
113
+ transition: all 1000ms linear;
114
+ }
115
+ .settings_page_wp-shortpixel-settings .red {
116
+ color: #ff0000;
117
+ }
118
+ .settings_page_wp-shortpixel-settings article.sp-tabs section .wp-shortpixel-tab-content {
119
+ opacity: 0;
120
+ }
121
+ .settings_page_wp-shortpixel-settings article.sp-tabs section.sel-tab .wp-shortpixel-tab-content {
122
+ opacity: 1;
123
+ }
124
+ .settings_page_wp-shortpixel-settings article.sp-tabs section h2 {
125
+ position: absolute;
126
+ font-size: 1.3em;
127
+ font-weight: normal;
128
+ width: 180px;
129
+ height: 1.8em;
130
+ top: -1.8em;
131
+ left: 10px;
132
+ padding: 0;
133
+ margin: 0;
134
+ color: #999;
135
+ background-color: #ddd;
136
+ /* border-radius: 5px 5px 0 0; */
137
+ }
138
+ .settings_page_wp-shortpixel-settings article.sp-tabs section h2 a {
139
+ display: block;
140
+ width: 100%;
141
+ line-height: 1.8em;
142
+ text-align: center;
143
+ text-decoration: none;
144
+ color: #23282d;
145
+ outline: 0 none;
146
+ }
147
+ .settings_page_wp-shortpixel-settings article.sp-tabs section:nth-child(2) h2 {
148
+ left: 192px;
149
+ }
150
+ .settings_page_wp-shortpixel-settings article.sp-tabs section:nth-child(3) h2 {
151
+ left: 374px;
152
+ }
153
+ .settings_page_wp-shortpixel-settings article.sp-tabs section:nth-child(4) h2 {
154
+ left: 556px;
155
+ }
156
+ .settings_page_wp-shortpixel-settings article.sp-tabs section:nth-child(5) h2 {
157
+ left: 738px;
158
+ }
159
+ .settings_page_wp-shortpixel-settings article.sp-tabs section:nth-child(6) h2 {
160
+ left: 920px;
161
+ }
162
+ .settings_page_wp-shortpixel-settings section#tab-debug .flex {
163
+ display: flex;
164
+ }
165
+ .settings_page_wp-shortpixel-settings section#tab-debug .env .flex {
166
+ flex-wrap: wrap;
167
+ max-width: 450px;
168
+ }
169
+ .settings_page_wp-shortpixel-settings section#tab-debug .env .flex span {
170
+ width: 45%;
171
+ padding: 4px;
172
+ }
173
+ .settings_page_wp-shortpixel-settings .view-notice {
174
+ box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
175
+ border: 4px solid #fff;
176
+ padding: 1px 12px;
177
+ }
178
+ .settings_page_wp-shortpixel-settings .view-notice p {
179
+ margin: 1em 0 !important;
180
+ }
181
+ .settings_page_wp-shortpixel-settings .view-notice.warning {
182
+ border-left-color: #ffb900;
183
+ }
184
+ .settings_page_wp-shortpixel-settings .view-notice-row {
185
+ display: none;
186
+ }
187
+
188
+ section.banner {
189
+ width: 100%;
190
+ background-color: #dcfdff;
191
+ display: flex;
192
+ align-items: center;
193
+ border: 1px solid #ccc;
194
+ margin-top: 35px;
195
+ margin-bottom: 45px;
196
+ z-index: 12;
197
+ position: relative;
198
+ opacity: 0;
199
+ }
200
+ section.banner span {
201
+ text-align: center;
202
+ }
203
+ section.banner .image {
204
+ flex: 1;
205
+ }
206
+ section.banner .line {
207
+ flex: 3;
208
+ }
209
+ section.banner .line h3 {
210
+ color: #00d0e5;
211
+ }
212
+ section.banner .button-wrap {
213
+ flex: 2;
214
+ }
215
+ section.banner .button-wrap .button {
216
+ background: #ff0000;
217
+ padding: 8px;
218
+ font-weight: 700;
219
+ font-size: 20px;
220
+ margin: 8px;
221
+ color: #fff;
222
+ text-transform: uppercase;
223
+ }
224
 
225
  .view-edit-media .debugInfo pre {
226
+ font-size: 11px;
227
+ }
228
  .view-edit-media .sp-column-stats {
229
+ position: relative;
230
+ }
231
+ .view-edit-media .sp-column-stats .sp-column-actions {
232
+ margin-right: 5px;
233
+ margin-top: 16px;
234
+ }
235
+ .view-edit-media .sp-column-stats .edit-media-stats {
236
+ border: 1px solid #ccc;
237
+ padding: 16px;
238
+ }
239
+ .view-edit-media .sp-column-stats .edit-media-stats li {
240
+ margin: 0;
241
+ line-height: 20px;
242
+ }
243
  .view-edit-media .main-actions {
244
  display: inline-block;
245
+ width: 100%;
246
+ }
247
+ .view-edit-media .main-actions .button.button-smaller {
248
+ padding: 6px 15px;
249
+ height: auto;
250
+ float: none;
251
+ }
252
 
253
  body.debug-model-active {
254
+ overflow: hidden;
255
+ }
256
 
257
  .debugInfo .content.wrapper {
258
+ display: none;
259
+ }
260
+ .debugInfo .content.wrapper li strong {
261
+ margin-right: 15px;
262
+ }
263
+ .debugInfo .content.wrapper ul {
264
+ margin: 25px 0;
265
+ }
266
 
267
  .debug-modal {
268
  display: none;
278
  top: 10%;
279
  z-index: 10020;
280
  display: none;
281
+ background: #ffffff;
282
+ }
283
+ .debug-modal.success {
284
+ border: 4px solid green;
285
+ }
286
+ .debug-modal.error {
287
+ border: 4px solid red;
288
+ }
289
+ .debug-modal.error h3 {
290
+ background-color: #ff0000;
291
+ }
292
+ .debug-modal .content-area {
293
+ background-color: #fff;
294
+ }
295
+ .debug-modal .modal_header {
296
+ text-align: center;
297
+ font-size: 16px;
298
+ font-weight: 700;
299
+ background-color: #f3f3f3;
300
+ border-bottom: 1px solid #ccc;
301
+ padding: 8px 5px;
302
+ cursor: move;
303
+ }
304
+ .debug-modal .modal_header h3 {
305
+ margin: 0;
306
+ color: #444;
307
+ font-weight: 400;
308
+ padding: 0;
309
+ text-align: center;
310
+ text-shadow: none;
311
+ font-size: 16px;
312
+ }
313
+ .debug-modal .modal_header .modal_close {
314
+ position: absolute;
315
+ right: 5px;
316
+ top: 8px;
317
+ width: 20px;
318
+ height: 20px;
319
+ cursor: pointer;
320
+ color: #444;
321
+ }
322
+ .debug-modal .modal_header .modal_close:hover {
323
+ cursor: pointer;
324
+ color: #111;
325
+ }
326
+ .debug-modal .content, .debug-modal .modal_content {
327
+ padding: 5px 15px 10px;
328
+ overflow-y: auto;
329
+ }
330
 
331
  .debugModal_overlay {
332
  background: #000;
338
  position: fixed;
339
  opacity: 0.7;
340
  z-index: 10000;
341
+ display: none;
342
+ }
343
+
344
+ /*# sourceMappingURL=shortpixel-admin.css.map */
res/js/shortpixel.js CHANGED
@@ -278,8 +278,8 @@ var ShortPixel = function() {
278
  jQuery("section").removeClass("sel-tab");
279
  jQuery('section .wp-shortpixel-tab-content').fadeOut(50);
280
  jQuery(section).addClass("sel-tab");
281
- ShortPixel.adjustSettingsTabs();
282
- jQuery(section).find('.wp-shortpixel-tab-content').fadeIn(50);
283
  }
284
  if(typeof HS !== 'undefined' && typeof HS.beacon.suggest !== 'undefined' ){
285
  switch(tab){
@@ -302,10 +302,13 @@ var ShortPixel = function() {
302
 
303
  // Fixes the height of the current active tab.
304
  function adjustSettingsTabsHeight(){
305
- var sectionHeight = jQuery('section.sel-tab').height() + 90;
306
- //sectionHeight = Math.max(sectionHeight, jQuery('section#tab-adv-settings .wp-shortpixel-options').height() + 20);
 
307
  // sectionHeight = Math.max(sectionHeight, jQuery('section#tab-resources .area1').height() + 60);
308
- jQuery('.section-wrapper').css('height', sectionHeight);
 
 
309
  //jQuery('#shortpixel-settings-tabs section').css('height', sectionHeight);
310
  }
311
 
278
  jQuery("section").removeClass("sel-tab");
279
  jQuery('section .wp-shortpixel-tab-content').fadeOut(50);
280
  jQuery(section).addClass("sel-tab");
281
+
282
+ jQuery(section).find('.wp-shortpixel-tab-content').fadeIn(50, ShortPixel.adjustSettingsTabs);
283
  }
284
  if(typeof HS !== 'undefined' && typeof HS.beacon.suggest !== 'undefined' ){
285
  switch(tab){
302
 
303
  // Fixes the height of the current active tab.
304
  function adjustSettingsTabsHeight(){
305
+ //var sectionHeight = jQuery('section.sel-tab').height() + 90;
306
+
307
+ //sectionHeight = Math.max(sectionHeight, jQuery('section#tab-adv-settings .wp-shortpixel-options').height() + 20);
308
  // sectionHeight = Math.max(sectionHeight, jQuery('section#tab-resources .area1').height() + 60);
309
+ // jQuery('.section-wrapper').css('height', sectionHeight);
310
+
311
+ jQuery('.wso.banner').css('opacity', 1);
312
  //jQuery('#shortpixel-settings-tabs section').css('height', sectionHeight);
313
  }
314
 
res/js/shortpixel.min.js CHANGED
@@ -1 +1 @@
1
- function showToolBarAlert(e,t,r){var i=jQuery("li.shortpixel-toolbar-processing");switch(e){case ShortPixel.STATUS_QUOTA_EXCEEDED:if(window.location.href.search("wp-short-pixel-bulk")>0&&0==jQuery(".sp-quota-exceeded-alert").length)return;i.addClass("shortpixel-alert"),i.addClass("shortpixel-quota-exceeded"),jQuery("a",i).attr("href","options-general.php?page=wp-shortpixel-settings"),jQuery("a div",i).attr("title","ShortPixel quota exceeded. Click for details.");break;case ShortPixel.STATUS_SKIP:case ShortPixel.STATUS_FAIL:i.addClass("shortpixel-alert shortpixel-processing"),jQuery("a div",i).attr("title",t),void 0!==r&&jQuery("a",i).attr("href","post.php?post="+r+"&action=edit");break;case ShortPixel.STATUS_NO_KEY:i.addClass("shortpixel-alert"),i.addClass("shortpixel-quota-exceeded"),jQuery("a",i).attr("href","options-general.php?page=wp-shortpixel-settings"),jQuery("a div",i).attr("title","Get API Key");break;case ShortPixel.STATUS_SUCCESS:case ShortPixel.STATUS_RETRY:i.addClass("shortpixel-processing"),i.removeClass("shortpixel-alert"),jQuery("a",i).removeAttr("target"),jQuery("a",i).attr("href",jQuery("a img",i).attr("success-url"))}i.removeClass("shortpixel-hide")}function hideToolBarAlert(e){var t=jQuery("li.shortpixel-toolbar-processing.shortpixel-processing");ShortPixel.STATUS_EMPTY_QUEUE==e&&(t.hasClass("shortpixel-alert")||t.hasClass("shortpixel-quota-exceeded"))||t.addClass("shortpixel-hide")}function hideQuotaExceededToolBarAlert(){jQuery("li.shortpixel-toolbar-processing.shortpixel-quota-exceeded").addClass("shortpixel-hide")}function checkQuotaExceededAlert(){"undefined"!=typeof shortPixelQuotaExceeded&&(1==shortPixelQuotaExceeded?showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED):hideQuotaExceededToolBarAlert())}function checkBulkProgress(){var e=function(e){return t?"/":(t=!0,e)},t=!1,r=window.location.href.toLowerCase().replace(/\/\//g,e);t=!1;var i=ShortPixel.WP_ADMIN_URL.toLowerCase().replace(/\/\//g,e);if(r.search(i)<0&&(r=ShortPixel.convertPunycode(r),i=ShortPixel.convertPunycode(i)),1==ShortPixel.bulkProcessor&&window.location.href.search("wp-short-pixel-bulk")<0&&void 0!==localStorage.bulkPage&&localStorage.bulkPage>0&&(ShortPixel.bulkProcessor=!1),window.location.href.search("wp-short-pixel-bulk")>=0&&(ShortPixel.bulkProcessor=!0,localStorage.bulkTime=Date.now(),localStorage.bulkPage=1,ShortPixel.BULK_SECRET=!1),!1!==ShortPixel.BULK_SECRET&&ShortPixel.BULK_SECRET!=localStorage.bulkSecret)return clearBulkProcessor(),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-processing"),void jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-hide");1==ShortPixel.bulkProcessor||void 0===localStorage.bulkTime||Date.now()-localStorage.bulkTime>1e4?(ShortPixel.bulkProcessor=!0,localStorage.bulkPage=window.location.href.search("wp-short-pixel-bulk")>=0?1:0,localStorage.bulkTime=Date.now(),null==localStorage.getItem("bulkSecret")&&(localStorage.bulkSecret=Math.random().toString(36).substring(7)),checkBulkProcessingCallApi()):setBulkTimer(2e4)}function setBulkTimer(e){window.clearTimeout(bulkTimer),e>0&&(bulkTimer=window.setTimeout(checkBulkProgress,e))}function checkBulkProcessingCallApi(){var e={action:"shortpixel_image_processing","bulk-secret":localStorage.bulkSecret};jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:e,success:function(e){if(e.length>0){t=null;try{var t=JSON.parse(e)}catch(e){return void ShortPixel.retry(e.message)}ShortPixel.retries=0;var r=t.ImageID,i=jQuery("div.short-pixel-bulk-page").length>0;switch(t.Status&&t.Status!=ShortPixel.STATUS_SEARCHING&&(ShortPixel.returnedStatusSearching>=2&&jQuery(".bulk-notice-msg.bulk-searching").hide(),ShortPixel.returnedStatusSearching=0),t.Status){case ShortPixel.STATUS_NO_KEY:setCellMessage(r,t.Message,'<a class=\'button button-smaller button-primary\' href="https://shortpixel.com/wp-apikey" target="_blank">'+_spTr.getApiKey+"</a>"),showToolBarAlert(ShortPixel.STATUS_NO_KEY);break;case ShortPixel.STATUS_QUOTA_EXCEEDED:setCellMessage(r,t.Message,'<a class=\'button button-smaller button-primary\' href="https://shortpixel.com/login/" target="_blank">'+_spTr.extendQuota+"</a><a class='button button-smaller' href='javascript:ShortPixel.checkQuota()'>"+_spTr.check__Quota+"</a>"),showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED),0==t.Stop&&setBulkTimer(5e3),ShortPixel.otherMediaUpdateActions(r,["quota","view"]);break;case ShortPixel.STATUS_FAIL:setCellMessage(r,t.Message,"<a class='button button-smaller button-primary' href=\"javascript:manualOptimization('"+r+"', true)\">"+_spTr.retry+"</a>"),showToolBarAlert(ShortPixel.STATUS_FAIL,t.Message,r),i&&(ShortPixel.bulkShowError(r,t.Message,t.Filename,t.CustomImageLink),t.BulkPercent&&progressUpdate(t.BulkPercent,t.BulkMsg),ShortPixel.otherMediaUpdateActions(r,["retry","view"])),console.log(t.Message),setBulkTimer(5e3);break;case ShortPixel.STATUS_EMPTY_QUEUE:console.log(t.Message),clearBulkProcessor(),hideToolBarAlert(t.Status);var s=jQuery("#bulk-progress");i&&s.length&&"2"!=t.BulkStatus&&(progressUpdate(100,"Bulk finished!"),jQuery("a.bulk-cancel").attr("disabled","disabled"),hideSlider(),setTimeout(function(){window.location.reload()},3e3));break;case ShortPixel.STATUS_SUCCESS:i&&(ShortPixel.bulkHideLengthyMsg(),ShortPixel.bulkHideMaintenanceMsg());var o=t.PercentImprovement;showToolBarAlert(ShortPixel.STATUS_SUCCESS,"");var a=ShortPixel.isCustomImageId(r)?"":ShortPixel.successActions(r,t.Type,t.ThumbsCount,t.ThumbsTotal,t.BackupEnabled,t.Filename);if(setCellMessage(r,ShortPixel.successMsg(r,o,t.Type,t.ThumbsCount,t.RetinasCount),a),jQuery("#post-"+r).length>0&&jQuery("#post-"+r).find(".filename").text(t.Filename),jQuery(".misc-pub-filename strong").length>0&&jQuery(".misc-pub-filename strong").text(t.Filename),ShortPixel.isCustomImageId(r)&&t.TsOptimized&&t.TsOptimized.length>0){n=jQuery(".list-overview .item-"+r);jQuery(n).children(".date").text(t.TsOptimized),jQuery(n).find(".row-actions .action-optimize").remove()}var l=jQuery(["restore","view","redolossy","redoglossy","redolossless"]).not(["redo"+t.Type]).get();ShortPixel.otherMediaUpdateActions(r,l);new PercentageAnimator("#sp-msg-"+r+" span.percent",o).animate(o),i&&void 0!==t.Thumb&&(t.BulkPercent&&progressUpdate(t.BulkPercent,t.BulkMsg),t.Thumb.length>0&&(sliderUpdate(r,t.Thumb,t.BkThumb,t.PercentImprovement,t.Filename),void 0!==t.AverageCompression&&0+t.AverageCompression>0&&(jQuery("#sp-avg-optimization").html('<input type="text" class="dial" value="'+Math.round(t.AverageCompression)+'"/>'),ShortPixel.percentDial("#sp-avg-optimization .dial",60)))),console.log("Server response: "+e),i&&void 0!==t.BulkPercent&&progressUpdate(t.BulkPercent,t.BulkMsg),setBulkTimer(5e3);break;case ShortPixel.STATUS_SKIP:1!==t.Silent&&ShortPixel.bulkShowError(r,t.Message,t.Filename,t.CustomImageLink);case ShortPixel.STATUS_ERROR:void 0!==t.Message&&(showToolBarAlert(ShortPixel.STATUS_SKIP,t.Message+" Image ID: "+r),setCellMessage(r,t.Message,"")),ShortPixel.otherMediaUpdateActions(r,["retry","view"]);case ShortPixel.STATUS_RETRY:console.log("Server response: "+e),showToolBarAlert(ShortPixel.STATUS_RETRY,""),i&&void 0!==t.BulkPercent&&progressUpdate(t.BulkPercent,t.BulkMsg),i&&t.Count>3&&ShortPixel.bulkShowLengthyMsg(r,t.Filename,t.CustomImageLink),setBulkTimer(5e3);break;case ShortPixel.STATUS_SEARCHING:console.log("Server response: "+e),ShortPixel.returnedStatusSearching++,ShortPixel.returnedStatusSearching>=2&&jQuery(".bulk-notice-msg.bulk-searching").show(),setBulkTimer(2500);break;case ShortPixel.STATUS_MAINTENANCE:ShortPixel.bulkShowMaintenanceMsg("maintenance"),setBulkTimer(6e4);break;case ShortPixel.STATUS_QUEUE_FULL:ShortPixel.bulkShowMaintenanceMsg("queue-full"),setBulkTimer(6e4);break;default:ShortPixel.retry("Unknown status "+t.Status+". Retrying...")}if(void 0!==r&&ShortPixel.isCustomImageId(r)){var n=jQuery(".list-overview .item-"+r);jQuery(n).find(".row-actions .action-optimize").remove(),t.actions&&jQuery(n).children(".actions").html(t.actions)}}},error:function(e){ShortPixel.retry(e.statusText)}})}function clearBulkProcessor(){ShortPixel.bulkProcessor=!1,localStorage.bulkTime=Date.now(),setBulkTimer(0),window.location.href.search("wp-short-pixel-bulk")>=0&&(localStorage.bulkPage=0)}function setCellMessage(e,t,r){var i=jQuery("#sp-msg-"+e);i.length>0&&(i.html("<div class='sp-column-actions'>"+r+"</div><div class='sp-column-info'>"+t+"</div>"),i.css("color","")),(i=jQuery("#sp-cust-msg-"+e)).length>0&&i.html("<div class='sp-column-info'>"+t+"</div>")}function manualOptimization(e,t){setCellMessage(e,"<img src='"+ShortPixel.WP_PLUGIN_URL+"/res/img/loading.gif' alt='"+_spTr.loading+"' class='sp-loading-small'>Image waiting to be processed",""),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide"),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-alert"),jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");var r={action:"shortpixel_manual_optimization",image_id:e,cleanup:t};jQuery.ajax({type:"GET",url:ShortPixel.AJAX_URL,data:r,success:function(t){var r=JSON.parse(t);r.Status==ShortPixel.STATUS_SUCCESS?(setBulkTimer(2e3),ShortPixel.BULK_SECRET=!1):setCellMessage(e,void 0!==r.Message?r.Message:_spTr.thisContentNotProcessable,"")},error:function(t){r.action="shortpixel_check_status",jQuery.ajax({type:"GET",url:ShortPixel.AJAX_URL,data:r,success:function(t){var r=JSON.parse(t);r.Status!==ShortPixel.STATUS_SUCCESS&&setCellMessage(e,void 0!==r.Message?r.Message:_spTr.thisContentNotProcessable,"")}})}})}function reoptimize(e,t){setCellMessage(e,"<img src='"+ShortPixel.WP_PLUGIN_URL+"/res/img/loading.gif' alt='"+_spTr.loading+"' class='sp-loading-small'>Image waiting to be reprocessed",""),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide"),jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");var r={action:"shortpixel_redo",attachment_ID:e,type:t};jQuery.get(ShortPixel.AJAX_URL,r,function(t){(r=JSON.parse(t)).Status==ShortPixel.STATUS_SUCCESS?(setBulkTimer(2e3),ShortPixel.BULK_SECRET=!1):($msg=void 0!==r.Message?r.Message:_spTr.thisContentNotProcessable,setCellMessage(e,$msg,""),showToolBarAlert(ShortPixel.STATUS_FAIL,$msg))})}function optimizeThumbs(e){setCellMessage(e,"<img src='"+ShortPixel.WP_PLUGIN_URL+"/res/img/loading.gif' alt='"+_spTr.loading+"' class='sp-loading-small'>"+_spTr.imageWaitOptThumbs,""),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide"),jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");var t={action:"shortpixel_optimize_thumbs",attachment_ID:e};jQuery.get(ShortPixel.AJAX_URL,t,function(r){(t=JSON.parse(r)).Status==ShortPixel.STATUS_SUCCESS?(setBulkTimer(2e3),ShortPixel.BULK_SECRET=!1):setCellMessage(e,void 0!==t.Message?t.Message:_spTr.thisContentNotProcessable,"")})}function dismissShortPixelNotice(e){jQuery("#short-pixel-notice-"+e).hide();var t={action:"shortpixel_dismiss_notice",notice_id:e};jQuery.get(ShortPixel.AJAX_URL,t,function(e){(t=JSON.parse(e)).Status==ShortPixel.STATUS_SUCCESS&&console.log("dismissed")})}function dismissFileError(){jQuery(".shortpixel-alert").hide();var e={action:"shortpixel_dismissFileError"};jQuery.get(ShortPixel.AJAX_URL,e,function(t){(e=JSON.parse(t)).Status==ShortPixel.STATUS_SUCCESS&&console.log("dismissed")})}function PercentageAnimator(e,t){this.animationSpeed=10,this.increment=2,this.curPercentage=0,this.targetPercentage=t,this.outputSelector=e,this.animate=function(e){this.targetPercentage=e,setTimeout(PercentageTimer.bind(null,this),this.animationSpeed)}}function PercentageTimer(e){e.curPercentage-e.targetPercentage<-e.increment?e.curPercentage+=e.increment:e.curPercentage-e.targetPercentage>e.increment?e.curPercentage-=e.increment:e.curPercentage=e.targetPercentage,jQuery(e.outputSelector).text(e.curPercentage+"%"),e.curPercentage!=e.targetPercentage&&setTimeout(PercentageTimer.bind(null,e),e.animationSpeed)}function progressUpdate(e,t){var r=jQuery("#bulk-progress");r.length&&(jQuery(".progress-left",r).css("width",e+"%"),jQuery(".progress-img",r).css("left",e+"%"),e>24?(jQuery(".progress-img span",r).html(""),jQuery(".progress-left",r).html(e+"%")):(jQuery(".progress-img span",r).html(e+"%"),jQuery(".progress-left",r).html("")),jQuery(".bulk-estimate").html(t))}function sliderUpdate(e,t,r,i,s){var o=jQuery(".bulk-slider div.bulk-slide:first-child");if(0!==o.length){"empty-slide"!=o.attr("id")&&o.hide(),o.css("z-index",1e3),jQuery(".bulk-img-opt",o).attr("src",""),void 0===r&&(r=""),r.length>0&&jQuery(".bulk-img-orig",o).attr("src","");var a=o.clone();a.attr("id","slide-"+e),jQuery(".bulk-img-opt",a).attr("src",t),r.length>0?(jQuery(".img-original",a).css("display","inline-block"),jQuery(".bulk-img-orig",a).attr("src",r)):jQuery(".img-original",a).css("display","none"),jQuery(".bulk-opt-percent",a).html('<input type="text" class="dial" value="'+i+'"/>'),jQuery(".bulk-slider").append(a),ShortPixel.percentDial("#"+a.attr("id")+" .dial",100),jQuery(".bulk-slider-container span.filename").html("&nbsp;&nbsp;"+s),"empty-slide"==o.attr("id")?(o.remove(),jQuery(".bulk-slider-container").css("display","block")):o.animate({left:o.width()+o.position().left},"slow","swing",function(){o.remove(),a.fadeIn("slow")})}}function hideSlider(){jQuery(".bulk-slider-container").css("display","none")}function showStats(){jQuery(".bulk-stats").length}function SPstringFormat(){var e=Array.prototype.slice.call(arguments);if(0!==e.length){var t=e.shift();for(i=0;i<e.length;i++)t=t.replace(new RegExp("\\{"+i+"\\}","gm"),e[i]);return t}}jQuery(document).ready(function(){ShortPixel.init()});var bulkTimer,ShortPixel=function(){function e(e){jQuery(e).is(":checked")?(jQuery("#width,#height").removeAttr("disabled"),SpioResize.lastW=!1,jQuery(".resize-type-wrap").show(800,window.SpioResize.run)):(jQuery("#width,#height").attr("disabled","disabled"),window.SpioResize.hide(),jQuery(".resize-type-wrap").hide(800))}function t(){jQuery("#shortpixel-hs-button-blind").remove(),jQuery("#shortpixel-hs-tools").remove(),jQuery("#hs-beacon").remove(),jQuery("#botbutton").remove(),jQuery("#shortpixel-hs-blind").remove()}return jQuery("#key").keypress(function(e){13==e.which&&jQuery("#valid").val("validate")}),{init:function(){void 0===ShortPixel.API_IS_ACTIVE&&(jQuery("table.wp-list-table.media").length>0&&jQuery('select[name^="action"] option:last-child').before('<option value="short-pixel-bulk">'+_spTr.optimizeWithSP+'</option><option value="short-pixel-bulk-lossy"> → '+_spTr.redoLossy+'</option><option value="short-pixel-bulk-glossy"> → '+_spTr.redoGlossy+'</option><option value="short-pixel-bulk-lossless"> → '+_spTr.redoLossless+'</option><option value="short-pixel-bulk-restore"> → '+_spTr.restoreOriginal+"</option>"),ShortPixel.setOptions(ShortPixelConstants[0]),jQuery("#backup-folder-size").length&&jQuery("#backup-folder-size").html(ShortPixel.getBackupSize()),"todo"==ShortPixel.MEDIA_ALERT&&jQuery("div.media-frame.mode-grid").length>0&&jQuery("div.media-frame.mode-grid").before('<div id="short-pixel-media-alert" class="notice notice-warning"><p>'+SPstringFormat(_spTr.changeMLToListMode,'<a href="upload.php?mode=list" class="view-list"><span class="screen-reader-text">'," </span>",'</a><a class="alignright" href="javascript:ShortPixel.dismissMediaAlert();">',"</a>")+"</p></div>"),jQuery(window).on("beforeunload",function(){1==ShortPixel.bulkProcessor&&clearBulkProcessor()}),checkQuotaExceededAlert(),checkBulkProgress())},setOptions:function(e){for(var t in e)ShortPixel[t]=e[t]},isEmailValid:function(e){return/^\w+([\.+-]?\w+)*@\w+([\.-]?\w+)*(\.\w{1,63})+$/.test(e)},updateSignupEmail:function(){var e=jQuery("#pluginemail").val();ShortPixel.isEmailValid(e)&&jQuery("#request_key").removeClass("disabled"),jQuery("#request_key").attr("href",jQuery("#request_key").attr("href").split("?")[0]+"?pluginemail="+e)},validateKey:function(e){jQuery("#valid").val("validate"),jQuery(e).parents("form").submit()},enableResize:e,setupGeneralTab:function(){var t=0;void 0!==document.wp_shortpixel_options&&(t=document.wp_shortpixel_options.compressionType);for(var r=0,i=null;r<t.length;r++)t[r].onclick=function(){this!==i&&(i=this),void 0===ShortPixel.setupGeneralTabAlert&&(alert(_spTr.alertOnlyAppliesToNewImages),ShortPixel.setupGeneralTabAlert=1)};ShortPixel.enableResize("#resize"),jQuery("#resize").change(function(){e(this)}),jQuery(".resize-sizes").blur(function(e){var t=jQuery(e.target);if(ShortPixel.resizeSizesAlert!=t.val()){ShortPixel.resizeSizesAlert=t.val();var r=jQuery("#min-"+t.attr("name")).val(),i=jQuery("#min-"+t.attr("name")).data("nicename");t.val()<Math.min(r,1024)?(r>1024?alert(SPstringFormat(_spTr.pleaseDoNotSetLesser1024,i)):alert(SPstringFormat(_spTr.pleaseDoNotSetLesserSize,i,i,r)),e.preventDefault(),t.focus()):this.defaultValue=t.val()}}),jQuery(".shortpixel-confirm").click(function(e){return!!confirm(e.target.getAttribute("data-confirm"))||(e.preventDefault(),!1)}),jQuery('input[name="removeExif"], input[name="png2jpg"]').on("change",function(){ShortPixel.checkExifWarning()}),ShortPixel.checkExifWarning(),jQuery('input[name="backupImages"]').on("change",function(){ShortPixel.checkBackUpWarning()}),ShortPixel.checkBackUpWarning()},apiKeyChanged:function(){jQuery(".wp-shortpixel-options .shortpixel-key-valid").css("display","none"),jQuery(".wp-shortpixel-options button#validate").css("display","inline-block")},setupAdvancedTab:function(){jQuery("input.remove-folder-button").click(function(){var e=jQuery(this).data("value"),t=jQuery(this).data("name");1==confirm(SPstringFormat(_spTr.areYouSureStopOptimizing,t))&&(jQuery("#removeFolder").val(e),jQuery("#wp_shortpixel_options").submit())}),jQuery("input.recheck-folder-button").click(function(){var e=jQuery(this).data("value");1==confirm(SPstringFormat(_spTr.areYouSureStopOptimizing,e))&&(jQuery("#recheckFolder").val(e),jQuery("#wp_shortpixel_options").submit())})},checkThumbsUpdTotal:function(e){var t=jQuery("#"+(e.checked?"total":"main")+"ToProcess").val();jQuery("div.bulk-play span.total").text(t),jQuery("#displayTotal").text(t)},initSettings:function(){ShortPixel.adjustSettingsTabs(),ShortPixel.setupGeneralTab(),jQuery(window).resize(function(){ShortPixel.adjustSettingsTabs()}),jQuery("article.sp-tabs a.tab-link").click(function(e){var t=jQuery(e.target).data("id");ShortPixel.switchSettingsTab(t)}),jQuery("input[type=radio][name=deliverWebpType]").change(function(){"deliverWebpAltered"==this.value?window.confirm(_spTr.alertDeliverWebPAltered)?0==jQuery("input[type=radio][name=deliverWebpAlteringType]:checked").length&&jQuery("#deliverWebpAlteredWP").prop("checked",!0):jQuery(this).prop("checked",!1):"deliverWebpUnaltered"==this.value&&window.alert(_spTr.alertDeliverWebPUnaltered)})},switchSettingsTab:function(e){var t=e.replace("tab-",""),r="",i=jQuery("section#"+e);jQuery('input[name="display_part"]').val(t);var s=window.location.href.toString();if(s.indexOf("?")>0){var o=s.substring(0,s.indexOf("?"));o+="?"+jQuery.param({page:"wp-shortpixel-settings",part:t}),window.history.replaceState({},document.title,o)}if(i.length>0&&(jQuery("section").removeClass("sel-tab"),jQuery("section .wp-shortpixel-tab-content").fadeOut(50),jQuery(i).addClass("sel-tab"),ShortPixel.adjustSettingsTabs(),jQuery(i).find(".wp-shortpixel-tab-content").fadeIn(50)),"undefined"!=typeof HS&&void 0!==HS.beacon.suggest){switch(t){case"settings":r=shortpixel_suggestions_settings;break;case"adv-settings":r=shortpixel_suggestions_adv_settings;break;case"cloudflare":case"stats":r=shortpixel_suggestions_cloudflare}HS.beacon.suggest(r)}},adjustSettingsTabs:function(){var e=jQuery("section.sel-tab").height()+90;jQuery(".section-wrapper").css("height",e)},onBulkThumbsCheck:function(e){e.checked?(jQuery("#with-thumbs").css("display","inherit"),jQuery("#without-thumbs").css("display","none")):(jQuery("#without-thumbs").css("display","inherit"),jQuery("#with-thumbs").css("display","none"))},dismissMediaAlert:function(){var e={action:"shortpixel_dismiss_media_alert"};jQuery.get(ShortPixel.AJAX_URL,e,function(t){"success"==(e=JSON.parse(t)).Status&&jQuery("#short-pixel-media-alert").hide()})},closeHelpPane:t,dismissHelpPane:function(){t(),dismissShortPixelNotice("help")},checkQuota:function(){var e={action:"shortpixel_check_quota",nonce:ShortPixelActions.nonce_check_quota,return_json:!0};jQuery.post(ShortPixel.AJAX_URL,e,function(e){console.log("quota refreshed"),console.log(e),window.location.href=e.redirect})},percentDial:function(e,t){jQuery(e).knob({readOnly:!0,width:t,height:t,fgColor:"#1CAECB",format:function(e){return e+"%"}})},successMsg:function(e,t,r,i,s){return(t>0?"<div class='sp-column-info'>"+_spTr.reducedBy+" <strong><span class='percent'>"+t+"%</span></strong> ":"")+(t>0&&t<5?"<br>":"")+(t<5?_spTr.bonusProcessing:"")+(r.length>0?" ("+r+")":"")+(0+i>0?"<br>"+SPstringFormat(_spTr.plusXthumbsOpt,i):"")+(0+s>0?"<br>"+SPstringFormat(_spTr.plusXretinasOpt,s):"")+"</div>"},successActions:function(e,t,r,i,s,o){if(1==s){var a=jQuery(".sp-column-actions-template").clone();if(!a.length)return!1;var l;return l=0==t.length?["lossy","lossless"]:["lossy","glossy","lossless"].filter(function(e){return!(e==t)}),a.html(a.html().replace(/__SP_ID__/g,e)),"pdf"==o.substr(o.lastIndexOf(".")+1).toLowerCase()&&jQuery(".sp-action-compare",a).remove(),0==r&&i>0?a.html(a.html().replace("__SP_THUMBS_TOTAL__",i)):(jQuery(".sp-action-optimize-thumbs",a).remove(),jQuery(".sp-dropbtn",a).removeClass("button-primary")),a.html(a.html().replace(/__SP_FIRST_TYPE__/g,l[0])),a.html(a.html().replace(/__SP_SECOND_TYPE__/g,l[1])),a.html()}return""},otherMediaUpdateActions:function(e,t){if(e=e.substring(2),jQuery(".shortpixel-other-media").length){for(var r=["optimize","retry","restore","redo","quota","view"],i=0,s=r.length;i<s;i++)jQuery("#"+r[i]+"_"+e).css("display","none");for(var i=0,s=t.length;i<s;i++)jQuery("#"+t[i]+"_"+e).css("display","")}},retry:function(e){ShortPixel.retries++,isNaN(ShortPixel.retries)&&(ShortPixel.retries=1),ShortPixel.retries<6?(console.log("Invalid response from server (Error: "+e+"). Retrying pass "+(ShortPixel.retries+1)+"..."),setBulkTimer(5e3)):(ShortPixel.bulkShowError(-1,"Invalid response from server received 6 times. Please retry later by reloading this page, or <a href='https://shortpixel.com/contact' target='_blank'>contact support</a>. (Error: "+e+")",""),console.log("Invalid response from server 6 times. Giving up."))},initFolderSelector:function(){jQuery(".select-folder-button").click(function(){jQuery(".sp-folder-picker-shade").fadeIn(100),jQuery(".shortpixel-modal.modal-folder-picker").show();var e=jQuery(".sp-folder-picker");e.parent().css("margin-left",-e.width()/2),e.fileTree({script:ShortPixel.browseContent,multiFolder:!1})}),jQuery(".shortpixel-modal input.select-folder-cancel, .sp-folder-picker-shade").click(function(){jQuery(".sp-folder-picker-shade").fadeOut(100),jQuery(".shortpixel-modal.modal-folder-picker").hide()}),jQuery(".shortpixel-modal input.select-folder").click(function(e){if(t=jQuery("UL.jqueryFileTree LI.directory.selected"),0==jQuery(t).length)var t=jQuery("UL.jqueryFileTree LI.selected").parents(".directory");var r=jQuery(t).children("a").attr("rel");if(void 0!==r)if(r=r.trim()){var i=jQuery("#customFolderBase").val()+r;i=i.replace(/\/\//,"/"),console.debug("FullPath"+i),jQuery("#addCustomFolder").val(i),jQuery("#addCustomFolderView").val(i),jQuery(".sp-folder-picker-shade").fadeOut(100),jQuery(".shortpixel-modal.modal-folder-picker").css("display","none"),jQuery("#saveAdvAddFolder").removeClass("hidden")}else alert("Please select a folder from the list.")})},browseContent:function(e){e.action="shortpixel_browse_content";var t="";return jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:e,success:function(e){t=e},async:!1}),t},getBackupSize:function(){var e="";return jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_get_backup_size"},success:function(t){e=t},async:!1}),e},newApiKey:function(e){if(!jQuery("#tos").is(":checked"))return e.preventDefault(),jQuery("#tos-robo").fadeIn(400,function(){jQuery("#tos-hand").fadeIn()}),void jQuery("#tos").click(function(){jQuery("#tos-robo").css("display","none"),jQuery("#tos-hand").css("display","none")});if(jQuery("#request_key").addClass("disabled"),jQuery("#pluginemail_spinner").addClass("is-active"),ShortPixel.updateSignupEmail(),ShortPixel.isEmailValid(jQuery("#pluginemail").val())){jQuery("#pluginemail-error").css("display","none");var t={action:"shortpixel_new_api_key",email:jQuery("#pluginemail").val()};jQuery.ajax({type:"POST",async:!1,url:ShortPixel.AJAX_URL,data:t,success:function(t){data=JSON.parse(t),"success"==data.Status?(e.preventDefault(),window.location.reload()):"invalid"==data.Status&&(jQuery("#pluginemail-error").html("<b>"+data.Details+"</b>"),jQuery("#pluginemail-error").css("display",""),jQuery("#pluginemail-info").css("display","none"),e.preventDefault())}}),jQuery("#request_key").removeAttr("onclick")}else jQuery("#pluginemail-error").css("display",""),jQuery("#pluginemail-info").css("display","none"),e.preventDefault();jQuery("#request_key").removeClass("disabled"),jQuery("#pluginemail_spinner").removeClass("is-active")},proposeUpgrade:function(){jQuery("#shortPixelProposeUpgrade .sp-modal-body").addClass("sptw-modal-spinner"),jQuery("#shortPixelProposeUpgrade .sp-modal-body").html(""),jQuery("#shortPixelProposeUpgradeShade").css("display","block"),jQuery("#shortPixelProposeUpgrade").removeClass("shortpixel-hide"),jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_propose_upgrade"},success:function(e){jQuery("#shortPixelProposeUpgrade .sp-modal-body").removeClass("sptw-modal-spinner"),jQuery("#shortPixelProposeUpgrade .sp-modal-body").html(e)}})},closeProposeUpgrade:function(){jQuery("#shortPixelProposeUpgradeShade").css("display","none"),jQuery("#shortPixelProposeUpgrade").addClass("shortpixel-hide"),ShortPixel.toRefresh&&ShortPixel.checkQuota()},bulkShowLengthyMsg:function(e,t,r){var i=jQuery(".bulk-notice-msg.bulk-lengthy");if(0!=i.length){var s=jQuery("a",i);s.text(t),r?s.attr("href",r):s.attr("href",s.data("href").replace("__ID__",e)),i.css("display","block")}},bulkHideLengthyMsg:function(){jQuery(".bulk-notice-msg.bulk-lengthy").css("display","none")},bulkShowMaintenanceMsg:function(e){var t=jQuery(".bulk-notice-msg.bulk-"+e);0!=t.length&&t.css("display","block")},bulkHideMaintenanceMsg:function(e){jQuery(".bulk-notice-msg.bulk-"+e).css("display","none")},bulkShowError:function(e,t,r,i){var s=jQuery("#bulk-error-template");if(0!=s.length){var o=s.clone();o.attr("id","bulk-error-"+e),-1==e?(jQuery("span.sp-err-title",o).remove(),o.addClass("bulk-error-fatal")):(jQuery("img",o).remove(),jQuery("#bulk-error-".id).remove()),jQuery("span.sp-err-content",o).html(t);var a=jQuery("a.sp-post-link",o);i?a.attr("href",i):a.attr("href",a.attr("href").replace("__ID__",e)),a.text(r),s.after(o),o.css("display","block")}},confirmBulkAction:function(e,t){return!!confirm(_spTr["confirmBulk"+e])||(t.stopPropagation(),t.preventDefault(),!1)},checkRandomAnswer:function(e){var t=jQuery(e.target).val(),r=jQuery('input[name="random_answer"]').val(),i=jQuery('input[name="random_answer"]').data("target");t==r?(jQuery(i).removeClass("disabled").prop("disabled",!1),jQuery(i).removeAttr("aria-disabled")):jQuery(i).addClass("disabled").prop("disabled",!0)},removeBulkMsg:function(e){jQuery(e).parent().parent().remove()},isCustomImageId:function(e){return"C-"==e.substring(0,2)},openImageMenu:function(e){e.preventDefault(),this.menuCloseEvent||(jQuery(window).click(function(e){e.target.matches(".sp-dropbtn")||jQuery(".sp-dropdown.sp-show").removeClass("sp-show")}),this.menuCloseEvent=!0);var t=e.target.parentElement.classList.contains("sp-show");jQuery(".sp-dropdown.sp-show").removeClass("sp-show"),t||e.target.parentElement.classList.add("sp-show")},menuCloseEvent:!1,loadComparer:function(e){this.comparerData.origUrl=!1,!1===this.comparerData.cssLoaded&&(jQuery("<link>").appendTo("head").attr({type:"text/css",rel:"stylesheet",href:this.WP_PLUGIN_URL+"/res/css/twentytwenty.min.css"}),this.comparerData.cssLoaded=2),!1===this.comparerData.jsLoaded&&(jQuery.getScript(this.WP_PLUGIN_URL+"/res/js/jquery.twentytwenty.min.js",function(){ShortPixel.comparerData.jsLoaded=2,ShortPixel.comparerData.origUrl.length>0&&ShortPixel.displayComparerPopup(ShortPixel.comparerData.width,ShortPixel.comparerData.height,ShortPixel.comparerData.origUrl,ShortPixel.comparerData.optUrl)}),this.comparerData.jsLoaded=1),!1===this.comparerData.origUrl&&(jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_get_comparer_data",id:e},success:function(e){data=JSON.parse(e),jQuery.extend(ShortPixel.comparerData,data),2==ShortPixel.comparerData.jsLoaded&&ShortPixel.displayComparerPopup(ShortPixel.comparerData.width,ShortPixel.comparerData.height,ShortPixel.comparerData.origUrl,ShortPixel.comparerData.optUrl)}}),this.comparerData.origUrl="")},displayComparerPopup:function(e,t,r,i){var s=e,o=t<150||e<350,a=jQuery(o?"#spUploadCompareSideBySide":"#spUploadCompare"),l=jQuery(".sp-modal-shade");o||jQuery("#spCompareSlider").html('<img alt="'+_spTr.originalImage+'" class="spUploadCompareOriginal"/><img alt="'+_spTr.optimizedImage+'" class="spUploadCompareOptimized"/>'),e=Math.max(350,Math.min(800,e<350?2*(e+25):t<150?e+25:e)),t=Math.max(150,o?s>350?2*(t+45):t+45:t*e/s);var n="-"+Math.round(e/2);jQuery(".sp-modal-body",a).css("width",e),jQuery(".shortpixel-slider",a).css("width",e),a.css("width",e),a.css("marginLeft",n+"px"),jQuery(".sp-modal-body",a).css("height",t),a.show(),l.show(),o||jQuery("#spCompareSlider").twentytwenty({slider_move:"mousemove"}),jQuery(".sp-close-button").on("click",ShortPixel.closeComparerPopup),jQuery(document).on("keyup.sp_modal_active",ShortPixel.closeComparerPopup),jQuery(".sp-modal-shade").on("click",ShortPixel.closeComparerPopup);var u=jQuery(".spUploadCompareOptimized",a);jQuery(".spUploadCompareOriginal",a).attr("src",r),setTimeout(function(){jQuery(window).trigger("resize")},1e3),u.load(function(){jQuery(window).trigger("resize")}),u.attr("src",i)},closeComparerPopup:function(e){jQuery("#spUploadCompareSideBySide").hide(),jQuery("#spUploadCompare").hide(),jQuery(".sp-modal-shade").hide(),jQuery(document).unbind("keyup.sp_modal_active"),jQuery(".sp-modal-shade").off("click"),jQuery(".sp-close-button").off("click")},convertPunycode:function(e){var t=document.createElement("a");return t.href=e,e.indexOf(t.protocol+"//"+t.hostname)<0?t.href:e.replace(t.protocol+"//"+t.hostname,t.protocol+"//"+t.hostname.split(".").map(function(e){return sp_punycode.toASCII(e)}).join("."))},checkExifWarning:function(){!jQuery('input[name="removeExif"]').is(":checked")&&jQuery('input[name="png2jpg"]').is(":checked")?jQuery(".exif_warning").fadeIn():jQuery(".exif_warning").fadeOut(),!jQuery('input[name="removeExif"]').is(":checked")&&jQuery(".exif_imagick_warning").data("imagick")<=0?jQuery(".exif_imagick_warning").fadeIn():jQuery(".exif_imagick_warning").fadeOut()},checkBackUpWarning:function(){jQuery('input[name="backupImages"]').is(":checked")?jQuery(".backup_warning").fadeOut():jQuery(".backup_warning").fadeIn()},comparerData:{cssLoaded:!1,jsLoaded:!1,origUrl:!1,optUrl:!1,width:0,height:0},toRefresh:!1,resizeSizesAlert:!1,returnedStatusSearching:0,optInHelp:function(e,t){var r={action:"shortpixel_helpscoutOptin",toggle:e.currentTarget.toggleParam},i=jQuery(e.target);jQuery.post(ShortPixel.AJAX_URL,r,function(e){"success"==e.Status&&i.parents(".shortpixel.notice").fadeOut()})}}}();!function(e,t,r){t.SpioResize={image:{width:0,height:0},lag:2e3,step1:!1,step2:!1,step3:!1,sizeRule:null,initialized:!1,lastW:!1,lastH:!1,lastType:!1},SpioResize.hide=function(){e(".presentation-wrap").css("opacity",0)},SpioResize.animate=function(e,t,r,i,s){e.animate(t,1e3,"swing",function(){SpioResize.step3=setTimeout(function(){document.styleSheets[0].deleteRule(SpioResize.sizeRule),r.animate(i,1e3,"swing",function(){SpioResize.sizeRule=document.styleSheets[0].insertRule(s)})},600)})},SpioResize.run=function(){if(!SpioResize.initialized){var t=e(r);t.on("input change",'input[name="resizeWidth"], input[name="resizeHeight"]',function(e){clearTimeout(SpioResize.change),SpioResize.changeDone=!0,SpioResize.changeFired=!1,SpioResize.change=setTimeout(function(){SpioResize.changeFired=!0,SpioResize.run()},1500)}),t.on("blur",'input[name="resizeWidth"], input[name="resizeHeight"]',function(e){SpioResize.changeFired||(clearTimeout(SpioResize.change),SpioResize.change=setTimeout(function(){SpioResize.run()},1500))}),t.on("change",'input[name="resizeType"]',function(e){SpioResize.run()}),SpioResize.initialized=!0}var i=e("#width").val(),s=e("#height").val();if(i&&s){var o=e("#resize_type_outer").is(":checked")?"outer":"inner";if(i!==SpioResize.lastW||s!==SpioResize.lastH||o!==SpioResize.lastType){SpioResize.hide(),SpioResize.lastW=i,SpioResize.lastH=s,SpioResize.lastType=o;var a=Math.round(120*Math.sqrt(i/s)),l=Math.round(120*Math.sqrt(s/i)),n=a/l;a>280&&(a=280,l=Math.round(280/n)),l>150&&(l=150,a=Math.round(150*n));var u=e("img.spai-resize-img");u.css("width",""),u.css("height",""),u.css("margin","0px");var c=e("div.spai-resize-frame");c.css("display","none"),c.css("width",a+"px"),c.css("height",l+"px"),c.css("margin",Math.round((156-l)/2)+"px auto 0"),clearTimeout(SpioResize.step1),clearTimeout(SpioResize.step2),clearTimeout(SpioResize.step3),u.stop(),c.stop(),null!==SpioResize.sizeRule&&(document.styleSheets[0].deleteRule(SpioResize.sizeRule),SpioResize.sizeRule=null),SpioResize.sizeRule=document.styleSheets[0].insertRule('.spai-resize-frame:after { content: "'+i+" × "+s+'"; }'),c.addClass("spai-resize-frame"),e(".presentation-wrap").animate({opacity:1},500,"swing",function(){c.css("display","block"),SpioResize.step2=setTimeout(function(){if("outer"==o)if(15/8>n)var e={height:l+"px",margin:Math.round((160-l)/2)+"px 0px"},t=l*(15/8),r={width:Math.round(t)+"px"},p='.spai-resize-frame:after { content: "'+Math.round(t*i/a)+" × "+s+'"; }';else var e={width:a+"px",margin:Math.round((160-a/(15/8))/2)+"px 0px"},h=a/(15/8),r={height:Math.round(h)+"px",margin:Math.round((156-h)/2)+"px auto 0"},p='.spai-resize-frame:after { content: "'+i+" × "+Math.round(h*i/a)+'"; }';else if(15/8>n)var e={width:a,margin:Math.round((160-a/(15/8))/2)+"px 0px"},h=a/(15/8),r={height:Math.round(h)+"px",margin:Math.round((156-h)/2)+"px auto 0"},p='.spai-resize-frame:after { content: "'+i+" × "+Math.round(h*i/a)+'"; }';else var e={height:l,margin:Math.round((160-l)/2)+"px 0px"},t=l*(15/8),r={width:Math.round(t)+"px"},p='.spai-resize-frame:after { content: "'+Math.round(t*i/a)+" × "+s+'"; }';SpioResize.animate(u,e,c,r,p)},1e3)})}}},e(function(){e("#resize").is("checked")&&SpioResize.run()})}(jQuery,window,document);
1
+ function showToolBarAlert(e,t,r){var i=jQuery("li.shortpixel-toolbar-processing");switch(e){case ShortPixel.STATUS_QUOTA_EXCEEDED:if(window.location.href.search("wp-short-pixel-bulk")>0&&0==jQuery(".sp-quota-exceeded-alert").length)return;i.addClass("shortpixel-alert"),i.addClass("shortpixel-quota-exceeded"),jQuery("a",i).attr("href","options-general.php?page=wp-shortpixel-settings"),jQuery("a div",i).attr("title","ShortPixel quota exceeded. Click for details.");break;case ShortPixel.STATUS_SKIP:case ShortPixel.STATUS_FAIL:i.addClass("shortpixel-alert shortpixel-processing"),jQuery("a div",i).attr("title",t),void 0!==r&&jQuery("a",i).attr("href","post.php?post="+r+"&action=edit");break;case ShortPixel.STATUS_NO_KEY:i.addClass("shortpixel-alert"),i.addClass("shortpixel-quota-exceeded"),jQuery("a",i).attr("href","options-general.php?page=wp-shortpixel-settings"),jQuery("a div",i).attr("title","Get API Key");break;case ShortPixel.STATUS_SUCCESS:case ShortPixel.STATUS_RETRY:i.addClass("shortpixel-processing"),i.removeClass("shortpixel-alert"),jQuery("a",i).removeAttr("target"),jQuery("a",i).attr("href",jQuery("a img",i).attr("success-url"))}i.removeClass("shortpixel-hide")}function hideToolBarAlert(e){var t=jQuery("li.shortpixel-toolbar-processing.shortpixel-processing");ShortPixel.STATUS_EMPTY_QUEUE==e&&(t.hasClass("shortpixel-alert")||t.hasClass("shortpixel-quota-exceeded"))||t.addClass("shortpixel-hide")}function hideQuotaExceededToolBarAlert(){jQuery("li.shortpixel-toolbar-processing.shortpixel-quota-exceeded").addClass("shortpixel-hide")}function checkQuotaExceededAlert(){"undefined"!=typeof shortPixelQuotaExceeded&&(1==shortPixelQuotaExceeded?showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED):hideQuotaExceededToolBarAlert())}function checkBulkProgress(){var e=function(e){return t?"/":(t=!0,e)},t=!1,r=window.location.href.toLowerCase().replace(/\/\//g,e);t=!1;var i=ShortPixel.WP_ADMIN_URL.toLowerCase().replace(/\/\//g,e);if(r.search(i)<0&&(r=ShortPixel.convertPunycode(r),i=ShortPixel.convertPunycode(i)),1==ShortPixel.bulkProcessor&&window.location.href.search("wp-short-pixel-bulk")<0&&void 0!==localStorage.bulkPage&&localStorage.bulkPage>0&&(ShortPixel.bulkProcessor=!1),window.location.href.search("wp-short-pixel-bulk")>=0&&(ShortPixel.bulkProcessor=!0,localStorage.bulkTime=Date.now(),localStorage.bulkPage=1,ShortPixel.BULK_SECRET=!1),!1!==ShortPixel.BULK_SECRET&&ShortPixel.BULK_SECRET!=localStorage.bulkSecret)return clearBulkProcessor(),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-processing"),void jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-hide");1==ShortPixel.bulkProcessor||void 0===localStorage.bulkTime||Date.now()-localStorage.bulkTime>1e4?(ShortPixel.bulkProcessor=!0,localStorage.bulkPage=window.location.href.search("wp-short-pixel-bulk")>=0?1:0,localStorage.bulkTime=Date.now(),null==localStorage.getItem("bulkSecret")&&(localStorage.bulkSecret=Math.random().toString(36).substring(7)),checkBulkProcessingCallApi()):setBulkTimer(2e4)}function setBulkTimer(e){window.clearTimeout(bulkTimer),e>0&&(bulkTimer=window.setTimeout(checkBulkProgress,e))}function checkBulkProcessingCallApi(){var e={action:"shortpixel_image_processing","bulk-secret":localStorage.bulkSecret};jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:e,success:function(e){if(e.length>0){t=null;try{var t=JSON.parse(e)}catch(e){return void ShortPixel.retry(e.message)}ShortPixel.retries=0;var r=t.ImageID,i=jQuery("div.short-pixel-bulk-page").length>0;switch(t.Status&&t.Status!=ShortPixel.STATUS_SEARCHING&&(ShortPixel.returnedStatusSearching>=2&&jQuery(".bulk-notice-msg.bulk-searching").hide(),ShortPixel.returnedStatusSearching=0),t.Status){case ShortPixel.STATUS_NO_KEY:setCellMessage(r,t.Message,'<a class=\'button button-smaller button-primary\' href="https://shortpixel.com/wp-apikey" target="_blank">'+_spTr.getApiKey+"</a>"),showToolBarAlert(ShortPixel.STATUS_NO_KEY);break;case ShortPixel.STATUS_QUOTA_EXCEEDED:setCellMessage(r,t.Message,'<a class=\'button button-smaller button-primary\' href="https://shortpixel.com/login/" target="_blank">'+_spTr.extendQuota+"</a><a class='button button-smaller' href='javascript:ShortPixel.checkQuota()'>"+_spTr.check__Quota+"</a>"),showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED),0==t.Stop&&setBulkTimer(5e3),ShortPixel.otherMediaUpdateActions(r,["quota","view"]);break;case ShortPixel.STATUS_FAIL:setCellMessage(r,t.Message,"<a class='button button-smaller button-primary' href=\"javascript:manualOptimization('"+r+"', true)\">"+_spTr.retry+"</a>"),showToolBarAlert(ShortPixel.STATUS_FAIL,t.Message,r),i&&(ShortPixel.bulkShowError(r,t.Message,t.Filename,t.CustomImageLink),t.BulkPercent&&progressUpdate(t.BulkPercent,t.BulkMsg),ShortPixel.otherMediaUpdateActions(r,["retry","view"])),console.log(t.Message),setBulkTimer(5e3);break;case ShortPixel.STATUS_EMPTY_QUEUE:console.log(t.Message),clearBulkProcessor(),hideToolBarAlert(t.Status);var s=jQuery("#bulk-progress");i&&s.length&&"2"!=t.BulkStatus&&(progressUpdate(100,"Bulk finished!"),jQuery("a.bulk-cancel").attr("disabled","disabled"),hideSlider(),setTimeout(function(){window.location.reload()},3e3));break;case ShortPixel.STATUS_SUCCESS:i&&(ShortPixel.bulkHideLengthyMsg(),ShortPixel.bulkHideMaintenanceMsg());var o=t.PercentImprovement;showToolBarAlert(ShortPixel.STATUS_SUCCESS,"");var a=ShortPixel.isCustomImageId(r)?"":ShortPixel.successActions(r,t.Type,t.ThumbsCount,t.ThumbsTotal,t.BackupEnabled,t.Filename);if(setCellMessage(r,ShortPixel.successMsg(r,o,t.Type,t.ThumbsCount,t.RetinasCount),a),jQuery("#post-"+r).length>0&&jQuery("#post-"+r).find(".filename").text(t.Filename),jQuery(".misc-pub-filename strong").length>0&&jQuery(".misc-pub-filename strong").text(t.Filename),ShortPixel.isCustomImageId(r)&&t.TsOptimized&&t.TsOptimized.length>0){n=jQuery(".list-overview .item-"+r);jQuery(n).children(".date").text(t.TsOptimized),jQuery(n).find(".row-actions .action-optimize").remove()}var l=jQuery(["restore","view","redolossy","redoglossy","redolossless"]).not(["redo"+t.Type]).get();ShortPixel.otherMediaUpdateActions(r,l);new PercentageAnimator("#sp-msg-"+r+" span.percent",o).animate(o),i&&void 0!==t.Thumb&&(t.BulkPercent&&progressUpdate(t.BulkPercent,t.BulkMsg),t.Thumb.length>0&&(sliderUpdate(r,t.Thumb,t.BkThumb,t.PercentImprovement,t.Filename),void 0!==t.AverageCompression&&0+t.AverageCompression>0&&(jQuery("#sp-avg-optimization").html('<input type="text" class="dial" value="'+Math.round(t.AverageCompression)+'"/>'),ShortPixel.percentDial("#sp-avg-optimization .dial",60)))),console.log("Server response: "+e),i&&void 0!==t.BulkPercent&&progressUpdate(t.BulkPercent,t.BulkMsg),setBulkTimer(5e3);break;case ShortPixel.STATUS_SKIP:1!==t.Silent&&ShortPixel.bulkShowError(r,t.Message,t.Filename,t.CustomImageLink);case ShortPixel.STATUS_ERROR:void 0!==t.Message&&(showToolBarAlert(ShortPixel.STATUS_SKIP,t.Message+" Image ID: "+r),setCellMessage(r,t.Message,"")),ShortPixel.otherMediaUpdateActions(r,["retry","view"]);case ShortPixel.STATUS_RETRY:console.log("Server response: "+e),showToolBarAlert(ShortPixel.STATUS_RETRY,""),i&&void 0!==t.BulkPercent&&progressUpdate(t.BulkPercent,t.BulkMsg),i&&t.Count>3&&ShortPixel.bulkShowLengthyMsg(r,t.Filename,t.CustomImageLink),setBulkTimer(5e3);break;case ShortPixel.STATUS_SEARCHING:console.log("Server response: "+e),ShortPixel.returnedStatusSearching++,ShortPixel.returnedStatusSearching>=2&&jQuery(".bulk-notice-msg.bulk-searching").show(),setBulkTimer(2500);break;case ShortPixel.STATUS_MAINTENANCE:ShortPixel.bulkShowMaintenanceMsg("maintenance"),setBulkTimer(6e4);break;case ShortPixel.STATUS_QUEUE_FULL:ShortPixel.bulkShowMaintenanceMsg("queue-full"),setBulkTimer(6e4);break;default:ShortPixel.retry("Unknown status "+t.Status+". Retrying...")}if(void 0!==r&&ShortPixel.isCustomImageId(r)){var n=jQuery(".list-overview .item-"+r);jQuery(n).find(".row-actions .action-optimize").remove(),t.actions&&jQuery(n).children(".actions").html(t.actions)}}},error:function(e){ShortPixel.retry(e.statusText)}})}function clearBulkProcessor(){ShortPixel.bulkProcessor=!1,localStorage.bulkTime=Date.now(),setBulkTimer(0),window.location.href.search("wp-short-pixel-bulk")>=0&&(localStorage.bulkPage=0)}function setCellMessage(e,t,r){var i=jQuery("#sp-msg-"+e);i.length>0&&(i.html("<div class='sp-column-actions'>"+r+"</div><div class='sp-column-info'>"+t+"</div>"),i.css("color","")),(i=jQuery("#sp-cust-msg-"+e)).length>0&&i.html("<div class='sp-column-info'>"+t+"</div>")}function manualOptimization(e,t){setCellMessage(e,"<img src='"+ShortPixel.WP_PLUGIN_URL+"/res/img/loading.gif' alt='"+_spTr.loading+"' class='sp-loading-small'>Image waiting to be processed",""),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide"),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-alert"),jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");var r={action:"shortpixel_manual_optimization",image_id:e,cleanup:t};jQuery.ajax({type:"GET",url:ShortPixel.AJAX_URL,data:r,success:function(t){var r=JSON.parse(t);r.Status==ShortPixel.STATUS_SUCCESS?(setBulkTimer(2e3),ShortPixel.BULK_SECRET=!1):setCellMessage(e,void 0!==r.Message?r.Message:_spTr.thisContentNotProcessable,"")},error:function(t){r.action="shortpixel_check_status",jQuery.ajax({type:"GET",url:ShortPixel.AJAX_URL,data:r,success:function(t){var r=JSON.parse(t);r.Status!==ShortPixel.STATUS_SUCCESS&&setCellMessage(e,void 0!==r.Message?r.Message:_spTr.thisContentNotProcessable,"")}})}})}function reoptimize(e,t){setCellMessage(e,"<img src='"+ShortPixel.WP_PLUGIN_URL+"/res/img/loading.gif' alt='"+_spTr.loading+"' class='sp-loading-small'>Image waiting to be reprocessed",""),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide"),jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");var r={action:"shortpixel_redo",attachment_ID:e,type:t};jQuery.get(ShortPixel.AJAX_URL,r,function(t){(r=JSON.parse(t)).Status==ShortPixel.STATUS_SUCCESS?(setBulkTimer(2e3),ShortPixel.BULK_SECRET=!1):($msg=void 0!==r.Message?r.Message:_spTr.thisContentNotProcessable,setCellMessage(e,$msg,""),showToolBarAlert(ShortPixel.STATUS_FAIL,$msg))})}function optimizeThumbs(e){setCellMessage(e,"<img src='"+ShortPixel.WP_PLUGIN_URL+"/res/img/loading.gif' alt='"+_spTr.loading+"' class='sp-loading-small'>"+_spTr.imageWaitOptThumbs,""),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide"),jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");var t={action:"shortpixel_optimize_thumbs",attachment_ID:e};jQuery.get(ShortPixel.AJAX_URL,t,function(r){(t=JSON.parse(r)).Status==ShortPixel.STATUS_SUCCESS?(setBulkTimer(2e3),ShortPixel.BULK_SECRET=!1):setCellMessage(e,void 0!==t.Message?t.Message:_spTr.thisContentNotProcessable,"")})}function dismissShortPixelNotice(e){jQuery("#short-pixel-notice-"+e).hide();var t={action:"shortpixel_dismiss_notice",notice_id:e};jQuery.get(ShortPixel.AJAX_URL,t,function(e){(t=JSON.parse(e)).Status==ShortPixel.STATUS_SUCCESS&&console.log("dismissed")})}function dismissFileError(){jQuery(".shortpixel-alert").hide();var e={action:"shortpixel_dismissFileError"};jQuery.get(ShortPixel.AJAX_URL,e,function(t){(e=JSON.parse(t)).Status==ShortPixel.STATUS_SUCCESS&&console.log("dismissed")})}function PercentageAnimator(e,t){this.animationSpeed=10,this.increment=2,this.curPercentage=0,this.targetPercentage=t,this.outputSelector=e,this.animate=function(e){this.targetPercentage=e,setTimeout(PercentageTimer.bind(null,this),this.animationSpeed)}}function PercentageTimer(e){e.curPercentage-e.targetPercentage<-e.increment?e.curPercentage+=e.increment:e.curPercentage-e.targetPercentage>e.increment?e.curPercentage-=e.increment:e.curPercentage=e.targetPercentage,jQuery(e.outputSelector).text(e.curPercentage+"%"),e.curPercentage!=e.targetPercentage&&setTimeout(PercentageTimer.bind(null,e),e.animationSpeed)}function progressUpdate(e,t){var r=jQuery("#bulk-progress");r.length&&(jQuery(".progress-left",r).css("width",e+"%"),jQuery(".progress-img",r).css("left",e+"%"),e>24?(jQuery(".progress-img span",r).html(""),jQuery(".progress-left",r).html(e+"%")):(jQuery(".progress-img span",r).html(e+"%"),jQuery(".progress-left",r).html("")),jQuery(".bulk-estimate").html(t))}function sliderUpdate(e,t,r,i,s){var o=jQuery(".bulk-slider div.bulk-slide:first-child");if(0!==o.length){"empty-slide"!=o.attr("id")&&o.hide(),o.css("z-index",1e3),jQuery(".bulk-img-opt",o).attr("src",""),void 0===r&&(r=""),r.length>0&&jQuery(".bulk-img-orig",o).attr("src","");var a=o.clone();a.attr("id","slide-"+e),jQuery(".bulk-img-opt",a).attr("src",t),r.length>0?(jQuery(".img-original",a).css("display","inline-block"),jQuery(".bulk-img-orig",a).attr("src",r)):jQuery(".img-original",a).css("display","none"),jQuery(".bulk-opt-percent",a).html('<input type="text" class="dial" value="'+i+'"/>'),jQuery(".bulk-slider").append(a),ShortPixel.percentDial("#"+a.attr("id")+" .dial",100),jQuery(".bulk-slider-container span.filename").html("&nbsp;&nbsp;"+s),"empty-slide"==o.attr("id")?(o.remove(),jQuery(".bulk-slider-container").css("display","block")):o.animate({left:o.width()+o.position().left},"slow","swing",function(){o.remove(),a.fadeIn("slow")})}}function hideSlider(){jQuery(".bulk-slider-container").css("display","none")}function showStats(){jQuery(".bulk-stats").length}function SPstringFormat(){var e=Array.prototype.slice.call(arguments);if(0!==e.length){var t=e.shift();for(i=0;i<e.length;i++)t=t.replace(new RegExp("\\{"+i+"\\}","gm"),e[i]);return t}}jQuery(document).ready(function(){ShortPixel.init()});var bulkTimer,ShortPixel=function(){function e(e){jQuery(e).is(":checked")?(jQuery("#width,#height").removeAttr("disabled"),SpioResize.lastW=!1,jQuery(".resize-type-wrap").show(800,window.SpioResize.run)):(jQuery("#width,#height").attr("disabled","disabled"),window.SpioResize.hide(),jQuery(".resize-type-wrap").hide(800))}function t(){jQuery("#shortpixel-hs-button-blind").remove(),jQuery("#shortpixel-hs-tools").remove(),jQuery("#hs-beacon").remove(),jQuery("#botbutton").remove(),jQuery("#shortpixel-hs-blind").remove()}return jQuery("#key").keypress(function(e){13==e.which&&jQuery("#valid").val("validate")}),{init:function(){void 0===ShortPixel.API_IS_ACTIVE&&(jQuery("table.wp-list-table.media").length>0&&jQuery('select[name^="action"] option:last-child').before('<option value="short-pixel-bulk">'+_spTr.optimizeWithSP+'</option><option value="short-pixel-bulk-lossy"> → '+_spTr.redoLossy+'</option><option value="short-pixel-bulk-glossy"> → '+_spTr.redoGlossy+'</option><option value="short-pixel-bulk-lossless"> → '+_spTr.redoLossless+'</option><option value="short-pixel-bulk-restore"> → '+_spTr.restoreOriginal+"</option>"),ShortPixel.setOptions(ShortPixelConstants[0]),jQuery("#backup-folder-size").length&&jQuery("#backup-folder-size").html(ShortPixel.getBackupSize()),"todo"==ShortPixel.MEDIA_ALERT&&jQuery("div.media-frame.mode-grid").length>0&&jQuery("div.media-frame.mode-grid").before('<div id="short-pixel-media-alert" class="notice notice-warning"><p>'+SPstringFormat(_spTr.changeMLToListMode,'<a href="upload.php?mode=list" class="view-list"><span class="screen-reader-text">'," </span>",'</a><a class="alignright" href="javascript:ShortPixel.dismissMediaAlert();">',"</a>")+"</p></div>"),jQuery(window).on("beforeunload",function(){1==ShortPixel.bulkProcessor&&clearBulkProcessor()}),checkQuotaExceededAlert(),checkBulkProgress())},setOptions:function(e){for(var t in e)ShortPixel[t]=e[t]},isEmailValid:function(e){return/^\w+([\.+-]?\w+)*@\w+([\.-]?\w+)*(\.\w{1,63})+$/.test(e)},updateSignupEmail:function(){var e=jQuery("#pluginemail").val();ShortPixel.isEmailValid(e)&&jQuery("#request_key").removeClass("disabled"),jQuery("#request_key").attr("href",jQuery("#request_key").attr("href").split("?")[0]+"?pluginemail="+e)},validateKey:function(e){jQuery("#valid").val("validate"),jQuery(e).parents("form").submit()},enableResize:e,setupGeneralTab:function(){var t=0;void 0!==document.wp_shortpixel_options&&(t=document.wp_shortpixel_options.compressionType);for(var r=0,i=null;r<t.length;r++)t[r].onclick=function(){this!==i&&(i=this),void 0===ShortPixel.setupGeneralTabAlert&&(alert(_spTr.alertOnlyAppliesToNewImages),ShortPixel.setupGeneralTabAlert=1)};ShortPixel.enableResize("#resize"),jQuery("#resize").change(function(){e(this)}),jQuery(".resize-sizes").blur(function(e){var t=jQuery(e.target);if(ShortPixel.resizeSizesAlert!=t.val()){ShortPixel.resizeSizesAlert=t.val();var r=jQuery("#min-"+t.attr("name")).val(),i=jQuery("#min-"+t.attr("name")).data("nicename");t.val()<Math.min(r,1024)?(r>1024?alert(SPstringFormat(_spTr.pleaseDoNotSetLesser1024,i)):alert(SPstringFormat(_spTr.pleaseDoNotSetLesserSize,i,i,r)),e.preventDefault(),t.focus()):this.defaultValue=t.val()}}),jQuery(".shortpixel-confirm").click(function(e){return!!confirm(e.target.getAttribute("data-confirm"))||(e.preventDefault(),!1)}),jQuery('input[name="removeExif"], input[name="png2jpg"]').on("change",function(){ShortPixel.checkExifWarning()}),ShortPixel.checkExifWarning(),jQuery('input[name="backupImages"]').on("change",function(){ShortPixel.checkBackUpWarning()}),ShortPixel.checkBackUpWarning()},apiKeyChanged:function(){jQuery(".wp-shortpixel-options .shortpixel-key-valid").css("display","none"),jQuery(".wp-shortpixel-options button#validate").css("display","inline-block")},setupAdvancedTab:function(){jQuery("input.remove-folder-button").click(function(){var e=jQuery(this).data("value"),t=jQuery(this).data("name");1==confirm(SPstringFormat(_spTr.areYouSureStopOptimizing,t))&&(jQuery("#removeFolder").val(e),jQuery("#wp_shortpixel_options").submit())}),jQuery("input.recheck-folder-button").click(function(){var e=jQuery(this).data("value");1==confirm(SPstringFormat(_spTr.areYouSureStopOptimizing,e))&&(jQuery("#recheckFolder").val(e),jQuery("#wp_shortpixel_options").submit())})},checkThumbsUpdTotal:function(e){var t=jQuery("#"+(e.checked?"total":"main")+"ToProcess").val();jQuery("div.bulk-play span.total").text(t),jQuery("#displayTotal").text(t)},initSettings:function(){ShortPixel.adjustSettingsTabs(),ShortPixel.setupGeneralTab(),jQuery(window).resize(function(){ShortPixel.adjustSettingsTabs()}),jQuery("article.sp-tabs a.tab-link").click(function(e){var t=jQuery(e.target).data("id");ShortPixel.switchSettingsTab(t)}),jQuery("input[type=radio][name=deliverWebpType]").change(function(){"deliverWebpAltered"==this.value?window.confirm(_spTr.alertDeliverWebPAltered)?0==jQuery("input[type=radio][name=deliverWebpAlteringType]:checked").length&&jQuery("#deliverWebpAlteredWP").prop("checked",!0):jQuery(this).prop("checked",!1):"deliverWebpUnaltered"==this.value&&window.alert(_spTr.alertDeliverWebPUnaltered)})},switchSettingsTab:function(e){var t=e.replace("tab-",""),r="",i=jQuery("section#"+e);jQuery('input[name="display_part"]').val(t);var s=window.location.href.toString();if(s.indexOf("?")>0){var o=s.substring(0,s.indexOf("?"));o+="?"+jQuery.param({page:"wp-shortpixel-settings",part:t}),window.history.replaceState({},document.title,o)}if(i.length>0&&(jQuery("section").removeClass("sel-tab"),jQuery("section .wp-shortpixel-tab-content").fadeOut(50),jQuery(i).addClass("sel-tab"),jQuery(i).find(".wp-shortpixel-tab-content").fadeIn(50,ShortPixel.adjustSettingsTabs)),"undefined"!=typeof HS&&void 0!==HS.beacon.suggest){switch(t){case"settings":r=shortpixel_suggestions_settings;break;case"adv-settings":r=shortpixel_suggestions_adv_settings;break;case"cloudflare":case"stats":r=shortpixel_suggestions_cloudflare}HS.beacon.suggest(r)}},adjustSettingsTabs:function(){jQuery(".wso.banner").css("opacity",1)},onBulkThumbsCheck:function(e){e.checked?(jQuery("#with-thumbs").css("display","inherit"),jQuery("#without-thumbs").css("display","none")):(jQuery("#without-thumbs").css("display","inherit"),jQuery("#with-thumbs").css("display","none"))},dismissMediaAlert:function(){var e={action:"shortpixel_dismiss_media_alert"};jQuery.get(ShortPixel.AJAX_URL,e,function(t){"success"==(e=JSON.parse(t)).Status&&jQuery("#short-pixel-media-alert").hide()})},closeHelpPane:t,dismissHelpPane:function(){t(),dismissShortPixelNotice("help")},checkQuota:function(){var e={action:"shortpixel_check_quota",nonce:ShortPixelActions.nonce_check_quota,return_json:!0};jQuery.post(ShortPixel.AJAX_URL,e,function(e){console.log("quota refreshed"),console.log(e),window.location.href=e.redirect})},percentDial:function(e,t){jQuery(e).knob({readOnly:!0,width:t,height:t,fgColor:"#1CAECB",format:function(e){return e+"%"}})},successMsg:function(e,t,r,i,s){return(t>0?"<div class='sp-column-info'>"+_spTr.reducedBy+" <strong><span class='percent'>"+t+"%</span></strong> ":"")+(t>0&&t<5?"<br>":"")+(t<5?_spTr.bonusProcessing:"")+(r.length>0?" ("+r+")":"")+(0+i>0?"<br>"+SPstringFormat(_spTr.plusXthumbsOpt,i):"")+(0+s>0?"<br>"+SPstringFormat(_spTr.plusXretinasOpt,s):"")+"</div>"},successActions:function(e,t,r,i,s,o){if(1==s){var a=jQuery(".sp-column-actions-template").clone();if(!a.length)return!1;var l;return l=0==t.length?["lossy","lossless"]:["lossy","glossy","lossless"].filter(function(e){return!(e==t)}),a.html(a.html().replace(/__SP_ID__/g,e)),"pdf"==o.substr(o.lastIndexOf(".")+1).toLowerCase()&&jQuery(".sp-action-compare",a).remove(),0==r&&i>0?a.html(a.html().replace("__SP_THUMBS_TOTAL__",i)):(jQuery(".sp-action-optimize-thumbs",a).remove(),jQuery(".sp-dropbtn",a).removeClass("button-primary")),a.html(a.html().replace(/__SP_FIRST_TYPE__/g,l[0])),a.html(a.html().replace(/__SP_SECOND_TYPE__/g,l[1])),a.html()}return""},otherMediaUpdateActions:function(e,t){if(e=e.substring(2),jQuery(".shortpixel-other-media").length){for(var r=["optimize","retry","restore","redo","quota","view"],i=0,s=r.length;i<s;i++)jQuery("#"+r[i]+"_"+e).css("display","none");for(var i=0,s=t.length;i<s;i++)jQuery("#"+t[i]+"_"+e).css("display","")}},retry:function(e){ShortPixel.retries++,isNaN(ShortPixel.retries)&&(ShortPixel.retries=1),ShortPixel.retries<6?(console.log("Invalid response from server (Error: "+e+"). Retrying pass "+(ShortPixel.retries+1)+"..."),setBulkTimer(5e3)):(ShortPixel.bulkShowError(-1,"Invalid response from server received 6 times. Please retry later by reloading this page, or <a href='https://shortpixel.com/contact' target='_blank'>contact support</a>. (Error: "+e+")",""),console.log("Invalid response from server 6 times. Giving up."))},initFolderSelector:function(){jQuery(".select-folder-button").click(function(){jQuery(".sp-folder-picker-shade").fadeIn(100),jQuery(".shortpixel-modal.modal-folder-picker").show();var e=jQuery(".sp-folder-picker");e.parent().css("margin-left",-e.width()/2),e.fileTree({script:ShortPixel.browseContent,multiFolder:!1})}),jQuery(".shortpixel-modal input.select-folder-cancel, .sp-folder-picker-shade").click(function(){jQuery(".sp-folder-picker-shade").fadeOut(100),jQuery(".shortpixel-modal.modal-folder-picker").hide()}),jQuery(".shortpixel-modal input.select-folder").click(function(e){if(t=jQuery("UL.jqueryFileTree LI.directory.selected"),0==jQuery(t).length)var t=jQuery("UL.jqueryFileTree LI.selected").parents(".directory");var r=jQuery(t).children("a").attr("rel");if(void 0!==r)if(r=r.trim()){var i=jQuery("#customFolderBase").val()+r;i=i.replace(/\/\//,"/"),console.debug("FullPath"+i),jQuery("#addCustomFolder").val(i),jQuery("#addCustomFolderView").val(i),jQuery(".sp-folder-picker-shade").fadeOut(100),jQuery(".shortpixel-modal.modal-folder-picker").css("display","none"),jQuery("#saveAdvAddFolder").removeClass("hidden")}else alert("Please select a folder from the list.")})},browseContent:function(e){e.action="shortpixel_browse_content";var t="";return jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:e,success:function(e){t=e},async:!1}),t},getBackupSize:function(){var e="";return jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_get_backup_size"},success:function(t){e=t},async:!1}),e},newApiKey:function(e){if(!jQuery("#tos").is(":checked"))return e.preventDefault(),jQuery("#tos-robo").fadeIn(400,function(){jQuery("#tos-hand").fadeIn()}),void jQuery("#tos").click(function(){jQuery("#tos-robo").css("display","none"),jQuery("#tos-hand").css("display","none")});if(jQuery("#request_key").addClass("disabled"),jQuery("#pluginemail_spinner").addClass("is-active"),ShortPixel.updateSignupEmail(),ShortPixel.isEmailValid(jQuery("#pluginemail").val())){jQuery("#pluginemail-error").css("display","none");var t={action:"shortpixel_new_api_key",email:jQuery("#pluginemail").val()};jQuery.ajax({type:"POST",async:!1,url:ShortPixel.AJAX_URL,data:t,success:function(t){data=JSON.parse(t),"success"==data.Status?(e.preventDefault(),window.location.reload()):"invalid"==data.Status&&(jQuery("#pluginemail-error").html("<b>"+data.Details+"</b>"),jQuery("#pluginemail-error").css("display",""),jQuery("#pluginemail-info").css("display","none"),e.preventDefault())}}),jQuery("#request_key").removeAttr("onclick")}else jQuery("#pluginemail-error").css("display",""),jQuery("#pluginemail-info").css("display","none"),e.preventDefault();jQuery("#request_key").removeClass("disabled"),jQuery("#pluginemail_spinner").removeClass("is-active")},proposeUpgrade:function(){jQuery("#shortPixelProposeUpgrade .sp-modal-body").addClass("sptw-modal-spinner"),jQuery("#shortPixelProposeUpgrade .sp-modal-body").html(""),jQuery("#shortPixelProposeUpgradeShade").css("display","block"),jQuery("#shortPixelProposeUpgrade").removeClass("shortpixel-hide"),jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_propose_upgrade"},success:function(e){jQuery("#shortPixelProposeUpgrade .sp-modal-body").removeClass("sptw-modal-spinner"),jQuery("#shortPixelProposeUpgrade .sp-modal-body").html(e)}})},closeProposeUpgrade:function(){jQuery("#shortPixelProposeUpgradeShade").css("display","none"),jQuery("#shortPixelProposeUpgrade").addClass("shortpixel-hide"),ShortPixel.toRefresh&&ShortPixel.checkQuota()},bulkShowLengthyMsg:function(e,t,r){var i=jQuery(".bulk-notice-msg.bulk-lengthy");if(0!=i.length){var s=jQuery("a",i);s.text(t),r?s.attr("href",r):s.attr("href",s.data("href").replace("__ID__",e)),i.css("display","block")}},bulkHideLengthyMsg:function(){jQuery(".bulk-notice-msg.bulk-lengthy").css("display","none")},bulkShowMaintenanceMsg:function(e){var t=jQuery(".bulk-notice-msg.bulk-"+e);0!=t.length&&t.css("display","block")},bulkHideMaintenanceMsg:function(e){jQuery(".bulk-notice-msg.bulk-"+e).css("display","none")},bulkShowError:function(e,t,r,i){var s=jQuery("#bulk-error-template");if(0!=s.length){var o=s.clone();o.attr("id","bulk-error-"+e),-1==e?(jQuery("span.sp-err-title",o).remove(),o.addClass("bulk-error-fatal")):(jQuery("img",o).remove(),jQuery("#bulk-error-".id).remove()),jQuery("span.sp-err-content",o).html(t);var a=jQuery("a.sp-post-link",o);i?a.attr("href",i):a.attr("href",a.attr("href").replace("__ID__",e)),a.text(r),s.after(o),o.css("display","block")}},confirmBulkAction:function(e,t){return!!confirm(_spTr["confirmBulk"+e])||(t.stopPropagation(),t.preventDefault(),!1)},checkRandomAnswer:function(e){var t=jQuery(e.target).val(),r=jQuery('input[name="random_answer"]').val(),i=jQuery('input[name="random_answer"]').data("target");t==r?(jQuery(i).removeClass("disabled").prop("disabled",!1),jQuery(i).removeAttr("aria-disabled")):jQuery(i).addClass("disabled").prop("disabled",!0)},removeBulkMsg:function(e){jQuery(e).parent().parent().remove()},isCustomImageId:function(e){return"C-"==e.substring(0,2)},openImageMenu:function(e){e.preventDefault(),this.menuCloseEvent||(jQuery(window).click(function(e){e.target.matches(".sp-dropbtn")||jQuery(".sp-dropdown.sp-show").removeClass("sp-show")}),this.menuCloseEvent=!0);var t=e.target.parentElement.classList.contains("sp-show");jQuery(".sp-dropdown.sp-show").removeClass("sp-show"),t||e.target.parentElement.classList.add("sp-show")},menuCloseEvent:!1,loadComparer:function(e){this.comparerData.origUrl=!1,!1===this.comparerData.cssLoaded&&(jQuery("<link>").appendTo("head").attr({type:"text/css",rel:"stylesheet",href:this.WP_PLUGIN_URL+"/res/css/twentytwenty.min.css"}),this.comparerData.cssLoaded=2),!1===this.comparerData.jsLoaded&&(jQuery.getScript(this.WP_PLUGIN_URL+"/res/js/jquery.twentytwenty.min.js",function(){ShortPixel.comparerData.jsLoaded=2,ShortPixel.comparerData.origUrl.length>0&&ShortPixel.displayComparerPopup(ShortPixel.comparerData.width,ShortPixel.comparerData.height,ShortPixel.comparerData.origUrl,ShortPixel.comparerData.optUrl)}),this.comparerData.jsLoaded=1),!1===this.comparerData.origUrl&&(jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_get_comparer_data",id:e},success:function(e){data=JSON.parse(e),jQuery.extend(ShortPixel.comparerData,data),2==ShortPixel.comparerData.jsLoaded&&ShortPixel.displayComparerPopup(ShortPixel.comparerData.width,ShortPixel.comparerData.height,ShortPixel.comparerData.origUrl,ShortPixel.comparerData.optUrl)}}),this.comparerData.origUrl="")},displayComparerPopup:function(e,t,r,i){var s=e,o=t<150||e<350,a=jQuery(o?"#spUploadCompareSideBySide":"#spUploadCompare"),l=jQuery(".sp-modal-shade");o||jQuery("#spCompareSlider").html('<img alt="'+_spTr.originalImage+'" class="spUploadCompareOriginal"/><img alt="'+_spTr.optimizedImage+'" class="spUploadCompareOptimized"/>'),e=Math.max(350,Math.min(800,e<350?2*(e+25):t<150?e+25:e)),t=Math.max(150,o?s>350?2*(t+45):t+45:t*e/s);var n="-"+Math.round(e/2);jQuery(".sp-modal-body",a).css("width",e),jQuery(".shortpixel-slider",a).css("width",e),a.css("width",e),a.css("marginLeft",n+"px"),jQuery(".sp-modal-body",a).css("height",t),a.show(),l.show(),o||jQuery("#spCompareSlider").twentytwenty({slider_move:"mousemove"}),jQuery(".sp-close-button").on("click",ShortPixel.closeComparerPopup),jQuery(document).on("keyup.sp_modal_active",ShortPixel.closeComparerPopup),jQuery(".sp-modal-shade").on("click",ShortPixel.closeComparerPopup);var u=jQuery(".spUploadCompareOptimized",a);jQuery(".spUploadCompareOriginal",a).attr("src",r),setTimeout(function(){jQuery(window).trigger("resize")},1e3),u.load(function(){jQuery(window).trigger("resize")}),u.attr("src",i)},closeComparerPopup:function(e){jQuery("#spUploadCompareSideBySide").hide(),jQuery("#spUploadCompare").hide(),jQuery(".sp-modal-shade").hide(),jQuery(document).unbind("keyup.sp_modal_active"),jQuery(".sp-modal-shade").off("click"),jQuery(".sp-close-button").off("click")},convertPunycode:function(e){var t=document.createElement("a");return t.href=e,e.indexOf(t.protocol+"//"+t.hostname)<0?t.href:e.replace(t.protocol+"//"+t.hostname,t.protocol+"//"+t.hostname.split(".").map(function(e){return sp_punycode.toASCII(e)}).join("."))},checkExifWarning:function(){!jQuery('input[name="removeExif"]').is(":checked")&&jQuery('input[name="png2jpg"]').is(":checked")?jQuery(".exif_warning").fadeIn():jQuery(".exif_warning").fadeOut(),!jQuery('input[name="removeExif"]').is(":checked")&&jQuery(".exif_imagick_warning").data("imagick")<=0?jQuery(".exif_imagick_warning").fadeIn():jQuery(".exif_imagick_warning").fadeOut()},checkBackUpWarning:function(){jQuery('input[name="backupImages"]').is(":checked")?jQuery(".backup_warning").fadeOut():jQuery(".backup_warning").fadeIn()},comparerData:{cssLoaded:!1,jsLoaded:!1,origUrl:!1,optUrl:!1,width:0,height:0},toRefresh:!1,resizeSizesAlert:!1,returnedStatusSearching:0,optInHelp:function(e,t){var r={action:"shortpixel_helpscoutOptin",toggle:e.currentTarget.toggleParam},i=jQuery(e.target);jQuery.post(ShortPixel.AJAX_URL,r,function(e){"success"==e.Status&&i.parents(".shortpixel.notice").fadeOut()})}}}();!function(e,t,r){t.SpioResize={image:{width:0,height:0},lag:2e3,step1:!1,step2:!1,step3:!1,sizeRule:null,initialized:!1,lastW:!1,lastH:!1,lastType:!1},SpioResize.hide=function(){e(".presentation-wrap").css("opacity",0)},SpioResize.animate=function(e,t,r,i,s){e.animate(t,1e3,"swing",function(){SpioResize.step3=setTimeout(function(){document.styleSheets[0].deleteRule(SpioResize.sizeRule),r.animate(i,1e3,"swing",function(){SpioResize.sizeRule=document.styleSheets[0].insertRule(s)})},600)})},SpioResize.run=function(){if(!SpioResize.initialized){var t=e(r);t.on("input change",'input[name="resizeWidth"], input[name="resizeHeight"]',function(e){clearTimeout(SpioResize.change),SpioResize.changeDone=!0,SpioResize.changeFired=!1,SpioResize.change=setTimeout(function(){SpioResize.changeFired=!0,SpioResize.run()},1500)}),t.on("blur",'input[name="resizeWidth"], input[name="resizeHeight"]',function(e){SpioResize.changeFired||(clearTimeout(SpioResize.change),SpioResize.change=setTimeout(function(){SpioResize.run()},1500))}),t.on("change",'input[name="resizeType"]',function(e){SpioResize.run()}),SpioResize.initialized=!0}var i=e("#width").val(),s=e("#height").val();if(i&&s){var o=e("#resize_type_outer").is(":checked")?"outer":"inner";if(i!==SpioResize.lastW||s!==SpioResize.lastH||o!==SpioResize.lastType){SpioResize.hide(),SpioResize.lastW=i,SpioResize.lastH=s,SpioResize.lastType=o;var a=Math.round(120*Math.sqrt(i/s)),l=Math.round(120*Math.sqrt(s/i)),n=a/l;a>280&&(a=280,l=Math.round(280/n)),l>150&&(l=150,a=Math.round(150*n));var u=e("img.spai-resize-img");u.css("width",""),u.css("height",""),u.css("margin","0px");var c=e("div.spai-resize-frame");c.css("display","none"),c.css("width",a+"px"),c.css("height",l+"px"),c.css("margin",Math.round((156-l)/2)+"px auto 0"),clearTimeout(SpioResize.step1),clearTimeout(SpioResize.step2),clearTimeout(SpioResize.step3),u.stop(),c.stop(),null!==SpioResize.sizeRule&&(document.styleSheets[0].deleteRule(SpioResize.sizeRule),SpioResize.sizeRule=null),SpioResize.sizeRule=document.styleSheets[0].insertRule('.spai-resize-frame:after { content: "'+i+" × "+s+'"; }'),c.addClass("spai-resize-frame"),e(".presentation-wrap").animate({opacity:1},500,"swing",function(){c.css("display","block"),SpioResize.step2=setTimeout(function(){if("outer"==o)if(15/8>n)var e={height:l+"px",margin:Math.round((160-l)/2)+"px 0px"},t=l*(15/8),r={width:Math.round(t)+"px"},p='.spai-resize-frame:after { content: "'+Math.round(t*i/a)+" × "+s+'"; }';else var e={width:a+"px",margin:Math.round((160-a/(15/8))/2)+"px 0px"},h=a/(15/8),r={height:Math.round(h)+"px",margin:Math.round((156-h)/2)+"px auto 0"},p='.spai-resize-frame:after { content: "'+i+" × "+Math.round(h*i/a)+'"; }';else if(15/8>n)var e={width:a,margin:Math.round((160-a/(15/8))/2)+"px 0px"},h=a/(15/8),r={height:Math.round(h)+"px",margin:Math.round((156-h)/2)+"px auto 0"},p='.spai-resize-frame:after { content: "'+i+" × "+Math.round(h*i/a)+'"; }';else var e={height:l,margin:Math.round((160-l)/2)+"px 0px"},t=l*(15/8),r={width:Math.round(t)+"px"},p='.spai-resize-frame:after { content: "'+Math.round(t*i/a)+" × "+s+'"; }';SpioResize.animate(u,e,c,r,p)},1e3)})}}},e(function(){e("#resize").is("checked")&&SpioResize.run()})}(jQuery,window,document);
res/scss/view/_settings.scss CHANGED
@@ -13,6 +13,10 @@
13
  transition: all 1000ms linear;
14
  }
15
 
 
 
 
 
16
  //tabs
17
  article.sp-tabs
18
  {
@@ -105,3 +109,43 @@
105
  }
106
 
107
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  transition: all 1000ms linear;
14
  }
15
 
16
+ .red {
17
+ color: #ff0000;
18
+ }
19
+
20
  //tabs
21
  article.sp-tabs
22
  {
109
  }
110
 
111
  }
112
+
113
+ section.banner
114
+ {
115
+ width: 100%;
116
+ background-color: #dcfdff;
117
+ display: flex;
118
+ align-items: center;
119
+ border: 1px solid #ccc;
120
+ margin-top: 35px;
121
+ margin-bottom: 45px;
122
+ z-index: 12;
123
+ position: relative;
124
+ opacity: 0;
125
+
126
+ span {
127
+ text-align: center;
128
+
129
+ }
130
+
131
+ .image { flex: 1; }
132
+ .line {
133
+ flex: 3;
134
+ h3 { color: #00d0e5 };
135
+
136
+ }
137
+ .button-wrap
138
+ {
139
+ flex: 2;
140
+ .button {
141
+ background: #ff0000;
142
+ padding: 8px;
143
+ font-weight: 700;
144
+ font-size: 20px;
145
+ margin: 8px;
146
+ color: #fff;
147
+ text-transform: uppercase;
148
+ //height: 45px;
149
+ }
150
+ }
151
+ }
shortpixel-plugin.php CHANGED
@@ -125,6 +125,7 @@ class ShortPixelPlugin
125
  add_action('admin_menu', array($this,'admin_pages'));
126
  add_action('admin_enqueue_scripts', array($this, 'admin_scripts')); // admin scripts
127
  add_action('admin_enqueue_scripts', array($this, 'load_admin_scripts'), 90); // loader via route.
 
128
  // defer notices a little to allow other hooks ( notable adminnotices )
129
 
130
  add_action( 'shortpixel-thumbnails-before-regenerate', array( $this->shortPixel, 'thumbnailsBeforeRegenerateHook' ), 10, 1);
@@ -189,7 +190,7 @@ class ShortPixelPlugin
189
  *
190
  * Not all those registered must be enqueued however.
191
  */
192
- public function admin_scripts()
193
  {
194
  // FileTree in Settings
195
  wp_register_style('sp-file-tree', plugins_url('/res/css/sp-file-tree.min.css',SHORTPIXEL_PLUGIN_FILE),array(), SHORTPIXEL_IMAGE_OPTIMISER_VERSION );
@@ -245,10 +246,11 @@ class ShortPixelPlugin
245
  }
246
 
247
  /** This is separated from route to load in head, preventing unstyled content all the time */
248
- public function load_admin_scripts()
249
  {
250
  global $plugin_page;
251
 
 
252
  switch($plugin_page)
253
  {
254
  case 'wp-shortpixel-settings': // settings
@@ -287,7 +289,6 @@ class ShortPixelPlugin
287
 
288
  $url = menu_page_url($plugin_page, false);
289
 
290
-
291
  switch($plugin_page)
292
  {
293
  case 'wp-shortpixel-settings': // settings
@@ -374,7 +375,7 @@ class ShortPixelPlugin
374
  $env = wpSPIO()->env();
375
 
376
  if(\WPShortPixelSettings::getOpt('deliverWebp') == 3 && ! $env->is_nginx) {
377
- \WpShortPixel::alterHtaccess(); //add the htaccess lines
378
  }
379
 
380
  \WpShortPixelDb::checkCustomTables();
@@ -399,8 +400,9 @@ class ShortPixelPlugin
399
  $env = wpSPIO()->env();
400
 
401
  if (! $env->is_nginx)
402
- \WpShortPixel::alterHtaccess(true);
403
-
 
404
  // save remove.
405
  $fs = new Controller\FileSystemController();
406
  $log = $fs->getFile(SHORTPIXEL_BACKUP_FOLDER . "/shortpixel_log");
125
  add_action('admin_menu', array($this,'admin_pages'));
126
  add_action('admin_enqueue_scripts', array($this, 'admin_scripts')); // admin scripts
127
  add_action('admin_enqueue_scripts', array($this, 'load_admin_scripts'), 90); // loader via route.
128
+
129
  // defer notices a little to allow other hooks ( notable adminnotices )
130
 
131
  add_action( 'shortpixel-thumbnails-before-regenerate', array( $this->shortPixel, 'thumbnailsBeforeRegenerateHook' ), 10, 1);
190
  *
191
  * Not all those registered must be enqueued however.
192
  */
193
+ public function admin_scripts($hook_suffix)
194
  {
195
  // FileTree in Settings
196
  wp_register_style('sp-file-tree', plugins_url('/res/css/sp-file-tree.min.css',SHORTPIXEL_PLUGIN_FILE),array(), SHORTPIXEL_IMAGE_OPTIMISER_VERSION );
246
  }
247
 
248
  /** This is separated from route to load in head, preventing unstyled content all the time */
249
+ public function load_admin_scripts($hook_suffix)
250
  {
251
  global $plugin_page;
252
 
253
+
254
  switch($plugin_page)
255
  {
256
  case 'wp-shortpixel-settings': // settings
289
 
290
  $url = menu_page_url($plugin_page, false);
291
 
 
292
  switch($plugin_page)
293
  {
294
  case 'wp-shortpixel-settings': // settings
375
  $env = wpSPIO()->env();
376
 
377
  if(\WPShortPixelSettings::getOpt('deliverWebp') == 3 && ! $env->is_nginx) {
378
+ \WpShortPixel::alterHtaccess(false, false); //add the htaccess lines
379
  }
380
 
381
  \WpShortPixelDb::checkCustomTables();
400
  $env = wpSPIO()->env();
401
 
402
  if (! $env->is_nginx)
403
+ {
404
+ \WpShortPixel::alterHtaccess(false, false);
405
+ }
406
  // save remove.
407
  $fs = new Controller\FileSystemController();
408
  $log = $fs->getFile(SHORTPIXEL_BACKUP_FOLDER . "/shortpixel_log");
shortpixel_api.php CHANGED
@@ -114,6 +114,16 @@ class ShortPixelAPI {
114
 
115
  // This filter, moved to facade GetuRls/Paths
116
  // $URLs = apply_filters('shortpixel_image_urls', $URLs, $itemHandler->getId()) ;
 
 
 
 
 
 
 
 
 
 
117
 
118
  $requestParameters = array(
119
  'plugin_version' => SHORTPIXEL_IMAGE_OPTIMISER_VERSION,
@@ -121,7 +131,7 @@ class ShortPixelAPI {
121
  'lossy' => $compressionType === false ? $this->_settings->compressionType : $compressionType,
122
  'cmyk2rgb' => $this->_settings->CMYKtoRGBconversion,
123
  'keep_exif' => ($this->_settings->keepExif ? "1" : "0"),
124
- 'convertto' => ($this->_settings->createWebp ? urlencode("+webp") : ""),
125
  'resize' => $this->_settings->resizeImages ? 1 + 2 * ($this->_settings->resizeType == 'inner' ? 1 : 0) : 0,
126
  'resize_width' => $this->_settings->resizeWidth,
127
  'resize_height' => $this->_settings->resizeHeight,
@@ -357,16 +367,23 @@ class ShortPixelAPI {
357
 
358
  }
359
 
360
- function fromArchive($path, $optimizedUrl, $optimizedSize, $originalSize, $webpUrl) {
361
  $webpTempFile = "NA";
362
  if($webpUrl !== "NA") {
363
  $webpTempFile = $path . '/' . wp_basename($webpUrl);
364
  $webpTempFile = file_exists($webpTempFile) ? $webpTempFile : 'NA';
365
  }
366
 
 
 
 
 
 
 
 
367
  //if there is no improvement in size then we do not download this file
368
  if ( $originalSize == $optimizedSize )
369
- return array("Status" => self::STATUS_UNCHANGED, "Message" => "File wasn't optimized so we do not download it.", "WebP" => $webpTempFile);
370
 
371
  $correctFileSize = $optimizedSize;
372
  $tempFile = $path . '/' . wp_basename($optimizedUrl);
@@ -377,12 +394,13 @@ class ShortPixelAPI {
377
  $size = filesize($tempFile);
378
  @unlink($tempFile);
379
  @unlink($webpTempFile);
 
380
  $returnMessage = array(
381
  "Status" => self::STATUS_ERROR,
382
  "Code" => self::ERR_INCORRECT_FILE_SIZE,
383
  "Message" => sprintf(__('Error in archive - incorrect file size (downloaded: %s, correct: %s )','shortpixel-image-optimiser'),$size, $correctFileSize));
384
  } else {
385
- $returnMessage = array("Status" => self::STATUS_SUCCESS, "Message" => $tempFile, "WebP" => $webpTempFile);
386
  }
387
  } else {
388
  $returnMessage = array("Status" => self::STATUS_ERROR,
@@ -401,7 +419,7 @@ class ShortPixelAPI {
401
  * @param string $webpUrl
402
  * @return array status /message array
403
  */
404
- private function handleDownload($optimizedUrl, $optimizedSize, $originalSize, $webpUrl){
405
 
406
  $downloadTimeout = max(ini_get('max_execution_time') - 10, 15);
407
 
@@ -412,9 +430,17 @@ class ShortPixelAPI {
412
  $webpTempFile = is_wp_error( $webpTempFile ) ? "NA" : $webpTempFile;
413
  }
414
 
 
 
 
 
 
 
 
 
415
  //if there is no improvement in size then we do not download this file
416
  if ( $originalSize == $optimizedSize )
417
- return array("Status" => self::STATUS_UNCHANGED, "Message" => "File wasn't optimized so we do not download it.", "WebP" => $webpTempFile);
418
 
419
  $correctFileSize = $optimizedSize;
420
  $fileURL = $this->setPreferredProtocol(urldecode($optimizedUrl));
@@ -428,11 +454,12 @@ class ShortPixelAPI {
428
  }
429
 
430
  //on success we return this
431
- $returnMessage = array("Status" => self::STATUS_SUCCESS, "Message" => $tempFile, "WebP" => $webpTempFile);
432
 
433
  if ( is_wp_error( $tempFile ) ) {
434
  @unlink($tempFile);
435
  @unlink($webpTempFile);
 
436
  $returnMessage = array(
437
  "Status" => self::STATUS_ERROR,
438
  "Code" => self::ERR_DOWNLOAD,
@@ -448,11 +475,13 @@ class ShortPixelAPI {
448
  $size = filesize($tempFile);
449
  @unlink($tempFile);
450
  @unlink($webpTempFile);
 
451
  $returnMessage = array(
452
  "Status" => self::STATUS_ERROR,
453
  "Code" => self::ERR_INCORRECT_FILE_SIZE,
454
  "Message" => sprintf(__('Error downloading file - incorrect file size (downloaded: %s, correct: %s )','shortpixel-image-optimiser'),$size, $correctFileSize));
455
  }
 
456
  return $returnMessage;
457
  }
458
 
@@ -615,9 +644,10 @@ class ShortPixelAPI {
615
  $fileSize = "LossySize";
616
  } else {
617
  $fileType = "LosslessURL";
618
- $fileSize = "LoselessSize";
619
  }
620
  $webpType = "WebP" . $fileType;
 
621
 
622
  $archive = /*false &&*/
623
  ($this->_settings->downloadArchive == 7 && class_exists('PharData') && isset($APIresponse[count($APIresponse) - 1]->ArchiveStatus))
@@ -638,11 +668,18 @@ class ShortPixelAPI {
638
  } else { //count thumbnails only
639
  $this->_settings->thumbsCount = $this->_settings->thumbsCount + 1;
640
  }
 
 
 
 
 
 
 
641
  //TODO la sfarsit sa faca fallback la handleDownload
642
  if($archive) {
643
- $downloadResult = $this->fromArchive($archive['Path'], $fileData->$fileType, $fileData->$fileSize, $fileData->OriginalSize, isset($fileData->$webpType) ? $fileData->$webpType : 'NA');
644
  } else {
645
- $downloadResult = $this->handleDownload($fileData->$fileType, $fileData->$fileSize, $fileData->OriginalSize, isset($fileData->$webpType) ? $fileData->$webpType : 'NA');
646
  }
647
 
648
  $tempFiles[$counter] = $downloadResult;
@@ -674,7 +711,7 @@ class ShortPixelAPI {
674
  if( $this->_settings->backupImages )
675
  {
676
  $backupStatus = self::backupImage($mainPath, $PATHs);
677
- Log::addDebug('Status', $backupStatus);
678
  if($backupStatus == self::STATUS_FAIL) {
679
  $itemHandler->incrementRetries(1, self::ERR_SAVE_BKP, $backupStatus["Message"]);
680
  self::cleanupTemporaryFiles($archive, empty($tempFiles) ? array() : $tempFiles);
@@ -769,6 +806,17 @@ class ShortPixelAPI {
769
  $tempWebpFilePATH->move($targetWebPFile);
770
  }
771
  }
 
 
 
 
 
 
 
 
 
 
 
772
  } // / For each tempFile
773
  self::cleanupTemporaryFiles($archive, $tempFiles);
774
 
114
 
115
  // This filter, moved to facade GetuRls/Paths
116
  // $URLs = apply_filters('shortpixel_image_urls', $URLs, $itemHandler->getId()) ;
117
+ $convertTo = array();
118
+ if ($this->_settings->createWebp)
119
+ $convertTo[]= urlencode("+webp");
120
+ if ($this->_settings->createAvif)
121
+ $convertTo[] = urlencode('+avif');
122
+
123
+ if (count($convertTo) > 0)
124
+ $convertTo = implode('|', $convertTo);
125
+ else
126
+ $convertTo = '';
127
 
128
  $requestParameters = array(
129
  'plugin_version' => SHORTPIXEL_IMAGE_OPTIMISER_VERSION,
131
  'lossy' => $compressionType === false ? $this->_settings->compressionType : $compressionType,
132
  'cmyk2rgb' => $this->_settings->CMYKtoRGBconversion,
133
  'keep_exif' => ($this->_settings->keepExif ? "1" : "0"),
134
+ 'convertto' => $convertTo,
135
  'resize' => $this->_settings->resizeImages ? 1 + 2 * ($this->_settings->resizeType == 'inner' ? 1 : 0) : 0,
136
  'resize_width' => $this->_settings->resizeWidth,
137
  'resize_height' => $this->_settings->resizeHeight,
367
 
368
  }
369
 
370
+ function fromArchive($path, $optimizedUrl, $optimizedSize, $originalSize, $webpUrl, $avifUrl) {
371
  $webpTempFile = "NA";
372
  if($webpUrl !== "NA") {
373
  $webpTempFile = $path . '/' . wp_basename($webpUrl);
374
  $webpTempFile = file_exists($webpTempFile) ? $webpTempFile : 'NA';
375
  }
376
 
377
+ $avifTempFile = false;
378
+ if ($avifUrl !== "NA")
379
+ {
380
+ $avifTempFile = $path . '/' . wp_basename($avifUrl);
381
+ $avifTempFile = file_exists($avifTempFile) ? $avifTempFile : 'NA';
382
+ }
383
+
384
  //if there is no improvement in size then we do not download this file
385
  if ( $originalSize == $optimizedSize )
386
+ return array("Status" => self::STATUS_UNCHANGED, "Message" => "File wasn't optimized so we do not download it.", "WebP" => $webpTempFile, 'Avif' => $avifTempFile);
387
 
388
  $correctFileSize = $optimizedSize;
389
  $tempFile = $path . '/' . wp_basename($optimizedUrl);
394
  $size = filesize($tempFile);
395
  @unlink($tempFile);
396
  @unlink($webpTempFile);
397
+ @unlink($avifTempFile);
398
  $returnMessage = array(
399
  "Status" => self::STATUS_ERROR,
400
  "Code" => self::ERR_INCORRECT_FILE_SIZE,
401
  "Message" => sprintf(__('Error in archive - incorrect file size (downloaded: %s, correct: %s )','shortpixel-image-optimiser'),$size, $correctFileSize));
402
  } else {
403
+ $returnMessage = array("Status" => self::STATUS_SUCCESS, "Message" => $tempFile, "WebP" => $webpTempFile, 'Avif' => $avifTempFile);
404
  }
405
  } else {
406
  $returnMessage = array("Status" => self::STATUS_ERROR,
419
  * @param string $webpUrl
420
  * @return array status /message array
421
  */
422
+ private function handleDownload($optimizedUrl, $optimizedSize, $originalSize, $webpUrl, $avifUrl){
423
 
424
  $downloadTimeout = max(ini_get('max_execution_time') - 10, 15);
425
 
430
  $webpTempFile = is_wp_error( $webpTempFile ) ? "NA" : $webpTempFile;
431
  }
432
 
433
+ $avifTempFile = "NA";
434
+ if($avifUrl !== "NA") {
435
+ $avifUrl = $this->setPreferredProtocol(urldecode($avifUrl));
436
+ $avifTempFile = download_url($avifUrl, $downloadTimeout);
437
+ Log::addTemp("Download Avif " . $avifUrl);
438
+ $avifTempFile = is_wp_error( $avifTempFile ) ? "NA" : $avifTempFile;
439
+ }
440
+
441
  //if there is no improvement in size then we do not download this file
442
  if ( $originalSize == $optimizedSize )
443
+ return array("Status" => self::STATUS_UNCHANGED, "Message" => "File wasn't optimized so we do not download it.", "WebP" => $webpTempFile, 'Avif' => $avifTempFile);
444
 
445
  $correctFileSize = $optimizedSize;
446
  $fileURL = $this->setPreferredProtocol(urldecode($optimizedUrl));
454
  }
455
 
456
  //on success we return this
457
+ $returnMessage = array("Status" => self::STATUS_SUCCESS, "Message" => $tempFile, "WebP" => $webpTempFile, 'Avif' => $avifTempFile);
458
 
459
  if ( is_wp_error( $tempFile ) ) {
460
  @unlink($tempFile);
461
  @unlink($webpTempFile);
462
+ @unlink($avifTempFile);
463
  $returnMessage = array(
464
  "Status" => self::STATUS_ERROR,
465
  "Code" => self::ERR_DOWNLOAD,
475
  $size = filesize($tempFile);
476
  @unlink($tempFile);
477
  @unlink($webpTempFile);
478
+ @unlink($avifTempFile);
479
  $returnMessage = array(
480
  "Status" => self::STATUS_ERROR,
481
  "Code" => self::ERR_INCORRECT_FILE_SIZE,
482
  "Message" => sprintf(__('Error downloading file - incorrect file size (downloaded: %s, correct: %s )','shortpixel-image-optimiser'),$size, $correctFileSize));
483
  }
484
+ Log::addDebug('HandleDownload ReturnMSG ', $returnMessage);
485
  return $returnMessage;
486
  }
487
 
644
  $fileSize = "LossySize";
645
  } else {
646
  $fileType = "LosslessURL";
647
+ $fileSize = "LosslessSize";
648
  }
649
  $webpType = "WebP" . $fileType;
650
+ $avifType = 'AVIF' . $fileType;
651
 
652
  $archive = /*false &&*/
653
  ($this->_settings->downloadArchive == 7 && class_exists('PharData') && isset($APIresponse[count($APIresponse) - 1]->ArchiveStatus))
668
  } else { //count thumbnails only
669
  $this->_settings->thumbsCount = $this->_settings->thumbsCount + 1;
670
  }
671
+
672
+ $webpUrl = isset($fileData->$webpType) ? $fileData->$webpType : 'NA';
673
+ $avifUrl = isset($fileData->$avifType) ? $fileData->$avifType : 'NA';
674
+
675
+ Log::addTemp('Searching for types : ' . $webpType . ' - ' . $avifType);
676
+ Log::addtemp("HandleSuccess, FileData ", $fileData);
677
+
678
  //TODO la sfarsit sa faca fallback la handleDownload
679
  if($archive) {
680
+ $downloadResult = $this->fromArchive($archive['Path'], $fileData->$fileType, $fileData->$fileSize, $fileData->OriginalSize, $webpUrl, $avifUrl );
681
  } else {
682
+ $downloadResult = $this->handleDownload($fileData->$fileType, $fileData->$fileSize, $fileData->OriginalSize, $webpUrl, $avifUrl);
683
  }
684
 
685
  $tempFiles[$counter] = $downloadResult;
711
  if( $this->_settings->backupImages )
712
  {
713
  $backupStatus = self::backupImage($mainPath, $PATHs);
714
+ Log::addTemp('Status backup - ', $backupStatus);
715
  if($backupStatus == self::STATUS_FAIL) {
716
  $itemHandler->incrementRetries(1, self::ERR_SAVE_BKP, $backupStatus["Message"]);
717
  self::cleanupTemporaryFiles($archive, empty($tempFiles) ? array() : $tempFiles);
806
  $tempWebpFilePATH->move($targetWebPFile);
807
  }
808
  }
809
+
810
+ $tempAvifFilePATH = $fs->getFile($tempFile["Avif"]);
811
+ if( $tempAvifFilePATH->exists() ) {
812
+ /*$targetAvifFileCompat = $fs->getFile($targetFile->getFileDir() . $targetFile->getFileName() . '.avif');*/
813
+
814
+ $targetWebPFile = $fs->getFile($targetFile->getFileDir() . $targetFile->getFileBase() . '.avif');
815
+ Log::addTemp("Moving Avif file ");
816
+ $tempAvifFilePATH->move($targetWebPFile);
817
+
818
+ }
819
+
820
  } // / For each tempFile
821
  self::cleanupTemporaryFiles($archive, $tempFiles);
822
 
wp-shortpixel.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: ShortPixel Image Optimizer
4
  * Plugin URI: https://shortpixel.com/
5
  * Description: ShortPixel optimizes images automatically, while guarding the quality of your images. Check your <a href="options-general.php?page=wp-shortpixel-settings" target="_blank">Settings &gt; ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
6
- * Version: 4.21.2
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  * GitHub Plugin URI: https://github.com/short-pixel-optimizer/shortpixel-image-optimiser
@@ -33,7 +33,7 @@ define('SHORTPIXEL_PLUGIN_DIR', __DIR__);
33
 
34
  //define('SHORTPIXEL_AFFILIATE_CODE', '');
35
 
36
- define('SHORTPIXEL_IMAGE_OPTIMISER_VERSION', "4.21.2");
37
  define('SHORTPIXEL_MAX_TIMEOUT', 10);
38
  define('SHORTPIXEL_VALIDATE_MAX_TIMEOUT', 15);
39
  define('SHORTPIXEL_BACKUP', 'ShortpixelBackups');
3
  * Plugin Name: ShortPixel Image Optimizer
4
  * Plugin URI: https://shortpixel.com/
5
  * Description: ShortPixel optimizes images automatically, while guarding the quality of your images. Check your <a href="options-general.php?page=wp-shortpixel-settings" target="_blank">Settings &gt; ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
6
+ * Version: 4.22.0
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  * GitHub Plugin URI: https://github.com/short-pixel-optimizer/shortpixel-image-optimiser
33
 
34
  //define('SHORTPIXEL_AFFILIATE_CODE', '');
35
 
36
+ define('SHORTPIXEL_IMAGE_OPTIMISER_VERSION', "4.22.0");
37
  define('SHORTPIXEL_MAX_TIMEOUT', 10);
38
  define('SHORTPIXEL_VALIDATE_MAX_TIMEOUT', 15);
39
  define('SHORTPIXEL_BACKUP', 'ShortpixelBackups');