Skip to content

Commit a4507da

Browse files
authored
Merge pull request #994 from cloudinary/hotfix/3.2.2-build-2
Hotfix/3.2.2 build 2
2 parents 3eecbb6 + 1d9f8dc commit a4507da

File tree

8 files changed

+28
-9
lines changed

8 files changed

+28
-9
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.2-build-2
1+
3.2.2-build-3

css/cloudinary.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/block-editor.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '6e506ba1169e4e191177');
1+
<?php return array('dependencies' => array('react', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '87ba7d528e0425bc85ca');

js/block-editor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

php/class-delivery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ public function is_deliverable( $attachment_id ) {
369369

370370
$svg = $this->plugin->get_component( 'svg' );
371371

372-
if ( ! $is && wp_attachment_is_image( $attachment_id ) && $svg->is_active() ) {
372+
if ( ! $is && $svg->is_active() && $svg::is_svg( $attachment_id ) ) {
373373
$is = true;
374374
}
375375

php/class-svg.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function allow_svg_for_cloudinary( $types ) {
162162
* @return array
163163
*/
164164
public function remove_svg_eagers( $options, $attachment ) {
165-
if ( 'image/svg+xml' === $attachment->post_mime_type ) {
165+
if ( static::is_svg( $attachment->ID ) ) {
166166
unset( $options['eager'], $options['eager_async'] );
167167
}
168168

@@ -179,7 +179,7 @@ public function remove_svg_eagers( $options, $attachment ) {
179179
*/
180180
public function upload_args( $args, $attachment_id ) {
181181

182-
if ( 'image/svg+xml' === get_post_mime_type( $attachment_id ) ) {
182+
if ( static::is_svg( $attachment_id ) ) {
183183
$args['body']['resource_type'] = 'auto';
184184
$args['body']['eager'] = 'fl_sanitize';
185185
}
@@ -194,7 +194,7 @@ public function upload_args( $args, $attachment_id ) {
194194
*/
195195
public function maybe_setup_metadata( $attachment_id, $result ) {
196196

197-
if ( is_array( $result ) && 'image/svg+xml' === get_post_mime_type( $attachment_id ) ) {
197+
if ( is_array( $result ) && static::is_svg( $attachment_id ) ) {
198198
$file_path = get_post_meta( $attachment_id, '_wp_attached_file', true );
199199
$meta = wp_get_attachment_metadata( $attachment_id );
200200
if ( empty( $meta ) ) {
@@ -237,4 +237,15 @@ public function setup_hooks() {
237237
// Add actions.
238238
add_action( 'cloudinary_uploaded_asset', array( $this, 'maybe_setup_metadata' ), 10, 2 );
239239
}
240+
241+
/**
242+
* Check if an attachment is an SVG.
243+
*
244+
* @param int $attachment_id The attachment ID.
245+
*
246+
* @return bool
247+
*/
248+
public static function is_svg( $attachment_id ) {
249+
return 'image/svg+xml' === get_post_mime_type( $attachment_id );
250+
}
240251
}

src/css/components/_ui.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@
3838
margin: 0 0 6px;
3939
font-weight: 700;
4040
}
41+
42+
.cloudinary-overwrite-transformations {
43+
padding: 6px 0;
44+
}

src/js/components/featured-image.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ let FeaturedTransformationsToggle = ( props ) => {
1212
<>
1313
{ props.modalClass && (
1414
<ToggleControl
15-
label={ __( 'Overwrite Transformations', 'cloudinary' ) }
15+
label={ __(
16+
'Cloudinary overwrite Global Transformations',
17+
'cloudinary'
18+
) }
1619
checked={ props.overwrite_featured_transformations }
1720
onChange={ ( value ) => props.setOverwrite( value ) }
21+
className="cloudinary-overwrite-transformations"
1822
/>
1923
) }
2024
</>

0 commit comments

Comments
 (0)