Skip to content

Commit

Permalink
Merge pull request #994 from cloudinary/hotfix/3.2.2-build-2
Browse files Browse the repository at this point in the history
Hotfix/3.2.2 build 2
  • Loading branch information
pereirinha authored Oct 28, 2024
2 parents 3eecbb6 + 1d9f8dc commit a4507da
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.2-build-2
3.2.2-build-3
2 changes: 1 addition & 1 deletion css/cloudinary.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/block-editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '6e506ba1169e4e191177');
<?php return array('dependencies' => array('react', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '87ba7d528e0425bc85ca');
2 changes: 1 addition & 1 deletion js/block-editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion php/class-delivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public function is_deliverable( $attachment_id ) {

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

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

Expand Down
17 changes: 14 additions & 3 deletions php/class-svg.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function allow_svg_for_cloudinary( $types ) {
* @return array
*/
public function remove_svg_eagers( $options, $attachment ) {
if ( 'image/svg+xml' === $attachment->post_mime_type ) {
if ( static::is_svg( $attachment->ID ) ) {
unset( $options['eager'], $options['eager_async'] );
}

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

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

if ( is_array( $result ) && 'image/svg+xml' === get_post_mime_type( $attachment_id ) ) {
if ( is_array( $result ) && static::is_svg( $attachment_id ) ) {
$file_path = get_post_meta( $attachment_id, '_wp_attached_file', true );
$meta = wp_get_attachment_metadata( $attachment_id );
if ( empty( $meta ) ) {
Expand Down Expand Up @@ -237,4 +237,15 @@ public function setup_hooks() {
// Add actions.
add_action( 'cloudinary_uploaded_asset', array( $this, 'maybe_setup_metadata' ), 10, 2 );
}

/**
* Check if an attachment is an SVG.
*
* @param int $attachment_id The attachment ID.
*
* @return bool
*/
public static function is_svg( $attachment_id ) {
return 'image/svg+xml' === get_post_mime_type( $attachment_id );
}
}
4 changes: 4 additions & 0 deletions src/css/components/_ui.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@
margin: 0 0 6px;
font-weight: 700;
}

.cloudinary-overwrite-transformations {
padding: 6px 0;
}
6 changes: 5 additions & 1 deletion src/js/components/featured-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ let FeaturedTransformationsToggle = ( props ) => {
<>
{ props.modalClass && (
<ToggleControl
label={ __( 'Overwrite Transformations', 'cloudinary' ) }
label={ __(
'Cloudinary overwrite Global Transformations',
'cloudinary'
) }
checked={ props.overwrite_featured_transformations }
onChange={ ( value ) => props.setOverwrite( value ) }
className="cloudinary-overwrite-transformations"
/>
) }
</>
Expand Down

0 comments on commit a4507da

Please sign in to comment.