| @@ -1,0 +1,30 @@ | ||
| 1 | +<?php | |
| 2 | +namespace ABlocksThemeBuilder; | |
| 3 | + | |
| 4 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 5 | + exit; | |
| 6 | +} | |
| 7 | + | |
| 8 | +class Frontend { | |
| 9 | + | |
| 10 | + public static function init() { | |
| 11 | + $self = new self(); | |
| 12 | + add_action( 'wp_body_open', array( $self, 'render_info_popup_builder' ) ); | |
| 13 | + } | |
| 14 | + | |
| 15 | + public function render_info_popup_builder() { | |
| 16 | + $info_popup_builder = Helper::get_info_popup_builder_content(); | |
| 17 | + if ( is_array( $info_popup_builder ) && count( $info_popup_builder ) ) { | |
| 18 | + add_filter( 'ablocks/is_allow_block_inline_assets', '__return_true' ); | |
| 19 | + add_filter( 'ablocks/is_enabled_assets_generation', '__return_false' ); | |
| 20 | + foreach ( $info_popup_builder as $post ) { | |
| 21 | + $content = apply_filters( 'the_content', $post->post_content ); | |
| 22 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Post content is sanitized on save by WordPress | |
| 23 | + echo do_blocks( $content ); | |
| 24 | + } | |
| 25 | + remove_filter( 'ablocks/is_allow_block_inline_assets', '__return_true' ); | |
| 26 | + remove_filter( 'ablocks/is_enabled_assets_generation', '__return_false' ); | |
| 27 | + } | |
| 28 | + } | |
| 29 | +} | |
| 30 | + | |