diff options
author | Zach van Rijn <me@zv.io> | 2021-07-21 14:54:07 -0500 |
---|---|---|
committer | Zach van Rijn <me@zv.io> | 2021-07-21 14:54:07 -0500 |
commit | 9d4123cee1867ee7199b06bdc92d40611f547ecc (patch) | |
tree | 6d864e2725242863afed1f8ba12d9c7a9bc63a69 /inc/core/builder | |
download | blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.gz blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.bz2 blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.xz blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.zip |
Initial unmodified import from Astra (Version: 3.6.5) @ /wp-content/themes/astra/.
Diffstat (limited to 'inc/core/builder')
-rw-r--r-- | inc/core/builder/class-astra-builder-admin.php | 155 | ||||
-rw-r--r-- | inc/core/builder/class-astra-builder-helper.php | 1154 | ||||
-rw-r--r-- | inc/core/builder/class-astra-builder-options.php | 1703 |
3 files changed, 3012 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; +} |