From 9294d8135a79a28038ee3150f05bbbc29143d7f3 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Fri, 5 May 2023 12:12:21 +0100 Subject: [PATCH 1/3] Adds filter to the max allowed files to be imported in a single batch --- php/class-media.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/php/class-media.php b/php/class-media.php index d3c85ebb7..c2f23184a 100644 --- a/php/class-media.php +++ b/php/class-media.php @@ -1911,6 +1911,20 @@ public function media_template() { public function editor_assets() { $deps = wp_script_is( 'cld-core', 'registered' ) ? array( 'cld-core' ) : array(); $this->plugin->register_assets(); // Ensure assets are registered. + + /** + * Filter the maximum number of files that can be imported from Cloudinary. + * + * @hook cloudinary_max_files_import + * @since 3.1.3 + * + * @param $max_files {int} The maximum number of files that can be imported from Cloudinary. + * @default 20 + * + * @return {int} + */ + $max_files = apply_filters( 'cloudinary_max_files_import', 20 ); + // External assets. wp_enqueue_script( 'cloudinary-media-modal', $this->plugin->dir_url . '/js/media-modal.js', null, $this->plugin->version, true ); wp_enqueue_script( 'cloudinary-media-library', CLOUDINARY_ENDPOINTS_MEDIA_LIBRARY, $deps, $this->plugin->version, true ); @@ -1924,6 +1938,7 @@ public function editor_assets() { 'cms_type' => 'wordpress', 'insert_caption' => __( 'Import', 'cloudinary' ), 'remove_header' => true, + 'max_files' => $max_files, 'integration' => array( 'type' => 'wordpress_plugin', 'platform' => 'WordPress ' . get_bloginfo( 'version' ), From f04e9bb9083c1fce0ddd3a381f5b0c1ad5e63789 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 31 May 2023 16:33:22 +0100 Subject: [PATCH 2/3] Add documentation example --- php/class-media.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/php/class-media.php b/php/class-media.php index c2f23184a..35604d453 100644 --- a/php/class-media.php +++ b/php/class-media.php @@ -1915,13 +1915,25 @@ public function editor_assets() { /** * Filter the maximum number of files that can be imported from Cloudinary. * - * @hook cloudinary_max_files_import - * @since 3.1.3 + * @hook cloudinary_max_files_import + * @since 3.1.3 * * @param $max_files {int} The maximum number of files that can be imported from Cloudinary. + * * @default 20 * - * @return {int} + * @return {int} + * + * @example + * Date: Wed, 31 May 2023 16:38:50 +0100 Subject: [PATCH 3/3] Improve documentation consistency --- php/delivery/class-lazy-load.php | 34 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/php/delivery/class-lazy-load.php b/php/delivery/class-lazy-load.php index cfbde17c1..126d8882b 100644 --- a/php/delivery/class-lazy-load.php +++ b/php/delivery/class-lazy-load.php @@ -86,22 +86,24 @@ public function bypass_lazy_load( $bypass, $tag_element ) { /** * Filter the classes that bypass lazy loading. * - * @hook cloudinary_lazy_load_bypass_classes - * @since 3.0.9 + * @hook cloudinary_lazy_load_bypass_classes + * @since 3.0.9 + * + * @param $classes {array} Classes that bypass the Lazy Load. + * + * @return {bool} * * @example *