Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 27 additions & 0 deletions php/class-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,32 @@ 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}
*
* @example
* <?php
*
* // Filter Cloudinary max files per import.
* add_filter(
* 'cloudinary_max_files_import',
* static function() {
* return 100;
* }
* );
*/
$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 );
Expand All @@ -1924,6 +1950,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' ),
Expand Down
34 changes: 19 additions & 15 deletions php/delivery/class-lazy-load.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <?php
*
* // Extend bypass lazy load classes to include `skip-lazy`.
* add_filter(
* 'cloudinary_lazy_load_bypass_classes',
* function( $classes ) {
* $classes[] = 'skip-lazy';
* return $classes;
* }
* 'cloudinary_lazy_load_bypass_classes',
* function( $classes ) {
* $classes[] = 'skip-lazy';
* return $classes;
* }
* );
*
* @param $classes {array} Classes that bypass the Lazy Load.
*/
$bypass_classes = apply_filters( 'cloudinary_lazy_load_bypass_classes', array( 'cld-bypass-lazy' ) );

Expand Down Expand Up @@ -264,10 +266,12 @@ public function add_features( $tag_element ) {
*
* @hook cloudinary_lazy_load_bypass
*
* @since 3.0.9
*
* @param $short_circuit {bool} The short circuit value.
* @param $tag_element {array} The tag element.
*
* @since 3.0.9
* @return {bool}
*
* @example
* <?php
Expand All @@ -276,11 +280,11 @@ public function add_features( $tag_element ) {
* add_filter(
* 'cloudinary_lazy_load_bypass',
* function( $bypass, $tag_element ) {
* if ( 'feature-image! === $tag_element['id'] ) {
* $bypass = true;
* }
* return $bypass;
* }
* if ( 'feature-image! === $tag_element['id'] ) {
* $bypass = true;
* }
* return $bypass;
* }
* );
*/
if ( apply_filters( 'cloudinary_lazy_load_bypass', false, $tag_element ) ) {
Expand Down