@@ -633,7 +633,19 @@ public function attachment_url( $url, $attachment_id ) {
633633 if ( false !== $ previous_url ) {
634634 return substr ( $ url , $ previous_url );
635635 }
636- if ( ! doing_action ( 'wp_insert_post_data ' ) && false === $ this ->in_downsize ) {
636+ if (
637+ ! doing_action ( 'wp_insert_post_data ' )
638+ && false === $ this ->in_downsize
639+ /**
640+ * Filter doing upload.
641+ * If so, return the default attachment URL.
642+ *
643+ * @param bool Default false.
644+ *
645+ * @return bool
646+ */
647+ && ! apply_filters ( 'cloudinary_doing_upload ' , false )
648+ ) {
637649 if ( $ this ->cloudinary_id ( $ attachment_id ) ) {
638650 $ url = $ this ->cloudinary_url ( $ attachment_id );
639651 }
@@ -762,7 +774,7 @@ public function cloudinary_url( $attachment_id, $size = array(), $transformation
762774
763775 // Make a copy as not to destroy the options in \Cloudinary::cloudinary_url().
764776 $ args = $ pre_args ;
765- $ url = $ this ->plugin ->components ['connect ' ]->api ->cloudinary_url ( $ cloudinary_id , $ args , $ size, $ clean );
777+ $ url = $ this ->plugin ->components ['connect ' ]->api ->cloudinary_url ( $ cloudinary_id , $ args , $ size );
766778
767779 // Check if this type is a preview only type. i.e PDF.
768780 if ( ! empty ( $ size ) && $ this ->is_preview_only ( $ attachment_id ) ) {
@@ -1051,6 +1063,8 @@ public function image_srcset( $sources, $size_array, $image_src, $image_meta, $a
10511063 $ transformations = $ this ->get_post_meta ( $ attachment_id , Sync::META_KEYS ['transformation ' ], true );
10521064 // Use Cloudinary breakpoints for same ratio.
10531065
1066+ $ image_meta ['overwrite_transformations ' ] = ! empty ( $ image_meta ['overwrite_transformations ' ] ) ? $ image_meta ['overwrite_transformations ' ] : false ;
1067+
10541068 if ( 'on ' === $ this ->plugin ->config ['settings ' ]['global_transformations ' ]['enable_breakpoints ' ] && wp_image_matches_ratio ( $ image_meta ['width ' ], $ image_meta ['height ' ], $ size_array [0 ], $ size_array [1 ] ) ) {
10551069 $ meta = $ this ->get_post_meta ( $ attachment_id , Sync::META_KEYS ['breakpoints ' ], true );
10561070 if ( ! empty ( $ meta ) ) {
@@ -1676,12 +1690,22 @@ public function get_context_options( $attachment_id ) {
16761690 */
16771691 public function is_folder_synced ( $ attachment_id ) {
16781692
1679- $ return = true ; // By default all assets in WordPress will be synced.
1693+ $ is_folder_synced = true ; // By default all assets in WordPress will be synced.
16801694 if ( $ this ->sync ->been_synced ( $ attachment_id ) ) {
1681- $ return = ! empty ( $ this ->get_post_meta ( $ attachment_id , Sync::META_KEYS ['folder_sync ' ], true ) );
1695+ $ is_folder_synced = ! empty ( $ this ->get_post_meta ( $ attachment_id , Sync::META_KEYS ['folder_sync ' ], true ) );
16821696 }
16831697
1684- return $ return ;
1698+ /**
1699+ * Filter is folder synced flag.
1700+ *
1701+ * @param bool $is_folder_synced Flag value for is folder sync.
1702+ * @param int $attachment_id The attachment ID.
1703+ *
1704+ * @return bool
1705+ */
1706+ $ is_folder_synced = apply_filters ( 'cloudinary_is_folder_synced ' , $ is_folder_synced , $ attachment_id );
1707+
1708+ return (bool ) $ is_folder_synced ;
16851709 }
16861710
16871711 /**
0 commit comments