From 17257b0603eb158ccf63a7841c031fcf5af05f25 Mon Sep 17 00:00:00 2001 From: Dukagjin Surdulli Date: Mon, 6 Jul 2020 14:38:17 -0400 Subject: [PATCH 01/39] Make sure that "controls" takes the correct value --- .../php/media/class-video.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php index 8be5b68a5..c571925d3 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php @@ -348,7 +348,6 @@ public function print_video_scripts() { $default = array( 'publicId' => $cloudinary_id, 'sourceTypes' => array( $video['format'] ), // @todo Make this based on eager items as mentioned above. - 'controls' => 'on' === $this->config['video_controls'] ? true : false, 'autoplay' => 'off' !== $this->config['video_autoplay_mode'] ? true : false, 'loop' => 'on' === $this->config['video_loop'] ? true : false, ); @@ -359,11 +358,12 @@ public function print_video_scripts() { } $config = wp_parse_args( $video['args'], $default ); - + if ( empty( $config['size'] ) && ! empty( $config['transformation'] ) && ! $this->media->get_crop_from_transformation( $config['transformation'] ) ) { $config['fluid'] = true; } + $config['controls'] = 'on' === $this->config['video_controls']; $cld_videos[ $instance ] = $config; } From 29b097674c89e70a411f9a99c157f0e8fe7bdec2 Mon Sep 17 00:00:00 2001 From: Dukagjin Surdulli Date: Tue, 7 Jul 2020 15:22:49 -0400 Subject: [PATCH 02/39] Remove unslash when editing in Gutenberg --- .../php/media/class-filter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-filter.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-filter.php index 553b4117a..4bfab0b95 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-filter.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-filter.php @@ -524,7 +524,7 @@ public function pre_filter_rest_content( $response, $post, $request ) { $context = $request->get_param( 'context' ); if ( 'edit' === $context ) { $data = $response->get_data(); - $content = wp_unslash( $data['content']['raw'] ); + $content = $data['content']['raw']; $data['content']['raw'] = $this->filter_out_local( $content ); $response->set_data( $data ); From 58d32f9a7fd9acbb2b3663bc4bb2c451b858a8cb Mon Sep 17 00:00:00 2001 From: Dukagjin Surdulli Date: Tue, 14 Jul 2020 10:49:50 -0400 Subject: [PATCH 03/39] Increment player version to 1.4.0 --- .../php/media/class-video.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php index c571925d3..97557674b 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php @@ -52,7 +52,7 @@ class Video { * * @var string */ - const PLAYER_VER = '1.3.3'; + const PLAYER_VER = '1.4.0'; /** * Cloudinary Core Version. @@ -356,16 +356,15 @@ public function print_video_scripts() { if ( $default['autoplay'] && in_array( $this->config['video_autoplay_mode'], $valid_autoplay_modes, true ) ) { $default['autoplayMode'] = $this->config['video_autoplay_mode']; } - + $config = wp_parse_args( $video['args'], $default ); if ( empty( $config['size'] ) && ! empty( $config['transformation'] ) && ! $this->media->get_crop_from_transformation( $config['transformation'] ) ) { $config['fluid'] = true; } - - $config['controls'] = 'on' === $this->config['video_controls']; + + $config['controls'] = 'on' === $this->config['video_controls'] ? true : false; $cld_videos[ $instance ] = $config; - } if ( empty( $cld_videos ) ) { From 3833c243f9f51494a78dfb0b49b00aa3d5b6a2ab Mon Sep 17 00:00:00 2001 From: Dukagjin Surdulli Date: Tue, 14 Jul 2020 11:56:20 -0400 Subject: [PATCH 04/39] Upgrade core version --- .../php/media/class-video.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php index 97557674b..29e95bd05 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php @@ -59,7 +59,7 @@ class Video { * * @var string */ - const CORE_VER = '2.6.2'; + const CORE_VER = '2.6.3'; /** * Meta key to store usable video transformations for an attachment. @@ -356,9 +356,9 @@ public function print_video_scripts() { if ( $default['autoplay'] && in_array( $this->config['video_autoplay_mode'], $valid_autoplay_modes, true ) ) { $default['autoplayMode'] = $this->config['video_autoplay_mode']; } - + $config = wp_parse_args( $video['args'], $default ); - + if ( empty( $config['size'] ) && ! empty( $config['transformation'] ) && ! $this->media->get_crop_from_transformation( $config['transformation'] ) ) { $config['fluid'] = true; } From d6e799d01f2d1d66564dcfcac0e94bf61cfbb11c Mon Sep 17 00:00:00 2001 From: Dukagjin Surdulli Date: Thu, 16 Jul 2020 13:52:53 -0400 Subject: [PATCH 05/39] Add message warning users about muted autoplay --- .../tabs/settings-global-video-transformations.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-video-transformations.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-video-transformations.php index edbf2da54..6caa367cb 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-video-transformations.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-video-transformations.php @@ -60,6 +60,12 @@ 'condition' => array( 'video_player' => 'cld', ), + 'description' => sprintf( + // translators: Placeholders are tags. + __( 'Please note that when choosing "always", the video will autoplay without sound (muted). This is a built-in browser feature and applies to all major browsers.%1$sRead more about muted autoplay%2$s', 'cloudinary' ), + '
', + '', + ), ), 'video_loop' => array( From 412a38f873845d645d1beaa27324a14edc3cda64 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 22 Jul 2020 14:32:53 +0100 Subject: [PATCH 06/39] Add method to check is auto sync is enabled --- .../php/class-settings-page.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-settings-page.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-settings-page.php index 46d32d451..6a1c6200d 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-settings-page.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-settings-page.php @@ -913,4 +913,19 @@ public function set_active_page( $page_slug ) { $this->active_page = $page_slug; } } + + /** + * Checks if auto sync feature is enabled. + * + * @return bool + */ + public function is_auto_sync_enabled() { + $settings = $this->get_config(); + + if ( ! empty( $settings['sync_media']['auto_sync'] ) && 'on' === $settings['sync_media']['auto_sync'] ) { + return true; + } + + return false; + } } From f11d629dc9250e95dfc2ce3b67b33b6545107c78 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 22 Jul 2020 14:33:28 +0100 Subject: [PATCH 07/39] Leverage the new method to check if auto sync is enabled --- .../php/sync/class-upload-sync.php | 2 +- .../ui-definitions/tabs/sync-media-content.php | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-sync.php index b7a6022d7..0e7c2f7ed 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-sync.php @@ -167,7 +167,7 @@ public function handle_bulk_actions( $location, $action, $post_ids ) { * @return bool */ public function auto_sync_enabled( $enabled, $post_id ) { - if ( isset( $this->plugin->config['settings']['sync_media']['auto_sync'] ) && 'on' === $this->plugin->config['settings']['sync_media']['auto_sync'] ) { + if ( $this->plugin->components['settings']->is_auto_sync_enabled() ) { $enabled = true; } diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/sync-media-content.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/sync-media-content.php index 5aad4e476..a37756fc0 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/sync-media-content.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/sync-media-content.php @@ -5,10 +5,7 @@ * @package Cloudinary */ -$autosync = false; -if ( isset( $this->plugin->config['settings']['sync_media']['auto_sync'] ) && 'on' === $this->plugin->config['settings']['sync_media']['auto_sync'] ) { - $autosync = true; -} +$autosync = $this->plugin->components['settings']->is_auto_sync_enabled(); ?> plugin->config['connect'] ) ) : ?>
From b7a7ac608bf429815c3df52f6fb0b45b58d3276b Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 22 Jul 2020 14:33:57 +0100 Subject: [PATCH 08/39] Syncing flag should only be set if auto sync is enabled --- .../php/class-sync.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php index a33f2208f..7845b1904 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php @@ -109,7 +109,7 @@ public function is_synced( $post_id ) { return true; } - if ( apply_filters( 'cloudinary_flag_sync', '__return_false' ) && ! get_post_meta( $post_id, Sync::META_KEYS['downloading'], true ) ) { + if ( $this->plugin->components['settings']->is_auto_sync_enabled() && apply_filters( 'cloudinary_flag_sync', '__return_false' ) && ! get_post_meta( $post_id, Sync::META_KEYS['downloading'], true ) ) { update_post_meta( $post_id, Sync::META_KEYS['syncing'], true ); } From eb0e1144ccc077ea9f7d6abd50433caebc15f761 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Thu, 23 Jul 2020 08:01:44 +0200 Subject: [PATCH 09/39] add generate new public ID and check methods on sync --- .../php/class-sync.php | 24 +++++++++++++++++++ .../php/connect/class-api.php | 14 +++++++++++ .../php/sync/class-push-sync.php | 11 ++++++--- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php index a33f2208f..707f633f0 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php @@ -172,6 +172,30 @@ public function get_signature( $post_id ) { return $return; } + /** + * Generate a new Public ID for an asset. + * + * @param int $attachment_id The attachment ID for the new public ID. + * + * @return string + */ + public function generate_public_id( $attachment_id, $prefix = null ) { + $settings = $this->plugin->config['settings']; + $cld_folder = trailingslashit( $settings['sync_media']['cloudinary_folder'] ); + $file = get_attached_file( $attachment_id ); + $file_info = pathinfo( $file ); + $public_id = $cld_folder . $prefix . $file_info['filename']; + + $cld_asset = $this->plugin->components['connect']->api->get_asset_details( $public_id, 'image' ); + if ( ! is_wp_error( $cld_asset ) && ! empty( $cld_asset['public_id'] ) ) { + // Exists, generate a new ID with a prefix. + $prefix = uniqid() . '-'; + $public_id = $this->generate_public_id( $attachment_id, $prefix ); + } + + return $public_id; + } + /** * Additional component setup. */ diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/connect/class-api.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/connect/class-api.php index 279a7da93..08d80d6ec 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/connect/class-api.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/connect/class-api.php @@ -269,6 +269,20 @@ public function cloudinary_url( $public_id, $args = array(), $size = array(), $c return implode( '/', $url_parts ); } + /** + * Get the details of an asset by public ID. + * + * @param string $public_id The public_id to check. + * @param string $type The asset type. + * + * @return array|\WP_Error + */ + public function get_asset_details( $public_id, $type ) { + $url = $this->url( 'resources', $type . '/upload/' . $public_id, true ); + + return $this->call( $url, array( 'body' => $args ), 'get' ); + } + /** * Upload a large asset in chunks. * diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php index 09ef6f25d..c39fb9442 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php @@ -331,11 +331,11 @@ private function get_sync_type( $attachment ) { * Prepare an attachment for upload. * * @param int|\WP_Post $post The attachment to prepare. - * @param bool $down_sync Flag to determine if a missing file starts a downsync. + * @param bool $push_sync Flag to determine if this prep is for a sync. True = build for syncing, false = build for validation. * * @return array|\WP_Error */ - public function prepare_upload( $post, $down_sync = false ) { + public function prepare_upload( $post, $push_sync = false ) { if ( is_numeric( $post ) ) { $post = get_post( $post ); @@ -365,7 +365,7 @@ public function prepare_upload( $post, $down_sync = false ) { $src = get_post_meta( $post->ID, '_wp_attached_file', true ); if ( $media->is_cloudinary_url( $src ) ) { // Download first maybe. - if ( true === $down_sync ) { + if ( true === $push_sync ) { $download = $this->plugin->components['sync']->managers['download']->down_sync( $post->ID ); if ( is_wp_error( $download ) ) { update_post_meta( $post->ID, Sync::META_KEYS['sync_error'], $download->get_error_message() ); @@ -403,8 +403,13 @@ public function prepare_upload( $post, $down_sync = false ) { $public_id = $post->{Sync::META_KEYS['public_id']}; // use the __get method on the \WP_Post to get post_meta. $cld_folder = trailingslashit( $settings['sync_media']['cloudinary_folder'] ); if ( empty( $public_id ) ) { + // Build a default ID. $file_info = pathinfo( $file ); $public_id = $cld_folder . $file_info['filename']; + // Check if this is a sync prep. If so, generate a safe ID. + if ( true === $push_sync ) { + $public_id = $this->plugin->components['sync']->generate_public_id( $post->ID ); + } } // Assume that the public_id is a root item. From c2f5f7ef26382d34cdb113586696472e96640dd5 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Thu, 23 Jul 2020 08:29:13 +0200 Subject: [PATCH 10/39] add generate new public ID if image, video, or audio only --- .../php/class-sync.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php index 707f633f0..09afc3647 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php @@ -177,7 +177,7 @@ public function get_signature( $post_id ) { * * @param int $attachment_id The attachment ID for the new public ID. * - * @return string + * @return string|null */ public function generate_public_id( $attachment_id, $prefix = null ) { $settings = $this->plugin->config['settings']; @@ -185,10 +185,20 @@ public function generate_public_id( $attachment_id, $prefix = null ) { $file = get_attached_file( $attachment_id ); $file_info = pathinfo( $file ); $public_id = $cld_folder . $prefix . $file_info['filename']; - - $cld_asset = $this->plugin->components['connect']->api->get_asset_details( $public_id, 'image' ); + // Get the type. + if ( wp_attachment_is( 'image', $attachment_id ) ) { + $type = 'image'; + } elseif ( wp_attachment_is( 'video', $attachment_id ) ) { + $type = 'video'; + } elseif ( wp_attachment_is( 'video', $attachment_id ) ) { + $type = 'audio'; + } else { + // not supported. + return null; + } + $cld_asset = $this->plugin->components['connect']->api->get_asset_details( $public_id, $type ); if ( ! is_wp_error( $cld_asset ) && ! empty( $cld_asset['public_id'] ) ) { - // Exists, generate a new ID with a prefix. + // Exists, generate a new ID with a uniqueID prefix. $prefix = uniqid() . '-'; $public_id = $this->generate_public_id( $attachment_id, $prefix ); } From 8422db947dc2d5ca680a1b770a190d0f18f8f65b Mon Sep 17 00:00:00 2001 From: David Cramer Date: Thu, 23 Jul 2020 08:48:29 +0200 Subject: [PATCH 11/39] shorten component usage --- .../php/sync/class-push-sync.php | 101 +++++++++++------- 1 file changed, 65 insertions(+), 36 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php index c39fb9442..d1cac64c1 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php @@ -47,6 +47,34 @@ class Push_Sync { */ protected $post_id; + /** + * Holds the media component. + * + * @var \Cloudinary\Media + */ + protected $media; + + /** + * Holds the sync component. + * + * @var \Cloudinary\Sync\ + */ + protected $sync; + + /** + * Holds the connect component. + * + * @var \Cloudinary\Connect + */ + protected $connect; + + /** + * Holds the Rest_API component. + * + * @var \Cloudinary\REST_API + */ + protected $api; + /** * Push_Sync constructor. * @@ -55,6 +83,12 @@ class Push_Sync { public function __construct( \Cloudinary\Plugin $plugin ) { $this->plugin = $plugin; + // Setup components. + $this->media = $this->plugin->components['media']; + $this->sync = $this->plugin->components['sync']; + $this->connect = $this->plugin->components['connect']; + $this->api = $this->plugin->components['api']; + // Define the sync types and their option keys. $sync_types = array( 'cloud_name' => 'upload', @@ -143,7 +177,7 @@ public function rest_get_queue_status() { return rest_ensure_response( array( 'success' => true, - 'data' => $this->plugin->components['sync']->managers['queue']->get_queue_status(), + 'data' => $this->sync->managers['queue']->get_queue_status(), ) ); } @@ -158,13 +192,13 @@ public function rest_get_queue_status() { public function rest_start_sync( \WP_REST_Request $request ) { $stop = $request->get_param( 'stop' ); - $queue = $this->plugin->components['sync']->managers['queue']->get_queue(); + $queue = $this->sync->managers['queue']->get_queue(); if ( empty( $queue['pending'] ) || ! empty( $stop ) ) { - $this->plugin->components['sync']->managers['queue']->stop_queue(); + $this->sync->managers['queue']->stop_queue(); return $this->rest_get_queue_status(); // Nothing to sync. } - $this->plugin->components['sync']->managers['queue']->start_queue(); + $this->sync->managers['queue']->start_queue(); return $this->call_thread(); @@ -202,18 +236,18 @@ public function rest_push_attachments( \WP_REST_Request $request ) { // Process queue based. if ( ! empty( $last_id ) && ! empty( $last_result ) ) { - $this->plugin->components['sync']->managers['queue']->mark( $last_id, $last_result ); + $this->sync->managers['queue']->mark( $last_id, $last_result ); } - if ( ! $this->plugin->components['sync']->managers['queue']->is_running() ) { // Check it wasn't stopped. + if ( ! $this->sync->managers['queue']->is_running() ) { // Check it wasn't stopped. return $this->rest_get_queue_status(); } - $this->post_id = $this->plugin->components['sync']->managers['queue']->get_post(); + $this->post_id = $this->sync->managers['queue']->get_post(); // No post, end of queue. if ( empty( $this->post_id ) ) { - $this->plugin->components['sync']->managers['queue']->stop_queue(); + $this->sync->managers['queue']->stop_queue(); return $this->rest_get_queue_status(); } @@ -233,7 +267,7 @@ public function resume_queue() { add_filter( 'cloudinary_on_demand_sync_enabled', '__return_false' ); // Disable the on-demand sync since we want the status. define( 'DOING_BULK_SYNC', true ); // Define bulk sync in action. - if ( ! $this->plugin->components['sync']->is_synced( $this->post_id ) ) { + if ( ! $this->sync->is_synced( $this->post_id ) ) { $stat = $this->push_attachments( array( $this->post_id ) ); if ( ! empty( $stat['processed'] ) ) { $result = 'done'; @@ -269,7 +303,7 @@ private function call_thread( $last_id = null, $last_result = null ) { } // Setup background call to continue the queue. - $this->plugin->components['api']->background_request( 'process', $params ); + $this->api->background_request( 'process', $params ); return $this->rest_get_queue_status(); } @@ -304,7 +338,7 @@ private function get_sync_type( $attachment ) { $type = 'upload'; // Check for explicit (has public_id, but no breakpoints). - $attachment_signature = $this->plugin->components['sync']->get_signature( $attachment->ID ); + $attachment_signature = $this->sync->get_signature( $attachment->ID ); if ( empty( $attachment_signature ) ) { if ( ! empty( $attachment->{Sync::META_KEYS['public_id']} ) ) { // Has a public id but no signature, explicit update to complete download. @@ -313,7 +347,7 @@ private function get_sync_type( $attachment ) { // fallback to upload. } else { // Has signature find differences and use specific sync method. - $required_signature = $this->plugin->components['sync']->generate_signature( $attachment->ID ); + $required_signature = $this->sync->generate_signature( $attachment->ID ); foreach ( $required_signature as $key => $signature ) { if ( ( ! isset( $attachment_signature[ $key ] ) || $attachment_signature[ $key ] !== $signature ) && isset( $this->sync_types[ $key ] ) ) { return $this->sync_types[ $key ]; @@ -351,9 +385,6 @@ public function prepare_upload( $post, $push_sync = false ) { return new \WP_Error( 'attachment_post_expected', __( 'An attachment post was expected.', 'cloudinary' ) ); } - // Get the media component. - $media = $this->plugin->components['media']; - // First check if this has a file and it can be uploaded. $file = get_attached_file( $post->ID ); $file_size = 0; @@ -363,10 +394,10 @@ public function prepare_upload( $post, $push_sync = false ) { } elseif ( ! file_exists( $file ) ) { // May be an old upload type. $src = get_post_meta( $post->ID, '_wp_attached_file', true ); - if ( $media->is_cloudinary_url( $src ) ) { + if ( $this->media->is_cloudinary_url( $src ) ) { // Download first maybe. if ( true === $push_sync ) { - $download = $this->plugin->components['sync']->managers['download']->down_sync( $post->ID ); + $download = $this->sync->managers['download']->down_sync( $post->ID ); if ( is_wp_error( $download ) ) { update_post_meta( $post->ID, Sync::META_KEYS['sync_error'], $download->get_error_message() ); @@ -384,12 +415,12 @@ public function prepare_upload( $post, $push_sync = false ) { $resource_type = $this->get_resource_type( $post ); $max_size = ( 'image' === $resource_type ? 'max_image_size' : 'max_video_size' ); - if ( ! empty( $this->plugin->components['connect']->usage[ $max_size ] ) && $file_size > $this->plugin->components['connect']->usage[ $max_size ] ) { - $max_size_hr = size_format( $this->plugin->components['connect']->usage[ $max_size ] ); + if ( ! empty( $this->connect->usage[ $max_size ] ) && $file_size > $this->connect->usage[ $max_size ] ) { + $max_size_hr = size_format( $this->connect->usage[ $max_size ] ); // translators: variable is file size. $error = sprintf( __( 'File size exceeds the maximum of %s. This media asset will be served from WordPress.', 'cloudinary' ), $max_size_hr ); - $media->delete_post_meta( $post->ID, Sync::META_KEYS['pending'] ); // Remove Flag. + $this->media->delete_post_meta( $post->ID, Sync::META_KEYS['pending'] ); // Remove Flag. // Cleanup flags delete_post_meta( $post->ID, Sync::META_KEYS['syncing'] ); @@ -408,7 +439,7 @@ public function prepare_upload( $post, $push_sync = false ) { $public_id = $cld_folder . $file_info['filename']; // Check if this is a sync prep. If so, generate a safe ID. if ( true === $push_sync ) { - $public_id = $this->plugin->components['sync']->generate_public_id( $post->ID ); + $public_id = $this->sync->generate_public_id( $post->ID ); } } @@ -424,7 +455,7 @@ public function prepare_upload( $post, $push_sync = false ) { $public_id_file = $public_id_info['filename']; } // Check if this asset is a folder sync. - $folder_sync = $media->get_post_meta( $post->ID, Sync::META_KEYS['folder_sync'], true ); + $folder_sync = $this->media->get_post_meta( $post->ID, Sync::META_KEYS['folder_sync'], true ); if ( ! empty( $folder_sync ) && false === $downsync ) { $public_id_folder = $cld_folder; // Ensure the public ID folder is constant. } else { @@ -457,7 +488,7 @@ public function prepare_upload( $post, $push_sync = false ) { $imagesize = getimagesize( $file ); $meta['width'] = $imagesize[0]; } - $max_width = $media->get_max_width(); + $max_width = $this->media->get_max_width(); // Add breakpoints request options. if ( ! empty( $settings['global_transformations']['enable_breakpoints'] ) ) { $options['responsive_breakpoints'] = array( @@ -467,7 +498,7 @@ public function prepare_upload( $post, $push_sync = false ) { 'max_width' => $meta['width'] < $max_width ? $meta['width'] : $max_width, 'min_width' => $settings['global_transformations']['min_width'], ); - $transformations = $media->get_transformation_from_meta( $post->ID ); + $transformations = $this->media->get_transformation_from_meta( $post->ID ); if ( ! empty( $transformations ) ) { $options['responsive_breakpoints']['transformation'] = Api::generate_transformation_string( $transformations ); } @@ -547,8 +578,6 @@ public function push_attachments( $attachments ) { 'total' => count( $attachments ), 'processed' => 0, ); - // Get media component. - $media = $this->plugin->components['media']; // Go over each attachment. foreach ( $attachments as $attachment ) { @@ -602,48 +631,48 @@ public function push_attachments( $attachments ) { if ( ! empty( $upload['options']['context'] ) ) { $args['context'] = $upload['options']['context']; } - $result = $this->plugin->components['connect']->api->explicit( $args ); + $result = $this->connect->api->explicit( $args ); } elseif ( 'rename' === $sync_type ) { // Rename an asset. $args = array( - 'from_public_id' => $media->get_post_meta( $attachment->ID, Sync::META_KEYS['public_id'] ), + 'from_public_id' => $this->media->get_post_meta( $attachment->ID, Sync::META_KEYS['public_id'] ), 'to_public_id' => $upload['public_id'], ); - $result = $this->plugin->components['connect']->api->{$upload['options']['resource_type']}( 'rename', 'POST', $args ); + $result = $this->connect->api->{$upload['options']['resource_type']}( 'rename', 'POST', $args ); } else { // dynamic sync type.. - $result = $this->plugin->components['connect']->api->{$sync_type}( $upload['file'], $upload['options'] ); + $result = $this->connect->api->{$sync_type}( $upload['file'], $upload['options'] ); } } else { // Large Upload. - $result = $this->plugin->components['connect']->api->upload_large( $upload['file'], $upload['options'] ); + $result = $this->connect->api->upload_large( $upload['file'], $upload['options'] ); } // Exceptions are handled by the Upload wrapper class and returned as \WP_Error, so check for it. if ( is_wp_error( $result ) ) { $error = $result->get_error_message(); $stats['fail'][] = $error; - $media->update_post_meta( $attachment->ID, Sync::META_KEYS['sync_error'], $error ); + $this->media->update_post_meta( $attachment->ID, Sync::META_KEYS['sync_error'], $error ); continue; } // Successful upload, so lets update meta. if ( is_array( $result ) && ( array_key_exists( 'public_id', $result ) || array_key_exists( 'public_ids', $result ) ) ) { $meta_data = array( - Sync::META_KEYS['signature'] => $this->plugin->components['sync']->generate_signature( $attachment->ID ), + Sync::META_KEYS['signature'] => $this->sync->generate_signature( $attachment->ID ), ); // We only have a version if updating a file or an upload. if ( ! empty( $result['version'] ) ) { $meta_data[ Sync::META_KEYS['version'] ] = $result['version']; } - $media->delete_post_meta( $attachment->ID, Sync::META_KEYS['pending'] ); + $this->media->delete_post_meta( $attachment->ID, Sync::META_KEYS['pending'] ); // Cleanup flags delete_post_meta( $attachment->ID, Sync::META_KEYS['downloading'] ); delete_post_meta( $attachment->ID, Sync::META_KEYS['syncing'] ); - $media->delete_post_meta( $attachment->ID, Sync::META_KEYS['sync_error'], false ); + $this->media->delete_post_meta( $attachment->ID, Sync::META_KEYS['sync_error'], false ); if ( ! empty( $this->plugin->config['settings']['global_transformations']['enable_breakpoints'] ) ) { if ( ! empty( $result['responsive_breakpoints'] ) ) { // Images only. $meta_data[ Sync::META_KEYS['breakpoints'] ] = $result['responsive_breakpoints'][0]['breakpoints']; @@ -664,7 +693,7 @@ public function push_attachments( $attachments ) { $meta = wp_get_attachment_metadata( $attachment->ID, true ); $meta[ Sync::META_KEYS['cloudinary'] ] = $meta_data; wp_update_attachment_metadata( $attachment->ID, $meta ); - $media->update_post_meta( $attachment->ID, Sync::META_KEYS['public_id'], $upload['options']['public_id'] ); + $this->media->update_post_meta( $attachment->ID, Sync::META_KEYS['public_id'], $upload['options']['public_id'] ); // Search and update link references in content. $content_search = new \WP_Query( array( 's' => 'wp-image-' . $attachment->ID, 'fields' => 'ids', 'posts_per_page' => 1000 ) ); if ( ! empty( $content_search->found_posts ) ) { From 6fb302df20fa1c8b295eed50a062e23b55fbb2db Mon Sep 17 00:00:00 2001 From: David Cramer Date: Thu, 23 Jul 2020 08:52:57 +0200 Subject: [PATCH 12/39] setup component --- .../php/class-sync.php | 1 + .../php/sync/class-push-sync.php | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php index 09afc3647..be2cfbcfa 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php @@ -213,6 +213,7 @@ public function setup() { if ( $this->plugin->config['connect'] ) { $this->managers['upload']->setup(); $this->managers['delete']->setup(); + $this->managers['push']->setup(); } } } diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php index d1cac64c1..dbebab742 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php @@ -83,12 +83,6 @@ class Push_Sync { public function __construct( \Cloudinary\Plugin $plugin ) { $this->plugin = $plugin; - // Setup components. - $this->media = $this->plugin->components['media']; - $this->sync = $this->plugin->components['sync']; - $this->connect = $this->plugin->components['connect']; - $this->api = $this->plugin->components['api']; - // Define the sync types and their option keys. $sync_types = array( 'cloud_name' => 'upload', @@ -110,6 +104,17 @@ private function register_hooks() { add_filter( 'cloudinary_api_rest_endpoints', array( $this, 'rest_endpoints' ) ); } + /** + * Setup this component. + */ + public function setup(){ + // Setup components. + $this->media = $this->plugin->components['media']; + $this->sync = $this->plugin->components['sync']; + $this->connect = $this->plugin->components['connect']; + $this->api = $this->plugin->components['api']; + } + /** * Add endpoints to the \Cloudinary\REST_API::$endpoints array. * From f15528912d57fb90b6d5b18f3277c8f3fc3cc7ad Mon Sep 17 00:00:00 2001 From: David Cramer Date: Thu, 23 Jul 2020 09:14:58 +0200 Subject: [PATCH 13/39] catch context ID to attempt a reconnection rather than generating a new ID --- .../php/class-sync.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php index be2cfbcfa..c0b2e9d79 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php @@ -198,9 +198,19 @@ public function generate_public_id( $attachment_id, $prefix = null ) { } $cld_asset = $this->plugin->components['connect']->api->get_asset_details( $public_id, $type ); if ( ! is_wp_error( $cld_asset ) && ! empty( $cld_asset['public_id'] ) ) { - // Exists, generate a new ID with a uniqueID prefix. - $prefix = uniqid() . '-'; - $public_id = $this->generate_public_id( $attachment_id, $prefix ); + $context_id = null; + + // Exists, check to see if this asset originally belongs to this ID. + if ( ! empty( $cld_asset['context'] ) && ! empty( $cld_asset['context']['custom'] ) && ! empty( $cld_asset['context']['custom']['wp_id'] ) ) { + $context_id = (int) $cld_asset['context']['custom']['wp_id']; + } + + // Generate new ID only if context ID is not related. + if ( $context_id !== $attachment_id ) { + // Generate a new ID with a uniqueID prefix. + $prefix = uniqid() . '-'; + $public_id = $this->generate_public_id( $attachment_id, $prefix ); + } } return $public_id; From b0c00e4f2d14dbb3305d85e15fad96428f691a60 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Thu, 23 Jul 2020 11:29:39 +0100 Subject: [PATCH 14/39] Make the assets upgrade mechanism more resilient --- .../php/media/class-upgrade.php | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-upgrade.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-upgrade.php index 0733bf599..29430a9c4 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-upgrade.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-upgrade.php @@ -34,6 +34,20 @@ class Upgrade { */ private $sync; + /** + * The cron frequency to ensure that the queue is progressing. + * + * @var int + */ + protected $cron_frequency; + + /** + * The cron offset since the last update. + * + * @var int + */ + protected $cron_start_offset; + /** * Filter constructor. * @@ -42,6 +56,10 @@ class Upgrade { public function __construct( \Cloudinary\Media $media ) { $this->media = $media; $this->sync = $media->plugin->components['sync']; + + $this->cron_frequency = apply_filters( 'cloudinary_cron_frequency', 600 ); + $this->cron_start_offset = apply_filters( 'cloudinary_cron_start_offset', 60 ); + $this->setup_hooks(); } @@ -167,6 +185,10 @@ function ( $val ) use ( $media ) { update_post_meta( $attachment_id, Sync::META_KEYS['downloading'], true ); delete_post_meta( $attachment_id, Sync::META_KEYS['syncing'] ); + if ( ! wp_next_scheduled( 'cloudinary_resume_upgrade' ) ) { + wp_schedule_single_event( time() + $this->cron_frequency, 'cloudinary_resume_upgrade' ); + } + if ( ! defined( 'DOING_BULK_SYNC' ) ) { $this->sync->managers['upload']->add_to_sync( $attachment_id ); // Auto sync if upgrading outside of bulk sync. } @@ -174,6 +196,33 @@ function ( $val ) use ( $media ) { return $public_id; } + /** + * Maybe resume the upgrading assets. + * This is a fallback mechanism to resume the upgrade when it stops unexpectedly. + * + * @return void + */ + public function maybe_resume_upgrade() { + global $wpdb; + + $assets = $wpdb->get_col( // phpcs:ignore WordPress.DB.DirectDatabaseQuery + $wpdb->prepare( + "SELECT post_id + FROM $wpdb->postmeta + WHERE meta_key = %s", + Sync::META_KEYS['downloading'] + ) + ); + + if ( ! empty( $assets ) ) { + wp_schedule_single_event( time() + $this->cron_frequency, 'cloudinary_resume_upgrade' ); + + foreach ( $assets as $asset ) { + $this->sync->managers['upload']->add_to_sync( $asset ); + } + } + } + /** * Setup hooks for the filters. */ @@ -193,5 +242,7 @@ public function setup_hooks() { } } ); } + + add_action( 'cloudinary_resume_upgrade', array( $this, 'maybe_resume_upgrade' ) ); } } From a99ea464e438df56a17089c076130f7013dc86e8 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Thu, 23 Jul 2020 17:19:46 +0200 Subject: [PATCH 15/39] Address issues --- .../php/class-sync.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php index c0b2e9d79..4e13ae342 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php @@ -175,7 +175,8 @@ public function get_signature( $post_id ) { /** * Generate a new Public ID for an asset. * - * @param int $attachment_id The attachment ID for the new public ID. + * @param int $attachment_id The attachment ID for the new public ID. + * @param string $suffix The suffic to prepend the ID. * * @return string|null */ @@ -190,7 +191,7 @@ public function generate_public_id( $attachment_id, $prefix = null ) { $type = 'image'; } elseif ( wp_attachment_is( 'video', $attachment_id ) ) { $type = 'video'; - } elseif ( wp_attachment_is( 'video', $attachment_id ) ) { + } elseif ( wp_attachment_is( 'audio', $attachment_id ) ) { $type = 'audio'; } else { // not supported. From ab1d698f556114aba98531c596c38df78e4dd409 Mon Sep 17 00:00:00 2001 From: Dukagjin Surdulli Date: Thu, 23 Jul 2020 11:40:48 -0400 Subject: [PATCH 16/39] Add 'muted' attribute if autoplay is on (required by browsers) --- .../php/media/class-video.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php index 29e95bd05..b27a5b167 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-video.php @@ -220,6 +220,7 @@ public function filter_video_shortcode( $html, $attr ) { if ( isset( $attr['autoplay'] ) ) { $args['autoplay'] = 'true' === $attr['autoplay']; + $args['muted'] = 'true' === $attr['autoplay']; } if ( isset( $attr['loop'] ) ) { $args['loop'] = 'true' === $attr['loop']; @@ -285,6 +286,7 @@ public function filter_video_tags( $content ) { // Enable Autoplay for this video. if ( false !== strpos( $tag, 'autoplay' ) ) { $args['autoplayMode'] = $this->config['video_autoplay_mode']; // if on, use defined mode. + $args['muted'] = 'always' === $this->config['video_autoplay_mode']; } // Enable Loop. if ( false !== strpos( $tag, 'loop' ) ) { From 7b7d3ad0cf5263a5c154b24547774126562961f1 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Fri, 24 Jul 2020 08:40:23 +0200 Subject: [PATCH 17/39] check file existance over fetch details, change prefix to suffix --- .../php/class-sync.php | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php index 4e13ae342..3aeaa7c89 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php @@ -175,17 +175,17 @@ public function get_signature( $post_id ) { /** * Generate a new Public ID for an asset. * - * @param int $attachment_id The attachment ID for the new public ID. - * @param string $suffix The suffic to prepend the ID. + * @param int $attachment_id The attachment ID for the new public ID. + * @param string|null $suffix The suffix to prepend the ID. * * @return string|null */ - public function generate_public_id( $attachment_id, $prefix = null ) { + public function generate_public_id( $attachment_id, $suffix = null ) { $settings = $this->plugin->config['settings']; $cld_folder = trailingslashit( $settings['sync_media']['cloudinary_folder'] ); $file = get_attached_file( $attachment_id ); $file_info = pathinfo( $file ); - $public_id = $cld_folder . $prefix . $file_info['filename']; + $public_id = $cld_folder . $file_info['filename'] . $suffix; // Get the type. if ( wp_attachment_is( 'image', $attachment_id ) ) { $type = 'image'; @@ -197,20 +197,30 @@ public function generate_public_id( $attachment_id, $prefix = null ) { // not supported. return null; } - $cld_asset = $this->plugin->components['connect']->api->get_asset_details( $public_id, $type ); - if ( ! is_wp_error( $cld_asset ) && ! empty( $cld_asset['public_id'] ) ) { - $context_id = null; - // Exists, check to see if this asset originally belongs to this ID. - if ( ! empty( $cld_asset['context'] ) && ! empty( $cld_asset['context']['custom'] ) && ! empty( $cld_asset['context']['custom']['wp_id'] ) ) { - $context_id = (int) $cld_asset['context']['custom']['wp_id']; - } + // Test if asset exists by calling just the head on the asset url, to prevent API rate limits. + $url = $this->plugin->components['connect']->api->cloudinary_url( $public_id ); + $req = wp_remote_head( $url, array( 'body' => array( 'rdm' => wp_rand( 100, 999 ) ) ) ); + $asset_error = strtolower( wp_remote_retrieve_header( $req, 'x-cld-error' ) ); + $code = wp_remote_retrieve_response_code( $req ); + + // If the request is not a 404 & does not have a cld-error header stating resource not found, it exists and should be checked that it's not a resync or generate a prefixed ID. + if ( 404 !== $code && false === strpos( $asset_error, 'resource not found' ) ) { + $cld_asset = $this->plugin->components['connect']->api->get_asset_details( $public_id, $type ); + if ( ! is_wp_error( $cld_asset ) && ! empty( $cld_asset['public_id'] ) ) { + $context_id = null; + + // Exists, check to see if this asset originally belongs to this ID. + if ( ! empty( $cld_asset['context'] ) && ! empty( $cld_asset['context']['custom'] ) && ! empty( $cld_asset['context']['custom']['wp_id'] ) ) { + $context_id = (int) $cld_asset['context']['custom']['wp_id']; + } - // Generate new ID only if context ID is not related. - if ( $context_id !== $attachment_id ) { - // Generate a new ID with a uniqueID prefix. - $prefix = uniqid() . '-'; - $public_id = $this->generate_public_id( $attachment_id, $prefix ); + // Generate new ID only if context ID is not related. + if ( $context_id !== $attachment_id ) { + // Generate a new ID with a uniqueID prefix. + $suffix = '-' . uniqid(); + $public_id = $this->generate_public_id( $attachment_id, $suffix ); + } } } From 28aa354bceec88fe2d711670318c0fc8cc68c767 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Fri, 24 Jul 2020 14:10:01 +0200 Subject: [PATCH 18/39] split process to make sure the ID is unique after filtering. --- .../php/class-sync.php | 54 ++++++++++++------- .../php/sync/class-push-sync.php | 17 +++--- 2 files changed, 43 insertions(+), 28 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php index 3aeaa7c89..deb8f1d80 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php @@ -175,37 +175,51 @@ public function get_signature( $post_id ) { /** * Generate a new Public ID for an asset. * - * @param int $attachment_id The attachment ID for the new public ID. - * @param string|null $suffix The suffix to prepend the ID. + * @param int $attachment_id The attachment ID for the new public ID. * * @return string|null */ - public function generate_public_id( $attachment_id, $suffix = null ) { + public function generate_public_id( $attachment_id ) { $settings = $this->plugin->config['settings']; $cld_folder = trailingslashit( $settings['sync_media']['cloudinary_folder'] ); $file = get_attached_file( $attachment_id ); $file_info = pathinfo( $file ); - $public_id = $cld_folder . $file_info['filename'] . $suffix; - // Get the type. - if ( wp_attachment_is( 'image', $attachment_id ) ) { - $type = 'image'; - } elseif ( wp_attachment_is( 'video', $attachment_id ) ) { - $type = 'video'; - } elseif ( wp_attachment_is( 'audio', $attachment_id ) ) { - $type = 'audio'; - } else { - // not supported. - return null; - } + $public_id = $cld_folder . $file_info['filename']; + + return $public_id; + } + + /** + * Maybe add a suffix to the public ID if it's not unique. + * + * @param string $public_id The public ID to maybe add a suffix. + * @param int $attachment_id The attachment ID. + * @param string|null $suffix The suffix to maybe add. + * + * @return string The public ID. + */ + public function add_suffix_maybe( $public_id, $attachment_id, $suffix = null ) { // Test if asset exists by calling just the head on the asset url, to prevent API rate limits. - $url = $this->plugin->components['connect']->api->cloudinary_url( $public_id ); + $url = $this->plugin->components['connect']->api->cloudinary_url( $public_id . $suffix ); $req = wp_remote_head( $url, array( 'body' => array( 'rdm' => wp_rand( 100, 999 ) ) ) ); $asset_error = strtolower( wp_remote_retrieve_header( $req, 'x-cld-error' ) ); $code = wp_remote_retrieve_response_code( $req ); // If the request is not a 404 & does not have a cld-error header stating resource not found, it exists and should be checked that it's not a resync or generate a prefixed ID. if ( 404 !== $code && false === strpos( $asset_error, 'resource not found' ) ) { + + // Get the attachment type. + if ( wp_attachment_is( 'image', $attachment_id ) ) { + $type = 'image'; + } elseif ( wp_attachment_is( 'video', $attachment_id ) ) { + $type = 'video'; + } elseif ( wp_attachment_is( 'audio', $attachment_id ) ) { + $type = 'audio'; + } else { + // not supported. + return null; + } $cld_asset = $this->plugin->components['connect']->api->get_asset_details( $public_id, $type ); if ( ! is_wp_error( $cld_asset ) && ! empty( $cld_asset['public_id'] ) ) { $context_id = null; @@ -218,13 +232,15 @@ public function generate_public_id( $attachment_id, $suffix = null ) { // Generate new ID only if context ID is not related. if ( $context_id !== $attachment_id ) { // Generate a new ID with a uniqueID prefix. - $suffix = '-' . uniqid(); - $public_id = $this->generate_public_id( $attachment_id, $suffix ); + $suffix = '-' . uniqid(); + + // Return new potential suffixed ID. + return $this->add_suffix_maybe( $public_id, $attachment_id, $suffix ); } } } - return $public_id; + return $public_id . $suffix; } /** diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php index dbebab742..cbb881ae0 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php @@ -107,7 +107,7 @@ private function register_hooks() { /** * Setup this component. */ - public function setup(){ + public function setup() { // Setup components. $this->media = $this->plugin->components['media']; $this->sync = $this->plugin->components['sync']; @@ -439,13 +439,8 @@ public function prepare_upload( $post, $push_sync = false ) { $public_id = $post->{Sync::META_KEYS['public_id']}; // use the __get method on the \WP_Post to get post_meta. $cld_folder = trailingslashit( $settings['sync_media']['cloudinary_folder'] ); if ( empty( $public_id ) ) { - // Build a default ID. - $file_info = pathinfo( $file ); - $public_id = $cld_folder . $file_info['filename']; - // Check if this is a sync prep. If so, generate a safe ID. - if ( true === $push_sync ) { - $public_id = $this->sync->generate_public_id( $post->ID ); - } + // Create a new public_id. + $public_id = $this->sync->generate_public_id( $post->ID ); } // Assume that the public_id is a root item. @@ -534,7 +529,11 @@ public function prepare_upload( $post, $push_sync = false ) { } // Restructure the path to the filename to allow correct placement in Cloudinary. - $public_id = ltrim( $public_id_folder . $options['public_id'], '/' ); + $public_id = ltrim( $public_id_folder . $options['public_id'], '/' ); + // If this is a push sync, make sure the ID is allowed and unique. + if ( true === $push_sync ) { + $public_id = $this->sync->add_suffix_maybe( $public_id, $post->ID ); + } $return = array( 'file' => $file, 'folder' => ltrim( $cld_folder, '/' ), From dbcf3cd9949ddd7426e9a5f4cb09c85607374a5d Mon Sep 17 00:00:00 2001 From: David Cramer Date: Mon, 27 Jul 2020 10:43:46 +0200 Subject: [PATCH 19/39] add suffix data to enable splitting public_id and unique suffix --- .../php/class-media.php | 6 +++- .../php/class-sync.php | 3 +- .../php/sync/class-push-sync.php | 33 ++++++++++++++++++- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php index 2ffd89d18..3ebc2bf00 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php @@ -655,7 +655,11 @@ public function get_public_id( $attachment_id ) { public function get_cloudinary_id( $attachment_id ) { // A cloudinary_id is a public_id with a file extension. - $public_id = $this->get_public_id( $attachment_id ); + $public_id = $this->get_public_id( $attachment_id ); + $suffix_data = $this->get_post_meta( $post->ID, Sync::META_KEYS['suffix'], true ); + if ( is_array( $suffix_data ) && ! empty( $suffix_data['suffix'] ) && $suffix_data['public_id'] === $public_id ) { + $public_id = $public_id . $suffix_data['suffix']; + } $file = get_attached_file( $attachment_id ); $info = pathinfo( $file ); $cloudinary_id = $public_id . '.' . $info['extension']; diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php index deb8f1d80..d0b4067ce 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php @@ -49,6 +49,7 @@ class Sync implements Setup, Assets { 'sync_error' => '_sync_error', 'cloudinary' => '_cloudinary_v2', 'folder_sync' => '_folder_sync', + 'suffix' => '_suffix', 'syncing' => '_cloudinary_syncing', 'downloading' => '_cloudinary_downloading', ); @@ -240,7 +241,7 @@ public function add_suffix_maybe( $public_id, $attachment_id, $suffix = null ) { } } - return $public_id . $suffix; + return $suffix; } /** diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php index cbb881ae0..e95bc6e31 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php @@ -531,13 +531,37 @@ public function prepare_upload( $post, $push_sync = false ) { // Restructure the path to the filename to allow correct placement in Cloudinary. $public_id = ltrim( $public_id_folder . $options['public_id'], '/' ); // If this is a push sync, make sure the ID is allowed and unique. + + // Setup suffix data for unique ids. + $suffix_defaults = array( + 'public_id' => $public_id, + 'suffix' => null, + ); + $suffix_meta = $this->media->get_post_meta( $post->ID, Sync::META_KEYS['suffix'], true ); + $suffix_data = wp_parse_args( $suffix_meta, $suffix_defaults ); + + // Prepare a uniqueness check and get a suffix if needed. if ( true === $push_sync ) { - $public_id = $this->sync->add_suffix_maybe( $public_id, $post->ID ); + if ( $public_id !== $suffix_data['public_id'] || empty( $suffix_data['suffix'] ) ) { + $suffix_data['suffix'] = $this->sync->add_suffix_maybe( $public_id, $post->ID ); + if ( ! empty( $suffix_data['suffix'] ) ) { + // Only save if there is a suffix to save on metadata. + $this->media->update_post_meta( $post->ID, Sync::META_KEYS['suffix'], $suffix_data ); + } else { + // Clear meta data in case of a unique name on a rename etc. + $this->media->delete_post_meta( $post->ID, Sync::META_KEYS['suffix'] ); + } + } + } + // Add Suffix to public_id. + if ( ! empty( $suffix_data['suffix'] ) ) { + $public_id = $public_id . $suffix_data['suffix']; } $return = array( 'file' => $file, 'folder' => ltrim( $cld_folder, '/' ), 'public_id' => $public_id, + 'suffix' => $suffix_data['suffix'], 'breakpoints' => array(), 'options' => $options, ); @@ -685,6 +709,12 @@ public function push_attachments( $attachments ) { delete_post_meta( $attachment->ID, Sync::META_KEYS['breakpoints'] ); } } + + // Reset public_id without suffix. + if ( ! empty( $upload['suffix'] ) ) { + $upload['options']['public_id'] = strstr( $upload['options']['public_id'], $upload['suffix'], true ); + } + // Generate a public_id sync hash. if ( ! empty( $upload['options']['public_id'] ) ) { // a transformation breakpoints only ever happens on a down sync. $sync_key = '_' . md5( $upload['options']['public_id'] ); @@ -697,6 +727,7 @@ public function push_attachments( $attachments ) { $meta = wp_get_attachment_metadata( $attachment->ID, true ); $meta[ Sync::META_KEYS['cloudinary'] ] = $meta_data; wp_update_attachment_metadata( $attachment->ID, $meta ); + $this->media->update_post_meta( $attachment->ID, Sync::META_KEYS['public_id'], $upload['options']['public_id'] ); // Search and update link references in content. $content_search = new \WP_Query( array( 's' => 'wp-image-' . $attachment->ID, 'fields' => 'ids', 'posts_per_page' => 1000 ) ); From cdbfb39e038936fb60894158acdf5e76886d4f21 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Mon, 27 Jul 2020 13:13:32 +0200 Subject: [PATCH 20/39] remove comma and cleanup formatting --- .../tabs/settings-global-video-transformations.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-video-transformations.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-video-transformations.php index 6caa367cb..63ec21efa 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-video-transformations.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-video-transformations.php @@ -64,7 +64,7 @@ // translators: Placeholders are tags. __( 'Please note that when choosing "always", the video will autoplay without sound (muted). This is a built-in browser feature and applies to all major browsers.%1$sRead more about muted autoplay%2$s', 'cloudinary' ), '
', - '', + '' ), ), From 0bfa56fed943425afa2664c254b6ff8ad47936bd Mon Sep 17 00:00:00 2001 From: David Cramer Date: Mon, 27 Jul 2020 13:13:53 +0200 Subject: [PATCH 21/39] cleanup formatting --- .../tabs/settings-global-video-transformations.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-video-transformations.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-video-transformations.php index 63ec21efa..f9386a812 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-video-transformations.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-video-transformations.php @@ -48,19 +48,19 @@ ), ), 'video_autoplay_mode' => array( - 'label' => null, - 'prefix' => __( 'Autoplay:', 'cloudinary' ), - 'type' => 'select', - 'default' => 'never', - 'choices' => array( + 'label' => null, + 'prefix' => __( 'Autoplay:', 'cloudinary' ), + 'type' => 'select', + 'default' => 'never', + 'choices' => array( 'off' => __( 'Off', 'cloudinary' ), 'always' => __( 'Always', 'cloudinary' ), 'on-scroll' => __( 'On-Scroll (Autoplay when in view)', 'cloudinary' ), ), - 'condition' => array( + 'condition' => array( 'video_player' => 'cld', ), - 'description' => sprintf( + 'description' => sprintf( // translators: Placeholders are tags. __( 'Please note that when choosing "always", the video will autoplay without sound (muted). This is a built-in browser feature and applies to all major browsers.%1$sRead more about muted autoplay%2$s', 'cloudinary' ), '
', From 97a564efba1a3ead9407629af0afb4e7aa39fa78 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Mon, 27 Jul 2020 13:35:40 +0200 Subject: [PATCH 22/39] typo on post_id --- .../php/class-media.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php index 3ebc2bf00..004d4fb07 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php @@ -656,7 +656,7 @@ public function get_cloudinary_id( $attachment_id ) { // A cloudinary_id is a public_id with a file extension. $public_id = $this->get_public_id( $attachment_id ); - $suffix_data = $this->get_post_meta( $post->ID, Sync::META_KEYS['suffix'], true ); + $suffix_data = $this->get_post_meta( $attachment_id, Sync::META_KEYS['suffix'], true ); if ( is_array( $suffix_data ) && ! empty( $suffix_data['suffix'] ) && $suffix_data['public_id'] === $public_id ) { $public_id = $public_id . $suffix_data['suffix']; } From efd08e96cca31c9cdbe0696f05f84ac20b517878 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Mon, 27 Jul 2020 13:44:22 +0100 Subject: [PATCH 23/39] Add compiled assets --- .../css/cloudinary.svg | 2 -- .../css/fonts/cloudinary.eot | Bin 3368 -> 2548 bytes .../css/fonts/cloudinary.ttf | Bin 3192 -> 2372 bytes .../css/fonts/cloudinary.woff | Bin 3268 -> 2448 bytes .../js/src/components/test.js | 9 +++++++++ 5 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/src/components/test.js diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.svg b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.svg index fdb8419c8..0b2a81765 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.svg +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.svg @@ -10,6 +10,4 @@ - - \ No newline at end of file diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.eot b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.eot index 912895d47a9b3d0d4cddd33e47ddbd61f2204462..8a843affcefc16ddb9e3d3cf7d3b2e0163499071 100644 GIT binary patch delta 364 zcmZ1>^+lNN3nv4E3+F^OGnVaJh1w=M1Th*+^p~EvPPBdv0|UbzAWlfmO)L-(yVS|R zz$gRchomPK7XWDiARk0?q~}zoWm|N90`e;u7+51RQWH~zcI~caU|_odlsC%&3b1!E zpI~5M=K%6mGIC2Qgcul;fqWexUnVC%IgzP_Wfzd|0ptthCRP+M@aQqs0|g?00t$JF zxvA1K%9Vh8paqPp3i69f7?^=F44f(;c?M?YhRFqt_KZxEH!ylLGHw3D*vhKR2$TZi zHleNC`b*FML@tbS&&zFay<8CaRY`hhE#?khGK?HhJ1!RprZ^K^cV~#bMeSc IPUkrY04Q!t!2kdN delta 1063 zcmZuvU5Fc16u#%qY-T2#WG0jOar4*hOftzP>ozkdP`O;S5CD`(}FAZMAj!9{=z;O{$C z(bJ%74XB!iRjs%UsI5ZTb`GP*pys$`M^lwR5!9UbCC$w*LmhmxOOAbih2Utl3?;|= zg~pxxgrlXvMApD#w6d-_Em(zI#VP{c$1EB45$Vs~Z&aJw0Y$YHO{ddq-7Due!imJj z;$o?g%RQDz%6Zc$i(*u&TUK#AZf$S3VqEftwS}y;qN>8oLzJcN=B9h?I{+ahQwp#R z3>pBXvK)d}afRQHgKp;%`>!vv0wQJvrl?W_mN3Qjo8V~2KvS?7hW&QfRh_G1DIBJ8*h_z- zzqRH*=-AN#MW8q73|LHClhH3^-8;4LA~^u=u2lFA0;@s+3PjU zDNsrL-=v_-xrJ<|CP|mNaw2}pvKCGh3v2Oscy0G$rvn1Zv%VS`EGin&L^-DDur(fS z!SQ5jBOidyL~9@J l2@-{*;U0a4UT5B9Pac*Mya@j*KEi)^73XjHv{x2B{};ISSPGlmYTX(i4jd zfV2RR5288Jb1KuaEjm8|`4tQdtPvThi77(6c2_enuw4Mkn`Hn6*t?idFfg!l0Qo8z zxg`}s42;P@z7CKtlart9n8?(^vI{8S0Td9(O{^$j;9;r<@*{wJg}lVvROuPzN)JZ`NbtbhXMho3P_%TnYm%&0eeQKNsQi%Oq+ceTUnJs{sH1Pp{?8F`E9;3aI=8a zGhBbU8)z(qo-D&~^-b_QUT9fh6L!vz^{HY7w!g`Lh>4 zJ#+K(fAWZT5MJFn-8nUS;_f$u1YV-w-9iKR9rG6c6PQ&gbon@fOzaur+Yg2^Nx=A1|IV3_T^q5FN!0)?)eGBT>tTY9oV0s z3GA&E_}aHYNsV-v-^W*0!Mb^@wsk2ZvbhBJ? zXQ46=Mcdi6?uUxw79CZQ{drKVp-io@8K{CMcEPdV?hx$lW}x5<>oo4XbvSAY4D{-F zj9S!Grw;RAmCQWgeT;%`?>W77xIoo`?Uxl>Ry8`f*1B|Nc_fioo}4V?EbB-jDUBO? zQ4peH)im?{etmtt9^;Z%7ALaioT3DL`zTA@l@<5eV}L+dq7+~q7!&|XB`FMF;10*% z-B$Agd(bppK?sNP>2#KnqSZ`hBA*?YGoo1Cn6Ga{7mh_D1^vLd2GDZdmFk}({4<6E zGY2q-RVjTImawolu`Q%QK4fk)ACRvQAgd8TGN-{TA(tNW$h%@y6eKzg$R)Se5F-Z$ zhd%6xU%(9i09l%aDNJ#_COGPTP-QHJX0IJ~S>wuB3a6p(_ReEv@|&0!NWM9SIBBztbDdER^d z-aiYYzdV|K^2aB_+zS$7Ju7)ynY!~%51;!h5ExE!NgbUvl*VpMkjNwrujohg2JiIYC&g+~3WOfsp|SI43Z0gJ~BA#>pFbgePi>)vrm;O)OwwV9WqYgn+Pk*rm?& z#A1-x9w46siUrbhD${^sM;I7bBS1LYqVrQmYGMil1G@}RjTs0F?b=5=*`Hqc?M%Et1=@{ z0*Kp$wr-E-xB1Gz%>oo)V7UHrcRh@roWW(z$Ub=imy8%#j*CHrL5}ekQw-A@kX8ov Y$@jQEFd9rg&n*fhmvPHYX688v08g7oBme*a delta 1100 zcmZuwOKcle6n*#2#N%H)_K@CmA$NbdeWho+-1lgEPas^m z@y=!Bj*xoK#l3fbFYN91E)n8Ck1>{u_^aQ2w1*^ehiGSAaGx+g@AU^m>l`3pc;(B6Vk|+&r)c_%&bt8^_>^ zVZL&L&;ZtHLkrk%?!bo=+mzHvkNJU_ChO#HLUKmQv?^sy*YtVNHPukK5O5xR-ARhd z8IWU3P*D}FQnr?$x&kG`9J6PjYFZ^TCPh63kaXt_sym0&Cl^hl28&PwoK9AYP&A#} zG_i2vFk@*@(W~GNv637!8?XX;St|e@MJ+1Eu~T)P(!|IUm5gXirlVV({mUDZ$>he| zTrscf=aVUMMpa5Y9~NqwRu~K#TU(6?mwIb$Hm5C1l5b*)veas~ty>QPd_j>?fGuDU z0F;Vi5Z=cXK9BpI)^+wdO|y7D7${^iIYtcEvf0@}P8%%>LT!7cu^oQlVklHp&d$gH z9m{Ihewy??VJI-m0LxgF(kDR?3%djRLYicidB8kRK0pJ-3;}Am09qL(bOlGbCA})4 zz8OFXx#K>lc~Cj@VIw>|W_YAg6!o9S6wB4#jGcj46pNv7ZWoM-%vG=y4pkYq&<%7$ ztJZ0wjyEU(eLyGhxIh`mQt*1Ck%*DB?V0sdGDD$OZZ^xPmpl Date: Mon, 27 Jul 2020 13:48:44 +0100 Subject: [PATCH 24/39] Bump plugin version --- .../cloudinary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php index 7dd2f1d18..c77522474 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php @@ -3,7 +3,7 @@ * Plugin Name: Cloudinary * Plugin URI: https://cloudinary.com/documentation/wordpress_integration * Description: With the Cloudinary plugin, you can upload and manage your media assets in the cloud, then deliver them to your users through a fast content delivery network, improving your website’s loading speed and overall user experience. Apply multiple transformations and take advantage of a full digital asset management solution without leaving WordPress. - * Version: 2.1.4 + * Version: 2.1.5 * Author: Cloudinary Ltd., XWP * Author URI: https://cloudinary.com/ * License: GPLv2+ From 1e2981e72ede4ad44fc44831cd4c5ad050ab1d5a Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Tue, 28 Jul 2020 17:22:47 +0100 Subject: [PATCH 25/39] Rename Cloudinary font --- ...loudinary.3e6e8c4703acd0d44ac0f1f2053ac136.woff} | Bin ...cloudinary.75ba9519614cb6a66e5cf729abd201eb.ttf} | Bin ...cloudinary.e464c04d2cb225f8a19b0a56742bccbc.eot} | Bin 3 files changed, 0 insertions(+), 0 deletions(-) rename cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/{cloudinary.woff => cloudinary.3e6e8c4703acd0d44ac0f1f2053ac136.woff} (100%) rename cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/{cloudinary.ttf => cloudinary.75ba9519614cb6a66e5cf729abd201eb.ttf} (100%) rename cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/{cloudinary.eot => cloudinary.e464c04d2cb225f8a19b0a56742bccbc.eot} (100%) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.woff b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.3e6e8c4703acd0d44ac0f1f2053ac136.woff similarity index 100% rename from cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.woff rename to cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.3e6e8c4703acd0d44ac0f1f2053ac136.woff diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.ttf b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.75ba9519614cb6a66e5cf729abd201eb.ttf similarity index 100% rename from cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.ttf rename to cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.75ba9519614cb6a66e5cf729abd201eb.ttf diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.eot b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.e464c04d2cb225f8a19b0a56742bccbc.eot similarity index 100% rename from cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.eot rename to cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.e464c04d2cb225f8a19b0a56742bccbc.eot From 82f9419cc09082a8c98e1337dc1dc317b6d0814f Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Tue, 28 Jul 2020 17:23:11 +0100 Subject: [PATCH 26/39] Add compiled asset --- .../css/cloudinary.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.css b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.css index 52fc32452..3edf5ff48 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.css +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.css @@ -1 +1 @@ -@font-face{font-family:cloudinary;src:url(../css/fonts/cloudinary.eot);src:url(../css/fonts/cloudinary.eot#iefix) format("embedded-opentype"),url(../css/fonts/cloudinary.ttf) format("truetype"),url(../css/fonts/cloudinary.woff) format("woff"),url(../css/cloudinary.svg#cloudinary) format("svg");font-weight:400;font-style:normal}.dashicons-cloudinary{speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.dashicons-cloudinary:before{font-family:cloudinary!important;content:"\e900"}.dashicons-cloudinary.success{color:#558b2f}.dashicons-cloudinary.error{color:#dd2c00}.dashicons-cloudinary.error:before{content:"\e901"}.dashicons-cloudinary.warning{color:#fd9d2c}.dashicons-cloudinary.warning:before{content:"\e902"}.dashicons-cloudinary.info{color:#0071ba}.dashicons-cloudinary.downloading:before{content:"\e903"}.dashicons-cloudinary.syncing:before{content:"\e904"}.column-cld_status{width:5.5em}.column-cld_status .dashicons-cloudinary{display:inline-block}.column-cld_status .dashicons-cloudinary:before{font-size:1.8rem}.form-field .error-notice,.form-table .error-notice{display:none;color:#dd2c00}.form-field input.cld-field:invalid,.form-table input.cld-field:invalid{border-color:#dd2c00}.form-field input.cld-field:invalid+.error-notice,.form-table input.cld-field:invalid+.error-notice{display:inline-block}.cloudinary-welcome{background-image:url(../css/logo.svg);background-repeat:no-repeat;background-size:153px;background-position:top 12px right 20px}.cloudinary-stats{display:inline-block;margin-left:25px}.cloudinary-stat{cursor:help}.cloudinary-percent{font-size:.8em;vertical-align:top;color:#0071ba}.settings-image{max-width:100%;padding-top:5px}.settings-tabs>li{display:inline-block}.settings-tabs>li a{padding:.6em}.settings-tabs>li a.active{background-color:#fff}.settings-tab-section{padding:20px 0 0;max-width:1030px;position:relative}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard{display:flex;align-items:flex-start;align-content:flex-start;margin-top:40px}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard-description{width:55%;margin:0 auto 0 0}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard-content{width:35%;margin:0 auto}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard-content .dashicons{color:#9ea3a8}.settings-tab-section.cloudinary-welcome .settings-tab-section-card{margin-top:0}.settings-tab-section-fields .field-heading th{display:block;width:auto;color:#23282d;font-size:1.1em;margin:1em 0}.settings-tab-section-fields .field-heading td{display:none;visibility:hidden}.settings-tab-section-fields .regular-textarea{width:100%;height:60px}.settings-tab-section-fields .dashicons{text-decoration:none;vertical-align:middle}.settings-tab-section-fields a .dashicons{color:#5f5f5f}.settings-tab-section-fields-dashboard-error{font-size:1.2em;color:#5f5f5f}.settings-tab-section-fields-dashboard-error .dashicons{color:#ac0000}.settings-tab-section-fields-dashboard-error .button{font-size:1.1em;height:40px;line-height:40px;padding-right:40px;padding-left:40px}.settings-tab-section-fields-dashboard-success{font-size:1.2em;color:#23282d}.settings-tab-section-fields-dashboard-success.expanded{padding-top:40px}.settings-tab-section-fields-dashboard-success .dashicons{color:#4fb651}.settings-tab-section-fields-dashboard-success .button{font-size:1.1em;height:40px;line-height:40px;padding-right:40px;padding-left:40px}.settings-tab-section-fields-dashboard-success .description{color:#5f5f5f;font-weight:400;margin-top:12px}.settings-tab-section-card{box-sizing:border-box;border:1px solid #e5e5e5;background-color:#fff;box-shadow:0 1px 1px 0 rgba(0,0,0,.07);padding:20px 23px;margin-top:12px}.settings-tab-section-card .dashicons{font-size:1.4em}.settings-tab-section-card h2{font-size:1.8em;font-weight:400;margin-top:0}.settings-tab-section-card.pull-right{width:450px;padding:12px;float:right;position:relative;z-index:10}.settings-tab-section-card.pull-right img.settings-image{box-shadow:0 2px 4px 0 rgba(0,0,0,.5);border:1px solid #979797;margin-top:12px}.settings-tab-section-card.pull-right h3,.settings-tab-section-card.pull-right h4{margin-top:0}.settings-tab-section .field-row-cloudinary_url,.settings-tab-section .field-row-signup{display:block}.settings-tab-section .field-row-cloudinary_url td,.settings-tab-section .field-row-cloudinary_url th,.settings-tab-section .field-row-signup td,.settings-tab-section .field-row-signup th{display:block;width:auto;padding:10px 0 0}.settings-tab-section .field-row-cloudinary_url td .sign-up,.settings-tab-section .field-row-cloudinary_url th .sign-up,.settings-tab-section .field-row-signup td .sign-up,.settings-tab-section .field-row-signup th .sign-up{vertical-align:baseline}.settings-tab-section.connect .form-table{display:inline-block;width:auto;max-width:580px}.settings-valid{color:#558b2f;font-size:30px}.settings-valid-field{border-color:#558b2f!important}.settings-invalid-field{border-color:#dd2c00!important}.settings-warning{display:inline-block;padding:5px 7px;background-color:#e9faff;border:1px solid #ccd0d4;border-left:4px solid #00a0d2;box-shadow:0 1px 1px rgba(0,0,0,.04)}.sync .spinner{display:inline-block;visibility:visible;float:none;margin:0 5px 0 0}.sync-media,.sync-media-progress{display:none}.sync-media-progress-outer{height:20px;margin:20px 0 10px;width:500px;background-color:#e5e5e5;position:relative}.sync-media-progress-outer .progress-bar{width:0;height:20px;background-color:#558b2f;transition:width .25s}.sync-media-progress-notice{color:#dd2c00}.sync-media-resource{width:100px;display:inline-block}.sync-media-error{color:#dd2c00}.sync-count{font-weight:700}.sync-details{margin-top:10px}.sync .button.start-sync,.sync .button.stop-sync{display:none;padding:0 16px}.sync .button.start-sync .dashicons,.sync .button.stop-sync .dashicons{line-height:2.2em}.sync .progress-text{padding:12px 4px 12px 12px;display:inline-block;font-weight:700}.sync .completed{max-width:300px;display:none}.sync-status-disabled{color:#dd2c00}.sync-status-enabled{color:#558b2f}.sync-status-button.button{vertical-align:baseline}.cloudinary-widget{height:100%}.cloudinary-widget-wrapper{height:100%;overflow:hidden;background-image:url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0ic3Bpbm5lciIgdmlld0JveD0iLTQgLTQgMTUxIDEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48c3R5bGU+QGtleWZyYW1lcyBjb2xvcnN7MCUsdG97c3Ryb2tlOiMwMDc4ZmZ9NTAle3N0cm9rZTojMGUyZjVhfX1Aa2V5ZnJhbWVzIGRhc2h7MCUsdG97c3Ryb2tlLWRhc2hvZmZzZXQ6NTYwfTUwJXtzdHJva2UtZGFzaG9mZnNldDowfX1ALXdlYmtpdC1rZXlmcmFtZXMgY29sb3JzezAlLHRve3N0cm9rZTojMDA3OGZmfTUwJXtzdHJva2U6IzBlMmY1YX19QC13ZWJraXQta2V5ZnJhbWVzIGRhc2h7MCUsdG97c3Ryb2tlLWRhc2hvZmZzZXQ6NTYwfTUwJXtzdHJva2UtZGFzaG9mZnNldDowfX08L3N0eWxlPjxwYXRoIGQ9Ik0xMjEuNjYzIDkwLjYzOGMtMS43OTYgMC05OS4zMy0uNDk4LTEwMS40NzQtMS40NzhDOC42ODUgODMuODc3IDEuMjUgNzIuMTk2IDEuMjUgNTkuMzk2YzAtMTYuNjU2IDEyLjc5Ny0zMC42MSAyOS4wNTItMzIuMzIzIDcuNDktMTUuNzA2IDIzLjE4Ni0yNS43MDcgNDAuNzE0LTI1LjcwNyAyMC45OCAwIDM5LjIxNSAxNC43NTIgNDMuOTQ1IDM0LjkwNyAxNS4wOS4yNDUgMjcuMjkgMTIuNjMgMjcuMjkgMjcuODIyIDAgMTEuOTY4LTcuNzM4IDIyLjU1LTE5LjI1NiAyNi4zMyIgc3Ryb2tlLXdpZHRoPSI5IiBzdHJva2UtbGluZWNhcD0icm91bmQiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3R5bGU9InRyYW5zZm9ybS1vcmlnaW46Y2VudGVyOy13ZWJraXQtYW5pbWF0aW9uOmRhc2ggMnMgZWFzZS1pbi1vdXQgaW5maW5pdGUsY29sb3JzIDhzIGVhc2UtaW4tb3V0IGluZmluaXRlO2FuaW1hdGlvbjpkYXNoIDJzIGVhc2UtaW4tb3V0IGluZmluaXRlLGNvbG9ycyA4cyBlYXNlLWluLW91dCBpbmZpbml0ZSIgc3Ryb2tlLWRhc2hhcnJheT0iMjgwIi8+PC9zdmc+");background-repeat:no-repeat;background-position:50%;background-size:150px}.attachment-actions .button.edit-attachment,.attachment-info .edit-attachment{display:none}.global-transformations-preview{position:relative;max-width:600px}.global-transformations-spinner{display:none}.global-transformations-button.button-primary{display:none;position:absolute;z-index:100}.global-transformations-url{margin-bottom:5px;margin-top:5px}.global-transformations-url-transformation{max-width:100px;overflow:hidden;text-overflow:ellipsis;color:#51a3ff}.global-transformations-url-file{color:#f2d864}.global-transformations-url-link{display:block;padding:16px;background-color:#262c35;text-decoration:none;color:#fff;border-radius:6px;overflow:hidden;text-overflow:ellipsis}.global-transformations-url-link:hover{color:#888;text-decoration:underline}.cld-tax-order-list-item{border:1px solid #efefef;padding:4px;margin:0 0 -1px;background-color:#fff}.cld-tax-order-list-item.no-items{color:#888;text-align:center;display:none}.cld-tax-order-list-item.no-items:last-child{display:block}.cld-tax-order-list-item.ui-sortable-helper{box-shadow:0 2px 5px rgba(0,0,0,.2)}.cld-tax-order-list-item-placeholder{background-color:#efefef;height:45px;margin:0}.cld-tax-order-list-item-handle{cursor:grab;margin-right:4px;color:#999}.cld-tax-order-list-type{width:45%;display:inline-block;margin-right:8px}.cld-tax-order-list-type input{margin-right:4px!important}.cloudinary-media-library{position:relative;margin-left:-20px}@media screen and (max-width:782px){.cloudinary-media-library{margin-left:-10px}} \ No newline at end of file +@font-face{font-family:cloudinary;src:url(../css/fonts/cloudinary.e464c04d2cb225f8a19b0a56742bccbc.eot);src:url(../css/fonts/cloudinary.e464c04d2cb225f8a19b0a56742bccbc.eot#iefix) format("embedded-opentype"),url(../css/fonts/cloudinary.75ba9519614cb6a66e5cf729abd201eb.ttf) format("truetype"),url(../css/fonts/cloudinary.3e6e8c4703acd0d44ac0f1f2053ac136.woff) format("woff"),url(../css/cloudinary.svg#cloudinary) format("svg");font-weight:400;font-style:normal}.dashicons-cloudinary{speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.dashicons-cloudinary:before{font-family:cloudinary!important;content:"\e900"}.dashicons-cloudinary.success{color:#558b2f}.dashicons-cloudinary.error{color:#dd2c00}.dashicons-cloudinary.error:before{content:"\e901"}.dashicons-cloudinary.warning{color:#fd9d2c}.dashicons-cloudinary.warning:before{content:"\e902"}.dashicons-cloudinary.info{color:#0071ba}.dashicons-cloudinary.downloading:before{content:"\e903"}.dashicons-cloudinary.syncing:before{content:"\e904"}.column-cld_status{width:5.5em}.column-cld_status .dashicons-cloudinary{display:inline-block}.column-cld_status .dashicons-cloudinary:before{font-size:1.8rem}.form-field .error-notice,.form-table .error-notice{display:none;color:#dd2c00}.form-field input.cld-field:invalid,.form-table input.cld-field:invalid{border-color:#dd2c00}.form-field input.cld-field:invalid+.error-notice,.form-table input.cld-field:invalid+.error-notice{display:inline-block}.cloudinary-welcome{background-image:url(../css/logo.svg);background-repeat:no-repeat;background-size:153px;background-position:top 12px right 20px}.cloudinary-stats{display:inline-block;margin-left:25px}.cloudinary-stat{cursor:help}.cloudinary-percent{font-size:.8em;vertical-align:top;color:#0071ba}.settings-image{max-width:100%;padding-top:5px}.settings-tabs>li{display:inline-block}.settings-tabs>li a{padding:.6em}.settings-tabs>li a.active{background-color:#fff}.settings-tab-section{padding:20px 0 0;max-width:1030px;position:relative}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard{display:flex;align-items:flex-start;align-content:flex-start;margin-top:40px}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard-description{width:55%;margin:0 auto 0 0}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard-content{width:35%;margin:0 auto}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard-content .dashicons{color:#9ea3a8}.settings-tab-section.cloudinary-welcome .settings-tab-section-card{margin-top:0}.settings-tab-section-fields .field-heading th{display:block;width:auto;color:#23282d;font-size:1.1em;margin:1em 0}.settings-tab-section-fields .field-heading td{display:none;visibility:hidden}.settings-tab-section-fields .regular-textarea{width:100%;height:60px}.settings-tab-section-fields .dashicons{text-decoration:none;vertical-align:middle}.settings-tab-section-fields a .dashicons{color:#5f5f5f}.settings-tab-section-fields-dashboard-error{font-size:1.2em;color:#5f5f5f}.settings-tab-section-fields-dashboard-error .dashicons{color:#ac0000}.settings-tab-section-fields-dashboard-error .button{font-size:1.1em;height:40px;line-height:40px;padding-right:40px;padding-left:40px}.settings-tab-section-fields-dashboard-success{font-size:1.2em;color:#23282d}.settings-tab-section-fields-dashboard-success.expanded{padding-top:40px}.settings-tab-section-fields-dashboard-success .dashicons{color:#4fb651}.settings-tab-section-fields-dashboard-success .button{font-size:1.1em;height:40px;line-height:40px;padding-right:40px;padding-left:40px}.settings-tab-section-fields-dashboard-success .description{color:#5f5f5f;font-weight:400;margin-top:12px}.settings-tab-section-card{box-sizing:border-box;border:1px solid #e5e5e5;background-color:#fff;box-shadow:0 1px 1px 0 rgba(0,0,0,.07);padding:20px 23px;margin-top:12px}.settings-tab-section-card .dashicons{font-size:1.4em}.settings-tab-section-card h2{font-size:1.8em;font-weight:400;margin-top:0}.settings-tab-section-card.pull-right{width:450px;padding:12px;float:right;position:relative;z-index:10}.settings-tab-section-card.pull-right img.settings-image{box-shadow:0 2px 4px 0 rgba(0,0,0,.5);border:1px solid #979797;margin-top:12px}.settings-tab-section-card.pull-right h3,.settings-tab-section-card.pull-right h4{margin-top:0}.settings-tab-section .field-row-cloudinary_url,.settings-tab-section .field-row-signup{display:block}.settings-tab-section .field-row-cloudinary_url td,.settings-tab-section .field-row-cloudinary_url th,.settings-tab-section .field-row-signup td,.settings-tab-section .field-row-signup th{display:block;width:auto;padding:10px 0 0}.settings-tab-section .field-row-cloudinary_url td .sign-up,.settings-tab-section .field-row-cloudinary_url th .sign-up,.settings-tab-section .field-row-signup td .sign-up,.settings-tab-section .field-row-signup th .sign-up{vertical-align:baseline}.settings-tab-section.connect .form-table{display:inline-block;width:auto;max-width:580px}.settings-valid{color:#558b2f;font-size:30px}.settings-valid-field{border-color:#558b2f!important}.settings-invalid-field{border-color:#dd2c00!important}.settings-warning{display:inline-block;padding:5px 7px;background-color:#e9faff;border:1px solid #ccd0d4;border-left:4px solid #00a0d2;box-shadow:0 1px 1px rgba(0,0,0,.04)}.sync .spinner{display:inline-block;visibility:visible;float:none;margin:0 5px 0 0}.sync-media,.sync-media-progress{display:none}.sync-media-progress-outer{height:20px;margin:20px 0 10px;width:500px;background-color:#e5e5e5;position:relative}.sync-media-progress-outer .progress-bar{width:0;height:20px;background-color:#558b2f;transition:width .25s}.sync-media-progress-notice{color:#dd2c00}.sync-media-resource{width:100px;display:inline-block}.sync-media-error{color:#dd2c00}.sync-count{font-weight:700}.sync-details{margin-top:10px}.sync .button.start-sync,.sync .button.stop-sync{display:none;padding:0 16px}.sync .button.start-sync .dashicons,.sync .button.stop-sync .dashicons{line-height:2.2em}.sync .progress-text{padding:12px 4px 12px 12px;display:inline-block;font-weight:700}.sync .completed{max-width:300px;display:none}.sync-status-disabled{color:#dd2c00}.sync-status-enabled{color:#558b2f}.sync-status-button.button{vertical-align:baseline}.cloudinary-widget{height:100%}.cloudinary-widget-wrapper{height:100%;overflow:hidden;background-image:url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0ic3Bpbm5lciIgdmlld0JveD0iLTQgLTQgMTUxIDEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48c3R5bGU+QGtleWZyYW1lcyBjb2xvcnN7MCUsdG97c3Ryb2tlOiMwMDc4ZmZ9NTAle3N0cm9rZTojMGUyZjVhfX1Aa2V5ZnJhbWVzIGRhc2h7MCUsdG97c3Ryb2tlLWRhc2hvZmZzZXQ6NTYwfTUwJXtzdHJva2UtZGFzaG9mZnNldDowfX1ALXdlYmtpdC1rZXlmcmFtZXMgY29sb3JzezAlLHRve3N0cm9rZTojMDA3OGZmfTUwJXtzdHJva2U6IzBlMmY1YX19QC13ZWJraXQta2V5ZnJhbWVzIGRhc2h7MCUsdG97c3Ryb2tlLWRhc2hvZmZzZXQ6NTYwfTUwJXtzdHJva2UtZGFzaG9mZnNldDowfX08L3N0eWxlPjxwYXRoIGQ9Ik0xMjEuNjYzIDkwLjYzOGMtMS43OTYgMC05OS4zMy0uNDk4LTEwMS40NzQtMS40NzhDOC42ODUgODMuODc3IDEuMjUgNzIuMTk2IDEuMjUgNTkuMzk2YzAtMTYuNjU2IDEyLjc5Ny0zMC42MSAyOS4wNTItMzIuMzIzIDcuNDktMTUuNzA2IDIzLjE4Ni0yNS43MDcgNDAuNzE0LTI1LjcwNyAyMC45OCAwIDM5LjIxNSAxNC43NTIgNDMuOTQ1IDM0LjkwNyAxNS4wOS4yNDUgMjcuMjkgMTIuNjMgMjcuMjkgMjcuODIyIDAgMTEuOTY4LTcuNzM4IDIyLjU1LTE5LjI1NiAyNi4zMyIgc3Ryb2tlLXdpZHRoPSI5IiBzdHJva2UtbGluZWNhcD0icm91bmQiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3R5bGU9InRyYW5zZm9ybS1vcmlnaW46Y2VudGVyOy13ZWJraXQtYW5pbWF0aW9uOmRhc2ggMnMgZWFzZS1pbi1vdXQgaW5maW5pdGUsY29sb3JzIDhzIGVhc2UtaW4tb3V0IGluZmluaXRlO2FuaW1hdGlvbjpkYXNoIDJzIGVhc2UtaW4tb3V0IGluZmluaXRlLGNvbG9ycyA4cyBlYXNlLWluLW91dCBpbmZpbml0ZSIgc3Ryb2tlLWRhc2hhcnJheT0iMjgwIi8+PC9zdmc+");background-repeat:no-repeat;background-position:50%;background-size:150px}.attachment-actions .button.edit-attachment,.attachment-info .edit-attachment{display:none}.global-transformations-preview{position:relative;max-width:600px}.global-transformations-spinner{display:none}.global-transformations-button.button-primary{display:none;position:absolute;z-index:100}.global-transformations-url{margin-bottom:5px;margin-top:5px}.global-transformations-url-transformation{max-width:100px;overflow:hidden;text-overflow:ellipsis;color:#51a3ff}.global-transformations-url-file{color:#f2d864}.global-transformations-url-link{display:block;padding:16px;background-color:#262c35;text-decoration:none;color:#fff;border-radius:6px;overflow:hidden;text-overflow:ellipsis}.global-transformations-url-link:hover{color:#888;text-decoration:underline}.cld-tax-order-list-item{border:1px solid #efefef;padding:4px;margin:0 0 -1px;background-color:#fff}.cld-tax-order-list-item.no-items{color:#888;text-align:center;display:none}.cld-tax-order-list-item.no-items:last-child{display:block}.cld-tax-order-list-item.ui-sortable-helper{box-shadow:0 2px 5px rgba(0,0,0,.2)}.cld-tax-order-list-item-placeholder{background-color:#efefef;height:45px;margin:0}.cld-tax-order-list-item-handle{cursor:grab;margin-right:4px;color:#999}.cld-tax-order-list-type{width:45%;display:inline-block;margin-right:8px}.cld-tax-order-list-type input{margin-right:4px!important}.cloudinary-media-library{position:relative;margin-left:-20px}@media screen and (max-width:782px){.cloudinary-media-library{margin-left:-10px}} \ No newline at end of file From 6c513829fa259a658e619fe442c6198ecc344606 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Tue, 28 Jul 2020 17:23:34 +0100 Subject: [PATCH 27/39] Make content hash as part of the font filename --- .../webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/webpack.config.js b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/webpack.config.js index 2e0f62269..41c0024c8 100755 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/webpack.config.js +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/webpack.config.js @@ -64,7 +64,7 @@ const cldCore = { { loader: 'file-loader', options: { - name: '[name].[ext]', + name: '[name].[contenthash].[ext]', outputPath: '../css/fonts/' } } From 22bbb9de4d985717bb4a11e41712c62ecd789560 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Tue, 28 Jul 2020 17:36:20 +0100 Subject: [PATCH 28/39] Remove unecessary cache busters --- .../css/src/components/_brand.scss | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/components/_brand.scss b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/components/_brand.scss index f210c857e..caecd2e68 100755 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/components/_brand.scss +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/components/_brand.scss @@ -1,10 +1,10 @@ @font-face { font-family : 'cloudinary'; - src : url('fonts/cloudinary.eot?xr4567gh'); - src : url('fonts/cloudinary.eot?xr4567gh#iefix') format('embedded-opentype'), - url('fonts/cloudinary.ttf?xr4567gh') format('truetype'), - url('fonts/cloudinary.woff?xr4567gh') format('woff'), - url('fonts/cloudinary.svg?xr4567gh#cloudinary') format('svg'); + src : url('fonts/cloudinary.eot'); + src : url('fonts/cloudinary.eot?x#iefix') format('embedded-opentype'), + url('fonts/cloudinary.ttf') format('truetype'), + url('fonts/cloudinary.woff') format('woff'), + url('fonts/cloudinary.svg?x#cloudinary') format('svg'); font-weight : normal; font-style : normal; } From 965bf6bbdca124ce4297080a4d1eddf24cd99289 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 29 Jul 2020 09:44:23 +0100 Subject: [PATCH 29/39] Bump plugin version --- .../cloudinary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php index c77522474..27f00e785 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php @@ -3,7 +3,7 @@ * Plugin Name: Cloudinary * Plugin URI: https://cloudinary.com/documentation/wordpress_integration * Description: With the Cloudinary plugin, you can upload and manage your media assets in the cloud, then deliver them to your users through a fast content delivery network, improving your website’s loading speed and overall user experience. Apply multiple transformations and take advantage of a full digital asset management solution without leaving WordPress. - * Version: 2.1.5 + * Version: 2.1.6 * Author: Cloudinary Ltd., XWP * Author URI: https://cloudinary.com/ * License: GPLv2+ From 6900f598a91da51e46217917bc1ac19d559810b7 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 29 Jul 2020 10:51:48 +0100 Subject: [PATCH 30/39] Cleanup --- .../js/src/components/test.js | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/src/components/test.js diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/src/components/test.js b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/src/components/test.js deleted file mode 100644 index f9044d546..000000000 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/src/components/test.js +++ /dev/null @@ -1,9 +0,0 @@ -let i = function( action ) { - console.log( action ); - if ( 1 === action ) { - let action = 2; - console.log( action ); - } -} - -i(1); \ No newline at end of file From 4ad3d430656bb9a187b6a36f7bfb6a0fc29ae315 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 29 Jul 2020 10:52:33 +0100 Subject: [PATCH 31/39] Update fonts --- .../css/cloudinary.svg | 2 ++ ...nary.0bf34bba6c50ef8a00885c94fc39bb81.ttf} | Bin 2448 -> 3192 bytes ...ary.130b5d626b226659422cfb0e20ce30c1.woff} | Bin 2372 -> 3268 bytes ...nary.7b8dc57b5dd3c69880043780bb9bb133.eot} | Bin 2548 -> 3368 bytes .../css/src/fonts/cloudinary.eot | Bin 2548 -> 3368 bytes .../css/src/fonts/cloudinary.svg | 2 ++ .../css/src/fonts/cloudinary.ttf | Bin 2372 -> 3192 bytes .../css/src/fonts/cloudinary.woff | Bin 2448 -> 3268 bytes 8 files changed, 4 insertions(+) rename cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/{cloudinary.3e6e8c4703acd0d44ac0f1f2053ac136.woff => cloudinary.0bf34bba6c50ef8a00885c94fc39bb81.ttf} (51%) rename cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/{cloudinary.75ba9519614cb6a66e5cf729abd201eb.ttf => cloudinary.130b5d626b226659422cfb0e20ce30c1.woff} (50%) rename cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/{cloudinary.e464c04d2cb225f8a19b0a56742bccbc.eot => cloudinary.7b8dc57b5dd3c69880043780bb9bb133.eot} (51%) mode change 100755 => 100644 cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.eot mode change 100755 => 100644 cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.svg mode change 100755 => 100644 cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.ttf mode change 100755 => 100644 cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.woff diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.svg b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.svg index 0b2a81765..fdb8419c8 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.svg +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.svg @@ -10,4 +10,6 @@ + + \ No newline at end of file diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.3e6e8c4703acd0d44ac0f1f2053ac136.woff b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.0bf34bba6c50ef8a00885c94fc39bb81.ttf similarity index 51% rename from cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.3e6e8c4703acd0d44ac0f1f2053ac136.woff rename to cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/fonts/cloudinary.0bf34bba6c50ef8a00885c94fc39bb81.ttf index 1fd9912744d6506d6519b2714160fc7afb90aad2..166b4542dcac33edc9624a44fdce2d42d52c467e 100644 GIT binary patch delta 1059 zcmZuw&1)N15TAJ~X|JnjQ*EA@om3b7(2#)LWsD9!n1`J>=9&ArJ_GkoM47JH3>?eZ#!p{NBua z{AS-5v6m+%fB+DLJHSEd!lflkl)S%DjXIV9m12R$P&NMO5<6WtMktGeIp`W*wKYj^tjima$|x_gG@-HDSfms1vKv z3GuQTx0<+$`HE3Qx{6-X%wtk_p0UKlCo85LSJ~ulcmL|fR5H1-uuv-G^JkMOX-?P5 zq8N?T4Wl?3HMh2!F+TPF+I-GfQ53;@f_a$T>DYIFMHE63V~AVGks&fBNg@1*Ry3Xr zy6u~uHw?oT#Za)A$>caGTF++Zi#cPm9EsGoSDV|>GZ(|*l6G=VMeN#kr~Y`#|CD3M ztst&YRmPr%Br5Dq>IbyoJokuu6Fw$DVuq14TtcHl61swu+)BQtkiHot3Hjqb=mpey z;;0cmkurSBL?-AJ``%rf-*z0zt`NH5hJy?ycAFv&}eUaz6!ghj;vO$tc7UC3o? zk;u)iluW#381qZT!dfCRwYGDk-A2LV_qb|gsi>$$ljWGK;^t_$i6>L(jk!QfXjQ5$ zrgpD%o6%mQ(Gy~UbZz>-DIL5tq@3AwaC#~dv2(e?g(06!r{_aKFrsMdfX`de*QVN;MhB-`5Fq&m``a$Hpp5o1p$yDgRj`z>>>B5 j=k!r2!Fj+xQ%&f>F1!mvxDE%fPtVGPMKGOj{ZIY@%H*!5 delta 414 zcmew%F+o_Y+~3WOfsp|SI43Z0gJ~BA#>t61V)g#P`bG>4j2uA01Q6yIVqKG*n^*u8 z%K-92Kv+ENQfGQ%F-U9=kPlJ|!UE|zm1#h+BMc0z5g?px(fKJOH8F*Ofn5eDZwA6b zyLMM+00n_!AhT3Jn7xbnL`H5&1yC#zNHBmD%Lp+rCgryel8wf>|G!vbO!w%L*lu!vxi6`cMI(tgYYKz z?O}g-M94Ft4<3?90>50lalitxAW<0nk-+_a?+7;z-9>wDf+!tb@AWSt_a|=t5kvaD zBje_c!4O~Z!++yATyfmTZ-3DQ{vBuo|JgRY?%SuNL3-R*+#J~?e-V;*%C1+fShi)K z0^2ejLx_Ul$BRv>qGv(ZR-kGcR<+`-Ky3}mjyqvzq2_vJS5p;#5mbAuPcHTX zT<5_Gjp=F`O76HxlkNkDt7X7MuYucWWnFWdum*O;DgvIzEE&$!$)4lWR2w;dMRgQS zr=#1Q>zB4>QmL)Q#Ztkx&!p1wylIq0F(%b5t2i7s_x74`A^rTuLf%?c)u8VL<*B#5 z?cKf$5RAx_0_*{Y0H9QsBk&5YaQxKow6F4ySe7S>k#I4a&2w_Bp35y1^CN3nlIr_w z&HdQvbJ1wYI61EabUbgn{>@C_9!G&&1z5$Zl-`TTSeV_|9?~M~+#T*w@){bbY7|h+ zC9o=}B~u=CSM8dLLT3TB6s8R^3t$T9!;bhx%8oNGh6eac(7Hewy55@&}qiHjYc;Z4`phJ|D<$uI6uIgxlA}QBS~I9 zU)UK4xlCpu5*DM?d~T6{cC&p2zj~A$k$C_6zrTL>DRK1=66P68eq8?zTQHr+zx!(t x94`uK1Dy>-i@8V$|GX^Rr%%vNxHtI6CZ&SoCxu_}Bisq7__PAq@vDI^{{iMKvtR%K delta 304 zcmX>ic|@q5fsuiMft#U$ftkU;KUm+0Ux;-LP-G7fCnV=47Kn#k>SSPGlmYTX(i4jd zfV2RR5288Jb1KuaEjm8|`4tQdtPvThi77(6c2_enuw4Mkn`Hn6*t?idFfg!l0Qo8z zxg`}s42;P@z7CKtlart9n8?(^vI{8S0Td9(O{^$j;9;r<@*{wJg}lVvROuPzN)JZ`NbtbhXMho3P_%TnYm#y52HOJ(_|k;Z$_rgGZmFZp&&l{P_&eS(5Jo>rJ#>eL{admFNLC_g46{)v#BrQ%suzq?|k>1 zd-=}&J#szn%LNG;1@?Uod+pxA{rzLlgSCH3+rO!dzbAy;L3??(*X^sFZ$2Od5{S3X zcL#m+5@OHu=P$i}?$(Wdbi_CCkWc$p21CLiLjv0# zPZ;Jiw+{_q-CNKC_VWXHcWQ@{I_WZBFmq&`{6$E{D%nn@Y-Y{uB4ka&(zy_DKKwnW zMAa0iv1O+eZ%TQf~l4T!8XQ664B|D}>eFadm?w2$>w*)ot%qrT}lNEx=Y6*(A z`!kK(PY64f1Or(ekBODknB9O?$d=6l;C+muZcRvUc7LU@vE_>@Ry3y4@zwU_a~nZT z+gMmA=Cj%7w1k{9^pYrsrJ89LhQr48b|bTGU0SHA-g0y3ol z+rXd!P%6s-cpF#v{nTr>F0xOXrXz}h=|U=%VdQWvot`gb#^#bF)pk}JJK^J}L!qL6 zB&Pzj9cQ!lRgizgP+(R7R delta 364 zcmZ1>^+lNN3nv4E3+F^OGnVaJh1w=M1Th*+^p~EvPPBdv0|UbzAWlfmO)L-(yVS|R zz$gRchomPK7XWDiARk0?q~}zoWm|N90`e;u7+51RQWH~zcI~caU|_odlsC%&3b1!E zpI~5M=K%6mGIC2Qgcul;fqWexUnVC%IgzP_Wfzd|0ptthCRP+M@aQqs0|g?00t$JF zxvA1K%9Vh8paqPp3i69f7?^=F44f(;c?M?YhRFqt_KZxEH!ylLGHw3D*vhKR2$TZi zHleNC`b*FML@tbS&&zFay<8CaRY`hhE#?khGK?HhJ1!RprZ^K^cV~#bMeSc IPUkrY04Q!t!2kdN diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.eot b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.eot old mode 100755 new mode 100644 index 8a843affcefc16ddb9e3d3cf7d3b2e0163499071..b5d83bc152b11edf00dcdc24ee46b1372e4e6ebb GIT binary patch delta 1063 zcmZuvU5Fc16u#%qY-T2#WG0hL#?2(z?MyPsChImcNhVo$vuVY4case*x`bU2G;Dv? zwrK;25mFZp&&l{P_&eS(5Jo>rJ#>eL{admFNLC_g46{)v#BrQ%suzq?|k>1 zd-=}&J#szn%LNG;1@?Uod+pxA{rzLlgSCH3+rO!dzbAy;L3??(*X^sFZ$2Od5{S3X zcL#m+5@OHu=P$i}?$(Wdbi_CCkWc$p21CLiLjv0# zPZ;Jiw+{_q-CNKC_VWXHcWQ@{I_WZBFmq&`{6$E{D%nn@Y-Y{uB4ka&(zy_DKKwnW zMAa0iv1O+eZ%TQf~l4T!8XQ664B|D}>eFadm?w2$>w*)ot%qrT}lNEx=Y6*(A z`!kK(PY64f1Or(ekBODknB9O?$d=6l;C+muZcRvUc7LU@vE_>@Ry3y4@zwU_a~nZT z+gMmA=Cj%7w1k{9^pYrsrJ89LhQr48b|bTGU0SHA-g0y3ol z+rXd!P%6s-cpF#v{nTr>F0xOXrXz}h=|U=%VdQWvot`gb#^#bF)pk}JJK^J}L!qL6 zB&Pzj9cQ!lRgizgP+(R7R delta 364 zcmZ1>^+lNN3nv4E3+F^OGnVaJh1w=M1Th*+^p~EvPPBdv0|UbzAWlfmO)L-(yVS|R zz$gRchomPK7XWDiARk0?q~}zoWm|N90`e;u7+51RQWH~zcI~caU|_odlsC%&3b1!E zpI~5M=K%6mGIC2Qgcul;fqWexUnVC%IgzP_Wfzd|0ptthCRP+M@aQqs0|g?00t$JF zxvA1K%9Vh8paqPp3i69f7?^=F44f(;c?M?YhRFqt_KZxEH!ylLGHw3D*vhKR2$TZi zHleNC`b*FML@tbS&&zFay<8CaRY`hhE#?khGK?HhJ1!RprZ^K^cV~#bMeSc IPUkrY04Q!t!2kdN diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.svg b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.svg old mode 100755 new mode 100644 index 0b2a81765..fdb8419c8 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.svg +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.svg @@ -10,4 +10,6 @@ + + \ No newline at end of file diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.ttf b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.ttf old mode 100755 new mode 100644 index 71b6556b5af1c4fbede5021b7090da8e22a5d512..166b4542dcac33edc9624a44fdce2d42d52c467e GIT binary patch delta 1054 zcmZuw&2Jk;6rVS{_O3tTU9b0}@mJDadpEH|<6YZphr}_dXp`8nQmK)ZNC>dfkI>d_ zBpVbYgeyKI3S3$X3H47XJs=_V)B^~F1V_XH#DNnRq)JGDR22@qiOU5sJ8x!w@6CHN z`u%3VQXZce5g>#_$W6kL()Rg9Pf`LuqURyn%lrM_q0#;B141B;c;|9&aEP;vn9btl zYp-AW^vz$2h>sB7Jh<4qF#YP88A3vjG43CrLwKM2mXL4>aqgf$JW3My74Z(k*KX{u z^@36H2|BO_q7u`SmWVju+ZW0R&DSupfvs9L67 zt@z7OTZOXg9eZb>=J{n$*VJGUG-s?*XLbqdz|1Xq?$Z^5$!ZBo-ndDV-qV1mXTZX! ziO1+=L-(4n3Qol?0^Y|eneHUW#_<}}M{ZEnTva#d=vL?YrOl~SYI9+sRB)W>;i`dK&hfc;VoQY z`?=p~U*(^%ZC{e2kzzKR=ahIomzyuobQ`3;>EFhP{L=dY0 zmVhx-Bq(7-$&QZ3yuq&)CReQOS&_$_dqgo#9{yPNp-PbKyj&RjIb9 z(YerR#=DJ1HyKWNR{kUro_WbnXMaZtCiD1@U=2d!1tD!>uz}WMArdAk$-)!*0=>_@ b$3J&mDl~pk_zfT7wy5D~i`ntp;urq_31F;# delta 355 zcmew%aYU$|fsuiMft#U$ftkU;KUm+0Ux;-LP-G7fCnV=47Kn#k>SSPGlmYTX(i4jd zfV2RR5288Jb1KuaEjm8|`4tQdtPvThi77(6c2_enuw4Mkn`Hn6*t?idFfg!l0Qo8z zxg`}s42;P@z7CKtlart9n8?(^vI{8S0Td9(O{^$j;9;r<@*{wJg}lVvROuPzN)JZ`NbtbhXMho3P_%TnYm%&0eeQKNsQi%Oq+ceTUnJs{sH1Pp{?8F`E9;3aI=8a zGhBbU8)z(qo-D&!{u^YMpPBC-+*39K}2`f*Y* z28$Iu_Ho)C1O#;qANB?l`5f1Rq3L4oRkG(<{iCv&;7hN z=g#{ydK8~}=ltp_0fJBPhy=#-5N-HuN+12c)9>9N1on{LbRl+=~yW9_GdruI) zeEr=^$Q>c|zKd_)`?IjO+q+1J|18E>F5+*Uo8ChbxkI$GF1SyaU-tTgA#z_n=Mn_| zx_+>Oaj*EXAQ4@7g5D?n-VitT-$Q$5j1V2|_xiiYJ;u%NxJca|DmM=70e;O_|Hd)6 zVwkU;AT)q=+Ry^_``hr*#5N^$(qn#PX2?4Ehmf36GObEk(=~kobWJrBE(DwhUw4v3 zIRkR+G*nbYtCX$NP+ftNVUF2psG3&Ej7g%W0Fv&!L3QVl`sAW%)L;o}fYZrp35uq3 zizXIN9A+#HDtZ;%Ay$%OW&>70FKY$Bqo_s2ICiSeLz)|ffLOeQzx z=Zkq=KbuSmv#L_!`AE2?X@$X{v9;BRa;dl1=5pGyB>5($C`+w&+q!uVz!wxK1=s=x z0YIrB1mOc*;d8&=X3Pcx)2H#l~c1a zK*zG$wVx-w4;Tu}GQcucrSw5iz{2jpzK|waW$rRBk`K{9F++eFE`nA@30=WaZb`37 zsBZ>PLhiT^Y93S$eb@*Oj~O0mB%=Ncm}0rwo3Uw#iC7GUbGu+vWUhjxaHz_-g>Il5 zTD6`x>Ue_!(7SX3j|-H6ECsJuj7E*5ZO^W!k{JrMa#<`xV2wM1faZRcvM1wPixx@u&xD6d44rKl*w=D^;B zQ>paEtUu~&mMcvvcP@4sk#4=-^+o;ZYW%+`ZFtqjoSAeWJ{b;Mxm^Cd&1KW+xnO_~ zRdU&R_R4zeD*o;$IU@eWZ%=>v{B?f$5ecv^Oa55>8(VNZJ7>5m_?#h^QqWmPG+h_* uiIYC&g+~3WOfsp|SI43Z0gJ~BA#>pFbgePi>)vrm;O)OwwV9WqYgn+Pk*rm?& z#A1-x9w46siUrbhD${^sM;I7bBS1LYqVrQmYGMil1G@}RjTs0F?b=5=*`Hqc?M%Et1=@{ z0*Kp$wr-E-xB1Gz%>oo)V7UHrcRh@roWW(z$Ub=imy8%#j*CHrL5}ekQw-A@kX8ov Y$@jQEFd9rg&n*fhmvPHYX688v08g7oBme*a From a6e1fa5a0ef15074fa5a645028c4d4be0ddf6ab1 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 29 Jul 2020 10:52:55 +0100 Subject: [PATCH 32/39] Update styling --- .../css/cloudinary.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.css b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.css index 3edf5ff48..5c14e6684 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.css +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/cloudinary.css @@ -1 +1 @@ -@font-face{font-family:cloudinary;src:url(../css/fonts/cloudinary.e464c04d2cb225f8a19b0a56742bccbc.eot);src:url(../css/fonts/cloudinary.e464c04d2cb225f8a19b0a56742bccbc.eot#iefix) format("embedded-opentype"),url(../css/fonts/cloudinary.75ba9519614cb6a66e5cf729abd201eb.ttf) format("truetype"),url(../css/fonts/cloudinary.3e6e8c4703acd0d44ac0f1f2053ac136.woff) format("woff"),url(../css/cloudinary.svg#cloudinary) format("svg");font-weight:400;font-style:normal}.dashicons-cloudinary{speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.dashicons-cloudinary:before{font-family:cloudinary!important;content:"\e900"}.dashicons-cloudinary.success{color:#558b2f}.dashicons-cloudinary.error{color:#dd2c00}.dashicons-cloudinary.error:before{content:"\e901"}.dashicons-cloudinary.warning{color:#fd9d2c}.dashicons-cloudinary.warning:before{content:"\e902"}.dashicons-cloudinary.info{color:#0071ba}.dashicons-cloudinary.downloading:before{content:"\e903"}.dashicons-cloudinary.syncing:before{content:"\e904"}.column-cld_status{width:5.5em}.column-cld_status .dashicons-cloudinary{display:inline-block}.column-cld_status .dashicons-cloudinary:before{font-size:1.8rem}.form-field .error-notice,.form-table .error-notice{display:none;color:#dd2c00}.form-field input.cld-field:invalid,.form-table input.cld-field:invalid{border-color:#dd2c00}.form-field input.cld-field:invalid+.error-notice,.form-table input.cld-field:invalid+.error-notice{display:inline-block}.cloudinary-welcome{background-image:url(../css/logo.svg);background-repeat:no-repeat;background-size:153px;background-position:top 12px right 20px}.cloudinary-stats{display:inline-block;margin-left:25px}.cloudinary-stat{cursor:help}.cloudinary-percent{font-size:.8em;vertical-align:top;color:#0071ba}.settings-image{max-width:100%;padding-top:5px}.settings-tabs>li{display:inline-block}.settings-tabs>li a{padding:.6em}.settings-tabs>li a.active{background-color:#fff}.settings-tab-section{padding:20px 0 0;max-width:1030px;position:relative}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard{display:flex;align-items:flex-start;align-content:flex-start;margin-top:40px}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard-description{width:55%;margin:0 auto 0 0}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard-content{width:35%;margin:0 auto}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard-content .dashicons{color:#9ea3a8}.settings-tab-section.cloudinary-welcome .settings-tab-section-card{margin-top:0}.settings-tab-section-fields .field-heading th{display:block;width:auto;color:#23282d;font-size:1.1em;margin:1em 0}.settings-tab-section-fields .field-heading td{display:none;visibility:hidden}.settings-tab-section-fields .regular-textarea{width:100%;height:60px}.settings-tab-section-fields .dashicons{text-decoration:none;vertical-align:middle}.settings-tab-section-fields a .dashicons{color:#5f5f5f}.settings-tab-section-fields-dashboard-error{font-size:1.2em;color:#5f5f5f}.settings-tab-section-fields-dashboard-error .dashicons{color:#ac0000}.settings-tab-section-fields-dashboard-error .button{font-size:1.1em;height:40px;line-height:40px;padding-right:40px;padding-left:40px}.settings-tab-section-fields-dashboard-success{font-size:1.2em;color:#23282d}.settings-tab-section-fields-dashboard-success.expanded{padding-top:40px}.settings-tab-section-fields-dashboard-success .dashicons{color:#4fb651}.settings-tab-section-fields-dashboard-success .button{font-size:1.1em;height:40px;line-height:40px;padding-right:40px;padding-left:40px}.settings-tab-section-fields-dashboard-success .description{color:#5f5f5f;font-weight:400;margin-top:12px}.settings-tab-section-card{box-sizing:border-box;border:1px solid #e5e5e5;background-color:#fff;box-shadow:0 1px 1px 0 rgba(0,0,0,.07);padding:20px 23px;margin-top:12px}.settings-tab-section-card .dashicons{font-size:1.4em}.settings-tab-section-card h2{font-size:1.8em;font-weight:400;margin-top:0}.settings-tab-section-card.pull-right{width:450px;padding:12px;float:right;position:relative;z-index:10}.settings-tab-section-card.pull-right img.settings-image{box-shadow:0 2px 4px 0 rgba(0,0,0,.5);border:1px solid #979797;margin-top:12px}.settings-tab-section-card.pull-right h3,.settings-tab-section-card.pull-right h4{margin-top:0}.settings-tab-section .field-row-cloudinary_url,.settings-tab-section .field-row-signup{display:block}.settings-tab-section .field-row-cloudinary_url td,.settings-tab-section .field-row-cloudinary_url th,.settings-tab-section .field-row-signup td,.settings-tab-section .field-row-signup th{display:block;width:auto;padding:10px 0 0}.settings-tab-section .field-row-cloudinary_url td .sign-up,.settings-tab-section .field-row-cloudinary_url th .sign-up,.settings-tab-section .field-row-signup td .sign-up,.settings-tab-section .field-row-signup th .sign-up{vertical-align:baseline}.settings-tab-section.connect .form-table{display:inline-block;width:auto;max-width:580px}.settings-valid{color:#558b2f;font-size:30px}.settings-valid-field{border-color:#558b2f!important}.settings-invalid-field{border-color:#dd2c00!important}.settings-warning{display:inline-block;padding:5px 7px;background-color:#e9faff;border:1px solid #ccd0d4;border-left:4px solid #00a0d2;box-shadow:0 1px 1px rgba(0,0,0,.04)}.sync .spinner{display:inline-block;visibility:visible;float:none;margin:0 5px 0 0}.sync-media,.sync-media-progress{display:none}.sync-media-progress-outer{height:20px;margin:20px 0 10px;width:500px;background-color:#e5e5e5;position:relative}.sync-media-progress-outer .progress-bar{width:0;height:20px;background-color:#558b2f;transition:width .25s}.sync-media-progress-notice{color:#dd2c00}.sync-media-resource{width:100px;display:inline-block}.sync-media-error{color:#dd2c00}.sync-count{font-weight:700}.sync-details{margin-top:10px}.sync .button.start-sync,.sync .button.stop-sync{display:none;padding:0 16px}.sync .button.start-sync .dashicons,.sync .button.stop-sync .dashicons{line-height:2.2em}.sync .progress-text{padding:12px 4px 12px 12px;display:inline-block;font-weight:700}.sync .completed{max-width:300px;display:none}.sync-status-disabled{color:#dd2c00}.sync-status-enabled{color:#558b2f}.sync-status-button.button{vertical-align:baseline}.cloudinary-widget{height:100%}.cloudinary-widget-wrapper{height:100%;overflow:hidden;background-image:url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0ic3Bpbm5lciIgdmlld0JveD0iLTQgLTQgMTUxIDEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48c3R5bGU+QGtleWZyYW1lcyBjb2xvcnN7MCUsdG97c3Ryb2tlOiMwMDc4ZmZ9NTAle3N0cm9rZTojMGUyZjVhfX1Aa2V5ZnJhbWVzIGRhc2h7MCUsdG97c3Ryb2tlLWRhc2hvZmZzZXQ6NTYwfTUwJXtzdHJva2UtZGFzaG9mZnNldDowfX1ALXdlYmtpdC1rZXlmcmFtZXMgY29sb3JzezAlLHRve3N0cm9rZTojMDA3OGZmfTUwJXtzdHJva2U6IzBlMmY1YX19QC13ZWJraXQta2V5ZnJhbWVzIGRhc2h7MCUsdG97c3Ryb2tlLWRhc2hvZmZzZXQ6NTYwfTUwJXtzdHJva2UtZGFzaG9mZnNldDowfX08L3N0eWxlPjxwYXRoIGQ9Ik0xMjEuNjYzIDkwLjYzOGMtMS43OTYgMC05OS4zMy0uNDk4LTEwMS40NzQtMS40NzhDOC42ODUgODMuODc3IDEuMjUgNzIuMTk2IDEuMjUgNTkuMzk2YzAtMTYuNjU2IDEyLjc5Ny0zMC42MSAyOS4wNTItMzIuMzIzIDcuNDktMTUuNzA2IDIzLjE4Ni0yNS43MDcgNDAuNzE0LTI1LjcwNyAyMC45OCAwIDM5LjIxNSAxNC43NTIgNDMuOTQ1IDM0LjkwNyAxNS4wOS4yNDUgMjcuMjkgMTIuNjMgMjcuMjkgMjcuODIyIDAgMTEuOTY4LTcuNzM4IDIyLjU1LTE5LjI1NiAyNi4zMyIgc3Ryb2tlLXdpZHRoPSI5IiBzdHJva2UtbGluZWNhcD0icm91bmQiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3R5bGU9InRyYW5zZm9ybS1vcmlnaW46Y2VudGVyOy13ZWJraXQtYW5pbWF0aW9uOmRhc2ggMnMgZWFzZS1pbi1vdXQgaW5maW5pdGUsY29sb3JzIDhzIGVhc2UtaW4tb3V0IGluZmluaXRlO2FuaW1hdGlvbjpkYXNoIDJzIGVhc2UtaW4tb3V0IGluZmluaXRlLGNvbG9ycyA4cyBlYXNlLWluLW91dCBpbmZpbml0ZSIgc3Ryb2tlLWRhc2hhcnJheT0iMjgwIi8+PC9zdmc+");background-repeat:no-repeat;background-position:50%;background-size:150px}.attachment-actions .button.edit-attachment,.attachment-info .edit-attachment{display:none}.global-transformations-preview{position:relative;max-width:600px}.global-transformations-spinner{display:none}.global-transformations-button.button-primary{display:none;position:absolute;z-index:100}.global-transformations-url{margin-bottom:5px;margin-top:5px}.global-transformations-url-transformation{max-width:100px;overflow:hidden;text-overflow:ellipsis;color:#51a3ff}.global-transformations-url-file{color:#f2d864}.global-transformations-url-link{display:block;padding:16px;background-color:#262c35;text-decoration:none;color:#fff;border-radius:6px;overflow:hidden;text-overflow:ellipsis}.global-transformations-url-link:hover{color:#888;text-decoration:underline}.cld-tax-order-list-item{border:1px solid #efefef;padding:4px;margin:0 0 -1px;background-color:#fff}.cld-tax-order-list-item.no-items{color:#888;text-align:center;display:none}.cld-tax-order-list-item.no-items:last-child{display:block}.cld-tax-order-list-item.ui-sortable-helper{box-shadow:0 2px 5px rgba(0,0,0,.2)}.cld-tax-order-list-item-placeholder{background-color:#efefef;height:45px;margin:0}.cld-tax-order-list-item-handle{cursor:grab;margin-right:4px;color:#999}.cld-tax-order-list-type{width:45%;display:inline-block;margin-right:8px}.cld-tax-order-list-type input{margin-right:4px!important}.cloudinary-media-library{position:relative;margin-left:-20px}@media screen and (max-width:782px){.cloudinary-media-library{margin-left:-10px}} \ No newline at end of file +@font-face{font-family:cloudinary;src:url(../css/fonts/cloudinary.7b8dc57b5dd3c69880043780bb9bb133.eot);src:url(../css/fonts/cloudinary.7b8dc57b5dd3c69880043780bb9bb133.eot#iefix) format("embedded-opentype"),url(../css/fonts/cloudinary.0bf34bba6c50ef8a00885c94fc39bb81.ttf) format("truetype"),url(../css/fonts/cloudinary.130b5d626b226659422cfb0e20ce30c1.woff) format("woff"),url(../css/cloudinary.svg#cloudinary) format("svg");font-weight:400;font-style:normal}.dashicons-cloudinary{speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.dashicons-cloudinary:before{font-family:cloudinary!important;content:"\e900"}.dashicons-cloudinary.success{color:#558b2f}.dashicons-cloudinary.error{color:#dd2c00}.dashicons-cloudinary.error:before{content:"\e901"}.dashicons-cloudinary.warning{color:#fd9d2c}.dashicons-cloudinary.warning:before{content:"\e902"}.dashicons-cloudinary.info{color:#0071ba}.dashicons-cloudinary.downloading:before{content:"\e903"}.dashicons-cloudinary.syncing:before{content:"\e904"}.column-cld_status{width:5.5em}.column-cld_status .dashicons-cloudinary{display:inline-block}.column-cld_status .dashicons-cloudinary:before{font-size:1.8rem}.form-field .error-notice,.form-table .error-notice{display:none;color:#dd2c00}.form-field input.cld-field:invalid,.form-table input.cld-field:invalid{border-color:#dd2c00}.form-field input.cld-field:invalid+.error-notice,.form-table input.cld-field:invalid+.error-notice{display:inline-block}.cloudinary-welcome{background-image:url(../css/logo.svg);background-repeat:no-repeat;background-size:153px;background-position:top 12px right 20px}.cloudinary-stats{display:inline-block;margin-left:25px}.cloudinary-stat{cursor:help}.cloudinary-percent{font-size:.8em;vertical-align:top;color:#0071ba}.settings-image{max-width:100%;padding-top:5px}.settings-tabs>li{display:inline-block}.settings-tabs>li a{padding:.6em}.settings-tabs>li a.active{background-color:#fff}.settings-tab-section{padding:20px 0 0;max-width:1030px;position:relative}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard{display:flex;align-items:flex-start;align-content:flex-start;margin-top:40px}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard-description{width:55%;margin:0 auto 0 0}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard-content{width:35%;margin:0 auto}.settings-tab-section.cloudinary-welcome .settings-tab-section-fields-dashboard-content .dashicons{color:#9ea3a8}.settings-tab-section.cloudinary-welcome .settings-tab-section-card{margin-top:0}.settings-tab-section-fields .field-heading th{display:block;width:auto;color:#23282d;font-size:1.1em;margin:1em 0}.settings-tab-section-fields .field-heading td{display:none;visibility:hidden}.settings-tab-section-fields .regular-textarea{width:100%;height:60px}.settings-tab-section-fields .dashicons{text-decoration:none;vertical-align:middle}.settings-tab-section-fields a .dashicons{color:#5f5f5f}.settings-tab-section-fields-dashboard-error{font-size:1.2em;color:#5f5f5f}.settings-tab-section-fields-dashboard-error .dashicons{color:#ac0000}.settings-tab-section-fields-dashboard-error .button{font-size:1.1em;height:40px;line-height:40px;padding-right:40px;padding-left:40px}.settings-tab-section-fields-dashboard-success{font-size:1.2em;color:#23282d}.settings-tab-section-fields-dashboard-success.expanded{padding-top:40px}.settings-tab-section-fields-dashboard-success .dashicons{color:#4fb651}.settings-tab-section-fields-dashboard-success .button{font-size:1.1em;height:40px;line-height:40px;padding-right:40px;padding-left:40px}.settings-tab-section-fields-dashboard-success .description{color:#5f5f5f;font-weight:400;margin-top:12px}.settings-tab-section-card{box-sizing:border-box;border:1px solid #e5e5e5;background-color:#fff;box-shadow:0 1px 1px 0 rgba(0,0,0,.07);padding:20px 23px;margin-top:12px}.settings-tab-section-card .dashicons{font-size:1.4em}.settings-tab-section-card h2{font-size:1.8em;font-weight:400;margin-top:0}.settings-tab-section-card.pull-right{width:450px;padding:12px;float:right;position:relative;z-index:10}.settings-tab-section-card.pull-right img.settings-image{box-shadow:0 2px 4px 0 rgba(0,0,0,.5);border:1px solid #979797;margin-top:12px}.settings-tab-section-card.pull-right h3,.settings-tab-section-card.pull-right h4{margin-top:0}.settings-tab-section .field-row-cloudinary_url,.settings-tab-section .field-row-signup{display:block}.settings-tab-section .field-row-cloudinary_url td,.settings-tab-section .field-row-cloudinary_url th,.settings-tab-section .field-row-signup td,.settings-tab-section .field-row-signup th{display:block;width:auto;padding:10px 0 0}.settings-tab-section .field-row-cloudinary_url td .sign-up,.settings-tab-section .field-row-cloudinary_url th .sign-up,.settings-tab-section .field-row-signup td .sign-up,.settings-tab-section .field-row-signup th .sign-up{vertical-align:baseline}.settings-tab-section.connect .form-table{display:inline-block;width:auto;max-width:580px}.settings-valid{color:#558b2f;font-size:30px}.settings-valid-field{border-color:#558b2f!important}.settings-invalid-field{border-color:#dd2c00!important}.settings-warning{display:inline-block;padding:5px 7px;background-color:#e9faff;border:1px solid #ccd0d4;border-left:4px solid #00a0d2;box-shadow:0 1px 1px rgba(0,0,0,.04)}.sync .spinner{display:inline-block;visibility:visible;float:none;margin:0 5px 0 0}.sync-media,.sync-media-progress{display:none}.sync-media-progress-outer{height:20px;margin:20px 0 10px;width:500px;background-color:#e5e5e5;position:relative}.sync-media-progress-outer .progress-bar{width:0;height:20px;background-color:#558b2f;transition:width .25s}.sync-media-progress-notice{color:#dd2c00}.sync-media-resource{width:100px;display:inline-block}.sync-media-error{color:#dd2c00}.sync-count{font-weight:700}.sync-details{margin-top:10px}.sync .button.start-sync,.sync .button.stop-sync{display:none;padding:0 16px}.sync .button.start-sync .dashicons,.sync .button.stop-sync .dashicons{line-height:2.2em}.sync .progress-text{padding:12px 4px 12px 12px;display:inline-block;font-weight:700}.sync .completed{max-width:300px;display:none}.sync-status-disabled{color:#dd2c00}.sync-status-enabled{color:#558b2f}.sync-status-button.button{vertical-align:baseline}.cloudinary-widget{height:100%}.cloudinary-widget-wrapper{height:100%;overflow:hidden;background-image:url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0ic3Bpbm5lciIgdmlld0JveD0iLTQgLTQgMTUxIDEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48c3R5bGU+QGtleWZyYW1lcyBjb2xvcnN7MCUsdG97c3Ryb2tlOiMwMDc4ZmZ9NTAle3N0cm9rZTojMGUyZjVhfX1Aa2V5ZnJhbWVzIGRhc2h7MCUsdG97c3Ryb2tlLWRhc2hvZmZzZXQ6NTYwfTUwJXtzdHJva2UtZGFzaG9mZnNldDowfX1ALXdlYmtpdC1rZXlmcmFtZXMgY29sb3JzezAlLHRve3N0cm9rZTojMDA3OGZmfTUwJXtzdHJva2U6IzBlMmY1YX19QC13ZWJraXQta2V5ZnJhbWVzIGRhc2h7MCUsdG97c3Ryb2tlLWRhc2hvZmZzZXQ6NTYwfTUwJXtzdHJva2UtZGFzaG9mZnNldDowfX08L3N0eWxlPjxwYXRoIGQ9Ik0xMjEuNjYzIDkwLjYzOGMtMS43OTYgMC05OS4zMy0uNDk4LTEwMS40NzQtMS40NzhDOC42ODUgODMuODc3IDEuMjUgNzIuMTk2IDEuMjUgNTkuMzk2YzAtMTYuNjU2IDEyLjc5Ny0zMC42MSAyOS4wNTItMzIuMzIzIDcuNDktMTUuNzA2IDIzLjE4Ni0yNS43MDcgNDAuNzE0LTI1LjcwNyAyMC45OCAwIDM5LjIxNSAxNC43NTIgNDMuOTQ1IDM0LjkwNyAxNS4wOS4yNDUgMjcuMjkgMTIuNjMgMjcuMjkgMjcuODIyIDAgMTEuOTY4LTcuNzM4IDIyLjU1LTE5LjI1NiAyNi4zMyIgc3Ryb2tlLXdpZHRoPSI5IiBzdHJva2UtbGluZWNhcD0icm91bmQiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3R5bGU9InRyYW5zZm9ybS1vcmlnaW46Y2VudGVyOy13ZWJraXQtYW5pbWF0aW9uOmRhc2ggMnMgZWFzZS1pbi1vdXQgaW5maW5pdGUsY29sb3JzIDhzIGVhc2UtaW4tb3V0IGluZmluaXRlO2FuaW1hdGlvbjpkYXNoIDJzIGVhc2UtaW4tb3V0IGluZmluaXRlLGNvbG9ycyA4cyBlYXNlLWluLW91dCBpbmZpbml0ZSIgc3Ryb2tlLWRhc2hhcnJheT0iMjgwIi8+PC9zdmc+");background-repeat:no-repeat;background-position:50%;background-size:150px}.attachment-actions .button.edit-attachment,.attachment-info .edit-attachment{display:none}.global-transformations-preview{position:relative;max-width:600px}.global-transformations-spinner{display:none}.global-transformations-button.button-primary{display:none;position:absolute;z-index:100}.global-transformations-url{margin-bottom:5px;margin-top:5px}.global-transformations-url-transformation{max-width:100px;overflow:hidden;text-overflow:ellipsis;color:#51a3ff}.global-transformations-url-file{color:#f2d864}.global-transformations-url-link{display:block;padding:16px;background-color:#262c35;text-decoration:none;color:#fff;border-radius:6px;overflow:hidden;text-overflow:ellipsis}.global-transformations-url-link:hover{color:#888;text-decoration:underline}.cld-tax-order-list-item{border:1px solid #efefef;padding:4px;margin:0 0 -1px;background-color:#fff}.cld-tax-order-list-item.no-items{color:#888;text-align:center;display:none}.cld-tax-order-list-item.no-items:last-child{display:block}.cld-tax-order-list-item.ui-sortable-helper{box-shadow:0 2px 5px rgba(0,0,0,.2)}.cld-tax-order-list-item-placeholder{background-color:#efefef;height:45px;margin:0}.cld-tax-order-list-item-handle{cursor:grab;margin-right:4px;color:#999}.cld-tax-order-list-type{width:45%;display:inline-block;margin-right:8px}.cld-tax-order-list-type input{margin-right:4px!important}.cloudinary-media-library{position:relative;margin-left:-20px}@media screen and (max-width:782px){.cloudinary-media-library{margin-left:-10px}} \ No newline at end of file From d5d0b66aa4e9d1659d8fb6275d835ad91539b71a Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 29 Jul 2020 10:53:53 +0100 Subject: [PATCH 33/39] Bump plugin version --- .../cloudinary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php index 27f00e785..04b3c4ae8 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php @@ -3,7 +3,7 @@ * Plugin Name: Cloudinary * Plugin URI: https://cloudinary.com/documentation/wordpress_integration * Description: With the Cloudinary plugin, you can upload and manage your media assets in the cloud, then deliver them to your users through a fast content delivery network, improving your website’s loading speed and overall user experience. Apply multiple transformations and take advantage of a full digital asset management solution without leaving WordPress. - * Version: 2.1.6 + * Version: 2.1.7 * Author: Cloudinary Ltd., XWP * Author URI: https://cloudinary.com/ * License: GPLv2+ From c4e38a18ed5755663af10d26c4e4aca3e371507b Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 29 Jul 2020 16:33:23 +0100 Subject: [PATCH 34/39] Cleanup syncing and downloading keys if processes fails --- .../php/sync/class-push-sync.php | 2 ++ .../php/sync/class-upload-queue.php | 1 + 2 files changed, 3 insertions(+) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php index e95bc6e31..732ce5cb8 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php @@ -404,6 +404,7 @@ public function prepare_upload( $post, $push_sync = false ) { if ( true === $push_sync ) { $download = $this->sync->managers['download']->down_sync( $post->ID ); if ( is_wp_error( $download ) ) { + delete_post_meta( $post->ID, Sync::META_KEYS['downloading'] ); update_post_meta( $post->ID, Sync::META_KEYS['sync_error'], $download->get_error_message() ); return new \WP_Error( 'attachment_download_error', $download->get_error_message() ); @@ -681,6 +682,7 @@ public function push_attachments( $attachments ) { $error = $result->get_error_message(); $stats['fail'][] = $error; $this->media->update_post_meta( $attachment->ID, Sync::META_KEYS['sync_error'], $error ); + delete_post_meta( $attachment->ID, Sync::META_KEYS['syncing'] ); continue; } diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-queue.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-queue.php index 781cf782a..930cbf1a6 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-queue.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-queue.php @@ -140,6 +140,7 @@ public function mark( $id, $type = 'done' ) { $queue[ $type ][] = '
' . basename( $file ) . ': ' . $state->get_error_message() . '
'; // Add a flag that this file had an error as to not try process it again. update_post_meta( $id, Sync::META_KEYS['sync_error'], $state->get_error_message() ); + delete_post_meta( $id, Sync::META_KEYS['syncing'], $state->get_error_message() ); } } else { if ( ! in_array( $id, $queue[ $type ], true ) ) { From 7e3e291720f662cdbcc02dbe79a18263ff356fe0 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 29 Jul 2020 16:35:06 +0100 Subject: [PATCH 35/39] No need for the suffix if we are downloading the asset --- .../php/sync/class-push-sync.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php index 732ce5cb8..c7033c533 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php @@ -542,7 +542,7 @@ public function prepare_upload( $post, $push_sync = false ) { $suffix_data = wp_parse_args( $suffix_meta, $suffix_defaults ); // Prepare a uniqueness check and get a suffix if needed. - if ( true === $push_sync ) { + if ( true === $push_sync && true !== $downsync ) { if ( $public_id !== $suffix_data['public_id'] || empty( $suffix_data['suffix'] ) ) { $suffix_data['suffix'] = $this->sync->add_suffix_maybe( $public_id, $post->ID ); if ( ! empty( $suffix_data['suffix'] ) ) { From 402b347bedf7e36d8395b2a8e0274839e237588e Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 29 Jul 2020 18:19:29 +0100 Subject: [PATCH 36/39] Bump plugin version --- .../cloudinary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php index 04b3c4ae8..656178dfa 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php @@ -3,7 +3,7 @@ * Plugin Name: Cloudinary * Plugin URI: https://cloudinary.com/documentation/wordpress_integration * Description: With the Cloudinary plugin, you can upload and manage your media assets in the cloud, then deliver them to your users through a fast content delivery network, improving your website’s loading speed and overall user experience. Apply multiple transformations and take advantage of a full digital asset management solution without leaving WordPress. - * Version: 2.1.7 + * Version: 2.1.8 * Author: Cloudinary Ltd., XWP * Author URI: https://cloudinary.com/ * License: GPLv2+ From a58cb5ca3845280ae648d953bdae6be485442b4a Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Thu, 30 Jul 2020 11:25:01 +0100 Subject: [PATCH 37/39] Ensure that the downloading process did not kickoff --- .../php/sync/class-push-sync.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php index c7033c533..7a3079394 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php @@ -542,7 +542,7 @@ public function prepare_upload( $post, $push_sync = false ) { $suffix_data = wp_parse_args( $suffix_meta, $suffix_defaults ); // Prepare a uniqueness check and get a suffix if needed. - if ( true === $push_sync && true !== $downsync ) { + if ( true === $push_sync && true !== $downsync && empty( get_post_meta( $post->ID, Sync::META_KEYS['downloading'], true ) ) ) { if ( $public_id !== $suffix_data['public_id'] || empty( $suffix_data['suffix'] ) ) { $suffix_data['suffix'] = $this->sync->add_suffix_maybe( $public_id, $post->ID ); if ( ! empty( $suffix_data['suffix'] ) ) { From 0600246f26962b0356051e131500945d70ac4446 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Fri, 31 Jul 2020 12:11:30 +0100 Subject: [PATCH 38/39] Revert "Feature/unique-filenames" --- .../php/class-media.php | 6 +- .../php/class-sync.php | 73 --------- .../php/connect/class-api.php | 14 -- .../php/sync/class-push-sync.php | 151 +++++------------- 4 files changed, 42 insertions(+), 202 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php index 004d4fb07..2ffd89d18 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php @@ -655,11 +655,7 @@ public function get_public_id( $attachment_id ) { public function get_cloudinary_id( $attachment_id ) { // A cloudinary_id is a public_id with a file extension. - $public_id = $this->get_public_id( $attachment_id ); - $suffix_data = $this->get_post_meta( $attachment_id, Sync::META_KEYS['suffix'], true ); - if ( is_array( $suffix_data ) && ! empty( $suffix_data['suffix'] ) && $suffix_data['public_id'] === $public_id ) { - $public_id = $public_id . $suffix_data['suffix']; - } + $public_id = $this->get_public_id( $attachment_id ); $file = get_attached_file( $attachment_id ); $info = pathinfo( $file ); $cloudinary_id = $public_id . '.' . $info['extension']; diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php index 35a34b1c9..7845b1904 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-sync.php @@ -49,7 +49,6 @@ class Sync implements Setup, Assets { 'sync_error' => '_sync_error', 'cloudinary' => '_cloudinary_v2', 'folder_sync' => '_folder_sync', - 'suffix' => '_suffix', 'syncing' => '_cloudinary_syncing', 'downloading' => '_cloudinary_downloading', ); @@ -173,77 +172,6 @@ public function get_signature( $post_id ) { return $return; } - /** - * Generate a new Public ID for an asset. - * - * @param int $attachment_id The attachment ID for the new public ID. - * - * @return string|null - */ - public function generate_public_id( $attachment_id ) { - $settings = $this->plugin->config['settings']; - $cld_folder = trailingslashit( $settings['sync_media']['cloudinary_folder'] ); - $file = get_attached_file( $attachment_id ); - $file_info = pathinfo( $file ); - $public_id = $cld_folder . $file_info['filename']; - - return $public_id; - } - - /** - * Maybe add a suffix to the public ID if it's not unique. - * - * @param string $public_id The public ID to maybe add a suffix. - * @param int $attachment_id The attachment ID. - * @param string|null $suffix The suffix to maybe add. - * - * @return string The public ID. - */ - public function add_suffix_maybe( $public_id, $attachment_id, $suffix = null ) { - - // Test if asset exists by calling just the head on the asset url, to prevent API rate limits. - $url = $this->plugin->components['connect']->api->cloudinary_url( $public_id . $suffix ); - $req = wp_remote_head( $url, array( 'body' => array( 'rdm' => wp_rand( 100, 999 ) ) ) ); - $asset_error = strtolower( wp_remote_retrieve_header( $req, 'x-cld-error' ) ); - $code = wp_remote_retrieve_response_code( $req ); - - // If the request is not a 404 & does not have a cld-error header stating resource not found, it exists and should be checked that it's not a resync or generate a prefixed ID. - if ( 404 !== $code && false === strpos( $asset_error, 'resource not found' ) ) { - - // Get the attachment type. - if ( wp_attachment_is( 'image', $attachment_id ) ) { - $type = 'image'; - } elseif ( wp_attachment_is( 'video', $attachment_id ) ) { - $type = 'video'; - } elseif ( wp_attachment_is( 'audio', $attachment_id ) ) { - $type = 'audio'; - } else { - // not supported. - return null; - } - $cld_asset = $this->plugin->components['connect']->api->get_asset_details( $public_id, $type ); - if ( ! is_wp_error( $cld_asset ) && ! empty( $cld_asset['public_id'] ) ) { - $context_id = null; - - // Exists, check to see if this asset originally belongs to this ID. - if ( ! empty( $cld_asset['context'] ) && ! empty( $cld_asset['context']['custom'] ) && ! empty( $cld_asset['context']['custom']['wp_id'] ) ) { - $context_id = (int) $cld_asset['context']['custom']['wp_id']; - } - - // Generate new ID only if context ID is not related. - if ( $context_id !== $attachment_id ) { - // Generate a new ID with a uniqueID prefix. - $suffix = '-' . uniqid(); - - // Return new potential suffixed ID. - return $this->add_suffix_maybe( $public_id, $attachment_id, $suffix ); - } - } - } - - return $suffix; - } - /** * Additional component setup. */ @@ -251,7 +179,6 @@ public function setup() { if ( $this->plugin->config['connect'] ) { $this->managers['upload']->setup(); $this->managers['delete']->setup(); - $this->managers['push']->setup(); } } } diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/connect/class-api.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/connect/class-api.php index 08d80d6ec..279a7da93 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/connect/class-api.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/connect/class-api.php @@ -269,20 +269,6 @@ public function cloudinary_url( $public_id, $args = array(), $size = array(), $c return implode( '/', $url_parts ); } - /** - * Get the details of an asset by public ID. - * - * @param string $public_id The public_id to check. - * @param string $type The asset type. - * - * @return array|\WP_Error - */ - public function get_asset_details( $public_id, $type ) { - $url = $this->url( 'resources', $type . '/upload/' . $public_id, true ); - - return $this->call( $url, array( 'body' => $args ), 'get' ); - } - /** * Upload a large asset in chunks. * diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php index e95bc6e31..09ef6f25d 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php @@ -47,34 +47,6 @@ class Push_Sync { */ protected $post_id; - /** - * Holds the media component. - * - * @var \Cloudinary\Media - */ - protected $media; - - /** - * Holds the sync component. - * - * @var \Cloudinary\Sync\ - */ - protected $sync; - - /** - * Holds the connect component. - * - * @var \Cloudinary\Connect - */ - protected $connect; - - /** - * Holds the Rest_API component. - * - * @var \Cloudinary\REST_API - */ - protected $api; - /** * Push_Sync constructor. * @@ -104,17 +76,6 @@ private function register_hooks() { add_filter( 'cloudinary_api_rest_endpoints', array( $this, 'rest_endpoints' ) ); } - /** - * Setup this component. - */ - public function setup() { - // Setup components. - $this->media = $this->plugin->components['media']; - $this->sync = $this->plugin->components['sync']; - $this->connect = $this->plugin->components['connect']; - $this->api = $this->plugin->components['api']; - } - /** * Add endpoints to the \Cloudinary\REST_API::$endpoints array. * @@ -182,7 +143,7 @@ public function rest_get_queue_status() { return rest_ensure_response( array( 'success' => true, - 'data' => $this->sync->managers['queue']->get_queue_status(), + 'data' => $this->plugin->components['sync']->managers['queue']->get_queue_status(), ) ); } @@ -197,13 +158,13 @@ public function rest_get_queue_status() { public function rest_start_sync( \WP_REST_Request $request ) { $stop = $request->get_param( 'stop' ); - $queue = $this->sync->managers['queue']->get_queue(); + $queue = $this->plugin->components['sync']->managers['queue']->get_queue(); if ( empty( $queue['pending'] ) || ! empty( $stop ) ) { - $this->sync->managers['queue']->stop_queue(); + $this->plugin->components['sync']->managers['queue']->stop_queue(); return $this->rest_get_queue_status(); // Nothing to sync. } - $this->sync->managers['queue']->start_queue(); + $this->plugin->components['sync']->managers['queue']->start_queue(); return $this->call_thread(); @@ -241,18 +202,18 @@ public function rest_push_attachments( \WP_REST_Request $request ) { // Process queue based. if ( ! empty( $last_id ) && ! empty( $last_result ) ) { - $this->sync->managers['queue']->mark( $last_id, $last_result ); + $this->plugin->components['sync']->managers['queue']->mark( $last_id, $last_result ); } - if ( ! $this->sync->managers['queue']->is_running() ) { // Check it wasn't stopped. + if ( ! $this->plugin->components['sync']->managers['queue']->is_running() ) { // Check it wasn't stopped. return $this->rest_get_queue_status(); } - $this->post_id = $this->sync->managers['queue']->get_post(); + $this->post_id = $this->plugin->components['sync']->managers['queue']->get_post(); // No post, end of queue. if ( empty( $this->post_id ) ) { - $this->sync->managers['queue']->stop_queue(); + $this->plugin->components['sync']->managers['queue']->stop_queue(); return $this->rest_get_queue_status(); } @@ -272,7 +233,7 @@ public function resume_queue() { add_filter( 'cloudinary_on_demand_sync_enabled', '__return_false' ); // Disable the on-demand sync since we want the status. define( 'DOING_BULK_SYNC', true ); // Define bulk sync in action. - if ( ! $this->sync->is_synced( $this->post_id ) ) { + if ( ! $this->plugin->components['sync']->is_synced( $this->post_id ) ) { $stat = $this->push_attachments( array( $this->post_id ) ); if ( ! empty( $stat['processed'] ) ) { $result = 'done'; @@ -308,7 +269,7 @@ private function call_thread( $last_id = null, $last_result = null ) { } // Setup background call to continue the queue. - $this->api->background_request( 'process', $params ); + $this->plugin->components['api']->background_request( 'process', $params ); return $this->rest_get_queue_status(); } @@ -343,7 +304,7 @@ private function get_sync_type( $attachment ) { $type = 'upload'; // Check for explicit (has public_id, but no breakpoints). - $attachment_signature = $this->sync->get_signature( $attachment->ID ); + $attachment_signature = $this->plugin->components['sync']->get_signature( $attachment->ID ); if ( empty( $attachment_signature ) ) { if ( ! empty( $attachment->{Sync::META_KEYS['public_id']} ) ) { // Has a public id but no signature, explicit update to complete download. @@ -352,7 +313,7 @@ private function get_sync_type( $attachment ) { // fallback to upload. } else { // Has signature find differences and use specific sync method. - $required_signature = $this->sync->generate_signature( $attachment->ID ); + $required_signature = $this->plugin->components['sync']->generate_signature( $attachment->ID ); foreach ( $required_signature as $key => $signature ) { if ( ( ! isset( $attachment_signature[ $key ] ) || $attachment_signature[ $key ] !== $signature ) && isset( $this->sync_types[ $key ] ) ) { return $this->sync_types[ $key ]; @@ -370,11 +331,11 @@ private function get_sync_type( $attachment ) { * Prepare an attachment for upload. * * @param int|\WP_Post $post The attachment to prepare. - * @param bool $push_sync Flag to determine if this prep is for a sync. True = build for syncing, false = build for validation. + * @param bool $down_sync Flag to determine if a missing file starts a downsync. * * @return array|\WP_Error */ - public function prepare_upload( $post, $push_sync = false ) { + public function prepare_upload( $post, $down_sync = false ) { if ( is_numeric( $post ) ) { $post = get_post( $post ); @@ -390,6 +351,9 @@ public function prepare_upload( $post, $push_sync = false ) { return new \WP_Error( 'attachment_post_expected', __( 'An attachment post was expected.', 'cloudinary' ) ); } + // Get the media component. + $media = $this->plugin->components['media']; + // First check if this has a file and it can be uploaded. $file = get_attached_file( $post->ID ); $file_size = 0; @@ -399,10 +363,10 @@ public function prepare_upload( $post, $push_sync = false ) { } elseif ( ! file_exists( $file ) ) { // May be an old upload type. $src = get_post_meta( $post->ID, '_wp_attached_file', true ); - if ( $this->media->is_cloudinary_url( $src ) ) { + if ( $media->is_cloudinary_url( $src ) ) { // Download first maybe. - if ( true === $push_sync ) { - $download = $this->sync->managers['download']->down_sync( $post->ID ); + if ( true === $down_sync ) { + $download = $this->plugin->components['sync']->managers['download']->down_sync( $post->ID ); if ( is_wp_error( $download ) ) { update_post_meta( $post->ID, Sync::META_KEYS['sync_error'], $download->get_error_message() ); @@ -420,12 +384,12 @@ public function prepare_upload( $post, $push_sync = false ) { $resource_type = $this->get_resource_type( $post ); $max_size = ( 'image' === $resource_type ? 'max_image_size' : 'max_video_size' ); - if ( ! empty( $this->connect->usage[ $max_size ] ) && $file_size > $this->connect->usage[ $max_size ] ) { - $max_size_hr = size_format( $this->connect->usage[ $max_size ] ); + if ( ! empty( $this->plugin->components['connect']->usage[ $max_size ] ) && $file_size > $this->plugin->components['connect']->usage[ $max_size ] ) { + $max_size_hr = size_format( $this->plugin->components['connect']->usage[ $max_size ] ); // translators: variable is file size. $error = sprintf( __( 'File size exceeds the maximum of %s. This media asset will be served from WordPress.', 'cloudinary' ), $max_size_hr ); - $this->media->delete_post_meta( $post->ID, Sync::META_KEYS['pending'] ); // Remove Flag. + $media->delete_post_meta( $post->ID, Sync::META_KEYS['pending'] ); // Remove Flag. // Cleanup flags delete_post_meta( $post->ID, Sync::META_KEYS['syncing'] ); @@ -439,8 +403,8 @@ public function prepare_upload( $post, $push_sync = false ) { $public_id = $post->{Sync::META_KEYS['public_id']}; // use the __get method on the \WP_Post to get post_meta. $cld_folder = trailingslashit( $settings['sync_media']['cloudinary_folder'] ); if ( empty( $public_id ) ) { - // Create a new public_id. - $public_id = $this->sync->generate_public_id( $post->ID ); + $file_info = pathinfo( $file ); + $public_id = $cld_folder . $file_info['filename']; } // Assume that the public_id is a root item. @@ -455,7 +419,7 @@ public function prepare_upload( $post, $push_sync = false ) { $public_id_file = $public_id_info['filename']; } // Check if this asset is a folder sync. - $folder_sync = $this->media->get_post_meta( $post->ID, Sync::META_KEYS['folder_sync'], true ); + $folder_sync = $media->get_post_meta( $post->ID, Sync::META_KEYS['folder_sync'], true ); if ( ! empty( $folder_sync ) && false === $downsync ) { $public_id_folder = $cld_folder; // Ensure the public ID folder is constant. } else { @@ -488,7 +452,7 @@ public function prepare_upload( $post, $push_sync = false ) { $imagesize = getimagesize( $file ); $meta['width'] = $imagesize[0]; } - $max_width = $this->media->get_max_width(); + $max_width = $media->get_max_width(); // Add breakpoints request options. if ( ! empty( $settings['global_transformations']['enable_breakpoints'] ) ) { $options['responsive_breakpoints'] = array( @@ -498,7 +462,7 @@ public function prepare_upload( $post, $push_sync = false ) { 'max_width' => $meta['width'] < $max_width ? $meta['width'] : $max_width, 'min_width' => $settings['global_transformations']['min_width'], ); - $transformations = $this->media->get_transformation_from_meta( $post->ID ); + $transformations = $media->get_transformation_from_meta( $post->ID ); if ( ! empty( $transformations ) ) { $options['responsive_breakpoints']['transformation'] = Api::generate_transformation_string( $transformations ); } @@ -529,39 +493,11 @@ public function prepare_upload( $post, $push_sync = false ) { } // Restructure the path to the filename to allow correct placement in Cloudinary. - $public_id = ltrim( $public_id_folder . $options['public_id'], '/' ); - // If this is a push sync, make sure the ID is allowed and unique. - - // Setup suffix data for unique ids. - $suffix_defaults = array( - 'public_id' => $public_id, - 'suffix' => null, - ); - $suffix_meta = $this->media->get_post_meta( $post->ID, Sync::META_KEYS['suffix'], true ); - $suffix_data = wp_parse_args( $suffix_meta, $suffix_defaults ); - - // Prepare a uniqueness check and get a suffix if needed. - if ( true === $push_sync ) { - if ( $public_id !== $suffix_data['public_id'] || empty( $suffix_data['suffix'] ) ) { - $suffix_data['suffix'] = $this->sync->add_suffix_maybe( $public_id, $post->ID ); - if ( ! empty( $suffix_data['suffix'] ) ) { - // Only save if there is a suffix to save on metadata. - $this->media->update_post_meta( $post->ID, Sync::META_KEYS['suffix'], $suffix_data ); - } else { - // Clear meta data in case of a unique name on a rename etc. - $this->media->delete_post_meta( $post->ID, Sync::META_KEYS['suffix'] ); - } - } - } - // Add Suffix to public_id. - if ( ! empty( $suffix_data['suffix'] ) ) { - $public_id = $public_id . $suffix_data['suffix']; - } + $public_id = ltrim( $public_id_folder . $options['public_id'], '/' ); $return = array( 'file' => $file, 'folder' => ltrim( $cld_folder, '/' ), 'public_id' => $public_id, - 'suffix' => $suffix_data['suffix'], 'breakpoints' => array(), 'options' => $options, ); @@ -606,6 +542,8 @@ public function push_attachments( $attachments ) { 'total' => count( $attachments ), 'processed' => 0, ); + // Get media component. + $media = $this->plugin->components['media']; // Go over each attachment. foreach ( $attachments as $attachment ) { @@ -659,48 +597,48 @@ public function push_attachments( $attachments ) { if ( ! empty( $upload['options']['context'] ) ) { $args['context'] = $upload['options']['context']; } - $result = $this->connect->api->explicit( $args ); + $result = $this->plugin->components['connect']->api->explicit( $args ); } elseif ( 'rename' === $sync_type ) { // Rename an asset. $args = array( - 'from_public_id' => $this->media->get_post_meta( $attachment->ID, Sync::META_KEYS['public_id'] ), + 'from_public_id' => $media->get_post_meta( $attachment->ID, Sync::META_KEYS['public_id'] ), 'to_public_id' => $upload['public_id'], ); - $result = $this->connect->api->{$upload['options']['resource_type']}( 'rename', 'POST', $args ); + $result = $this->plugin->components['connect']->api->{$upload['options']['resource_type']}( 'rename', 'POST', $args ); } else { // dynamic sync type.. - $result = $this->connect->api->{$sync_type}( $upload['file'], $upload['options'] ); + $result = $this->plugin->components['connect']->api->{$sync_type}( $upload['file'], $upload['options'] ); } } else { // Large Upload. - $result = $this->connect->api->upload_large( $upload['file'], $upload['options'] ); + $result = $this->plugin->components['connect']->api->upload_large( $upload['file'], $upload['options'] ); } // Exceptions are handled by the Upload wrapper class and returned as \WP_Error, so check for it. if ( is_wp_error( $result ) ) { $error = $result->get_error_message(); $stats['fail'][] = $error; - $this->media->update_post_meta( $attachment->ID, Sync::META_KEYS['sync_error'], $error ); + $media->update_post_meta( $attachment->ID, Sync::META_KEYS['sync_error'], $error ); continue; } // Successful upload, so lets update meta. if ( is_array( $result ) && ( array_key_exists( 'public_id', $result ) || array_key_exists( 'public_ids', $result ) ) ) { $meta_data = array( - Sync::META_KEYS['signature'] => $this->sync->generate_signature( $attachment->ID ), + Sync::META_KEYS['signature'] => $this->plugin->components['sync']->generate_signature( $attachment->ID ), ); // We only have a version if updating a file or an upload. if ( ! empty( $result['version'] ) ) { $meta_data[ Sync::META_KEYS['version'] ] = $result['version']; } - $this->media->delete_post_meta( $attachment->ID, Sync::META_KEYS['pending'] ); + $media->delete_post_meta( $attachment->ID, Sync::META_KEYS['pending'] ); // Cleanup flags delete_post_meta( $attachment->ID, Sync::META_KEYS['downloading'] ); delete_post_meta( $attachment->ID, Sync::META_KEYS['syncing'] ); - $this->media->delete_post_meta( $attachment->ID, Sync::META_KEYS['sync_error'], false ); + $media->delete_post_meta( $attachment->ID, Sync::META_KEYS['sync_error'], false ); if ( ! empty( $this->plugin->config['settings']['global_transformations']['enable_breakpoints'] ) ) { if ( ! empty( $result['responsive_breakpoints'] ) ) { // Images only. $meta_data[ Sync::META_KEYS['breakpoints'] ] = $result['responsive_breakpoints'][0]['breakpoints']; @@ -709,12 +647,6 @@ public function push_attachments( $attachments ) { delete_post_meta( $attachment->ID, Sync::META_KEYS['breakpoints'] ); } } - - // Reset public_id without suffix. - if ( ! empty( $upload['suffix'] ) ) { - $upload['options']['public_id'] = strstr( $upload['options']['public_id'], $upload['suffix'], true ); - } - // Generate a public_id sync hash. if ( ! empty( $upload['options']['public_id'] ) ) { // a transformation breakpoints only ever happens on a down sync. $sync_key = '_' . md5( $upload['options']['public_id'] ); @@ -727,8 +659,7 @@ public function push_attachments( $attachments ) { $meta = wp_get_attachment_metadata( $attachment->ID, true ); $meta[ Sync::META_KEYS['cloudinary'] ] = $meta_data; wp_update_attachment_metadata( $attachment->ID, $meta ); - - $this->media->update_post_meta( $attachment->ID, Sync::META_KEYS['public_id'], $upload['options']['public_id'] ); + $media->update_post_meta( $attachment->ID, Sync::META_KEYS['public_id'], $upload['options']['public_id'] ); // Search and update link references in content. $content_search = new \WP_Query( array( 's' => 'wp-image-' . $attachment->ID, 'fields' => 'ids', 'posts_per_page' => 1000 ) ); if ( ! empty( $content_search->found_posts ) ) { From e91287b73ea9e68bb2203ad2abcc85862757a7e3 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Fri, 31 Jul 2020 16:46:39 +0100 Subject: [PATCH 39/39] Bump plugin version --- .../cloudinary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php index 656178dfa..75a0bb3a3 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php @@ -3,7 +3,7 @@ * Plugin Name: Cloudinary * Plugin URI: https://cloudinary.com/documentation/wordpress_integration * Description: With the Cloudinary plugin, you can upload and manage your media assets in the cloud, then deliver them to your users through a fast content delivery network, improving your website’s loading speed and overall user experience. Apply multiple transformations and take advantage of a full digital asset management solution without leaving WordPress. - * Version: 2.1.8 + * Version: 2.1.9 * Author: Cloudinary Ltd., XWP * Author URI: https://cloudinary.com/ * License: GPLv2+