Skip to content

Commit ad2ed3c

Browse files
Format
1 parent 517d0c9 commit ad2ed3c

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/class-tiny-cli.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ public function __construct( $settings ) {
7777
* @return void
7878
*/
7979
public function optimize( $args, $assoc_args ) {
80-
$attachments = isset( $assoc_args['attachments'] ) ? array_map( 'trim', explode( ',', $assoc_args['attachments'] ) ) : array();
80+
$attachments = isset( $assoc_args['attachments'] ) ?
81+
array_map( 'trim', explode( ',', $assoc_args['attachments'] ) ) :
82+
array();
8183

8284
if ( empty( $attachments ) ) {
8385
$attachments = $this->get_unoptimized_attachments();
@@ -106,7 +108,13 @@ public function optimize( $args, $assoc_args ) {
106108
$this->optimize_attachment( $attachment_id );
107109
$optimized++;
108110
} catch ( Exception $e ) {
109-
WP_CLI::warning( 'skipping - error: ' . $e->getMessage() . ' (ID: ' . $attachment_id . ')' );
111+
WP_CLI::warning(
112+
'skipping - error: ' .
113+
$e->getMessage() .
114+
' (ID: ' .
115+
$attachment_id .
116+
')'
117+
);
110118
}
111119

112120
$progress->tick();
@@ -143,7 +151,7 @@ private function is_valid_attachment( $attachment_id ) {
143151
return false;
144152
}
145153

146-
if ( $attachment->post_type !== 'attachment' ) {
154+
if ( 'attachment' !== $attachment->post_type ) {
147155
return false;
148156
}
149157

0 commit comments

Comments
 (0)