Skip to content

Commit e8828c6

Browse files
authored
release(minor): v3.14
#### New Features - You can now create **sub-API keys** in the Optimole dashboard to connect sites while restricting access to specific folders. Ideal for agencies and multi-site users, this feature allows **folder-level access control**. - **Bulk delete assets in the Cloud Library**, including entire folders with their contents. #### Enhancements - Added **basic previews for video and audio files** in the Optimole dashboard, now with an **asset player** in the file details modal. - **Increased the maximum file upload size** in the Cloud Library to **100MB** for better support of larger media files. - The **Cloud Library now remembers your last used display mode**, keeping your preferred **folder view or image gallery view** for a smoother experience. - **Improved folder listing**, allowing more than **50 folders** to load dynamically for better navigation. - **Optimized upload process** by uploading files faster to our cloud. #### Bug Fixes - **Fixed folder movement behavior**, preventing folders from being moved into their own subfolders. - **Fixed folder creation modal layout**, ensuring button text is displayed correctly.
2 parents 3198d7c + 365d9e8 commit e8828c6

File tree

10 files changed

+92
-15
lines changed

10 files changed

+92
-15
lines changed

assets/src/dashboard/parts/components/Modal.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function Modal({ icon, labels = {}, onRequestClose = () => {}, on
1212
'bg-stale-yellow': 'warning' === variant,
1313
'bg-light-blue': 'default' === variant
1414
},
15-
'p-3 rounded-full'
15+
'p-2 rounded-full flex items-center justify-center'
1616
);
1717

1818
const actionButtonClasses = classnames(
@@ -37,11 +37,12 @@ export default function Modal({ icon, labels = {}, onRequestClose = () => {}, on
3737
/>
3838

3939
<div className="flex flex-col items-center">
40-
<Icon
41-
icon={ icon }
42-
size={ 24 }
43-
className={iconClasses}
44-
/>
40+
<span className={iconClasses}>
41+
<Icon
42+
icon={ icon }
43+
size={ 24 }
44+
/>
45+
</span>
4546

4647
<h2
4748
className="mb-0"

assets/src/dashboard/parts/connected/settings/OffloadMedia.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useDispatch, useSelect } from '@wordpress/data';
66
import { Icon } from '@wordpress/icons';
77

88
import { warning, rollback as rollbackIcon, offload, warningAlt, sync } from '../../../utils/icons';
9-
import { callSync, checkOffloadConflicts, saveSettings } from '../../../utils/api';
9+
import { callSync, clearOffloadErrors, checkOffloadConflicts, saveSettings } from '../../../utils/api';
1010
import Notice from '../../components/Notice';
1111
import RadioBoxes from '../../components/RadioBoxes';
1212
import ProgressTile from '../../components/ProgressTile';
@@ -113,7 +113,9 @@ const OffloadMedia = ({ settings, canSave, setSettings, setCanSave }) => {
113113
}, []);
114114

115115

116-
const onOffloadMedia = ( imageIds = []) => {
116+
const onOffloadMedia = async( imageIds = []) => {
117+
await clearOffloadErrors();
118+
117119
const nextSettings = { ...settings };
118120
nextSettings['show_offload_finish_notice'] = '';
119121
nextSettings['offloading_status'] = 'enabled';

assets/src/dashboard/utils/api.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,17 @@ export const callSync = ( data ) => {
592592
});
593593
};
594594

595+
export const clearOffloadErrors = async() => {
596+
try {
597+
return await apiFetch({
598+
path: optimoleDashboardApp.routes['clear_offload_errors'],
599+
method: 'GET'
600+
});
601+
} catch ( error ) {
602+
console.log( error );
603+
}
604+
};
605+
595606
export const addNotice = ( text ) => {
596607
createNotice(
597608
'info',

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inc/app_replacer.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,15 @@ protected function parse_dimensions_from_filename( $src ) {
612612
if ( $width && $height ) {
613613
return [ $width, $height, $crop ];
614614
}
615+
} else {
616+
$optimized_args = $this->parse_dimension_from_optimized_url( $src );
617+
if ( $optimized_args[0] !== 'auto' || $optimized_args[1] !== 'auto' ) {
618+
return [
619+
$optimized_args[0] !== 'auto' ? (int) $optimized_args[0] : false,
620+
$optimized_args[1] !== 'auto' ? (int) $optimized_args[1] : false,
621+
false,
622+
];
623+
}
615624
}
616625

617626
return [ false, false, false ];

inc/main.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static function instance() {
9292

9393
if ( null === self::$_instance ) {
9494
add_filter( 'themeisle_sdk_products', [ __CLASS__, 'register_sdk' ] );
95-
add_filter( 'themeisle_sdk_ran_promos', '__return_true' );
95+
add_filter( 'themeisle_sdk_ran_promos', [ __CLASS__, 'sdk_hide_promo_notice' ] );
9696
add_filter( 'optimole-wp_uninstall_feedback_icon', [ __CLASS__, 'change_icon' ] );
9797
add_filter( 'optimole_wp_uninstall_feedback_after_css', [ __CLASS__, 'adds_uf_css' ] );
9898
add_filter( 'optimole_wp_feedback_review_message', [ __CLASS__, 'change_review_message' ] );
@@ -246,4 +246,19 @@ public function __clone() {
246246
public function __wakeup() {
247247
_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'optimole-wp' ), '1.0.0' );
248248
}
249+
250+
/**
251+
* Hide SDK promo notice for pro uses.
252+
*
253+
* @access public
254+
*/
255+
public static function sdk_hide_promo_notice( $should_show ) {
256+
if ( self::$_instance->admin->settings->is_connected() ) {
257+
$service_data = self::$_instance->admin->settings->get( 'service_data' );
258+
if ( isset( $service_data['plan'] ) && 'free' !== $service_data['plan'] ) {
259+
return true;
260+
}
261+
}
262+
return $should_show;
263+
}
249264
}

inc/media_offload.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2754,4 +2754,18 @@ private function get_offloaded_attachment_url( $attachment_id, $url ) {
27542754

27552755
return $url;
27562756
}
2757+
2758+
/**
2759+
* Cleanup the offload errors meta.
2760+
*/
2761+
public static function clear_offload_errors_meta() {
2762+
global $wpdb;
2763+
2764+
return $wpdb->query(
2765+
$wpdb->prepare(
2766+
"DELETE FROM {$wpdb->postmeta} WHERE meta_key = %s",
2767+
self::META_KEYS['offload_error']
2768+
)
2769+
);
2770+
}
27572771
}

inc/rest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class Optml_Rest {
7878
],
7979
'media_cloud_routes' => [
8080
'number_of_images_and_pages' => 'POST',
81+
'clear_offload_errors' => 'GET',
8182
'get_offload_conflicts' => 'GET',
8283
],
8384
'watermark_routes' => [
@@ -867,6 +868,19 @@ public function number_of_images_and_pages( WP_REST_Request $request ) {
867868
return $this->response( Optml_Media_Offload::get_image_count( $action, $refresh, $images ) );
868869
}
869870

871+
/**
872+
* Clear the offload errors from previous offload attempts.
873+
*
874+
* @param WP_REST_Request $request Rest request object.
875+
*
876+
* @return WP_REST_Response
877+
*/
878+
public function clear_offload_errors( WP_REST_Request $request ) {
879+
$delete_count = Optml_Media_Offload::clear_offload_errors_meta();
880+
881+
return $this->response( [ 'success' => $delete_count ] );
882+
}
883+
870884
/**
871885
* Get conflicts list.
872886
*

inc/tag_replacer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
final class Optml_Tag_Replacer extends Optml_App_Replacer {
1010
use Optml_Normalizer;
1111
use Optml_Validator;
12+
use Optml_Dam_Offload_Utils;
1213

1314
/**
1415
* Cached object instance.

tests/test-lazyload.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class Test_Lazyload extends WP_UnitTestCase {
2525
<img src="http://example.org/wp-content/optimole-wp/assets/img/logo5.gif">
2626
';
2727
const DAM_IMG_TAG = '<img width="100" height="200" src="https://cloudUrlTest.test/dam:1/w:auto/h:auto/q:auto/id:b1b12ee03bf3945d9d9bb963ce79cd4f/https://test-site.test/9.jpg">';
28+
const DAM_IMG_TAG_NO_WIDTH = '<img src="https://cloudUrlTest.test/w:200/h:300/process:20202/q:auto/id:b1b12ee03bf3945d9d9bb963ce79cd4f/https://test-site.test/9.jpg">';
2829
public function setUp() : void {
2930
parent::setUp();
3031
$settings = new Optml_Settings();
@@ -575,4 +576,13 @@ public function test_dam_lazyloading() {
575576

576577
$this->assertStringContainsString( 'data-opt-src="https://cloudUrlTest.test/w:100/h:200/rt:fill/g:ce/ig:avif/q:mauto/id:b1b12ee03bf3945d9d9bb963ce79cd4f/https://test-site.test/9.jpg"', $replaced_content );
577578
}
579+
public function test_dam_lazyloading_no_wh_attributes() {
580+
add_filter('optml_lazyload_images_skip','__return_zero');
581+
Optml_Manager::instance()->lazyload_replacer->settings->update('lazyload_placeholder','enabled');
582+
Optml_Manager::instance()->lazyload_replacer->init();
583+
$replaced_content = Optml_Manager::instance()->process_images_from_content( self::DAM_IMG_TAG_NO_WIDTH );
584+
$svg = Optml_Manager::instance()->lazyload_replacer->get_svg_for( 200, 300, 'http://example.org/testimage.png' );
585+
$this->assertStringContainsString( $svg, $replaced_content );
586+
remove_filter('optml_lazyload_images_skip','__return_zero');
587+
}
578588
}

0 commit comments

Comments
 (0)