| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || exit; |
| 3 |
|
| 4 |
add_filter('ultp_addons_config', 'ultp_divi_config'); |
| 5 |
function ultp_divi_config( $config ) { |
| 6 |
$configuration = array( |
| 7 |
'name' => __( 'Divi', 'ultimate-post' ), |
| 8 |
'desc' => __( 'It lets you use PostX’s Gutenberg blocks in the Divi Builder by using the Saved Template Addon.', 'ultimate-post' ), |
| 9 |
'img' => ULTP_URL.'/assets/img/addons/divi.svg', |
| 10 |
'is_pro' => false, |
| 11 |
'live' => 'https://www.wpxpo.com/use-gutenberg-blocks-in-divi-builder/live_demo_args', |
| 12 |
'docs' => 'https://wpxpo.com/docs/postx/add-on/divi-addon/?utm_source=postx-menu&utm_medium=addons-demo&utm_campaign=postx-dashboard', |
| 13 |
'video' => 'https://www.youtube.com/watch?v=p9RKTYzqU48', |
| 14 |
'position' => 20, |
| 15 |
'integration' => true |
| 16 |
); |
| 17 |
$arr['ultp_divi'] = $configuration; |
| 18 |
return $arr + $config; |
| 19 |
} |
| 20 |
|
| 21 |
|
| 22 |
function ultp_divi_builder() { |
| 23 |
$settings = ultimate_post()->get_setting('ultp_divi'); |
| 24 |
if ($settings == 'true') { |
| 25 |
if ( class_exists( 'ET_Builder_Module' ) ) { |
| 26 |
require_once ULTP_PATH.'/addons/divi/divi.php'; |
| 27 |
|
| 28 |
$action = isset($_GET['action']) ? sanitize_text_field($_GET['action']) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 29 |
$post_id = isset($_GET['post']) ? sanitize_text_field($_GET['post']) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 30 |
if ($action && $post_id) { |
| 31 |
if (get_post_type($post_id) == 'ultp_templates') { |
| 32 |
add_filter( 'et_builder_enable_classic_editor', '__return_false' ); |
| 33 |
} |
| 34 |
} |
| 35 |
} |
| 36 |
} |
| 37 |
} |
| 38 |
add_action( 'init', 'ultp_divi_builder' ); |