Skip to content

Commit c6ad7ea

Browse files
tijmenbruggemanrkoopmans
authored andcommitted
Format
1 parent b6244c1 commit c6ad7ea

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

src/class-tiny-image.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function compress() {
193193

194194
$compressor = $this->settings->get_compressor();
195195
$convert_to = $this->convert_to();
196-
196+
197197
foreach ( $unprocessed_sizes as $size_name => $size ) {
198198
if ( ! $size->is_duplicate() ) {
199199
$size->add_tiny_meta_start();
@@ -209,7 +209,9 @@ public function compress() {
209209
);
210210

211211
// ensure that all conversion are in the same format as the first one
212-
$convert_to = isset($response['convert']) ? array($response['convert']['type']) : $convert_to;
212+
$convert_to = isset( $response['convert'] ) ?
213+
array( $response['convert']['type'] ) :
214+
$convert_to;
213215

214216
$size->add_tiny_meta( $response );
215217
$success++;
@@ -251,7 +253,7 @@ public function compress_retina( $size_name, $path ) {
251253
}
252254

253255
$size = $this->sizes[ $size_name ];
254-
256+
255257
$compressor = $this->settings->get_compressor();
256258
$convert_to = $this->convert_to();
257259

@@ -486,7 +488,7 @@ public function can_be_converted() {
486488
* If nothing is converted yet, we use the settings conversion settings.
487489
*
488490
* @since 3.6.4
489-
*
491+
*
490492
* @return array{string} mimetypes to which the image should be converted to
491493
*/
492494
private function convert_to() {
@@ -504,11 +506,11 @@ private function convert_to() {
504506
$original_img_size = $this->sizes[ self::ORIGINAL ];
505507
if ( $original_img_size->converted() ) {
506508
// original has been convert so use that mimetype to convert to
507-
return array($original_img_size->meta['convert']['type']);
509+
return array( $original_img_size->meta['convert']['type'] );
508510
}
509511

510512
return $convert_settings['convert_to'];
511-
513+
512514
}
513515

514516
/**

src/class-tiny-picture.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ protected function get_image_srcsets( $html ) {
316316
'size' => $parts[1],
317317
);
318318
} elseif ( count( $parts ) === 1 ) {
319-
// We only have a path, will be interpreted as pixel density 1x (unusual in srcset)
319+
// We only have a path, will be interpreted as pixel
320+
// density 1x (unusual in srcset)
320321
$result[] = array(
321322
'path' => $parts[0],
322323
'size' => '',
@@ -359,7 +360,7 @@ protected function create_alternative_sources( $original_source_html ) {
359360
$srcsets[] = $this->get_image_src( $original_source_html );
360361
}
361362

362-
if ( empty ( $srcsets ) ) {
363+
if ( empty( $srcsets ) ) {
363364
return array();
364365
}
365366

@@ -378,7 +379,11 @@ protected function create_alternative_sources( $original_source_html ) {
378379
}
379380
}
380381

381-
if ( $width_descriptor && ! self::srcset_contains_width_descriptor( $srcset_parts, $width_descriptor ) ) {
382+
if ( $width_descriptor &&
383+
! self::srcset_contains_width_descriptor(
384+
$srcset_parts,
385+
$width_descriptor
386+
) ) {
382387
continue;
383388
}
384389

@@ -407,13 +412,14 @@ protected function create_alternative_sources( $original_source_html ) {
407412
}
408413
$source_parts[] = '/>';
409414
$sources[] = implode( ' ', $source_parts );
410-
}
415+
}// End foreach().
411416

412417
return $sources;
413418
}
414419

415420
/**
416-
* Returns the largest numeric width descriptor (e.g. 2000 from "2000w") found in the srcset data.
421+
* Returns the largest numeric width descriptor
422+
* (e.g. 2000 from "2000w") found in the srcset data.
417423
*
418424
* @param array<array{path: string, size: string}> $srcsets
419425
* @return int

0 commit comments

Comments
 (0)