Skip to content

Commit 102b7a0

Browse files
Fix lint issues
1 parent 802b145 commit 102b7a0

File tree

6 files changed

+49
-25
lines changed

6 files changed

+49
-25
lines changed

src/class-tiny-bulk-optimization.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,15 @@ private static function populate_optimization_statistics( $settings, $result, $s
128128
$image_stats['available_unconverted_sizes'];
129129
$stats['optimized-image-sizes'] +=
130130
$image_stats['image_sizes_converted'];
131-
$stats['estimated_credit_use'] += $image_stats['available_unconverted_sizes'];
131+
132+
$stats['estimated_credit_use'] += $image_stats['available_unconverted_sizes'];
132133
} else {
133134
$stats['available-unoptimized-sizes'] +=
134135
$image_stats['available_uncompressed_sizes'];
135136
$stats['optimized-image-sizes'] +=
136137
$image_stats['image_sizes_compressed'];
137138
}
139+
138140
$stats['optimized-library-size'] += $image_stats['compressed_total_size'];
139141
$stats['unoptimized-library-size'] += $image_stats['initial_total_size'];
140142

src/class-tiny-compress-fopen.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ public function get_key() {
6161
}
6262

6363
protected function validate() {
64-
$params = $this->request_options( 'GET' );
65-
$url = Tiny_Config::KEYS_URL . '/' . $this->get_key();
64+
$params = $this->request_options( 'GET' );
65+
66+
$url = Tiny_Config::KEYS_URL . '/' . $this->get_key();
67+
6668
list($details, $headers, $status_code) = $this->request( $params, $url );
6769

6870
if ( 429 == $status_code || 400 == $status_code || 200 == $status_code ) {
@@ -83,7 +85,8 @@ protected function validate() {
8385
}
8486

8587
protected function compress( $input, $resize_opts, $preserve_opts, $convert_to ) {
86-
$params = $this->request_options( 'POST', $input );
88+
$params = $this->request_options( 'POST', $input );
89+
8790
list($details, $headers, $status_code) = $this->request( $params );
8891

8992
$output_url = isset( $headers['location'] ) ? $headers['location'] : null;
@@ -106,7 +109,8 @@ protected function compress( $input, $resize_opts, $preserve_opts, $convert_to )
106109
);
107110
}
108111

109-
$params = $this->output_request_options( $resize_opts, $preserve_opts );
112+
$params = $this->output_request_options( $resize_opts, $preserve_opts );
113+
110114
list($output, $headers, $status_code) = $this->request( $params, $output_url );
111115

112116
if ( $status_code >= 400 && is_array( $output ) && isset( $output['error'] ) ) {
@@ -161,11 +165,13 @@ protected function compress( $input, $resize_opts, $preserve_opts, $convert_to )
161165
$convert_params,
162166
$output_url
163167
);
164-
$meta['convert'] = array(
168+
169+
$meta['convert'] = array(
165170
'type' => $convert_headers['content-type'],
166171
'size' => strlen( $convert_output ),
167172
);
168-
$convert = $convert_output;
173+
174+
$convert = $convert_output;
169175

170176
}
171177

src/class-tiny-image.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,10 @@ public function get_latest_error() {
401401
if ( isset( $size->meta['error'] ) && isset( $size->meta['message'] ) ) {
402402
if ( null === $last_timestamp || $last_timestamp < $size->meta['timestamp'] ) {
403403
$last_timestamp = $size->meta['timestamp'];
404-
$error_message = Tiny_Helpers::truncate_text( $size->meta['message'], 140 );
404+
$error_message = Tiny_Helpers::truncate_text(
405+
$size->meta['message'],
406+
140
407+
);
405408
}
406409
}
407410
}

src/class-tiny-plugin.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,15 @@ public function enqueue_scripts( $hook ) {
289289
'nonce' => wp_create_nonce( 'tiny-compress' ),
290290
'wpVersion' => self::wp_version(),
291291
'pluginVersion' => self::version(),
292-
'L10nAllDone' => __( 'All images are processed', 'tiny-compress-images' ),
292+
'L10nAllDone' => __(
293+
'All images are processed',
294+
'tiny-compress-images'
295+
),
293296
'L10nNoActionTaken' => __( 'No action taken', 'tiny-compress-images' ),
294-
'L10nDuplicate' => __( 'Image was already processed', 'tiny-compress-images' ),
297+
'L10nDuplicate' => __(
298+
'Image was already processed',
299+
'tiny-compress-images'
300+
),
295301
'L10nBulkAction' => __( 'Compress Images', 'tiny-compress-images' ),
296302
'L10nBulkMarkCompressed' => __( 'Mark as Compressed', 'tiny-compress-images' ),
297303
'L10nCancelled' => __( 'Cancelled', 'tiny-compress-images' ),
@@ -739,9 +745,11 @@ public function add_dashboard_widget() {
739745
true
740746
);
741747

742-
/* This might be deduplicated with the admin script localization, but
743-
the order of including scripts is sometimes different. So in that
744-
case we need to make sure that the order of inclusion is correc.t */
748+
/**
749+
* This might be deduplicated with the admin script localization, but
750+
* the order of including scripts is sometimes different. So in that
751+
* case we need to make sure that the order of inclusion is correc.t
752+
*/
745753
wp_localize_script(
746754
self::NAME . '_dashboard_widget',
747755
'tinyCompressDashboard',
@@ -813,7 +821,8 @@ function clean_attachment( $post_id ) {
813821
}
814822

815823
static function request_review() {
816-
$review_url = 'https://wordpress.org/support/plugin/tiny-compress-images/reviews/#new-post';
824+
$review_url =
825+
'https://wordpress.org/support/plugin/tiny-compress-images/reviews/#new-post';
817826
$review_block = esc_html__( 'Enjoying TinyPNG?', 'tiny-compress-images' );
818827
$review_block .= ' ';
819828
$review_block .= sprintf(

src/class-tiny-settings.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,11 @@ public function create_api_key() {
904904
}
905905

906906
try {
907-
$site = str_replace( array( 'http://', 'https://' ), '', get_bloginfo( 'url' ) );
907+
$site = str_replace(
908+
array( 'http://', 'https://' ),
909+
'',
910+
get_bloginfo( 'url' )
911+
);
908912
$identifier = 'WordPress plugin for ' . $site;
909913
$link = $this->get_absolute_url();
910914
$compressor->create_key(
@@ -1005,10 +1009,12 @@ public function render_format_conversion() {
10051009
'</label>';
10061010
echo '</p>';
10071011

1008-
$convertopts_convert_to_name = self::get_prefixed_name( 'convert_format[convert_to]' );
1012+
$convertopts_convert_to_name =
1013+
self::get_prefixed_name( 'convert_format[convert_to]' );
10091014
$convertopts_convert_subfields_classname = self::get_prefixed_name( 'convert_fields' );
10101015
$convertopts_convert_to_id = self::get_prefixed_name( 'convert_convert_to' );
1011-
$convertopts_convert_value = self::get_convert_format_option( 'convert_to', 'smallest' );
1016+
$convertopts_convert_value =
1017+
self::get_convert_format_option( 'convert_to', 'smallest' );
10121018
$convertopts_convert_disabled =
10131019
self::get_conversion_enabled() ? '' : ' disabled="disabled"';
10141020
echo sprintf(

src/views/compress-details.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,9 @@
147147
<th><?php esc_html_e( 'Initial Size', 'tiny-compress-images' ); ?></th>
148148
<th><?php esc_html_e( 'Compressed', 'tiny-compress-images' ); ?></th>
149149
<th><?php esc_html_e( 'Format', 'tiny-compress-images' ); ?></th>
150-
<?php
151-
if ( $conversion_enabled ) {
152-
?>
153-
<th><?php esc_html_e( 'Converted', 'tiny-compress-images' ); ?></th> <?php } ?>
150+
<?php if ( $conversion_enabled ) { ?>
151+
<th><?php esc_html_e( 'Converted', 'tiny-compress-images' ); ?></th>
152+
<?php } ?>
154153
<th><?php esc_html_e( 'Date', 'tiny-compress-images' ); ?></th>
155154
</tr>
156155
<?php
@@ -227,10 +226,9 @@
227226
<td><?php echo size_format( $size_before, 1 ); ?></td>
228227
<td><?php echo size_format( $size_after, 1 ); ?></td>
229228
<td></td>
230-
<?php
231-
if ( $conversion_enabled ) {
232-
?>
233-
<td></td> <?php } ?>
229+
<?php if ( $conversion_enabled ) { ?>
230+
<td></td>
231+
<?php } ?>
234232
<td></td>
235233
</tr>
236234
</tfoot>

0 commit comments

Comments
 (0)