Skip to content

Commit afa5a35

Browse files
author
Marco Pereirinha
committed
Include the Storage as part of the CLDN object
1 parent 0f7bf57 commit afa5a35

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

php/class-media.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,6 +2042,7 @@ public function editor_assets() {
20422042
wp_enqueue_style( 'cloudinary' );
20432043
$params = array(
20442044
'nonce' => wp_create_nonce( 'wp_rest' ),
2045+
'storage' => $this->plugin->components['storage']->get_settings( 'offload' ),
20452046
'mloptions' => array(
20462047
'cloud_name' => $this->credentials['cloud_name'],
20472048
'api_key' => $this->credentials['api_key'],

php/sync/class-storage.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* @package Cloudinary
66
*/
77

8-
namespace Cloudinary;
9-
108
namespace Cloudinary\Sync;
119

1210
use Cloudinary\Component\Notice;
@@ -467,7 +465,7 @@ public function unique_filename( $filename, $ext, $dir ) {
467465
$base['count'] = '-' . $count;
468466
$file_path = path_join( $path, implode( '', $base ) );
469467
$filename = implode( '', $base );
470-
$count ++;
468+
++$count;
471469
}
472470

473471
return $filename;
@@ -571,4 +569,23 @@ public function is_local_full() {
571569

572570
return ! empty( $sync_media['offload'] ) && 'dual_full' === $sync_media['offload'];
573571
}
572+
573+
/**
574+
* Get the settings for Storage.
575+
*
576+
* @param string $setting The Setting to get.
577+
*
578+
* @return array|string|null
579+
*/
580+
public function get_settings( $setting = null ) {
581+
if ( is_null( $setting ) ) {
582+
return $this->settings;
583+
}
584+
585+
if ( isset( $this->settings[ $setting ] ) ) {
586+
return $this->settings[ $setting ];
587+
}
588+
589+
return null;
590+
}
574591
}

0 commit comments

Comments
 (0)