Skip to content
Merged

Uat #150

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
17257b0
Make sure that "controls" takes the correct value
Jul 6, 2020
29b0976
Remove unslash when editing in Gutenberg
Jul 7, 2020
58d32f9
Increment player version to 1.4.0
Jul 14, 2020
3833c24
Upgrade core version
Jul 14, 2020
d6e799d
Add message warning users about muted autoplay
Jul 16, 2020
412a38f
Add method to check is auto sync is enabled
Jul 22, 2020
f11d629
Leverage the new method to check if auto sync is enabled
Jul 22, 2020
b7a7ac6
Syncing flag should only be set if auto sync is enabled
Jul 22, 2020
eb0e114
add generate new public ID and check methods on sync
DavidCramer Jul 23, 2020
c2f5f7e
add generate new public ID if image, video, or audio only
DavidCramer Jul 23, 2020
8422db9
shorten component usage
DavidCramer Jul 23, 2020
6fb302d
setup component
DavidCramer Jul 23, 2020
f155289
catch context ID to attempt a reconnection rather than generating a n…
DavidCramer Jul 23, 2020
b0c00e4
Make the assets upgrade mechanism more resilient
Jul 23, 2020
a99ea46
Address issues
DavidCramer Jul 23, 2020
ab1d698
Add 'muted' attribute if autoplay is on (required by browsers)
Jul 23, 2020
e8f20d7
Remove unslash when editing in Gutenberg
Jul 23, 2020
7b7d3ad
check file existance over fetch details, change prefix to suffix
DavidCramer Jul 24, 2020
0188a8b
merge develop
DavidCramer Jul 24, 2020
28aa354
split process to make sure the ID is unique after filtering.
DavidCramer Jul 24, 2020
072039c
Make sure that "controls" takes the correct value
Jul 24, 2020
dbcf3cd
add suffix data to enable splitting public_id and unique suffix
DavidCramer Jul 27, 2020
ad70a2d
merge develop
DavidCramer Jul 27, 2020
1f970b7
Merge pull request #134 from cloudinary/feature/improve-upgrade-resil…
pereirinha Jul 27, 2020
cdbfb39
remove comma and cleanup formatting
DavidCramer Jul 27, 2020
0bfa56f
cleanup formatting
DavidCramer Jul 27, 2020
6faac36
Merge pull request #135 from cloudinary/fix/parse-error-in-settings
pereirinha Jul 27, 2020
97a564e
typo on post_id
DavidCramer Jul 27, 2020
a4812af
Merge pull request #131 from cloudinary/hotfix/sync-status
pereirinha Jul 27, 2020
1229132
Merge pull request #133 from cloudinary/feature/unique-filesnames
pereirinha Jul 27, 2020
ae03438
Merge branch 'develop' into UAT
Jul 27, 2020
efd08e9
Add compiled assets
Jul 27, 2020
2a1c234
Bump plugin version
Jul 27, 2020
1e2981e
Rename Cloudinary font
Jul 28, 2020
82f9419
Add compiled asset
Jul 28, 2020
6c51382
Make content hash as part of the font filename
Jul 28, 2020
22bbb9d
Remove unecessary cache busters
Jul 28, 2020
6f1d3ae
Merge pull request #137 from cloudinary/fix/cached-fonts
pereirinha Jul 29, 2020
965bf6b
Bump plugin version
Jul 29, 2020
5347270
Merge pull request #138 from cloudinary/update/version
pereirinha Jul 29, 2020
6900f59
Cleanup
Jul 29, 2020
4ad3d43
Update fonts
Jul 29, 2020
a6e1fa5
Update styling
Jul 29, 2020
d5d0b66
Bump plugin version
Jul 29, 2020
0241795
Merge pull request #139 from cloudinary/hotfix/fonts
pereirinha Jul 29, 2020
6543423
Merge pull request #140 from cloudinary/UAT
pereirinha Jul 29, 2020
c4e38a1
Cleanup syncing and downloading keys if processes fails
Jul 29, 2020
7e3e291
No need for the suffix if we are downloading the asset
Jul 29, 2020
0b50c15
Merge pull request #141 from cloudinary/hotfix/downsync
pereirinha Jul 29, 2020
402b347
Bump plugin version
Jul 29, 2020
21c62ce
Merge pull request #142 from cloudinary/update/version
pereirinha Jul 29, 2020
a58cb5c
Ensure that the downloading process did not kickoff
Jul 30, 2020
e167366
Merge pull request #144 from cloudinary/hotfix/downsync
pereirinha Jul 30, 2020
0600246
Revert "Feature/unique-filenames"
pereirinha Jul 31, 2020
847f0c2
Merge branch 'UAT' into revert-133-feature/unique-filesnames
pereirinha Jul 31, 2020
cbbbd41
Merge pull request #146 from cloudinary/revert-133-feature/unique-fil…
pereirinha Jul 31, 2020
e91287b
Bump plugin version
Jul 31, 2020
df01531
Merge pull request #147 from cloudinary/update/version
pereirinha Jul 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.9
* Author: Cloudinary Ltd., XWP
* Author URI: https://cloudinary.com/
* License: GPLv2+
Expand Down

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down
Binary file modified cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.eot
100755 → 100644
Binary file not shown.
2 changes: 2 additions & 0 deletions ...image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.ttf
100755 → 100644
Binary file not shown.
Binary file modified cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/fonts/cloudinary.woff
100755 → 100644
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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();
}

Expand Down Expand Up @@ -167,13 +185,44 @@ 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.
}

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.
*/
Expand All @@ -193,5 +242,7 @@ public function setup_hooks() {
}
} );
}

add_action( 'cloudinary_resume_upgrade', array( $this, 'maybe_resume_upgrade' ) );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ class Video {
*
* @var string
*/
const PLAYER_VER = '1.3.3';
const PLAYER_VER = '1.4.0';

/**
* Cloudinary Core Version.
*
* @var string
*/
const CORE_VER = '2.6.2';
const CORE_VER = '2.6.3';

/**
* Meta key to store usable video transformations for an attachment.
Expand Down Expand Up @@ -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'];
Expand Down Expand Up @@ -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' ) ) {
Expand Down Expand Up @@ -348,7 +350,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,
);
Expand All @@ -363,9 +364,9 @@ public function print_video_scripts() {
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'] ? true : false;
$cld_videos[ $instance ] = $config;

}

if ( empty( $cld_videos ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ public function prepare_upload( $post, $down_sync = false ) {
if ( true === $down_sync ) {
$download = $this->plugin->components['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() );
Expand Down Expand Up @@ -619,6 +620,7 @@ public function push_attachments( $attachments ) {
$error = $result->get_error_message();
$stats['fail'][] = $error;
$media->update_post_meta( $attachment->ID, Sync::META_KEYS['sync_error'], $error );
delete_post_meta( $attachment->ID, Sync::META_KEYS['syncing'] );
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public function mark( $id, $type = 'done' ) {
$queue[ $type ][] = '<div>' . basename( $file ) . ': ' . $state->get_error_message() . '</div>';
// 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 ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Loading