Skip to content

Commit

Permalink
Add integration with Flatsome theme gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
av3nger committed Jul 5, 2024
1 parent 8ec842c commit 51934e1
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Added:
* Integration with WPBakery page builder image galleries
* Integration with Elementor Pro Gallery
* Integration with Flatsome theme gallery
* cf_images_upload_host filter to adjust the image host ID

Changed:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ If something is still not working for you, please let me know by creating a supp
Added:
* Integration with WPBakery page builder image galleries
* Integration with Elementor Pro Gallery
* Integration with Flatsome theme gallery
* cf_images_upload_host filter to adjust the image host ID

Changed:
Expand Down
2 changes: 2 additions & 0 deletions app/class-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ private function set_cdn_domain() {
* @see Integrations\Wpml
* @see Integrations\Shortpixel
* @see Integrations\JS_Composer
* @see Integrations\Flatsome
*/
private function init_integrations() {
$loader = Loader::get_instance();
Expand All @@ -191,6 +192,7 @@ private function init_integrations() {
$loader->integration( 'shortpixel' );
$loader->integration( 'elementor' );
$loader->integration( 'js-composer' );
$loader->integration( 'flatsome' );
}

/**
Expand Down
52 changes: 52 additions & 0 deletions app/integrations/class-flatsome.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/**
* Flatsome theme integration class
*
* This class adds compatibility with the Flatsome theme.
*
* @link https://vcore.au
*
* @package CF_Images
* @subpackage CF_Images/App/Integrations
* @author Anton Vanyukov <a.vanyukov@vcore.ru>
* @since 1.9.2
*/

namespace CF_Images\App\Integrations;

use CF_Images\App\Modules\Cloudflare_Images;

if ( ! defined( 'WPINC' ) ) {
die;
}

/**
* Flatsome class.
*
* @since 1.9.2
*/
class Flatsome {
/**
* Class constructor.
*
* @since 1.9.2
*/
public function __construct() {
add_action( 'wp_ajax_flatsome_additional_variation_images_load_images_ajax_frontend', array( $this, 'load_images_ajax' ) );
add_action( 'wp_ajax_nopriv_flatsome_additional_variation_images_load_images_ajax_frontend', array( $this, 'load_images_ajax' ) );
}

/**
* Add support for additional variation images (Flatsome gallery).
*
* @since 1.9.2
*/
public function load_images_ajax() {
if ( is_admin() ) {
return;
}

$cf_images = new Cloudflare_Images( 'cloudflare-images' );
add_filter( 'wp_get_attachment_image_src', array( $cf_images, 'get_attachment_image_src' ), 10, 3 );
}
}
2 changes: 1 addition & 1 deletion app/integrations/class-js-composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class JS_Composer {
/**
* Class constructor.
*
* @since 1.4.0
* @since 1.9.2
*/
public function __construct() {
add_filter( 'vc_wpb_getimagesize', array( $this, 'fix_getimagesize_paths' ), 10, 3 );
Expand Down

0 comments on commit 51934e1

Please sign in to comment.