From ebe66ed2d6896eaf3c888a91f54abb57892f95ea Mon Sep 17 00:00:00 2001 From: David Cramer Date: Thu, 14 Apr 2022 11:38:13 +0200 Subject: [PATCH 1/2] active and enabled --- php/class-delivery-feature.php | 2 +- php/class-svg.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/php/class-delivery-feature.php b/php/class-delivery-feature.php index fc8101879..aff9f3549 100644 --- a/php/class-delivery-feature.php +++ b/php/class-delivery-feature.php @@ -166,7 +166,7 @@ public function enqueue_assets() { * @return bool */ public function is_enabled() { - return 'on' === $this->config[ $this->enable_slug ]; + return $this->is_active() && 'on' === $this->config[ $this->enable_slug ]; } /** diff --git a/php/class-svg.php b/php/class-svg.php index f9207150b..79809640b 100644 --- a/php/class-svg.php +++ b/php/class-svg.php @@ -207,6 +207,16 @@ public function maybe_setup_metadata( $attachment_id, $result ) { } } + /** + * Check if component is active. + * + * @return bool + */ + public function is_active() { + // It's always active if on. + return 'on' === $this->config[ $this->enable_slug ]; + } + /** * Setup the component */ From e7a0958115c1af51ec030343f49553d82fa4bda1 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Tue, 19 Apr 2022 13:04:39 +0200 Subject: [PATCH 2/2] convert ? to & --- php/class-delivery.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/php/class-delivery.php b/php/class-delivery.php index 4f4e91857..e1c7908e7 100644 --- a/php/class-delivery.php +++ b/php/class-delivery.php @@ -890,9 +890,11 @@ public function convert_tags( $content, $context = 'view' ) { if ( empty( $relation['public_id'] || $url === $relation['public_id'] ) ) { continue; // We don't need the public_id relation item. } - $base = $type . ':' . $url; - $public_id = ! is_admin() ? $relation['public_id'] . '.' . $relation['format'] : null; - $aliases[ $base ] = $this->media->cloudinary_url( $relation['post_id'], array(), $relation['transformations'], $public_id ); + $base = $type . ':' . $url; + $public_id = ! is_admin() ? $relation['public_id'] . '.' . $relation['format'] : null; + $cloudinary_url = $this->media->cloudinary_url( $relation['post_id'], array(), $relation['transformations'], $public_id ); + $aliases[ $base . '?' ] = $cloudinary_url . '&'; + $aliases[ $base ] = $cloudinary_url; } // Create the sized found relations second. @@ -909,7 +911,9 @@ public function convert_tags( $content, $context = 'view' ) { $aliases[ $local_url ] = $cached[ $local_url ]; continue; } - $aliases[ $local_url ] = $this->media->cloudinary_url( $relation['post_id'], explode( 'x', $size ), $relation['transformations'], $public_id ); + $cloudinary_url = $this->media->cloudinary_url( $relation['post_id'], explode( 'x', $size ), $relation['transformations'], $public_id ); + $aliases[ $local_url . '?' ] = $cloudinary_url . '&'; + $aliases[ $local_url ] = $cloudinary_url; } }