Skip to content

Commit 7b2c65b

Browse files
committed
ensure correct value - defaults
1 parent 343539e commit 7b2c65b

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

php/class-media.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ public function image_srcset( $sources, $size_array, $image_src, $image_meta, $a
11451145

11461146
$image_meta['overwrite_transformations'] = ! empty( $image_meta['overwrite_transformations'] ) ? $image_meta['overwrite_transformations'] : false;
11471147

1148-
if ( $this->settings->get_setting( 'enable_breakpoints' )->get_value() && wp_image_matches_ratio( $image_meta['width'], $image_meta['height'], $size_array[0], $size_array[1] ) ) {
1148+
if ( 'on' === $this->settings->get_setting( 'enable_breakpoints' )->get_value() && wp_image_matches_ratio( $image_meta['width'], $image_meta['height'], $size_array[0], $size_array[1] ) ) {
11491149
$meta = $this->get_post_meta( $attachment_id, Sync::META_KEYS['breakpoints'], true );
11501150
if ( ! empty( $meta ) ) {
11511151
// Since srcset is primary and src is a fallback, we need to set the first srcset with the main image.
@@ -1718,7 +1718,7 @@ public function get_breakpoint_options( $attachment_id ) {
17181718
$breakpoints = array();
17191719
$settings = $this->settings->get_setting( self::MEDIA_SETTINGS_SLUG )->get_value();
17201720

1721-
if ( ! empty( $settings['enable_breakpoints'] ) && wp_attachment_is_image( $attachment_id ) ) {
1721+
if ( 'on' === $settings['enable_breakpoints'] && wp_attachment_is_image( $attachment_id ) ) {
17221722
$meta = wp_get_attachment_metadata( $attachment_id );
17231723
// Get meta image size if non exists.
17241724
if ( empty( $meta ) ) {

php/media/class-video.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,10 @@ public function filter_video_block_pre_render( $block, $source_block ) {
442442
*/
443443
public function default_video_transformations( $default ) {
444444

445-
if ( ! empty( $this->config['video_limit_bitrate'] ) ) {
445+
if ( 'on' === $this->config['video_limit_bitrate'] ) {
446446
$default['bit_rate'] = $this->config['video_bitrate'] . 'k';
447447
}
448-
if ( ! empty( $this->config['video_optimization'] ) && true === $this->config['video_optimization'] ) {
448+
if ( 'on' === $this->config['video_optimization'] ) {
449449
if ( 'auto' === $this->config['video_format'] ) {
450450
$default['fetch_format'] = 'auto';
451451
}

php/sync/class-upload-sync.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public function explicit_update( $attachment_id ) {
330330
*/
331331
public function update_breakpoints( $attachment_id, $breakpoints ) {
332332

333-
if ( ! empty( $this->plugin->settings->get_value( 'enable_breakpoints' ) ) ) {
333+
if ( 'on' === $this->plugin->settings->get_value( 'enable_breakpoints' ) ) {
334334
if ( ! empty( $breakpoints['responsive_breakpoints'] ) ) { // Images only.
335335
$this->media->update_post_meta( $attachment_id, Sync::META_KEYS['breakpoints'], $breakpoints['responsive_breakpoints'][0]['breakpoints'] );
336336
} elseif ( wp_attachment_is_image( $attachment_id ) ) {

ui-definitions/settings-image.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
'title' => __( 'Image breakpoints', 'cloudinary' ),
9292
'tooltip_text' => __( 'Automatically generate multiple sizes based on the configured breakpoints to enable your images to responsively adjust to different screen sizes. Note that your Cloudinary usage will increase when enabling responsive images.', 'cloudinary' ),
9393
'description' => __( 'Enable responsive images.', 'cloudinary' ),
94+
'default' => 'off',
9495
),
9596
array(
9697
'type' => 'group',

ui-definitions/settings-video.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
'default' => '500',
8686
'suffix' => 'k',
8787
'condition' => array(
88-
'video_limit_bitrate' => true,
88+
'video_limit_bitrate' => 'on',
8989
),
9090
'attributes' => array(
9191
'data-context' => 'video',
@@ -113,7 +113,7 @@
113113
'title' => __( 'Advanced optimization', 'cloudinary' ),
114114
'collapsible' => 'open',
115115
'condition' => array(
116-
'video_optimization' => true,
116+
'video_optimization' => 'on',
117117
),
118118
array(
119119
'type' => 'select',

0 commit comments

Comments
 (0)