| 1 |
<?php |
| 2 |
|
| 3 |
namespace AgeGate\Integration; |
| 4 |
|
| 5 |
use AgeGate\Common\Settings; |
| 6 |
use AgeGate\Common\Integration; |
| 7 |
|
| 8 |
class Divi extends Integration |
| 9 |
{ |
| 10 |
public function exists() |
| 11 |
{ |
| 12 |
return function_exists('et_fb_is_enabled'); |
| 13 |
} |
| 14 |
|
| 15 |
public function init() |
| 16 |
{ |
| 17 |
if ($this->exists()) { |
| 18 |
// add_action('init', function () { |
| 19 |
if (isset($_GET['et_fb']) && current_user_can('edit_posts')) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 20 |
Settings::getInstance()->set('isBuilder', true); |
| 21 |
} |
| 22 |
|
| 23 |
add_action('age_gate/before_render', [$this, 'pauseDiviCssCache']); |
| 24 |
|
| 25 |
// }); |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
public function pauseDiviCssCache() |
| 30 |
{ |
| 31 |
$class = 'ET_Core_PageResource'; |
| 32 |
|
| 33 |
// Output Location: head-early, right after theme styles have been enqueued. |
| 34 |
remove_action('wp_enqueue_scripts', [$class, 'head_early_output_cb'], 11); |
| 35 |
|
| 36 |
// Output Location: head, right BEFORE the theme and wp's custom css. |
| 37 |
remove_action('wp_head', [$class, 'head_output_cb'], 99); |
| 38 |
|
| 39 |
// Output Location: head-late, right AFTER the theme and wp's custom css. |
| 40 |
remove_action('wp_head', [$class, 'head_late_output_cb'], 103); |
| 41 |
|
| 42 |
// Output Location: footer |
| 43 |
remove_action('wp_footer', [$class, 'footer_output_cb'], 20); |
| 44 |
|
| 45 |
// Always delete cached resources for a post upon saving. |
| 46 |
remove_action('save_post', [$class, 'save_post_cb'], 10, 3); |
| 47 |
|
| 48 |
// Always delete cached resources for theme customizer upon saving. |
| 49 |
remove_action('customize_save_after', [$class, 'customize_save_after_cb']); |
| 50 |
|
| 51 |
// Add fallback callbacks (lol) to link/script tags |
| 52 |
remove_filter('style_loader_tag', [$class, 'link_and_script_tags_filter_cb'], 999, 2); |
| 53 |
|
| 54 |
remove_filter('wp_get_custom_css', 'et_epanel_handle_custom_css_output', 999, 2); |
| 55 |
|
| 56 |
add_action('wp_head', 'wp_custom_css_cb', 101); |
| 57 |
} |
| 58 |
} |
| 59 |
|