-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration with Flatsome theme gallery
- Loading branch information
Showing
5 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters