PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.9.1
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.9.1
2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 All 80 releases
ablocks / addons / theme-builder / compatibility / astra.php

astra.php in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder 2.9.1, at addons/theme-builder/compatibility/astra.php

69 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ABlocksThemeBuilder\Compatibility;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 use ABlocksThemeBuilder\AbstractCompatibilityBase;
9
10 class Astra extends AbstractCompatibilityBase {
11 protected $header_hook = 'astra_header';
12 protected $footer_hook = 'astra_footer';
13 protected $before_footer_hook = 'astra_footer_before';
14
15 public function init() {
16 // Header
17 if ( $this->enabled_header() ) {
18 add_action( 'template_redirect', [ $this, 'astra_setup_header' ], 10 );
19 add_action( $this->header_hook, [ $this, 'render_header' ] );
20 }
21
22 // Footer
23 $enabled_footer = $this->enabled_footer();
24 $enabled_before_footer = $this->enabled_before_footer();
25 if ( $enabled_footer || $enabled_before_footer ) {
26 add_action( 'template_redirect', [ $this, 'astra_setup_footer' ], 10 );
27 }
28
29 if ( $this->enabled_before_footer() ) {
30 add_action( $this->before_footer_hook, [ $this, 'render_before_footer' ] );
31 }
32
33 if ( $this->enabled_footer() ) {
34 add_action( $this->footer_hook, [ $this, 'render_footer' ] );
35 }
36
37 }
38
39 public function astra_setup_header() {
40 remove_action( 'astra_header', 'astra_header_markup' );
41
42 // Remove the new header builder action.
43 if ( class_exists( 'Astra_Builder_Helper' ) && \Astra_Builder_Helper::$is_header_footer_builder_active ) {
44 remove_action( 'astra_header', [ \Astra_Builder_Header::get_instance(), 'prepare_header_builder_markup' ] );
45 }
46 }
47
48 public function astra_setup_footer() {
49 remove_action( 'astra_footer', 'astra_footer_markup' );
50
51 // Remove the new footer builder action.
52 if ( class_exists( 'Astra_Builder_Helper' ) && \Astra_Builder_Helper::$is_header_footer_builder_active ) {
53 remove_action( 'astra_footer', [ \Astra_Builder_Footer::get_instance(), 'footer_markup' ] );
54 }
55 }
56
57 public function render_header() {
58 echo $this->get_rendered_block_content_by_id( $this->get_settings( 'header' ) );
59 }
60
61 public function render_footer() {
62 echo $this->get_rendered_block_content_by_id( $this->get_settings( 'footer' ) );
63 }
64
65 public function render_before_footer() {
66 echo $this->get_rendered_block_content_by_id( $this->get_settings( 'before-footer' ) );
67 }
68 }
69