EDD_SL_Plugin_Updater.php
7 years ago
ad-ajax.php
8 years ago
ad-debug.php
8 years ago
ad-model.php
8 years ago
ad-select.php
9 years ago
ad.php
7 years ago
ad_ajax_callbacks.php
7 years ago
ad_group.php
7 years ago
ad_placements.php
7 years ago
ad_type_abstract.php
8 years ago
ad_type_content.php
8 years ago
ad_type_dummy.php
8 years ago
ad_type_group.php
8 years ago
ad_type_image.php
7 years ago
ad_type_plain.php
8 years ago
checks.php
7 years ago
compatibility.php
7 years ago
display-conditions.php
7 years ago
filesystem.php
8 years ago
frontend_checks.php
7 years ago
plugin.php
7 years ago
upgrades.php
9 years ago
utils.php
7 years ago
visitor-conditions.php
7 years ago
widget.php
7 years ago
compatibility.php
40 lines
| 1 | <?php |
| 2 | class Advanced_Ads_Compatibility { |
| 3 | public function __construct() { |
| 4 | // Elementor plugin |
| 5 | if ( defined( 'ELEMENTOR_VERSION' ) ) { |
| 6 | add_filter( 'advanced-ads-placement-content-injection-xpath', array( $this, 'content_injection_elementor' ), 10, 1 ); |
| 7 | } |
| 8 | if ( defined( 'WP_ROCKET_VERSION' ) ) { |
| 9 | add_filter( 'rocket_excluded_inline_js_content', array( $this, 'exclude_inline_js' ) ); |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * Modify xPath expression for Elementor plugin. |
| 15 | * The plugin does not wrap newly created text in 'p' tags. |
| 16 | * |
| 17 | * @param str $tag |
| 18 | * @return xPath expression |
| 19 | */ |
| 20 | public function content_injection_elementor( $tag ) { |
| 21 | if ( $tag === 'p' ) { |
| 22 | // 'p' or 'div.elementor-widget-text-editor' without nested 'p' |
| 23 | $tag = "*[self::p or self::div[@class and contains(concat(' ', normalize-space(@class), ' '), ' elementor-widget-text-editor ') and not(descendant::p)]]"; |
| 24 | } |
| 25 | return $tag; |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Prevent the 'advanced_ads_ready' function declaration from being merged with other JS |
| 30 | * and outputted into the footer. This is needed because WP Rocket does not output all |
| 31 | * the code that depends on this function into the footer. |
| 32 | * |
| 33 | * @param array $pattern Patterns to match in inline JS content. |
| 34 | */ |
| 35 | function exclude_inline_js( $pattern ) { |
| 36 | $pattern[] = 'advanced_ads_ready'; |
| 37 | return $pattern; |
| 38 | } |
| 39 | } |
| 40 |