This repository has been archived on 2022-06-23. You can view files and clone it, but cannot push or open issues or pull requests.
divi/includes/builder/plugin-compat/jucra-acf-google-maps-for-divi.php
2021-12-07 11:08:05 +00:00

61 lines
1.3 KiB
PHP

<?php
/**
* Plugin compatibility for Jucra ACF Maps.
*
* @package Divi
* @subpackage Builder
* @since 4.10.5
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Plugin compatibility for Jucra ACF Maps.
*
* @since 4.10.5
*
* @link https://www.jucra.com/display-acf-maps-in-a-divi-theme-builder-page/
*/
class ET_Builder_Plugin_Compat_Jucra_ACF_Maps extends ET_Builder_Plugin_Compat_Base {
/**
* Constructor
*/
public function __construct() {
$this->plugin_id = 'jucra-acf-google-maps-for-divi/index.php';
$this->init_hooks();
}
/**
* Hook methods to WordPress
*
* @return void
*/
public function init_hooks() {
add_filter( 'et_builder_enable_jquery_body', [ $this, 'maybe_disable_jquery_body' ], 10, 2 );
}
/**
* Disable JQuery Body feature when showing a map
*
* @since 4.10.5
*
* @param bool $enabled Whether the feature should be enabled or not.
* @param string $content TB/Post Content.
*
* @return bool
*/
public function maybe_disable_jquery_body( $enabled, $content = '' ) {
if ( empty( $content ) ) {
return $enabled;
}
// disable when the shortcode is found.
return false === strpos( $content, 'jucra_acf_map' ) ? $enabled : false;
}
}
new ET_Builder_Plugin_Compat_Jucra_ACF_Maps();