summaryrefslogtreecommitdiff
path: root/inc/core
diff options
context:
space:
mode:
Diffstat (limited to 'inc/core')
-rw-r--r--inc/core/builder/class-astra-builder-admin.php155
-rw-r--r--inc/core/builder/class-astra-builder-helper.php1154
-rw-r--r--inc/core/builder/class-astra-builder-options.php1703
-rw-r--r--inc/core/class-astra-admin-helper.php87
-rw-r--r--inc/core/class-astra-admin-settings.php1467
-rw-r--r--inc/core/class-astra-attr.php115
-rw-r--r--inc/core/class-astra-enqueue-scripts.php389
-rw-r--r--inc/core/class-astra-icons.php139
-rw-r--r--inc/core/class-astra-theme-options.php530
-rw-r--r--inc/core/class-astra-walker-page.php137
-rw-r--r--inc/core/class-gutenberg-editor-css.php1116
-rw-r--r--inc/core/class-theme-strings.php108
-rw-r--r--inc/core/common-functions.php1526
-rw-r--r--inc/core/deprecated/deprecated-filters.php87
-rw-r--r--inc/core/deprecated/deprecated-functions.php145
-rw-r--r--inc/core/deprecated/deprecated-hooks.php34
-rw-r--r--inc/core/index.php9
-rw-r--r--inc/core/markup/class-astra-markup.php340
-rw-r--r--inc/core/sidebar-manager.php82
-rw-r--r--inc/core/theme-hooks.php499
-rw-r--r--inc/core/view-general.php45
21 files changed, 9867 insertions, 0 deletions
diff --git a/inc/core/builder/class-astra-builder-admin.php b/inc/core/builder/class-astra-builder-admin.php
new file mode 100644
index 0000000..94df3e4
--- /dev/null
+++ b/inc/core/builder/class-astra-builder-admin.php
@@ -0,0 +1,155 @@
+<?php
+/**
+ * Astra Builder Admin Loader.
+ *
+ * @package astra-builder
+ */
+
+// No direct access, please.
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+/**
+ * Class Astra_Builder_Admin.
+ */
+final class Astra_Builder_Admin {
+
+ /**
+ * Member Variable
+ *
+ * @var instance
+ */
+ private static $instance = null;
+
+ /**
+ * Initiator
+ */
+ public static function get_instance() {
+
+ if ( is_null( self::$instance ) ) {
+ self::$instance = new self();
+ }
+
+ return self::$instance;
+ }
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+ add_action( 'wp_ajax_ast-migrate-to-builder', array( $this, 'migrate_to_builder' ) );
+ add_action( 'astra_welcome_page_content', array( $this, 'migrate_to_builder_box' ), 5 );
+ }
+
+ /**
+ * Migrate to New Header Builder
+ *
+ * @since 3.0.0
+ * @return void
+ */
+ public function migrate_to_builder_box() {
+ if ( Astra_Builder_Helper::is_new_user() ) {
+ add_filter( 'astra_quick_settings', array( $this, 'update_customizer_header_footer_link' ) );
+ return;
+ }
+
+ $status = astra_get_option( 'is-header-footer-builder', false );
+ $astra_theme_title = Astra_Admin_Settings::$page_title;
+
+ $label = ( false !== $status ) ? __( 'Use Old Header/Footer', 'astra' ) : __( 'Use New Header/Footer Builder', 'astra' );
+
+ ?>
+ <div class="postbox">
+ <h2 class="hndle ast-normal-cursor ast-addon-heading ast-flex">
+ <span>
+ <?php
+ printf(
+ /* translators: %1$s: Theme name. */
+ esc_html__( '%1$s Header/Footer Builder', 'astra' ),
+ esc_html( $astra_theme_title )
+ );
+ ?>
+ </span>
+ </h2>
+ <div class="inside">
+ <div>
+ <p>
+ <?php
+ printf(
+ /* translators: %1$s: Theme name. */
+ esc_html__( '%1$s Header/Footer Builder is a new and powerful way to design header and footer for your website. With this, you can give a creative look to your header/footer with less effort.', 'astra' ),
+ esc_html( $astra_theme_title )
+ );
+ ?>
+ </p>
+ <p>
+ <?php
+ printf(
+ /* translators: %1$s: Theme name. */
+ esc_html__( 'Activating this feature will add advanced options to %1$s customizer where you can create awesome new designs.', 'astra' ),
+ esc_html( $astra_theme_title )
+ );
+ ?>
+ </p>
+ <p><?php esc_html_e( 'Note: The header/footer builder will replace the existing header/footer settings in the customizer. This might make your header/footer look a bit different. You can configure header/footer builder settings from customizer to give it a nice look. You can always come back here and switch to your old header/footer.', 'astra' ); ?></p>
+ <div class="ast-actions-wrap" style="justify-content: space-between;display: flex;align-items: center;" >
+ <a href="<?php echo esc_url( admin_url( '/customize.php' ) ); ?>" class="ast-go-to-customizer"><?php esc_html_e( 'Go to Customizer', 'astra' ); ?></a>
+ <div class="ast-actions" style="display: inline-flex;">
+ <button href="#" class="button button-primary ast-builder-migrate" style="margin-right:10px;" data-value="<?php echo ( $status ) ? 0 : 1; ?>"><?php echo esc_html( $label ); ?></button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <?php
+ if ( $status ) {
+ add_filter( 'astra_quick_settings', array( $this, 'update_customizer_header_footer_link' ) );
+ }
+ }
+
+ /**
+ * Update Customizer Header Footer quick links from options page.
+ *
+ * @since 3.0.0
+ * @param array $args default Header Footer quick links.
+ * @return array updated Header Footer quick links.
+ */
+ public function update_customizer_header_footer_link( $args ) {
+ if ( isset( $args['header']['quick_url'] ) ) {
+ $args['header']['quick_url'] = admin_url( 'customize.php?autofocus[panel]=panel-header-builder-group' );
+ }
+ if ( isset( $args['footer']['quick_url'] ) ) {
+ $args['footer']['quick_url'] = admin_url( 'customize.php?autofocus[panel]=panel-footer-builder-group' );
+ }
+ return $args;
+ }
+
+ /**
+ * Migrate to New Header Builder
+ */
+ public function migrate_to_builder() {
+
+ check_ajax_referer( 'astra-builder-module-nonce', 'nonce' );
+
+ if ( ! current_user_can( 'manage_options' ) ) {
+ wp_send_json_error( __( 'You don\'t have the access', 'astra' ) );
+ }
+
+ $migrate = isset( $_POST['value'] ) ? sanitize_key( $_POST['value'] ) : '';
+ $migrate = ( $migrate ) ? true : false;
+ $migration_flag = astra_get_option( 'v3-option-migration', false );
+ astra_update_option( 'is-header-footer-builder', $migrate );
+ if ( $migrate && false === $migration_flag ) {
+ astra_header_builder_migration();
+ }
+ wp_send_json_success();
+ }
+
+}
+
+/**
+ * Prepare if class 'Astra_Builder_Admin' exist.
+ * Kicking this off by calling 'get_instance()' method
+ */
+Astra_Builder_Admin::get_instance();
diff --git a/inc/core/builder/class-astra-builder-helper.php b/inc/core/builder/class-astra-builder-helper.php
new file mode 100644
index 0000000..1980cee
--- /dev/null
+++ b/inc/core/builder/class-astra-builder-helper.php
@@ -0,0 +1,1154 @@
+<?php
+/**
+ * Astra Builder Helper.
+ *
+ * @package astra-builder
+ */
+
+// No direct access, please.
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+/**
+ * Class Astra_Builder_Helper.
+ */
+final class Astra_Builder_Helper {
+
+ /**
+ * Config context general tab.
+ *
+ * @var string[][]
+ */
+ public static $general_tab = array(
+ array(
+ 'setting' => 'ast_selected_tab',
+ 'value' => 'general',
+ ),
+ );
+
+ /**
+ * Config context general tab config.
+ *
+ * @var string[][]
+ */
+ public static $general_tab_config = array(
+ 'setting' => 'ast_selected_tab',
+ 'value' => 'general',
+ );
+
+ /**
+ * Config context design tab.
+ *
+ * @var string[][]
+ */
+ public static $design_tab = array(
+ array(
+ 'setting' => 'ast_selected_tab',
+ 'value' => 'design',
+ ),
+ );
+
+ /**
+ * Config context design tab.
+ *
+ * @var string[][]
+ */
+ public static $design_tab_config = array(
+ 'setting' => 'ast_selected_tab',
+ 'value' => 'design',
+ );
+
+ /**
+ * Config Tablet device context.
+ *
+ * @var string[][]
+ */
+ public static $tablet_device = array(
+ array(
+ 'setting' => 'ast_selected_device',
+ 'operator' => 'in',
+ 'value' => array( 'tablet' ),
+ ),
+ );
+
+ /**
+ * Config Mobile device context.
+ *
+ * @var string[][]
+ */
+ public static $mobile_device = array(
+ array(
+ 'setting' => 'ast_selected_device',
+ 'operator' => 'in',
+ 'value' => array( 'mobile' ),
+ ),
+ );
+
+ /**
+ * Config Mobile device context.
+ *
+ * @var string[][]
+ */
+ public static $responsive_devices = array(
+ array(
+ 'setting' => 'ast_selected_device',
+ 'operator' => 'in',
+ 'value' => array( 'tablet', 'mobile' ),
+ ),
+ );
+
+ /**
+ * Config Mobile device context.
+ *
+ * @var string[][]
+ */
+ public static $responsive_general_tab = array(
+ array(
+ 'setting' => 'ast_selected_tab',
+ 'value' => 'general',
+ ),
+ array(
+ 'setting' => 'ast_selected_device',
+ 'operator' => 'in',
+ 'value' => array( 'tablet', 'mobile' ),
+ ),
+ );
+
+ /**
+ * Config Desktop device context.
+ *
+ * @var string[][]
+ */
+ public static $desktop_general_tab = array(
+ array(
+ 'setting' => 'ast_selected_tab',
+ 'value' => 'general',
+ ),
+ array(
+ 'setting' => 'ast_selected_device',
+ 'operator' => '==',
+ 'value' => 'desktop',
+ ),
+ );
+
+ /**
+ * Default responsive spacing control value.
+ *
+ * @var string[][]
+ */
+ public static $default_responsive_spacing = array(
+ 'desktop' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'tablet' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'mobile' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+
+ /**
+ * Config Tablet device context.
+ *
+ * @var string[][]
+ */
+ public static $tablet_general_tab = array(
+ array(
+ 'setting' => 'ast_selected_tab',
+ 'value' => 'general',
+ ),
+ array(
+ 'setting' => 'ast_selected_device',
+ 'operator' => '==',
+ 'value' => 'tablet',
+ ),
+ );
+
+ /**
+ * Config Mobile device context.
+ *
+ * @var string[][]
+ */
+ public static $mobile_general_tab = array(
+ array(
+ 'setting' => 'ast_selected_tab',
+ 'value' => 'general',
+ ),
+ array(
+ 'setting' => 'ast_selected_device',
+ 'operator' => '==',
+ 'value' => 'mobile',
+ ),
+ );
+
+ /**
+ * No. Of. Component Limit.
+ *
+ * @var int
+ */
+ public static $component_limit = 10;
+
+ /**
+ * No. Of. Component count array.
+ *
+ * @var int
+ */
+ public static $component_count_array = array();
+
+ /**
+ * No. Of. Footer Widgets.
+ *
+ * @var int
+ */
+ public static $num_of_footer_widgets;
+
+ /**
+ * No. Of. Footer HTML.
+ *
+ * @var int
+ */
+ public static $num_of_footer_html;
+
+ /**
+ * No. Of. Header Widgets.
+ *
+ * @var int
+ */
+ public static $num_of_header_widgets;
+
+ /**
+ * No. Of. Header Menu.
+ *
+ * @var int
+ */
+ public static $num_of_header_menu;
+
+ /**
+ * No. Of. Header Buttons.
+ *
+ * @var int
+ */
+ public static $num_of_header_button;
+
+ /**
+ * No. Of. Footer Buttons.
+ *
+ * @var int
+ */
+ public static $num_of_footer_button;
+
+ /**
+ * No. Of. Header HTML.
+ *
+ * @var int
+ */
+ public static $num_of_header_html;
+
+ /**
+ * No. Of. Footer Columns.
+ *
+ * @var int
+ */
+ public static $num_of_footer_columns;
+
+ /**
+ * No. Of. Header Social Icons.
+ *
+ * @var int
+ */
+ public static $num_of_header_social_icons;
+
+ /**
+ * No. Of. Footer Social Icons.
+ *
+ * @var int
+ */
+ public static $num_of_footer_social_icons;
+
+ /**
+ * No. Of. Header Dividers.
+ *
+ * @since 3.0.0
+ * @var int
+ */
+ public static $num_of_header_divider;
+
+ /**
+ * No. Of. Footer Dividers.
+ *
+ * @since 3.0.0
+ * @var int
+ */
+ public static $num_of_footer_divider;
+
+ /**
+ * Check if migrated to new HFB.
+ *
+ * @var int
+ */
+ public static $is_header_footer_builder_active;
+
+ /**
+ * Footer Row layout
+ *
+ * @var array
+ */
+ public static $footer_row_layouts;
+
+ /**
+ * Header Desktop Items
+ *
+ * @var array
+ */
+ public static $header_desktop_items = null;
+
+ /**
+ * Footer Desktop Items
+ *
+ * @var array
+ */
+ public static $footer_desktop_items = null;
+
+ /**
+ * Header Mobile Items
+ *
+ * @var array
+ */
+ public static $header_mobile_items = null;
+
+ /**
+ * Member Variable
+ *
+ * @var instance
+ */
+ public static $loaded_grid = null;
+
+ /**
+ * Member Variable
+ *
+ * @var instance
+ */
+ private static $instance = null;
+
+ /**
+ * Member Variable
+ *
+ * @var grid_size_mapping
+ */
+ public static $grid_size_mapping = array(
+ '6-equal' => 'repeat( 6, 1fr )',
+ '5-equal' => 'repeat( 5, 1fr )',
+ '4-equal' => 'repeat( 4, 1fr )',
+ '4-lheavy' => '2fr 1fr 1fr 1fr',
+ '4-rheavy' => '1fr 1fr 1fr 2fr',
+ '3-equal' => 'repeat( 3, 1fr )',
+ '3-lheavy' => '2fr 1fr 1fr',
+ '3-rheavy' => '1fr 1fr 2fr',
+ '3-cheavy' => '1fr 2fr 1fr',
+ '3-cwide' => '1fr 3fr 1fr',
+ '3-firstrow' => '1fr 1fr',
+ '3-lastrow' => '1fr 1fr',
+ '2-equal' => 'repeat( 2, 1fr )',
+ '2-lheavy' => '2fr 1fr',
+ '2-rheavy' => '1fr 2fr',
+ '2-full' => '2fr',
+ 'full' => '1fr',
+ );
+
+ /**
+ * Initiator
+ */
+ public static function get_instance() {
+
+ if ( is_null( self::$instance ) ) {
+ self::$instance = new self();
+ }
+
+ return self::$instance;
+ }
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+
+ self::$component_count_array = self::get_component_count();
+
+ self::$num_of_header_button = defined( 'ASTRA_EXT_VER' ) ? self::$component_count_array['header-button'] : 1;
+ self::$num_of_footer_button = defined( 'ASTRA_EXT_VER' ) ? self::$component_count_array['footer-button'] : 0;
+
+ self::$num_of_header_html = defined( 'ASTRA_EXT_VER' ) ? self::$component_count_array['header-html'] : 2;
+ self::$num_of_footer_html = defined( 'ASTRA_EXT_VER' ) ? self::$component_count_array['footer-html'] : 2;
+
+ self::$num_of_header_menu = defined( 'ASTRA_EXT_VER' ) ? self::$component_count_array['header-menu'] : 2;
+
+ self::$num_of_header_widgets = defined( 'ASTRA_EXT_VER' ) ? self::$component_count_array['header-widget'] : 2;
+ self::$num_of_footer_widgets = defined( 'ASTRA_EXT_VER' ) ? self::$component_count_array['footer-widget'] : 4;
+
+ self::$num_of_header_social_icons = defined( 'ASTRA_EXT_VER' ) ? self::$component_count_array['header-social-icons'] : 1;
+ self::$num_of_footer_social_icons = defined( 'ASTRA_EXT_VER' ) ? self::$component_count_array['footer-social-icons'] : 1;
+
+ // Divider.
+ self::$num_of_header_divider = defined( 'ASTRA_EXT_VER' ) ? self::$component_count_array['header-divider'] : 0;
+ self::$num_of_footer_divider = defined( 'ASTRA_EXT_VER' ) ? self::$component_count_array['footer-divider'] : 0;
+
+ self::$num_of_footer_columns = defined( 'ASTRA_EXT_VER' ) ? apply_filters( 'astra_footer_column_count', 6 ) : 6;
+
+ self::$footer_row_layouts = apply_filters(
+ 'astra_footer_row_layout',
+ array(
+ 'desktop' => array(
+ '6' => array(
+ '6-equal' => array(
+ 'icon' => 'sixcol',
+ ),
+ ),
+ '5' => array(
+ '5-equal' => array(
+ 'icon' => 'fivecol',
+ ),
+ ),
+ '4' => array(
+ '4-equal' => array(
+ 'icon' => 'fourcol',
+ ),
+ '4-lheavy' => array(
+ 'icon' => 'lfourforty',
+ ),
+ '4-rheavy' => array(
+ 'icon' => 'rfourforty',
+ ),
+ ),
+ '3' => array(
+ '3-equal' => array(
+ 'icon' => 'threecol',
+ ),
+ '3-lheavy' => array(
+ 'icon' => 'lefthalf',
+ ),
+ '3-rheavy' => array(
+ 'icon' => 'righthalf',
+ ),
+ '3-cheavy' => array(
+ 'icon' => 'centerhalf',
+ ),
+ '3-cwide' => array(
+ 'icon' => 'widecenter',
+ ),
+ ),
+ '2' => array(
+ '2-equal' => array(
+ 'icon' => 'twocol',
+ ),
+ '2-lheavy' => array(
+ 'icon' => 'twoleftgolden',
+ ),
+ '2-rheavy' => array(
+ 'icon' => 'tworightgolden',
+ ),
+ ),
+ '1' => array(
+ 'full' => array(
+ 'icon' => 'row',
+ ),
+ ),
+ ),
+ 'tablet' => array(
+ '6' => array(
+ '6-equal' => array(
+ 'tooltip' => __( 'Equal Width Columns', 'astra' ),
+ 'icon' => 'sixcol',
+ ),
+ 'full' => array(
+ 'tooltip' => __( 'Collapse to Rows', 'astra' ),
+ 'icon' => 'collapserowsix',
+ ),
+ ),
+ '5' => array(
+ '5-equal' => array(
+ 'tooltip' => __( 'Equal Width Columns', 'astra' ),
+ 'icon' => 'fivecol',
+ ),
+ 'full' => array(
+ 'tooltip' => __( 'Collapse to Rows', 'astra' ),
+ 'icon' => 'collapserowfive',
+ ),
+ ),
+ '4' => array(
+ '4-equal' => array(
+ 'tooltip' => __( 'Equal Width Columns', 'astra' ),
+ 'icon' => 'fourcol',
+ ),
+ '2-equal' => array(
+ 'tooltip' => __( 'Two Column Grid', 'astra' ),
+ 'icon' => 'grid',
+ ),
+ 'full' => array(
+ 'tooltip' => __( 'Collapse to Rows', 'astra' ),
+ 'icon' => 'collapserowfour',
+ ),
+ ),
+ '3' => array(
+ '3-equal' => array(
+ 'tooltip' => __( 'Equal Width Columns', 'astra' ),
+ 'icon' => 'threecol',
+ ),
+ '3-lheavy' => array(
+ 'tooltip' => __( 'Left Heavy 50/25/25', 'astra' ),
+ 'icon' => 'lefthalf',
+ ),
+ '3-rheavy' => array(
+ 'tooltip' => __( 'Right Heavy 25/25/50', 'astra' ),
+ 'icon' => 'righthalf',
+ ),
+ '3-cheavy' => array(
+ 'tooltip' => __( 'Center Heavy 25/50/25', 'astra' ),
+ 'icon' => 'centerhalf',
+ ),
+ '3-cwide' => array(
+ 'tooltip' => __( 'Wide Center 20/60/20', 'astra' ),
+ 'icon' => 'widecenter',
+ ),
+ '3-firstrow' => array(
+ 'tooltip' => __( 'First Row, Next Columns 100 - 50/50', 'astra' ),
+ 'icon' => 'firstrow',
+ ),
+ '3-lastrow' => array(
+ 'tooltip' => __( 'Last Row, Previous Columns 50/50 - 100', 'astra' ),
+ 'icon' => 'lastrow',
+ ),
+ 'full' => array(
+ 'tooltip' => __( 'Collapse to Rows', 'astra' ),
+ 'icon' => 'collapserowthree',
+ ),
+ ),
+ '2' => array(
+ '2-equal' => array(
+ 'tooltip' => __( 'Equal Width Columns', 'astra' ),
+ 'icon' => 'twocol',
+ ),
+ '2-lheavy' => array(
+ 'tooltip' => __( 'Left Heavy 66/33', 'astra' ),
+ 'icon' => 'twoleftgolden',
+ ),
+ '2-rheavy' => array(
+ 'tooltip' => __( 'Right Heavy 33/66', 'astra' ),
+ 'icon' => 'tworightgolden',
+ ),
+ 'full' => array(
+ 'tooltip' => __( 'Collapse to Rows', 'astra' ),
+ 'icon' => 'collapserow',
+ ),
+ ),
+ '1' => array(
+ 'full' => array(
+ 'tooltip' => __( 'Single Row', 'astra' ),
+ 'icon' => 'row',
+ ),
+ ),
+ ),
+ 'mobile' => array(
+ '6' => array(
+ '6-equal' => array(
+ 'tooltip' => __( 'Equal Width Columns', 'astra' ),
+ 'icon' => 'sixcol',
+ ),
+ 'full' => array(
+ 'tooltip' => __( 'Collapse to Rows', 'astra' ),
+ 'icon' => 'collapserowsix',
+ ),
+ ),
+ '5' => array(
+ '5-equal' => array(
+ 'tooltip' => __( 'Equal Width Columns', 'astra' ),
+ 'icon' => 'fivecol',
+ ),
+ 'full' => array(
+ 'tooltip' => __( 'Collapse to Rows', 'astra' ),
+ 'icon' => 'collapserowfive',
+ ),
+ ),
+ '4' => array(
+ '4-equal' => array(
+ 'icon' => 'fourcol',
+ ),
+ '2-equal' => array(
+ 'icon' => 'grid',
+ ),
+ 'full' => array(
+ 'icon' => 'collapserowfour',
+ ),
+ ),
+ '3' => array(
+ '3-equal' => array(
+ 'icon' => 'threecol',
+ ),
+ '3-lheavy' => array(
+ 'icon' => 'lefthalf',
+ ),
+ '3-rheavy' => array(
+ 'icon' => 'righthalf',
+ ),
+ '3-cheavy' => array(
+ 'icon' => 'centerhalf',
+ ),
+ '3-cwide' => array(
+ 'icon' => 'widecenter',
+ ),
+ '3-firstrow' => array(
+ 'icon' => 'firstrow',
+ ),
+ '3-lastrow' => array(
+ 'icon' => 'lastrow',
+ ),
+ 'full' => array(
+ 'icon' => 'collapserowthree',
+ ),
+ ),
+ '2' => array(
+ '2-equal' => array(
+ 'icon' => 'twocol',
+ ),
+ '2-lheavy' => array(
+ 'icon' => 'twoleftgolden',
+ ),
+ '2-rheavy' => array(
+ 'icon' => 'tworightgolden',
+ ),
+ 'full' => array(
+ 'icon' => 'collapserow',
+ ),
+ ),
+ '1' => array(
+ 'full' => array(
+ 'icon' => 'row',
+ ),
+ ),
+ ),
+ 'responsive' => true,
+ )
+ );
+
+ self::$header_desktop_items = apply_filters(
+ 'astra_header_desktop_items',
+ array(
+ 'logo' => array(
+ 'name' => __( 'Site Identity & Logo', 'astra' ),
+ 'icon' => 'admin-appearance',
+ 'section' => 'title_tagline',
+ 'delete' => false,
+ ),
+ 'search' => array(
+ 'name' => __( 'Search', 'astra' ),
+ 'icon' => 'search',
+ 'section' => 'section-header-search',
+ 'delete' => false,
+ ),
+ 'account' => array(
+ 'name' => __( 'Account', 'astra' ),
+ 'icon' => 'admin-users',
+ 'section' => 'section-header-account',
+ 'delete' => false,
+ ),
+ )
+ );
+
+ self::$footer_desktop_items = apply_filters(
+ 'astra_footer_desktop_items',
+ array(
+ 'copyright' => array(
+ 'name' => 'Copyright',
+ 'icon' => 'nametag',
+ 'section' => 'section-footer-copyright',
+ 'delete' => false,
+ ),
+ 'menu' => array(
+ 'name' => 'Footer Menu',
+ 'icon' => 'menu',
+ 'section' => 'section-footer-menu',
+ 'delete' => false,
+ ),
+ )
+ );
+
+ if ( class_exists( 'Astra_Woocommerce' ) ) {
+
+ $woo_cart_name = class_exists( 'Easy_Digital_Downloads' ) ? __( 'Woo Cart', 'astra' ) : __( 'Cart', 'astra' );
+
+ self::$header_desktop_items['woo-cart'] = array(
+ 'name' => $woo_cart_name,
+ 'icon' => 'cart',
+ 'section' => 'section-header-woo-cart',
+ );
+ }
+ if ( class_exists( 'Easy_Digital_Downloads' ) ) {
+
+ $edd_cart_name = class_exists( 'Astra_Woocommerce' ) ? __( 'EDD Cart', 'astra' ) : __( 'Cart', 'astra' );
+
+ self::$header_desktop_items['edd-cart'] = array(
+ 'name' => $edd_cart_name,
+ 'icon' => 'cart',
+ 'section' => 'section-header-edd-cart',
+ );
+ }
+
+ self::$header_mobile_items = apply_filters(
+ 'astra_header_mobile_items',
+ array(
+ 'logo' => array(
+ 'name' => __( 'Site Identity & Logo', 'astra' ),
+ 'icon' => 'admin-appearance',
+ 'section' => 'title_tagline',
+ ),
+ 'search' => array(
+ 'name' => __( 'Search', 'astra' ),
+ 'icon' => 'search',
+ 'section' => 'section-header-search',
+ ),
+ 'mobile-trigger' => array(
+ 'name' => __( 'Toggle Button', 'astra' ),
+ 'icon' => 'menu-alt',
+ 'section' => 'section-header-mobile-trigger',
+ ),
+ 'mobile-menu' => array(
+ 'name' => __( 'Off-Canvas Menu', 'astra' ),
+ 'icon' => 'menu-alt',
+ 'section' => 'section-header-mobile-menu',
+ ),
+ 'account' => array(
+ 'name' => __( 'Account', 'astra' ),
+ 'icon' => 'admin-users',
+ 'section' => 'section-header-account',
+ ),
+ )
+ );
+
+ if ( class_exists( 'Astra_Woocommerce' ) ) {
+ self::$header_mobile_items['woo-cart'] = array(
+ 'name' => $woo_cart_name,
+ 'icon' => 'cart',
+ 'section' => 'section-header-woo-cart',
+ );
+ }
+ if ( class_exists( 'Easy_Digital_Downloads' ) ) {
+ self::$header_mobile_items['edd-cart'] = array(
+ 'name' => $edd_cart_name,
+ 'icon' => 'cart',
+ 'section' => 'section-header-edd-cart',
+ );
+ }
+
+ self::$is_header_footer_builder_active = self::is_header_footer_builder_active();
+
+ add_filter( 'astra_addon_list', array( $this, 'deprecate_old_header_and_footer' ) );
+ }
+
+ /**
+ * Get count of all components.
+ *
+ * @since 3.0.0
+ *
+ * @return int Number of all components.
+ */
+ public static function get_component_count() {
+
+ $component_keys_count = array(
+ 'header-button' => 2,
+ 'footer-button' => 2,
+ 'header-html' => 2,
+ 'footer-html' => 2,
+ 'header-menu' => 2,
+ 'header-widget' => 4,
+ 'footer-widget' => 4,
+ 'header-social-icons' => 1,
+ 'footer-social-icons' => 1,
+ 'header-divider' => 0,
+ 'footer-divider' => 0,
+ 'removed-items' => array(),
+ );
+
+ $component_keys_count = array_merge(
+ $component_keys_count,
+ apply_filters(
+ 'astra_builder_elements_count',
+ $component_keys_count
+ )
+ );
+
+ $skip_it_keys = array( 'removed-items', 'flag' );
+ foreach ( $component_keys_count as $component_type => $component_count ) {
+ if ( in_array( $component_type, $skip_it_keys, true ) ) {
+ continue;
+ }
+ $component_keys_count[ $component_type ] = min( $component_count, self::$component_limit );
+ }
+
+ return $component_keys_count;
+ }
+
+ /**
+ * Deprecate Header Sections, Mobile Headers, Footer Widgets for new users and migrated users.
+ *
+ * @since 3.0.0
+ * @param array $args The arguments as per the filter.
+ * @return array $args Updated arguments as per the filter.
+ */
+ public function deprecate_old_header_and_footer( $args ) {
+
+ if ( self::$is_header_footer_builder_active ) {
+ unset( $args['mobile-header'] );
+ unset( $args['header-sections'] );
+ unset( $args['advanced-footer'] );
+ }
+ return $args;
+ }
+
+ /**
+ * For existing users, do not load the wide/full width image CSS by default.
+ *
+ * @since 3.0.0
+ * @return boolean false if it is an existing user , true if not.
+ */
+ public static function is_header_footer_builder_active() {
+
+ $astra_settings = get_option( ASTRA_THEME_SETTINGS );
+ $is_header_footer_builder = isset( $astra_settings['is-header-footer-builder'] ) ? (bool) $astra_settings['is-header-footer-builder'] : true;
+ return apply_filters( 'astra_is_header_footer_builder_active', $is_header_footer_builder );
+ }
+
+ /**
+ * Check if Migrated to new Astra Builder.
+ */
+ public static function is_new_user() {
+ return astra_get_option( 'header-footer-builder-notice', true );
+ }
+
+ /**
+ * Adds a check to see if the side columns should run.
+ *
+ * @param string $row the name of the row.
+ */
+ public static function has_mobile_side_columns( $row = 'primary' ) {
+
+ $mobile_sides = false;
+ $elements = astra_get_option( 'header-mobile-items' );
+ if ( isset( $elements ) && isset( $elements[ $row ] ) ) {
+ if ( ( isset( $elements[ $row ][ $row . '_left' ] ) && is_array( $elements[ $row ][ $row . '_left' ] ) &&
+ ! empty( $elements[ $row ][ $row . '_left' ] ) ) || ( isset( $elements[ $row ][ $row . '_left_center' ] ) &&
+ is_array( $elements[ $row ][ $row . '_left_center' ] ) &&
+ ! empty( $elements[ $row ][ $row . '_left_center' ] ) ) || ( isset( $elements[ $row ][ $row . '_right_center' ] ) &&
+ is_array( $elements[ $row ][ $row . '_right_center' ] ) && ! empty( $elements[ $row ][ $row . '_right_center' ] ) ) ||
+ ( isset( $elements[ $row ][ $row . '_right' ] ) && is_array( $elements[ $row ][ $row . '_right' ] ) &&
+ ! empty( $elements[ $row ][ $row . '_right' ] ) ) ) {
+ $mobile_sides = true;
+ }
+ }
+
+ return $mobile_sides;
+ }
+
+
+ /**
+ * Adds a check to see if the center column should run.
+ *
+ * @param string $row the name of the row.
+ */
+ public static function has_mobile_center_column( $row = 'primary' ) {
+
+ $mobile_center = false;
+ $elements = astra_get_option( 'header-mobile-items' );
+ if ( isset( $elements ) && isset( $elements[ $row ] ) && isset( $elements[ $row ][ $row . '_center' ] ) &&
+ is_array( $elements[ $row ][ $row . '_center' ] ) && ! empty( $elements[ $row ][ $row . '_center' ] ) ) {
+ $mobile_center = true;
+ }
+
+ return $mobile_center;
+ }
+
+ /**
+ * Adds support to render header columns.
+ *
+ * @param string $row the name of the row.
+ * @param string $column the name of the column.
+ * @param string $header the name of the header.
+ * @param string $builder the name of the builder.
+ */
+ public static function render_builder_markup( $row = 'primary', $column = 'left', $header = 'desktop', $builder = 'header' ) {
+ $elements = astra_get_option( $builder . '-' . $header . '-items' );
+ if ( isset( $elements ) && isset( $elements[ $row ] ) && isset( $elements[ $row ][ $row . '_' . $column ] ) && is_array( $elements[ $row ][ $row . '_' . $column ] ) && ! empty( $elements[ $row ][ $row . '_' . $column ] ) ) {
+ foreach ( $elements[ $row ][ $row . '_' . $column ] as $key => $item ) {
+
+
+ if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
+
+ get_template_part(
+ 'template-parts/' . $builder . '/builder/components',
+ '',
+ array(
+ 'type' => $item,
+ 'device' => $header,
+ )
+ );
+ } else {
+
+ set_query_var( 'type', $item );
+ get_template_part( 'template-parts/' . $builder . '/builder/components' );
+ }
+ }
+ }
+ }
+ /**
+ * Adds support to render Mobile Popup Markup.
+ */
+ public static function render_mobile_popup_markup() {
+
+ $off_canvas_slide = astra_get_option( 'off-canvas-slide' );
+ $mobile_header_type = astra_get_option( 'mobile-header-type' );
+ $content_alignment = astra_get_option( 'header-offcanvas-content-alignment' );
+
+ $side_class = 'content-align-' . $content_alignment . ' ';
+
+ if ( $mobile_header_type ) {
+
+ if ( 'off-canvas' === $mobile_header_type ) {
+
+ if ( $off_canvas_slide ) {
+
+ if ( 'left' === $off_canvas_slide ) {
+
+ $side_class .= 'ast-mobile-popup-left';
+ } else {
+
+ $side_class .= 'ast-mobile-popup-right';
+ }
+ }
+ } else {
+ $side_class .= 'ast-mobile-popup-full-width';
+ }
+ }
+ ?>
+ <div id="ast-mobile-popup-wrapper">
+ <div id="ast-mobile-popup" class="ast-mobile-popup-drawer <?php echo esc_attr( $side_class ); ?>">
+ <div class="ast-mobile-popup-overlay"></div>
+ <div class="ast-mobile-popup-inner">
+ <div class="ast-mobile-popup-header">
+ <button id="menu-toggle-close" class="menu-toggle-close" aria-label="Close menu">
+ <span class="ast-svg-iconset">
+ <?php echo Astra_Builder_UI_Controller::fetch_svg_icon( 'close' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </span>
+ </button>
+ </div>
+ <div class="ast-mobile-popup-content">
+ <?php
+ /**
+ * Astra Off-Canvas
+ */
+ do_action( 'astra_render_mobile_popup', 'popup', 'content' );
+ ?>
+ </div>
+ <div class="ast-desktop-popup-content">
+ <?php
+ /**
+ * Astra Off-Canvas
+ */
+ do_action( 'astra_render_desktop_popup', 'popup', 'content' );
+ ?>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <?php
+ }
+
+ /**
+ * Check if Center column element exists.
+ *
+ * @param string $row the name of the row.
+ * @param string $builder_type the type of the builder.
+ * @param string $device Device.
+ */
+ public static function has_center_column( $row = 'main', $builder_type = 'header', $device = 'desktop' ) {
+
+ $center = false;
+ $elements = astra_get_option( $builder_type . '-' . $device . '-items' );
+ if ( isset( $elements ) && isset( $elements[ $row ] ) &&
+ isset( $elements[ $row ][ $row . '_center' ] ) && is_array( $elements[ $row ][ $row . '_center' ] ) &&
+ ! empty( $elements[ $row ][ $row . '_center' ] ) ) {
+ $center = true;
+ }
+
+ return $center;
+ }
+
+ /**
+ * Check if Side column element exists.
+ *
+ * @param string $row row.
+ * @param string $builder_type the type of the builder.
+ * @param string $device Device.
+ * @return bool
+ */
+ public static function has_side_columns( $row = 'primary', $builder_type = 'header', $device = 'desktop' ) {
+
+ $sides = false;
+ $elements = astra_get_option( $builder_type . '-' . $device . '-items' );
+ if ( isset( $elements ) && isset( $elements[ $row ] ) ) {
+ if ( (
+ isset( $elements[ $row ][ $row . '_left' ] ) &&
+ is_array( $elements[ $row ][ $row . '_left' ] ) && ! empty( $elements[ $row ][ $row . '_left' ] ) ) ||
+ ( isset( $elements[ $row ][ $row . '_left_center' ] ) &&
+ is_array( $elements[ $row ][ $row . '_left_center' ] ) && ! empty( $elements[ $row ][ $row . '_left_center' ] ) ) ||
+ ( isset( $elements[ $row ][ $row . '_right_center' ] ) &&
+ is_array( $elements[ $row ][ $row . '_right_center' ] ) && ! empty( $elements[ $row ][ $row . '_right_center' ] ) ) ||
+ ( isset( $elements[ $row ][ $row . '_right' ] ) &&
+ is_array( $elements[ $row ][ $row . '_right' ] ) && ! empty( $elements[ $row ][ $row . '_right' ] ) ) ) {
+ $sides = true;
+ }
+ }
+ return $sides;
+ }
+
+ /**
+ * Check if Footer Zone is empty.
+ *
+ * @param string $row row.
+ * @return bool
+ */
+ public static function is_footer_row_empty( $row = 'primary' ) {
+ $sides = false;
+ $elements = astra_get_option( 'footer-desktop-items' );
+
+ if ( isset( $elements ) && isset( $elements[ $row ] ) ) {
+ for ( $i = 1; $i <= 5; $i++ ) {
+ if (
+ isset( $elements[ $row ][ $row . '_' . $i ] ) &&
+ is_array( $elements[ $row ][ $row . '_' . $i ] ) &&
+ ! empty( $elements[ $row ][ $row . '_' . $i ] )
+ ) {
+ $sides = true;
+ break;
+ }
+ }
+ }
+ return $sides;
+ }
+
+ /**
+ * Check if row is empty.
+ *
+ * @param string $row row.
+ * @param string $builder_type the type of the builder.
+ * @param string $device Device.
+ * @return bool
+ */
+ public static function is_row_empty( $row = 'primary', $builder_type = 'header', $device = 'desktop' ) {
+ if ( false === self::has_center_column( $row, $builder_type, $device ) && false === self::has_side_columns( $row, $builder_type, $device ) ) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Check if component placed on the builder.
+ *
+ * @param integer $component_id component id.
+ * @param string $builder_type builder type.
+ * @param string $device Device type (mobile, desktop and both).
+ * @return bool
+ */
+ public static function is_component_loaded( $component_id, $builder_type = 'header', $device = 'both' ) {
+
+ $loaded_components = array();
+
+ if ( is_null( self::$loaded_grid ) ) {
+
+ $grids['header_desktop'] = astra_get_option( 'header-desktop-items', array() );
+ $grids['header_mobile'] = astra_get_option( 'header-mobile-items', array() );
+ $grids['footer_both'] = astra_get_option( 'footer-desktop-items', array() );
+
+ if ( ! empty( $grids ) ) {
+
+ foreach ( $grids as $grid_row => $row_grids ) {
+
+ $components = array();
+ if ( ! empty( $row_grids ) ) {
+
+ foreach ( $row_grids as $row => $grid ) {
+
+ if ( ! in_array( $row, array( 'below', 'above', 'primary', 'popup' ) ) ) {
+ continue;
+ }
+
+ if ( ! is_array( $grid ) ) {
+ continue;
+ }
+
+ $result = array_values( $grid );
+
+ if ( is_array( $result ) ) {
+ $loaded_component = call_user_func_array( 'array_merge', $result );
+ $components[] = is_array( $loaded_component ) ? $loaded_component : array();
+ }
+ }
+ }
+
+ $loaded_components[ $grid_row ] = call_user_func_array( 'array_merge', $components );
+ }
+ }
+
+ if ( ! empty( $loaded_components ) ) {
+ // For both devices(mobile & desktop).
+ $loaded_components['header_both'] = array_merge( $loaded_components['header_desktop'], $loaded_components['header_mobile'] );
+
+ // For All device and builder type.
+ $all_components = call_user_func_array( 'array_merge', array_values( $loaded_components ) );
+ $loaded_components['all'] = array_unique( $all_components );
+ }
+
+ self::$loaded_grid = $loaded_components;
+ }
+
+ $loaded_components = self::$loaded_grid;
+
+ if ( 'all' === $builder_type && ! empty( $loaded_components['all'] ) ) {
+ $is_loaded = in_array( $component_id, $loaded_components['all'], true );
+ } else {
+ $is_loaded = in_array( $component_id, $loaded_components[ $builder_type . '_' . $device ], true );
+ }
+
+ return $is_loaded || is_customize_preview();
+ }
+
+ /**
+ * For existing users, do not apply dynamic CSS chages.
+ *
+ * @since 3.3.0
+ * @return boolean true if it is an existing user , false if not.
+ */
+ public static function apply_flex_based_css() {
+ $astra_settings = get_option( ASTRA_THEME_SETTINGS );
+ $astra_settings['is-flex-based-css'] = isset( $astra_settings['is-flex-based-css'] ) ? $astra_settings['is-flex-based-css'] : true;
+ return apply_filters( 'astra_apply_flex_based_css', $astra_settings['is-flex-based-css'] );
+ }
+}
+
+/**
+ * Prepare if class 'Astra_Builder_Helper' exist.
+ * Kicking this off by calling 'get_instance()' method
+ */
+Astra_Builder_Helper::get_instance();
diff --git a/inc/core/builder/class-astra-builder-options.php b/inc/core/builder/class-astra-builder-options.php
new file mode 100644
index 0000000..4046448
--- /dev/null
+++ b/inc/core/builder/class-astra-builder-options.php
@@ -0,0 +1,1703 @@
+<?php
+/**
+ * Astra Builder Options default values.
+ *
+ * @package astra-builder
+ */
+
+// No direct access, please.
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+add_filter( 'astra_theme_defaults', 'astra_hf_builder_customizer_defaults' );
+
+/**
+ * Return defaults for Builder Options.
+ *
+ * @param array $defaults exsiting options array.
+ * @return array
+ */
+function astra_hf_builder_customizer_defaults( $defaults ) {
+
+ /**
+ * Header Builder - Desktop Defaults.
+ */
+ $defaults['header-desktop-items'] = array(
+ 'popup' => array( 'popup_content' => array( 'mobile-menu' ) ),
+ 'above' =>
+ array(
+ 'above_left' => array(),
+ 'above_left_center' => array(),
+ 'above_center' => array(),
+ 'above_right_center' => array(),
+ 'above_right' => array(),
+ ),
+ 'primary' =>
+ array(
+ 'primary_left' => array( 'logo' ),
+ 'primary_left_center' => array(),
+ 'primary_center' => array(),
+ 'primary_right_center' => array(),
+ 'primary_right' => array( 'menu-1' ),
+ ),
+ 'below' =>
+ array(
+ 'below_left' => array(),
+ 'below_left_center' => array(),
+ 'below_center' => array(),
+ 'below_right_center' => array(),
+ 'below_right' => array(),
+ ),
+ );
+
+ /**
+ * Header Builder - Mobile Defaults.
+ */
+ $defaults['header-mobile-items'] = array(
+ 'popup' => array( 'popup_content' => array( 'mobile-menu' ) ),
+ 'above' =>
+ array(
+ 'above_left' => array(),
+ 'above_center' => array(),
+ 'above_right' => array(),
+ ),
+ 'primary' =>
+ array(
+ 'primary_left' => array( 'logo' ),
+ 'primary_center' => array(),
+ 'primary_right' => array( 'mobile-trigger' ),
+ ),
+ 'below' =>
+ array(
+ 'below_left' => array(),
+ 'below_center' => array(),
+ 'below_right' => array(),
+ ),
+ );
+
+ /**
+ * Primary Header Defaults.
+ */
+ $defaults['hb-header-main-layout-width'] = 'content';
+ $defaults['hb-header-height'] = array(
+ 'desktop' => 70,
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults['hb-stack'] = array(
+ 'desktop' => 'stack',
+ 'tablet' => 'stack',
+ 'mobile' => 'stack',
+ );
+
+ $defaults['hb-header-main-sep'] = 1;
+ $defaults['hb-header-main-sep-color'] = '#eaeaea';
+ $defaults['hb-header-main-menu-align'] = 'inline';
+ $defaults['hb-header-bg-obj-responsive'] = array(
+ 'desktop' => array(
+ 'background-color' => '#ffffff',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'tablet' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'mobile' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ );
+
+ $defaults['hb-header-spacing'] = array(
+ 'desktop' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'tablet' => array(
+ 'top' => '1.5',
+ 'right' => '',
+ 'bottom' => '1.5',
+ 'left' => '',
+ ),
+ 'mobile' => array(
+ 'top' => '1',
+ 'right' => '',
+ 'bottom' => '1',
+ 'left' => '',
+ ),
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'em',
+ 'mobile-unit' => 'em',
+ );
+
+ /**
+ * Above Header Defaults.
+ */
+ $defaults['hba-header-layout'] = 'above-header-layout-1';
+ $defaults['hba-header-height'] = array(
+ 'desktop' => 50,
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults['hba-stack'] = array(
+ 'desktop' => 'stack',
+ 'tablet' => 'stack',
+ 'mobile' => 'stack',
+ );
+ $defaults['hba-header-separator'] = 1;
+ $defaults['hba-header-bottom-border-color'] = '#eaeaea';
+ $defaults['hba-header-bg-obj-responsive'] = array(
+ 'desktop' => array(
+ 'background-color' => '#ffffff',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'tablet' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'mobile' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ );
+ $defaults['hba-header-text-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults['hba-header-link-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults['hba-header-link-h-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults['hba-header-spacing'] = array(
+ 'desktop' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'tablet' => array(
+ 'top' => '0',
+ 'right' => '',
+ 'bottom' => '0',
+ 'left' => '',
+ ),
+ 'mobile' => array(
+ 'top' => '0.5',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'em',
+ );
+
+ /**
+ * Logo defaults.
+ */
+ $defaults['ast-header-responsive-logo-width'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ /**
+ * Below Header Defaults.
+ */
+ $defaults['hbb-header-layout'] = 'below-header-layout-1';
+ $defaults['hbb-header-height'] = array(
+ 'desktop' => 60,
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults['hbb-stack'] = array(
+ 'desktop' => 'stack',
+ 'tablet' => 'stack',
+ 'mobile' => 'stack',
+ );
+
+ $defaults['hbb-header-separator'] = 1;
+ $defaults['hbb-header-bottom-border-color'] = '#eaeaea';
+ $defaults['hbb-header-bg-obj-responsive'] = array(
+ 'desktop' => array(
+ 'background-color' => '#eeeeee',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'tablet' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'mobile' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ );
+ $defaults['hbb-header-spacing'] = array(
+ 'desktop' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'tablet' => array(
+ 'top' => '1',
+ 'right' => '',
+ 'bottom' => '1',
+ 'left' => '',
+ ),
+ 'mobile' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'em',
+ 'mobile-unit' => 'px',
+ );
+
+
+ $margin_defaults = array(
+ 'section-footer-builder-layout-padding',
+ 'section-footer-builder-layout-margin',
+ 'section-above-header-builder-padding',
+ 'section-above-header-builder-margin',
+ 'section-below-header-builder-padding',
+ 'section-below-header-builder-margin',
+ 'section-header-mobile-trigger-margin',
+ 'section-primary-header-builder-padding',
+ 'section-primary-header-builder-margin',
+ 'title_tagline-margin',
+ 'section-header-search-margin',
+ 'header-account-margin',
+ 'header-mobile-menu-menu-spacing',
+ 'section-header-mobile-menu-margin',
+ 'section-above-footer-builder-padding',
+ 'section-above-footer-builder-margin',
+ 'section-below-footer-builder-margin',
+ 'section-footer-copyright-margin',
+ 'section-footer-menu-margin',
+ 'section-primary-footer-builder-padding',
+ 'section-primary-footer-builder-margin',
+ );
+
+ foreach ( $margin_defaults as $margin_default ) {
+ $defaults[ $margin_default ] = Astra_Builder_Helper::$default_responsive_spacing;
+ }
+
+ for ( $index = 1; $index <= Astra_Builder_Helper::$component_limit; $index++ ) {
+
+ $defaults = prepare_button_defaults( $defaults, $index );
+ $defaults = prepare_html_defaults( $defaults, $index );
+ $defaults = prepare_social_icon_defaults( $defaults, $index );
+ $defaults = prepare_widget_defaults( $defaults, $index );
+ $defaults = prepare_menu_defaults( $defaults, $index );
+ $defaults = prepare_divider_defaults( $defaults, $index );
+ }
+
+ /**
+ * Header Types - Defaults
+ */
+ $defaults['transparent-header-main-sep'] = ( false === astra_get_transparent_header_default_value() ) ? '' : 0;
+ $defaults['transparent-header-main-sep-color'] = '';
+
+ /**
+ * Header > Sticky Defaults.
+ */
+ $defaults['sticky-header-on-devices'] = 'desktop';
+ $defaults['sticky-header-style'] = 'none';
+
+ /**
+ * Footer Builder - Desktop Defaults.
+ */
+ $defaults['footer-desktop-items'] = array(
+ 'above' =>
+ array(
+ 'above_1' => array(),
+ 'above_2' => array(),
+ 'above_3' => array(),
+ 'above_4' => array(),
+ 'above_5' => array(),
+ ),
+ 'primary' =>
+ array(
+ 'primary_1' => array(),
+ 'primary_2' => array(),
+ 'primary_3' => array(),
+ 'primary_4' => array(),
+ 'primary_5' => array(),
+ ),
+ 'below' =>
+ array(
+ 'below_1' => array( 'copyright' ),
+ 'below_2' => array(),
+ 'below_3' => array(),
+ 'below_4' => array(),
+ 'below_5' => array(),
+ ),
+ );
+
+ /**
+ * Above Footer Defaults.
+ */
+ $defaults['hba-footer-height'] = 60;
+ $defaults['hba-footer-column'] = '2';
+ $defaults['hba-footer-layout'] = array(
+ 'desktop' => '2-equal',
+ 'tablet' => '2-equal',
+ 'mobile' => 'full',
+ );
+
+ /**
+ * Footer - Defaults
+ */
+ $defaults['hba-footer-bg-obj-responsive'] = array(
+ 'desktop' => array(
+ 'background-color' => '#eeeeee',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'tablet' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'mobile' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ );
+ $defaults['hbb-footer-bg-obj-responsive'] = array(
+ 'desktop' => array(
+ 'background-color' => '#eeeeee',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'tablet' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'mobile' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ );
+ $defaults['hb-footer-bg-obj-responsive'] = array(
+ 'desktop' => array(
+ 'background-color' => '#f9f9f9',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'tablet' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'mobile' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ );
+
+ /**
+ * Header Margin defaults.
+ */
+ $defaults['section-header-builder-layout-margin'] = array(
+ 'desktop' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'tablet' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'mobile' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+
+ /**
+ * Below Footer Defaults.
+ */
+ $defaults['hbb-footer-height'] = 80;
+ $defaults['hbb-footer-column'] = '1';
+ $defaults['hbb-footer-layout'] = array(
+ 'desktop' => 'full',
+ 'tablet' => 'full',
+ 'mobile' => 'full',
+ );
+
+ $defaults['hba-footer-layout-width'] = 'content';
+ $defaults['hb-footer-layout-width'] = 'content';
+ $defaults['hbb-footer-layout-width'] = 'content';
+
+ $defaults['hba-footer-vertical-alignment'] = 'flex-start';
+ $defaults['hb-footer-vertical-alignment'] = 'flex-start';
+ $defaults['hbb-footer-vertical-alignment'] = 'flex-start';
+
+ $defaults['footer-bg-obj-responsive'] = array(
+ 'desktop' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'tablet' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'mobile' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ );
+
+ /**
+ * Primary Footer Defaults.
+ */
+ $defaults['hb-footer-column'] = '3';
+ $defaults['hb-footer-separator'] = 1;
+ $defaults['hb-footer-bottom-border-color'] = '#e6e6e6';
+ $defaults['hb-footer-layout'] = array(
+ 'desktop' => '3-equal',
+ 'tablet' => '3-equal',
+ 'mobile' => 'full',
+ );
+
+ $defaults['hb-footer-main-sep'] = 1;
+ $defaults['hb-footer-main-sep-color'] = '#e6e6e6';
+
+ /**
+ * Footer Copyright.
+ */
+ $defaults['footer-copyright-editor'] = 'Copyright [copyright] [current_year] [site_title] | Powered by [theme_author]';
+ $defaults['footer-copyright-color'] = '#3a3a3a';
+ $defaults['line-height-section-footer-copyright'] = 2;
+ $defaults['footer-copyright-alignment'] = array(
+ 'desktop' => 'center',
+ 'tablet' => 'center',
+ 'mobile' => 'center',
+ );
+ $defaults['font-size-section-footer-copyright'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults['font-weight-section-footer-copyright'] = 'inherit';
+ $defaults['font-family-section-footer-copyright'] = 'inherit';
+ $defaults['text-transform-section-footer-copyright'] = '';
+ $defaults['line-height-section-footer-copyright'] = '';
+
+ $defaults['footer-menu-alignment'] = array(
+ 'desktop' => 'center',
+ 'tablet' => 'center',
+ 'mobile' => 'center',
+ );
+
+ /**
+ * Footer Below Padding.
+ */
+ $defaults['section-below-footer-builder-padding'] = array(
+ 'desktop' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'tablet' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'mobile' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+
+ /**
+ * Search.
+ */
+ $defaults['header-search-icon-space'] = array(
+ 'desktop' => 18,
+ 'tablet' => 18,
+ 'mobile' => 18,
+ );
+
+ $defaults['header-search-icon-color'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ /**
+ * Transparent Header > Component Configs
+ */
+ $defaults['transparent-header-social-icons-color'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults['transparent-header-social-icons-h-color'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults['transparent-header-social-icons-bg-color'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults['transparent-header-social-icons-bg-h-color'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults['transparent-header-html-text-color'] = '';
+ $defaults['transparent-header-html-link-color'] = '';
+ $defaults['transparent-header-html-link-h-color'] = '';
+
+ $defaults['transparent-header-widget-title-color'] = '';
+ $defaults['transparent-header-widget-content-color'] = '';
+ $defaults['transparent-header-widget-link-color'] = '';
+ $defaults['transparent-header-widget-link-h-color'] = '';
+
+ $defaults['transparent-header-button-text-color'] = '';
+ $defaults['transparent-header-button-text-h-color'] = '';
+ $defaults['transparent-header-button-bg-color'] = '';
+ $defaults['transparent-header-button-bg-h-color'] = '';
+
+ /**
+ * Off-Canvas defaults.
+ */
+ $defaults['off-canvas-layout'] = 'side-panel';
+ $defaults['off-canvas-slide'] = 'right';
+ $defaults['header-builder-menu-toggle-target'] = 'icon';
+ $defaults['header-offcanvas-content-alignment'] = 'flex-start';
+ $defaults['off-canvas-background'] = array(
+ 'background-color' => '#ffffff',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ );
+ $defaults['off-canvas-close-color'] = '#3a3a3a';
+ $defaults['mobile-header-type'] = 'dropdown';
+ $defaults['off-canvas-inner-spacing'] = '';
+ $defaults['footer-menu-layout'] = array(
+ 'desktop' => 'horizontal',
+ 'tablet' => 'vertical',
+ 'mobile' => 'vertical',
+ );
+
+ $defaults['footer-menu-bg-obj-responsive'] = array(
+ 'desktop' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'tablet' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'mobile' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ );
+
+ $defaults['footer-menu-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults['footer-menu-h-bg-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults['footer-menu-h-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults['footer-menu-a-bg-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults['footer-menu-a-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults['footer-menu-font-size'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults['footer-menu-font-weight'] = 'inherit';
+ $defaults['footer-menu-font-family'] = 'inherit';
+ $defaults['footer-menu-text-transform'] = '';
+ $defaults['footer-menu-line-height'] = '';
+
+ $defaults['footer-main-menu-spacing'] = array(
+ 'desktop' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'tablet' => array(
+ 'top' => '0',
+ 'right' => '20',
+ 'bottom' => '0',
+ 'left' => '20',
+ ),
+ 'mobile' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+
+ // Mobile Trigger defaults.
+ $defaults['header-trigger-icon'] = 'menu';
+ $defaults['mobile-header-toggle-icon-size'] = 20;
+ $defaults['mobile-header-toggle-btn-style'] = 'minimal';
+ $defaults['mobile-header-toggle-btn-border-size'] = array(
+ 'top' => 1,
+ 'right' => 1,
+ 'bottom' => 1,
+ 'left' => 1,
+ );
+ $defaults['mobile-header-toggle-border-radius'] = 2;
+
+ /**
+ * Mobile trigger - Label Typography.
+ */
+ $defaults['mobile-header-label-font-family'] = 'inherit';
+ $defaults['mobile-header-label-font-weight'] = 'inherit';
+ $defaults['mobile-header-label-text-transform'] = '';
+ $defaults['mobile-header-label-line-height'] = '';
+ $defaults['mobile-header-label-font-size'] = '';
+
+ /**
+ * Mobile Menu
+ */
+
+ // Specify all the default values for Menu from here.
+ $defaults['header-mobile-menu-bg-color'] = '';
+ $defaults['header-mobile-menu-color'] = '';
+ $defaults['header-mobile-menu-h-bg-color'] = '';
+ $defaults['header-mobile-menu-h-color'] = '';
+ $defaults['header-mobile-menu-a-bg-color'] = '';
+ $defaults['header-mobile-menu-a-color'] = '';
+
+ $defaults['header-mobile-menu-bg-obj-responsive'] = array(
+ 'desktop' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'tablet' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'mobile' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ );
+
+ $defaults['header-mobile-menu-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults['header-mobile-menu-h-bg-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults['header-mobile-menu-h-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults['header-mobile-menu-a-bg-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults['header-mobile-menu-a-color-responsive'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults['header-mobile-menu-submenu-container-animation'] = 'fade';
+
+ /**
+ * Submenu
+ */
+ $defaults['header-mobile-menu-submenu-item-border'] = false;
+ $defaults['header-mobile-menu-submenu-item-b-size'] = '1';
+ $defaults['header-mobile-menu-submenu-item-b-color'] = '#eaeaea';
+ $defaults['header-mobile-menu-submenu-border'] = array(
+ 'top' => 2,
+ 'bottom' => 0,
+ 'left' => 0,
+ 'right' => 0,
+ );
+
+
+ /**
+ * Menu - Typography.
+ */
+ $defaults['header-mobile-menu-font-size'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults['header-mobile-menu-font-weight'] = 'inherit';
+ $defaults['header-mobile-menu-font-family'] = 'inherit';
+ $defaults['header-mobile-menu-text-transform'] = '';
+ $defaults['header-mobile-menu-line-height'] = '';
+
+ /**
+ * Woo-Cart.
+ */
+ $defaults['woo-header-cart-icon-style'] = 'outline';
+ $defaults['header-woo-cart-icon-color'] = '';
+ $defaults['transparent-header-woo-cart-icon-color'] = '';
+ $defaults['woo-header-cart-icon-radius'] = 3;
+ $defaults['woo-header-cart-total-display'] = true;
+ $defaults['woo-header-cart-title-display'] = true;
+
+ // Cart tray > General Color styles.
+ $defaults['header-woo-cart-text-color'] = '';
+ $defaults['header-woo-cart-link-color'] = '';
+ $defaults['header-woo-cart-background-color'] = '';
+ $defaults['header-woo-cart-separator-color'] = '';
+ $defaults['header-woo-cart-link-hover-color'] = '';
+
+ // Cart tray > Cart Button styles.
+ $defaults['header-woo-cart-btn-text-color'] = '';
+ $defaults['header-woo-cart-btn-background-color'] = '';
+ $defaults['header-woo-cart-btn-text-hover-color'] = '';
+ $defaults['header-woo-cart-btn-bg-hover-color'] = '';
+
+ // Cart tray > Checkout Button styles.
+ $defaults['header-woo-checkout-btn-text-color'] = '';
+ $defaults['header-woo-checkout-btn-background-color'] = '';
+ $defaults['header-woo-checkout-btn-text-hover-color'] = '';
+ $defaults['header-woo-checkout-btn-bg-hover-color'] = '';
+
+ /**
+ * EDD-Cart.
+ */
+ $defaults['edd-header-cart-icon-style'] = 'outline';
+ $defaults['edd-header-cart-icon-color'] = '';
+ $defaults['edd-header-cart-icon-radius'] = 3;
+ $defaults['transparent-header-edd-cart-icon-color'] = '';
+ $defaults['edd-header-cart-total-display'] = true;
+ $defaults['edd-header-cart-title-display'] = true;
+
+ // Cart tray > General Color styles.
+ $defaults['header-edd-cart-text-color'] = '';
+ $defaults['header-edd-cart-link-color'] = '';
+ $defaults['header-edd-cart-background-color'] = '';
+ $defaults['header-edd-cart-separator-color'] = '';
+
+ // Cart tray > Checkout Button styles.
+ $defaults['header-edd-checkout-btn-text-color'] = '';
+ $defaults['header-edd-checkout-btn-background-color'] = '';
+ $defaults['header-edd-checkout-btn-text-hover-color'] = '';
+ $defaults['header-edd-checkout-btn-bg-hover-color'] = '';
+
+ /**
+ * Account element.
+ */
+ $defaults['header-account-type'] = 'default';
+ $defaults['header-account-login-style'] = 'icon';
+ $defaults['header-account-action-type'] = 'link';
+ $defaults['header-account-link-type'] = 'default';
+ $defaults['header-account-logout-style'] = 'icon';
+ $defaults['header-account-logged-out-text'] = __( 'Log In', 'astra' );
+ $defaults['header-account-logged-in-text'] = __( 'My Account', 'astra' );
+ $defaults['header-account-logout-action'] = 'link';
+ $defaults['header-account-image-width'] = array(
+ 'desktop' => '40',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults['header-account-icon-size'] = array(
+ 'desktop' => 18,
+ 'tablet' => 18,
+ 'mobile' => 18,
+ );
+
+ $defaults['header-account-icon-color'] = '';
+
+ $defaults['header-account-login-link'] = array(
+ 'url' => '',
+ 'new_tab' => false,
+ 'link_rel' => '',
+ );
+
+ $defaults['header-account-logout-link'] = array(
+ 'url' => esc_url( wp_login_url() ),
+ 'new_tab' => false,
+ 'link_rel' => '',
+ );
+
+ $defaults['font-size-section-header-account'] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+
+ $defaults['header-account-type-text-color'] = '';
+ $defaults['header-account-woo-menu'] = false;
+
+ $defaults['cloned-component-track'] = Astra_Builder_Helper::$component_count_array;
+
+ return $defaults;
+}
+
+/**
+ * Prepare Divider Defaults.
+ *
+ * @param array $defaults defaults.
+ * @param integer $index index.
+ */
+function prepare_divider_defaults( $defaults, $index ) {
+
+ $defaults[ 'section-hb-divider-' . $index . '-margin' ] = Astra_Builder_Helper::$default_responsive_spacing;
+ $defaults[ 'section-fb-divider-' . $index . '-margin' ] = Astra_Builder_Helper::$default_responsive_spacing;
+
+
+ return $defaults;
+}
+
+/**
+ * Prepare Button Defaults.
+ *
+ * @param array $defaults defaults.
+ * @param integer $index index.
+ */
+function prepare_button_defaults( $defaults, $index ) {
+
+ $_prefix = 'button' . $index;
+
+ $defaults[ 'header-' . $_prefix . '-text' ] = __( 'Button', 'astra' );
+ $defaults[ 'header-' . $_prefix . '-link-option' ] = array(
+ 'url' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ),
+ 'new_tab' => false,
+ 'link_rel' => '',
+ );
+ $defaults[ 'header-' . $_prefix . '-font-family' ] = 'inherit';
+ $defaults[ 'header-' . $_prefix . '-font-weight' ] = 'inherit';
+ $defaults[ 'header-' . $_prefix . '-text-transform' ] = '';
+ $defaults[ 'header-' . $_prefix . '-line-height' ] = '';
+ $defaults[ 'header-' . $_prefix . '-font-size' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults[ 'header-' . $_prefix . '-text-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'header-' . $_prefix . '-back-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'header-' . $_prefix . '-text-h-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'header-' . $_prefix . '-back-h-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'header-' . $_prefix . '-padding' ] = array(
+ 'desktop' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'tablet' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'mobile' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults[ 'header-' . $_prefix . '-border-size' ] = array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ );
+ $defaults[ 'header-' . $_prefix . '-border-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'header-' . $_prefix . '-border-radius' ] = '';
+
+ $defaults[ 'section-hb-button-' . $index . '-padding' ] = Astra_Builder_Helper::$default_responsive_spacing;
+ $defaults[ 'section-hb-button-' . $index . '-margin' ] = Astra_Builder_Helper::$default_responsive_spacing;
+ $defaults[ 'sticky-header-button' . $index . '-padding' ] = Astra_Builder_Helper::$default_responsive_spacing;
+
+
+ $_prefix = 'button' . $index;
+
+ $defaults[ 'footer-' . $_prefix . '-text' ] = __( 'Button', 'astra' );
+ $defaults[ 'footer-' . $_prefix . '-link-option' ] = array(
+ 'url' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ),
+ 'new_tab' => false,
+ 'link_rel' => '',
+ );
+ $defaults[ 'footer-' . $_prefix . '-font-family' ] = 'inherit';
+ $defaults[ 'footer-' . $_prefix . '-font-weight' ] = 'inherit';
+ $defaults[ 'footer-' . $_prefix . '-text-transform' ] = '';
+ $defaults[ 'footer-' . $_prefix . '-line-height' ] = '';
+ $defaults[ 'footer-' . $_prefix . '-font-size' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults[ 'footer-' . $_prefix . '-text-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'footer-' . $_prefix . '-back-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'footer-' . $_prefix . '-text-h-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'footer-' . $_prefix . '-back-h-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'footer-' . $_prefix . '-padding' ] = array(
+ 'desktop' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'tablet' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'mobile' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults[ 'footer-' . $_prefix . '-border-size' ] = array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ );
+ $defaults[ 'footer-' . $_prefix . '-border-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'footer-' . $_prefix . '-border-radius' ] = '';
+ $defaults[ 'footer-button-' . $index . '-alignment' ] = array(
+ 'desktop' => 'center',
+ 'tablet' => 'center',
+ 'mobile' => 'center',
+ );
+
+ $defaults[ 'section-fb-button-' . $index . '-padding' ] = Astra_Builder_Helper::$default_responsive_spacing;
+ $defaults[ 'section-fb-button-' . $index . '-margin' ] = Astra_Builder_Helper::$default_responsive_spacing;
+
+ return $defaults;
+}
+
+/**
+ * Prepare HTML Defaults.
+ *
+ * @param array $defaults defaults.
+ * @param integer $index index.
+ */
+function prepare_html_defaults( $defaults, $index ) {
+
+ $_section = 'section-hb-html-' . $index;
+
+ $defaults[ 'header-html-' . $index ] = __( 'Insert HTML text here.', 'astra' );
+ $defaults[ 'header-html-' . $index . 'color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'header-html-' . $index . 'link-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'header-html-' . $index . 'link-h-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'font-size-' . $_section ] = array(
+ 'desktop' => 15,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults[ 'font-weight-' . $_section ] = 'inherit';
+ $defaults[ 'font-family-' . $_section ] = 'inherit';
+ $defaults[ 'line-height-' . $_section ] = '';
+ $defaults[ 'text-transform-' . $_section ] = '';
+
+ $defaults[ 'section-hb-html-' . $index . '-margin' ] = Astra_Builder_Helper::$default_responsive_spacing;
+
+
+
+ $_section = 'section-fb-html-' . $index;
+
+ $defaults[ 'footer-html-' . $index ] = __( 'Insert HTML text here.', 'astra' );
+ $defaults[ 'footer-html-' . $index . 'color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'footer-html-' . $index . 'link-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'footer-html-' . $index . 'link-h-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'font-size-' . $_section ] = array(
+ 'desktop' => 15,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults[ 'footer-html-' . $index . '-alignment' ] = array(
+ 'desktop' => 'center',
+ 'tablet' => 'center',
+ 'mobile' => 'center',
+ );
+ $defaults[ 'font-size-' . $_section ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults[ 'font-weight-' . $_section ] = 'inherit';
+ $defaults[ 'font-family-' . $_section ] = 'inherit';
+ $defaults[ 'text-transform-' . $_section ] = '';
+ $defaults[ 'line-height-' . $_section ] = '';
+
+ $defaults[ 'section-fb-html-' . $index . '-margin' ] = Astra_Builder_Helper::$default_responsive_spacing;
+
+ return $defaults;
+}
+
+/**
+ * Prepare Social Icon Defaults.
+ *
+ * @param array $defaults defaults.
+ * @param integer $index index.
+ */
+function prepare_social_icon_defaults( $defaults, $index ) {
+
+ $defaults[ 'header-social-' . $index . '-space' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'header-social-' . $index . '-bg-space' ] = '';
+ $defaults[ 'header-social-' . $index . '-size' ] = array(
+ 'desktop' => 18,
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'header-social-' . $index . '-radius' ] = '';
+ $defaults[ 'header-social-' . $index . '-color' ] = '';
+ $defaults[ 'header-social-' . $index . '-h-color' ] = '';
+ $defaults[ 'header-social-' . $index . '-bg-color' ] = '';
+ $defaults[ 'header-social-' . $index . '-bg-h-color' ] = '';
+ $defaults[ 'header-social-' . $index . '-label-toggle' ] = false;
+ $defaults[ 'header-social-' . $index . '-color-type' ] = 'custom';
+ $defaults[ 'font-size-section-hb-social-icons-' . $index ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults[ 'header-social-icons-' . $index ] = array(
+ 'items' =>
+ array(
+ array(
+ 'id' => 'facebook',
+ 'enabled' => true,
+ 'source' => 'icon',
+ 'url' => '',
+ 'color' => '#557dbc',
+ 'background' => 'transparent',
+ 'icon' => 'facebook',
+ 'label' => 'Facebook',
+ ),
+ array(
+ 'id' => 'twitter',
+ 'enabled' => true,
+ 'source' => 'icon',
+ 'url' => '',
+ 'color' => '#7acdee',
+ 'background' => 'transparent',
+ 'icon' => 'twitter',
+ 'label' => 'Twitter',
+ ),
+ array(
+ 'id' => 'instagram',
+ 'enabled' => true,
+ 'source' => 'icon',
+ 'url' => '',
+ 'color' => '#8a3ab9',
+ 'background' => 'transparent',
+ 'icon' => 'instagram',
+ 'label' => 'Instagram',
+ ),
+ ),
+ );
+
+ $defaults[ 'section-hb-social-icons-' . $index . '-margin' ] = Astra_Builder_Helper::$default_responsive_spacing;
+
+
+ $defaults[ 'footer-social-' . $index . '-space' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'footer-social-' . $index . '-bg-space' ] = '';
+ $defaults[ 'footer-social-' . $index . '-size' ] = array(
+ 'desktop' => 18,
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'footer-social-' . $index . '-radius' ] = '';
+ $defaults[ 'footer-social-' . $index . '-color' ] = '';
+ $defaults[ 'footer-social-' . $index . '-h-color' ] = '';
+ $defaults[ 'footer-social-' . $index . '-bg-color' ] = '';
+ $defaults[ 'footer-social-' . $index . '-bg-h-color' ] = '';
+ $defaults[ 'footer-social-' . $index . '-label-toggle' ] = false;
+ $defaults[ 'footer-social-' . $index . '-color-type' ] = 'custom';
+ $defaults[ 'font-size-section-fb-social-icons-' . $index ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults[ 'footer-social-icons-' . $index ] = array(
+ 'items' =>
+ array(
+ array(
+ 'id' => 'facebook',
+ 'enabled' => true,
+ 'source' => 'icon',
+ 'url' => '',
+ 'color' => '#557dbc',
+ 'background' => 'transparent',
+ 'icon' => 'facebook',
+ 'label' => 'Facebook',
+ ),
+ array(
+ 'id' => 'twitter',
+ 'enabled' => true,
+ 'source' => 'icon',
+ 'url' => '',
+ 'color' => '#7acdee',
+ 'background' => 'transparent',
+ 'icon' => 'twitter',
+ 'label' => 'Twitter',
+ ),
+ array(
+ 'id' => 'instagram',
+ 'enabled' => true,
+ 'source' => 'icon',
+ 'url' => '',
+ 'color' => '#8a3ab9',
+ 'background' => 'transparent',
+ 'icon' => 'instagram',
+ 'label' => 'Instagram',
+ ),
+ ),
+ );
+ $defaults[ 'footer-social-' . $index . '-alignment' ] = array(
+ 'desktop' => 'center',
+ 'tablet' => 'center',
+ 'mobile' => 'center',
+ );
+
+ $defaults[ 'section-fb-social-icons-' . $index . '-margin' ] = Astra_Builder_Helper::$default_responsive_spacing;
+
+ return $defaults;
+}
+
+/**
+ * Prepare Widget Defaults.
+ *
+ * @param array $defaults defaults.
+ * @param integer $index index.
+ */
+function prepare_widget_defaults( $defaults, $index ) {
+
+ // Widget Header defaults.
+
+ // Colors.
+ $defaults[ 'header-widget-' . $index . '-title-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'header-widget-' . $index . '-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'header-widget-' . $index . '-link-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'header-widget-' . $index . '-link-h-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ // Title Typography.
+ $defaults[ 'header-widget-' . $index . '-font-family' ] = 'inherit';
+ $defaults[ 'header-widget-' . $index . '-font-weight' ] = 'inherit';
+ $defaults[ 'header-widget-' . $index . '-text-transform' ] = '';
+ $defaults[ 'header-widget-' . $index . '-line-height' ] = '';
+ $defaults[ 'header-widget-' . $index . '-font-size' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+
+
+ // Content Typography.
+ $defaults[ 'header-widget-' . $index . '-content-font-family' ] = 'inherit';
+ $defaults[ 'header-widget-' . $index . '-content-font-weight' ] = 'inherit';
+ $defaults[ 'header-widget-' . $index . '-content-text-transform' ] = '';
+ $defaults[ 'header-widget-' . $index . '-content-line-height' ] = '';
+ $defaults[ 'header-widget-' . $index . '-content-font-size' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+
+ $defaults[ 'sidebar-widgets-header-widget-' . $index . '-margin' ] = Astra_Builder_Helper::$default_responsive_spacing;
+
+ // Widget Footer defaults.
+
+ // Colors.
+ $defaults[ 'footer-widget-' . $index . '-title-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'footer-widget-' . $index . '-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'footer-widget-' . $index . '-link-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+ $defaults[ 'footer-widget-' . $index . '-link-h-color' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ // Title Typography.
+ $defaults[ 'footer-widget-' . $index . '-font-family' ] = 'inherit';
+ $defaults[ 'footer-widget-' . $index . '-font-weight' ] = 'inherit';
+ $defaults[ 'footer-widget-' . $index . '-text-transform' ] = '';
+ $defaults[ 'footer-widget-' . $index . '-line-height' ] = '';
+ $defaults[ 'footer-widget-' . $index . '-font-size' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+
+ // Content Typography.
+ $defaults[ 'footer-widget-' . $index . '-content-font-family' ] = 'inherit';
+ $defaults[ 'footer-widget-' . $index . '-content-font-weight' ] = 'inherit';
+ $defaults[ 'footer-widget-' . $index . '-content-text-transform' ] = '';
+ $defaults[ 'footer-widget-' . $index . '-content-line-height' ] = '';
+ $defaults[ 'footer-widget-' . $index . '-content-font-size' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+
+ $defaults[ 'footer-widget-alignment-' . $index ] = array(
+ 'desktop' => 'left',
+ 'tablet' => 'center',
+ 'mobile' => 'center',
+ );
+
+ $defaults[ 'sidebar-widgets-footer-widget-' . $index . '-margin' ] = Astra_Builder_Helper::$default_responsive_spacing;
+
+
+ return $defaults;
+}
+
+/**
+ * Prepare menu Defaults.
+ *
+ * @param array $defaults defaults.
+ * @param integer $index index.
+ */
+function prepare_menu_defaults( $defaults, $index ) {
+
+ $_prefix = 'menu' . $index;
+
+ // Specify all the default values for Menu from here.
+ $defaults[ 'header-' . $_prefix . '-bg-color' ] = '';
+ $defaults[ 'header-' . $_prefix . '-color' ] = '';
+ $defaults[ 'header-' . $_prefix . '-h-bg-color' ] = '';
+ $defaults[ 'header-' . $_prefix . '-h-color' ] = '';
+ $defaults[ 'header-' . $_prefix . '-a-bg-color' ] = '';
+ $defaults[ 'header-' . $_prefix . '-a-color' ] = '';
+
+ $defaults[ 'header-' . $_prefix . '-bg-obj-responsive' ] = array(
+ 'desktop' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'tablet' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ 'mobile' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ ),
+ );
+
+ $defaults[ 'header-' . $_prefix . '-color-responsive' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults[ 'header-' . $_prefix . '-h-bg-color-responsive' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults[ 'header-' . $_prefix . '-h-color-responsive' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults[ 'header-' . $_prefix . '-a-bg-color-responsive' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults[ 'header-' . $_prefix . '-a-color-responsive' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ );
+
+ $defaults[ 'header-' . $_prefix . '-menu-hover-animation' ] = '';
+ $defaults[ 'header-' . $_prefix . '-submenu-container-animation' ] = '';
+
+ $defaults[ 'section-hb-menu-' . $index . '-margin' ] = Astra_Builder_Helper::$default_responsive_spacing;
+ $defaults[ 'header-menu' . $index . '-menu-spacing' ] = Astra_Builder_Helper::$default_responsive_spacing;
+
+
+
+ /**
+ * Submenu
+ */
+ $defaults[ 'header-' . $_prefix . '-submenu-item-border' ] = false;
+ $defaults[ 'header-' . $_prefix . '-submenu-item-b-size' ] = '1';
+ $defaults[ 'header-' . $_prefix . '-submenu-item-b-color' ] = '#eaeaea';
+ $defaults[ 'header-' . $_prefix . '-submenu-border-radius' ] = '';
+ $defaults[ 'header-' . $_prefix . '-submenu-top-offset' ] = '';
+ $defaults[ 'header-' . $_prefix . '-submenu-width' ] = '';
+ $defaults[ 'header-' . $_prefix . '-submenu-border' ] = array(
+ 'top' => 2,
+ 'bottom' => 0,
+ 'left' => 0,
+ 'right' => 0,
+ );
+
+ /**
+ * Menu Stack on Mobile.
+ */
+ $defaults[ 'header-' . $_prefix . '-menu-stack-on-mobile' ] = true;
+
+ /**
+ * Menu - Typography.
+ */
+ $defaults[ 'header-' . $_prefix . '-font-size' ] = array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ );
+ $defaults[ 'header-' . $_prefix . '-font-weight' ] = 'inherit';
+ $defaults[ 'header-' . $_prefix . '-font-family' ] = 'inherit';
+ $defaults[ 'header-' . $_prefix . '-text-transform' ] = '';
+ $defaults[ 'header-' . $_prefix . '-line-height' ] = '';
+
+ /**
+ * Header Types - Defaults
+ */
+ $defaults['transparent-header-main-sep'] = '';
+ $defaults['transparent-header-main-sep-color'] = '';
+
+ return $defaults;
+}
diff --git a/inc/core/class-astra-admin-helper.php b/inc/core/class-astra-admin-helper.php
new file mode 100644
index 0000000..ea35e7d
--- /dev/null
+++ b/inc/core/class-astra-admin-helper.php
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Admin settings helper
+ *
+ * @link https://developer.wordpress.org/themes/basics/theme-functions/
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+if ( ! class_exists( 'Astra_Admin_Helper' ) ) :
+
+ /**
+ * Admin Helper
+ */
+ final class Astra_Admin_Helper {
+
+ /**
+ * Returns an option from the database for
+ * the admin settings page.
+ *
+ * @param string $key The option key.
+ * @param boolean $network Whether to allow the network admin setting to be overridden on subsites.
+ * @return string Return the option value
+ */
+ public static function get_admin_settings_option( $key, $network = false ) {
+
+ // Get the site-wide option if we're in the network admin.
+ if ( $network && is_multisite() ) {
+ $value = get_site_option( $key );
+ } else {
+ $value = get_option( $key );
+ }
+
+ return $value;
+ }
+
+ /**
+ * Updates an option from the admin settings page.
+ *
+ * @param string $key The option key.
+ * @param mixed $value The value to update.
+ * @param bool $network Whether to allow the network admin setting to be overridden on subsites.
+ * @return mixed
+ */
+ public static function update_admin_settings_option( $key, $value, $network = false ) {
+
+ // Update the site-wide option since we're in the network admin.
+ if ( $network && is_multisite() ) {
+ update_site_option( $key, $value );
+ } else {
+ update_option( $key, $value );
+ }
+
+ }
+
+ /**
+ * Returns an option from the database for
+ * the admin settings page.
+ *
+ * @param string $key The option key.
+ * @param bool $network Whether to allow the network admin setting to be overridden on subsites.
+ * @return mixed
+ */
+ public static function delete_admin_settings_option( $key, $network = false ) {
+
+ // Get the site-wide option if we're in the network admin.
+ if ( $network && is_multisite() ) {
+ $value = delete_site_option( $key );
+ } else {
+ $value = delete_option( $key );
+ }
+
+ return $value;
+ }
+
+ }
+
+
+endif;
diff --git a/inc/core/class-astra-admin-settings.php b/inc/core/class-astra-admin-settings.php
new file mode 100644
index 0000000..bcdab75
--- /dev/null
+++ b/inc/core/class-astra-admin-settings.php
@@ -0,0 +1,1467 @@
+<?php
+/**
+ * Admin settings helper
+ *
+ * @link https://developer.wordpress.org/themes/basics/theme-functions/
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+if ( ! class_exists( 'Astra_Admin_Settings' ) ) {
+
+ /**
+ * Astra Admin Settings
+ */
+ class Astra_Admin_Settings {
+
+ /**
+ * Menu page title
+ *
+ * @since 1.0
+ * @var array $menu_page_title
+ */
+ public static $menu_page_title;
+
+ /**
+ * Page title
+ *
+ * @since 1.0
+ * @var array $page_title
+ */
+ public static $page_title = 'Astra';
+
+ /**
+ * Plugin slug
+ *
+ * @since 1.0
+ * @var array $plugin_slug
+ */
+ public static $plugin_slug = 'astra';
+
+ /**
+ * Default Menu position
+ *
+ * @since 1.0
+ * @var array $default_menu_position
+ */
+ public static $default_menu_position = 'themes.php';
+
+ /**
+ * Parent Page Slug
+ *
+ * @since 1.0
+ * @var array $parent_page_slug
+ */
+ public static $parent_page_slug = 'general';
+
+ /**
+ * Current Slug
+ *
+ * @since 1.0
+ * @var array $current_slug
+ */
+ public static $current_slug = 'general';
+
+ /**
+ * Starter Templates Slug
+ *
+ * @since 2.3.2
+ * @var array $starter_templates_slug
+ */
+ public static $starter_templates_slug = 'astra-sites';
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+
+ if ( ! is_admin() ) {
+ return;
+ }
+
+ self::get_starter_templates_slug();
+
+ add_action( 'after_setup_theme', __CLASS__ . '::init_admin_settings', 99 );
+ }
+
+ /**
+ * Admin settings init
+ */
+ public static function init_admin_settings() {
+ self::$menu_page_title = apply_filters( 'astra_menu_page_title', __( 'Astra Options', 'astra' ) );
+ self::$page_title = apply_filters( 'astra_page_title', __( 'Astra', 'astra' ) );
+ self::$plugin_slug = self::get_theme_page_slug();
+
+ add_action( 'admin_enqueue_scripts', __CLASS__ . '::register_scripts' );
+
+ if ( ! is_customize_preview() ) {
+ // add css on the admin init action to resolve the error in the PWA service worker js.
+ add_action( 'admin_head', __CLASS__ . '::admin_submenu_css' );
+ }
+
+ $requested_page = isset( $_REQUEST['page'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) : '';// phpcs:ignore WordPress.Security.NonceVerification.Recommended
+
+ if ( strpos( $requested_page, self::$plugin_slug ) !== false ) {
+
+ add_action( 'admin_enqueue_scripts', __CLASS__ . '::styles_scripts' );
+
+ // Let extensions hook into saving.
+ do_action( 'astra_admin_settings_scripts' );
+
+ if ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, '2.5.0', '<' ) ) {
+ self::save_settings();
+ }
+ }
+
+ add_action( 'customize_controls_enqueue_scripts', __CLASS__ . '::customizer_scripts' );
+
+ add_action( 'admin_menu', __CLASS__ . '::add_admin_menu', 99 );
+
+ add_action( 'astra_menu_general_action', __CLASS__ . '::general_page' );
+
+ add_action( 'astra_header_right_section', __CLASS__ . '::top_header_right_section' );
+
+ add_action( 'astra_welcome_page_right_sidebar_content', __CLASS__ . '::astra_welcome_page_starter_sites_section', 10 );
+ add_action( 'astra_welcome_page_right_sidebar_content', __CLASS__ . '::external_important_links_section', 11 );
+
+ add_action( 'astra_welcome_page_content', __CLASS__ . '::astra_welcome_page_content' );
+ add_action( 'astra_welcome_page_content', __class__ . '::astra_available_plugins', 30 );
+
+ // AJAX.
+ add_action( 'wp_ajax_astra-sites-plugin-activate', __CLASS__ . '::required_plugin_activate' );
+ add_action( 'wp_ajax_astra-sites-plugin-deactivate', __CLASS__ . '::required_plugin_deactivate' );
+
+ add_action( 'admin_init', __CLASS__ . '::register_notices' );
+ add_action( 'astra_notice_before_markup', __CLASS__ . '::notice_assets' );
+
+ add_action( 'admin_init', __CLASS__ . '::minimum_addon_version_notice' );
+ }
+
+ /**
+ * Save All admin settings here
+ */
+ public static function save_settings() {
+
+ // Only admins can save settings.
+ if ( ! current_user_can( 'manage_options' ) ) {
+ return;
+ }
+
+ // Let extensions hook into saving.
+ do_action( 'astra_admin_settings_save' );
+ }
+
+ /**
+ * Theme options page Slug getter including White Label string.
+ *
+ * @since 2.1.0
+ * @return string Theme Options Page Slug.
+ */
+ public static function get_theme_page_slug() {
+ return apply_filters( 'astra_theme_page_slug', self::$plugin_slug );
+ }
+
+ /**
+ * Ask Theme Rating
+ *
+ * @since 1.4.0
+ */
+ public static function register_notices() {
+ // Return if white labeled.
+ if ( astra_is_white_labelled() ) {
+ return;
+ }
+
+ // Force Astra welcome notice on theme activation.
+ if ( current_user_can( 'install_plugins' ) && ! defined( 'ASTRA_SITES_NAME' ) && '1' == get_option( 'fresh_site' ) ) {
+
+ wp_enqueue_script( 'astra-admin-settings' );
+ $image_path = ASTRA_THEME_URI . 'inc/assets/images/astra-logo.svg';
+ $ast_sites_notice_btn = self::astra_sites_notice_button();
+
+ if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
+ $ast_sites_notice_btn['button_text'] = __( 'Get Started', 'astra' );
+ $ast_sites_notice_btn['class'] .= ' button button-primary button-hero';
+ } elseif ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
+ $ast_sites_notice_btn['button_text'] = __( 'Get Started', 'astra' );
+ $ast_sites_notice_btn['class'] .= ' button button-primary button-hero';
+ // Astra Premium Sites - Active.
+ } else {
+ $ast_sites_notice_btn['class'] = ' button button-primary button-hero astra-notice-close';
+ }
+
+ $astra_sites_notice_args = array(
+ 'id' => 'astra-sites-on-active',
+ 'type' => 'info',
+ 'message' => sprintf(
+ '<div class="notice-image">
+ <img src="%1$s" class="custom-logo" alt="Astra" itemprop="logo"></div>
+ <div class="notice-content">
+ <h2 class="notice-heading">
+ %2$s
+ </h2>
+ <p>%3$s</p>
+ <div class="astra-review-notice-container">
+ <a class="%4$s" %5$s %6$s %7$s %8$s %9$s %10$s> %11$s </a>
+ </div>
+ </div>',
+ $image_path,
+ __( 'Thank you for installing Astra!', 'astra' ),
+ __( 'Did you know Astra comes with dozens of ready-to-use <a href="https://wpastra.com/starter-templates/?utm_source=install-notice">starter templates</a>? Install the Starter Templates plugin to get started.', 'astra' ),
+ esc_attr( $ast_sites_notice_btn['class'] ),
+ 'href="' . astra_get_prop( $ast_sites_notice_btn, 'link', '' ) . '"',
+ 'data-slug="' . astra_get_prop( $ast_sites_notice_btn, 'data_slug', '' ) . '"',
+ 'data-init="' . astra_get_prop( $ast_sites_notice_btn, 'data_init', '' ) . '"',
+ 'data-settings-link-text="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link_text', '' ) . '"',
+ 'data-settings-link="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link', '' ) . '"',
+ 'data-activating-text="' . astra_get_prop( $ast_sites_notice_btn, 'activating_text', '' ) . '"',
+ esc_html( $ast_sites_notice_btn['button_text'] )
+ ),
+ 'priority' => 5,
+ 'display-with-other-notices' => false,
+ 'show_if' => class_exists( 'Astra_Ext_White_Label_Markup' ) ? Astra_Ext_White_Label_Markup::show_branding() : true,
+ );
+
+ Astra_Notices::add_notice(
+ $astra_sites_notice_args
+ );
+ }
+ }
+
+ /**
+ * Display notice for minimun version for Astra addon.
+ *
+ * @since 2.0.0
+ */
+ public static function minimum_addon_version_notice() {
+
+ if ( ! defined( 'ASTRA_EXT_VER' ) ) {
+ return;
+ }
+
+ if ( version_compare( ASTRA_EXT_VER, ASTRA_EXT_MIN_VER ) < 0 ) {
+
+ $message = sprintf(
+ /* translators: %1$1s: Theme Name, %2$2s: Minimum Required version of the addon */
+ __( 'Please update the %1$1s to version %2$2s or higher. Ignore if already updated.', 'astra' ),
+ astra_get_addon_name(),
+ ASTRA_EXT_MIN_VER
+ );
+
+ $min_version = get_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', true );
+
+ if ( ! $min_version ) {
+ update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER );
+ }
+
+ if ( version_compare( $min_version, ASTRA_EXT_MIN_VER, '!=' ) ) {
+ delete_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice' );
+ update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER );
+ }
+
+ $notice_args = array(
+ 'id' => 'ast-minimum-addon-version-notice',
+ 'type' => 'warning',
+ 'message' => $message,
+ 'show_if' => true,
+ 'repeat-notice-after' => false,
+ 'priority' => 18,
+ 'display-with-other-notices' => true,
+ );
+
+ Astra_Notices::add_notice( $notice_args );
+ }
+ }
+
+ /**
+ * Enqueue Astra Notices CSS.
+ *
+ * @since 2.0.0
+ *
+ * @return void
+ */
+ public static function notice_assets() {
+ if ( is_rtl() ) {
+ wp_enqueue_style( 'astra-notices-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-notices-rtl.css', array(), ASTRA_THEME_VERSION );
+ } else {
+ wp_enqueue_style( 'astra-notices', ASTRA_THEME_URI . 'inc/assets/css/astra-notices.css', array(), ASTRA_THEME_VERSION );
+ }
+ }
+
+ /**
+ * Render button for Astra Site notices
+ *
+ * @since 1.6.5
+ * @return array $ast_sites_notice_btn Rendered button
+ */
+ public static function astra_sites_notice_button() {
+
+ $ast_sites_notice_btn = array();
+
+ // Any of the Starter Templtes plugin - Active.
+ if ( is_plugin_active( 'astra-pro-sites/astra-pro-sites.php' ) || is_plugin_active( 'astra-sites/astra-sites.php' ) ) {
+ $ast_sites_notice_btn['class'] = 'active';
+ $ast_sites_notice_btn['button_text'] = __( 'See Library &#187;', 'astra' );
+ $ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
+
+ return $ast_sites_notice_btn;
+ }
+
+ // Starter Templates PRO Plugin - Installed but Inactive.
+ if ( file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
+ $ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin';
+ $ast_sites_notice_btn['button_text'] = __( 'Activate Importer Plugin', 'astra' );
+ $ast_sites_notice_btn['data_slug'] = 'astra-pro-sites';
+ $ast_sites_notice_btn['data_init'] = '/astra-pro-sites/astra-pro-sites.php';
+ $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
+ $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library &#187;', 'astra' );
+ $ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '&hellip;';
+
+ return $ast_sites_notice_btn;
+ }
+
+ // Starter Templates FREE Plugin - Installed but Inactive.
+ if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) ) {
+ $ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin';
+ $ast_sites_notice_btn['button_text'] = __( 'Activate Importer Plugin', 'astra' );
+ $ast_sites_notice_btn['data_slug'] = 'astra-sites';
+ $ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php';
+ $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
+ $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library &#187;', 'astra' );
+ $ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '&hellip;';
+
+ return $ast_sites_notice_btn;
+ }
+
+ // Any of the Starter Templates plugin not available.
+ if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) || ! file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) ) {
+ $ast_sites_notice_btn['class'] = 'astra-install-recommended-plugin';
+ $ast_sites_notice_btn['button_text'] = __( 'Install Importer Plugin', 'astra' );
+ $ast_sites_notice_btn['data_slug'] = 'astra-sites';
+ $ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php';
+ $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
+ $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library &#187;', 'astra' );
+ $ast_sites_notice_btn['detail_link_class'] = 'plugin-detail thickbox open-plugin-details-modal astra-starter-sites-detail-link';
+ $ast_sites_notice_btn['detail_link'] = network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=astra-sites&TB_iframe=true&width=772&height=400' );
+ $ast_sites_notice_btn['detail_link_text'] = __( 'Details &#187;', 'astra' );
+
+ return $ast_sites_notice_btn;
+ }
+
+ $ast_sites_notice_btn['class'] = 'active';
+ $ast_sites_notice_btn['button_text'] = __( 'See Library &#187;', 'astra' );
+ $ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
+
+ return $ast_sites_notice_btn;
+ }
+
+ /**
+ * Check if installed Starter Sites plugin is new.
+ *
+ * @since 2.3.2
+ */
+ public static function get_starter_templates_slug() {
+
+ if ( defined( 'ASTRA_PRO_SITES_VER' ) && version_compare( ASTRA_PRO_SITES_VER, '2.0.0', '>=' ) ) {
+ self::$starter_templates_slug = 'starter-templates';
+ }
+
+ if ( defined( 'ASTRA_SITES_VER' ) && version_compare( ASTRA_SITES_VER, '2.0.0', '>=' ) ) {
+ self::$starter_templates_slug = 'starter-templates';
+ }
+ }
+
+ /**
+ * Load the scripts and styles in the customizer controls.
+ *
+ * @since 1.2.1
+ */
+ public static function customizer_scripts() {
+ $color_palettes = wp_json_encode( astra_color_palette() );
+ wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $color_palettes . ';' );
+ }
+
+ /**
+ * Register admin scripts.
+ *
+ * @param String $hook Screen name where the hook is fired.
+ * @return void
+ */
+ public static function register_scripts( $hook ) {
+
+ if ( in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) {
+ $post_types = get_post_types( array( 'public' => true ) );
+ $screen = get_current_screen();
+ $post_type = $screen->id;
+
+ if ( in_array( $post_type, (array) $post_types ) ) {
+
+ echo '<style class="astra-meta-box-style">
+ .block-editor-page #side-sortables #astra_settings_meta_box select { min-width: 84%; padding: 3px 24px 3px 8px; height: 20px; }
+ .block-editor-page #normal-sortables #astra_settings_meta_box select { min-width: 200px; }
+ .block-editor-page .edit-post-meta-boxes-area #poststuff #astra_settings_meta_box h2.hndle { border-bottom: 0; }
+ .block-editor-page #astra_settings_meta_box .components-base-control__field, .block-editor-page #astra_settings_meta_box .block-editor-page .transparent-header-wrapper, .block-editor-page #astra_settings_meta_box .adv-header-wrapper, .block-editor-page #astra_settings_meta_box .stick-header-wrapper, .block-editor-page #astra_settings_meta_box .disable-section-meta div { margin-bottom: 8px; }
+ .block-editor-page #astra_settings_meta_box .disable-section-meta div label { vertical-align: inherit; }
+ .block-editor-page #astra_settings_meta_box .post-attributes-label-wrapper { margin-bottom: 4px; }
+ #side-sortables #astra_settings_meta_box select { min-width: 100%; }
+ #normal-sortables #astra_settings_meta_box select { min-width: 200px; }
+ </style>';
+ }
+ }
+ /* Add CSS for the Submenu for BSF plugins added in Appearance Menu */
+
+ if ( ! is_customize_preview() ) {
+
+ if ( ! current_user_can( 'manage_options' ) ) {
+ return;
+ }
+
+ wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false );
+
+ $localize = array(
+ 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
+ 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '&hellip;',
+ 'astraSitesLink' => admin_url( 'themes.php?page=' ),
+ 'astraSitesLinkTitle' => __( 'See Library &#187;', 'astra' ),
+ 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '&hellip;',
+ 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '&hellip;',
+ 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ),
+ 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ),
+ 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ),
+ 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ),
+ );
+
+ wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) );
+ }
+ }
+
+ /**
+ * Enqueues the needed CSS/JS for the builder's admin settings page.
+ *
+ * @since 1.0
+ */
+ public static function styles_scripts() {
+
+ // Styles.
+ if ( is_rtl() ) {
+ wp_enqueue_style( 'astra-admin-settings-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings-rtl.css', array(), ASTRA_THEME_VERSION );
+ } else {
+ wp_enqueue_style( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings.css', array(), ASTRA_THEME_VERSION );
+ }
+
+ if ( ! current_user_can( 'manage_options' ) ) {
+ return;
+ }
+
+ wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false );
+
+ $localize = array(
+ 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
+ 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '&hellip;',
+ 'astraSitesLink' => admin_url( 'themes.php?page=' ),
+ 'astraSitesLinkTitle' => __( 'See Library &#187;', 'astra' ),
+ 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '&hellip;',
+ 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '&hellip;',
+ 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ),
+ 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ),
+ 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ),
+ 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ),
+ 'ajax_nonce' => wp_create_nonce( 'astra-builder-module-nonce' ),
+ 'old_header_footer' => __( 'Use Old Header/Footer', 'astra' ),
+ 'migrate_to_builder' => __( 'Use New Header/Footer Builder', 'astra' ),
+ );
+ wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) );
+
+ // Script.
+ wp_enqueue_script( 'astra-admin-settings' );
+
+ if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
+ // For starter site plugin popup detail "Details &#187;" on Astra Options page.
+ wp_enqueue_script( 'plugin-install' );
+ wp_enqueue_script( 'thickbox' );
+ wp_enqueue_style( 'thickbox' );
+ }
+ }
+
+
+ /**
+ * Get and return page URL
+ *
+ * @param string $menu_slug Menu name.
+ * @since 1.0
+ * @return string page url
+ */
+ public static function get_page_url( $menu_slug ) {
+
+ $parent_page = self::$default_menu_position;
+
+ if ( strpos( $parent_page, '?' ) !== false ) {
+ $query_var = '&page=' . self::$plugin_slug;
+ } else {
+ $query_var = '?page=' . self::$plugin_slug;
+ }
+
+ $parent_page_url = admin_url( $parent_page . $query_var );
+
+ $url = $parent_page_url . '&action=' . $menu_slug;
+
+ return esc_url( $url );
+ }
+
+ /**
+ * Add main menu
+ *
+ * @since 1.0
+ */
+ public static function add_admin_menu() {
+
+ $parent_page = self::$default_menu_position;
+ $page_title = self::$menu_page_title;
+ $capability = 'manage_options';
+ $page_menu_slug = self::$plugin_slug;
+ $page_menu_func = __CLASS__ . '::menu_callback';
+
+ if ( apply_filters( 'astra_dashboard_admin_menu', true ) ) {
+ add_theme_page( $page_title, $page_title, $capability, $page_menu_slug, $page_menu_func );
+ } else {
+ do_action( 'asta_register_admin_menu', $parent_page, $page_title, $capability, $page_menu_slug, $page_menu_func );
+ }
+ }
+
+ /**
+ * Menu callback
+ *
+ * @since 1.0
+ */
+ public static function menu_callback() {
+
+ $current_slug = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : self::$current_slug; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+
+ $current_slug = str_replace( '-', '_', $current_slug );
+
+ $ast_icon = apply_filters( 'astra_page_top_icon', true );
+ $ast_visit_site_url = apply_filters( 'astra_site_url', 'https://wpastra.com' );
+ $ast_wrapper_class = apply_filters( 'astra_welcome_wrapper_class', array( $current_slug ) );
+
+ ?>
+ <div class="ast-menu-page-wrapper wrap ast-clear <?php echo esc_attr( implode( ' ', $ast_wrapper_class ) ); ?>">
+ <div class="ast-theme-page-header">
+ <div class="ast-container ast-flex">
+ <div class="ast-theme-title">
+ <a href="<?php echo esc_url( $ast_visit_site_url ); ?>" target="_blank" rel="noopener" >
+ <?php if ( $ast_icon ) { ?>
+ <img src="<?php echo esc_url( ASTRA_THEME_URI . 'inc/assets/images/astra.svg' ); ?>" class="ast-theme-icon" alt="<?php echo esc_attr( self::$page_title ); ?> " >
+ <span class="astra-theme-version"><?php echo esc_html( ASTRA_THEME_VERSION ); ?></span>
+ <?php } ?>
+ <?php do_action( 'astra_welcome_page_header_title' ); ?>
+ </a>
+ </div>
+
+ <?php do_action( 'astra_header_right_section' ); ?>
+
+ </div>
+ </div>
+
+ <?php do_action( 'astra_menu_' . esc_attr( $current_slug ) . '_action' ); ?>
+ </div>
+ <?php
+ }
+
+ /**
+ * Include general page
+ *
+ * @since 1.0
+ */
+ public static function general_page() {
+ require_once ASTRA_THEME_DIR . 'inc/core/view-general.php';// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
+ }
+
+ /**
+ * External links through Astra Options page.
+ *
+ * @since 3.4.0
+ */
+ public static function external_important_links_section() {
+
+ if ( astra_is_white_labelled() ) {
+ return;
+ }
+ ?>
+
+ <div class="postbox">
+ <h2 class="hndle ast-normal-cursor">
+ <span><?php echo esc_html( apply_filters( 'astra_other_links_postbox_title', __( 'Important Links', 'astra' ) ) ); ?></span>
+ </h2>
+ <div class="inside">
+ <ul class="ast-other-links-list">
+ <li>
+ <span class="dashicons dashicons-admin-home"></span>
+ <a href="https://wpastra.com/" target="_blank" rel="noopener"> <?php esc_html_e( 'Astra Website', 'astra' ); ?> </a>
+ </li>
+ <li>
+ <span class="dashicons dashicons-book"></span>
+ <a href="https://wpastra.com/docs/?utm_campaign=welcome-page" target="_blank" rel="noopener"> <?php esc_html_e( 'Knowledge Base', 'astra' ); ?> </a>
+ </li>
+ <li>
+ <span class="dashicons dashicons-sos"></span>
+ <a href="https://wpastra.com/contact/?utm_campaign=welcome-page" target="_blank" rel="noopener"> <?php esc_html_e( 'Five Star Support', 'astra' ); ?> </a>
+ </li>
+ <li>
+ <span class="dashicons dashicons-groups"></span>
+ <a href="https://www.facebook.com/groups/wpastra" target="_blank" rel="noopener"> <?php esc_html_e( 'Users Community Group', 'astra' ); ?> </a>
+ </li>
+ <li>
+ <span class="dashicons dashicons-star-filled"></span>
+ <a href="https://wordpress.org/support/theme/astra/reviews/?rate=5#new-post" target="_blank" rel="noopener"> <?php esc_html_e( 'Rate Us ★★★★★', 'astra' ); ?> </a>
+ </li>
+ </ul>
+ </div>
+ </div>
+
+ <?php
+ }
+
+ /**
+ * Starter Templates Post Box Title.
+ *
+ * @since 3.4.0
+ *
+ * @return string Starter Templates Plugin name.
+ */
+ public static function get_starter_templates_title() {
+
+ $astra_sites_name = __( '150+ Starter Templates', 'astra' );
+
+ if ( method_exists( 'Astra_Ext_White_Label_Markup', 'get_whitelabel_string' ) ) {
+ $white_labelled_astra_sites_name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
+ if ( ! empty( $white_labelled_astra_sites_name ) ) {
+ $astra_sites_name = $white_labelled_astra_sites_name;
+ }
+ }
+
+ return $astra_sites_name;
+ }
+
+ /**
+ * Include Welcome page right starter sites content
+ *
+ * @since 1.2.4
+ */
+ public static function astra_welcome_page_starter_sites_section() {
+
+ if ( astra_is_white_labelled() ) {
+ return;
+ }
+ ?>
+
+ <div class="postbox">
+ <h2 class="hndle ast-normal-cursor">
+ <span class="dashicons dashicons-admin-customizer"></span>
+ <span><?php echo self::get_starter_templates_title(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
+ </h2>
+ <img class="ast-starter-sites-img" alt="Starter Templates" src="<?php echo esc_url( ASTRA_THEME_URI . 'assets/images/astra-starter-sites.jpg' ); ?>">
+ <div class="inside">
+ <p>
+ <?php
+ $astra_starter_sites_doc_link = apply_filters( 'astra_starter_sites_documentation_link', astra_get_pro_url( 'https://wpastra.com/starter-templates', 'astra-dashboard', 'astra-starter-templates', 'astra-options-page' ) );
+ $astra_starter_sites_doc_link_text = apply_filters( 'astra_starter_sites_doc_link_text', __( 'Starter Templates?', 'astra' ) );
+ printf(
+ /* translators: %1$s: Starter site link. */
+ esc_html__( 'Did you know %1$s offers a free library of %2$s ', 'astra' ),
+ self::$page_title,
+ ! empty( $astra_starter_sites_doc_link ) ? '<a href=' . esc_url( $astra_starter_sites_doc_link ) . ' target="_blank" rel="noopener">' . esc_html( $astra_starter_sites_doc_link_text ) . '</a>' :
+ esc_html( $astra_starter_sites_doc_link_text )
+ );
+ ?>
+ </p>
+ <p>
+ <?php
+ esc_html_e( 'Choose from over 150 beautiful templates and kickstart your project!', 'astra' );
+ ?>
+ </p>
+ <?php
+ $ast_sites_notice_btn = self::astra_sites_notice_button();
+
+ printf(
+ '<a class="%1$s" %2$s %3$s %4$s %5$s %6$s %7$s> %8$s </a>',
+ esc_attr( $ast_sites_notice_btn['class'] ),
+ 'href="' . esc_url( astra_get_prop( $ast_sites_notice_btn, 'link', '' ) ) . '"',
+ 'data-slug="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_slug', '' ) ) . '"',
+ 'data-init="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_init', '' ) ) . '"',
+ 'data-settings-link-text="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_settings_link_text', '' ) ) . '"',
+ 'data-settings-link="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_settings_link', '' ) ) . '"',
+ 'data-activating-text="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'activating_text', '' ) ) . '"',
+ esc_html( $ast_sites_notice_btn['button_text'] )
+ );
+ printf(
+ '<a class="%1$s" %2$s target="_blank" rel="noopener"> %3$s </a>',
+ isset( $ast_sites_notice_btn['detail_link_class'] ) ? esc_attr( $ast_sites_notice_btn['detail_link_class'] ) : '',
+ isset( $ast_sites_notice_btn['detail_link'] ) ? 'href="' . esc_url( $ast_sites_notice_btn['detail_link'] ) . '"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ isset( $ast_sites_notice_btn['detail_link_class'] ) ? esc_html( $ast_sites_notice_btn['detail_link_text'] ) : '' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ );
+ ?>
+ <div>
+ </div>
+ </div>
+ </div>
+
+ <?php
+ }
+
+ /**
+ * Include Welcome page content
+ *
+ * @since 1.2.4
+ */
+ public static function astra_welcome_page_content() {
+
+ $astra_addon_tagline = apply_filters( 'astra_addon_list_tagline', __( 'More Options Available with Astra Pro!', 'astra' ) );
+
+ // Quick settings.
+ $quick_settings = apply_filters(
+ 'astra_quick_settings',
+ array(
+ 'header' => array(
+ 'title' => __( 'Header Options', 'astra' ),
+ 'dashicon' => 'dashicons-align-center',
+ 'quick_url' => admin_url( 'customize.php?autofocus[panel]=panel-header-group' ),
+ ),
+ 'logo-favicon' => array(
+ 'title' => __( 'Upload Logo', 'astra' ),
+ 'dashicon' => 'dashicons-format-image',
+ 'quick_url' => admin_url( 'customize.php?autofocus[control]=custom_logo' ),
+ ),
+ 'footer' => array(
+ 'title' => __( 'Footer Settings', 'astra' ),
+ 'dashicon' => 'dashicons-align-wide',
+ 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-footer-group' ),
+ ),
+ 'colors' => array(
+ 'title' => __( 'Set Colors', 'astra' ),
+ 'dashicon' => 'dashicons-admin-customizer',
+ 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-colors-background' ),
+ ),
+ 'layout' => array(
+ 'title' => __( 'Layout Options', 'astra' ),
+ 'dashicon' => 'dashicons-layout',
+ 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-container-layout' ),
+ ),
+ 'typography' => array(
+ 'title' => __( 'Customize Fonts', 'astra' ),
+ 'dashicon' => 'dashicons-editor-textcolor',
+ 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-typography' ),
+ ),
+ 'blog-layout' => array(
+ 'title' => __( 'Blog Layouts', 'astra' ),
+ 'dashicon' => 'dashicons-welcome-write-blog',
+ 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-blog-group' ),
+ ),
+ 'sidebars' => array(
+ 'title' => __( 'Sidebar Options', 'astra' ),
+ 'dashicon' => 'dashicons-align-left',
+ 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-sidebars' ),
+ ),
+ )
+ );
+
+ $extensions = apply_filters(
+ 'astra_addon_list',
+ array(
+ 'colors-and-background' => array(
+ 'title' => __( 'Colors & Background', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/colors-background-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/colors-background-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'typography' => array(
+ 'title' => __( 'Typography', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/typography-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/typography-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'spacing' => array(
+ 'title' => __( 'Spacing', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/spacing-addon-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/spacing-addon-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'blog-pro' => array(
+ 'title' => __( 'Blog Pro', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/blog-pro-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/blog-pro-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'mobile-header' => array(
+ 'title' => __( 'Mobile Header', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/mobile-header-with-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/mobile-header-with-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'header-sections' => array(
+ 'title' => __( 'Header Sections', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/header-sections-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/header-sections-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'nav-menu' => array(
+ 'title' => __( 'Nav Menu', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/nav-menu-addon/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/nav-menu-addon/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'sticky-header' => array(
+ 'title' => __( 'Sticky Header', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/sticky-header-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/sticky-header-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'advanced-headers' => array(
+ 'title' => __( 'Page Headers', 'astra' ),
+ 'description' => __( 'Make your header layouts look more appealing and sexy!', 'astra' ),
+ 'manage_settings' => true,
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/page-headers-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/page-headers-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'advanced-hooks' => array(
+ 'title' => __( 'Custom Layouts', 'astra' ),
+ // 'icon' => ASTRA_THEME_URI . 'assets/img/astra-advanced-hooks.png',
+ 'description' => __( 'Add content conditionally in the various hook areas of the theme.', 'astra' ),
+ 'manage_settings' => true,
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/custom-layouts-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/custom-layouts-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'site-layouts' => array(
+ 'title' => __( 'Site Layouts', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/site-layout-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/site-layout-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'advanced-footer' => array(
+ 'title' => __( 'Footer Widgets', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/footer-widgets-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/footer-widgets-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'scroll-to-top' => array(
+ 'title' => __( 'Scroll To Top', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/scroll-to-top-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/scroll-to-top-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'woocommerce' => array(
+ 'title' => __( 'WooCommerce', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/woocommerce-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/woocommerce-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'edd' => array(
+ 'title' => __( 'Easy Digital Downloads', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/easy-digital-downloads-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/easy-digital-downloads-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'learndash' => array(
+ 'title' => __( 'LearnDash', 'astra' ),
+ 'description' => __( 'Supercharge your LearnDash website with amazing design features.', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/learndash-integration-in-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/learndash-integration-in-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'lifterlms' => array(
+ 'title' => __( 'LifterLMS', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/lifterlms-module-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/lifterlms-module-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ 'white-label' => array(
+ 'title' => __( 'White Label', 'astra' ),
+ 'class' => 'ast-addon',
+ 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/how-to-white-label-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'links' => array(
+ array(
+ 'link_class' => 'ast-learn-more',
+ 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/how-to-white-label-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
+ 'link_text' => __( 'Learn More &#187;', 'astra' ),
+ 'target_blank' => true,
+ ),
+ ),
+ ),
+ )
+ );
+ ?>
+ <div class="postbox">
+ <h2 class="hndle ast-normal-cursor"><span><?php esc_html_e( 'Links to Customizer Settings:', 'astra' ); ?></span></h2>
+ <div class="ast-quick-setting-section">
+ <?php
+ if ( ! empty( $quick_settings ) ) :
+ ?>
+ <div class="ast-quick-links">
+ <ul class="ast-flex">
+ <?php
+ foreach ( (array) $quick_settings as $key => $link ) {
+ echo '<li class="' . esc_attr( $key ) . '"><span class="dashicons ' . esc_attr( $link['dashicon'] ) . '"></span><a class="ast-quick-setting-title" href="' . esc_url( $link['quick_url'] ) . '" target="_blank" rel="noopener">' . esc_html( $link['title'] ) . '</a></li>';
+ }
+ ?>
+ </ul>
+ </div>
+ <?php endif; ?>
+ </div>
+ </div>
+
+ <div class="postbox">
+ <h2 class="hndle ast-normal-cursor ast-addon-heading ast-flex"><span><?php echo esc_html( $astra_addon_tagline ); ?></span>
+ <?php do_action( 'astra_addon_bulk_action' ); ?>
+ </h2>
+ <div class="ast-addon-list-section">
+ <?php
+ if ( ! empty( $extensions ) ) :
+ ?>
+ <div>
+ <ul class="ast-addon-list">
+ <?php
+ foreach ( (array) $extensions as $addon => $info ) {
+ $title_url = ( isset( $info['title_url'] ) && ! empty( $info['title_url'] ) ) ? 'href="' . esc_url( $info['title_url'] ) . '"' : '';
+ $anchor_target = ( isset( $info['title_url'] ) && ! empty( $info['title_url'] ) ) ? "target='_blank' rel='noopener'" : '';
+
+ echo '<li id="' . esc_attr( $addon ) . '" class="' . esc_attr( $info['class'] ) . '"><a class="ast-addon-title"' . $title_url . $anchor_target . ' >' . esc_html( $info['title'] ) . '</a><div class="ast-addon-link-wrapper">'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+
+ foreach ( $info['links'] as $key => $link ) {
+ printf(
+ '<a class="%1$s" %2$s %3$s> %4$s </a>',
+ esc_attr( $link['link_class'] ),
+ isset( $link['link_url'] ) ? 'href="' . esc_url( $link['link_url'] ) . '"' : '',
+ ( isset( $link['target_blank'] ) && $link['target_blank'] ) ? 'target="_blank" rel="noopener"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ esc_html( $link['link_text'] )
+ );
+ }
+ echo '</div></li>';
+ }
+ ?>
+ </ul>
+ </div>
+ <?php endif; ?>
+ </div>
+ </div>
+
+ <?php
+ }
+
+ /**
+ * Include Welcome page content
+ *
+ * @since 1.2.4
+ */
+ public static function astra_available_plugins() {
+
+ // Return if white labeled.
+ if ( astra_is_white_labelled() ) {
+ return;
+ }
+
+ $astra_addon_tagline = apply_filters(
+ 'astra_available_plugins',
+ sprintf(
+ /* translators: %1s Astra Theme */
+ __( 'Extend %1s with free plugins!', 'astra' ),
+ astra_get_theme_name()
+ )
+ );
+
+ $recommended_plugins = apply_filters(
+ 'astra_recommended_plugins',
+ array(
+ 'astra-import-export' =>
+ array(
+ 'plugin-name' => __( 'Import / Export Customizer Settings', 'astra' ),
+ 'plugin-init' => 'astra-import-export/astra-import-export.php',
+ 'settings-link' => '',
+ 'settings-link-text' => 'Settings',
+ ),
+ 'reset-astra-customizer' =>
+ array(
+ 'plugin-name' => __( 'Astra Customizer Reset', 'astra' ),
+ 'plugin-init' => 'reset-astra-customizer/class-astra-theme-customizer-reset.php',
+ 'settings-link' => admin_url( 'customize.php' ),
+ 'settings-link-text' => 'Settings',
+ ),
+
+ 'customizer-search' =>
+ array(
+ 'plugin-name' => __( 'Customizer Search', 'astra' ),
+ 'plugin-init' => 'customizer-search/customizer-search.php',
+ 'settings-link' => admin_url( 'customize.php' ),
+ 'settings-link-text' => 'Settings',
+ ),
+
+ 'astra-bulk-edit' =>
+ array(
+ 'plugin-name' => __( 'Astra Bulk Edit', 'astra' ),
+ 'plugin-init' => 'astra-bulk-edit/astra-bulk-edit.php',
+ 'settings-link' => '',
+ 'settings-link-text' => 'Settings',
+ ),
+
+ 'astra-widgets' =>
+ array(
+ 'plugin-name' => __( 'Astra Widgets', 'astra' ),
+ 'plugin-init' => 'astra-widgets/astra-widgets.php',
+ 'settings-link' => admin_url( 'widgets.php' ),
+ 'settings-link-text' => 'Settings',
+ ),
+
+ 'custom-fonts' =>
+ array(
+ 'plugin-name' => __( 'Custom Fonts', 'astra' ),
+ 'plugin-init' => 'custom-fonts/custom-fonts.php',
+ 'settings-link' => admin_url( 'edit-tags.php?taxonomy=bsf_custom_fonts' ),
+ 'settings-link-text' => 'Settings',
+ ),
+
+ 'custom-typekit-fonts' =>
+ array(
+ 'plugin-name' => __( 'Custom Typekit Fonts', 'astra' ),
+ 'plugin-init' => 'custom-typekit-fonts/custom-typekit-fonts.php',
+ 'settings-link' => admin_url( 'themes.php?page=custom-typekit-fonts' ),
+ 'settings-link-text' => 'Settings',
+ ),
+
+ 'sidebar-manager' =>
+ array(
+ 'plugin-name' => __( 'Sidebar Manager', 'astra' ),
+ 'plugin-init' => 'sidebar-manager/sidebar-manager.php',
+ 'settings-link' => admin_url( 'edit.php?post_type=bsf-sidebar' ),
+ 'settings-link-text' => 'Settings',
+ ),
+
+ 'ultimate-addons-for-gutenberg' =>
+ array(
+ 'plugin-name' => __( 'Ultimate Addons for Gutenberg', 'astra' ),
+ 'plugin-init' => 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php',
+ 'settings-link' => admin_url( 'options-general.php?page=uag' ),
+ 'settings-link-text' => 'Settings',
+ 'display' => function_exists( 'register_block_type' ),
+ ),
+ )
+ );
+
+ if ( apply_filters( 'astra_show_free_extend_plugins', true ) ) {
+ ?>
+
+ <div class="postbox">
+ <h2 class="hndle ast-normal-cursor ast-addon-heading ast-flex"><span><?php echo esc_html( $astra_addon_tagline ); ?></span>
+ </h2>
+ <div class="ast-addon-list-section">
+ <?php
+ if ( ! empty( $recommended_plugins ) ) :
+ ?>
+ <div>
+ <ul class="ast-addon-list">
+ <?php
+ foreach ( $recommended_plugins as $slug => $plugin ) {
+
+ // If display condition for the plugin does not meet, skip the plugin from displaying.
+ if ( isset( $plugin['display'] ) && false === $plugin['display'] ) {
+ continue;
+ }
+
+ $plugin_active_status = '';
+ if ( is_plugin_active( $plugin['plugin-init'] ) ) {
+ $plugin_active_status = ' active';
+ }
+
+ echo '<li ' . astra_attr(
+ 'astra-recommended-plugin-' . esc_attr( $slug ),
+ array(
+ 'id' => esc_attr( $slug ),
+ 'class' => 'astra-recommended-plugin' . $plugin_active_status,
+ 'data-slug' => $slug,
+ )
+ ) . '>';
+
+ echo '<a href="' . esc_url( self::build_worg_plugin_link( $slug ) ) . '" target="_blank">';
+ echo esc_html( $plugin['plugin-name'] );
+ echo '</a>';
+
+ echo '<div class="ast-addon-link-wrapper">';
+
+ if ( ! is_plugin_active( $plugin['plugin-init'] ) ) {
+
+ if ( file_exists( WP_CONTENT_DIR . '/plugins/' . $plugin['plugin-init'] ) ) {
+ echo '<a ' . astra_attr(
+ 'astra-activate-recommended-plugin',
+ array(
+ 'data-slug' => $slug,
+ 'href' => '#',
+ 'data-init' => $plugin['plugin-init'],
+ 'data-settings-link' => esc_url( $plugin['settings-link'] ),
+ 'data-settings-link-text' => $plugin['settings-link-text'],
+ )
+ ) . '>';
+
+ esc_html_e( 'Activate', 'astra' );
+
+ echo '</a>';
+
+ } else {
+
+ echo '<a ' . astra_attr(
+ 'astra-install-recommended-plugin',
+ array(
+ 'data-slug' => $slug,
+ 'href' => '#',
+ 'data-init' => $plugin['plugin-init'],
+ 'data-settings-link' => esc_url( $plugin['settings-link'] ),
+ 'data-settings-link-text' => $plugin['settings-link-text'],
+ )
+ ) . '>';
+
+ esc_html_e( 'Activate', 'astra' );
+
+ echo '</a>';
+ }
+ } else {
+
+ echo '<a ' . astra_attr(
+ 'astra-deactivate-recommended-plugin',
+ array(
+ 'data-slug' => $slug,
+ 'href' => '#',
+ 'data-init' => $plugin['plugin-init'],
+ 'data-settings-link' => esc_url( $plugin['settings-link'] ),
+ 'data-settings-link-text' => $plugin['settings-link-text'],
+ )
+ ) . '>';
+
+ esc_html_e( 'Deactivate', 'astra' );
+
+ echo '</a>';
+
+ if ( '' !== $plugin['settings-link'] ) {
+
+ echo '<a ' . astra_attr(
+ 'astra-recommended-plugin-links',
+ array(
+ 'data-slug' => $slug,
+ 'href' => $plugin['settings-link'],
+ )
+ ) . '>';
+
+ echo esc_html( $plugin['settings-link-text'] );
+
+ echo '</a>';
+ }
+ }
+
+ echo '</div>';
+
+ echo '</li>';
+ }
+ ?>
+ </ul>
+ </div>
+ <?php endif; ?>
+ </div>
+ </div>
+
+ <?php
+ }
+
+ }
+
+ /**
+ * Build plugin's page URL on WordPress.org
+ * https://wordpress.org/plugins/{plugin-slug}
+ *
+ * @since 1.6.9
+ * @param String $slug plugin slug.
+ * @return String Plugin URL on WordPress.org
+ */
+ private static function build_worg_plugin_link( $slug ) {
+ return esc_url( trailingslashit( 'https://wordpress.org/plugins/' . $slug ) );
+ }
+
+ /**
+ * Required Plugin Activate
+ *
+ * @since 1.2.4
+ */
+ public static function required_plugin_activate() {
+
+ $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : '';
+
+ if ( false === wp_verify_nonce( $nonce, 'astra-recommended-plugin-nonce' ) ) {
+ wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'astra' ) );
+ }
+
+ if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) {
+ wp_send_json_error(
+ array(
+ 'success' => false,
+ 'message' => __( 'No plugin specified', 'astra' ),
+ )
+ );
+ }
+
+ $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : '';
+
+ $activate = activate_plugin( $plugin_init, '', false, true );
+
+ if ( '/astra-pro-sites/astra-pro-sites.php' === $plugin_init || '/astra-sites/astra-sites.php' === $plugin_init ) {
+ self::get_starter_templates_slug();
+ }
+
+ if ( is_wp_error( $activate ) ) {
+ wp_send_json_error(
+ array(
+ 'success' => false,
+ 'message' => $activate->get_error_message(),
+ 'starter_template_slug' => self::$starter_templates_slug,
+ )
+ );
+ }
+
+ wp_send_json_success(
+ array(
+ 'success' => true,
+ 'message' => __( 'Plugin Successfully Activated', 'astra' ),
+ 'starter_template_slug' => self::$starter_templates_slug,
+ )
+ );
+ }
+
+ /**
+ * Required Plugin Activate
+ *
+ * @since 1.2.4
+ */
+ public static function required_plugin_deactivate() {
+
+ $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : '';
+
+ if ( false === wp_verify_nonce( $nonce, 'astra-recommended-plugin-nonce' ) ) {
+ wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'astra' ) );
+ }
+
+ if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) {
+ wp_send_json_error(
+ array(
+ 'success' => false,
+ 'message' => __( 'No plugin specified', 'astra' ),
+ )
+ );
+ }
+
+ $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : '';
+
+ $deactivate = deactivate_plugins( $plugin_init, '', false );
+
+ if ( is_wp_error( $deactivate ) ) {
+ wp_send_json_error(
+ array(
+ 'success' => false,
+ 'message' => $deactivate->get_error_message(),
+ )
+ );
+ }
+
+ wp_send_json_success(
+ array(
+ 'success' => true,
+ 'message' => __( 'Plugin Successfully Deactivated', 'astra' ),
+ )
+ );
+
+ }
+
+ /**
+ * Astra Header Right Section Links
+ *
+ * @since 1.2.4
+ */
+ public static function top_header_right_section() {
+
+ $top_links = apply_filters(
+ 'astra_header_top_links',
+ array(
+ 'astra-theme-info' => array(
+ 'title' => '<img src=" ' . ASTRA_THEME_URI . 'inc/assets/images/lightning-speed.svg" class="astra-lightning-icon" alt="Astra Lightning Speed">' . __( ' Lightning Fast & Fully Customizable WordPress theme!', 'astra' ),
+ ),
+ )
+ );
+
+ if ( ! empty( $top_links ) ) {
+ ?>
+ <div class="ast-top-links">
+ <ul>
+ <?php
+ foreach ( (array) $top_links as $key => $info ) {
+ /* translators: %1$s: Top Link URL wrapper, %2$s: Top Link URL, %3$s: Top Link URL target attribute */
+ printf(
+ '<li><%1$s %2$s %3$s > %4$s </%1$s>',
+ isset( $info['url'] ) ? 'a' : 'span',
+ isset( $info['url'] ) ? 'href="' . esc_url( $info['url'] ) . '"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ isset( $info['url'] ) ? 'target="_blank" rel="noopener"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ $info['title']// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ );
+ }
+ ?>
+ </ul>
+ </div>
+ <?php
+ }
+ }
+
+ /**
+ * Add custom CSS for admin area sub menu icons.
+ *
+ * @since 2.5.4
+ */
+ public static function admin_submenu_css() {
+
+ echo '<style class="astra-menu-appearance-style">
+ #menu-appearance a[href^="edit.php?post_type=astra-"]:before,
+ #menu-appearance a[href^="themes.php?page=astra-"]:before,
+ #menu-appearance a[href^="edit.php?post_type=astra_"]:before,
+ #menu-appearance a[href^="edit-tags.php?taxonomy=bsf_custom_fonts"]:before,
+ #menu-appearance a[href^="themes.php?page=custom-typekit-fonts"]:before,
+ #menu-appearance a[href^="edit.php?post_type=bsf-sidebar"]:before {
+ content: "\21B3";
+ margin-right: 0.5em;
+ opacity: 0.5;
+ }
+ </style>';
+
+ }
+ }
+
+ new Astra_Admin_Settings();
+}
diff --git a/inc/core/class-astra-attr.php b/inc/core/class-astra-attr.php
new file mode 100644
index 0000000..2f55e46
--- /dev/null
+++ b/inc/core/class-astra-attr.php
@@ -0,0 +1,115 @@
+<?php
+/**
+ * Astra Attributes Class.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.6.2
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+if ( ! class_exists( 'Astra_Attr' ) ) :
+
+ /**
+ * Class Astra_Attr
+ */
+ class Astra_Attr {
+
+ /**
+ * Store Instance on Current Class.
+ *
+ * @var object instance
+ */
+ private static $instance;
+
+ /**
+ * Initiator
+ */
+ public static function get_instance() {
+ if ( ! isset( self::$instance ) ) {
+ self::$instance = new self();
+ }
+ return self::$instance;
+ }
+
+ /**
+ * Initialuze the Class.
+ *
+ * @since 1.6.2
+ */
+ private function __construct() {}
+
+ /**
+ * Build list of attributes into a string and apply contextual filter on string.
+ *
+ * The contextual filter is of the form `astra_attr_{context}_output`.
+ *
+ * @since 1.6.2
+ *
+ * @param string $context The context, to build filter name.
+ * @param array $attributes Optional. Extra attributes to merge with defaults.
+ * @param array $args Optional. Custom data to pass to filter.
+ * @return string String of HTML attributes and values.
+ */
+ public function astra_attr( $context, $attributes = array(), $args = array() ) {
+
+ $attributes = $this->astra_parse_attr( $context, $attributes, $args );
+
+ $output = '';
+
+ // Cycle through attributes, build tag attribute string.
+ foreach ( $attributes as $key => $value ) {
+
+ if ( ! $value ) {
+ continue;
+ }
+
+ if ( true === $value ) {
+ $output .= esc_html( $key ) . ' ';
+ } else {
+ $output .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
+ }
+ }
+
+ $output = apply_filters( "astra_attr_{$context}_output", $output, $attributes, $context, $args );
+
+ return trim( $output );
+ }
+
+ /**
+ * Merge array of attributes with defaults, and apply contextual filter on array.
+ *
+ * The contextual filter is of the form `astra_attr_{context}`.
+ *
+ * @since 1.6.2
+ *
+ * @param string $context The context, to build filter name.
+ * @param array $attributes Optional. Extra attributes to merge with defaults.
+ * @param array $args Optional. Custom data to pass to filter.
+ * @return array Merged and filtered attributes.
+ */
+ public function astra_parse_attr( $context, $attributes = array(), $args = array() ) {
+
+ $defaults = array(
+ 'class' => sanitize_html_class( $context ),
+ );
+
+ $attributes = wp_parse_args( $attributes, $defaults );
+
+ // Contextual filter.
+ return apply_filters( "astra_attr_{$context}", $attributes, $context, $args );
+ }
+
+ }
+
+endif;
+
+/**
+ * Kicking this off by calling 'get_instance()' method
+ */
+Astra_Attr::get_instance();
diff --git a/inc/core/class-astra-enqueue-scripts.php b/inc/core/class-astra-enqueue-scripts.php
new file mode 100644
index 0000000..c249445
--- /dev/null
+++ b/inc/core/class-astra-enqueue-scripts.php
@@ -0,0 +1,389 @@
+<?php
+/**
+ * Loader Functions
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+/**
+ * Theme Enqueue Scripts
+ */
+if ( ! class_exists( 'Astra_Enqueue_Scripts' ) ) {
+
+ /**
+ * Theme Enqueue Scripts
+ */
+ class Astra_Enqueue_Scripts {
+
+ /**
+ * Class styles.
+ *
+ * @access public
+ * @var $styles Enqueued styles.
+ */
+ public static $styles;
+
+ /**
+ * Class scripts.
+ *
+ * @access public
+ * @var $scripts Enqueued scripts.
+ */
+ public static $scripts;
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+
+ add_action( 'astra_get_fonts', array( $this, 'add_fonts' ), 1 );
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
+ add_action( 'enqueue_block_editor_assets', array( $this, 'gutenberg_assets' ) );
+ add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
+ add_action( 'wp_print_footer_scripts', array( $this, 'astra_skip_link_focus_fix' ) );
+ add_filter( 'gallery_style', array( $this, 'enqueue_galleries_style' ) );
+ }
+
+ /**
+ * Fix skip link focus in IE11.
+ *
+ * This does not enqueue the script because it is tiny and because it is only for IE11,
+ * thus it does not warrant having an entire dedicated blocking script being loaded.
+ *
+ * @link https://git.io/vWdr2
+ * @link https://github.com/WordPress/twentynineteen/pull/47/files
+ * @link https://github.com/ampproject/amphtml/issues/18671
+ */
+ public function astra_skip_link_focus_fix() {
+ // Skip printing script on AMP content, since accessibility fix is covered by AMP framework.
+ if ( astra_is_amp_endpoint() ) {
+ return;
+ }
+
+ // The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`.
+ ?>
+ <script>
+ /(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1);
+ </script>
+ <?php
+ }
+
+ /**
+ * Admin body classes.
+ *
+ * Body classes to be added to <body> tag in admin page
+ *
+ * @param String $classes body classes returned from the filter.
+ * @return String body classes to be added to <body> tag in admin page
+ */
+ public function admin_body_class( $classes ) {
+
+ global $pagenow;
+ $screen = get_current_screen();
+
+ if ( ( ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) && ( defined( 'ASTRA_ADVANCED_HOOKS_POST_TYPE' ) && ASTRA_ADVANCED_HOOKS_POST_TYPE == $screen->post_type ) ) || 'widgets.php' == $pagenow ) {
+ return;
+ }
+
+ $post_id = get_the_ID();
+
+ if ( $post_id ) {
+ $meta_content_layout = get_post_meta( $post_id, 'site-content-layout', true );
+ }
+
+ if ( ( isset( $meta_content_layout ) && ! empty( $meta_content_layout ) ) && 'default' !== $meta_content_layout ) {
+ $content_layout = $meta_content_layout;
+ } else {
+ $content_layout = astra_get_option( 'site-content-layout' );
+ }
+
+ if ( 'content-boxed-container' == $content_layout ) {
+ $classes .= ' ast-separate-container';
+ } elseif ( 'boxed-container' == $content_layout ) {
+ $classes .= ' ast-separate-container ast-two-container';
+ } elseif ( 'page-builder' == $content_layout ) {
+ $classes .= ' ast-page-builder-template';
+ } elseif ( 'plain-container' == $content_layout ) {
+ $classes .= ' ast-plain-container';
+ }
+
+ $site_layout = astra_get_option( 'site-layout' );
+ if ( 'ast-box-layout' === $site_layout ) {
+ $classes .= ' ast-max-width-layout';
+ }
+
+ $classes .= ' ast-' . astra_page_layout();
+
+ return $classes;
+ }
+
+ /**
+ * List of all assets.
+ *
+ * @return array assets array.
+ */
+ public static function theme_assets() {
+
+ $default_assets = array(
+ // handle => location ( in /assets/js/ ) ( without .js ext).
+ 'js' => array(
+ 'astra-theme-js' => 'style',
+ ),
+ // handle => location ( in /assets/css/ ) ( without .css ext).
+ 'css' => array(
+ 'astra-theme-css' => Astra_Builder_Helper::apply_flex_based_css() ? 'style-flex' : 'style',
+ ),
+ );
+
+ if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
+
+ $default_assets = array(
+ // handle => location ( in /assets/js/ ) ( without .js ext).
+ 'js' => array(
+ 'astra-theme-js' => 'frontend',
+ ),
+ // handle => location ( in /assets/css/ ) ( without .css ext).
+ 'css' => array(
+ 'astra-theme-css' => Astra_Builder_Helper::apply_flex_based_css() ? 'main' : 'frontend',
+ ),
+ );
+
+ if ( Astra_Builder_Helper::is_component_loaded( 'edd-cart', 'header' ) ||
+ Astra_Builder_Helper::is_component_loaded( 'woo-cart', 'header' ) ) {
+ $default_assets['js']['astra-mobile-cart'] = 'mobile-cart';
+ }
+ }
+ return apply_filters( 'astra_theme_assets', $default_assets );
+ }
+
+ /**
+ * Add Fonts
+ */
+ public function add_fonts() {
+
+ $font_family = astra_get_option( 'body-font-family' );
+ $font_weight = astra_get_option( 'body-font-weight' );
+ $font_variant = astra_get_option( 'body-font-variant' );
+
+ Astra_Fonts::add_font( $font_family, $font_weight );
+ Astra_Fonts::add_font( $font_family, $font_variant );
+
+ // Render headings font.
+ $heading_font_family = astra_get_option( 'headings-font-family' );
+ $heading_font_weight = astra_get_option( 'headings-font-weight' );
+ $heading_font_variant = astra_get_option( 'headings-font-variant' );
+
+ Astra_Fonts::add_font( $heading_font_family, $heading_font_weight );
+ Astra_Fonts::add_font( $heading_font_family, $heading_font_variant );
+ }
+
+ /**
+ * Enqueue Scripts
+ */
+ public function enqueue_scripts() {
+
+ if ( false === self::enqueue_theme_assets() ) {
+ return;
+ }
+
+ /* Directory and Extension */
+ $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
+ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
+
+ $js_uri = ASTRA_THEME_URI . 'assets/js/' . $dir_name . '/';
+ $css_uri = ASTRA_THEME_URI . 'assets/css/' . $dir_name . '/';
+
+ /**
+ * IE Only Js and CSS Files.
+ */
+ // Flexibility.js for flexbox IE10 support.
+ wp_enqueue_script( 'astra-flexibility', $js_uri . 'flexibility' . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, false );
+ wp_add_inline_script( 'astra-flexibility', 'flexibility(document.documentElement);' );
+ wp_script_add_data( 'astra-flexibility', 'conditional', 'IE' );
+
+ // Polyfill for CustomEvent for IE.
+ wp_register_script( 'astra-customevent', $js_uri . 'custom-events-polyfill' . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, false );
+ wp_register_style( 'astra-galleries-css', $css_uri . 'galleries' . $file_prefix . '.css', array(), ASTRA_THEME_VERSION, 'all' );
+ // All assets.
+ $all_assets = self::theme_assets();
+ $styles = $all_assets['css'];
+ $scripts = $all_assets['js'];
+
+ if ( is_array( $styles ) && ! empty( $styles ) ) {
+ // Register & Enqueue Styles.
+ foreach ( $styles as $key => $style ) {
+
+ $dependency = array();
+
+ // Add dynamic CSS dependency for all styles except for theme's style.css.
+ if ( 'astra-theme-css' !== $key && class_exists( 'Astra_Cache_Base' ) ) {
+ if ( ! Astra_Cache_Base::inline_assets() ) {
+ $dependency[] = 'astra-theme-dynamic';
+ }
+ }
+
+ // Generate CSS URL.
+ $css_file = $css_uri . $style . $file_prefix . '.css';
+
+ // Register.
+ wp_register_style( $key, $css_file, $dependency, ASTRA_THEME_VERSION, 'all' );
+
+ // Enqueue.
+ wp_enqueue_style( $key );
+
+ // RTL support.
+ wp_style_add_data( $key, 'rtl', 'replace' );
+ }
+ }
+
+ // Fonts - Render Fonts.
+ Astra_Fonts::render_fonts();
+
+ /**
+ * Inline styles
+ */
+
+ add_filter( 'astra_dynamic_theme_css', array( 'Astra_Dynamic_CSS', 'return_output' ) );
+ add_filter( 'astra_dynamic_theme_css', array( 'Astra_Dynamic_CSS', 'return_meta_output' ) );
+
+ $menu_animation = astra_get_option( 'header-main-submenu-container-animation' );
+
+ // Submenu Container Animation for header builder.
+ if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
+
+ for ( $index = 1; $index <= Astra_Builder_Helper::$component_limit; $index++ ) {
+
+ $menu_animation_enable = astra_get_option( 'header-menu' . $index . '-submenu-container-animation' );
+
+ if ( Astra_Builder_Helper::is_component_loaded( 'menu-' . $index, 'header' ) && ! empty( $menu_animation_enable ) ) {
+ $menu_animation = 'is_animated';
+ break;
+ }
+ }
+ }
+
+ $rtl = ( is_rtl() ) ? '-rtl' : '';
+
+ if ( ! empty( $menu_animation ) || is_customize_preview() ) {
+ if ( class_exists( 'Astra_Cache' ) ) {
+ Astra_Cache::add_css_file( ASTRA_THEME_DIR . 'assets/css/' . $dir_name . '/menu-animation' . $rtl . $file_prefix . '.css' );
+ } else {
+ wp_register_style( 'astra-menu-animation', $css_uri . 'menu-animation' . $file_prefix . '.css', null, ASTRA_THEME_VERSION, 'all' );
+ wp_enqueue_style( 'astra-menu-animation' );
+ }
+ }
+
+ if ( ! class_exists( 'Astra_Cache' ) ) {
+ $theme_css_data = apply_filters( 'astra_dynamic_theme_css', '' );
+ wp_add_inline_style( 'astra-theme-css', $theme_css_data );
+ }
+
+ if ( astra_is_amp_endpoint() ) {
+ return;
+ }
+
+ // Comment assets.
+ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
+ wp_enqueue_script( 'comment-reply' );
+ }
+
+ if ( is_array( $scripts ) && ! empty( $scripts ) ) {
+
+ // Register & Enqueue Scripts.
+ foreach ( $scripts as $key => $script ) {
+
+ // Register.
+ wp_register_script( $key, $js_uri . $script . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, true );
+
+ // Enqueue.
+ wp_enqueue_script( $key );
+ }
+ }
+
+ $astra_localize = array(
+ 'break_point' => astra_header_break_point(), // Header Break Point.
+ 'isRtl' => is_rtl(),
+ );
+
+ wp_localize_script( 'astra-theme-js', 'astra', apply_filters( 'astra_theme_js_localize', $astra_localize ) );
+ }
+
+ /**
+ * Trim CSS
+ *
+ * @since 1.0.0
+ * @param string $css CSS content to trim.
+ * @return string
+ */
+ public static function trim_css( $css = '' ) {
+
+ // Trim white space for faster page loading.
+ if ( ! empty( $css ) ) {
+ $css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css );
+ $css = str_replace( array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), '', $css );
+ $css = str_replace( ', ', ',', $css );
+ }
+
+ return $css;
+ }
+
+ /**
+ * Enqueue Gutenberg assets.
+ *
+ * @since 1.5.2
+ *
+ * @return void
+ */
+ public function gutenberg_assets() {
+ /* Directory and Extension */
+ $rtl = '';
+ if ( is_rtl() ) {
+ $rtl = '-rtl';
+ }
+
+ $css_uri = ASTRA_THEME_URI . 'inc/assets/css/block-editor-styles' . $rtl . '.css';
+ $js_uri = ASTRA_THEME_URI . 'inc/assets/js/block-editor-script.js';
+
+ wp_enqueue_style( 'astra-block-editor-styles', $css_uri, false, ASTRA_THEME_VERSION, 'all' );
+ wp_enqueue_script( 'astra-block-editor-script', $js_uri, false, ASTRA_THEME_VERSION, 'all' );
+
+ // Render fonts in Gutenberg layout.
+ Astra_Fonts::render_fonts();
+
+ wp_add_inline_style( 'astra-block-editor-styles', apply_filters( 'astra_block_editor_dynamic_css', Gutenberg_Editor_CSS::get_css() ) );
+ }
+
+ /**
+ * Function to check if enqueuing of Astra assets are disabled.
+ *
+ * @since 2.1.0
+ * @return boolean
+ */
+ public static function enqueue_theme_assets() {
+ return apply_filters( 'astra_enqueue_theme_assets', true );
+ }
+
+ /**
+ * Enqueue galleries relates CSS on gallery_style filter.
+ *
+ * @param string $gallery_style gallery style and div.
+ * @since 3.5.0
+ * @return string
+ */
+ public function enqueue_galleries_style( $gallery_style ) {
+ wp_enqueue_style( 'astra-galleries-css' );
+ return $gallery_style;
+ }
+
+ }
+
+ new Astra_Enqueue_Scripts();
+}
diff --git a/inc/core/class-astra-icons.php b/inc/core/class-astra-icons.php
new file mode 100644
index 0000000..3dca6ad
--- /dev/null
+++ b/inc/core/class-astra-icons.php
@@ -0,0 +1,139 @@
+<?php
+/**
+ * Icons for Astra theme.
+ *
+ * @package Astra
+ * @author Brainstorm Force
+ * @copyright Copyright (c) 2020, Brainstorm Force
+ * @link https://www.brainstormforce.com
+ * @since Astra 3.3.0
+ */
+
+/**
+ * Icons Initial Setup
+ *
+ * @since 3.3.0
+ */
+class Astra_Icons {
+ /**
+ * Constructor function that initializes required actions and hooks
+ */
+ public function __construct() {
+ // Remove astra.woff and other format of Astra font files when SVG is enabled.
+ if ( self::is_svg_icons() ) {
+ add_filter( 'astra_enable_default_fonts', '__return_false' );
+ }
+ }
+
+ /**
+ * Check if we need to load icons as SVG or fonts.
+ * Returns true if SVG false if font.
+ *
+ * @since 3.3.0
+ *
+ * @return boolean should be svg or font.
+ */
+ public static function is_svg_icons() {
+ $astra_settings = get_option( ASTRA_THEME_SETTINGS );
+ $astra_settings['can-update-astra-icons-svg'] = ( isset( $astra_settings['can-update-astra-icons-svg'] ) && false === $astra_settings['can-update-astra-icons-svg'] ) ? false : true;
+ return apply_filters( 'astra_is_svg_icons', $astra_settings['can-update-astra-icons-svg'] );
+ }
+
+ /**
+ * Get SVG icons.
+ * Returns the SVG icon you want to display.
+ *
+ * @since 3.3.0
+ *
+ * @param string $icon Key for the SVG you want to load.
+ * @param boolean $is_echo whether to echo the output or return.
+ * @param boolean $replace load close markup for SVG.
+ * @param string $menu_location Creates dynamic filter for passed parameter.
+ *
+ * @return string SVG for passed key.
+ */
+ public static function get_icons( $icon, $is_echo = false, $replace = false, $menu_location = 'main' ) {
+ $output = '';
+ if ( true === self::is_svg_icons() ) {
+ switch ( $icon ) {
+ case 'menu-bars':
+ $output = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="20px" height="20px" viewBox="57 41.229 26 18.806" enable-background="new 57 41.229 26 18.806" xml:space="preserve">
+ <path d="M82.5,41.724h-25v3.448h25V41.724z M57.5,48.907h25v3.448h-25V48.907z M82.5,56.092h-25v3.448h25V56.092z"/>
+ </svg>';
+ break;
+
+ case 'close':
+ $output = '<svg viewBox="0 0 512 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18px" height="18px">
+ <path d="M71.029 71.029c9.373-9.372 24.569-9.372 33.942 0L256 222.059l151.029-151.03c9.373-9.372 24.569-9.372 33.942 0 9.372 9.373 9.372 24.569 0 33.942L289.941 256l151.03 151.029c9.372 9.373 9.372 24.569 0 33.942-9.373 9.372-24.569 9.372-33.942 0L256 289.941l-151.029 151.03c-9.373 9.372-24.569 9.372-33.942 0-9.372-9.373-9.372-24.569 0-33.942L222.059 256 71.029 104.971c-9.372-9.373-9.372-24.569 0-33.942z" />
+ </svg>';
+ break;
+
+ case 'search':
+ $output = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="-888 480 142 142" enable-background="new -888 480 142 142" xml:space="preserve">
+ <title/>
+ <desc/>
+ <path id="Shape" d="M-787.4,568.7h-6.3l-2.4-2.4c7.9-8.7,12.6-20.5,12.6-33.1c0-28.4-22.9-51.3-51.3-51.3 c-28.4,0-51.3,22.9-51.3,51.3c0,28.4,22.9,51.3,51.3,51.3c12.6,0,24.4-4.7,33.1-12.6l2.4,2.4v6.3l39.4,39.4l11.8-11.8L-787.4,568.7 L-787.4,568.7z M-834.7,568.7c-19.7,0-35.5-15.8-35.5-35.5c0-19.7,15.8-35.5,35.5-35.5c19.7,0,35.5,15.8,35.5,35.5 C-799.3,553-815,568.7-834.7,568.7L-834.7,568.7z"/>
+ </svg>';
+ break;
+
+ case 'arrow':
+ $output = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="26px" height="16.043px" viewBox="57 35.171 26 16.043" enable-background="new 57 35.171 26 16.043" xml:space="preserve">
+ <path d="M57.5,38.193l12.5,12.5l12.5-12.5l-2.5-2.5l-10,10l-10-10L57.5,38.193z"/>
+ </svg>';
+ break;
+
+ case 'cart':
+ $output = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="20px" height="20px" viewBox="826 837.5 140 121" enable-background="new 826 837.5 140 121" xml:space="preserve">
+ <path d="M878.77,943.611c0,2.75-1.005,5.131-3.015,7.141c-2.009,2.01-4.389,3.014-7.139,3.014c-2.75,0-5.13-1.004-7.139-3.014 c-2.01-2.01-3.015-4.391-3.015-7.141c0-2.749,1.005-5.129,3.015-7.138c2.009-2.011,4.389-3.016,7.139-3.016 c2.75,0,5.13,1.005,7.139,3.016C877.765,938.482,878.77,940.862,878.77,943.611z M949.846,943.611c0,2.75-1.005,5.131-3.015,7.141 s-4.39,3.014-7.141,3.014c-2.748,0-5.129-1.004-7.138-3.014c-2.01-2.01-3.015-4.391-3.015-7.141c0-2.749,1.005-5.129,3.015-7.138 c2.009-2.011,4.39-3.016,7.138-3.016c2.751,0,5.131,1.005,7.141,3.016C948.841,938.482,949.846,940.862,949.846,943.611z M960,857.306v40.615c0,1.27-0.438,2.393-1.311,3.371s-1.943,1.548-3.212,1.705l-82.815,9.678c0.687,3.174,1.031,5.024,1.031,5.554 c0,0.846-0.635,2.539-1.904,5.076h72.979c1.375,0,2.564,0.503,3.569,1.508c1.006,1.005,1.508,2.194,1.508,3.569 c0,1.376-0.502,2.564-1.508,3.569c-1.005,1.005-2.194,1.507-3.569,1.507H863.54c-1.375,0-2.565-0.502-3.57-1.507 s-1.507-2.193-1.507-3.569c0-0.581,0.212-1.415,0.634-2.498c0.424-1.085,0.847-2.036,1.27-2.855c0.423-0.82,0.992-1.878,1.706-3.174 s1.124-2.076,1.23-2.34l-14.041-65.285h-16.183c-1.375,0-2.564-0.502-3.569-1.507c-1.005-1.005-1.508-2.195-1.508-3.57 c0-1.375,0.502-2.565,1.508-3.57c1.004-1.004,2.194-1.507,3.569-1.507h20.308c0.846,0,1.6,0.172,2.261,0.516 s1.177,0.754,1.547,1.229c0.37,0.476,0.714,1.124,1.032,1.944c0.316,0.819,0.528,1.507,0.634,2.062 c0.106,0.556,0.252,1.336,0.437,2.34c0.185,1.005,0.304,1.692,0.357,2.063h95.271c1.375,0,2.563,0.502,3.57,1.507 C959.497,854.741,960,855.931,960,857.306z"/>
+ </svg>';
+ break;
+
+ case 'bag':
+ $output = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="100" height="100" viewBox="826 826 140 140" enable-background="new 826 826 140 140" xml:space="preserve">
+ <path d="M960.758,934.509l2.632,23.541c0.15,1.403-0.25,2.657-1.203,3.761c-0.953,1.053-2.156,1.579-3.61,1.579H833.424 c-1.454,0-2.657-0.526-3.61-1.579c-0.952-1.104-1.354-2.357-1.203-3.761l2.632-23.541H960.758z M953.763,871.405l6.468,58.29H831.77 l6.468-58.29c0.15-1.203,0.677-2.218,1.58-3.045c0.903-0.827,1.981-1.241,3.234-1.241h19.254v9.627c0,2.658,0.94,4.927,2.82,6.807 s4.149,2.82,6.807,2.82c2.658,0,4.926-0.94,6.807-2.82s2.821-4.149,2.821-6.807v-9.627h28.882v9.627 c0,2.658,0.939,4.927,2.819,6.807c1.881,1.88,4.149,2.82,6.807,2.82s4.927-0.94,6.808-2.82c1.879-1.88,2.82-4.149,2.82-6.807v-9.627 h19.253c1.255,0,2.332,0.414,3.235,1.241C953.086,869.187,953.612,870.202,953.763,871.405z M924.881,857.492v19.254 c0,1.304-0.476,2.432-1.429,3.385s-2.08,1.429-3.385,1.429c-1.303,0-2.432-0.477-3.384-1.429c-0.953-0.953-1.43-2.081-1.43-3.385 v-19.254c0-5.315-1.881-9.853-5.641-13.613c-3.76-3.761-8.298-5.641-13.613-5.641s-9.853,1.88-13.613,5.641 c-3.761,3.76-5.641,8.298-5.641,13.613v19.254c0,1.304-0.476,2.432-1.429,3.385c-0.953,0.953-2.081,1.429-3.385,1.429 c-1.303,0-2.432-0.477-3.384-1.429c-0.953-0.953-1.429-2.081-1.429-3.385v-19.254c0-7.973,2.821-14.779,8.461-20.42 c5.641-5.641,12.448-8.461,20.42-8.461c7.973,0,14.779,2.82,20.42,8.461C922.062,842.712,924.881,849.519,924.881,857.492z"/>
+ </svg>';
+ break;
+
+ case 'basket':
+ $output = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="100" height="100" viewBox="826 826 140 140" enable-background="new 826 826 140 140" xml:space="preserve">
+ <path d="M955.418,887.512c2.344,0,4.343,0.829,6.002,2.486c1.657,1.659,2.486,3.659,2.486,6.002c0,2.343-0.829,4.344-2.486,6.001 c-1.659,1.658-3.658,2.487-6.002,2.487h-0.994l-7.627,43.9c-0.354,2.033-1.326,3.713-2.917,5.04 c-1.593,1.326-3.405,1.989-5.438,1.989h-84.883c-2.033,0-3.846-0.663-5.438-1.989c-1.591-1.327-2.564-3.007-2.918-5.04l-7.626-43.9 h-0.995c-2.343,0-4.344-0.829-6.001-2.487c-1.658-1.657-2.487-3.658-2.487-6.001c0-2.343,0.829-4.343,2.487-6.002 c1.658-1.658,3.659-2.486,6.001-2.486H955.418z M860.256,940.563c1.149-0.089,2.111-0.585,2.885-1.491 c0.773-0.907,1.116-1.936,1.028-3.085l-2.122-27.586c-0.088-1.15-0.585-2.111-1.492-2.885c-0.906-0.774-1.934-1.117-3.083-1.028 c-1.149,0.088-2.111,0.586-2.885,1.492s-1.116,1.934-1.028,3.083l2.122,27.587c0.088,1.105,0.542,2.034,1.359,2.785 c0.818,0.752,1.78,1.128,2.885,1.128H860.256z M887.512,936.319v-27.587c0-1.149-0.42-2.144-1.26-2.984 c-0.84-0.84-1.834-1.26-2.984-1.26s-2.144,0.42-2.984,1.26c-0.84,0.841-1.26,1.835-1.26,2.984v27.587c0,1.149,0.42,2.145,1.26,2.984 c0.84,0.84,1.835,1.26,2.984,1.26s2.144-0.42,2.984-1.26C887.092,938.464,887.512,937.469,887.512,936.319z M912.977,936.319 v-27.587c0-1.149-0.42-2.144-1.26-2.984c-0.841-0.84-1.835-1.26-2.984-1.26s-2.145,0.42-2.984,1.26 c-0.84,0.841-1.26,1.835-1.26,2.984v27.587c0,1.149,0.42,2.145,1.26,2.984s1.835,1.26,2.984,1.26s2.144-0.42,2.984-1.26 C912.557,938.464,912.977,937.469,912.977,936.319z M936.319,936.65l2.122-27.587c0.088-1.149-0.254-2.177-1.027-3.083 s-1.735-1.404-2.885-1.492c-1.15-0.089-2.178,0.254-3.084,1.028c-0.906,0.773-1.404,1.734-1.492,2.885l-2.122,27.586 c-0.088,1.149,0.254,2.178,1.027,3.085c0.774,0.906,1.736,1.402,2.885,1.491h0.332c1.105,0,2.066-0.376,2.885-1.128 C935.777,938.685,936.23,937.756,936.319,936.65z M859.66,855.946l-6.167,27.322h-8.753l6.698-29.245 c0.84-3.89,2.807-7.062,5.902-9.516c3.095-2.453,6.632-3.68,10.611-3.68h11.074c0-1.149,0.42-2.144,1.26-2.984 c0.84-0.84,1.835-1.26,2.984-1.26h25.465c1.149,0,2.144,0.42,2.984,1.26c0.84,0.84,1.26,1.834,1.26,2.984h11.074 c3.979,0,7.516,1.227,10.611,3.68c3.094,2.454,5.062,5.626,5.901,9.516l6.697,29.245h-8.753l-6.168-27.322 c-0.486-1.945-1.491-3.537-3.017-4.774c-1.525-1.238-3.282-1.857-5.272-1.857h-11.074c0,1.15-0.42,2.144-1.26,2.984 c-0.841,0.84-1.835,1.26-2.984,1.26h-25.465c-1.149,0-2.144-0.42-2.984-1.26c-0.84-0.84-1.26-1.834-1.26-2.984h-11.074 c-1.99,0-3.747,0.619-5.272,1.857C861.152,852.409,860.146,854,859.66,855.946z"/>
+ </svg>';
+ break;
+
+ default:
+ $output = '';
+ break;
+ }
+
+ if ( $replace ) {
+ $output .= '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="18px" height="18px" viewBox="-63 -63 140 140" enable-background="new -63 -63 140 140" xml:space="preserve">
+ <path id="Shape" d="M75.133-47.507L61.502-61.133L7-6.625l-54.507-54.507l-13.625,13.625L-6.625,7l-54.507,54.503l13.625,13.63 L7,20.631l54.502,54.502l13.631-13.63L20.63,7L75.133-47.507z"/></svg>';
+ }
+ } else {
+ if ( 'menu-bars' === $icon ) {
+ $menu_icon = apply_filters( 'astra_' . $menu_location . '_menu_toggle_icon', 'menu-toggle-icon' );
+ $output = '<span class="' . esc_attr( $menu_icon ) . '"></span>';
+ }
+ }
+
+ $output = apply_filters( 'astra_svg_icon_element', $output, $icon );
+
+ $classes = array(
+ 'ast-icon',
+ 'icon-' . $icon,
+ );
+
+ $output = sprintf(
+ '<span class="%1$s">%2$s</span>',
+ implode( ' ', $classes ),
+ $output
+ );
+
+ if ( ! $is_echo ) {
+ return apply_filters( 'astra_svg_icon', $output, $icon );
+ }
+
+ echo apply_filters( 'astra_svg_icon', $output, $icon ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ }
+}
+new Astra_Icons();
diff --git a/inc/core/class-astra-theme-options.php b/inc/core/class-astra-theme-options.php
new file mode 100644
index 0000000..3521399
--- /dev/null
+++ b/inc/core/class-astra-theme-options.php
@@ -0,0 +1,530 @@
+<?php
+/**
+ * Astra Theme Options
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Theme Options
+ */
+if ( ! class_exists( 'Astra_Theme_Options' ) ) {
+ /**
+ * Theme Options
+ */
+ class Astra_Theme_Options {
+
+ /**
+ * Class instance.
+ *
+ * @access private
+ * @var $instance Class instance.
+ */
+ private static $instance;
+
+ /**
+ * Customizer defaults.
+ *
+ * @access Private
+ * @since 1.4.3
+ * @var Array
+ */
+ private static $defaults;
+
+ /**
+ * Post id.
+ *
+ * @var $instance Post id.
+ */
+ public static $post_id = null;
+
+ /**
+ * A static option variable.
+ *
+ * @since 1.0.0
+ * @access private
+ * @var mixed $db_options
+ */
+ private static $db_options;
+
+ /**
+ * A static option variable.
+ *
+ * @since 1.0.0
+ * @access private
+ * @var mixed $db_options
+ */
+ private static $db_options_no_defaults;
+
+ /**
+ * Initiator
+ */
+ public static function get_instance() {
+ if ( ! isset( self::$instance ) ) {
+ self::$instance = new self();
+ }
+ return self::$instance;
+ }
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+
+ // Refresh options variables after customizer save.
+ add_action( 'after_setup_theme', array( $this, 'refresh' ) );
+
+ }
+
+ /**
+ * Set default theme option values
+ *
+ * @since 1.0.0
+ * @return default values of the theme.
+ */
+ public static function defaults() {
+
+ if ( ! is_null( self::$defaults ) ) {
+ return self::$defaults;
+ }
+
+ /**
+ * Update Astra customizer default values. To not update directly on existing users site, added backwards.
+ *
+ * @since 3.6.3
+ */
+ $apply_new_default_values = astra_button_default_padding_updated();
+
+ // Defaults list of options.
+ self::$defaults = apply_filters(
+ 'astra_theme_defaults',
+ array(
+ // Blog Single.
+ 'blog-single-post-structure' => array(
+ 'single-image',
+ 'single-title-meta',
+ ),
+
+ 'blog-single-width' => 'default',
+ 'blog-single-max-width' => 1200,
+ 'blog-single-meta' => array(
+ 'comments',
+ 'category',
+ 'author',
+ ),
+ // Blog.
+ 'blog-post-structure' => array(
+ 'image',
+ 'title-meta',
+ ),
+ 'blog-width' => 'default',
+ 'blog-max-width' => 1200,
+ 'blog-post-content' => 'excerpt',
+ 'blog-meta' => array(
+ 'comments',
+ 'category',
+ 'author',
+ ),
+ // Colors.
+ 'text-color' => '#3a3a3a',
+ 'link-color' => '#0170B9',
+ 'theme-color' => '#0170B9',
+ 'link-h-color' => '#3a3a3a',
+
+ // Footer Bar Background.
+ 'footer-bg-obj' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ 'background-type' => '',
+ 'background-media' => '',
+ ),
+ 'footer-color' => '',
+ 'footer-link-color' => '',
+ 'footer-link-h-color' => '',
+
+ // Footer Widgets Background.
+ 'footer-adv-bg-obj' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ 'background-type' => '',
+ 'background-media' => '',
+ ),
+ 'footer-adv-text-color' => '',
+ 'footer-adv-link-color' => '',
+ 'footer-adv-link-h-color' => '',
+ 'footer-adv-wgt-title-color' => '',
+
+ // Buttons.
+ 'button-color' => '',
+ 'button-h-color' => '',
+ 'button-bg-color' => '',
+ 'button-bg-h-color' => '',
+ 'theme-button-padding' => array(
+ 'desktop' => array(
+ 'top' => $apply_new_default_values ? 15 : 10,
+ 'right' => $apply_new_default_values ? 30 : 40,
+ 'bottom' => $apply_new_default_values ? 15 : 10,
+ 'left' => $apply_new_default_values ? 30 : 40,
+ ),
+ 'tablet' => array(
+ 'top' => $apply_new_default_values ? 14 : '',
+ 'right' => $apply_new_default_values ? 28 : '',
+ 'bottom' => $apply_new_default_values ? 14 : '',
+ 'left' => $apply_new_default_values ? 28 : '',
+ ),
+ 'mobile' => array(
+ 'top' => $apply_new_default_values ? 12 : '',
+ 'right' => $apply_new_default_values ? 24 : '',
+ 'bottom' => $apply_new_default_values ? 12 : '',
+ 'left' => $apply_new_default_values ? 24 : '',
+ ),
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'button-radius' => 2,
+ 'theme-button-border-group-border-size' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ // Footer - Small.
+ 'footer-sml-layout' => 'footer-sml-layout-1',
+ 'footer-sml-section-1' => 'custom',
+ 'footer-sml-section-1-credit' => __( 'Copyright &copy; [current_year] [site_title] | Powered by [theme_author]', 'astra' ),
+ 'footer-sml-section-2' => '',
+ 'footer-sml-section-2-credit' => __( 'Copyright &copy; [current_year] [site_title] | Powered by [theme_author]', 'astra' ),
+ 'footer-sml-dist-equal-align' => true,
+ 'footer-sml-divider' => 1,
+ 'footer-sml-divider-color' => '#7a7a7a',
+ 'footer-layout-width' => 'content',
+ // General.
+ 'ast-header-retina-logo' => '',
+ 'ast-header-logo-width' => '',
+ 'ast-header-responsive-logo-width' => array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ ),
+ 'header-color-site-title' => '',
+ 'header-color-h-site-title' => '',
+ 'header-color-site-tagline' => '',
+ 'display-site-title-responsive' => array(
+ 'desktop' => 1,
+ 'tablet' => 1,
+ 'mobile' => 1,
+ ),
+ 'display-site-tagline-responsive' => array(
+ 'desktop' => 0,
+ 'tablet' => 0,
+ 'mobile' => 0,
+ ),
+ 'logo-title-inline' => 1,
+ // Header - Primary.
+ 'disable-primary-nav' => false,
+ 'header-layouts' => 'header-main-layout-1',
+ 'header-main-rt-section' => 'none',
+ 'header-display-outside-menu' => false,
+ 'header-main-rt-section-html' => '<button>' . __( 'Contact Us', 'astra' ) . '</button>',
+ 'header-main-rt-section-button-text' => __( 'Button', 'astra' ),
+ 'header-main-rt-section-button-link' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ),
+ 'header-main-rt-section-button-link-option' => array(
+ 'url' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ),
+ 'new_tab' => false,
+ 'link_rel' => '',
+ ),
+ 'header-main-rt-section-button-style' => 'theme-button',
+ 'header-main-rt-section-button-text-color' => '',
+ 'header-main-rt-section-button-back-color' => '',
+ 'header-main-rt-section-button-text-h-color' => '',
+ 'header-main-rt-section-button-back-h-color' => '',
+ 'header-main-rt-section-button-padding' => array(
+ 'desktop' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'tablet' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'mobile' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ ),
+ 'header-main-rt-section-button-border-size' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'header-main-sep' => 1,
+ 'header-main-sep-color' => '',
+ 'header-main-layout-width' => 'content',
+ // Header - Sub menu Border.
+ 'primary-submenu-border' => array(
+ 'top' => '2',
+ 'right' => '0',
+ 'bottom' => '0',
+ 'left' => '0',
+ ),
+ 'primary-submenu-item-border' => false,
+ 'primary-submenu-b-color' => '',
+ 'primary-submenu-item-b-color' => '',
+
+ // Primary header button typo options.
+ 'primary-header-button-font-family' => 'inherit',
+ 'primary-header-button-font-weight' => 'inherit',
+ 'primary-header-button-font-size' => array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'primary-header-button-text-transform' => '',
+ 'primary-header-button-line-height' => 1,
+ 'primary-header-button-letter-spacing' => '',
+
+ 'header-main-menu-label' => '',
+ 'header-main-menu-align' => 'inline',
+ 'header-main-submenu-container-animation' => '',
+ 'mobile-header-breakpoint' => '',
+ 'mobile-header-logo' => '',
+ 'mobile-header-logo-width' => '',
+ // Site Layout.
+ 'site-layout' => 'ast-full-width-layout',
+ 'site-content-width' => 1200,
+ 'site-layout-outside-bg-obj-responsive' => array(
+ 'desktop' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ 'background-type' => '',
+ 'background-media' => '',
+ ),
+ 'tablet' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ 'background-type' => '',
+ 'background-media' => '',
+ ),
+ 'mobile' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ 'background-type' => '',
+ 'background-media' => '',
+ ),
+ ),
+ // Container.
+ 'site-content-layout' => 'content-boxed-container',
+ 'single-page-content-layout' => 'default',
+ 'single-post-content-layout' => 'default',
+ 'archive-post-content-layout' => 'default',
+ // Typography.
+ 'body-font-family' => 'inherit',
+ 'body-font-variant' => '',
+ 'body-font-weight' => 'inherit',
+ 'font-size-body' => array(
+ 'desktop' => 15,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+
+ 'body-line-height' => '',
+ 'para-margin-bottom' => '',
+ 'underline-content-links' => true,
+ 'body-text-transform' => '',
+ 'headings-font-family' => 'inherit',
+ 'headings-font-weight' => 'inherit',
+ 'headings-text-transform' => '',
+ 'headings-line-height' => '',
+ 'font-size-site-title' => array(
+ 'desktop' => 35,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-site-tagline' => array(
+ 'desktop' => 15,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-entry-title' => array(
+ 'desktop' => 30,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-archive-summary-title' => array(
+ 'desktop' => 40,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-page-title' => array(
+ 'desktop' => 30,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-h1' => array(
+ 'desktop' => 40,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-h2' => array(
+ 'desktop' => 30,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-h3' => array(
+ 'desktop' => 25,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-h4' => array(
+ 'desktop' => 20,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-h5' => array(
+ 'desktop' => 18,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-h6' => array(
+ 'desktop' => 15,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+
+ // Sidebar.
+ 'site-sidebar-layout' => 'right-sidebar',
+ 'site-sidebar-width' => 30,
+ 'single-page-sidebar-layout' => 'default',
+ 'single-post-sidebar-layout' => 'default',
+ 'archive-post-sidebar-layout' => 'default',
+
+ // Sidebar.
+ 'footer-adv' => 'disabled',
+ 'footer-adv-border-width' => '',
+ 'footer-adv-border-color' => '#7a7a7a',
+
+ // toogle menu style.
+ 'mobile-header-toggle-btn-style' => 'minimal',
+ 'hide-custom-menu-mobile' => 1,
+
+ // toogle menu target.
+ 'mobile-header-toggle-target' => 'icon',
+
+ // Performance.
+ 'load-google-fonts-locally' => false,
+ 'preload-local-fonts' => false,
+ )
+ );
+
+ return self::$defaults;
+ }
+
+ /**
+ * Get theme options from static array()
+ *
+ * @return array Return array of theme options.
+ */
+ public static function get_options() {
+ return self::$db_options;
+ }
+
+ /**
+ * Update theme static option array.
+ */
+ public static function refresh() {
+ self::$db_options = wp_parse_args(
+ self::get_db_options(),
+ self::defaults()
+ );
+ }
+
+ /**
+ * Get theme options from static array() from database
+ *
+ * @return array Return array of theme options from database.
+ */
+ public static function get_db_options() {
+ self::$db_options_no_defaults = get_option( ASTRA_THEME_SETTINGS );
+ return self::$db_options_no_defaults;
+ }
+ }
+}
+/**
+ * Kicking this off by calling 'get_instance()' method
+ */
+Astra_Theme_Options::get_instance();
diff --git a/inc/core/class-astra-walker-page.php b/inc/core/class-astra-walker-page.php
new file mode 100644
index 0000000..b4d0082
--- /dev/null
+++ b/inc/core/class-astra-walker-page.php
@@ -0,0 +1,137 @@
+<?php
+/**
+ * Navigation Menu customizations.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.5.4
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Custom wp_nav_menu walker.
+ *
+ * @package Astra WordPress theme
+ */
+if ( ! class_exists( 'Astra_Walker_Page' ) ) {
+
+ /**
+ * Astra custom navigation walker.
+ *
+ * @since 1.5.4
+ */
+ class Astra_Walker_Page extends Walker_Page {
+
+ /**
+ * Outputs the beginning of the current level in the tree before elements are output.
+ *
+ * @since 1.5.4
+ *
+ * @see Walker::start_lvl()
+ *
+ * @param string $output Used to append additional content (passed by reference).
+ * @param int $depth Optional. Depth of page. Used for padding. Default 0.
+ * @param array $args Optional. Arguments for outputting the next level.
+ * Default empty array.
+ */
+ public function start_lvl( &$output, $depth = 0, $args = array() ) {
+ if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
+ $t = "\t";
+ $n = "\n";
+ } else {
+ $t = '';
+ $n = '';
+ }
+ $indent = str_repeat( $t, $depth );
+ $output .= "{$n}{$indent}<ul class='children sub-menu'>{$n}";
+ $output = apply_filters( 'astra_caret_wrap_filter', $output, $args['sort_column'] );
+
+ }
+
+ /**
+ * Outputs the beginning of the current element in the tree.
+ *
+ * @see Walker::start_el()
+ * @since 1.7.2
+ *
+ * @param string $output Used to append additional content. Passed by reference.
+ * @param WP_Post $page Page data object.
+ * @param int $depth Optional. Depth of page. Used for padding. Default 0.
+ * @param array $args Optional. Array of arguments. Default empty array.
+ * @param int $current_page Optional. Page ID. Default 0.
+ */
+ public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
+ $css_class = array( 'page_item', 'page-item-' . $page->ID );
+ $icon = '';
+ $mobile_icon = '';
+
+ if ( isset( $args['pages_with_children'][ $page->ID ] ) ) {
+ $css_class[] = 'menu-item-has-children';
+ $icon = Astra_Icons::get_icons( 'arrow' );
+ $icon = '<span role="presentation" class="dropdown-menu-toggle">' . $icon . '</span>';
+ // Add toggle button if menu is from Astra.
+ if ( true === is_object( $args ) ) {
+ if ( isset( $args->theme_location ) &&
+ ( 'primary' === $args->theme_location ||
+ 'above_header_menu' === $args->theme_location ||
+ 'below_header_menu' === $args->theme_location )
+ ) {
+ $mobile_icon = '<button ' . astra_attr(
+ 'ast-menu-toggle',
+ array(
+ 'aria-expanded' => 'false',
+ ),
+ $page
+ ) . '><span class="screen-reader-text">' . __( 'Menu Toggle', 'astra' ) . '</span>' . Astra_Icons::get_icons( 'arrow' ) . '</button>';
+ }
+ } else {
+ if ( isset( $page->post_parent ) && 0 === $page->post_parent ) {
+ $mobile_icon = '<button ' . astra_attr(
+ 'ast-menu-toggle',
+ array(
+ 'aria-expanded' => 'false',
+ ),
+ $page
+ ) . '><span class="screen-reader-text">' . __( 'Menu Toggle', 'astra' ) . '</span>' . Astra_Icons::get_icons( 'arrow' ) . '</button>';
+ }
+ }
+ }
+
+ if ( ! empty( $current_page ) ) {
+ $_current_page = get_post( $current_page );
+ if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) {
+ $css_class[] = 'current-menu-ancestor';
+ }
+ if ( $page->ID == $current_page ) {
+ $css_class[] = 'current-menu-item';
+ } elseif ( $_current_page && $page->ID == $_current_page->post_parent ) {
+ $css_class[] = 'current-menu-parent';
+ }
+ } elseif ( get_option( 'page_for_posts' ) == $page->ID ) {
+ $css_class[] = 'current-menu-parent';
+ }
+
+ $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
+
+ $args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before'];
+ $args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after'];
+
+ $output .= sprintf(
+ '<li class="%s"><a href="%s" class="menu-link">%s%s%s%s</a>%s',
+ $css_classes,
+ get_permalink( $page->ID ),
+ $args['link_before'],
+ apply_filters( 'the_title', $page->post_title, $page->ID ),
+ $args['link_after'],
+ $icon,
+ $mobile_icon
+ );
+ }
+ }
+
+}
diff --git a/inc/core/class-gutenberg-editor-css.php b/inc/core/class-gutenberg-editor-css.php
new file mode 100644
index 0000000..c77182b
--- /dev/null
+++ b/inc/core/class-gutenberg-editor-css.php
@@ -0,0 +1,1116 @@
+<?php
+/**
+ * Gutenberg Editor CSS
+ *
+ * @link https://developer.wordpress.org/themes/basics/theme-functions/
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link http://wpastra.com/
+ * @since Astra 1.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+if ( ! class_exists( 'Gutenberg_Editor_CSS' ) ) :
+
+ /**
+ * Admin Helper
+ */
+ class Gutenberg_Editor_CSS {
+
+ /**
+ * Get dynamic CSS required for the block editor to make editing experience similar to how it looks on frontend.
+ *
+ * @return String CSS to be loaded in the editor interface.
+ */
+ public static function get_css() {
+ global $pagenow;
+ global $post;
+ $post_id = astra_get_post_id();
+ $is_site_rtl = is_rtl();
+
+ $site_content_width = astra_get_option( 'site-content-width', 1200 ) + 56;
+ $headings_font_family = astra_get_option( 'headings-font-family' );
+ $headings_font_weight = astra_get_option( 'headings-font-weight' );
+ $headings_text_transform = astra_get_option( 'headings-text-transform' );
+ $headings_line_height = astra_get_option( 'headings-line-height' );
+ $single_post_title_font_size = astra_get_option( 'font-size-entry-title' );
+ $body_font_family = astra_body_font_family();
+ $para_margin_bottom = astra_get_option( 'para-margin-bottom' );
+ $theme_color = astra_get_option( 'theme-color' );
+ $link_color = astra_get_option( 'link-color', $theme_color );
+ $heading_base_color = astra_get_option( 'heading-base-color' );
+
+ $highlight_theme_color = astra_get_foreground_color( $theme_color );
+
+ $body_font_weight = astra_get_option( 'body-font-weight' );
+ $body_font_size = astra_get_option( 'font-size-body' );
+ $body_line_height = astra_get_option( 'body-line-height' );
+ $body_text_transform = astra_get_option( 'body-text-transform' );
+ $box_bg_obj = astra_get_option( 'site-layout-outside-bg-obj-responsive' );
+ $text_color = astra_get_option( 'text-color' );
+
+ $heading_h1_font_size = astra_get_option( 'font-size-h1' );
+ $heading_h2_font_size = astra_get_option( 'font-size-h2' );
+ $heading_h3_font_size = astra_get_option( 'font-size-h3' );
+ $heading_h4_font_size = astra_get_option( 'font-size-h4' );
+ $heading_h5_font_size = astra_get_option( 'font-size-h5' );
+ $heading_h6_font_size = astra_get_option( 'font-size-h6' );
+
+ /**
+ * WooCommerce Grid Products compatibility.
+ */
+ $link_h_color = astra_get_option( 'link-h-color' );
+ $btn_color = astra_get_option( 'button-color' );
+ $btn_bg_color = astra_get_option( 'button-bg-color', '', $theme_color );
+ $btn_h_color = astra_get_option( 'button-h-color' );
+ $btn_bg_h_color = astra_get_option( 'button-bg-h-color', '', $link_h_color );
+ $btn_border_radius = astra_get_option( 'button-radius' );
+ $theme_btn_padding = astra_get_option( 'theme-button-padding' );
+
+ /**
+ * Button theme compatibility.
+ */
+ $global_custom_button_border_size = astra_get_option( 'theme-button-border-group-border-size' );
+ $btn_border_color = astra_get_option( 'theme-button-border-group-border-color' );
+ $btn_border_h_color = astra_get_option( 'theme-button-border-group-border-h-color' );
+
+ /**
+ * Theme Button Typography
+ */
+ $theme_btn_font_family = astra_get_option( 'font-family-button' );
+ $theme_btn_font_size = astra_get_option( 'font-size-button' );
+ $theme_btn_font_weight = astra_get_option( 'font-weight-button' );
+ $theme_btn_text_transform = astra_get_option( 'text-transform-button' );
+ $theme_btn_line_height = astra_get_option( 'theme-btn-line-height' );
+ $theme_btn_letter_spacing = astra_get_option( 'theme-btn-letter-spacing' );
+
+ $h1_font_family = astra_get_option( 'font-family-h1' );
+ $h1_font_weight = astra_get_option( 'font-weight-h1' );
+ $h1_line_height = astra_get_option( 'line-height-h1' );
+ $h1_text_transform = astra_get_option( 'text-transform-h1' );
+
+ $h2_font_family = astra_get_option( 'font-family-h2' );
+ $h2_font_weight = astra_get_option( 'font-weight-h2' );
+ $h2_line_height = astra_get_option( 'line-height-h2' );
+ $h2_text_transform = astra_get_option( 'text-transform-h2' );
+
+ $h3_font_family = astra_get_option( 'font-family-h3' );
+ $h3_font_weight = astra_get_option( 'font-weight-h3' );
+ $h3_line_height = astra_get_option( 'line-height-h3' );
+ $h3_text_transform = astra_get_option( 'text-transform-h3' );
+
+ $single_post_title = astra_get_option( 'blog-single-post-structure' );
+ $title_enabled_from_meta = get_post_meta( $post_id, 'site-post-title', true );
+
+ $is_widget_title_support_font_weight = Astra_Dynamic_CSS::support_font_css_to_widget_and_in_editor();
+ $font_weight_prop = ( $is_widget_title_support_font_weight ) ? 'inherit' : 'normal';
+
+ // Fallback for H1 - headings typography.
+ if ( 'inherit' == $h1_font_family ) {
+ $h1_font_family = $headings_font_family;
+ }
+ if ( $font_weight_prop === $h1_font_weight ) {
+ $h1_font_weight = $headings_font_weight;
+ }
+ if ( '' == $h1_text_transform ) {
+ $h1_text_transform = $headings_text_transform;
+ }
+ if ( '' == $h1_line_height ) {
+ $h1_line_height = $headings_line_height;
+ }
+
+ // Fallback for H2 - headings typography.
+ if ( 'inherit' == $h2_font_family ) {
+ $h2_font_family = $headings_font_family;
+ }
+ if ( $font_weight_prop === $h2_font_weight ) {
+ $h2_font_weight = $headings_font_weight;
+ }
+ if ( '' == $h2_text_transform ) {
+ $h2_text_transform = $headings_text_transform;
+ }
+ if ( '' == $h2_line_height ) {
+ $h2_line_height = $headings_line_height;
+ }
+
+ // Fallback for H3 - headings typography.
+ if ( 'inherit' == $h3_font_family ) {
+ $h3_font_family = $headings_font_family;
+ }
+ if ( $font_weight_prop === $h3_font_weight ) {
+ $h3_font_weight = $headings_font_weight;
+ }
+ if ( '' == $h3_text_transform ) {
+ $h3_text_transform = $headings_text_transform;
+ }
+ if ( '' == $h3_line_height ) {
+ $h3_line_height = $headings_line_height;
+ }
+
+ // Fallback for H4 - headings typography.
+ $h4_line_height = $headings_line_height;
+
+ // Fallback for H5 - headings typography.
+ $h5_line_height = $headings_line_height;
+
+ // Fallback for H6 - headings typography.
+ $h6_line_height = $headings_line_height;
+
+ if ( empty( $btn_color ) ) {
+ $btn_color = astra_get_foreground_color( $theme_color );
+ }
+
+ if ( empty( $btn_h_color ) ) {
+ $btn_h_color = astra_get_foreground_color( $link_h_color );
+ }
+
+ if ( is_array( $body_font_size ) ) {
+ $body_font_size_desktop = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15;
+ } else {
+ $body_font_size_desktop = ( '' != $body_font_size ) ? $body_font_size : 15;
+ }
+
+ // check the selection color incase of empty/no theme color.
+ $selection_text_color = ( 'transparent' === $highlight_theme_color ) ? '' : $highlight_theme_color;
+
+ $css = '';
+
+ $desktop_css = array(
+ 'html' => array(
+ 'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 6.25, '%' ),
+ ),
+ 'a' => array(
+ 'color' => esc_attr( $link_color ),
+ ),
+
+ // Global selection CSS.
+ '.block-editor-block-list__layout .block-editor-block-list__block ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit:before' => array(
+ 'background-color' => esc_attr( $theme_color ),
+ ),
+ '.block-editor-block-list__layout .block-editor-block-list__block ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit' => array(
+ 'color' => esc_attr( $selection_text_color ),
+ ),
+ '.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'desktop' ),
+ '.editor-post-title__block,.editor-default-block-appender,.block-editor-block-list__block' => array(
+ 'max-width' => astra_get_css_value( $site_content_width, 'px' ),
+ ),
+ '.block-editor-block-list__block[data-align=wide]' => array(
+ 'max-width' => astra_get_css_value( $site_content_width + 200, 'px' ),
+ ),
+ '.editor-post-title__block .editor-post-title__input, .edit-post-visual-editor .block-editor-block-list__block h1, .edit-post-visual-editor .block-editor-block-list__block h2, .edit-post-visual-editor .block-editor-block-list__block h3, .edit-post-visual-editor .block-editor-block-list__block h4, .edit-post-visual-editor .block-editor-block-list__block h5, .edit-post-visual-editor .block-editor-block-list__block h6' => array(
+ 'font-family' => astra_get_css_value( $headings_font_family, 'font' ),
+ 'font-weight' => astra_get_css_value( $headings_font_weight, 'font' ),
+ 'text-transform' => esc_attr( $headings_text_transform ),
+ ),
+ '.edit-post-visual-editor h1, .edit-post-visual-editor h2, .edit-post-visual-editor h3, .edit-post-visual-editor h4, .edit-post-visual-editor h5, .edit-post-visual-editor h6' => array(
+ 'line-height' => esc_attr( $headings_line_height ),
+ ),
+ '.edit-post-visual-editor.editor-styles-wrapper p,.block-editor-block-list__block p, .block-editor-block-list__layout, .editor-post-title' => array(
+ 'font-size' => astra_responsive_font( $body_font_size, 'desktop' ),
+ ),
+ '.edit-post-visual-editor.editor-styles-wrapper p,.block-editor-block-list__block p, .wp-block-latest-posts a,.editor-default-block-appender textarea.editor-default-block-appender__content, .block-editor-block-list__block, .block-editor-block-list__block h1, .block-editor-block-list__block h2, .block-editor-block-list__block h3, .block-editor-block-list__block h4, .block-editor-block-list__block h5, .block-editor-block-list__block h6, .edit-post-visual-editor .editor-styles-wrapper' => array(
+ 'font-family' => astra_get_font_family( $body_font_family ),
+ 'font-weight' => esc_attr( $body_font_weight ),
+ 'font-size' => astra_responsive_font( $body_font_size, 'desktop' ),
+ 'line-height' => esc_attr( $body_line_height ),
+ 'text-transform' => esc_attr( $body_text_transform ),
+ 'margin-bottom' => astra_get_css_value( $para_margin_bottom, 'em' ),
+ ),
+ '.editor-post-title__block .editor-post-title__input' => array(
+ 'font-family' => ( 'inherit' === $headings_font_family ) ? astra_get_font_family( $body_font_family ) : astra_get_font_family( $headings_font_family ),
+ 'font-size' => astra_responsive_font( $single_post_title_font_size, 'desktop' ),
+ 'font-weight' => 'normal',
+ ),
+ '.block-editor-block-list__block' => array(
+ 'color' => esc_attr( $text_color ),
+ ),
+ /**
+ * Content base heading color.
+ */
+ '.editor-post-title__block .editor-post-title__input, .wc-block-grid__product-title, .edit-post-visual-editor .block-editor-block-list__block h1, .edit-post-visual-editor .block-editor-block-list__block h2, .edit-post-visual-editor .block-editor-block-list__block h3, .edit-post-visual-editor .block-editor-block-list__block h4, .edit-post-visual-editor .block-editor-block-list__block h5, .edit-post-visual-editor .block-editor-block-list__block h6, .edit-post-visual-editor .wp-block-heading, .edit-post-visual-editor .wp-block-uagb-advanced-heading h1, .edit-post-visual-editor .wp-block-uagb-advanced-heading h2, .edit-post-visual-editor .wp-block-uagb-advanced-heading h3, .edit-post-visual-editor .wp-block-uagb-advanced-heading h4, .edit-post-visual-editor .wp-block-uagb-advanced-heading h5, .edit-post-visual-editor .wp-block-uagb-advanced-heading h6' => array(
+ 'color' => esc_attr( $heading_base_color ),
+ ),
+ // Blockquote Text Color.
+ 'blockquote' => array(
+ 'color' => astra_adjust_brightness( $text_color, 75, 'darken' ),
+ ),
+ 'blockquote .editor-rich-text__tinymce a' => array(
+ 'color' => astra_hex_to_rgba( $link_color, 1 ),
+ ),
+ 'blockquote' => array(
+ 'border-color' => astra_hex_to_rgba( $link_color, 0.05 ),
+ ),
+ '.block-editor-block-list__block .wp-block-quote:not(.is-large):not(.is-style-large), .edit-post-visual-editor .wp-block-pullquote blockquote' => array(
+ 'border-color' => astra_hex_to_rgba( $link_color, 0.15 ),
+ ),
+
+ // Heading H1 - H6 font size.
+ '.edit-post-visual-editor .block-editor-block-list__block h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1, .edit-post-visual-editor h1.block-editor-block-list__block' => array(
+ 'font-size' => astra_responsive_font( $heading_h1_font_size, 'desktop' ),
+ 'font-family' => astra_get_css_value( $h1_font_family, 'font' ),
+ 'font-weight' => astra_get_css_value( $h1_font_weight, 'font' ),
+ 'line-height' => esc_attr( $h1_line_height ),
+ 'text-transform' => esc_attr( $h1_text_transform ),
+ ),
+ '.edit-post-visual-editor .block-editor-block-list__block h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2, .edit-post-visual-editor h2.block-editor-block-list__block' => array(
+ 'font-size' => astra_responsive_font( $heading_h2_font_size, 'desktop' ),
+ 'font-family' => astra_get_css_value( $h2_font_family, 'font' ),
+ 'font-weight' => astra_get_css_value( $h2_font_weight, 'font' ),
+ 'line-height' => esc_attr( $h2_line_height ),
+ 'text-transform' => esc_attr( $h2_text_transform ),
+ ),
+ '.edit-post-visual-editor .block-editor-block-list__block h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3, .edit-post-visual-editor h3.block-editor-block-list__block' => array(
+ 'font-size' => astra_responsive_font( $heading_h3_font_size, 'desktop' ),
+ 'font-family' => astra_get_css_value( $h3_font_family, 'font' ),
+ 'font-weight' => astra_get_css_value( $h3_font_weight, 'font' ),
+ 'line-height' => esc_attr( $h3_line_height ),
+ 'text-transform' => esc_attr( $h3_text_transform ),
+ ),
+ '.edit-post-visual-editor .block-editor-block-list__block h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4, .edit-post-visual-editor h4.block-editor-block-list__block' => array(
+ 'font-size' => astra_responsive_font( $heading_h4_font_size, 'desktop' ),
+ 'line-height' => esc_attr( $h4_line_height ),
+ ),
+ '.edit-post-visual-editor .block-editor-block-list__block h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5, .edit-post-visual-editor h5.block-editor-block-list__block' => array(
+ 'font-size' => astra_responsive_font( $heading_h5_font_size, 'desktop' ),
+ 'line-height' => esc_attr( $h5_line_height ),
+ ),
+ '.edit-post-visual-editor .block-editor-block-list__block h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6, .edit-post-visual-editor h6.block-editor-block-list__block' => array(
+ 'font-size' => astra_responsive_font( $heading_h6_font_size, 'desktop' ),
+ 'line-height' => esc_attr( $h6_line_height ),
+ ),
+ /**
+ * WooCommerce Grid Products compatibility.
+ */
+ '.wc-block-grid__product-title' => array(
+ 'color' => esc_attr( $text_color ),
+ ),
+ '.wc-block-grid__product .wc-block-grid__product-onsale' => array(
+ 'background-color' => $theme_color,
+ 'color' => astra_get_foreground_color( $theme_color ),
+ ),
+ '.editor-styles-wrapper .wc-block-grid__products .wc-block-grid__product .wp-block-button__link, .wc-block-grid__product-onsale' => array(
+ 'color' => $btn_color,
+ 'border-color' => $btn_bg_color,
+ 'background-color' => $btn_bg_color,
+ ),
+ '.wc-block-grid__products .wc-block-grid__product .wp-block-button__link:hover' => array(
+ 'color' => $btn_h_color,
+ 'border-color' => $btn_bg_h_color,
+ 'background-color' => $btn_bg_h_color,
+ ),
+ '.wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array(
+ 'border-radius' => astra_get_css_value( $btn_border_radius, 'px' ),
+ 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'desktop' ),
+ 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'desktop' ),
+ 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'desktop' ),
+ 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'desktop' ),
+ ),
+ );
+
+ if ( astra_wp_version_compare( '5.7', '>=' ) ) {
+ $base_background_color = astra_get_responsive_background_obj( $box_bg_obj, 'desktop' );
+ if ( empty( $base_background_color ) ) {
+ $background_style_data = array(
+ 'background-color' => '#ffffff',
+ );
+ } else {
+ $background_style_data = $base_background_color;
+ }
+
+ $desktop_css['.edit-post-visual-editor'] = array(
+ 'padding' => '20px',
+ 'padding-top' => 'calc(2em + 20px)',
+ );
+ $desktop_css['.ast-page-builder-template .edit-post-visual-editor'] = array(
+ 'padding' => '0',
+ 'padding-top' => '2em',
+ );
+ $desktop_css['.ast-separate-container .editor-post-title'] = array(
+ 'margin-top' => '0',
+ );
+ $desktop_css['.editor-styles-wrapper .block-editor-writing-flow'] = array(
+ 'height' => '100%',
+ 'padding' => '10px',
+ );
+ $desktop_css['.edit-post-visual-editor .editor-styles-wrapper'] = array(
+ 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
+ 'width' => '100%',
+ 'margin' => '0 auto',
+ 'padding' => '0',
+ );
+ $desktop_css['.ast-page-builder-template .edit-post-visual-editor .editor-styles-wrapper'] = array(
+ 'max-width' => '100%',
+ );
+ $desktop_css['.ast-separate-container .edit-post-visual-editor .block-editor-block-list__layout .wp-block[data-align="full"] figure.wp-block-image, .ast-separate-container .edit-post-visual-editor .wp-block[data-align="full"] .wp-block-cover'] = array(
+ 'margin-left' => 'calc(-4.8em - 10px)',
+ 'margin-right' => 'calc(-4.8em - 10px)',
+ );
+ $desktop_css['.ast-page-builder-template .editor-styles-wrapper .block-editor-writing-flow, .ast-plain-container .editor-styles-wrapper .block-editor-writing-flow, #editor .edit-post-visual-editor'] = $background_style_data;
+ }
+
+ if ( ( ( ! in_array( 'single-title-meta', $single_post_title ) ) && ( 'post' === get_post_type() ) ) || ( 'disabled' === $title_enabled_from_meta ) ) {
+ $destop_title_css = array(
+ '.editor-post-title__block' => array(
+ 'opacity' => '0.2',
+ ),
+ );
+ $css .= astra_parse_css( $destop_title_css );
+ }
+
+ $content_links_underline = astra_get_option( 'underline-content-links' );
+
+ if ( $content_links_underline ) {
+ $desktop_css['.edit-post-visual-editor a'] = array(
+ 'text-decoration' => 'underline',
+ );
+ }
+
+ $css .= astra_parse_css( $desktop_css );
+
+ /**
+ * Global button CSS - Tablet.
+ */
+ $css_prod_button_tablet = array(
+ '.wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array(
+ 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'tablet' ),
+ 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'tablet' ),
+ 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'tablet' ),
+ 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'tablet' ),
+ ),
+ );
+
+ if ( astra_wp_version_compare( '5.7', '>=' ) ) {
+ $css_prod_button_tablet['.ast-page-builder-template .editor-styles-wrapper .block-editor-writing-flow, .ast-plain-container .editor-styles-wrapper .block-editor-writing-flow'] = astra_get_responsive_background_obj( $box_bg_obj, 'tablet' );
+ }
+
+ $css .= astra_parse_css( $css_prod_button_tablet, '', astra_get_tablet_breakpoint() );
+
+ /**
+ * Global button CSS - Mobile.
+ */
+ $css_prod_button_mobile = array(
+ '.wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array(
+ 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'mobile' ),
+ 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'mobile' ),
+ 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'mobile' ),
+ 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'mobile' ),
+ ),
+ );
+
+ if ( astra_wp_version_compare( '5.7', '>=' ) ) {
+ $css_prod_button_mobile['.ast-page-builder-template .editor-styles-wrapper .block-editor-writing-flow, .ast-plain-container .editor-styles-wrapper .block-editor-writing-flow'] = astra_get_responsive_background_obj( $box_bg_obj, 'mobile' );
+ }
+
+ $css .= astra_parse_css( $css_prod_button_mobile, '', astra_get_mobile_breakpoint() );
+
+ $theme_btn_top_border = ( isset( $global_custom_button_border_size['top'] ) && '' !== $global_custom_button_border_size['top'] ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : '1px';
+ $theme_btn_right_border = ( isset( $global_custom_button_border_size['right'] ) && '' !== $global_custom_button_border_size['right'] ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : '1px';
+ $theme_btn_left_border = ( isset( $global_custom_button_border_size['left'] ) && '' !== $global_custom_button_border_size['left'] ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : '1px';
+ $theme_btn_bottom_border = ( isset( $global_custom_button_border_size['bottom'] ) && '' !== $global_custom_button_border_size['bottom'] ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : '1px';
+
+ if ( Astra_Dynamic_CSS::page_builder_button_style_css() ) {
+
+ $is_support_wp_5_8 = Astra_Dynamic_CSS::is_block_editor_support_enabled();
+ $search_button_selector = $is_support_wp_5_8 ? ', .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button' : '';
+ $search_button_hover_selector = $is_support_wp_5_8 ? ', .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:hover, .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:focus' : '';
+
+ $button_desktop_css = array(
+ /**
+ * Gutenberg button compatibility for default styling.
+ */
+ '.wp-block-button .wp-block-button__link' . $search_button_selector => array(
+ 'border-style' => 'solid',
+ 'border-top-width' => $theme_btn_top_border,
+ 'border-right-width' => $theme_btn_right_border,
+ 'border-left-width' => $theme_btn_left_border,
+ 'border-bottom-width' => $theme_btn_bottom_border,
+ 'color' => esc_attr( $btn_color ),
+ 'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
+ 'background-color' => esc_attr( $btn_bg_color ),
+ 'font-family' => astra_get_font_family( $theme_btn_font_family ),
+ 'font-weight' => esc_attr( $theme_btn_font_weight ),
+ 'line-height' => esc_attr( $theme_btn_line_height ),
+ 'text-transform' => esc_attr( $theme_btn_text_transform ),
+ 'letter-spacing' => astra_get_css_value( $theme_btn_letter_spacing, 'px' ),
+ 'font-size' => astra_responsive_font( $theme_btn_font_size, 'desktop' ),
+ 'border-radius' => astra_get_css_value( $btn_border_radius, 'px' ),
+ 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'desktop' ),
+ 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'desktop' ),
+ 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'desktop' ),
+ 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'desktop' ),
+ ),
+ '.wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus' . $search_button_hover_selector => array(
+ 'color' => esc_attr( $btn_h_color ),
+ 'background-color' => esc_attr( $btn_bg_h_color ),
+ 'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_h_color ) : esc_attr( $btn_border_h_color ),
+ ),
+ );
+
+ if ( $is_support_wp_5_8 ) {
+ $button_desktop_css['.wp-block-search .wp-block-search__input, .wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper'] = array(
+ 'border-color' => '#eaeaea',
+ 'background' => '#fafafa',
+ );
+ $button_desktop_css['.block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__input'] = array(
+ 'padding' => '15px',
+ );
+ $button_desktop_css['.wp-block-search__button svg'] = array(
+ 'fill' => 'currentColor',
+ );
+ }
+
+ $css .= astra_parse_css( $button_desktop_css );
+
+ /**
+ * Global button CSS - Tablet.
+ */
+ $css_global_button_tablet = array(
+ '.wp-block-button .wp-block-button__link' => array(
+ 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'tablet' ),
+ 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'tablet' ),
+ 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'tablet' ),
+ 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'tablet' ),
+ ),
+ );
+
+ $css .= astra_parse_css( $css_global_button_tablet, '', astra_get_tablet_breakpoint() );
+
+ /**
+ * Global button CSS - Mobile.
+ */
+ $css_global_button_mobile = array(
+ '.wp-block-button .wp-block-button__link' => array(
+ 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'mobile' ),
+ 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'mobile' ),
+ 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'mobile' ),
+ 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'mobile' ),
+ ),
+ );
+
+ $css .= astra_parse_css( $css_global_button_mobile, '', astra_get_mobile_breakpoint() );
+ }
+
+ if ( Astra_Dynamic_CSS::gutenberg_core_patterns_compat() ) {
+
+ $link_hover_color = astra_get_option( 'link-h-color' );
+ $btn_text_hover_color = astra_get_option( 'button-h-color' );
+ if ( empty( $btn_text_hover_color ) ) {
+ $btn_text_hover_color = astra_get_foreground_color( $link_hover_color );
+ }
+
+ /**
+ * When supporting GB button outline patterns in v3.3.0 we have given 2px as default border for GB outline button, where we restrict button border for flat type buttons.
+ * But now while reverting this change there is no need of default border because whatever customizer border will set it should behave accordingly. Although it is empty ('') WP applying 2px as default border for outline buttons.
+ *
+ * @since 3.6.3
+ */
+ $default_border_size = '2px';
+ if ( ! astra_button_default_padding_updated() ) {
+ $default_border_size = '';
+ }
+
+ // Outline Gutenberg button compatibility CSS.
+ $theme_btn_top_border = ( isset( $global_custom_button_border_size['top'] ) && ( '' !== $global_custom_button_border_size['top'] && '0' !== $global_custom_button_border_size['top'] ) ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : $default_border_size;
+ $theme_btn_right_border = ( isset( $global_custom_button_border_size['right'] ) && ( '' !== $global_custom_button_border_size['right'] && '0' !== $global_custom_button_border_size['right'] ) ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : $default_border_size;
+ $theme_btn_left_border = ( isset( $global_custom_button_border_size['left'] ) && ( '' !== $global_custom_button_border_size['left'] && '0' !== $global_custom_button_border_size['left'] ) ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : $default_border_size;
+ $theme_btn_bottom_border = ( isset( $global_custom_button_border_size['bottom'] ) && ( '' !== $global_custom_button_border_size['bottom'] && '0' !== $global_custom_button_border_size['bottom'] ) ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : $default_border_size;
+
+ // Added CSS compatibility support for Gutenberg pattern.
+ $button_patterns_compat_css = array(
+ '.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color), .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color)' => array(
+ 'color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
+ ),
+ '.wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-button.is-style-outline .wp-block-button__link:focus' => array(
+ 'color' => esc_attr( $btn_text_hover_color ) . ' !important',
+ ),
+ '.wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus' => array(
+ 'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_h_color ) : esc_attr( $btn_border_h_color ),
+ ),
+ );
+
+ if ( ! astra_button_default_padding_updated() ) {
+ $button_patterns_compat_css['.wp-block-button .wp-block-button__link'] = array(
+ 'border' => 'none',
+ 'padding' => '15px 30px',
+ );
+ $button_patterns_compat_css['.wp-block-button.is-style-outline .wp-block-button__link'] = array(
+ 'border-style' => 'solid',
+ 'border-top-width' => esc_attr( $theme_btn_top_border ),
+ 'border-right-width' => esc_attr( $theme_btn_right_border ),
+ 'border-bottom-width' => esc_attr( $theme_btn_bottom_border ),
+ 'border-left-width' => esc_attr( $theme_btn_left_border ),
+ 'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
+ 'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
+ 'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
+ 'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
+ 'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
+ );
+ }
+
+ $css .= astra_parse_css( $button_patterns_compat_css );
+
+ if ( ! astra_button_default_padding_updated() ) {
+ // Tablet CSS.
+ $button_patterns_tablet_compat_css = array(
+ '.wp-block-button .wp-block-button__link' => array(
+ 'border' => 'none',
+ 'padding' => '15px 30px',
+ ),
+ '.wp-block-button.is-style-outline .wp-block-button__link' => array(
+ 'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
+ 'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
+ 'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
+ 'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
+ ),
+ );
+
+ $css .= astra_parse_css( $button_patterns_tablet_compat_css, '', astra_get_tablet_breakpoint() );
+
+ // Mobile CSS.
+ $button_patterns_mobile_compat_css = array(
+ '.wp-block-button .wp-block-button__link' => array(
+ 'border' => 'none',
+ 'padding' => '15px 30px',
+ ),
+ '.wp-block-button.is-style-outline .wp-block-button__link' => array(
+ 'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
+ 'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
+ 'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
+ 'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
+ ),
+ );
+
+ $css .= astra_parse_css( $button_patterns_mobile_compat_css, '', astra_get_mobile_breakpoint() );
+ }
+
+ if ( $is_site_rtl ) {
+ $gb_patterns_min_mobile_css = array(
+ '.editor-styles-wrapper .alignleft' => array(
+ 'margin-left' => '20px',
+ ),
+ '.editor-styles-wrapper .alignright' => array(
+ 'margin-right' => '20px',
+ ),
+ );
+ } else {
+ $gb_patterns_min_mobile_css = array(
+ '.editor-styles-wrapper .alignleft' => array(
+ 'margin-right' => '20px',
+ ),
+ '.editor-styles-wrapper .alignright' => array(
+ 'margin-left' => '20px',
+ ),
+ );
+ }
+
+ if ( ! astra_button_default_padding_updated() ) {
+ $gb_patterns_min_mobile_css['.editor-styles-wrapper p.has-background'] = array(
+ 'padding' => '20px',
+ );
+ }
+
+ /* Parse CSS from array() -> min-width: (mobile-breakpoint) px CSS */
+ $css .= astra_parse_css( $gb_patterns_min_mobile_css );
+ }
+
+ if ( Astra_Dynamic_CSS::gutenberg_core_blocks_css_comp() ) {
+
+ $desktop_screen_gb_css = array(
+ '.wp-block-columns' => array(
+ 'margin-bottom' => 'unset',
+ ),
+ 'figure.size-full' => array(
+ 'margin' => '2rem 0',
+ ),
+ '.wp-block-gallery' => array(
+ 'margin-bottom' => '1.6em',
+ ),
+ '.wp-block-group' => array(
+ 'padding-top' => '4em',
+ 'padding-bottom' => '4em',
+ ),
+ '.wp-block-group__inner-container:last-child, .wp-block-table table' => array(
+ 'margin-bottom' => '0',
+ ),
+ '.blocks-gallery-grid' => array(
+ 'width' => '100%',
+ ),
+ '.wp-block-navigation-link__content' => array(
+ 'padding' => '5px 0',
+ ),
+ '.wp-block-group .wp-block-group .has-text-align-center, .wp-block-group .wp-block-column .has-text-align-center' => array(
+ 'max-width' => '100%',
+ ),
+ '.has-text-align-center' => array(
+ 'margin' => '0 auto',
+ ),
+ );
+
+ /* Parse CSS from array() -> Desktop CSS */
+ $css .= astra_parse_css( $desktop_screen_gb_css );
+
+ $middle_screen_min_gb_css = array(
+ '.wp-block-cover__inner-container, .alignwide .wp-block-group__inner-container, .alignfull .wp-block-group__inner-container' => array(
+ 'max-width' => '1200px',
+ 'margin' => '0 auto',
+ ),
+ '.wp-block-group.alignnone, .wp-block-group.aligncenter, .wp-block-group.alignleft, .wp-block-group.alignright, .wp-block-group.alignwide, .wp-block-columns.alignwide' => array(
+ 'margin' => '2rem 0 1rem 0',
+ ),
+ );
+
+ /* Parse CSS from array() -> min-width: (1200)px CSS */
+ $css .= astra_parse_css( $middle_screen_min_gb_css, '1200' );
+
+ $middle_screen_max_gb_css = array(
+ '.wp-block-group' => array(
+ 'padding' => '3em',
+ ),
+ '.wp-block-group .wp-block-group' => array(
+ 'padding' => '1.5em',
+ ),
+ '.wp-block-columns, .wp-block-column' => array(
+ 'margin' => '1rem 0',
+ ),
+ );
+
+ /* Parse CSS from array() -> max-width: (1200)px CSS */
+ $css .= astra_parse_css( $middle_screen_max_gb_css, '', '1200' );
+
+ $tablet_screen_min_gb_css = array(
+ '.wp-block-columns .wp-block-group' => array(
+ 'padding' => '2em',
+ ),
+ );
+
+ /* Parse CSS from array() -> min-width: (tablet-breakpoint)px CSS */
+ $css .= astra_parse_css( $tablet_screen_min_gb_css, astra_get_tablet_breakpoint() );
+
+ $mobile_screen_max_gb_css = array(
+ '.wp-block-media-text .wp-block-media-text__content' => array(
+ 'padding' => '3em 2em',
+ ),
+ '.wp-block-cover-image .wp-block-cover__inner-container, .wp-block-cover .wp-block-cover__inner-container' => array(
+ 'width' => 'unset',
+ ),
+ '.wp-block-cover, .wp-block-cover-image' => array(
+ 'padding' => '2em 0',
+ ),
+ '.wp-block-group, .wp-block-cover' => array(
+ 'padding' => '2em',
+ ),
+ '.wp-block-media-text__media img, .wp-block-media-text__media video' => array(
+ 'width' => 'unset',
+ 'max-width' => '100%',
+ ),
+ '.wp-block-media-text.has-background .wp-block-media-text__content' => array(
+ 'padding' => '1em',
+ ),
+ );
+
+ /* Parse CSS from array() -> max-width: (mobile-breakpoint)px CSS */
+ $css .= astra_parse_css( $mobile_screen_max_gb_css, '', astra_get_mobile_breakpoint() );
+ }
+
+ if ( Astra_Dynamic_CSS::gutenberg_core_patterns_compat() ) {
+
+ // Added CSS compatibility support for Gutenberg Editor's Media & Text block pattern.
+ if ( $is_site_rtl ) {
+ $gb_editor_block_pattern_css = array(
+ '.wp-block-media-text .wp-block-media-text__content .wp-block-group__inner-container' => array(
+ 'padding' => '0 8% 0 0',
+ ),
+ '.ast-separate-container .block-editor-block-list__layout .wp-block[data-align="full"] .wp-block[data-align="center"] > .wp-block-image' => array(
+ 'margin-right' => 'auto',
+ 'margin-left' => 'auto',
+ ),
+ );
+ } else {
+ $gb_editor_block_pattern_css = array(
+ '.wp-block-media-text .wp-block-media-text__content .wp-block-group__inner-container' => array(
+ 'padding' => '0 0 0 8%',
+ ),
+ '.ast-separate-container .block-editor-block-list__layout .wp-block[data-align="full"] .wp-block[data-align="center"] > .wp-block-image' => array(
+ 'margin-right' => 'auto',
+ 'margin-left' => 'auto',
+ ),
+ );
+ }
+
+ $gb_editor_block_pattern_css['.block-editor-block-list__layout * .block-editor-block-list__block'] = array(
+ 'padding-left' => '20px',
+ 'padding-right' => '20px',
+ );
+
+ $css .= astra_parse_css( $gb_editor_block_pattern_css );
+ }
+
+ $tablet_css = array(
+ '.editor-post-title__block .editor-post-title__input' => array(
+ 'font-size' => astra_responsive_font( $single_post_title_font_size, 'tablet', 30 ),
+ ),
+ // Heading H1 - H6 font size.
+ '.edit-post-visual-editor h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1' => array(
+ 'font-size' => astra_responsive_font( $heading_h1_font_size, 'tablet', 30 ),
+ ),
+ '.edit-post-visual-editor h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2' => array(
+ 'font-size' => astra_responsive_font( $heading_h2_font_size, 'tablet', 25 ),
+ ),
+ '.edit-post-visual-editor h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3' => array(
+ 'font-size' => astra_responsive_font( $heading_h3_font_size, 'tablet', 20 ),
+ ),
+ '.edit-post-visual-editor h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4' => array(
+ 'font-size' => astra_responsive_font( $heading_h4_font_size, 'tablet' ),
+ ),
+ '.edit-post-visual-editor h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5' => array(
+ 'font-size' => astra_responsive_font( $heading_h5_font_size, 'tablet' ),
+ ),
+ '.edit-post-visual-editor h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6' => array(
+ 'font-size' => astra_responsive_font( $heading_h6_font_size, 'tablet' ),
+ ),
+ '.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'tablet' ),
+ );
+
+ $css .= astra_parse_css( $tablet_css, '', astra_get_tablet_breakpoint() );
+
+ $mobile_css = array(
+ '.editor-post-title__block .editor-post-title__input' => array(
+ 'font-size' => astra_responsive_font( $single_post_title_font_size, 'mobile', 30 ),
+ ),
+
+ // Heading H1 - H6 font size.
+ '.edit-post-visual-editor h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1' => array(
+ 'font-size' => astra_responsive_font( $heading_h1_font_size, 'mobile', 30 ),
+ ),
+ '.edit-post-visual-editor h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2' => array(
+ 'font-size' => astra_responsive_font( $heading_h2_font_size, 'mobile', 25 ),
+ ),
+ '.edit-post-visual-editor h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3' => array(
+ 'font-size' => astra_responsive_font( $heading_h3_font_size, 'mobile', 20 ),
+ ),
+ '.edit-post-visual-editor h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4' => array(
+ 'font-size' => astra_responsive_font( $heading_h4_font_size, 'mobile' ),
+ ),
+ '.edit-post-visual-editor h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5' => array(
+ 'font-size' => astra_responsive_font( $heading_h5_font_size, 'mobile' ),
+ ),
+ '.edit-post-visual-editor h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6' => array(
+ 'font-size' => astra_responsive_font( $heading_h6_font_size, 'mobile' ),
+ ),
+ '.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'mobile' ),
+ );
+
+ $css .= astra_parse_css( $mobile_css, '', astra_get_mobile_breakpoint() );
+
+ if ( is_callable( 'Astra_Woocommerce::astra_global_btn_woo_comp' ) && Astra_Woocommerce::astra_global_btn_woo_comp() ) {
+
+ $woo_global_button_css = array(
+ '.editor-styles-wrapper .wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array(
+ 'border-top-width' => ( isset( $global_custom_button_border_size['top'] ) && '' !== $global_custom_button_border_size['top'] ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : '0',
+ 'border-right-width' => ( isset( $global_custom_button_border_size['right'] ) && '' !== $global_custom_button_border_size['right'] ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : '0',
+ 'border-left-width' => ( isset( $global_custom_button_border_size['left'] ) && '' !== $global_custom_button_border_size['left'] ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : '0',
+ 'border-bottom-width' => ( isset( $global_custom_button_border_size['bottom'] ) && '' !== $global_custom_button_border_size['bottom'] ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : '0',
+ 'border-color' => $btn_border_color ? $btn_border_color : $btn_bg_color,
+ ),
+ '.wc-block-grid__products .wc-block-grid__product .wp-block-button__link:hover' => array(
+ 'border-color' => $btn_bg_h_color,
+ ),
+ );
+ $css .= astra_parse_css( $woo_global_button_css );
+ }
+
+ if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
+
+ $page_builder_css = array(
+ '.ast-page-builder-template .editor-post-title__block, .ast-page-builder-template .editor-default-block-appender' => array(
+ 'width' => '100%',
+ 'max-width' => '100%',
+ ),
+ '.ast-page-builder-template .wp-block[data-align="right"] > *' => array(
+ 'max-width' => 'unset',
+ 'width' => 'unset',
+ ),
+ '.ast-page-builder-template .block-editor-block-list__layout' => array(
+ 'padding-left' => 0,
+ 'padding-right' => 0,
+ ),
+ '.ast-page-builder-template .editor-block-list__block-edit' => array(
+ 'padding-left' => '20px',
+ 'padding-right' => '20px',
+ ),
+ '.ast-page-builder-template .editor-block-list__block-edit .editor-block-list__block-edit' => array(
+ 'padding-left' => '0',
+ 'padding-right' => '0',
+ ),
+ );
+
+ } else {
+
+ $page_builder_css = array(
+ '.ast-page-builder-template .editor-post-title__block, .ast-page-builder-template .editor-default-block-appender, .ast-page-builder-template .block-editor-block-list__block' => array(
+ 'width' => '100%',
+ 'max-width' => '100%',
+ ),
+ '.ast-page-builder-template .block-editor-block-list__layout' => array(
+ 'padding-left' => 0,
+ 'padding-right' => 0,
+ ),
+ '.ast-page-builder-template .editor-block-list__block-edit' => array(
+ 'padding-left' => '20px',
+ 'padding-right' => '20px',
+ ),
+ '.ast-page-builder-template .editor-block-list__block-edit .editor-block-list__block-edit' => array(
+ 'padding-left' => '0',
+ 'padding-right' => '0',
+ ),
+ );
+ }
+
+ $css .= astra_parse_css( $page_builder_css );
+
+ $aligned_full_content_css = array(
+ '.ast-page-builder-template .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit, .ast-plain-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit' => array(
+ 'margin-left' => '0',
+ 'margin-right' => '0',
+ ),
+ '.ast-page-builder-template .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .ast-plain-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"]' => array(
+ 'margin-left' => '0',
+ 'margin-right' => '0',
+ ),
+ );
+
+ $css .= astra_parse_css( $aligned_full_content_css );
+
+ $boxed_container = array(
+ '.ast-separate-container .block-editor-writing-flow, .ast-two-container .block-editor-writing-flow' => array(
+ 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
+ 'margin' => '0 auto',
+ 'background-color' => '#fff',
+ ),
+ '.ast-separate-container .gutenberg__editor, .ast-two-container .gutenberg__editor' => array(
+ 'background-color' => '#f5f5f5',
+ ),
+
+ '.ast-separate-container .block-editor-block-list__layout, .ast-two-container .editor-block-list__layout' => array(
+ 'padding-top' => '0',
+ ),
+
+ '.ast-two-container .editor-post-title, .ast-separate-container .block-editor-block-list__layout, .ast-two-container .editor-post-title' => array(
+ 'padding-top' => 'calc( 5.34em - 19px)',
+ 'padding-bottom' => '5.34em',
+ 'padding-left' => 'calc( 6.67em - 28px )',
+ 'padding-right' => 'calc( 6.67em - 28px )',
+ ),
+ '.ast-separate-container .block-editor-block-list__layout' => array(
+ 'padding-top' => '0',
+ 'padding-bottom' => '5.34em',
+ 'padding-left' => 'calc( 6.67em - 28px )',
+ 'padding-right' => 'calc( 6.67em - 28px )',
+ ),
+ '.ast-separate-container .editor-post-title' => array(
+ 'padding-top' => 'calc( 5.34em - 19px)',
+ 'padding-bottom' => '5.34em',
+ 'padding-left' => 'calc( 6.67em - 28px )',
+ 'padding-right' => 'calc( 6.67em - 28px )',
+ ),
+
+ '.ast-separate-container .editor-post-title, .ast-two-container .editor-post-title' => array(
+ 'padding-bottom' => '0',
+ ),
+ '.ast-separate-container .editor-block-list__block, .ast-two-container .editor-block-list__block' => array(
+ 'max-width' => 'calc(' . astra_get_css_value( $site_content_width, 'px' ) . ' - 6.67em)',
+ ),
+ '.ast-separate-container .editor-block-list__block[data-align=wide], .ast-two-container .editor-block-list__block[data-align=wide]' => array(
+ 'margin-left' => '-20px',
+ 'margin-right' => '-20px',
+ ),
+ '.ast-separate-container .editor-block-list__block[data-align=full], .ast-two-container .editor-block-list__block[data-align=full]' => array(
+ 'margin-left' => '-6.67em',
+ 'margin-right' => '-6.67em',
+ ),
+ '.ast-separate-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .ast-separate-container .block-editor-block-list__layout .editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit, .ast-two-container .block-editor-block-list__layout .editor-block-list__block[data-align="full"], .ast-two-container .block-editor-block-list__layout .editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit' => array(
+ 'margin-left' => '0',
+ 'margin-right' => '0',
+ ),
+ );
+
+ $css .= astra_parse_css( $boxed_container );
+
+ // Manage the extra padding applied in the block inster preview of blocks.
+ $block_inserter_css = array(
+ '.ast-separate-container .block-editor-inserter__preview .block-editor-block-list__layout' => array(
+ 'padding-top' => '0px',
+ 'padding-bottom' => '0px',
+ 'padding-left' => '0px',
+ 'padding-right' => '0px',
+ ),
+ );
+
+ $css .= astra_parse_css( $block_inserter_css );
+
+ // WP 5.5 compatibility fix the extra padding applied for the block patterns in the editor view.
+ if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
+
+ $block_pattern_css = array(
+ '.ast-separate-container .block-editor-inserter__panel-content .block-editor-block-list__layout' => array(
+ 'padding-top' => '0px',
+ 'padding-bottom' => '0px',
+ 'padding-left' => '0px',
+ 'padding-right' => '0px',
+
+ ),
+ '.block-editor-inserter__panel-content .block-editor-block-list__layout' => array(
+ 'margin-left' => '60px',
+ 'margin-right' => '60px',
+ ),
+ '.block-editor-inserter__panel-content .block-editor-block-list__layout .block-editor-block-list__layout' => array(
+ 'margin-left' => '0px',
+ 'margin-right' => '0px',
+ ),
+ '.ast-page-builder-template .block-editor-inserter__panel-content .block-editor-block-list__layout' => array(
+ 'margin-left' => '0px',
+ 'margin-right' => '0px',
+ ),
+ );
+
+ $css .= astra_parse_css( $block_pattern_css );
+ } else {
+ $full_width_streched_css = array(
+ '.ast-page-builder-template .block-editor-block-list__layout' => array(
+ 'margin-left' => '60px',
+ 'margin-right' => '60px',
+ ),
+ '.ast-page-builder-template .block-editor-block-list__layout .block-editor-block-list__layout' => array(
+ 'margin-left' => '0px',
+ 'margin-right' => '0px',
+ ),
+ );
+
+ $css .= astra_parse_css( $full_width_streched_css );
+ }
+
+ $ast_gtn_mobile_css = array(
+ '.ast-separate-container .editor-post-title' => array(
+ 'padding-top' => 'calc( 2.34em - 19px)',
+ 'padding-left' => 'calc( 3.67em - 28px )',
+ 'padding-right' => 'calc( 3.67em - 28px )',
+ ),
+ '.ast-separate-container .block-editor-block-list__layout' => array(
+ 'padding-bottom' => '2.34em',
+ 'padding-left' => 'calc( 3.67em - 28px )',
+ 'padding-right' => 'calc( 3.67em - 28px )',
+ ),
+ '.ast-page-builder-template .block-editor-block-list__layout' => array(
+ 'margin-left' => '30px',
+ 'margin-right' => '30px',
+ ),
+ '.ast-plain-container .block-editor-block-list__layout' => array(
+ 'padding-left' => '30px',
+ 'padding-right' => '30px',
+ ),
+ );
+
+ $css .= astra_parse_css( $ast_gtn_mobile_css, '', astra_get_mobile_breakpoint() );
+
+ if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
+ $gtn_full_wide_image_css = array(
+ '.wp-block[data-align="left"], .wp-block[data-align="right"], .wp-block[data-align="center"]' => array(
+ 'max-width' => '100%',
+ 'width' => '100%',
+ ),
+ '.ast-separate-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"], .ast-plain-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"]' => array(
+ 'margin-left' => 'auto',
+ 'margin-right' => 'auto',
+ ),
+ '.ast-separate-container .block-editor-block-list__layout .wp-block[data-align="full"] figure.wp-block-image' => array(
+ 'margin-left' => '-4.8em',
+ 'margin-right' => '-4.81em',
+ 'max-width' => 'unset',
+ 'width' => 'unset',
+ ),
+ '.ast-separate-container .wp-block[data-align="full"] .wp-block-cover' => array(
+ 'margin-left' => '-4.8em',
+ 'margin-right' => '-4.81em',
+ 'max-width' => 'unset',
+ 'width' => 'unset',
+ ),
+ '.ast-plain-container .wp-block[data-align="left"], .ast-plain-container .wp-block[data-align="right"], .ast-plain-container .wp-block[data-align="center"], .ast-plain-container .wp-block[data-align="full"]' => array(
+ 'max-width' => astra_get_css_value( $site_content_width, 'px' ),
+ ),
+ '.ast-plain-container .wp-block[data-align="wide"]' => array(
+ 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
+ ),
+ );
+ } else {
+ $gtn_full_wide_image_css = array(
+ '.ast-separate-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] figure.wp-block-image' => array(
+ 'margin-left' => '-4.8em',
+ 'margin-right' => '-4.81em',
+ 'max-width' => 'unset',
+ 'width' => 'unset',
+ ),
+ '.ast-separate-container .block-editor-block-list__block[data-align="full"] .wp-block-cover' => array(
+ 'margin-left' => '-4.8em',
+ 'margin-right' => '-4.81em',
+ 'max-width' => 'unset',
+ 'width' => 'unset',
+ ),
+ );
+ }
+
+ $css .= astra_parse_css( $gtn_full_wide_image_css );
+
+ if ( in_array( $pagenow, array( 'post-new.php' ) ) && ! isset( $post ) ) {
+
+ $boxed_container = array(
+ '.block-editor-writing-flow' => array(
+ 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
+ 'margin' => '0 auto',
+ 'background-color' => '#fff',
+ ),
+ '.gutenberg__editor' => array(
+ 'background-color' => '#f5f5f5',
+ ),
+ '.block-editor-block-list__layout, .editor-post-title' => array(
+ 'padding-top' => 'calc( 5.34em - 19px)',
+ 'padding-bottom' => '5.34em',
+ 'padding-left' => 'calc( 6.67em - 28px )',
+ 'padding-right' => 'calc( 6.67em - 28px )',
+ ),
+ '.block-editor-block-list__layout' => array(
+ 'padding-top' => '0',
+ ),
+ '.editor-post-title' => array(
+ 'padding-bottom' => '0',
+ ),
+ '.block-editor-block-list__block' => array(
+ 'max-width' => 'calc(' . astra_get_css_value( $site_content_width, 'px' ) . ' - 6.67em)',
+ ),
+ '.block-editor-block-list__block[data-align=wide]' => array(
+ 'margin-left' => '-20px',
+ 'margin-right' => '-20px',
+ ),
+ '.block-editor-block-list__block[data-align=full]' => array(
+ 'margin-left' => '-6.67em',
+ 'margin-right' => '-6.67em',
+ ),
+ '.block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .editor-block-list__block-edit' => array(
+ 'margin-left' => '0',
+ 'margin-right' => '0',
+ ),
+ );
+
+ $css .= astra_parse_css( $boxed_container );
+
+ }
+
+ return $css;
+ }
+ }
+
+endif;
diff --git a/inc/core/class-theme-strings.php b/inc/core/class-theme-strings.php
new file mode 100644
index 0000000..089de87
--- /dev/null
+++ b/inc/core/class-theme-strings.php
@@ -0,0 +1,108 @@
+<?php
+/**
+ * Astra Theme Strings
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Default Strings
+ */
+if ( ! function_exists( 'astra_default_strings' ) ) {
+
+ /**
+ * Default Strings
+ *
+ * @since 1.0.0
+ * @param string $key String key.
+ * @param boolean $echo Print string.
+ * @return mixed Return string or nothing.
+ */
+ function astra_default_strings( $key, $echo = true ) {
+
+ $defaults = apply_filters(
+ 'astra_default_strings',
+ array(
+
+ // Header.
+ 'string-header-skip-link' => __( 'Skip to content', 'astra' ),
+
+ // 404 Page Strings.
+ 'string-404-sub-title' => __( 'It looks like the link pointing here was faulty. Maybe try searching?', 'astra' ),
+
+ // Search Page Strings.
+ 'string-search-nothing-found' => __( 'Nothing Found', 'astra' ),
+ 'string-search-nothing-found-message' => __( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'astra' ),
+ 'string-full-width-search-message' => __( 'Start typing and press enter to search', 'astra' ),
+ 'string-full-width-search-placeholder' => __( 'Search &hellip;', 'astra' ),
+ 'string-header-cover-search-placeholder' => __( 'Search &hellip;', 'astra' ),
+ 'string-search-input-placeholder' => __( 'Search &hellip;', 'astra' ),
+
+ // Comment Template Strings.
+ 'string-comment-reply-link' => __( 'Reply', 'astra' ),
+ 'string-comment-edit-link' => __( 'Edit', 'astra' ),
+ 'string-comment-awaiting-moderation' => __( 'Your comment is awaiting moderation.', 'astra' ),
+ 'string-comment-title-reply' => __( 'Leave a Comment', 'astra' ),
+ 'string-comment-cancel-reply-link' => __( 'Cancel Reply', 'astra' ),
+ 'string-comment-label-submit' => __( 'Post Comment &raquo;', 'astra' ),
+ 'string-comment-label-message' => __( 'Type here..', 'astra' ),
+ 'string-comment-label-name' => __( 'Name*', 'astra' ),
+ 'string-comment-label-email' => __( 'Email*', 'astra' ),
+ 'string-comment-label-website' => __( 'Website', 'astra' ),
+ 'string-comment-closed' => __( 'Comments are closed.', 'astra' ),
+ 'string-comment-navigation-title' => __( 'Comment navigation', 'astra' ),
+ 'string-comment-navigation-next' => __( 'Newer Comments', 'astra' ),
+ 'string-comment-navigation-previous' => __( 'Older Comments', 'astra' ),
+
+ // Blog Default Strings.
+ 'string-blog-page-links-before' => __( 'Pages:', 'astra' ),
+ 'string-blog-meta-author-by' => __( 'By ', 'astra' ),
+ 'string-blog-meta-leave-a-comment' => __( 'Leave a Comment', 'astra' ),
+ 'string-blog-meta-one-comment' => __( '1 Comment', 'astra' ),
+ 'string-blog-meta-multiple-comment' => __( '% Comments', 'astra' ),
+ 'string-blog-navigation-next' => __( 'Next Page', 'astra' ) . ' <span class="ast-right-arrow">&rarr;</span>',
+ 'string-blog-navigation-previous' => '<span class="ast-left-arrow">&larr;</span> ' . __( 'Previous Page', 'astra' ),
+
+ // Single Post Default Strings.
+ 'string-single-page-links-before' => __( 'Pages:', 'astra' ),
+ /* translators: 1: Post type label */
+ 'string-single-navigation-next' => __( 'Next %s', 'astra' ) . ' <span class="ast-right-arrow">&rarr;</span>',
+ /* translators: 1: Post type label */
+ 'string-single-navigation-previous' => '<span class="ast-left-arrow">&larr;</span> ' . __( 'Previous %s', 'astra' ),
+
+ // Content None.
+ 'string-content-nothing-found-message' => __( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'astra' ),
+
+ )
+ );
+
+ if ( is_rtl() ) {
+ $defaults['string-blog-navigation-next'] = __( 'Next Page', 'astra' ) . ' <span class="ast-left-arrow">&larr;</span>';
+ $defaults['string-blog-navigation-previous'] = '<span class="ast-right-arrow">&rarr;</span> ' . __( 'Previous Page', 'astra' );
+
+ /* translators: 1: Post type label */
+ $defaults['string-single-navigation-next'] = __( 'Next %s', 'astra' ) . ' <span class="ast-left-arrow">&larr;</span>';
+ /* translators: 1: Post type label */
+ $defaults['string-single-navigation-previous'] = '<span class="ast-right-arrow">&rarr;</span> ' . __( 'Previous %s', 'astra' );
+ }
+
+ $output = isset( $defaults[ $key ] ) ? $defaults[ $key ] : '';
+
+ /**
+ * Print or return
+ */
+ if ( $echo ) {
+ echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ } else {
+ return $output;
+ }
+ }
+}
diff --git a/inc/core/common-functions.php b/inc/core/common-functions.php
new file mode 100644
index 0000000..3c9ae29
--- /dev/null
+++ b/inc/core/common-functions.php
@@ -0,0 +1,1526 @@
+<?php
+/**
+ * Functions for Astra Theme.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+/**
+ * Foreground Color
+ */
+if ( ! function_exists( 'astra_get_foreground_color' ) ) {
+
+ /**
+ * Foreground Color
+ *
+ * @param string $hex Color code in HEX format.
+ * @return string Return foreground color depend on input HEX color.
+ */
+ function astra_get_foreground_color( $hex ) {
+
+ // bail early if color's not set.
+ if ( 'transparent' == $hex || 'false' == $hex || '#' == $hex || empty( $hex ) ) {
+ return 'transparent';
+ }
+
+ // Get clean hex code.
+ $hex = str_replace( '#', '', $hex );
+
+ if ( 3 == strlen( $hex ) ) {
+ $hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 );
+ }
+
+ if ( strpos( $hex, 'rgba' ) !== false ) {
+
+ $rgba = preg_replace( '/[^0-9,]/', '', $hex );
+ $rgba = explode( ',', $rgba );
+
+ $hex = sprintf( '#%02x%02x%02x', $rgba[0], $rgba[1], $rgba[2] );
+ }
+
+ // Return if non hex.
+ if ( ! ctype_xdigit( $hex ) ) {
+ return $hex;
+ }
+
+ // Get r, g & b codes from hex code.
+ $r = hexdec( substr( $hex, 0, 2 ) );
+ $g = hexdec( substr( $hex, 2, 2 ) );
+ $b = hexdec( substr( $hex, 4, 2 ) );
+ $hex = ( ( $r * 299 ) + ( $g * 587 ) + ( $b * 114 ) ) / 1000;
+
+ return 128 <= $hex ? '#000000' : '#ffffff';
+ }
+}
+
+/**
+ * Generate CSS
+ */
+if ( ! function_exists( 'astra_css' ) ) {
+
+ /**
+ * Generate CSS
+ *
+ * @param mixed $value CSS value.
+ * @param string $css_property CSS property.
+ * @param string $selector CSS selector.
+ * @param string $unit CSS property unit.
+ * @return void Echo generated CSS.
+ */
+ function astra_css( $value = '', $css_property = '', $selector = '', $unit = '' ) {
+
+ if ( $selector ) {
+ if ( $css_property && $value ) {
+
+ if ( '' != $unit ) {
+ $value .= $unit;
+ }
+
+ $css = $selector;
+ $css .= '{';
+ $css .= ' ' . $css_property . ': ' . $value . ';';
+ $css .= '}';
+
+ echo $css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ }
+ }
+ }
+}
+
+/**
+ * Get Font Size value
+ */
+if ( ! function_exists( 'astra_responsive_font' ) ) {
+
+ /**
+ * Get Font CSS value
+ *
+ * @param array $font CSS value.
+ * @param string $device CSS device.
+ * @param string $default Default value.
+ * @return mixed
+ */
+ function astra_responsive_font( $font, $device = 'desktop', $default = '' ) {
+
+ if ( isset( $font[ $device ] ) && isset( $font[ $device . '-unit' ] ) ) {
+ if ( '' != $default ) {
+ $font_size = astra_get_css_value( $font[ $device ], $font[ $device . '-unit' ], $default );
+ } else {
+ $font_size = astra_get_font_css_value( $font[ $device ], $font[ $device . '-unit' ] );
+ }
+ } elseif ( is_numeric( $font ) ) {
+ $font_size = astra_get_css_value( $font );
+ } else {
+ $font_size = ( ! is_array( $font ) ) ? $font : '';
+ }
+
+ return $font_size;
+ }
+}
+
+/**
+ * Get Font Size value
+ */
+if ( ! function_exists( 'astra_get_font_css_value' ) ) {
+
+ /**
+ * Get Font CSS value
+ *
+ * Syntax:
+ *
+ * astra_get_font_css_value( VALUE, DEVICE, UNIT );
+ *
+ * E.g.
+ *
+ * astra_get_css_value( VALUE, 'desktop', '%' );
+ * astra_get_css_value( VALUE, 'tablet' );
+ * astra_get_css_value( VALUE, 'mobile' );
+ *
+ * @param string $value CSS value.
+ * @param string $unit CSS unit.
+ * @param string $device CSS device.
+ * @return mixed CSS value depends on $unit & $device
+ */
+ function astra_get_font_css_value( $value, $unit = 'px', $device = 'desktop' ) {
+
+ // If value is empty or 0 then return blank.
+ if ( '' == $value || 0 == $value ) {
+ return '';
+ }
+
+ $css_val = '';
+
+ switch ( $unit ) {
+ case 'em':
+ case '%':
+ $css_val = esc_attr( $value ) . $unit;
+ break;
+
+ case 'px':
+ if ( is_numeric( $value ) || strpos( $value, 'px' ) ) {
+ $value = intval( $value );
+ $fonts = array();
+ $body_font_size = astra_get_option( 'font-size-body' );
+ $fonts['desktop'] = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15;
+ $fonts['tablet'] = ( isset( $body_font_size['tablet'] ) && '' != $body_font_size['tablet'] ) ? $body_font_size['tablet'] : $fonts['desktop'];
+ $fonts['mobile'] = ( isset( $body_font_size['mobile'] ) && '' != $body_font_size['mobile'] ) ? $body_font_size['mobile'] : $fonts['tablet'];
+
+ if ( $fonts[ $device ] ) {
+ $css_val = esc_attr( $value ) . 'px;font-size:' . ( esc_attr( $value ) / esc_attr( $fonts[ $device ] ) ) . 'rem';
+ }
+ } else {
+ $css_val = esc_attr( $value );
+ }
+ }
+
+ return $css_val;
+ }
+}
+
+/**
+ * Get Font family
+ */
+if ( ! function_exists( 'astra_get_font_family' ) ) {
+
+ /**
+ * Get Font family
+ *
+ * Syntax:
+ *
+ * astra_get_font_family( VALUE, DEFAULT );
+ *
+ * E.g.
+ * astra_get_font_family( VALUE, '' );
+ *
+ * @since 1.0.19
+ *
+ * @param string $value CSS value.
+ * @return mixed CSS value depends on $unit
+ */
+ function astra_get_font_family( $value = '' ) {
+ $system_fonts = Astra_Font_Families::get_system_fonts();
+ if ( isset( $system_fonts[ $value ] ) && isset( $system_fonts[ $value ]['fallback'] ) ) {
+ $value .= ',' . $system_fonts[ $value ]['fallback'];
+ }
+
+ return $value;
+ }
+}
+
+
+/**
+ * Get CSS value
+ */
+if ( ! function_exists( 'astra_get_css_value' ) ) {
+
+ /**
+ * Get CSS value
+ *
+ * Syntax:
+ *
+ * astra_get_css_value( VALUE, UNIT );
+ *
+ * E.g.
+ *
+ * astra_get_css_value( VALUE, 'url' );
+ * astra_get_css_value( VALUE, 'px' );
+ * astra_get_css_value( VALUE, 'em' );
+ *
+ * @param string $value CSS value.
+ * @param string $unit CSS unit.
+ * @param string $default CSS default font.
+ * @return mixed CSS value depends on $unit
+ */
+ function astra_get_css_value( $value = '', $unit = 'px', $default = '' ) {
+
+ if ( '' == $value && '' == $default ) {
+ return $value;
+ }
+
+ $css_val = '';
+
+ switch ( $unit ) {
+
+ case 'font':
+ if ( 'inherit' != $value ) {
+ $value = astra_get_font_family( $value );
+ $css_val = $value;
+ } elseif ( '' != $default ) {
+ $css_val = $default;
+ } else {
+ $css_val = '';
+ }
+ break;
+
+ case 'px':
+ case '%':
+ if ( 'inherit' === strtolower( $value ) || 'inherit' === strtolower( $default ) ) {
+ return $value;
+ }
+
+ $value = ( '' != $value ) ? $value : $default;
+ $css_val = esc_attr( $value ) . $unit;
+ break;
+
+ case 'url':
+ $css_val = $unit . '(' . esc_url( $value ) . ')';
+ break;
+
+ case 'rem':
+ if ( 'inherit' === strtolower( $value ) || 'inherit' === strtolower( $default ) ) {
+ return $value;
+ }
+ if ( is_numeric( $value ) || strpos( $value, 'px' ) ) {
+ $value = intval( $value );
+ $body_font_size = astra_get_option( 'font-size-body' );
+ if ( is_array( $body_font_size ) ) {
+ $body_font_size_desktop = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15;
+ } else {
+ $body_font_size_desktop = ( '' != $body_font_size ) ? $body_font_size : 15;
+ }
+
+ if ( $body_font_size_desktop ) {
+ $css_val = esc_attr( $value ) . 'px;font-size:' . ( esc_attr( $value ) / esc_attr( $body_font_size_desktop ) ) . $unit;
+ }
+ } else {
+ $css_val = esc_attr( $value );
+ }
+
+ break;
+
+ default:
+ $value = ( '' != $value ) ? $value : $default;
+ if ( '' != $value ) {
+ $css_val = esc_attr( $value ) . $unit;
+ }
+ }
+
+ return $css_val;
+ }
+}
+
+/**
+ * Adjust the background obj.
+ */
+if ( ! function_exists( 'astra_get_background_obj' ) ) {
+
+ /**
+ * Adjust Brightness
+ *
+ * @param array $bg_obj Color code in HEX.
+ *
+ * @return array Color code in HEX.
+ */
+ function astra_get_background_obj( $bg_obj ) {
+
+ $gen_bg_css = array();
+
+ $bg_img = isset( $bg_obj['background-image'] ) ? $bg_obj['background-image'] : '';
+ $bg_color = isset( $bg_obj['background-color'] ) ? $bg_obj['background-color'] : '';
+ $bg_type = isset( $bg_obj['background-type'] ) ? $bg_obj['background-type'] : '';
+
+ if ( '' !== $bg_type ) {
+ switch ( $bg_type ) {
+ case 'color':
+ if ( '' !== $bg_img && '' !== $bg_color ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');';
+ } elseif ( '' === $bg_img ) {
+ $gen_bg_css['background-color'] = $bg_color . ';';
+ }
+ break;
+
+ case 'image':
+ if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');';
+ }
+ if ( '' === $bg_color || is_numeric( strpos( $bg_color, 'linear-gradient' ) ) || is_numeric( strpos( $bg_color, 'radial-gradient' ) ) && '' !== $bg_img ) {
+ $gen_bg_css['background-image'] = 'url(' . $bg_img . ');';
+ }
+ break;
+
+ case 'gradient':
+ if ( isset( $bg_color ) ) {
+ $gen_bg_css['background-image'] = $bg_color . ';';
+ }
+ break;
+
+ default:
+ break;
+ }
+ } elseif ( '' !== $bg_color ) {
+ $gen_bg_css['background-color'] = $bg_color . ';';
+ }
+
+ if ( '' !== $bg_img ) {
+ if ( isset( $bg_obj['background-repeat'] ) ) {
+ $gen_bg_css['background-repeat'] = esc_attr( $bg_obj['background-repeat'] );
+ }
+
+ if ( isset( $bg_obj['background-position'] ) ) {
+ $gen_bg_css['background-position'] = esc_attr( $bg_obj['background-position'] );
+ }
+
+ if ( isset( $bg_obj['background-size'] ) ) {
+ $gen_bg_css['background-size'] = esc_attr( $bg_obj['background-size'] );
+ }
+
+ if ( isset( $bg_obj['background-attachment'] ) ) {
+ $gen_bg_css['background-attachment'] = esc_attr( $bg_obj['background-attachment'] );
+ }
+ }
+
+ return $gen_bg_css;
+ }
+}
+
+/**
+ * Parse CSS
+ */
+if ( ! function_exists( 'astra_parse_css' ) ) {
+
+ /**
+ * Parse CSS
+ *
+ * @param array $css_output Array of CSS.
+ * @param string $min_media Min Media breakpoint.
+ * @param string $max_media Max Media breakpoint.
+ * @return string Generated CSS.
+ */
+ function astra_parse_css( $css_output = array(), $min_media = '', $max_media = '' ) {
+
+ $parse_css = '';
+ if ( is_array( $css_output ) && count( $css_output ) > 0 ) {
+
+ foreach ( $css_output as $selector => $properties ) {
+
+ if ( null === $properties ) {
+ break;
+ }
+
+ if ( ! count( $properties ) ) {
+ continue;
+ }
+
+ $temp_parse_css = $selector . '{';
+ $properties_added = 0;
+
+ foreach ( $properties as $property => $value ) {
+
+ if ( '' == $value && 0 !== $value ) {
+ continue;
+ }
+
+ $properties_added++;
+ $temp_parse_css .= $property . ':' . $value . ';';
+ }
+
+ $temp_parse_css .= '}';
+
+ if ( $properties_added > 0 ) {
+ $parse_css .= $temp_parse_css;
+ }
+ }
+
+ if ( '' != $parse_css && ( '' !== $min_media || '' !== $max_media ) ) {
+
+ $media_css = '@media ';
+ $min_media_css = '';
+ $max_media_css = '';
+ $media_separator = '';
+
+ if ( '' !== $min_media ) {
+ $min_media_css = '(min-width:' . $min_media . 'px)';
+ }
+ if ( '' !== $max_media ) {
+ $max_media_css = '(max-width:' . $max_media . 'px)';
+ }
+ if ( '' !== $min_media && '' !== $max_media ) {
+ $media_separator = ' and ';
+ }
+
+ $media_css .= $min_media_css . $media_separator . $max_media_css . '{' . $parse_css . '}';
+
+ return $media_css;
+ }
+ }
+
+ return $parse_css;
+ }
+}
+
+/**
+ * Return Theme options.
+ */
+if ( ! function_exists( 'astra_get_option' ) ) {
+
+ /**
+ * Return Theme options.
+ *
+ * @param string $option Option key.
+ * @param string $default Option default value.
+ * @param string $deprecated Option default value.
+ * @return Mixed Return option value.
+ */
+ function astra_get_option( $option, $default = '', $deprecated = '' ) {
+
+ if ( '' != $deprecated ) {
+ $default = $deprecated;
+ }
+
+ $theme_options = Astra_Theme_Options::get_options();
+
+ /**
+ * Filter the options array for Astra Settings.
+ *
+ * @since 1.0.20
+ * @var Array
+ */
+ $theme_options = apply_filters( 'astra_get_option_array', $theme_options, $option, $default );
+
+ $value = ( isset( $theme_options[ $option ] ) && '' !== $theme_options[ $option ] ) ? $theme_options[ $option ] : $default;
+
+ /**
+ * Dynamic filter astra_get_option_$option.
+ * $option is the name of the Astra Setting, Refer Astra_Theme_Options::defaults() for option names from the theme.
+ *
+ * @since 1.0.20
+ * @var Mixed.
+ */
+ return apply_filters( "astra_get_option_{$option}", $value, $option, $default );
+ }
+}
+
+if ( ! function_exists( 'astra_update_option' ) ) {
+
+ /**
+ * Update Theme options.
+ *
+ * @param string $option option key.
+ * @param Mixed $value option value.
+ * @return void
+ */
+ function astra_update_option( $option, $value ) {
+
+ do_action( "astra_before_update_option_{$option}", $value, $option );
+
+ // Get all customizer options.
+ $theme_options = get_option( ASTRA_THEME_SETTINGS );
+
+ // Update value in options array.
+ $theme_options[ $option ] = $value;
+
+ update_option( ASTRA_THEME_SETTINGS, $theme_options );
+
+ do_action( "astra_after_update_option_{$option}", $value, $option );
+ }
+}
+
+if ( ! function_exists( 'astra_delete_option' ) ) {
+
+ /**
+ * Update Theme options.
+ *
+ * @param string $option option key.
+ * @return void
+ */
+ function astra_delete_option( $option ) {
+
+ do_action( "astra_before_delete_option_{$option}", $option );
+
+ // Get all customizer options.
+ $theme_options = get_option( ASTRA_THEME_SETTINGS );
+
+ // Update value in options array.
+ unset( $theme_options[ $option ] );
+
+ update_option( ASTRA_THEME_SETTINGS, $theme_options );
+
+ do_action( "astra_after_delete_option_{$option}", $option );
+ }
+}
+
+/**
+ * Return Theme options from postmeta.
+ */
+if ( ! function_exists( 'astra_get_option_meta' ) ) {
+
+ /**
+ * Return Theme options from postmeta.
+ *
+ * @param string $option_id Option ID.
+ * @param string $default Option default value.
+ * @param boolean $only_meta Get only meta value.
+ * @param string $extension Is value from extension.
+ * @param string $post_id Get value from specific post by post ID.
+ * @return Mixed Return option value.
+ */
+ function astra_get_option_meta( $option_id, $default = '', $only_meta = false, $extension = '', $post_id = '' ) {
+
+ $post_id = ( '' != $post_id ) ? $post_id : astra_get_post_id();
+
+ $value = astra_get_option( $option_id, $default );
+
+ // Get value from option 'post-meta'.
+ if ( is_singular() || ( is_home() && ! is_front_page() ) ) {
+
+ $value = get_post_meta( $post_id, $option_id, true );
+
+ if ( empty( $value ) || 'default' == $value ) {
+
+ if ( true === $only_meta ) {
+ return false;
+ }
+
+ $value = astra_get_option( $option_id, $default );
+ }
+ }
+
+ /**
+ * Dynamic filter astra_get_option_meta_$option.
+ * $option_id is the name of the Astra Meta Setting.
+ *
+ * @since 1.0.20
+ * @var Mixed.
+ */
+ return apply_filters( "astra_get_option_meta_{$option_id}", $value, $default, $default );
+ }
+}
+
+/**
+ * Helper function to get the current post id.
+ */
+if ( ! function_exists( 'astra_get_post_id' ) ) {
+
+ /**
+ * Get post ID.
+ *
+ * @param string $post_id_override Get override post ID.
+ * @return number Post ID.
+ */
+ function astra_get_post_id( $post_id_override = '' ) {
+
+ if ( null == Astra_Theme_Options::$post_id ) {
+ global $post;
+
+ $post_id = 0;
+
+ if ( is_home() ) {
+ $post_id = get_option( 'page_for_posts' );
+ } elseif ( is_archive() ) {
+ global $wp_query;
+ $post_id = $wp_query->get_queried_object_id();
+ } elseif ( isset( $post->ID ) && ! is_search() && ! is_category() ) {
+ $post_id = $post->ID;
+ }
+
+ Astra_Theme_Options::$post_id = $post_id;
+ }
+
+ return apply_filters( 'astra_get_post_id', Astra_Theme_Options::$post_id, $post_id_override );
+ }
+}
+
+
+/**
+ * Display classes for primary div
+ */
+if ( ! function_exists( 'astra_primary_class' ) ) {
+
+ /**
+ * Display classes for primary div
+ *
+ * @param string|array $class One or more classes to add to the class list.
+ * @return void Echo classes.
+ */
+ function astra_primary_class( $class = '' ) {
+
+ // Separates classes with a single space, collates classes for body element.
+ echo 'class="' . esc_attr( join( ' ', astra_get_primary_class( $class ) ) ) . '"';
+ }
+}
+
+/**
+ * Retrieve the classes for the primary element as an array.
+ */
+if ( ! function_exists( 'astra_get_primary_class' ) ) {
+
+ /**
+ * Retrieve the classes for the primary element as an array.
+ *
+ * @param string|array $class One or more classes to add to the class list.
+ * @return array Return array of classes.
+ */
+ function astra_get_primary_class( $class = '' ) {
+
+ // array of class names.
+ $classes = array();
+
+ // default class for content area.
+ $classes[] = 'content-area';
+
+ // primary base class.
+ $classes[] = 'primary';
+
+ if ( ! empty( $class ) ) {
+ if ( ! is_array( $class ) ) {
+ $class = preg_split( '#\s+#', $class );
+ }
+ $classes = array_merge( $classes, $class );
+ } else {
+
+ // Ensure that we always coerce class to being an array.
+ $class = array();
+ }
+
+ // Filter primary div class names.
+ $classes = apply_filters( 'astra_primary_class', $classes, $class );
+
+ $classes = array_map( 'sanitize_html_class', $classes );
+
+ return array_unique( $classes );
+ }
+}
+
+/**
+ * Display classes for secondary div
+ */
+if ( ! function_exists( 'astra_secondary_class' ) ) {
+
+ /**
+ * Retrieve the classes for the secondary element as an array.
+ *
+ * @param string|array $class One or more classes to add to the class list.
+ * @return void echo classes.
+ */
+ function astra_secondary_class( $class = '' ) {
+
+ // Separates classes with a single space, collates classes for body element.
+ echo 'class="' . esc_attr( join( ' ', astra_get_secondary_class( $class ) ) ) . '"';
+ }
+}
+
+/**
+ * Retrieve the classes for the secondary element as an array.
+ */
+if ( ! function_exists( 'astra_get_secondary_class' ) ) {
+
+ /**
+ * Retrieve the classes for the secondary element as an array.
+ *
+ * @param string|array $class One or more classes to add to the class list.
+ * @return array Return array of classes.
+ */
+ function astra_get_secondary_class( $class = '' ) {
+
+ // array of class names.
+ $classes = array();
+
+ // default class from widget area.
+ $classes[] = 'widget-area';
+
+ // secondary base class.
+ $classes[] = 'secondary';
+
+ if ( ! empty( $class ) ) {
+ if ( ! is_array( $class ) ) {
+ $class = preg_split( '#\s+#', $class );
+ }
+ $classes = array_merge( $classes, $class );
+ } else {
+
+ // Ensure that we always coerce class to being an array.
+ $class = array();
+ }
+
+ // Filter secondary div class names.
+ $classes = apply_filters( 'astra_secondary_class', $classes, $class );
+
+ $classes = array_map( 'sanitize_html_class', $classes );
+
+ return array_unique( $classes );
+ }
+}
+
+/**
+ * Get post format
+ */
+if ( ! function_exists( 'astra_get_post_format' ) ) {
+
+ /**
+ * Get post format
+ *
+ * @param string $post_format_override Override post formate.
+ * @return string Return post format.
+ */
+ function astra_get_post_format( $post_format_override = '' ) {
+
+ if ( ( is_home() ) || is_archive() ) {
+ $post_format = 'blog';
+ } else {
+ $post_format = get_post_format();
+ }
+
+ return apply_filters( 'astra_get_post_format', $post_format, $post_format_override );
+ }
+}
+
+/**
+ * Wrapper function for get_the_title() for blog post.
+ */
+if ( ! function_exists( 'astra_the_post_title' ) ) {
+
+ /**
+ * Wrapper function for get_the_title() for blog post.
+ *
+ * Displays title only if the page title bar is disabled.
+ *
+ * @since 1.0.15
+ * @param string $before Optional. Content to prepend to the title.
+ * @param string $after Optional. Content to append to the title.
+ * @param int $post_id Optional, default to 0. Post id.
+ * @param bool $echo Optional, default to true.Whether to display or return.
+ * @return string|void String if $echo parameter is false.
+ */
+ function astra_the_post_title( $before = '', $after = '', $post_id = 0, $echo = true ) {
+
+ $enabled = apply_filters( 'astra_the_post_title_enabled', true );
+ if ( $enabled ) {
+
+ $title = astra_get_the_title( $post_id );
+ $before = apply_filters( 'astra_the_post_title_before', $before );
+ $after = apply_filters( 'astra_the_post_title_after', $after );
+
+ // This will work same as `the_title` function but with Custom Title if exits.
+ if ( $echo ) {
+ echo $before . $title . $after; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ } else {
+ return $before . $title . $after;
+ }
+ }
+ }
+}
+
+/**
+ * Wrapper function for the_title()
+ */
+if ( ! function_exists( 'astra_the_title' ) ) {
+
+ /**
+ * Wrapper function for the_title()
+ *
+ * Displays title only if the page title bar is disabled.
+ *
+ * @param string $before Optional. Content to prepend to the title.
+ * @param string $after Optional. Content to append to the title.
+ * @param int $post_id Optional, default to 0. Post id.
+ * @param bool $echo Optional, default to true.Whether to display or return.
+ * @return string|void String if $echo parameter is false.
+ */
+ function astra_the_title( $before = '', $after = '', $post_id = 0, $echo = true ) {
+
+ $title = '';
+ $blog_post_title = astra_get_option( 'blog-post-structure' );
+ $single_post_title = astra_get_option( 'blog-single-post-structure' );
+
+ if ( ( ! is_singular() && in_array( 'title-meta', $blog_post_title ) ) || ( is_single() && in_array( 'single-title-meta', $single_post_title ) ) || is_page() ) {
+ if ( apply_filters( 'astra_the_title_enabled', true ) ) {
+
+ $title = astra_get_the_title( $post_id );
+ $before = apply_filters( 'astra_the_title_before', $before );
+ $after = apply_filters( 'astra_the_title_after', $after );
+
+ $title = $before . $title . $after;
+ }
+ }
+
+ // This will work same as `the_title` function but with Custom Title if exits.
+ if ( $echo ) {
+ echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ } else {
+ return $title;
+ }
+ }
+}
+
+/**
+ * Wrapper function for get_the_title()
+ */
+if ( ! function_exists( 'astra_get_the_title' ) ) {
+
+ /**
+ * Wrapper function for get_the_title()
+ *
+ * Return title for Title Bar and Normal Title.
+ *
+ * @param int $post_id Optional, default to 0. Post id.
+ * @param bool $echo Optional, default to false. Whether to display or return.
+ * @return string|void String if $echo parameter is false.
+ */
+ function astra_get_the_title( $post_id = 0, $echo = false ) {
+
+ $title = '';
+ if ( $post_id || is_singular() ) {
+ $title = get_the_title( $post_id );
+ } else {
+ if ( is_front_page() && is_home() ) {
+ // Default homepage.
+ $title = apply_filters( 'astra_the_default_home_page_title', esc_html__( 'Home', 'astra' ) );
+ } elseif ( is_home() ) {
+ // blog page.
+ $title = apply_filters( 'astra_the_blog_home_page_title', get_the_title( get_option( 'page_for_posts', true ) ) );
+ } elseif ( is_404() ) {
+ // for 404 page - title always display.
+ $title = apply_filters( 'astra_the_404_page_title', esc_html__( 'This page doesn\'t seem to exist.', 'astra' ) );
+
+ // for search page - title always display.
+ } elseif ( is_search() ) {
+
+ /* translators: 1: search string */
+ $title = apply_filters( 'astra_the_search_page_title', sprintf( __( 'Search Results for: %s', 'astra' ), '<span>' . get_search_query() . '</span>' ) );
+
+ } elseif ( class_exists( 'WooCommerce' ) && is_shop() ) {
+
+ $title = woocommerce_page_title( false );
+
+ } elseif ( is_archive() ) {
+
+ $title = get_the_archive_title();
+
+ }
+ }
+
+ $title = apply_filters( 'astra_the_title', $title, $post_id );
+
+ // This will work same as `get_the_title` function but with Custom Title if exits.
+ if ( $echo ) {
+ echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ } else {
+ return $title;
+ }
+ }
+}
+
+/**
+ * Archive Page Title
+ */
+if ( ! function_exists( 'astra_archive_page_info' ) ) {
+
+ /**
+ * Wrapper function for the_title()
+ *
+ * Displays title only if the page title bar is disabled.
+ */
+ function astra_archive_page_info() {
+
+ if ( apply_filters( 'astra_the_title_enabled', true ) ) {
+
+ // Author.
+ if ( is_author() ) { ?>
+
+ <section class="ast-author-box ast-archive-description">
+ <div class="ast-author-bio">
+ <?php do_action( 'astra_before_archive_title' ); ?>
+ <h1 class='page-title ast-archive-title'><?php echo get_the_author(); ?></h1>
+ <?php do_action( 'astra_after_archive_title' ); ?>
+ <p><?php echo wp_kses_post( get_the_author_meta( 'description' ) ); ?></p>
+ <?php do_action( 'astra_after_archive_description' ); ?>
+ </div>
+ <div class="ast-author-avatar">
+ <?php echo get_avatar( get_the_author_meta( 'email' ), 120 ); ?>
+ </div>
+ </section>
+
+ <?php
+
+ // Category.
+ } elseif ( is_category() ) {
+ ?>
+
+ <section class="ast-archive-description">
+ <?php do_action( 'astra_before_archive_title' ); ?>
+ <h1 class="page-title ast-archive-title"><?php echo single_cat_title(); ?></h1>
+ <?php do_action( 'astra_after_archive_title' ); ?>
+ <?php echo wp_kses_post( wpautop( get_the_archive_description() ) ); ?>
+ <?php do_action( 'astra_after_archive_description' ); ?>
+ </section>
+
+ <?php
+
+ // Tag.
+ } elseif ( is_tag() ) {
+ ?>
+
+ <section class="ast-archive-description">
+ <?php do_action( 'astra_before_archive_title' ); ?>
+ <h1 class="page-title ast-archive-title"><?php echo single_tag_title(); ?></h1>
+ <?php do_action( 'astra_after_archive_title' ); ?>
+ <?php echo wp_kses_post( wpautop( get_the_archive_description() ) ); ?>
+ <?php do_action( 'astra_after_archive_description' ); ?>
+ </section>
+
+ <?php
+
+ // Search.
+ } elseif ( is_search() ) {
+ ?>
+
+ <section class="ast-archive-description">
+ <?php do_action( 'astra_before_archive_title' ); ?>
+ <?php
+ /* translators: 1: search string */
+ $title = apply_filters( 'astra_the_search_page_title', sprintf( __( 'Search Results for: %s', 'astra' ), '<span>' . get_search_query() . '</span>' ) );
+ ?>
+ <h1 class="page-title ast-archive-title"> <?php echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> </h1>
+ <?php do_action( 'astra_after_archive_title' ); ?>
+ </section>
+
+ <?php
+
+ // Other.
+ } else {
+ ?>
+
+ <section class="ast-archive-description">
+ <?php do_action( 'astra_before_archive_title' ); ?>
+ <?php the_archive_title( '<h1 class="page-title ast-archive-title">', '</h1>' ); ?>
+ <?php do_action( 'astra_after_archive_title' ); ?>
+ <?php echo wp_kses_post( wpautop( get_the_archive_description() ) ); ?>
+ <?php do_action( 'astra_after_archive_description' ); ?>
+ </section>
+
+ <?php
+ }
+ }
+ }
+
+ add_action( 'astra_archive_header', 'astra_archive_page_info' );
+}
+
+/**
+ * Adjust the HEX color brightness
+ */
+if ( ! function_exists( 'astra_adjust_brightness' ) ) {
+
+ /**
+ * Adjust Brightness
+ *
+ * @param string $hex Color code in HEX.
+ * @param number $steps brightness value.
+ * @param string $type brightness is reverse or default.
+ * @return string Color code in HEX.
+ */
+ function astra_adjust_brightness( $hex, $steps, $type ) {
+
+ // Get rgb vars.
+ $hex = str_replace( '#', '', $hex );
+
+ // Return if non hex.
+ if ( ! ctype_xdigit( $hex ) ) {
+ return $hex;
+ }
+
+ $shortcode_atts = array(
+ 'r' => hexdec( substr( $hex, 0, 2 ) ),
+ 'g' => hexdec( substr( $hex, 2, 2 ) ),
+ 'b' => hexdec( substr( $hex, 4, 2 ) ),
+ );
+
+ // Should we darken the color?
+ if ( 'reverse' == $type && $shortcode_atts['r'] + $shortcode_atts['g'] + $shortcode_atts['b'] > 382 ) {
+ $steps = -$steps;
+ } elseif ( 'darken' == $type ) {
+ $steps = -$steps;
+ }
+
+ // Build the new color.
+ $steps = max( -255, min( 255, $steps ) );
+
+ $shortcode_atts['r'] = max( 0, min( 255, $shortcode_atts['r'] + $steps ) );
+ $shortcode_atts['g'] = max( 0, min( 255, $shortcode_atts['g'] + $steps ) );
+ $shortcode_atts['b'] = max( 0, min( 255, $shortcode_atts['b'] + $steps ) );
+
+ $r_hex = str_pad( dechex( $shortcode_atts['r'] ), 2, '0', STR_PAD_LEFT );
+ $g_hex = str_pad( dechex( $shortcode_atts['g'] ), 2, '0', STR_PAD_LEFT );
+ $b_hex = str_pad( dechex( $shortcode_atts['b'] ), 2, '0', STR_PAD_LEFT );
+
+ return '#' . $r_hex . $g_hex . $b_hex;
+ }
+} // End if.
+
+/**
+ * Convert colors from HEX to RGBA
+ */
+if ( ! function_exists( 'astra_hex_to_rgba' ) ) :
+
+ /**
+ * Convert colors from HEX to RGBA
+ *
+ * @param string $color Color code in HEX.
+ * @param boolean $opacity Color code opacity.
+ * @return string Color code in RGB or RGBA.
+ */
+ function astra_hex_to_rgba( $color, $opacity = false ) {
+
+ $default = 'rgb(0,0,0)';
+
+ // Return default if no color provided.
+ if ( empty( $color ) ) {
+ return $default;
+ }
+
+ // Sanitize $color if "#" is provided.
+ if ( '#' == $color[0] ) {
+ $color = substr( $color, 1 );
+ }
+
+ // Check if color has 6 or 3 characters and get values.
+ if ( 6 == strlen( $color ) ) {
+ $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
+ } elseif ( 3 == strlen( $color ) ) {
+ $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
+ } else {
+ return $default;
+ }
+
+ // Convert HEX to RGB.
+ $rgb = array_map( 'hexdec', $hex );
+
+ // Check if opacity is set(RGBA or RGB).
+ if ( $opacity ) {
+ if ( 1 < abs( $opacity ) ) {
+ $opacity = 1.0;
+ }
+ $output = 'rgba(' . implode( ',', $rgb ) . ',' . $opacity . ')';
+ } else {
+ $output = 'rgb(' . implode( ',', $rgb ) . ')';
+ }
+
+ // Return RGB(a) color string.
+ return $output;
+ }
+
+endif;
+
+
+if ( ! function_exists( 'astra_enable_page_builder_compatibility' ) ) :
+
+ /**
+ * Allow filter to enable/disable page builder compatibility.
+ *
+ * @see https://wpastra.com/docs/recommended-settings-beaver-builder-astra/
+ * @see https://wpastra.com/docs/recommended-settings-for-elementor/
+ *
+ * @since 1.2.2
+ * @return bool True - If the page builder compatibility is enabled. False - IF the page builder compatibility is disabled.
+ */
+ function astra_enable_page_builder_compatibility() {
+ return apply_filters( 'astra_enable_page_builder_compatibility', true );
+ }
+
+endif;
+
+
+if ( ! function_exists( 'astra_get_pro_url' ) ) :
+ /**
+ * Returns an URL with utm tags
+ * the admin settings page.
+ *
+ * @param string $url URL fo the site.
+ * @param string $source utm source.
+ * @param string $medium utm medium.
+ * @param string $campaign utm campaign.
+ * @return mixed
+ */
+ function astra_get_pro_url( $url, $source = '', $medium = '', $campaign = '' ) {
+
+ $astra_pro_url = trailingslashit( $url );
+
+ // Set up our URL if we have a source.
+ if ( isset( $source ) ) {
+ $astra_pro_url = add_query_arg( 'utm_source', sanitize_text_field( $source ), $url );
+ }
+ // Set up our URL if we have a medium.
+ if ( isset( $medium ) ) {
+ $astra_pro_url = add_query_arg( 'utm_medium', sanitize_text_field( $medium ), $url );
+ }
+ // Set up our URL if we have a campaign.
+ if ( isset( $campaign ) ) {
+ $astra_pro_url = add_query_arg( 'utm_campaign', sanitize_text_field( $campaign ), $url );
+ }
+
+ return esc_url( apply_filters( 'astra_get_pro_url', $astra_pro_url, $url ) );
+ }
+
+endif;
+
+
+/**
+ * Search Form
+ */
+if ( ! function_exists( 'astra_get_search_form' ) ) :
+ /**
+ * Display search form.
+ *
+ * @param bool $echo Default to echo and not return the form.
+ * @return string|void String when $echo is false.
+ */
+ function astra_get_search_form( $echo = true ) {
+
+ $form = get_search_form(
+ array(
+ 'input_placeholder' => apply_filters( 'astra_search_field_placeholder', esc_attr_x( 'Search &hellip;', 'placeholder', 'astra' ) ),
+ 'data_attributes' => apply_filters( 'astra_search_field_toggle_data_attrs', '' ),
+ 'input_value' => get_search_query(),
+ 'show_input_submit' => false,
+ )
+ );
+
+ /**
+ * Filters the HTML output of the search form.
+ *
+ * @param string $form The search form HTML output.
+ */
+ $result = apply_filters( 'astra_get_search_form', $form );
+
+ if ( null === $result ) {
+ $result = $form;
+ }
+
+ if ( $echo ) {
+ echo $result; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ } else {
+ return $result;
+ }
+ }
+
+endif;
+
+/**
+ * Check if we're being delivered AMP
+ *
+ * @return bool
+ */
+function astra_is_amp_endpoint() {
+ return function_exists( 'is_amp_endpoint' ) && is_amp_endpoint();
+}
+
+/*
+ * Get Responsive Spacing
+ */
+if ( ! function_exists( 'astra_responsive_spacing' ) ) {
+
+ /**
+ * Get Spacing value
+ *
+ * @param array $option CSS value.
+ * @param string $side top | bottom | left | right.
+ * @param string $device CSS device.
+ * @param string $default Default value.
+ * @param string $prefix Prefix value.
+ * @return mixed
+ */
+ function astra_responsive_spacing( $option, $side = '', $device = 'desktop', $default = '', $prefix = '' ) {
+
+ if ( isset( $option[ $device ][ $side ] ) && isset( $option[ $device . '-unit' ] ) ) {
+ $spacing = astra_get_css_value( $option[ $device ][ $side ], $option[ $device . '-unit' ], $default );
+ } elseif ( is_numeric( $option ) ) {
+ $spacing = astra_get_css_value( $option );
+ } else {
+ $spacing = ( ! is_array( $option ) ) ? $option : '';
+ }
+
+ if ( '' !== $prefix && '' !== $spacing ) {
+ return $prefix . $spacing;
+ }
+ return $spacing;
+ }
+}
+
+/**
+ * Get the tablet breakpoint value.
+ *
+ * @param string $min min.
+ * @param string $max max.
+ *
+ * @since 2.4.0
+ *
+ * @return number $breakpoint.
+ */
+function astra_get_tablet_breakpoint( $min = '', $max = '' ) {
+
+ $update_breakpoint = astra_get_option( 'can-update-theme-tablet-breakpoint', true );
+
+ // Change default for new users.
+ $default = ( true === $update_breakpoint ) ? 921 : 768;
+
+ $header_breakpoint = apply_filters( 'astra_tablet_breakpoint', $default );
+
+ if ( '' !== $min ) {
+ $header_breakpoint = $header_breakpoint - $min;
+ } elseif ( '' !== $max ) {
+ $header_breakpoint = $header_breakpoint + $max;
+ }
+
+ return absint( $header_breakpoint );
+}
+
+/**
+ * Get the mobile breakpoint value.
+ *
+ * @param string $min min.
+ * @param string $max max.
+ *
+ * @since 2.4.0
+ *
+ * @return number header_breakpoint.
+ */
+function astra_get_mobile_breakpoint( $min = '', $max = '' ) {
+
+ $header_breakpoint = apply_filters( 'astra_mobile_breakpoint', 544 );
+
+ if ( '' !== $min ) {
+ $header_breakpoint = $header_breakpoint - $min;
+ } elseif ( '' !== $max ) {
+ $header_breakpoint = $header_breakpoint + $max;
+ }
+
+ return absint( $header_breakpoint );
+}
+
+/*
+ * Apply CSS for the element
+ */
+if ( ! function_exists( 'astra_color_responsive_css' ) ) {
+
+ /**
+ * Astra Responsive Colors
+ *
+ * @param array $setting Responsive colors.
+ * @param string $css_property CSS property.
+ * @param string $selector CSS selector.
+ * @return string Dynamic responsive CSS.
+ */
+ function astra_color_responsive_css( $setting, $css_property, $selector ) {
+ $css = '';
+ if ( isset( $setting['desktop'] ) && ! empty( $setting['desktop'] ) ) {
+ $css .= $selector . '{' . $css_property . ':' . esc_attr( $setting['desktop'] ) . ';}';
+ }
+ if ( isset( $setting['tablet'] ) && ! empty( $setting['tablet'] ) ) {
+ $css .= '@media (max-width:' . astra_get_tablet_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['tablet'] ) . ';} }';
+ }
+ if ( isset( $setting['mobile'] ) && ! empty( $setting['mobile'] ) ) {
+ $css .= '@media (max-width:' . astra_get_mobile_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['mobile'] ) . ';} }';
+ }
+ return $css;
+ }
+}
+
+if ( ! function_exists( 'astra_check_is_bb_themer_layout' ) ) :
+
+ /**
+ * Check if layout is bb themer's layout
+ */
+ function astra_check_is_bb_themer_layout() {
+
+ $is_layout = false;
+
+ $post_type = get_post_type();
+ $post_id = get_the_ID();
+
+ if ( 'fl-theme-layout' === $post_type && $post_id ) {
+
+ $is_layout = true;
+ }
+
+ return $is_layout;
+ }
+
+endif;
+
+
+if ( ! function_exists( 'astra_is_white_labelled' ) ) :
+
+ /**
+ * Check if white label option is enabled in astra pro plugin
+ */
+ function astra_is_white_labelled() {
+
+ if ( is_callable( 'Astra_Ext_White_Label_Markup::show_branding' ) && ! Astra_Ext_White_Label_Markup::show_branding() ) {
+ return apply_filters( 'astra_is_white_labelled', true );
+ }
+
+ return apply_filters( 'astra_is_white_labelled', false );
+ }
+
+endif;
+
+/**
+ * Get the value for font-display property.
+ *
+ * @since 1.8.6
+ * @return string
+ */
+function astra_get_fonts_display_property() {
+ return apply_filters( 'astra_fonts_display_property', 'fallback' );
+}
+
+/**
+ * Return Theme options from database.
+ *
+ * @param string $option Option key.
+ * @param string $default Option default value.
+ * @param string $deprecated Option default value.
+ * @return Mixed Return option value.
+ */
+function astra_get_db_option( $option, $default = '', $deprecated = '' ) {
+
+ if ( '' != $deprecated ) {
+ $default = $deprecated;
+ }
+
+ $theme_options = Astra_Theme_Options::get_db_options();
+
+ /**
+ * Filter the options array for Astra Settings.
+ *
+ * @since 1.0.20
+ * @var Array
+ */
+ $theme_options = apply_filters( 'astra_get_db_option_array', $theme_options, $option, $default );
+
+ $value = ( isset( $theme_options[ $option ] ) && '' !== $theme_options[ $option ] ) ? $theme_options[ $option ] : $default;
+
+ /**
+ * Dynamic filter astra_get_option_$option.
+ * $option is the name of the Astra Setting, Refer Astra_Theme_Options::defaults() for option names from the theme.
+ *
+ * @since 1.0.20
+ * @var Mixed.
+ */
+ return apply_filters( "astra_get_db_option_{$option}", $value, $option, $default );
+}
+
+/**
+ * Generate Responsive Background Color CSS.
+ *
+ * @param array $bg_obj_res array of background object.
+ * @param string $device CSS for which device.
+ * @return array
+ */
+function astra_get_responsive_background_obj( $bg_obj_res, $device ) {
+
+ $gen_bg_css = array();
+
+ if ( ! is_array( $bg_obj_res ) ) {
+ return;
+ }
+
+ $bg_obj = $bg_obj_res[ $device ];
+ $bg_img = isset( $bg_obj['background-image'] ) ? $bg_obj['background-image'] : '';
+ $bg_tab_img = isset( $bg_obj_res['tablet']['background-image'] ) ? $bg_obj_res['tablet']['background-image'] : '';
+ $bg_desk_img = isset( $bg_obj_res['desktop']['background-image'] ) ? $bg_obj_res['desktop']['background-image'] : '';
+ $bg_color = isset( $bg_obj['background-color'] ) ? $bg_obj['background-color'] : '';
+ $tablet_css = ( isset( $bg_obj_res['tablet']['background-image'] ) && $bg_obj_res['tablet']['background-image'] ) ? true : false;
+ $desktop_css = ( isset( $bg_obj_res['desktop']['background-image'] ) && $bg_obj_res['desktop']['background-image'] ) ? true : false;
+
+ $bg_type = ( isset( $bg_obj['background-type'] ) && $bg_obj['background-type'] ) ? $bg_obj['background-type'] : '';
+
+ if ( '' !== $bg_type ) {
+ switch ( $bg_type ) {
+ case 'color':
+ if ( '' !== $bg_img && '' !== $bg_color ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');';
+ } elseif ( 'mobile' === $device ) {
+ if ( $desktop_css ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_desk_img . ');';
+ } elseif ( $tablet_css ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_tab_img . ');';
+ } else {
+ $gen_bg_css['background-color'] = $bg_color . ';';
+ $gen_bg_css['background-image'] = 'none;';
+ }
+ } elseif ( 'tablet' === $device ) {
+ if ( $desktop_css ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_desk_img . ');';
+ } else {
+ $gen_bg_css['background-color'] = $bg_color . ';';
+ $gen_bg_css['background-image'] = 'none;';
+ }
+ } elseif ( '' === $bg_img ) {
+ $gen_bg_css['background-color'] = $bg_color . ';';
+ $gen_bg_css['background-image'] = 'none;';
+ }
+ break;
+
+ case 'image':
+ if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');';
+ }
+ if ( '' === $bg_color || is_numeric( strpos( $bg_color, 'linear-gradient' ) ) || is_numeric( strpos( $bg_color, 'radial-gradient' ) ) && '' !== $bg_img ) {
+ $gen_bg_css['background-image'] = 'url(' . $bg_img . ');';
+ }
+ break;
+
+ case 'gradient':
+ if ( isset( $bg_color ) ) {
+ $gen_bg_css['background-image'] = $bg_color . ';';
+ }
+ break;
+
+ default:
+ break;
+ }
+ } elseif ( '' !== $bg_color ) {
+ $gen_bg_css['background-color'] = $bg_color . ';';
+ }
+
+ if ( '' !== $bg_img ) {
+ if ( isset( $bg_obj['background-repeat'] ) ) {
+ $gen_bg_css['background-repeat'] = esc_attr( $bg_obj['background-repeat'] );
+ }
+
+ if ( isset( $bg_obj['background-position'] ) ) {
+ $gen_bg_css['background-position'] = esc_attr( $bg_obj['background-position'] );
+ }
+
+ if ( isset( $bg_obj['background-size'] ) ) {
+ $gen_bg_css['background-size'] = esc_attr( $bg_obj['background-size'] );
+ }
+
+ if ( isset( $bg_obj['background-attachment'] ) ) {
+ $gen_bg_css['background-attachment'] = esc_attr( $bg_obj['background-attachment'] );
+ }
+ }
+
+ return $gen_bg_css;
+}
+
+/**
+ * Common function to check is pagination is enabled on current page.
+ *
+ * @since 3.0.1
+ * @return boolean
+ */
+function is_astra_pagination_enabled() {
+ global $wp_query;
+
+ return ( $wp_query->max_num_pages > 1 && apply_filters( 'astra_pagination_enabled', true ) );
+}
+
+/**
+ * Verify is current post comments are enabled or not for applying dynamic CSS.
+ *
+ * @since 3.0.1
+ * @return boolean
+ */
+function is_current_post_comment_enabled() {
+ return ( is_singular() && comments_open() );
+}
diff --git a/inc/core/deprecated/deprecated-filters.php b/inc/core/deprecated/deprecated-filters.php
new file mode 100644
index 0000000..ae044ee
--- /dev/null
+++ b/inc/core/deprecated/deprecated-filters.php
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Deprecated Filters of Astra Theme.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.23
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+// Depreciating astra_color_palletes filter.
+add_filter( 'astra_color_palettes', 'astra_deprecated_color_palette', 10, 1 );
+
+/**
+ * Astra Color Palettes
+ *
+ * @since 1.0.23
+ * @param array $color_palette customizer color palettes.
+ * @return array $color_palette updated customizer color palettes.
+ */
+function astra_deprecated_color_palette( $color_palette ) {
+
+ $color_palette = astra_apply_filters_deprecated( 'astra_color_palletes', array( $color_palette ), '1.0.22', 'astra_color_palettes', '' );
+
+ return $color_palette;
+}
+
+
+// Deprecating astra_sigle_post_navigation_enabled filter.
+add_filter( 'astra_single_post_navigation_enabled', 'astra_deprecated_sigle_post_navigation_enabled', 10, 1 );
+
+/**
+ * Astra Single Post Navigation
+ *
+ * @since 1.0.27
+ * @param boolean $post_nav true | false.
+ * @return boolean $post_nav true for enabled | false for disable.
+ */
+function astra_deprecated_sigle_post_navigation_enabled( $post_nav ) {
+
+ $post_nav = astra_apply_filters_deprecated( 'astra_sigle_post_navigation_enabled', array( $post_nav ), '1.0.27', 'astra_single_post_navigation_enabled', '' );
+
+ return $post_nav;
+}
+
+// Deprecating astra_primary_header_main_rt_section filter.
+add_filter( 'astra_header_section_elements', 'astra_deprecated_primary_header_main_rt_section', 10, 2 );
+
+/**
+ * Astra Header elements.
+ *
+ * @since 1.2.2
+ * @param array $elements List of elements.
+ * @param string $header Header section type.
+ * @return array
+ */
+function astra_deprecated_primary_header_main_rt_section( $elements, $header ) {
+
+ $elements = astra_apply_filters_deprecated( 'astra_primary_header_main_rt_section', array( $elements, $header ), '1.2.2', 'astra_header_section_elements', '' );
+
+ return $elements;
+}
+
+if ( ! function_exists( 'astra_apply_filters_deprecated' ) ) {
+ /**
+ * Astra Filter Deprecated
+ *
+ * @since 1.1.1
+ * @param string $tag The name of the filter hook.
+ * @param array $args Array of additional function arguments to be passed to apply_filters().
+ * @param string $version The version of WordPress that deprecated the hook.
+ * @param string $replacement Optional. The hook that should have been used. Default false.
+ * @param string $message Optional. A message regarding the change. Default null.
+ */
+ function astra_apply_filters_deprecated( $tag, $args, $version, $replacement = false, $message = null ) {
+ if ( function_exists( 'apply_filters_deprecated' ) ) { /* WP >= 4.6 */
+ return apply_filters_deprecated( $tag, $args, $version, $replacement, $message );
+ } else {
+ return apply_filters_ref_array( $tag, $args );
+ }
+ }
+}
diff --git a/inc/core/deprecated/deprecated-functions.php b/inc/core/deprecated/deprecated-functions.php
new file mode 100644
index 0000000..779d474
--- /dev/null
+++ b/inc/core/deprecated/deprecated-functions.php
@@ -0,0 +1,145 @@
+<?php
+/**
+ * Deprecated Functions of Astra Theme.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.23
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+if ( ! function_exists( 'astra_blog_post_thumbnai_and_title_order' ) ) :
+
+ /**
+ * Blog post thumbnail & title order
+ *
+ * @since 1.4.9
+ * @deprecated 1.4.9 Use astra_blog_post_thumbnail_and_title_order()
+ * @see astra_blog_post_thumbnail_and_title_order()
+ *
+ * @return void
+ */
+ function astra_blog_post_thumbnai_and_title_order() {
+ _deprecated_function( __FUNCTION__, '1.4.9', 'astra_blog_post_thumbnail_and_title_order()' );
+
+ astra_blog_post_thumbnail_and_title_order();
+ }
+
+endif;
+
+if ( ! function_exists( 'get_astra_secondary_class' ) ) :
+
+ /**
+ * Retrieve the classes for the secondary element as an array.
+ *
+ * @since 1.5.2
+ * @deprecated 1.5.2 Use astra_get_secondary_class()
+ * @param string|array $class One or more classes to add to the class list.
+ * @see astra_get_secondary_class()
+ *
+ * @return array
+ */
+ function get_astra_secondary_class( $class = '' ) {
+ _deprecated_function( __FUNCTION__, '1.5.2', 'astra_get_secondary_class()' );
+
+ return astra_get_secondary_class( $class );
+ }
+
+endif;
+
+if ( ! function_exists( 'deprecated_astra_color_palette' ) ) :
+
+ /**
+ * Depreciating astra_color_palletes filter.
+ *
+ * @since 1.5.2
+ * @deprecated 1.5.2 Use astra_deprecated_color_palette()
+ * @param array $color_palette customizer color palettes.
+ * @see astra_deprecated_color_palette()
+ *
+ * @return array
+ */
+ function deprecated_astra_color_palette( $color_palette ) {
+ _deprecated_function( __FUNCTION__, '1.5.2', 'astra_deprecated_color_palette()' );
+
+ return astra_deprecated_color_palette( $color_palette );
+ }
+
+endif;
+
+if ( ! function_exists( 'deprecated_astra_sigle_post_navigation_enabled' ) ) :
+
+ /**
+ * Deprecating astra_sigle_post_navigation_enabled filter.
+ *
+ * @since 1.5.2
+ * @deprecated 1.5.2 Use astra_deprecated_sigle_post_navigation_enabled()
+ * @param boolean $post_nav true | false.
+ * @see astra_deprecated_sigle_post_navigation_enabled()
+ *
+ * @return array
+ */
+ function deprecated_astra_sigle_post_navigation_enabled( $post_nav ) {
+ _deprecated_function( __FUNCTION__, '1.5.2', 'astra_deprecated_sigle_post_navigation_enabled()' );
+
+ return astra_deprecated_sigle_post_navigation_enabled( $post_nav );
+ }
+
+endif;
+
+if ( ! function_exists( 'deprecated_astra_primary_header_main_rt_section' ) ) :
+
+ /**
+ * Deprecating astra_primary_header_main_rt_section filter.
+ *
+ * @since 1.5.2
+ * @deprecated 1.5.2 Use astra_deprecated_primary_header_main_rt_section()
+ * @param array $elements List of elements.
+ * @param string $header Header section type.
+ * @see astra_deprecated_primary_header_main_rt_section()
+ *
+ * @return array
+ */
+ function deprecated_astra_primary_header_main_rt_section( $elements, $header ) {
+ _deprecated_function( __FUNCTION__, '1.5.2', 'astra_deprecated_primary_header_main_rt_section()' );
+
+ return astra_deprecated_primary_header_main_rt_section( $elements, $header );
+ }
+
+endif;
+
+if ( ! function_exists( 'astar' ) ) :
+
+ /**
+ * Get a specific property of an array without needing to check if that property exists.
+ *
+ * @since 1.5.2
+ * @deprecated 1.5.2 Use astra_get_prop()
+ * @param array $array Array from which the property's value should be retrieved.
+ * @param string $prop Name of the property to be retrieved.
+ * @param string $default Optional. Value that should be returned if the property is not set or empty. Defaults to null.
+ * @see astra_get_prop()
+ *
+ * @return null|string|mixed The value
+ */
+ function astar( $array, $prop, $default = null ) {
+ return astra_get_prop( $array, $prop, $default );
+ }
+
+endif;
+
+/**
+ * Check if we're being delivered AMP.
+ *
+ * @return bool
+ */
+function astra_is_emp_endpoint() {
+ _deprecated_function( __FUNCTION__, '2.0.1', 'astra_is_amp_endpoint()' );
+
+ return astra_is_amp_endpoint();
+}
diff --git a/inc/core/deprecated/deprecated-hooks.php b/inc/core/deprecated/deprecated-hooks.php
new file mode 100644
index 0000000..0f2943d
--- /dev/null
+++ b/inc/core/deprecated/deprecated-hooks.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Deprecated Hooks of Astra Theme.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.23
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+if ( ! function_exists( 'astra_do_action_deprecated' ) ) {
+ /**
+ * Astra Filter Deprecated
+ *
+ * @since 1.1.1
+ * @param string $tag The name of the filter hook.
+ * @param array $args Array of additional function arguments to be passed to apply_filters().
+ * @param string $version The version of WordPress that deprecated the hook.
+ * @param string $replacement Optional. The hook that should have been used. Default false.
+ * @param string $message Optional. A message regarding the change. Default null.
+ */
+ function astra_do_action_deprecated( $tag, $args, $version, $replacement = false, $message = null ) {
+ if ( function_exists( 'do_action_deprecated' ) ) { /* WP >= 4.6 */
+ do_action_deprecated( $tag, $args, $version, $replacement, $message );
+ } else {
+ do_action_ref_array( $tag, $args );
+ }
+ }
+}
diff --git a/inc/core/index.php b/inc/core/index.php
new file mode 100644
index 0000000..8b96815
--- /dev/null
+++ b/inc/core/index.php
@@ -0,0 +1,9 @@
+<?php
+/**
+ * Index file
+ *
+ * @package Astra
+ * @since Astra 1.0.0
+ */
+
+/* Silence is golden, and we agree. */
diff --git a/inc/core/markup/class-astra-markup.php b/inc/core/markup/class-astra-markup.php
new file mode 100644
index 0000000..d9d6e9c
--- /dev/null
+++ b/inc/core/markup/class-astra-markup.php
@@ -0,0 +1,340 @@
+<?php
+/**
+ * Astra Generate Markup Class.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2021, Astra
+ * @link https://wpastra.com/
+ * @since Astra 3.3.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Class Astra_Attr
+ */
+class Astra_Markup {
+
+ /**
+ * Initialuze the Class.
+ *
+ * @since 3.3.0
+ */
+ public function __construct() {
+
+ if ( ! Astra_Builder_Helper::apply_flex_based_css() ) {
+ // Add filters here.
+ add_filter( 'astra_markup_footer-widget-div_open', array( $this, 'footer_widget_div_open' ) );
+ add_filter( 'astra_markup_footer-widget-div_close', array( $this, 'footer_widget_div_close' ) );
+ add_filter( 'astra_markup_header-widget-div_open', array( $this, 'header_widget_div_open' ) );
+ add_filter( 'astra_markup_header-widget-div_close', array( $this, 'footer_widget_div_close' ) );
+ add_filter( 'astra_markup_comment-count-wrapper_open', array( $this, 'comment_count_wrapper_open' ) );
+ add_filter( 'astra_markup_comment-count-wrapper_close', array( $this, 'comment_count_wrapper_close' ) );
+ add_filter( 'astra_markup_ast-comment-data-wrap_open', array( $this, 'ast_comment_data_wrap_open' ) );
+ add_filter( 'astra_markup_ast-comment-data-wrap_close', array( $this, 'ast_comment_data_wrap_close' ) );
+ add_filter( 'astra_markup_ast-comment-meta-wrap_open', array( $this, 'ast_comment_meta_wrap_open' ) );
+ add_filter( 'astra_markup_ast-comment-meta-wrap_close', array( $this, 'ast_comment_meta_wrap_close' ) );
+ add_filter( 'astra_attr_ast-comment-time_output', array( $this, 'ast_comment_time_attr' ) );
+ add_filter( 'astra_attr_ast-comment-cite-wrap_output', array( $this, 'ast_comment_cite_wrap_attr' ) );
+ }
+ add_filter( 'astra_attr_comment-form-grid-class_output', array( $this, 'comment_form_grid_class' ) );
+ add_filter( 'astra_attr_header-widget-area-inner', array( $this, 'header_widget_area_inner' ) );
+ add_filter( 'astra_attr_footer-widget-area-inner', array( $this, 'footer_widget_area_inner' ) );
+ add_filter( 'astra_attr_ast-grid-lg-12_output', array( $this, 'ast_grid_lg_12' ) );
+ add_filter( 'astra_attr_ast-grid-common-col_output', array( $this, 'ast_grid_common_css' ) );
+ add_filter( 'astra_attr_ast-grid-blog-col_output', array( $this, 'ast_grid_blog_col' ) );
+ add_filter( 'astra_attr_ast-blog-col_output', array( $this, 'ast_blog_common_css' ) );
+ add_filter( 'astra_attr_ast-grid-col-6_output', array( $this, 'ast_grid_col_6' ) );
+ add_filter( 'astra_attr_ast-layout-4-grid_output', array( $this, 'ast_layout_4_grid' ) );
+ add_filter( 'astra_attr_ast-layout-1-grid_output', array( $this, 'ast_layout_1_grid' ) );
+ add_filter( 'astra_attr_ast-layout-2-grid_output', array( $this, 'ast_layout_2_grid' ) );
+ add_filter( 'astra_attr_ast-layout-3-grid_output', array( $this, 'ast_layout_3_grid' ) );
+ add_filter( 'astra_attr_ast-layout-5-grid_output', array( $this, 'ast_layout_5_grid' ) );
+ add_filter( 'astra_attr_ast-layout-6-grid_output', array( $this, 'ast_layout_6_grid' ) );
+
+ }
+
+ /**
+ * Comment count wrapper opening div.
+ *
+ * @param array $args markup arguments.
+ * @since 3.3.0
+ * @return array.
+ */
+ public function comment_count_wrapper_open( $args ) {
+ $args['open'] = '<div %s>';
+ $args['attrs'] = array( 'class' => 'comments-count-wrapper' );
+ return $args;
+ }
+
+ /**
+ * Comment count wrapper closing div.
+ *
+ * @param array $args markup arguments.
+ * @since 3.3.0
+ * @return array.
+ */
+ public function comment_count_wrapper_close( $args ) {
+ $args['close'] = '</div>';
+ return $args;
+ }
+
+ /**
+ * Comment data wrapper opening div.
+ *
+ * @param array $args markup arguments.
+ * @since 3.3.0
+ * @return array.
+ */
+ public function ast_comment_data_wrap_open( $args ) {
+ $args['open'] = '<div %s>';
+ $args['attrs'] = array( 'class' => 'ast-comment-data-wrap' );
+ return $args;
+ }
+
+ /**
+ * Comment data wrapper closing div.
+ *
+ * @param array $args markup arguments.
+ * @since 3.3.0
+ * @return array.
+ */
+ public function ast_comment_data_wrap_close( $args ) {
+ $args['close'] = '</div>';
+ return $args;
+ }
+
+ /**
+ * Comment meta wrapper opening div.
+ *
+ * @param array $args markup arguments.
+ * @since 3.3.0
+ * @return array.
+ */
+ public function ast_comment_meta_wrap_open( $args ) {
+ $args['open'] = '<div %s>';
+ $args['attrs'] = array( 'class' => 'ast-comment-meta-wrap' );
+ return $args;
+ }
+
+ /**
+ * Comment meta wrapper closing div.
+ *
+ * @param array $args markup arguments.
+ * @since 3.3.0
+ * @return array.
+ */
+ public function ast_comment_meta_wrap_close( $args ) {
+ $args['close'] = '</div>';
+ return $args;
+ }
+
+ /**
+ * Comment time div attributes.
+ *
+ * @since 3.3.0
+ * @return string.
+ */
+ public function ast_comment_time_attr() {
+ return 'class = "ast-comment-time ast-col-lg-12" ';
+ }
+
+ /**
+ * Comment cite wrapper div attributes.
+ *
+ * @since 3.3.0
+ * @return string.
+ */
+ public function ast_comment_cite_wrap_attr() {
+ return 'class = "ast-comment-cite-wrap ast-col-lg-12" ';
+ }
+
+ /**
+ * We have removed grid css and make common css for grid style.
+ *
+ * @since 3.3.0
+ * @return string.
+ */
+ public function ast_grid_common_css() {
+ return Astra_Builder_Helper::apply_flex_based_css() ? 'ast-grid-common-col' : 'ast-col-md-12';
+ }
+
+ /**
+ * Blog content Grid CSS.
+ *
+ * @since 3.3.0
+ * @return string.
+ */
+ public function ast_grid_blog_col() {
+ return Astra_Builder_Helper::apply_flex_based_css() ? 'ast-grid-common-col ast-float' : 'ast-col-md-12';
+ }
+
+ /**
+ * We have removed grid css and make common css for grid style.
+ *
+ * @since 3.3.0
+ * @return string.
+ */
+ public function ast_blog_common_css() {
+ return Astra_Builder_Helper::apply_flex_based_css() ? 'ast-grid-common-col ast-full-width' : 'ast-col-sm-12';
+ }
+
+ /**
+ * Removed grid layout classes and make common class for same style.
+ *
+ * @since 3.3.0
+ * @return string.
+ */
+ public function ast_grid_col_6() {
+ return Astra_Builder_Helper::apply_flex_based_css() ? 'ast-width-md-6' : 'ast-col-md-6';
+ }
+
+ /**
+ * Comment form grid classes.
+ *
+ * @since 3.3.0
+ * @return string.
+ */
+ public function comment_form_grid_class() {
+ return ( Astra_Builder_Helper::apply_flex_based_css() ) ? 'ast-grid-common-col ast-width-lg-33 ast-width-md-4 ast-float' : 'ast-col-xs-12 ast-col-sm-12 ast-col-md-4 ast-col-lg-4';
+ }
+
+ /**
+ * Removed grid layout classes and make common class for same style
+ *
+ * @since 3.3.0
+ * @return string.
+ */
+ public function ast_grid_lg_12() {
+ return Astra_Builder_Helper::apply_flex_based_css() ? 'ast-grid-common-col' : 'ast-col-lg-12';
+ }
+
+ /**
+ * Layout-4 grid css backward comaptibility.
+ *
+ * @return string.
+ */
+ public function ast_layout_4_grid() {
+ return Astra_Builder_Helper::apply_flex_based_css() ? 'ast-grid-common-col ast-width-sm-25 ast-width-md-3 ast-float ast-full-width' : 'ast-col-lg-3 ast-col-md-3 ast-col-sm-12 ast-col-xs-12';
+ }
+
+ /**
+ * Layout-2 grid css backward comaptibility.
+ *
+ * @return string.
+ */
+ public function ast_layout_2_grid() {
+ return Astra_Builder_Helper::apply_flex_based_css() ? 'ast-grid-common-col ast-width-md-6 ast-full-width' : 'ast-col-lg-6 ast-col-md-6 ast-col-sm-12 ast-col-xs-12';
+ }
+
+ /**
+ * Layout-1 grid css backward comaptibility.
+ *
+ * @return string.
+ */
+ public function ast_layout_1_grid() {
+ return Astra_Builder_Helper::apply_flex_based_css() ? 'ast-grid-common-col' : 'ast-col-lg-12 ast-col-md-12 ast-col-sm-12 ast-col-xs-12';
+ }
+
+ /**
+ * Layout-3 grid css backward comaptibility.
+ *
+ * @return string.
+ */
+ public function ast_layout_3_grid() {
+ return Astra_Builder_Helper::apply_flex_based_css() ? 'ast-grid-common-col ast-width-md-4 ast-float ast-full-width' : 'ast-col-lg-4 ast-col-md-4 ast-col-sm-12 ast-col-xs-12';
+ }
+
+ /**
+ * Layout-5 grid css backward comaptibility.
+ *
+ * @return string.
+ */
+ public function ast_layout_5_grid() {
+ return Astra_Builder_Helper::apply_flex_based_css() ? 'ast-grid-common-col ast-width-md-16 ast-width-md-20 ast-float ast-full-width' : 'ast-col-lg-2 ast-col-md-2 ast-col-sm-12 ast-col-xs-12';
+ }
+
+ /**
+ * Layout-6 grid css backward comaptibility.
+ *
+ * @return string.
+ */
+ public function ast_layout_6_grid() {
+ return Astra_Builder_Helper::apply_flex_based_css() ? 'ast-grid-common-col ast-width-md-6 ast-width-lg-50 ast-float ast-full-width' : 'ast-col-lg-6 ast-col-md-6 ast-col-sm-12 ast-col-xs-12';
+ }
+
+ /**
+ * Footer widget opening div.
+ *
+ * @since 3.3.0
+ * @param array $args div attributes.
+ * @return array.
+ */
+ public function footer_widget_div_open( $args ) {
+ $args['open'] = '<div %s>';
+ $args['attrs'] = array( 'class' => 'footer-widget-area-inner site-info-inner' );
+ return $args;
+ }
+
+ /**
+ * Footer widget closing div.
+ *
+ * @since 3.3.0
+ * @param array $args div attributes.
+ * @return array.
+ */
+ public function footer_widget_div_close( $args ) {
+ $args['close'] = '</div>';
+ return $args;
+ }
+
+ /**
+ * Footer widget inner class.
+ *
+ * @param array $args attributes.
+ * @since 3.3.0
+ * @return string.
+ */
+ public function footer_widget_area_inner( $args ) {
+ if ( Astra_Builder_Helper::apply_flex_based_css() ) {
+ $args['class'] = $args['class'] . ' footer-widget-area-inner';
+ }
+ return $args;
+ }
+
+ /**
+ * Header widget inner class.
+ *
+ * @param array $args Attributes.
+ * @since 3.3.0
+ * @return string.
+ */
+ public function header_widget_area_inner( $args ) {
+ if ( Astra_Builder_Helper::apply_flex_based_css() ) {
+ $args['class'] = $args['class'] . ' header-widget-area-inner';
+ }
+ return $args;
+ }
+
+ /**
+ * Footer widget opening div.
+ *
+ * @since 3.3.0
+ * @param array $args div attributes.
+ * @return array.
+ */
+ public function header_widget_div_open( $args ) {
+ $args['open'] = '<div %s>';
+ $args['attrs'] = array( 'class' => 'header-widget-area-inner site-info-inner' );
+ return $args;
+ }
+
+}
+
+/**
+ * Kicking this off by calling 'get_instance()' method
+ */
+new Astra_Markup();
diff --git a/inc/core/sidebar-manager.php b/inc/core/sidebar-manager.php
new file mode 100644
index 0000000..a191020
--- /dev/null
+++ b/inc/core/sidebar-manager.php
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Sidebar Manager functions
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Site Sidebar
+ */
+if ( ! function_exists( 'astra_page_layout' ) ) {
+
+ /**
+ * Site Sidebar
+ *
+ * Default 'right sidebar' for overall site.
+ */
+ function astra_page_layout() {
+
+ if ( is_singular() ) {
+
+ // If post meta value is empty,
+ // Then get the POST_TYPE sidebar.
+ $layout = astra_get_option_meta( 'site-sidebar-layout', '', true );
+
+ if ( empty( $layout ) ) {
+
+ $post_type = get_post_type();
+
+ if ( 'post' === $post_type || 'page' === $post_type || 'product' === $post_type ) {
+ $layout = astra_get_option( 'single-' . get_post_type() . '-sidebar-layout' );
+ }
+
+ if ( 'default' == $layout || empty( $layout ) ) {
+
+ // Get the global sidebar value.
+ // NOTE: Here not used `true` in the below function call.
+ $layout = astra_get_option( 'site-sidebar-layout' );
+ }
+ }
+ } else {
+
+ if ( is_search() ) {
+
+ // Check only post type archive option value.
+ $layout = astra_get_option( 'archive-post-sidebar-layout' );
+
+ if ( 'default' == $layout || empty( $layout ) ) {
+
+ // Get the global sidebar value.
+ // NOTE: Here not used `true` in the below function call.
+ $layout = astra_get_option( 'site-sidebar-layout' );
+ }
+ } else {
+
+ $post_type = get_post_type();
+ $layout = '';
+
+ if ( 'post' === $post_type ) {
+ $layout = astra_get_option( 'archive-' . get_post_type() . '-sidebar-layout' );
+ }
+
+ if ( 'default' == $layout || empty( $layout ) ) {
+
+ // Get the global sidebar value.
+ // NOTE: Here not used `true` in the below function call.
+ $layout = astra_get_option( 'site-sidebar-layout' );
+ }
+ }
+ }
+
+ return apply_filters( 'astra_page_layout', $layout );
+ }
+}
diff --git a/inc/core/theme-hooks.php b/inc/core/theme-hooks.php
new file mode 100644
index 0000000..562b79e
--- /dev/null
+++ b/inc/core/theme-hooks.php
@@ -0,0 +1,499 @@
+<?php
+/**
+ * Theme Hook Alliance hook stub list.
+ *
+ * @see https://github.com/zamoose/themehookalliance
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Themes and Plugins can check for astra_hooks using current_theme_supports( 'astra_hooks', $hook )
+ * to determine whether a theme declares itself to support this specific hook type.
+ *
+ * Example:
+ * <code>
+ * // Declare support for all hook types
+ * add_theme_support( 'astra_hooks', array( 'all' ) );
+ *
+ * // Declare support for certain hook types only
+ * add_theme_support( 'astra_hooks', array( 'header', 'content', 'footer' ) );
+ * </code>
+ */
+add_theme_support(
+ 'astra_hooks',
+ array(
+
+ /**
+ * As a Theme developer, use the 'all' parameter, to declare support for all
+ * hook types.
+ * Please make sure you then actually reference all the hooks in this file,
+ * Plugin developers depend on it!
+ */
+ 'all',
+
+ /**
+ * Themes can also choose to only support certain hook types.
+ * Please make sure you then actually reference all the hooks in this type
+ * family.
+ *
+ * When the 'all' parameter was set, specific hook types do not need to be
+ * added explicitly.
+ */
+ 'html',
+ 'body',
+ 'head',
+ 'header',
+ 'content',
+ 'entry',
+ 'comments',
+ 'sidebars',
+ 'sidebar',
+ 'footer',
+
+ /**
+ * If/when WordPress Core implements similar methodology, Themes and Plugins
+ * will be able to check whether the version of THA supplied by the theme
+ * supports Core hooks.
+ */
+ )
+);
+
+/**
+ * Determines, whether the specific hook type is actually supported.
+ *
+ * Plugin developers should always check for the support of a <strong>specific</strong>
+ * hook type before hooking a callback function to a hook of this type.
+ *
+ * Example:
+ * <code>
+ * if ( current_theme_supports( 'astra_hooks', 'header' ) )
+ * add_action( 'astra_head_top', 'prefix_header_top' );
+ * </code>
+ *
+ * @param bool $bool true.
+ * @param array $args The hook type being checked.
+ * @param array $registered All registered hook types.
+ *
+ * @return bool
+ */
+function astra_current_theme_supports( $bool, $args, $registered ) {
+ return in_array( $args[0], $registered[0] ) || in_array( 'all', $registered[0] );
+}
+add_filter( 'current_theme_supports-astra_hooks', 'astra_current_theme_supports', 10, 3 );
+
+/**
+ * HTML <html> hook
+ * Special case, useful for <DOCTYPE>, etc.
+ * $astra_supports[] = 'html;
+ */
+function astra_html_before() {
+ do_action( 'astra_html_before' );
+}
+/**
+ * HTML <body> hooks
+ * $astra_supports[] = 'body';
+ */
+function astra_body_top() {
+ do_action( 'astra_body_top' );
+}
+
+/**
+ * Body Bottom
+ */
+function astra_body_bottom() {
+ do_action( 'astra_body_bottom' );
+}
+
+/**
+ * HTML <head> hooks
+ *
+ * $astra_supports[] = 'head';
+ */
+function astra_head_top() {
+ do_action( 'astra_head_top' );
+}
+
+/**
+ * Head Bottom
+ */
+function astra_head_bottom() {
+ do_action( 'astra_head_bottom' );
+}
+
+/**
+ * Semantic <header> hooks
+ *
+ * $astra_supports[] = 'header';
+ */
+function astra_header_before() {
+ do_action( 'astra_header_before' );
+}
+
+/**
+ * Site Header
+ */
+function astra_header() {
+ do_action( 'astra_header' );
+}
+
+/**
+ * Masthead Top
+ */
+function astra_masthead_top() {
+ do_action( 'astra_masthead_top' );
+}
+
+/**
+ * Masthead
+ */
+function astra_masthead() {
+ do_action( 'astra_masthead' );
+}
+
+/**
+ * Masthead Bottom
+ */
+function astra_masthead_bottom() {
+ do_action( 'astra_masthead_bottom' );
+}
+
+/**
+ * Header After
+ */
+function astra_header_after() {
+ do_action( 'astra_header_after' );
+}
+
+/**
+ * Main Header bar top
+ */
+function astra_main_header_bar_top() {
+ do_action( 'astra_main_header_bar_top' );
+}
+
+/**
+ * Main Header bar bottom
+ */
+function astra_main_header_bar_bottom() {
+ do_action( 'astra_main_header_bar_bottom' );
+}
+
+/**
+ * Main Header Content
+ */
+function astra_masthead_content() {
+ do_action( 'astra_masthead_content' );
+}
+/**
+ * Main toggle button before
+ */
+function astra_masthead_toggle_buttons_before() {
+ do_action( 'astra_masthead_toggle_buttons_before' );
+}
+
+/**
+ * Main toggle buttons
+ */
+function astra_masthead_toggle_buttons() {
+ do_action( 'astra_masthead_toggle_buttons' );
+}
+
+/**
+ * Main toggle button after
+ */
+function astra_masthead_toggle_buttons_after() {
+ do_action( 'astra_masthead_toggle_buttons_after' );
+}
+
+/**
+ * Semantic <content> hooks
+ *
+ * $astra_supports[] = 'content';
+ */
+function astra_content_before() {
+ do_action( 'astra_content_before' );
+}
+
+/**
+ * Content after
+ */
+function astra_content_after() {
+ do_action( 'astra_content_after' );
+}
+
+/**
+ * Content top
+ */
+function astra_content_top() {
+ do_action( 'astra_content_top' );
+}
+
+/**
+ * Content bottom
+ */
+function astra_content_bottom() {
+ do_action( 'astra_content_bottom' );
+}
+
+/**
+ * Content while before
+ */
+function astra_content_while_before() {
+ do_action( 'astra_content_while_before' );
+}
+
+/**
+ * Content loop
+ */
+function astra_content_loop() {
+ do_action( 'astra_content_loop' );
+}
+
+/**
+ * Conten Page Loop.
+ *
+ * Called from page.php
+ */
+function astra_content_page_loop() {
+ do_action( 'astra_content_page_loop' );
+}
+
+/**
+ * Content while after
+ */
+function astra_content_while_after() {
+ do_action( 'astra_content_while_after' );
+}
+
+/**
+ * Semantic <entry> hooks
+ *
+ * $astra_supports[] = 'entry';
+ */
+function astra_entry_before() {
+ do_action( 'astra_entry_before' );
+}
+
+/**
+ * Entry after
+ */
+function astra_entry_after() {
+ do_action( 'astra_entry_after' );
+}
+
+/**
+ * Entry content before
+ */
+function astra_entry_content_before() {
+ do_action( 'astra_entry_content_before' );
+}
+
+/**
+ * Entry content after
+ */
+function astra_entry_content_after() {
+ do_action( 'astra_entry_content_after' );
+}
+
+/**
+ * Entry Top
+ */
+function astra_entry_top() {
+ do_action( 'astra_entry_top' );
+}
+
+/**
+ * Entry bottom
+ */
+function astra_entry_bottom() {
+ do_action( 'astra_entry_bottom' );
+}
+
+/**
+ * Single Post Header Before
+ */
+function astra_single_header_before() {
+ do_action( 'astra_single_header_before' );
+}
+
+/**
+ * Single Post Header After
+ */
+function astra_single_header_after() {
+ do_action( 'astra_single_header_after' );
+}
+
+/**
+ * Single Post Header Top
+ */
+function astra_single_header_top() {
+ do_action( 'astra_single_header_top' );
+}
+
+/**
+ * Single Post Header Bottom
+ */
+function astra_single_header_bottom() {
+ do_action( 'astra_single_header_bottom' );
+}
+
+/**
+ * Comments block hooks
+ *
+ * $astra_supports[] = 'comments';
+ */
+function astra_comments_before() {
+ do_action( 'astra_comments_before' );
+}
+
+/**
+ * Comments after.
+ */
+function astra_comments_after() {
+ do_action( 'astra_comments_after' );
+}
+
+/**
+ * Semantic <sidebar> hooks
+ *
+ * $astra_supports[] = 'sidebar';
+ */
+function astra_sidebars_before() {
+ do_action( 'astra_sidebars_before' );
+}
+
+/**
+ * Sidebars after
+ */
+function astra_sidebars_after() {
+ do_action( 'astra_sidebars_after' );
+}
+
+/**
+ * Semantic <footer> hooks
+ *
+ * $astra_supports[] = 'footer';
+ */
+function astra_footer() {
+ do_action( 'astra_footer' );
+}
+
+/**
+ * Footer before
+ */
+function astra_footer_before() {
+ do_action( 'astra_footer_before' );
+}
+
+/**
+ * Footer after
+ */
+function astra_footer_after() {
+ do_action( 'astra_footer_after' );
+}
+
+/**
+ * Footer top
+ */
+function astra_footer_content_top() {
+ do_action( 'astra_footer_content_top' );
+}
+
+/**
+ * Footer
+ */
+function astra_footer_content() {
+ do_action( 'astra_footer_content' );
+}
+
+/**
+ * Footer bottom
+ */
+function astra_footer_content_bottom() {
+ do_action( 'astra_footer_content_bottom' );
+}
+
+/**
+ * Archive header
+ */
+function astra_archive_header() {
+ do_action( 'astra_archive_header' );
+}
+
+/**
+ * Pagination
+ */
+function astra_pagination() {
+ do_action( 'astra_pagination' );
+}
+
+/**
+ * Entry content single
+ */
+function astra_entry_content_single() {
+ do_action( 'astra_entry_content_single' );
+}
+
+/**
+ * 404
+ */
+function astra_entry_content_404_page() {
+ do_action( 'astra_entry_content_404_page' );
+}
+
+/**
+ * Entry content blog
+ */
+function astra_entry_content_blog() {
+ do_action( 'astra_entry_content_blog' );
+}
+
+/**
+ * Blog featured post section
+ */
+function astra_blog_post_featured_format() {
+ do_action( 'astra_blog_post_featured_format' );
+}
+
+/**
+ * Primary Content Top
+ */
+function astra_primary_content_top() {
+ do_action( 'astra_primary_content_top' );
+}
+
+/**
+ * Primary Content Bottom
+ */
+function astra_primary_content_bottom() {
+ do_action( 'astra_primary_content_bottom' );
+}
+
+/**
+ * 404 Page content template action.
+ */
+function astra_404_content_template() {
+ do_action( 'astra_404_content_template' );
+}
+
+if ( ! function_exists( 'wp_body_open' ) ) {
+
+ /**
+ * Fire the wp_body_open action.
+ * Adds backward compatibility for WordPress versions < 5.2
+ *
+ * @since 1.8.7
+ */
+ function wp_body_open() {
+ do_action( 'wp_body_open' );
+ }
+}
diff --git a/inc/core/view-general.php b/inc/core/view-general.php
new file mode 100644
index 0000000..7194851
--- /dev/null
+++ b/inc/core/view-general.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * View General
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+?>
+
+<div class="ast-container ast-welcome">
+ <div id="poststuff">
+ <div id="post-body" class="columns-2">
+ <div id="post-body-content">
+ <!-- All WordPress Notices below header -->
+ <h1 class="screen-reader-text"> <?php esc_html_e( 'Astra', 'astra' ); ?> </h1>
+ <?php do_action( 'astra_welcome_page_content_before' ); ?>
+
+ <?php do_action( 'astra_welcome_page_content' ); ?>
+
+ <?php do_action( 'astra_welcome_page_content_after' ); ?>
+ </div>
+ <div class="postbox-container ast-sidebar" id="postbox-container-1">
+ <div id="side-sortables">
+ <?php do_action( 'astra_welcome_page_right_sidebar_before' ); ?>
+
+ <?php do_action( 'astra_welcome_page_right_sidebar_content' ); ?>
+
+ <?php do_action( 'astra_welcome_page_right_sidebar_after' ); ?>
+ </div>
+ </div>
+ </div>
+ <!-- /post-body -->
+ <br class="clear">
+ </div>
+
+
+</div>