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/builder/type/footer | |
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/builder/type/footer')
45 files changed, 2952 insertions, 0 deletions
diff --git a/inc/builder/type/footer/above-footer/assets/js/minified/customizer-preview.min.js b/inc/builder/type/footer/above-footer/assets/js/minified/customizer-preview.min.js new file mode 100644 index 0000000..8cabe1c --- /dev/null +++ b/inc/builder/type/footer/above-footer/assets/js/minified/customizer-preview.min.js @@ -0,0 +1 @@ +!function(){var r=astraBuilderPreview.tablet_break_point||768,o=astraBuilderPreview.mobile_break_point||544,t="section-above-footer-builder",i='.site-above-footer-wrap[data-section="section-above-footer-builder"]';astra_css("astra-settings[hba-footer-height]","min-height",i,"px"),astra_css("astra-settings[hba-footer-vertical-alignment]","align-items",i+" .ast-builder-grid-row, "+i+" .site-footer-section"),wp.customize("astra-settings[hba-footer-separator]",function(t){t.bind(function(t){var a="";""!==t&&(a=i+" {",a+="border-top-width: "+t+"px;",a+="border-top-style: solid",a+="} "),astra_add_dynamic_css("hba-footer-separator",a)})}),wp.customize("astra-settings[hba-inner-spacing]",function(t){t.bind(function(t){var a="";""!=t.desktop&&(a+=i+" .ast-builder-grid-row {",a+="grid-column-gap: "+t.desktop+"px;",a+="} "),""!=t.tablet&&(a+="@media (max-width: "+r+"px) {",a+=i+" .ast-builder-grid-row {",a+="grid-column-gap: "+t.tablet+"px;",a+="grid-row-gap: "+t.tablet+"px;",a+="} ",a+="} "),""!=t.mobile&&(a+="@media (max-width: "+o+"px) {",a+=i+" .ast-builder-grid-row {",a+="grid-column-gap: "+t.mobile+"px;",a+="grid-row-gap: "+t.mobile+"px;",a+="} ",a+="} "),astra_add_dynamic_css("hba-inner-spacing-toggle-button",a)})}),wp.customize("astra-settings[hba-footer-top-border-color]",function(t){t.bind(function(t){var a="";""!==t&&(a=i+" {",a+="border-top-color: "+t+";",a+="border-top-style: solid",a+="} "),astra_add_dynamic_css("hba-footer-top-border-color",a)})}),wp.customize("astra-settings[hba-footer-layout-width]",function(t){t.bind(function(t){var a="";"content"==t&&(a=i+" .ast-builder-grid-row {",a+="max-width: "+AstraBuilderPrimaryFooterData.footer_content_width+"px;",a+="margin-left: auto;",a+="margin-right: auto;",a+="} "),"full"==t&&(a=i+" .ast-builder-grid-row {",a+="max-width: 100%;",a+="padding-right: 35px; padding-left: 35px;",a+="} "),astra_add_dynamic_css("hba-footer-layout-width",a)})}),astra_apply_responsive_background_css("astra-settings[hba-footer-bg-obj-responsive]",i,"desktop"),astra_apply_responsive_background_css("astra-settings[hba-footer-bg-obj-responsive]",i,"tablet"),astra_apply_responsive_background_css("astra-settings[hba-footer-bg-obj-responsive]",i,"mobile"),astra_builder_advanced_css(t,i),astra_builder_visibility_css(t,i,"grid")}(jQuery);
\ No newline at end of file diff --git a/inc/builder/type/footer/above-footer/assets/js/unminified/customizer-preview.js b/inc/builder/type/footer/above-footer/assets/js/unminified/customizer-preview.js new file mode 100644 index 0000000..0b32c85 --- /dev/null +++ b/inc/builder/type/footer/above-footer/assets/js/unminified/customizer-preview.js @@ -0,0 +1,139 @@ +/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra
+ * @since 3.0.0
+ */
+
+( function( $ ) {
+
+ var tablet_break_point = astraBuilderPreview.tablet_break_point || 768,
+ mobile_break_point = astraBuilderPreview.mobile_break_point || 544;
+
+ var section = 'section-above-footer-builder';
+ var selector = '.site-above-footer-wrap[data-section="section-above-footer-builder"]';
+
+ // Footer Height.
+ astra_css(
+ 'astra-settings[hba-footer-height]',
+ 'min-height',
+ selector,
+ 'px'
+ );
+
+ // Footer Vertical Alignment.
+ astra_css(
+ 'astra-settings[hba-footer-vertical-alignment]',
+ 'align-items',
+ selector + ' .ast-builder-grid-row, ' + selector + ' .site-footer-section'
+ );
+
+ // Border Bottom width.
+ wp.customize( 'astra-settings[hba-footer-separator]', function( setting ) {
+ setting.bind( function( separator ) {
+
+ var dynamicStyle = '';
+
+ if ( '' !== separator ) {
+ dynamicStyle = selector + ' {';
+ dynamicStyle += 'border-top-width: ' + separator + 'px;';
+ dynamicStyle += 'border-top-style: solid';
+ dynamicStyle += '} ';
+ }
+
+ astra_add_dynamic_css( 'hba-footer-separator', dynamicStyle );
+
+ } );
+ } );
+
+ // Inner Space.
+ wp.customize( 'astra-settings[hba-inner-spacing]', function( value ) {
+ value.bind( function( spacing ) {
+ var dynamicStyle = '';
+ if ( spacing.desktop != '' ) {
+ dynamicStyle += selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'grid-column-gap: ' + spacing.desktop + 'px;';
+ dynamicStyle += '} ';
+ }
+
+ if ( spacing.tablet != '' ) {
+ dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
+ dynamicStyle += selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'grid-column-gap: ' + spacing.tablet + 'px;';
+ dynamicStyle += 'grid-row-gap: ' + spacing.tablet + 'px;';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+ }
+
+ if ( spacing.mobile != '' ) {
+ dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
+ dynamicStyle += selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'grid-column-gap: ' + spacing.mobile + 'px;';
+ dynamicStyle += 'grid-row-gap: ' + spacing.mobile + 'px;';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+ }
+
+ astra_add_dynamic_css( 'hba-inner-spacing-toggle-button', dynamicStyle );
+ } );
+ } );
+
+ // Border Color.
+ wp.customize( 'astra-settings[hba-footer-top-border-color]', function( setting ) {
+ setting.bind( function( color ) {
+
+ var dynamicStyle = '';
+
+ if ( '' !== color ) {
+ dynamicStyle = selector + ' {';
+ dynamicStyle += 'border-top-color: ' + color + ';';
+ dynamicStyle += 'border-top-style: solid';
+ dynamicStyle += '} ';
+ }
+
+ astra_add_dynamic_css( 'hba-footer-top-border-color', dynamicStyle );
+
+ } );
+ } );
+
+ // Primary Header - Layout.
+ wp.customize( 'astra-settings[hba-footer-layout-width]', function( setting ) {
+ setting.bind( function( layout ) {
+
+ var dynamicStyle = '';
+
+ if ( 'content' == layout ) {
+ dynamicStyle = selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'max-width: ' + AstraBuilderPrimaryFooterData.footer_content_width + 'px;';
+ dynamicStyle += 'margin-left: auto;';
+ dynamicStyle += 'margin-right: auto;';
+ dynamicStyle += '} ';
+ }
+
+ if ( 'full' == layout ) {
+ dynamicStyle = selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'max-width: 100%;';
+ dynamicStyle += 'padding-right: 35px; padding-left: 35px;';
+ dynamicStyle += '} ';
+ }
+
+ astra_add_dynamic_css( 'hba-footer-layout-width', dynamicStyle );
+
+ } );
+ } );
+
+ // Responsive BG styles > Above Footer Row.
+ astra_apply_responsive_background_css( 'astra-settings[hba-footer-bg-obj-responsive]', selector, 'desktop' );
+ astra_apply_responsive_background_css( 'astra-settings[hba-footer-bg-obj-responsive]', selector, 'tablet' );
+ astra_apply_responsive_background_css( 'astra-settings[hba-footer-bg-obj-responsive]', selector, 'mobile' );
+
+ // Advanced CSS Generation.
+ astra_builder_advanced_css( section, selector );
+
+ // Advanced Visibility CSS Generation.
+ astra_builder_visibility_css( section, selector, 'grid' );
+
+} )( jQuery );
diff --git a/inc/builder/type/footer/above-footer/class-astra-above-footer-component-loader.php b/inc/builder/type/footer/above-footer/class-astra-above-footer-component-loader.php new file mode 100644 index 0000000..01242f1 --- /dev/null +++ b/inc/builder/type/footer/above-footer/class-astra-above-footer-component-loader.php @@ -0,0 +1,51 @@ +<?php +/** + * Above Footer Styling Loader for Astra theme. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Above Footer Initialization + * + * @since 3.0.0 + */ +class Astra_Above_Footer_Component_Loader { + + /** + * Constructor + * + * @since 3.0.0 + */ + public function __construct() { + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); + } + + /** + * Customizer Preview + * + * @since 3.0.0 + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-footer-above-customizer-preview-js', ASTRA_BUILDER_FOOTER_ABOVE_FOOTER_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + } +} + +/** +* Kicking this off by creating the object of the class. +*/ +new Astra_Above_Footer_Component_Loader(); diff --git a/inc/builder/type/footer/above-footer/class-astra-above-footer.php b/inc/builder/type/footer/above-footer/class-astra-above-footer.php new file mode 100644 index 0000000..7832f52 --- /dev/null +++ b/inc/builder/type/footer/above-footer/class-astra-above-footer.php @@ -0,0 +1,49 @@ +<?php +/** + * Above Footer component. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +define( 'ASTRA_BUILDER_FOOTER_ABOVE_FOOTER_DIR', ASTRA_THEME_DIR . 'inc/builder/type/footer/above-footer' ); +define( 'ASTRA_BUILDER_FOOTER_ABOVE_FOOTER_URI', ASTRA_THEME_URI . 'inc/builder/type/footer/above-footer' ); + +if ( ! class_exists( 'Astra_Above_Footer' ) ) { + + /** + * Above Footer Initial Setup + * + * @since 3.0.0 + */ + class Astra_Above_Footer { + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_BUILDER_FOOTER_ABOVE_FOOTER_DIR . '/class-astra-above-footer-component-loader.php'; + + // Include front end files. + if ( ! is_admin() ) { + require_once ASTRA_BUILDER_FOOTER_ABOVE_FOOTER_DIR . '/dynamic-css/dynamic.css.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + } + + /** + * Kicking this off by creating an object. + */ + new Astra_Above_Footer(); + +} diff --git a/inc/builder/type/footer/above-footer/dynamic-css/dynamic.css.php b/inc/builder/type/footer/above-footer/dynamic-css/dynamic.css.php new file mode 100644 index 0000000..07f94ea --- /dev/null +++ b/inc/builder/type/footer/above-footer/dynamic-css/dynamic.css.php @@ -0,0 +1,151 @@ +<?php +/** + * Above Footer control - Dynamic CSS + * + * @package Astra Builder + * @since 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Above Footer CSS + */ +add_filter( 'astra_dynamic_theme_css', 'astra_fb_above_footer_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for above Footer. + * + * @since 3.0.0 + */ +function astra_fb_above_footer_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + if ( ! ( Astra_Builder_Helper::is_footer_row_empty( 'above' ) || is_customize_preview() ) ) { + return $dynamic_css; + } + + $_section = 'section-above-footer-builder'; + + $selector = '.site-above-footer-wrap[data-section="section-above-footer-builder"]'; + + $footer_bg = astra_get_option( 'hba-footer-bg-obj-responsive' ); + $footer_top_border_size = astra_get_option( 'hba-footer-separator' ); + $footer_top_border_color = astra_get_option( 'hba-footer-top-border-color' ); + $footer_height = astra_get_option( 'hba-footer-height' ); + $footer_width = astra_get_option( 'hba-footer-layout-width' ); + $content_width = astra_get_option( 'site-content-width' ); + $inner_spacing = astra_get_option( 'hba-inner-spacing' ); + + $layout = astra_get_option( 'hba-footer-layout' ); + + $desk_layout = ( isset( $layout['desktop'] ) ) ? $layout['desktop'] : 'full'; + $tab_layout = ( isset( $layout['tablet'] ) ) ? $layout['tablet'] : 'full'; + $mob_layout = ( isset( $layout['mobile'] ) ) ? $layout['mobile'] : 'full'; + + $inner_spacing_desktop = ( isset( $inner_spacing['desktop'] ) ) ? $inner_spacing['desktop'] : ''; + $inner_spacing_tablet = ( isset( $inner_spacing['tablet'] ) ) ? $inner_spacing['tablet'] : ''; + $inner_spacing_mobile = ( isset( $inner_spacing['mobile'] ) ) ? $inner_spacing['mobile'] : ''; + + $css_output_desktop = array( + '.site-above-footer-wrap' => array( + 'padding-top' => '20px', + 'padding-bottom' => '20px', + ), + $selector => astra_get_responsive_background_obj( $footer_bg, 'desktop' ), + $selector . ' .ast-builder-grid-row' => array( + 'grid-column-gap' => astra_get_css_value( $inner_spacing_desktop, 'px' ), + ), + $selector . ' .ast-builder-grid-row, ' . $selector . ' .site-footer-section' => array( + 'align-items' => astra_get_option( 'hba-footer-vertical-alignment' ), + ), + $selector . '.ast-footer-row-inline .site-footer-section' => array( + 'display' => 'flex', + 'margin-bottom' => '0', + ), + '.ast-builder-grid-row-' . $desk_layout . ' .ast-builder-grid-row' => array( + 'grid-template-columns' => Astra_Builder_Helper::$grid_size_mapping[ $desk_layout ], + ), + + ); + + if ( isset( $footer_width ) && 'content' === $footer_width ) { + + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['max-width'] = astra_get_css_value( $content_width, 'px' ); + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['margin-left'] = 'auto'; + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['margin-right'] = 'auto'; + } else { + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['max-width'] = '100%'; + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['padding-left'] = '35px'; + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['padding-right'] = '35px'; + } + + + $css_output_desktop[ $selector ]['min-height'] = astra_get_css_value( $footer_height, 'px' ); + + if ( isset( $footer_top_border_size ) && 1 <= $footer_top_border_size ) { + + $css_output_desktop[ $selector ]['border-style'] = 'solid'; + + $css_output_desktop[ $selector ]['border-width'] = '0px'; + + $css_output_desktop[ $selector ]['border-top-width'] = astra_get_css_value( $footer_top_border_size, 'px' ); + + $css_output_desktop[ $selector ]['border-top-color'] = $footer_top_border_color; + } + + $css_output_tablet = array( + + $selector => astra_get_responsive_background_obj( $footer_bg, 'tablet' ), + $selector . ' .ast-builder-grid-row' => array( + 'grid-column-gap' => astra_get_css_value( $inner_spacing_tablet, 'px' ), + 'grid-row-gap' => astra_get_css_value( $inner_spacing_tablet, 'px' ), + ), + $selector . '.ast-footer-row-tablet-inline .site-footer-section' => array( + 'display' => 'flex', + 'margin-bottom' => '0', + ), + $selector . '.ast-footer-row-tablet-stack .site-footer-section' => array( + 'display' => 'block', + 'margin-bottom' => '10px', + ), + '.ast-builder-grid-row-container.ast-builder-grid-row-tablet-' . $tab_layout . ' .ast-builder-grid-row' => array( + 'grid-template-columns' => Astra_Builder_Helper::$grid_size_mapping[ $tab_layout ], + ), + ); + $css_output_mobile = array( + + $selector => astra_get_responsive_background_obj( $footer_bg, 'mobile' ), + $selector . ' .ast-builder-grid-row' => array( + 'grid-column-gap' => astra_get_css_value( $inner_spacing_mobile, 'px' ), + 'grid-row-gap' => astra_get_css_value( $inner_spacing_mobile, 'px' ), + ), + $selector . '.ast-footer-row-mobile-inline .site-footer-section' => array( + 'display' => 'flex', + 'margin-bottom' => '0', + ), + $selector . '.ast-footer-row-mobile-stack .site-footer-section' => array( + 'display' => 'block', + 'margin-bottom' => '10px', + ), + '.ast-builder-grid-row-container.ast-builder-grid-row-mobile-' . $mob_layout . ' .ast-builder-grid-row' => array( + 'grid-template-columns' => Astra_Builder_Helper::$grid_size_mapping[ $mob_layout ], + ), + ); + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output_desktop ); + $css_output .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); + $css_output .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); + + $dynamic_css .= $css_output; + + $dynamic_css .= Astra_Builder_Base_Dynamic_CSS::prepare_advanced_margin_padding_css( $_section, $selector ); + $dynamic_css .= Astra_Builder_Base_Dynamic_CSS::prepare_visibility_css( $_section, $selector, 'grid' ); + return $dynamic_css; +} diff --git a/inc/builder/type/footer/below-footer/assets/js/minified/customizer-preview.min.js b/inc/builder/type/footer/below-footer/assets/js/minified/customizer-preview.min.js new file mode 100644 index 0000000..a8355dc --- /dev/null +++ b/inc/builder/type/footer/below-footer/assets/js/minified/customizer-preview.min.js @@ -0,0 +1 @@ +!function(){var o=astraBuilderPreview.tablet_break_point||768,a=astraBuilderPreview.mobile_break_point||544,t="section-below-footer-builder",i='.site-below-footer-wrap[data-section="section-below-footer-builder"]';astra_css("astra-settings[hbb-footer-vertical-alignment]","align-items",i+" .ast-builder-grid-row, "+i+" .site-footer-section"),astra_css("astra-settings[hbb-footer-height]","min-height",i,"px"),wp.customize("astra-settings[hbb-inner-spacing]",function(t){t.bind(function(t){var r="";""!=t.desktop&&(r+=i+" .ast-builder-grid-row {",r+="grid-column-gap: "+t.desktop+"px;",r+="} "),""!=t.tablet&&(r+="@media (max-width: "+o+"px) {",r+=i+" .ast-builder-grid-row {",r+="grid-column-gap: "+t.tablet+"px;",r+="grid-row-gap: "+t.tablet+"px;",r+="} ",r+="} "),""!=t.mobile&&(r+="@media (max-width: "+a+"px) {",r+=i+" .ast-builder-grid-row {",r+="grid-column-gap: "+t.mobile+"px;",r+="grid-row-gap: "+t.mobile+"px;",r+="} ",r+="} "),astra_add_dynamic_css("hbb-inner-spacing-toggle-button",r)})}),wp.customize("astra-settings[hbb-footer-separator]",function(t){t.bind(function(t){var r="";""!==t&&(r=i+" {",r+="border-top-width: "+t+"px;",r+="border-top-style: solid",r+="} "),astra_add_dynamic_css("hbb-footer-separator",r)})}),wp.customize("astra-settings[hbb-footer-top-border-color]",function(t){t.bind(function(t){var r="";""!==t&&(r=i+" {",r+="border-top-color: "+t+";",r+="border-top-style: solid",r+="} "),astra_add_dynamic_css("hbb-footer-top-border-color",r)})}),wp.customize("astra-settings[hbb-footer-layout-width]",function(t){t.bind(function(t){var r="";"content"==t&&(r=i+" .ast-builder-grid-row {",r+="max-width: "+AstraBuilderPrimaryFooterData.footer_content_width+"px;",r+="margin-left: auto;",r+="margin-right: auto;",r+="} "),"full"==t&&(r=i+" .ast-builder-grid-row {",r+="max-width: 100%;",r+="padding-right: 35px; padding-left: 35px;",r+="} "),astra_add_dynamic_css("hbb-footer-layout-width",r)})}),astra_apply_responsive_background_css("astra-settings[hbb-footer-bg-obj-responsive]",i,"desktop"),astra_apply_responsive_background_css("astra-settings[hbb-footer-bg-obj-responsive]",i,"tablet"),astra_apply_responsive_background_css("astra-settings[hbb-footer-bg-obj-responsive]",i,"mobile"),astra_builder_advanced_css(t,i),astra_builder_visibility_css(t,i,"grid")}(jQuery);
\ No newline at end of file diff --git a/inc/builder/type/footer/below-footer/assets/js/unminified/customizer-preview.js b/inc/builder/type/footer/below-footer/assets/js/unminified/customizer-preview.js new file mode 100644 index 0000000..f5d8377 --- /dev/null +++ b/inc/builder/type/footer/below-footer/assets/js/unminified/customizer-preview.js @@ -0,0 +1,142 @@ +/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra
+ * @since 3.0.0
+ */
+
+( function( $ ) {
+
+ var tablet_break_point = astraBuilderPreview.tablet_break_point || 768,
+ mobile_break_point = astraBuilderPreview.mobile_break_point || 544;
+
+ var section = 'section-below-footer-builder';
+ var selector = '.site-below-footer-wrap[data-section="section-below-footer-builder"]';
+
+ // Footer Vertical Alignment.
+ astra_css(
+ 'astra-settings[hbb-footer-vertical-alignment]',
+ 'align-items',
+ selector + ' .ast-builder-grid-row, ' + selector + ' .site-footer-section'
+ );
+
+
+ // Header Height.
+ astra_css(
+ 'astra-settings[hbb-footer-height]',
+ 'min-height',
+ selector,
+ 'px'
+ );
+
+ // Inner Space.
+ wp.customize( 'astra-settings[hbb-inner-spacing]', function( value ) {
+ value.bind( function( spacing ) {
+ var dynamicStyle = '';
+ if ( spacing.desktop != '' ) {
+ dynamicStyle += selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'grid-column-gap: ' + spacing.desktop + 'px;';
+ dynamicStyle += '} ';
+ }
+
+ if ( spacing.tablet != '' ) {
+ dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
+ dynamicStyle += selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'grid-column-gap: ' + spacing.tablet + 'px;';
+ dynamicStyle += 'grid-row-gap: ' + spacing.tablet + 'px;';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+ }
+
+ if ( spacing.mobile != '' ) {
+ dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
+ dynamicStyle += selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'grid-column-gap: ' + spacing.mobile + 'px;';
+ dynamicStyle += 'grid-row-gap: ' + spacing.mobile + 'px;';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+ }
+
+ astra_add_dynamic_css( 'hbb-inner-spacing-toggle-button', dynamicStyle );
+ } );
+ } );
+
+ // Border Top width.
+ wp.customize( 'astra-settings[hbb-footer-separator]', function( setting ) {
+ setting.bind( function( separator ) {
+
+ var dynamicStyle = '';
+
+ if ( '' !== separator ) {
+ dynamicStyle = selector + ' {';
+ dynamicStyle += 'border-top-width: ' + separator + 'px;';
+ dynamicStyle += 'border-top-style: solid';
+ dynamicStyle += '} ';
+ }
+
+ astra_add_dynamic_css( 'hbb-footer-separator', dynamicStyle );
+
+ } );
+ } );
+
+ // Border Color.
+
+ wp.customize( 'astra-settings[hbb-footer-top-border-color]', function( setting ) {
+ setting.bind( function( color ) {
+
+ var dynamicStyle = '';
+
+ if ( '' !== color ) {
+ dynamicStyle = selector + ' {';
+ dynamicStyle += 'border-top-color: ' + color + ';';
+ dynamicStyle += 'border-top-style: solid';
+ dynamicStyle += '} ';
+ }
+
+ astra_add_dynamic_css( 'hbb-footer-top-border-color', dynamicStyle );
+
+ } );
+ } );
+
+ // Primary Header - Layout.
+ wp.customize( 'astra-settings[hbb-footer-layout-width]', function( setting ) {
+ setting.bind( function( layout ) {
+
+ var dynamicStyle = '';
+
+ if ( 'content' == layout ) {
+ dynamicStyle = selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'max-width: ' + AstraBuilderPrimaryFooterData.footer_content_width + 'px;';
+ dynamicStyle += 'margin-left: auto;';
+ dynamicStyle += 'margin-right: auto;';
+ dynamicStyle += '} ';
+ }
+
+ if ( 'full' == layout ) {
+ dynamicStyle = selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'max-width: 100%;';
+ dynamicStyle += 'padding-right: 35px; padding-left: 35px;';
+ dynamicStyle += '} ';
+ }
+
+ astra_add_dynamic_css( 'hbb-footer-layout-width', dynamicStyle );
+
+ } );
+ } );
+
+
+ // Responsive BG styles > Below Footer Row.
+ astra_apply_responsive_background_css( 'astra-settings[hbb-footer-bg-obj-responsive]', selector, 'desktop' );
+ astra_apply_responsive_background_css( 'astra-settings[hbb-footer-bg-obj-responsive]', selector, 'tablet' );
+ astra_apply_responsive_background_css( 'astra-settings[hbb-footer-bg-obj-responsive]', selector, 'mobile' );
+
+ // Advanced CSS Generation.
+ astra_builder_advanced_css( section, selector );
+
+ // Advanced Visibility CSS Generation.
+ astra_builder_visibility_css( section, selector, 'grid' );
+
+} )( jQuery );
diff --git a/inc/builder/type/footer/below-footer/class-astra-below-footer-component-loader.php b/inc/builder/type/footer/below-footer/class-astra-below-footer-component-loader.php new file mode 100644 index 0000000..c600d23 --- /dev/null +++ b/inc/builder/type/footer/below-footer/class-astra-below-footer-component-loader.php @@ -0,0 +1,52 @@ +<?php +/** + * Below Footer Styling Loader for Astra theme. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Below Footer Initialization + * + * @since 3.0.0 + */ +class Astra_Below_Footer_Component_Loader { + + /** + * Constructor + * + * @since 3.0.0 + */ + public function __construct() { + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); + } + + /** + * Customizer Preview + * + * @since 3.0.0 + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-footer-below-footer-customizer-preview-js', ASTRA_BUILDER_FOOTER_BELOW_FOOTER_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + + } +} + +/** +* Kicking this off by creating the object of the class. +*/ +new Astra_Below_Footer_Component_Loader(); diff --git a/inc/builder/type/footer/below-footer/class-astra-below-footer.php b/inc/builder/type/footer/below-footer/class-astra-below-footer.php new file mode 100644 index 0000000..e9ff993 --- /dev/null +++ b/inc/builder/type/footer/below-footer/class-astra-below-footer.php @@ -0,0 +1,49 @@ +<?php +/** + * Below Footer component. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +define( 'ASTRA_BUILDER_FOOTER_BELOW_FOOTER_DIR', ASTRA_THEME_DIR . 'inc/builder/type/footer/below-footer' ); +define( 'ASTRA_BUILDER_FOOTER_BELOW_FOOTER_URI', ASTRA_THEME_URI . 'inc/builder/type/footer/below-footer' ); + +if ( ! class_exists( 'Astra_Below_Footer' ) ) { + + /** + * Below Footer Initial Setup + * + * @since 3.0.0 + */ + class Astra_Below_Footer { + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_BUILDER_FOOTER_BELOW_FOOTER_DIR . '/class-astra-below-footer-component-loader.php'; + + // Include front end files. + if ( ! is_admin() ) { + require_once ASTRA_BUILDER_FOOTER_BELOW_FOOTER_DIR . '/dynamic-css/dynamic.css.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + } + + /** + * Kicking this off by creating an object. + */ + new Astra_Below_Footer(); + +} diff --git a/inc/builder/type/footer/below-footer/dynamic-css/dynamic.css.php b/inc/builder/type/footer/below-footer/dynamic-css/dynamic.css.php new file mode 100644 index 0000000..7427eb8 --- /dev/null +++ b/inc/builder/type/footer/below-footer/dynamic-css/dynamic.css.php @@ -0,0 +1,153 @@ +<?php +/** + * Below Footer control - Dynamic CSS + * + * @package Astra Builder + * @since 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Below Footer CSS + */ +add_filter( 'astra_dynamic_theme_css', 'astra_fb_below_footer_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for below Footer. + * + * @since 3.0.0 + */ +function astra_fb_below_footer_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + if ( ! ( Astra_Builder_Helper::is_footer_row_empty( 'below' ) || is_customize_preview() ) ) { + return $dynamic_css; + } + + $_section = 'section-below-footer-builder'; + + $selector = '.site-below-footer-wrap[data-section="section-below-footer-builder"]'; + + $footer_bg = astra_get_option( 'hbb-footer-bg-obj-responsive' ); + $footer_height = astra_get_option( 'hbb-footer-height' ); + $footer_top_border_size = astra_get_option( 'hbb-footer-separator' ); + $footer_top_border_color = astra_get_option( 'hbb-footer-top-border-color' ); + $footer_width = astra_get_option( 'hbb-footer-layout-width' ); + $content_width = astra_get_option( 'site-content-width' ); + $inner_spacing = astra_get_option( 'hbb-inner-spacing' ); + + $layout = astra_get_option( 'hbb-footer-layout' ); + + $desk_layout = ( isset( $layout['desktop'] ) ) ? $layout['desktop'] : 'full'; + $tab_layout = ( isset( $layout['tablet'] ) ) ? $layout['tablet'] : 'full'; + $mob_layout = ( isset( $layout['mobile'] ) ) ? $layout['mobile'] : 'full'; + + $inner_spacing_desktop = ( isset( $inner_spacing['desktop'] ) ) ? $inner_spacing['desktop'] : ''; + $inner_spacing_tablet = ( isset( $inner_spacing['tablet'] ) ) ? $inner_spacing['tablet'] : ''; + $inner_spacing_mobile = ( isset( $inner_spacing['mobile'] ) ) ? $inner_spacing['mobile'] : ''; + + $css_output_desktop = array( + '.site-below-footer-wrap' => array( + 'padding-top' => '20px', + 'padding-bottom' => '20px', + ), + $selector => astra_get_responsive_background_obj( $footer_bg, 'desktop' ), + $selector . ' .ast-builder-grid-row' => array( + 'grid-column-gap' => astra_get_css_value( $inner_spacing_desktop, 'px' ), + ), + $selector . ' .ast-builder-grid-row, ' . $selector . ' .site-footer-section' => array( + 'align-items' => astra_get_option( 'hbb-footer-vertical-alignment' ), + ), + $selector . '.ast-footer-row-inline .site-footer-section' => array( + 'display' => 'flex', + 'margin-bottom' => '0', + ), + '.ast-builder-grid-row-' . $desk_layout . ' .ast-builder-grid-row' => array( + 'grid-template-columns' => Astra_Builder_Helper::$grid_size_mapping[ $desk_layout ], + ), + + ); + + $css_output_desktop[ $selector ]['min-height'] = astra_get_css_value( $footer_height, 'px' ); + + if ( isset( $footer_top_border_size ) && 1 <= $footer_top_border_size ) { + + $css_output_desktop[ $selector ]['border-style'] = 'solid'; + + $css_output_desktop[ $selector ]['border-width'] = '0px'; + + $css_output_desktop[ $selector ]['border-top-width'] = astra_get_css_value( $footer_top_border_size, 'px' ); + + $css_output_desktop[ $selector ]['border-top-color'] = $footer_top_border_color; + } + + $css_output_tablet = array( + + $selector => astra_get_responsive_background_obj( $footer_bg, 'tablet' ), + $selector . ' .ast-builder-grid-row' => array( + 'grid-column-gap' => astra_get_css_value( $inner_spacing_tablet, 'px' ), + 'grid-row-gap' => astra_get_css_value( $inner_spacing_tablet, 'px' ), + ), + $selector . '.ast-footer-row-tablet-inline .site-footer-section' => array( + 'display' => 'flex', + 'margin-bottom' => '0', + ), + $selector . '.ast-footer-row-tablet-stack .site-footer-section' => array( + 'display' => 'block', + 'margin-bottom' => '10px', + ), + '.ast-builder-grid-row-container.ast-builder-grid-row-tablet-' . $tab_layout . ' .ast-builder-grid-row' => array( + 'grid-template-columns' => Astra_Builder_Helper::$grid_size_mapping[ $tab_layout ], + ), + ); + $css_output_mobile = array( + + $selector => astra_get_responsive_background_obj( $footer_bg, 'mobile' ), + $selector . ' .ast-builder-grid-row' => array( + 'grid-column-gap' => astra_get_css_value( $inner_spacing_mobile, 'px' ), + 'grid-row-gap' => astra_get_css_value( $inner_spacing_mobile, 'px' ), + ), + $selector . '.ast-footer-row-mobile-inline .site-footer-section' => array( + 'display' => 'flex', + 'margin-bottom' => '0', + ), + $selector . '.ast-footer-row-mobile-stack .site-footer-section' => array( + 'display' => 'block', + 'margin-bottom' => '10px', + ), + '.ast-builder-grid-row-container.ast-builder-grid-row-mobile-' . $mob_layout . ' .ast-builder-grid-row' => array( + 'grid-template-columns' => Astra_Builder_Helper::$grid_size_mapping[ $mob_layout ], + ), + ); + + if ( isset( $footer_width ) && 'content' === $footer_width ) { + + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['max-width'] = astra_get_css_value( $content_width, 'px' ); + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['margin-left'] = 'auto'; + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['margin-right'] = 'auto'; + } else { + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['max-width'] = '100%'; + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['padding-left'] = '35px'; + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['padding-right'] = '35px'; + } + + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output_desktop ); + $css_output .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); + $css_output .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); + + $dynamic_css .= $css_output; + + $dynamic_css .= Astra_Builder_Base_Dynamic_CSS::prepare_advanced_margin_padding_css( $_section, $selector ); + + $dynamic_css .= Astra_Builder_Base_Dynamic_CSS::prepare_visibility_css( $_section, $selector, 'grid' ); + + return $dynamic_css; +} diff --git a/inc/builder/type/footer/button/assets/js/minified/customizer-preview.min.js b/inc/builder/type/footer/button/assets/js/minified/customizer-preview.min.js new file mode 100644 index 0000000..3a83881 --- /dev/null +++ b/inc/builder/type/footer/button/assets/js/minified/customizer-preview.min.js @@ -0,0 +1 @@ +jQuery,astra_builder_button_css("footer",AstraBuilderFooterButtonData.component_limit);
\ No newline at end of file diff --git a/inc/builder/type/footer/button/assets/js/unminified/customizer-preview.js b/inc/builder/type/footer/button/assets/js/unminified/customizer-preview.js new file mode 100644 index 0000000..45f32cd --- /dev/null +++ b/inc/builder/type/footer/button/assets/js/unminified/customizer-preview.js @@ -0,0 +1,15 @@ +/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra
+ * @since 3.0.0
+ */
+
+( function( $ ) {
+
+ astra_builder_button_css( 'footer', AstraBuilderFooterButtonData.component_limit );
+
+} )( jQuery );
diff --git a/inc/builder/type/footer/button/class-astra-footer-button-component-loader.php b/inc/builder/type/footer/button/class-astra-footer-button-component-loader.php new file mode 100644 index 0000000..eb895bf --- /dev/null +++ b/inc/builder/type/footer/button/class-astra-footer-button-component-loader.php @@ -0,0 +1,62 @@ +<?php +/** + * Button Styling Loader for Astra theme. + * + * @package Astra + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Customizer Initialization + * + * @since 3.0.0 + */ +class Astra_Footer_Button_Component_Loader { + + /** + * Constructor + * + * @since 3.0.0 + */ + public function __construct() { + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); + } + + /** + * Customizer Preview + * + * @since 3.0.0 + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-footer-button-customizer-preview-js', ASTRA_FOOTER_BUTTON_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + + // Localize variables for Button JS. + wp_localize_script( + 'astra-footer-button-customizer-preview-js', + 'AstraBuilderFooterButtonData', + array( + 'component_limit' => defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_footer_button, + 'tablet_break_point' => astra_get_tablet_breakpoint(), + 'mobile_break_point' => astra_get_mobile_breakpoint(), + ) + ); + } +} + +/** +* Kicking this off by creating the object of the class. +*/ +new Astra_Footer_Button_Component_Loader(); diff --git a/inc/builder/type/footer/button/class-astra-footer-button-component.php b/inc/builder/type/footer/button/class-astra-footer-button-component.php new file mode 100644 index 0000000..f0344f9 --- /dev/null +++ b/inc/builder/type/footer/button/class-astra-footer-button-component.php @@ -0,0 +1,46 @@ +<?php +/** + * Footer Colors for Astra theme Buttpn. + * + * @package Astra + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + + +define( 'ASTRA_FOOTER_BUTTON_DIR', ASTRA_THEME_DIR . 'inc/builder/type/footer/button' ); +define( 'ASTRA_FOOTER_BUTTON_URI', ASTRA_THEME_URI . 'inc/builder/type/footer/button' ); + +/** + * Heading Initial Setup + * + * @since 3.0.0 + */ +class Astra_Footer_Button_Component { + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_FOOTER_BUTTON_DIR . '/class-astra-footer-button-component-loader.php'; + + // Include front end files. + if ( ! is_admin() ) { + require_once ASTRA_FOOTER_BUTTON_DIR . '/dynamic-css/dynamic.css.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } +} + +/** + * Kicking this off by creating an object. + */ +new Astra_Footer_Button_Component(); diff --git a/inc/builder/type/footer/button/dynamic-css/dynamic.css.php b/inc/builder/type/footer/button/dynamic-css/dynamic.css.php new file mode 100644 index 0000000..03e2037 --- /dev/null +++ b/inc/builder/type/footer/button/dynamic-css/dynamic.css.php @@ -0,0 +1,90 @@ +<?php +/** + * Butons - Dynamic CSS + * + * @package Astra + * @since 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Heading Colors + */ +add_filter( 'astra_dynamic_theme_css', 'astra_fb_button_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for Heading Colors. + * + * @since 3.0.0 + */ +function astra_fb_button_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + $dynamic_css .= Astra_Button_Component_Dynamic_CSS::astra_button_dynamic_css( 'footer' ); + $fb_button_flag = false; + for ( $index = 1; $index <= Astra_Builder_Helper::$num_of_footer_button; $index++ ) { + + if ( ! Astra_Builder_Helper::is_component_loaded( 'button-' . $index, 'footer' ) ) { + continue; + } + $fb_button_flag = true; + + $selector = '.ast-footer-button-' . $index . '[data-section="section-fb-button-' . $index . '"]'; + + $alignment = astra_get_option( 'footer-button-' . $index . '-alignment' ); + + $desktop_alignment = ( isset( $alignment['desktop'] ) ) ? $alignment['desktop'] : ''; + $tablet_alignment = ( isset( $alignment['tablet'] ) ) ? $alignment['tablet'] : ''; + $mobile_alignment = ( isset( $alignment['mobile'] ) ) ? $alignment['mobile'] : ''; + + /** + * Copyright CSS. + */ + $css_output_desktop = array( + $selector => array( + 'justify-content' => $desktop_alignment, + ), + ); + + $css_output_tablet = array( + $selector => array( + 'justify-content' => $tablet_alignment, + ), + ); + + $css_output_mobile = array( + $selector => array( + 'justify-content' => $mobile_alignment, + ), + ); + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output_desktop ); + $css_output .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); + $css_output .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); + + $dynamic_css .= $css_output; + } + if ( true === $fb_button_flag ) { + $static_css = array( + '[data-section*="section-fb-button-"] .menu-link' => array( + 'display' => 'none', + ), + '[CLASS*="ast-footer-button-"][data-section^="section-fb-button-"]' => array( + 'justify-content' => 'center', + ), + '.site-footer-focus-item[CLASS*="ast-footer-button-"]' => array( + 'display' => 'flex', + ), + ); + return astra_parse_css( $static_css ) . $dynamic_css; + } + + return $dynamic_css; +} diff --git a/inc/builder/type/footer/copyright/assets/js/minified/customizer-preview.min.js b/inc/builder/type/footer/copyright/assets/js/minified/customizer-preview.min.js new file mode 100644 index 0000000..8d1e5a6 --- /dev/null +++ b/inc/builder/type/footer/copyright/assets/js/minified/customizer-preview.min.js @@ -0,0 +1 @@ +!function(){var i=".ast-footer-copyright",e=astraBuilderPreview.tablet_break_point||768,a=astraBuilderPreview.mobile_break_point||544;astra_css("astra-settings[footer-copyright-color]","color",i),astra_responsive_font_size("astra-settings[font-size-section-footer-copyright]",i),wp.customize("astra-settings[footer-copyright-alignment]",function(t){t.bind(function(t){var o;""==t.desktop&&""==t.tablet&&""==t.mobile||(o="",o+=".ast-footer-copyright {",o+="text-align: "+t.desktop+";",o+="} ",o+="@media (max-width: "+e+"px) {",o+=".ast-footer-copyright {",o+="text-align: "+t.tablet+";",o+="} ",o+="} ",o+="@media (max-width: "+a+"px) {",o+=".ast-footer-copyright {",o+="text-align: "+t.mobile+";",o+="} ",o+="} ",astra_add_dynamic_css("footer-copyright-alignment",o))})}),wp.customize("astra-settings[section-footer-copyright-margin]",function(t){t.bind(function(t){var o;""==t.desktop.bottom&&""==t.desktop.top&&""==t.desktop.left&&""==t.desktop.right&&""==t.tablet.bottom&&""==t.tablet.top&&""==t.tablet.left&&""==t.tablet.right&&""==t.mobile.bottom&&""==t.mobile.top&&""==t.mobile.left&&""==t.mobile.right||(o="",o+=i+" {",o+="margin-left: "+t.desktop.left+t["desktop-unit"]+";",o+="margin-right: "+t.desktop.right+t["desktop-unit"]+";",o+="margin-top: "+t.desktop.top+t["desktop-unit"]+";",o+="margin-bottom: "+t.desktop.bottom+t["desktop-unit"]+";",o+="} ",o+="@media (max-width: "+e+"px) {",o+=i+" {",o+="margin-left: "+t.tablet.left+t["tablet-unit"]+";",o+="margin-right: "+t.tablet.right+t["tablet-unit"]+";",o+="margin-top: "+t.tablet.top+t["desktop-unit"]+";",o+="margin-bottom: "+t.tablet.bottom+t["desktop-unit"]+";",o+="} ",o+="} ",o+="@media (max-width: "+a+"px) {",o+=i+" {",o+="margin-left: "+t.mobile.left+t["mobile-unit"]+";",o+="margin-right: "+t.mobile.right+t["mobile-unit"]+";",o+="margin-top: "+t.mobile.top+t["desktop-unit"]+";",o+="margin-bottom: "+t.mobile.bottom+t["desktop-unit"]+";",o+="} ",o+="} ",astra_add_dynamic_css("footer-copyright-margin",o))})}),astra_builder_visibility_css("section-footer-copyright",".ast-footer-copyright.ast-builder-layout-element")}(jQuery);
\ No newline at end of file diff --git a/inc/builder/type/footer/copyright/assets/js/unminified/customizer-preview.js b/inc/builder/type/footer/copyright/assets/js/unminified/customizer-preview.js new file mode 100644 index 0000000..4a70418 --- /dev/null +++ b/inc/builder/type/footer/copyright/assets/js/unminified/customizer-preview.js @@ -0,0 +1,98 @@ +/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra Builder
+ * @since 3.0.0
+ */
+
+( function( $ ) {
+
+ var selector = '.ast-footer-copyright';
+ var visibility_selector = '.ast-footer-copyright.ast-builder-layout-element';
+
+ var tablet_break_point = astraBuilderPreview.tablet_break_point || 768,
+ mobile_break_point = astraBuilderPreview.mobile_break_point || 544;
+
+ // HTML color.
+ astra_css(
+ 'astra-settings[footer-copyright-color]',
+ 'color',
+ selector
+ );
+
+ // Typography CSS Generation.
+ astra_responsive_font_size(
+ 'astra-settings[font-size-section-footer-copyright]',
+ selector
+ );
+
+ wp.customize( 'astra-settings[footer-copyright-alignment]', function( value ) {
+ value.bind( function( alignment ) {
+ if( alignment.desktop != '' || alignment.tablet != '' || alignment.mobile != '' ) {
+ var dynamicStyle = '';
+ dynamicStyle += '.ast-footer-copyright {';
+ dynamicStyle += 'text-align: ' + alignment['desktop'] + ';';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
+ dynamicStyle += '.ast-footer-copyright {';
+ dynamicStyle += 'text-align: ' + alignment['tablet'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
+ dynamicStyle += '.ast-footer-copyright {';
+ dynamicStyle += 'text-align: ' + alignment['mobile'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ astra_add_dynamic_css( 'footer-copyright-alignment', dynamicStyle );
+ }
+ } );
+ } );
+
+ // Margin.
+ wp.customize( 'astra-settings[section-footer-copyright-margin]', function( value ) {
+ value.bind( function( margin ) {
+ if(
+ margin.desktop.bottom != '' || margin.desktop.top != '' || margin.desktop.left != '' || margin.desktop.right != '' ||
+ margin.tablet.bottom != '' || margin.tablet.top != '' || margin.tablet.left != '' || margin.tablet.right != '' ||
+ margin.mobile.bottom != '' || margin.mobile.top != '' || margin.mobile.left != '' || margin.mobile.right != ''
+ ) {
+ var dynamicStyle = '';
+ dynamicStyle += selector + ' {';
+ dynamicStyle += 'margin-left: ' + margin['desktop']['left'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-right: ' + margin['desktop']['right'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-top: ' + margin['desktop']['top'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-bottom: ' + margin['desktop']['bottom'] + margin['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
+ dynamicStyle += selector + ' {';
+ dynamicStyle += 'margin-left: ' + margin['tablet']['left'] + margin['tablet-unit'] + ';';
+ dynamicStyle += 'margin-right: ' + margin['tablet']['right'] + margin['tablet-unit'] + ';';
+ dynamicStyle += 'margin-top: ' + margin['tablet']['top'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-bottom: ' + margin['tablet']['bottom'] + margin['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
+ dynamicStyle += selector + ' {';
+ dynamicStyle += 'margin-left: ' + margin['mobile']['left'] + margin['mobile-unit'] + ';';
+ dynamicStyle += 'margin-right: ' + margin['mobile']['right'] + margin['mobile-unit'] + ';';
+ dynamicStyle += 'margin-top: ' + margin['mobile']['top'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-bottom: ' + margin['mobile']['bottom'] + margin['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+ astra_add_dynamic_css( 'footer-copyright-margin', dynamicStyle );
+ }
+ } );
+ } );
+
+ // Advanced Visibility CSS Generation.
+ astra_builder_visibility_css( 'section-footer-copyright', visibility_selector );
+
+} )( jQuery );
diff --git a/inc/builder/type/footer/copyright/class-astra-footer-copyright-component-loader.php b/inc/builder/type/footer/copyright/class-astra-footer-copyright-component-loader.php new file mode 100644 index 0000000..cf69a0f --- /dev/null +++ b/inc/builder/type/footer/copyright/class-astra-footer-copyright-component-loader.php @@ -0,0 +1,52 @@ +<?php +/** + * Copyright Styling Loader for Astra theme. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Customizer Initialization + * + * @since 3.0.0 + */ +class Astra_Footer_Copyright_Component_Loader { + + /** + * Constructor + * + * @since 3.0.0 + */ + public function __construct() { + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); + } + + /** + * Customizer Preview + * + * @since 3.0.0 + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-footer-copyright-customizer-preview-js', ASTRA_BUILDER_FOOTER_COPYRIGHT_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + + } +} + +/** +* Kicking this off by creating the object of the class. +*/ +new Astra_Footer_Copyright_Component_Loader(); diff --git a/inc/builder/type/footer/copyright/class-astra-footer-copyright-component.php b/inc/builder/type/footer/copyright/class-astra-footer-copyright-component.php new file mode 100644 index 0000000..1c03485 --- /dev/null +++ b/inc/builder/type/footer/copyright/class-astra-footer-copyright-component.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright component. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +define( 'ASTRA_BUILDER_FOOTER_COPYRIGHT_DIR', ASTRA_THEME_DIR . 'inc/builder/type/footer/copyright' ); +define( 'ASTRA_BUILDER_FOOTER_COPYRIGHT_URI', ASTRA_THEME_URI . 'inc/builder/type/footer/copyright' ); + +if ( ! class_exists( 'Astra_Footer_Copyright_Component' ) ) { + + /** + * Astra_Footer_Copyright_Component + * + * @since 3.0.0 + */ + class Astra_Footer_Copyright_Component { + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_BUILDER_FOOTER_COPYRIGHT_DIR . '/class-astra-footer-copyright-component-loader.php'; + + // Include front end files. + if ( ! is_admin() ) { + require_once ASTRA_BUILDER_FOOTER_COPYRIGHT_DIR . '/dynamic-css/dynamic.css.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + } + + /** + * Kicking this off by creating an object. + */ + new Astra_Footer_Copyright_Component(); + +} diff --git a/inc/builder/type/footer/copyright/dynamic-css/dynamic.css.php b/inc/builder/type/footer/copyright/dynamic-css/dynamic.css.php new file mode 100644 index 0000000..bd74c46 --- /dev/null +++ b/inc/builder/type/footer/copyright/dynamic-css/dynamic.css.php @@ -0,0 +1,102 @@ +<?php +/** + * Copyright control - Dynamic CSS + * + * @package Astra Builder + * @since 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Copyright CSS + */ +add_filter( 'astra_dynamic_theme_css', 'astra_fb_copyright_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for Heading Colors. + * + * @since 3.0.0 + */ +function astra_fb_copyright_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + if ( ! Astra_Builder_Helper::is_component_loaded( 'copyright', 'footer' ) ) { + return $dynamic_css; + } + + $_section = 'section-footer-copyright'; + + $selector = '.ast-footer-copyright '; + + $visibility_selector = '.ast-footer-copyright.ast-builder-layout-element'; + + $alignment = astra_get_option( 'footer-copyright-alignment' ); + + $desktop_alignment = ( isset( $alignment['desktop'] ) ) ? $alignment['desktop'] : ''; + $tablet_alignment = ( isset( $alignment['tablet'] ) ) ? $alignment['tablet'] : ''; + $mobile_alignment = ( isset( $alignment['mobile'] ) ) ? $alignment['mobile'] : ''; + + $margin = astra_get_option( $_section . '-margin' ); + + /** + * Copyright CSS. + */ + $css_output_desktop = array( + '.ast-footer-copyright' => array( + 'text-align' => $desktop_alignment, + ), + $selector => array( + 'color' => astra_get_option( 'footer-copyright-color' ), + // Margin CSS. + 'margin-top' => astra_responsive_spacing( $margin, 'top', 'desktop' ), + 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'desktop' ), + 'margin-left' => astra_responsive_spacing( $margin, 'left', 'desktop' ), + 'margin-right' => astra_responsive_spacing( $margin, 'right', 'desktop' ), + ), + ); + + $css_output_tablet = array( + '.ast-footer-copyright' => array( + 'text-align' => $tablet_alignment, + ), + $selector => array( + // Margin CSS. + 'margin-top' => astra_responsive_spacing( $margin, 'top', 'tablet' ), + 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'tablet' ), + 'margin-left' => astra_responsive_spacing( $margin, 'left', 'tablet' ), + 'margin-right' => astra_responsive_spacing( $margin, 'right', 'tablet' ), + ), + ); + + $css_output_mobile = array( + '.ast-footer-copyright' => array( + 'text-align' => $mobile_alignment, + ), + $selector => array( + // Margin CSS. + 'margin-top' => astra_responsive_spacing( $margin, 'top', 'mobile' ), + 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'mobile' ), + 'margin-left' => astra_responsive_spacing( $margin, 'left', 'mobile' ), + 'margin-right' => astra_responsive_spacing( $margin, 'right', 'mobile' ), + ), + ); + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output_desktop ); + $css_output .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); + $css_output .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); + + $dynamic_css .= $css_output; + + $dynamic_css .= Astra_Builder_Base_Dynamic_CSS::prepare_advanced_typography_css( $_section, $selector ); + + $dynamic_css .= Astra_Builder_Base_Dynamic_CSS::prepare_visibility_css( $_section, $visibility_selector ); + + return $dynamic_css; +} diff --git a/inc/builder/type/footer/html/assets/js/minified/customizer-preview.min.js b/inc/builder/type/footer/html/assets/js/minified/customizer-preview.min.js new file mode 100644 index 0000000..08c135c --- /dev/null +++ b/inc/builder/type/footer/html/assets/js/minified/customizer-preview.min.js @@ -0,0 +1 @@ +!function(){var i=AstraBuilderHTMLData.tablet_break_point||768,o=AstraBuilderHTMLData.mobile_break_point||544;astra_builder_html_css("footer",AstraBuilderHTMLData.component_limit);for(var t=1;t<=AstraBuilderHTMLData.component_limit;t++)!function(a){wp.customize("astra-settings[footer-html-"+a+"-alignment]",function(t){t.bind(function(t){var e;""==t.desktop&&""==t.tablet&&""==t.mobile||(e="",e+='.footer-widget-area[data-section="section-fb-html-'+a+'"] .ast-builder-html-element {',e+="text-align: "+t.desktop+";",e+="} ",e+="@media (max-width: "+i+"px) {",e+='.footer-widget-area[data-section="section-fb-html-'+a+'"] .ast-builder-html-element {',e+="text-align: "+t.tablet+";",e+="} ",e+="} ",e+="@media (max-width: "+o+"px) {",e+='.footer-widget-area[data-section="section-fb-html-'+a+'"] .ast-builder-html-element {',e+="text-align: "+t.mobile+";",e+="} ",e+="} ",astra_add_dynamic_css("footer-html-"+a+"-alignment",e))})})}(t)}(jQuery);
\ No newline at end of file diff --git a/inc/builder/type/footer/html/assets/js/unminified/customizer-preview.js b/inc/builder/type/footer/html/assets/js/unminified/customizer-preview.js new file mode 100644 index 0000000..f437ab2 --- /dev/null +++ b/inc/builder/type/footer/html/assets/js/unminified/customizer-preview.js @@ -0,0 +1,47 @@ +/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra Builder
+ * @since 3.0.0
+ */
+
+( function( $ ) {
+
+ var tablet_break_point = AstraBuilderHTMLData.tablet_break_point || 768,
+ mobile_break_point = AstraBuilderHTMLData.mobile_break_point || 544;
+
+ astra_builder_html_css( 'footer', AstraBuilderHTMLData.component_limit );
+
+ for( var index = 1; index <= AstraBuilderHTMLData.component_limit ; index++ ) {
+ (function( index ) {
+ wp.customize( 'astra-settings[footer-html-'+ index +'-alignment]', function( value ) {
+ value.bind( function( alignment ) {
+ if( alignment.desktop != '' || alignment.tablet != '' || alignment.mobile != '' ) {
+ var dynamicStyle = '';
+ dynamicStyle += '.footer-widget-area[data-section="section-fb-html-'+ index +'"] .ast-builder-html-element {';
+ dynamicStyle += 'text-align: ' + alignment['desktop'] + ';';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
+ dynamicStyle += '.footer-widget-area[data-section="section-fb-html-'+ index +'"] .ast-builder-html-element {';
+ dynamicStyle += 'text-align: ' + alignment['tablet'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
+ dynamicStyle += '.footer-widget-area[data-section="section-fb-html-'+ index +'"] .ast-builder-html-element {';
+ dynamicStyle += 'text-align: ' + alignment['mobile'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ astra_add_dynamic_css( 'footer-html-'+ index +'-alignment', dynamicStyle );
+ }
+ } );
+ } );
+ })( index );
+ }
+
+} )( jQuery );
diff --git a/inc/builder/type/footer/html/class-astra-footer-html-component-loader.php b/inc/builder/type/footer/html/class-astra-footer-html-component-loader.php new file mode 100644 index 0000000..dedd754 --- /dev/null +++ b/inc/builder/type/footer/html/class-astra-footer-html-component-loader.php @@ -0,0 +1,62 @@ +<?php +/** + * HTML Styling Loader for Astra theme. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Customizer Initialization + * + * @since 3.0.0 + */ +class Astra_Footer_Html_Component_Loader { + + /** + * Constructor + * + * @since 3.0.0 + */ + public function __construct() { + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); + } + + /** + * Customizer Preview + * + * @since 3.0.0 + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-footer-html-customizer-preview-js', ASTRA_BUILDER_FOOTER_HTML_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + + // Localize variables for HTML JS. + wp_localize_script( + 'astra-footer-html-customizer-preview-js', + 'AstraBuilderHTMLData', + array( + 'component_limit' => defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_footer_html, + 'tablet_break_point' => astra_get_tablet_breakpoint(), + 'mobile_break_point' => astra_get_mobile_breakpoint(), + ) + ); + } +} + +/** +* Kicking this off by creating the object of the class. +*/ +new Astra_Footer_Html_Component_Loader(); diff --git a/inc/builder/type/footer/html/class-astra-footer-html-component.php b/inc/builder/type/footer/html/class-astra-footer-html-component.php new file mode 100644 index 0000000..296beb0 --- /dev/null +++ b/inc/builder/type/footer/html/class-astra-footer-html-component.php @@ -0,0 +1,45 @@ +<?php +/** + * HTML component. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +define( 'ASTRA_BUILDER_FOOTER_HTML_DIR', ASTRA_THEME_DIR . 'inc/builder/type/footer/html' ); +define( 'ASTRA_BUILDER_FOOTER_HTML_URI', ASTRA_THEME_URI . 'inc/builder/type/footer/html' ); + +/** + * Heading Initial Setup + * + * @since 3.0.0 + */ +class Astra_Footer_Html_Component { + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_BUILDER_FOOTER_HTML_DIR . '/class-astra-footer-html-component-loader.php'; + + // Include front end files. + if ( ! is_admin() ) { + require_once ASTRA_BUILDER_FOOTER_HTML_DIR . '/dynamic-css/dynamic.css.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } +} + +/** + * Kicking this off by creating an object. + */ +new Astra_Footer_Html_Component(); diff --git a/inc/builder/type/footer/html/dynamic-css/dynamic.css.php b/inc/builder/type/footer/html/dynamic-css/dynamic.css.php new file mode 100644 index 0000000..d40188e --- /dev/null +++ b/inc/builder/type/footer/html/dynamic-css/dynamic.css.php @@ -0,0 +1,86 @@ +<?php +/** + * HTML control - Dynamic CSS + * + * @package Astra Builder + * @since 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Heading Colors + */ +add_filter( 'astra_dynamic_theme_css', 'astra_fb_html_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for Heading Colors. + * + * @since 3.0.0 + */ +function astra_fb_html_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + $dynamic_css .= Astra_Html_Component_Dynamic_CSS::astra_html_dynamic_css( 'footer' ); + $static_css_flg = false; + $stati_css_output = ''; + for ( $index = 1; $index <= Astra_Builder_Helper::$num_of_footer_html; $index++ ) { + + if ( ! Astra_Builder_Helper::is_component_loaded( 'html-' . $index, 'footer' ) ) { + continue; + } + + $static_css_flg = true; + $selector = '.footer-widget-area[data-section="section-fb-html-' . $index . '"]'; + + $alignment = astra_get_option( 'footer-html-' . $index . '-alignment' ); + + $desktop_alignment = ( isset( $alignment['desktop'] ) ) ? $alignment['desktop'] : ''; + $tablet_alignment = ( isset( $alignment['tablet'] ) ) ? $alignment['tablet'] : ''; + $mobile_alignment = ( isset( $alignment['mobile'] ) ) ? $alignment['mobile'] : ''; + + /** + * Copyright CSS. + */ + $css_output_desktop = array( + $selector . ' .ast-builder-html-element' => array( + 'text-align' => $desktop_alignment, + ), + ); + + $css_output_tablet = array( + $selector . ' .ast-builder-html-element' => array( + 'text-align' => $tablet_alignment, + ), + ); + + $css_output_mobile = array( + $selector . ' .ast-builder-html-element' => array( + 'text-align' => $mobile_alignment, + ), + ); + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output_desktop ); + $css_output .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); + $css_output .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); + + $dynamic_css .= $css_output; + } + + if ( true === $static_css_flg ) { + $stati_css_output .= astra_parse_css( + array( + '.footer-widget-area[data-section^="section-fb-html-"] .ast-builder-html-element' => array( + 'text-align' => 'center', + ), + ) + ); + } + return $stati_css_output . $dynamic_css; +} diff --git a/inc/builder/type/footer/menu/assets/js/minified/customizer-preview.min.js b/inc/builder/type/footer/menu/assets/js/minified/customizer-preview.min.js new file mode 100644 index 0000000..b15bb4b --- /dev/null +++ b/inc/builder/type/footer/menu/assets/js/minified/customizer-preview.min.js @@ -0,0 +1 @@ +!function(){var o="#astra-footer-menu",i=astraBuilderPreview.tablet_break_point||768,a=astraBuilderPreview.mobile_break_point||544;wp.customize("astra-settings[footer-menu-alignment]",function(t){t.bind(function(t){var e;""==t.desktop&&""==t.tablet&&""==t.mobile||(e="",e+='.footer-widget-area[data-section="section-footer-menu"] .astra-footer-vertical-menu .menu-item {',e+="align-items: "+t.desktop+";",e+="} ",e+='.footer-widget-area[data-section="section-footer-menu"] .astra-footer-horizontal-menu {',e+="justify-content: "+t.desktop+";",e+="} ",e+="@media (max-width: "+i+"px) {",e+='.footer-widget-area[data-section="section-footer-menu"] .astra-footer-vertical-menu .menu-item {',e+="align-items: "+t.tablet+";",e+="} ",e+='.footer-widget-area[data-section="section-footer-menu"] .astra-footer-horizontal-menu {',e+="justify-content: "+t.tablet+";",e+="} ",e+="} ",e+="@media (max-width: "+a+"px) {",e+='.footer-widget-area[data-section="section-footer-menu"] .astra-footer-vertical-menu .menu-item {',e+="align-items: "+t.mobile+";",e+="} ",e+='.footer-widget-area[data-section="section-footer-menu"] .astra-footer-horizontal-menu {',e+="justify-content: "+t.mobile+";",e+="} ",e+="} ",astra_add_dynamic_css("footer-menu-alignment",e))})}),astra_responsive_font_size("astra-settings[footer-menu-font-size]",o+" .menu-item > a"),astra_color_responsive_css("astra-footer-menu-preview","astra-settings[footer-menu-color-responsive]","color",o+" .menu-item > a"),astra_color_responsive_css("astra-footer-menu-preview","astra-settings[footer-menu-h-color-responsive]","color",o+" .menu-item:hover > a"),astra_color_responsive_css("astra-footer-menu-preview","astra-settings[footer-menu-a-color-responsive]","color",o+" .menu-item.current-menu-item > a"),astra_apply_responsive_background_css("astra-settings[footer-menu-bg-obj-responsive]",o,"desktop"),astra_apply_responsive_background_css("astra-settings[footer-menu-bg-obj-responsive]",o,"tablet"),astra_apply_responsive_background_css("astra-settings[footer-menu-bg-obj-responsive]",o,"mobile"),astra_color_responsive_css("astra-footer-menu-preview","astra-settings[footer-menu-h-bg-color-responsive]","background",o+" .menu-item:hover > a"),astra_color_responsive_css("astra-footer-menu-preview","astra-settings[footer-menu-a-bg-color-responsive]","background",o+" .menu-item.current-menu-item > a"),wp.customize("astra-settings[footer-main-menu-spacing]",function(t){t.bind(function(t){var e;""==t.desktop.bottom&&""==t.desktop.top&&""==t.desktop.left&&""==t.desktop.right&&""==t.tablet.bottom&&""==t.tablet.top&&""==t.tablet.left&&""==t.tablet.right&&""==t.mobile.bottom&&""==t.mobile.top&&""==t.mobile.left&&""==t.mobile.right||(e="",e+=o+" .menu-item > a {",e+="padding-left: "+t.desktop.left+t["desktop-unit"]+";",e+="padding-right: "+t.desktop.right+t["desktop-unit"]+";",e+="padding-top: "+t.desktop.top+t["desktop-unit"]+";",e+="padding-bottom: "+t.desktop.bottom+t["desktop-unit"]+";",e+="} ",e+="@media (max-width: "+i+"px) {",e+=o+" .menu-item > a {",e+="padding-left: "+t.tablet.left+t["tablet-unit"]+";",e+="padding-right: "+t.tablet.right+t["tablet-unit"]+";",e+="padding-top: "+t.tablet.top+t["tablet-unit"]+";",e+="padding-bottom: "+t.tablet.bottom+t["tablet-unit"]+";",e+="} ",e+="} ",e+="@media (max-width: "+a+"px) {",e+=o+" .menu-item > a {",e+="padding-left: "+t.mobile.left+t["mobile-unit"]+";",e+="padding-right: "+t.mobile.right+t["mobile-unit"]+";",e+="padding-top: "+t.mobile.top+t["mobile-unit"]+";",e+="padding-bottom: "+t.mobile.bottom+t["mobile-unit"]+";",e+="} ",e+="} ",astra_add_dynamic_css("footer-menu-spacing",e))})}),wp.customize("astra-settings[section-footer-menu-margin]",function(t){t.bind(function(t){var e;""==t.desktop.bottom&&""==t.desktop.top&&""==t.desktop.left&&""==t.desktop.right&&""==t.tablet.bottom&&""==t.tablet.top&&""==t.tablet.left&&""==t.tablet.right&&""==t.mobile.bottom&&""==t.mobile.top&&""==t.mobile.left&&""==t.mobile.right||(e="",e+=o+" {",e+="margin-left: "+t.desktop.left+t["desktop-unit"]+";",e+="margin-right: "+t.desktop.right+t["desktop-unit"]+";",e+="margin-top: "+t.desktop.top+t["desktop-unit"]+";",e+="margin-bottom: "+t.desktop.bottom+t["desktop-unit"]+";",e+="} ",e+="@media (max-width: "+i+"px) {",e+=o+" {",e+="margin-left: "+t.tablet.left+t["tablet-unit"]+";",e+="margin-right: "+t.tablet.right+t["tablet-unit"]+";",e+="margin-top: "+t.tablet.top+t["desktop-unit"]+";",e+="margin-bottom: "+t.tablet.bottom+t["desktop-unit"]+";",e+="} ",e+="} ",e+="@media (max-width: "+a+"px) {",e+=o+" {",e+="margin-left: "+t.mobile.left+t["mobile-unit"]+";",e+="margin-right: "+t.mobile.right+t["mobile-unit"]+";",e+="margin-top: "+t.mobile.top+t["desktop-unit"]+";",e+="margin-bottom: "+t.mobile.bottom+t["desktop-unit"]+";",e+="} ",e+="} ",astra_add_dynamic_css("section-footer-menu-margin",e))})}),astra_builder_visibility_css("section-footer-menu",'.footer-widget-area[data-section="section-footer-menu"]',"block")}(jQuery);
\ No newline at end of file diff --git a/inc/builder/type/footer/menu/assets/js/unminified/customizer-preview.js b/inc/builder/type/footer/menu/assets/js/unminified/customizer-preview.js new file mode 100644 index 0000000..050aa76 --- /dev/null +++ b/inc/builder/type/footer/menu/assets/js/unminified/customizer-preview.js @@ -0,0 +1,191 @@ +/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra
+ * @since 3.0.0
+ */
+
+( function( $ ) {
+
+ var selector = '#astra-footer-menu';
+ var visibility_selector = '.footer-widget-area[data-section="section-footer-menu"]';
+
+ var tablet_break_point = astraBuilderPreview.tablet_break_point || 768,
+ mobile_break_point = astraBuilderPreview.mobile_break_point || 544;
+
+ wp.customize( 'astra-settings[footer-menu-alignment]', function( value ) {
+ value.bind( function( alignment ) {
+ if( alignment.desktop != '' || alignment.tablet != '' || alignment.mobile != '' ) {
+ var dynamicStyle = '';
+ dynamicStyle += '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-vertical-menu .menu-item {';
+ dynamicStyle += 'align-items: ' + alignment['desktop'] + ';';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-horizontal-menu {';
+ dynamicStyle += 'justify-content: ' + alignment['desktop'] + ';';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
+ dynamicStyle += '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-vertical-menu .menu-item {';
+ dynamicStyle += 'align-items: ' + alignment['tablet'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-horizontal-menu {';
+ dynamicStyle += 'justify-content: ' + alignment['tablet'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
+ dynamicStyle += '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-vertical-menu .menu-item {';
+ dynamicStyle += 'align-items: ' + alignment['mobile'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-horizontal-menu {';
+ dynamicStyle += 'justify-content: ' + alignment['mobile'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ astra_add_dynamic_css( 'footer-menu-alignment', dynamicStyle );
+ }
+ } );
+ } );
+
+ /**
+ * Typography CSS.
+ */
+ astra_responsive_font_size(
+ 'astra-settings[footer-menu-font-size]',
+ selector + ' .menu-item > a'
+ );
+
+ /**
+ * Menu - Colors
+ */
+ astra_color_responsive_css(
+ 'astra-footer-menu-preview',
+ 'astra-settings[footer-menu-color-responsive]',
+ 'color',
+ selector + ' .menu-item > a'
+ );
+
+ // Menu - Hover Color
+ astra_color_responsive_css(
+ 'astra-footer-menu-preview',
+ 'astra-settings[footer-menu-h-color-responsive]',
+ 'color',
+ selector + ' .menu-item:hover > a'
+ );
+
+ // Menu - Active Color
+ astra_color_responsive_css(
+ 'astra-footer-menu-preview',
+ 'astra-settings[footer-menu-a-color-responsive]',
+ 'color',
+ selector + ' .menu-item.current-menu-item > a'
+ );
+
+ // Responsive BG styles > Footer Menu.
+ astra_apply_responsive_background_css( 'astra-settings[footer-menu-bg-obj-responsive]', selector, 'desktop' );
+ astra_apply_responsive_background_css( 'astra-settings[footer-menu-bg-obj-responsive]', selector, 'tablet' );
+ astra_apply_responsive_background_css( 'astra-settings[footer-menu-bg-obj-responsive]', selector, 'mobile' );
+
+ // Menu - Hover Background
+ astra_color_responsive_css(
+ 'astra-footer-menu-preview',
+ 'astra-settings[footer-menu-h-bg-color-responsive]',
+ 'background',
+ selector + ' .menu-item:hover > a'
+ );
+
+ // Menu - Active Background
+ astra_color_responsive_css(
+ 'astra-footer-menu-preview',
+ 'astra-settings[footer-menu-a-bg-color-responsive]',
+ 'background',
+ selector + ' .menu-item.current-menu-item > a'
+ );
+
+ /**
+ * Spacing CSS.
+ */
+ wp.customize( 'astra-settings[footer-main-menu-spacing]', function( value ) {
+ value.bind( function( padding ) {
+ if(
+ padding.desktop.bottom != '' || padding.desktop.top != '' || padding.desktop.left != '' || padding.desktop.right != '' ||
+ padding.tablet.bottom != '' || padding.tablet.top != '' || padding.tablet.left != '' || padding.tablet.right != '' ||
+ padding.mobile.bottom != '' || padding.mobile.top != '' || padding.mobile.left != '' || padding.mobile.right != ''
+ ) {
+ var dynamicStyle = '';
+ dynamicStyle += selector + ' .menu-item > a {';
+ dynamicStyle += 'padding-left: ' + padding['desktop']['left'] + padding['desktop-unit'] + ';';
+ dynamicStyle += 'padding-right: ' + padding['desktop']['right'] + padding['desktop-unit'] + ';';
+ dynamicStyle += 'padding-top: ' + padding['desktop']['top'] + padding['desktop-unit'] + ';';
+ dynamicStyle += 'padding-bottom: ' + padding['desktop']['bottom'] + padding['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
+ dynamicStyle += selector + ' .menu-item > a {';
+ dynamicStyle += 'padding-left: ' + padding['tablet']['left'] + padding['tablet-unit'] + ';';
+ dynamicStyle += 'padding-right: ' + padding['tablet']['right'] + padding['tablet-unit'] + ';';
+ dynamicStyle += 'padding-top: ' + padding['tablet']['top'] + padding['tablet-unit'] + ';';
+ dynamicStyle += 'padding-bottom: ' + padding['tablet']['bottom'] + padding['tablet-unit'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
+ dynamicStyle += selector + ' .menu-item > a {';
+ dynamicStyle += 'padding-left: ' + padding['mobile']['left'] + padding['mobile-unit'] + ';';
+ dynamicStyle += 'padding-right: ' + padding['mobile']['right'] + padding['mobile-unit'] + ';';
+ dynamicStyle += 'padding-top: ' + padding['mobile']['top'] + padding['mobile-unit'] + ';';
+ dynamicStyle += 'padding-bottom: ' + padding['mobile']['bottom'] + padding['mobile-unit'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ astra_add_dynamic_css( 'footer-menu-spacing', dynamicStyle );
+ }
+ } );
+ } );
+
+ // Margin.
+ wp.customize( 'astra-settings[section-footer-menu-margin]', function( value ) {
+ value.bind( function( margin ) {
+ if(
+ margin.desktop.bottom != '' || margin.desktop.top != '' || margin.desktop.left != '' || margin.desktop.right != '' ||
+ margin.tablet.bottom != '' || margin.tablet.top != '' || margin.tablet.left != '' || margin.tablet.right != '' ||
+ margin.mobile.bottom != '' || margin.mobile.top != '' || margin.mobile.left != '' || margin.mobile.right != ''
+ ) {
+ var dynamicStyle = '';
+ dynamicStyle += selector + ' {';
+ dynamicStyle += 'margin-left: ' + margin['desktop']['left'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-right: ' + margin['desktop']['right'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-top: ' + margin['desktop']['top'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-bottom: ' + margin['desktop']['bottom'] + margin['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
+ dynamicStyle += selector + ' {';
+ dynamicStyle += 'margin-left: ' + margin['tablet']['left'] + margin['tablet-unit'] + ';';
+ dynamicStyle += 'margin-right: ' + margin['tablet']['right'] + margin['tablet-unit'] + ';';
+ dynamicStyle += 'margin-top: ' + margin['tablet']['top'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-bottom: ' + margin['tablet']['bottom'] + margin['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
+ dynamicStyle += selector + ' {';
+ dynamicStyle += 'margin-left: ' + margin['mobile']['left'] + margin['mobile-unit'] + ';';
+ dynamicStyle += 'margin-right: ' + margin['mobile']['right'] + margin['mobile-unit'] + ';';
+ dynamicStyle += 'margin-top: ' + margin['mobile']['top'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-bottom: ' + margin['mobile']['bottom'] + margin['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+ astra_add_dynamic_css( 'section-footer-menu-margin', dynamicStyle );
+ }
+ } );
+ } );
+
+ // Advanced Visibility CSS Generation.
+ astra_builder_visibility_css( 'section-footer-menu', visibility_selector, 'block' );
+
+} )( jQuery );
diff --git a/inc/builder/type/footer/menu/class-astra-footer-menu-component-loader.php b/inc/builder/type/footer/menu/class-astra-footer-menu-component-loader.php new file mode 100644 index 0000000..c4d0355 --- /dev/null +++ b/inc/builder/type/footer/menu/class-astra-footer-menu-component-loader.php @@ -0,0 +1,52 @@ +<?php +/** + * Footer Navigation Menu Styling Loader for Astra theme. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Footer Navigation Menu Initialization + * + * @since 3.0.0 + */ +class Astra_Footer_Menu_Component_Loader { + + /** + * Constructor + * + * @since 3.0.0 + */ + public function __construct() { + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); + } + + /** + * Customizer Preview + * + * @since 3.0.0 + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-footer-menu-customizer-preview', ASTRA_BUILDER_FOOTER_MENU_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + + } +} + +/** +* Kicking this off by creating the object of the class. +*/ +new Astra_Footer_Menu_Component_Loader(); diff --git a/inc/builder/type/footer/menu/class-astra-footer-menu-component.php b/inc/builder/type/footer/menu/class-astra-footer-menu-component.php new file mode 100644 index 0000000..7a89429 --- /dev/null +++ b/inc/builder/type/footer/menu/class-astra-footer-menu-component.php @@ -0,0 +1,114 @@ +<?php +/** + * Footer Navigation Menu component. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +define( 'ASTRA_BUILDER_FOOTER_MENU_DIR', ASTRA_THEME_DIR . 'inc/builder/type/footer/menu' ); +define( 'ASTRA_BUILDER_FOOTER_MENU_URI', ASTRA_THEME_URI . 'inc/builder/type/footer/menu' ); + +/** + * Footer Navigation Menu Initial Setup + * + * @since 3.0.0 + */ +class Astra_Footer_Menu_Component { + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_BUILDER_FOOTER_MENU_DIR . '/class-astra-footer-menu-component-loader.php'; + + // Include front end files. + if ( ! is_admin() ) { + require_once ASTRA_BUILDER_FOOTER_MENU_DIR . '/dynamic-css/dynamic.css.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + + /** + * Secondary navigation markup + * + * @since 3.0.0. + */ + public static function menu_markup() { + + // Menu Layout. + $desktop_menu_layout_class = ''; + $tablet_menu_layout_class = ''; + $mobile_menu_layout_class = ''; + $menu_layout = astra_get_option( 'footer-menu-layout' ); + + $desktop_menu_layout = ( isset( $menu_layout['desktop'] ) ) ? $menu_layout['desktop'] : ''; + $tablet_menu_layout = ( isset( $menu_layout['tablet'] ) ) ? $menu_layout['tablet'] : ''; + $mobile_menu_layout = ( isset( $menu_layout['mobile'] ) ) ? $menu_layout['mobile'] : ''; + + if ( ! empty( $desktop_menu_layout ) ) { + $desktop_menu_layout_class = 'astra-footer-' . esc_attr( $desktop_menu_layout ) . '-menu'; + } + + if ( ! empty( $tablet_menu_layout ) ) { + $tablet_menu_layout_class = 'astra-footer-tablet-' . esc_attr( $tablet_menu_layout ) . '-menu'; + } + + if ( ! empty( $mobile_menu_layout ) ) { + $mobile_menu_layout_class = 'astra-footer-mobile-' . esc_attr( $mobile_menu_layout ) . '-menu'; + } + + /** + * Filter the classes(array) for Menu (<ul>). + * + * @since 3.0.0 + * @var Array + */ + $menu_classes = apply_filters( 'astra_menu_classes', array( 'ast-nav-menu', 'ast-flex', $desktop_menu_layout_class, $tablet_menu_layout_class, $mobile_menu_layout_class ) ); + + $items_wrap = '<nav '; + $items_wrap .= astra_attr( + 'site-navigation', + array( + 'id' => 'site-navigation', + 'class' => 'ast-flex-grow-1 navigation-accessibility footer-navigation', + 'aria-label' => esc_attr__( 'Site Navigation', 'astra' ), + ) + ); + $items_wrap .= '>'; + $items_wrap .= '<div class="footer-nav-wrap">'; + $items_wrap .= '<ul id="%1$s" class="%2$s">%3$s</ul>'; + $items_wrap .= '</div>'; + $items_wrap .= '</nav>'; + + // To add default alignment for navigation which can be added through any third party plugin. + // Do not add any CSS from theme except header alignment. + if ( has_nav_menu( 'footer_menu' ) ) { + wp_nav_menu( + array( + 'depth' => 1, + 'menu_id' => 'astra-footer-menu', + 'menu_class' => esc_attr( implode( ' ', $menu_classes ) ), + 'container' => 'div', + 'container_class' => 'footer-bar-navigation', + 'items_wrap' => $items_wrap, + 'theme_location' => 'footer_menu', + ) + ); + } + } +} + +/** + * Kicking this off by creating an object. + */ +new Astra_Footer_Menu_Component(); diff --git a/inc/builder/type/footer/menu/dynamic-css/dynamic.css.php b/inc/builder/type/footer/menu/dynamic-css/dynamic.css.php new file mode 100644 index 0000000..1686dc8 --- /dev/null +++ b/inc/builder/type/footer/menu/dynamic-css/dynamic.css.php @@ -0,0 +1,291 @@ +<?php +/** + * Footer Menu Colors - Dynamic CSS + * + * @package astra-builder + * @since 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Footer Menu Colors + */ +add_filter( 'astra_dynamic_theme_css', 'astra_hb_footer_menu_dynamic_css', 11 ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for Footer Menu Colors. + * + * @since 3.0.0 + */ +function astra_hb_footer_menu_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + if ( ! Astra_Builder_Helper::is_component_loaded( 'menu', 'footer' ) ) { + return $dynamic_css; + } + + $_section = 'section-footer-menu'; + + $selector = '#astra-footer-menu'; + + $visibility_selector = '.footer-widget-area[data-section="section-footer-menu"]'; + + // Menu. + $menu_resp_color = astra_get_option( 'footer-menu-color-responsive' ); + $menu_resp_bg_color = astra_get_option( 'footer-menu-bg-obj-responsive' ); + $menu_resp_color_hover = astra_get_option( 'footer-menu-h-color-responsive' ); + $menu_resp_bg_color_hover = astra_get_option( 'footer-menu-h-bg-color-responsive' ); + $menu_resp_color_active = astra_get_option( 'footer-menu-a-color-responsive' ); + $menu_resp_bg_color_active = astra_get_option( 'footer-menu-a-bg-color-responsive' ); + + $alignment = astra_get_option( 'footer-menu-alignment' ); + + $desktop_alignment = ( isset( $alignment['desktop'] ) ) ? $alignment['desktop'] : ''; + $tablet_alignment = ( isset( $alignment['tablet'] ) ) ? $alignment['tablet'] : ''; + $mobile_alignment = ( isset( $alignment['mobile'] ) ) ? $alignment['mobile'] : ''; + + $menu_resp_color_desktop = ( isset( $menu_resp_color['desktop'] ) ) ? $menu_resp_color['desktop'] : ''; + $menu_resp_color_tablet = ( isset( $menu_resp_color['tablet'] ) ) ? $menu_resp_color['tablet'] : ''; + $menu_resp_color_mobile = ( isset( $menu_resp_color['mobile'] ) ) ? $menu_resp_color['mobile'] : ''; + + $menu_resp_color_hover_desktop = ( isset( $menu_resp_color_hover['desktop'] ) ) ? $menu_resp_color_hover['desktop'] : ''; + $menu_resp_color_hover_tablet = ( isset( $menu_resp_color_hover['tablet'] ) ) ? $menu_resp_color_hover['tablet'] : ''; + $menu_resp_color_hover_mobile = ( isset( $menu_resp_color_hover['mobile'] ) ) ? $menu_resp_color_hover['mobile'] : ''; + + $menu_resp_bg_color_hover_desktop = ( isset( $menu_resp_bg_color_hover['desktop'] ) ) ? $menu_resp_bg_color_hover['desktop'] : ''; + $menu_resp_bg_color_hover_tablet = ( isset( $menu_resp_bg_color_hover['tablet'] ) ) ? $menu_resp_bg_color_hover['tablet'] : ''; + $menu_resp_bg_color_hover_mobile = ( isset( $menu_resp_bg_color_hover['mobile'] ) ) ? $menu_resp_bg_color_hover['mobile'] : ''; + + $menu_resp_color_active_desktop = ( isset( $menu_resp_color_active['desktop'] ) ) ? $menu_resp_color_active['desktop'] : ''; + $menu_resp_color_active_tablet = ( isset( $menu_resp_color_active['tablet'] ) ) ? $menu_resp_color_active['tablet'] : ''; + $menu_resp_color_active_mobile = ( isset( $menu_resp_color_active['mobile'] ) ) ? $menu_resp_color_active['mobile'] : ''; + + $menu_resp_bg_color_active_desktop = ( isset( $menu_resp_bg_color_active['desktop'] ) ) ? $menu_resp_bg_color_active['desktop'] : ''; + $menu_resp_bg_color_active_tablet = ( isset( $menu_resp_bg_color_active['tablet'] ) ) ? $menu_resp_bg_color_active['tablet'] : ''; + $menu_resp_bg_color_active_mobile = ( isset( $menu_resp_bg_color_active['mobile'] ) ) ? $menu_resp_bg_color_active['mobile'] : ''; + + // Typography. + $menu_font_size = astra_get_option( 'footer-menu-font-size' ); + + $menu_font_size_desktop = ( isset( $menu_font_size['desktop'] ) ) ? $menu_font_size['desktop'] : ''; + $menu_font_size_tablet = ( isset( $menu_font_size['tablet'] ) ) ? $menu_font_size['tablet'] : ''; + $menu_font_size_mobile = ( isset( $menu_font_size['mobile'] ) ) ? $menu_font_size['mobile'] : ''; + $menu_font_size_desktop_unit = ( isset( $menu_font_size['desktop-unit'] ) ) ? $menu_font_size['desktop-unit'] : ''; + $menu_font_size_tablet_unit = ( isset( $menu_font_size['tablet-unit'] ) ) ? $menu_font_size['tablet-unit'] : ''; + $menu_font_size_mobile_unit = ( isset( $menu_font_size['mobile-unit'] ) ) ? $menu_font_size['mobile-unit'] : ''; + + // Menu Spacing. + $menu_spacing = astra_get_option( 'footer-main-menu-spacing' ); + + // - Desktop. + $menu_desktop_spacing_top = ( isset( $menu_spacing['desktop']['top'] ) && ! empty( $menu_spacing['desktop']['top'] ) ) ? $menu_spacing['desktop']['top'] : ''; + + $menu_desktop_spacing_bottom = ( isset( $menu_spacing['desktop']['bottom'] ) && ! empty( $menu_spacing['desktop']['bottom'] ) ) ? $menu_spacing['desktop']['bottom'] : ''; + + $menu_desktop_spacing_right = ( isset( $menu_spacing['desktop']['right'] ) && ! empty( $menu_spacing['desktop']['right'] ) ) ? $menu_spacing['desktop']['right'] : ''; + + $menu_desktop_spacing_left = ( isset( $menu_spacing['desktop']['left'] ) && ! empty( $menu_spacing['desktop']['left'] ) ) ? $menu_spacing['desktop']['left'] : ''; + + $menu_desktop_spacing_unit = ( isset( $menu_spacing['desktop-unit'] ) && ! empty( $menu_spacing['desktop-unit'] ) ) ? $menu_spacing['desktop-unit'] : ''; + + // - Tablet. + $menu_tablet_spacing_top = ( isset( $menu_spacing['tablet']['top'] ) && ! empty( $menu_spacing['tablet']['top'] ) ) ? $menu_spacing['tablet']['top'] : ''; + + $menu_tablet_spacing_bottom = ( isset( $menu_spacing['tablet']['bottom'] ) && ! empty( $menu_spacing['tablet']['bottom'] ) ) ? $menu_spacing['tablet']['bottom'] : ''; + + $menu_tablet_spacing_right = ( isset( $menu_spacing['tablet']['right'] ) && ! empty( $menu_spacing['tablet']['right'] ) ) ? $menu_spacing['tablet']['right'] : ''; + + $menu_tablet_spacing_left = ( isset( $menu_spacing['tablet']['left'] ) && ! empty( $menu_spacing['tablet']['left'] ) ) ? $menu_spacing['tablet']['left'] : ''; + + $menu_tablet_spacing_unit = ( isset( $menu_spacing['tablet-unit'] ) && ! empty( $menu_spacing['tablet-unit'] ) ) ? $menu_spacing['tablet-unit'] : ''; + + // - Mobile. + $menu_mobile_spacing_top = ( isset( $menu_spacing['mobile']['top'] ) && ! empty( $menu_spacing['mobile']['top'] ) ) ? $menu_spacing['mobile']['top'] : ''; + + $menu_mobile_spacing_bottom = ( isset( $menu_spacing['mobile']['bottom'] ) && ! empty( $menu_spacing['mobile']['bottom'] ) ) ? $menu_spacing['mobile']['bottom'] : ''; + + $menu_mobile_spacing_right = ( isset( $menu_spacing['mobile']['right'] ) && ! empty( $menu_spacing['mobile']['right'] ) ) ? $menu_spacing['mobile']['right'] : ''; + + $menu_mobile_spacing_left = ( isset( $menu_spacing['mobile']['left'] ) && ! empty( $menu_spacing['mobile']['left'] ) ) ? $menu_spacing['mobile']['left'] : ''; + + $menu_mobile_spacing_unit = ( isset( $menu_spacing['mobile-unit'] ) && ! empty( $menu_spacing['mobile-unit'] ) ) ? $menu_spacing['mobile-unit'] : ''; + + $margin = astra_get_option( $_section . '-margin' ); + + $arr_footer_ul_desktop = array( + // Margin CSS. + 'margin-top' => astra_responsive_spacing( $margin, 'top', 'desktop' ), + 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'desktop' ), + 'margin-left' => astra_responsive_spacing( $margin, 'left', 'desktop' ), + 'margin-right' => astra_responsive_spacing( $margin, 'right', 'desktop' ), + ); + + $arr_footer_ul_desktop = array_merge( $arr_footer_ul_desktop, astra_get_responsive_background_obj( $menu_resp_bg_color, 'desktop' ) ); + + $css_output_desktop = array( + '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-horizontal-menu' => array( + 'justify-content' => $desktop_alignment, + ), + '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-vertical-menu .menu-item' => array( + 'align-items' => $desktop_alignment, + ), + $selector . ' .menu-item > a' => array( + 'color' => $menu_resp_color_desktop, + 'font-size' => astra_get_font_css_value( $menu_font_size_desktop, $menu_font_size_desktop_unit ), + 'padding-top' => astra_get_css_value( $menu_desktop_spacing_top, $menu_desktop_spacing_unit ), + 'padding-bottom' => astra_get_css_value( $menu_desktop_spacing_bottom, $menu_desktop_spacing_unit ), + 'padding-left' => astra_get_css_value( $menu_desktop_spacing_left, $menu_desktop_spacing_unit ), + 'padding-right' => astra_get_css_value( $menu_desktop_spacing_right, $menu_desktop_spacing_unit ), + ), + $selector . ' .menu-item:hover > a' => array( + 'color' => $menu_resp_color_hover_desktop, + 'background' => $menu_resp_bg_color_hover_desktop, + ), + $selector . ' .menu-item.current-menu-item > a' => array( + 'color' => $menu_resp_color_active_desktop, + 'background' => $menu_resp_bg_color_active_desktop, + ), + $selector => $arr_footer_ul_desktop, + ); + + $arr_footer_ul_tablet = array( + // Margin CSS. + 'margin-top' => astra_responsive_spacing( $margin, 'top', 'tablet' ), + 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'tablet' ), + 'margin-left' => astra_responsive_spacing( $margin, 'left', 'tablet' ), + 'margin-right' => astra_responsive_spacing( $margin, 'right', 'tablet' ), + ); + + $arr_footer_ul_tablet = array_merge( $arr_footer_ul_tablet, astra_get_responsive_background_obj( $menu_resp_bg_color, 'tablet' ) ); + + $css_output_tablet = array( + '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-tablet-horizontal-menu' => array( + 'justify-content' => $tablet_alignment, + ), + '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-tablet-vertical-menu' => array( + 'display' => 'grid', + ), + '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-tablet-vertical-menu .menu-item' => array( + 'align-items' => $tablet_alignment, + ), + $selector . ' .menu-item > a' => array( + 'color' => $menu_resp_color_tablet, + 'font-size' => astra_get_font_css_value( $menu_font_size_tablet, $menu_font_size_tablet_unit ), + 'padding-top' => astra_get_css_value( $menu_tablet_spacing_top, $menu_tablet_spacing_unit ), + 'padding-bottom' => astra_get_css_value( $menu_tablet_spacing_bottom, $menu_tablet_spacing_unit ), + 'padding-left' => astra_get_css_value( $menu_tablet_spacing_left, $menu_tablet_spacing_unit ), + 'padding-right' => astra_get_css_value( $menu_tablet_spacing_right, $menu_tablet_spacing_unit ), + ), + $selector . ' .menu-item:hover > a' => array( + 'color' => $menu_resp_color_hover_tablet, + 'background' => $menu_resp_bg_color_hover_tablet, + ), + $selector . ' .menu-item.current-menu-item > a' => array( + 'color' => $menu_resp_color_active_tablet, + 'background' => $menu_resp_bg_color_active_tablet, + ), + $selector => $arr_footer_ul_tablet, + ); + + $arr_footer_ul_mobile = array( + // Margin CSS. + 'margin-top' => astra_responsive_spacing( $margin, 'top', 'mobile' ), + 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'mobile' ), + 'margin-left' => astra_responsive_spacing( $margin, 'left', 'mobile' ), + 'margin-right' => astra_responsive_spacing( $margin, 'right', 'mobile' ), + ); + + $arr_footer_ul_mobile = array_merge( $arr_footer_ul_mobile, astra_get_responsive_background_obj( $menu_resp_bg_color, 'mobile' ) ); + + $css_output_mobile = array( + $selector => astra_get_responsive_background_obj( $menu_resp_bg_color, 'mobile' ), + '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-mobile-horizontal-menu' => array( + 'justify-content' => $mobile_alignment, + ), + '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-mobile-vertical-menu' => array( + 'display' => 'grid', + ), + '.footer-widget-area[data-section="section-footer-menu"] .astra-footer-mobile-vertical-menu .menu-item' => array( + 'align-items' => $mobile_alignment, + ), + $selector . ' .menu-item > a' => array( + 'color' => $menu_resp_color_mobile, + 'font-size' => astra_get_font_css_value( $menu_font_size_mobile, $menu_font_size_mobile_unit ), + 'padding-top' => astra_get_css_value( $menu_mobile_spacing_top, $menu_mobile_spacing_unit ), + 'padding-bottom' => astra_get_css_value( $menu_mobile_spacing_bottom, $menu_mobile_spacing_unit ), + 'padding-left' => astra_get_css_value( $menu_mobile_spacing_left, $menu_mobile_spacing_unit ), + 'padding-right' => astra_get_css_value( $menu_mobile_spacing_right, $menu_mobile_spacing_unit ), + ), + $selector . ' .menu-item:hover > a' => array( + 'color' => $menu_resp_color_hover_mobile, + 'background' => $menu_resp_bg_color_hover_mobile, + ), + $selector . ' .menu-item.current-menu-item > a' => array( + 'color' => $menu_resp_color_active_mobile, + 'background' => $menu_resp_bg_color_active_mobile, + ), + $selector => $arr_footer_ul_mobile, + ); + + /* Parse CSS from array() */ + $css_output = footer_menu_static_css(); + $css_output .= astra_parse_css( $css_output_desktop ); + $css_output .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); + $css_output .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); + + $dynamic_css .= $css_output; + + $dynamic_css .= Astra_Builder_Base_Dynamic_CSS::prepare_visibility_css( $_section, $visibility_selector, 'block' ); + + return $dynamic_css; +} + +/** + * Footer menu static CSS + * + * @since 3.5.0 + * @return string + */ +function footer_menu_static_css() { + $footer_menu_css = ' + .footer-nav-wrap .astra-footer-vertical-menu { + display: grid; + } + @media (min-width: 769px) { + .footer-nav-wrap .astra-footer-horizontal-menu li { + margin: 0; + } + .footer-nav-wrap .astra-footer-horizontal-menu a { + padding: 0 0.5em; + } + }'; + + if ( is_rtl() ) { + $footer_menu_css .= ' + @media (min-width: 769px) { + .footer-nav-wrap .astra-footer-horizontal-menu li:first-child a { + padding-right: 0; + } + .footer-nav-wrap .astra-footer-horizontal-menu li:last-child a { + padding-left: 0; + } + }'; + } else { + $footer_menu_css .= ' + @media (min-width: 769px) { + .footer-nav-wrap .astra-footer-horizontal-menu li:first-child a { + padding-left: 0; + } + .footer-nav-wrap .astra-footer-horizontal-menu li:last-child a { + padding-right: 0; + } + }'; + } + return Astra_Enqueue_Scripts::trim_css( $footer_menu_css ); +} diff --git a/inc/builder/type/footer/primary-footer/assets/js/minified/customizer-preview.min.js b/inc/builder/type/footer/primary-footer/assets/js/minified/customizer-preview.min.js new file mode 100644 index 0000000..34b93c8 --- /dev/null +++ b/inc/builder/type/footer/primary-footer/assets/js/minified/customizer-preview.min.js @@ -0,0 +1 @@ +!function(){var s=astraBuilderPreview.tablet_break_point||768,a=astraBuilderPreview.mobile_break_point||544,t="section-primary-footer-builder",e='.site-primary-footer-wrap[data-section="section-primary-footer-builder"]';wp.customize("astra-settings[hb-footer-layout-width]",function(t){t.bind(function(t){var r="";"content"==t&&(r=e+" .ast-builder-grid-row {",r+="max-width: "+AstraBuilderPrimaryFooterData.footer_content_width+"px;",r+="margin-left: auto;",r+="margin-right: auto;",r+="} "),"full"==t&&(r=e+" .ast-builder-grid-row {",r+="max-width: 100%;",r+="padding-right: 35px; padding-left: 35px;",r+="} "),astra_add_dynamic_css("hb-footer-layout-width",r)})}),astra_css("astra-settings[hb-footer-vertical-alignment]","align-items",e+" .ast-builder-grid-row, "+e+" .site-footer-section"),wp.customize("astra-settings[hb-inner-spacing]",function(t){t.bind(function(t){var r="";""!=t.desktop&&(r+=e+" .ast-builder-grid-row {",r+="grid-column-gap: "+t.desktop+"px;",r+="} "),""!=t.tablet&&(r+="@media (max-width: "+s+"px) {",r+=e+" .ast-builder-grid-row {",r+="grid-column-gap: "+t.tablet+"px;",r+="grid-row-gap: "+t.tablet+"px;",r+="} ",r+="} "),""!=t.mobile&&(r+="@media (max-width: "+a+"px) {",r+=e+" .ast-builder-grid-row {",r+="grid-column-gap: "+t.mobile+"px;",r+="grid-row-gap: "+t.mobile+"px;",r+="} ",r+="} "),astra_add_dynamic_css("hb-inner-spacing-toggle-button",r)})}),astra_css("astra-settings[hb-footer-main-sep]","border-top-width",e,"px"),astra_css("astra-settings[hb-footer-main-sep-color]","border-color",e);astra_add_dynamic_css("hb-footer-main-sep-color",'.site-primary-footer-wrap[data-section="section-primary-footer-builder"] {border-top-style: solid} '),astra_apply_responsive_background_css("astra-settings[hb-footer-bg-obj-responsive]",e,"desktop"),astra_apply_responsive_background_css("astra-settings[hb-footer-bg-obj-responsive]",e,"tablet"),astra_apply_responsive_background_css("astra-settings[hb-footer-bg-obj-responsive]",e,"mobile"),astra_apply_responsive_background_css("astra-settings[footer-bg-obj-responsive]",".site-footer","desktop"),astra_apply_responsive_background_css("astra-settings[footer-bg-obj-responsive]",".site-footer","tablet"),astra_apply_responsive_background_css("astra-settings[footer-bg-obj-responsive]",".site-footer","mobile"),astra_builder_advanced_css(t,e),astra_builder_advanced_css("section-footer-builder-layout",".ast-hfb-header .site-footer"),astra_builder_visibility_css(t,e,"grid")}(jQuery);
\ No newline at end of file diff --git a/inc/builder/type/footer/primary-footer/assets/js/unminified/customizer-preview.js b/inc/builder/type/footer/primary-footer/assets/js/unminified/customizer-preview.js new file mode 100644 index 0000000..c0e089a --- /dev/null +++ b/inc/builder/type/footer/primary-footer/assets/js/unminified/customizer-preview.js @@ -0,0 +1,124 @@ +/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra
+ * @since 3.0.0
+ */
+
+( function( $ ) {
+
+ var tablet_break_point = astraBuilderPreview.tablet_break_point || 768,
+ mobile_break_point = astraBuilderPreview.mobile_break_point || 544;
+
+ var section = 'section-primary-footer-builder';
+ var selector = '.site-primary-footer-wrap[data-section="section-primary-footer-builder"]';
+
+ // Primary Header - Layout.
+ wp.customize( 'astra-settings[hb-footer-layout-width]', function( setting ) {
+ setting.bind( function( layout ) {
+
+ var dynamicStyle = '';
+
+ if ( 'content' == layout ) {
+ dynamicStyle = selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'max-width: ' + AstraBuilderPrimaryFooterData.footer_content_width + 'px;';
+ dynamicStyle += 'margin-left: auto;';
+ dynamicStyle += 'margin-right: auto;';
+ dynamicStyle += '} ';
+ }
+
+ if ( 'full' == layout ) {
+ dynamicStyle = selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'max-width: 100%;';
+ dynamicStyle += 'padding-right: 35px; padding-left: 35px;';
+ dynamicStyle += '} ';
+ }
+
+ astra_add_dynamic_css( 'hb-footer-layout-width', dynamicStyle );
+
+ } );
+ } );
+
+ // Footer Vertical Alignment.
+ astra_css(
+ 'astra-settings[hb-footer-vertical-alignment]',
+ 'align-items',
+ selector + ' .ast-builder-grid-row, ' + selector + ' .site-footer-section'
+ );
+
+ // Inner Space.
+ wp.customize( 'astra-settings[hb-inner-spacing]', function( value ) {
+ value.bind( function( spacing ) {
+ var dynamicStyle = '';
+ if ( spacing.desktop != '' ) {
+ dynamicStyle += selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'grid-column-gap: ' + spacing.desktop + 'px;';
+ dynamicStyle += '} ';
+ }
+
+ if ( spacing.tablet != '' ) {
+ dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
+ dynamicStyle += selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'grid-column-gap: ' + spacing.tablet + 'px;';
+ dynamicStyle += 'grid-row-gap: ' + spacing.tablet + 'px;';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+ }
+
+ if ( spacing.mobile != '' ) {
+ dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
+ dynamicStyle += selector + ' .ast-builder-grid-row {';
+ dynamicStyle += 'grid-column-gap: ' + spacing.mobile + 'px;';
+ dynamicStyle += 'grid-row-gap: ' + spacing.mobile + 'px;';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+ }
+
+ astra_add_dynamic_css( 'hb-inner-spacing-toggle-button', dynamicStyle );
+ } );
+ } );
+
+ // Border Top width.
+ astra_css(
+ 'astra-settings[hb-footer-main-sep]',
+ 'border-top-width',
+ selector,
+ 'px'
+ );
+
+ // Border Color.
+ astra_css(
+ 'astra-settings[hb-footer-main-sep-color]',
+ 'border-color',
+ selector
+ );
+
+ var dynamicStyle = selector + ' {';
+ dynamicStyle += 'border-top-style: solid';
+ dynamicStyle += '} ';
+
+ astra_add_dynamic_css( 'hb-footer-main-sep-color', dynamicStyle );
+
+ // Responsive BG styles > Primary Footer Row.
+ astra_apply_responsive_background_css( 'astra-settings[hb-footer-bg-obj-responsive]', selector, 'desktop' );
+ astra_apply_responsive_background_css( 'astra-settings[hb-footer-bg-obj-responsive]', selector, 'tablet' );
+ astra_apply_responsive_background_css( 'astra-settings[hb-footer-bg-obj-responsive]', selector, 'mobile' );
+
+ // Responsive BG styles > Global Footer Row.
+ astra_apply_responsive_background_css( 'astra-settings[footer-bg-obj-responsive]', '.site-footer', 'desktop' );
+ astra_apply_responsive_background_css( 'astra-settings[footer-bg-obj-responsive]', '.site-footer', 'tablet' );
+ astra_apply_responsive_background_css( 'astra-settings[footer-bg-obj-responsive]', '.site-footer', 'mobile' );
+
+ // Advanced CSS Generation.
+ astra_builder_advanced_css( section, selector );
+
+ // Advanced CSS for Header Builder.
+ astra_builder_advanced_css( 'section-footer-builder-layout', '.ast-hfb-header .site-footer' );
+
+ // Advanced Visibility CSS Generation.
+ astra_builder_visibility_css( section, selector, 'grid' );
+
+} )( jQuery );
diff --git a/inc/builder/type/footer/primary-footer/class-astra-primary-footer-component-loader.php b/inc/builder/type/footer/primary-footer/class-astra-primary-footer-component-loader.php new file mode 100644 index 0000000..3e8dbee --- /dev/null +++ b/inc/builder/type/footer/primary-footer/class-astra-primary-footer-component-loader.php @@ -0,0 +1,60 @@ +<?php +/** + * Primary Footer Styling Loader for Astra theme. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Primary Footer Initialization + * + * @since 3.0.0 + */ +class Astra_Primary_Footer_Component_Loader { + + /** + * Constructor + * + * @since 3.0.0 + */ + public function __construct() { + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); + } + + /** + * Customizer Preview + * + * @since 3.0.0 + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-footer-primary-footer-customizer-preview-js', ASTRA_BUILDER_FOOTER_PRIMARY_FOOTER_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + + // Localize variables for Footer JS. + wp_localize_script( + 'astra-heading-primary-customizer-preview-js', + 'AstraBuilderPrimaryFooterData', + array( + 'footer_content_width' => astra_get_option( 'site-content-width' ), + ) + ); + } +} + +/** +* Kicking this off by creating the object of the class. +*/ +new Astra_Primary_Footer_Component_Loader(); diff --git a/inc/builder/type/footer/primary-footer/class-astra-primary-footer.php b/inc/builder/type/footer/primary-footer/class-astra-primary-footer.php new file mode 100644 index 0000000..6a2b92c --- /dev/null +++ b/inc/builder/type/footer/primary-footer/class-astra-primary-footer.php @@ -0,0 +1,50 @@ +<?php +/** + * Primary Footer component. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +define( 'ASTRA_BUILDER_FOOTER_PRIMARY_FOOTER_DIR', ASTRA_THEME_DIR . 'inc/builder/type/footer/primary-footer' ); +define( 'ASTRA_BUILDER_FOOTER_PRIMARY_FOOTER_URI', ASTRA_THEME_URI . 'inc/builder/type/footer/primary-footer' ); + +if ( ! class_exists( 'Astra_Primary_Footer' ) ) { + + /** + * Primary Footer Initial Setup + * + * @since 3.0.0 + */ + class Astra_Primary_Footer { + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_BUILDER_FOOTER_PRIMARY_FOOTER_DIR . '/class-astra-primary-footer-component-loader.php'; + + // Include front end files. + if ( ! is_admin() ) { + + require_once ASTRA_BUILDER_FOOTER_PRIMARY_FOOTER_DIR . '/dynamic-css/dynamic.css.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + } + + /** + * Kicking this off by creating an object. + */ + new Astra_Primary_Footer(); + +} diff --git a/inc/builder/type/footer/primary-footer/dynamic-css/dynamic.css.php b/inc/builder/type/footer/primary-footer/dynamic-css/dynamic.css.php new file mode 100644 index 0000000..9cde713 --- /dev/null +++ b/inc/builder/type/footer/primary-footer/dynamic-css/dynamic.css.php @@ -0,0 +1,165 @@ +<?php +/** + * Primary Footer control - Dynamic CSS + * + * @package Astra Builder + * @since 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Primary Footer CSS + */ +add_filter( 'astra_dynamic_theme_css', 'astra_fb_primary_footer_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for Primary Footer. + * + * @since 3.0.0 + */ +function astra_fb_primary_footer_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + if ( ! ( Astra_Builder_Helper::is_footer_row_empty( 'primary' ) || is_customize_preview() ) ) { + return $dynamic_css; + } + + $global_footer_bg = astra_get_option( 'footer-bg-obj-responsive' ); + + $css_output_desktop = array( + '.site-footer' => astra_get_responsive_background_obj( $global_footer_bg, 'desktop' ), + ); + + $dynamic_css .= astra_parse_css( $css_output_desktop ); + // Advanced CSS for Header Builder. + $dynamic_css .= Astra_Builder_Base_Dynamic_CSS::prepare_advanced_margin_padding_css( 'section-footer-builder-layout', '.ast-hfb-header .site-footer' ); + + if ( ! ( Astra_Builder_Helper::is_footer_row_empty( 'primary' ) || is_customize_preview() ) ) { + return $dynamic_css; + } + + $_section = 'section-primary-footer-builder'; + + $selector = '.site-primary-footer-wrap[data-section="section-primary-footer-builder"]'; + + $footer_bg = astra_get_option( 'hb-footer-bg-obj-responsive' ); + $footer_top_border_size = astra_get_option( 'hb-footer-main-sep' ); + $footer_top_border_color = astra_get_option( 'hb-footer-main-sep-color' ); + $footer_width = astra_get_option( 'hb-footer-layout-width' ); + $content_width = astra_get_option( 'site-content-width' ); + $inner_spacing = astra_get_option( 'hb-inner-spacing' ); + + $layout = astra_get_option( 'hb-footer-layout' ); + + $desk_layout = ( isset( $layout['desktop'] ) ) ? $layout['desktop'] : 'full'; + $tab_layout = ( isset( $layout['tablet'] ) ) ? $layout['tablet'] : 'full'; + $mob_layout = ( isset( $layout['mobile'] ) ) ? $layout['mobile'] : 'full'; + + $inner_spacing_desktop = ( isset( $inner_spacing['desktop'] ) ) ? $inner_spacing['desktop'] : ''; + $inner_spacing_tablet = ( isset( $inner_spacing['tablet'] ) ) ? $inner_spacing['tablet'] : ''; + $inner_spacing_mobile = ( isset( $inner_spacing['mobile'] ) ) ? $inner_spacing['mobile'] : ''; + + $css_output_desktop = array( + '.site-primary-footer-wrap' => array( + 'padding-top' => '45px', + 'padding-bottom' => '45px', + ), + $selector => astra_get_responsive_background_obj( $footer_bg, 'desktop' ), + $selector . ' .ast-builder-grid-row' => array( + 'grid-column-gap' => astra_get_css_value( $inner_spacing_desktop, 'px' ), + ), + $selector . ' .ast-builder-grid-row, ' . $selector . ' .site-footer-section' => array( + 'align-items' => astra_get_option( 'hb-footer-vertical-alignment' ), + ), + $selector . '.ast-footer-row-inline .site-footer-section' => array( + 'display' => 'flex', + 'margin-bottom' => '0', + ), + '.ast-builder-grid-row-' . $desk_layout . ' .ast-builder-grid-row' => array( + 'grid-template-columns' => Astra_Builder_Helper::$grid_size_mapping[ $desk_layout ], + ), + + ); + + if ( isset( $footer_top_border_size ) && 1 <= $footer_top_border_size ) { + + $css_output_desktop[ $selector ]['border-style'] = 'solid'; + + $css_output_desktop[ $selector ]['border-width'] = '0px'; + + $css_output_desktop[ $selector ]['border-top-width'] = astra_get_css_value( $footer_top_border_size, 'px' ); + + $css_output_desktop[ $selector ]['border-top-color'] = $footer_top_border_color; + } + + if ( isset( $footer_width ) && 'content' === $footer_width ) { + + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['max-width'] = astra_get_css_value( $content_width, 'px' ); + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['margin-left'] = 'auto'; + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['margin-right'] = 'auto'; + } else { + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['max-width'] = '100%'; + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['padding-left'] = '35px'; + $css_output_desktop[ $selector . ' .ast-builder-grid-row' ]['padding-right'] = '35px'; + } + + $css_output_tablet = array( + + $selector => astra_get_responsive_background_obj( $footer_bg, 'tablet' ), + '.site-footer' => astra_get_responsive_background_obj( $global_footer_bg, 'tablet' ), + $selector . ' .ast-builder-grid-row' => array( + 'grid-column-gap' => astra_get_css_value( $inner_spacing_tablet, 'px' ), + 'grid-row-gap' => astra_get_css_value( $inner_spacing_tablet, 'px' ), + ), + $selector . '.ast-footer-row-tablet-inline .site-footer-section' => array( + 'display' => 'flex', + 'margin-bottom' => '0', + ), + $selector . '.ast-footer-row-tablet-stack .site-footer-section' => array( + 'display' => 'block', + 'margin-bottom' => '10px', + ), + '.ast-builder-grid-row-container.ast-builder-grid-row-tablet-' . $tab_layout . ' .ast-builder-grid-row' => array( + 'grid-template-columns' => Astra_Builder_Helper::$grid_size_mapping[ $tab_layout ], + ), + ); + $css_output_mobile = array( + + $selector => astra_get_responsive_background_obj( $footer_bg, 'mobile' ), + '.site-footer' => astra_get_responsive_background_obj( $global_footer_bg, 'mobile' ), + $selector . ' .ast-builder-grid-row' => array( + 'grid-column-gap' => astra_get_css_value( $inner_spacing_mobile, 'px' ), + 'grid-row-gap' => astra_get_css_value( $inner_spacing_mobile, 'px' ), + ), + $selector . '.ast-footer-row-mobile-inline .site-footer-section' => array( + 'display' => 'flex', + 'margin-bottom' => '0', + ), + $selector . '.ast-footer-row-mobile-stack .site-footer-section' => array( + 'display' => 'block', + 'margin-bottom' => '10px', + ), + '.ast-builder-grid-row-container.ast-builder-grid-row-mobile-' . $mob_layout . ' .ast-builder-grid-row' => array( + 'grid-template-columns' => Astra_Builder_Helper::$grid_size_mapping[ $mob_layout ], + ), + ); + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output_desktop ); + $css_output .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); + $css_output .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); + + $dynamic_css .= $css_output; + + $dynamic_css .= Astra_Builder_Base_Dynamic_CSS::prepare_advanced_margin_padding_css( $_section, $selector ); + + $dynamic_css .= Astra_Builder_Base_Dynamic_CSS::prepare_visibility_css( $_section, $selector, 'grid' ); + + return $dynamic_css; +} diff --git a/inc/builder/type/footer/social-icon/assets/js/minified/customizer-preview.min.js b/inc/builder/type/footer/social-icon/assets/js/minified/customizer-preview.min.js new file mode 100644 index 0000000..8ca4a0a --- /dev/null +++ b/inc/builder/type/footer/social-icon/assets/js/minified/customizer-preview.min.js @@ -0,0 +1 @@ +jQuery,astra_builder_social_css("footer",astraBuilderFooterSocial.component_limit);
\ No newline at end of file diff --git a/inc/builder/type/footer/social-icon/assets/js/unminified/customizer-preview.js b/inc/builder/type/footer/social-icon/assets/js/unminified/customizer-preview.js new file mode 100644 index 0000000..5658cac --- /dev/null +++ b/inc/builder/type/footer/social-icon/assets/js/unminified/customizer-preview.js @@ -0,0 +1,15 @@ +/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra
+ * @since 3.0.0
+ */
+
+( function( $ ) {
+
+ astra_builder_social_css( 'footer', astraBuilderFooterSocial.component_limit );
+
+} )( jQuery );
diff --git a/inc/builder/type/footer/social-icon/class-astra-footer-social-icons-component-loader.php b/inc/builder/type/footer/social-icon/class-astra-footer-social-icons-component-loader.php new file mode 100644 index 0000000..408692c --- /dev/null +++ b/inc/builder/type/footer/social-icon/class-astra-footer-social-icons-component-loader.php @@ -0,0 +1,62 @@ +<?php +/** + * Social Icons Styling Loader for Astra theme. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Social Icons Initialization + * + * @since 3.0.0 + */ +class Astra_Footer_Social_Icons_Component_Loader { + + /** + * Constructor + * + * @since 3.0.0 + */ + public function __construct() { + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); + } + + /** + * Customizer Preview + * + * @since 3.0.0 + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-footer-social-icons-customizer-preview-js', ASTRA_BUILDER_FOOTER_SOCIAL_ICONS_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + + // Localize variables for Astra Breakpoints JS. + wp_localize_script( + 'astra-footer-social-icons-customizer-preview-js', + 'astraBuilderFooterSocial', + array( + 'tablet_break_point' => astra_get_tablet_breakpoint(), + 'mobile_break_point' => astra_get_mobile_breakpoint(), + 'component_limit' => defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_footer_social_icons, + ) + ); + } +} + +/** +* Kicking this off by creating the object of the class. +*/ +new Astra_Footer_Social_Icons_Component_Loader(); diff --git a/inc/builder/type/footer/social-icon/class-astra-footer-social-icons-component.php b/inc/builder/type/footer/social-icon/class-astra-footer-social-icons-component.php new file mode 100644 index 0000000..4890d26 --- /dev/null +++ b/inc/builder/type/footer/social-icon/class-astra-footer-social-icons-component.php @@ -0,0 +1,45 @@ +<?php +/** + * Social Icons component. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +define( 'ASTRA_BUILDER_FOOTER_SOCIAL_ICONS_DIR', ASTRA_THEME_DIR . 'inc/builder/type/footer/social-icon' ); +define( 'ASTRA_BUILDER_FOOTER_SOCIAL_ICONS_URI', ASTRA_THEME_URI . 'inc/builder/type/footer/social-icon' ); + +/** + * Social Icons Initial Setup + * + * @since 3.0.0 + */ +class Astra_Footer_Social_Icons_Component { + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_BUILDER_FOOTER_SOCIAL_ICONS_DIR . '/class-astra-footer-social-icons-component-loader.php'; + + // Include front end files. + if ( ! is_admin() ) { + require_once ASTRA_BUILDER_FOOTER_SOCIAL_ICONS_DIR . '/dynamic-css/dynamic.css.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } +} + +/** + * Kicking this off by creating an object. + */ +new Astra_Footer_Social_Icons_Component(); diff --git a/inc/builder/type/footer/social-icon/dynamic-css/dynamic.css.php b/inc/builder/type/footer/social-icon/dynamic-css/dynamic.css.php new file mode 100644 index 0000000..6ad9621 --- /dev/null +++ b/inc/builder/type/footer/social-icon/dynamic-css/dynamic.css.php @@ -0,0 +1,32 @@ +<?php +/** + * Social Icons control - Dynamic CSS + * + * @package Astra Builder + * @since 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Social Icons Colors + */ +add_filter( 'astra_dynamic_theme_css', 'astra_fb_social_icon_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for Social Icons Colors. + * + * @since 3.0.0 + */ +function astra_fb_social_icon_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + $dynamic_css .= Astra_Social_Component_Dynamic_CSS::astra_social_dynamic_css( 'footer' ); + + return $dynamic_css; +} diff --git a/inc/builder/type/footer/widget/assets/js/minified/customizer-preview.min.js b/inc/builder/type/footer/widget/assets/js/minified/customizer-preview.min.js new file mode 100644 index 0000000..febe5a6 --- /dev/null +++ b/inc/builder/type/footer/widget/assets/js/minified/customizer-preview.min.js @@ -0,0 +1 @@ +jQuery,astra_builder_widget_css("footer");
\ No newline at end of file diff --git a/inc/builder/type/footer/widget/assets/js/unminified/customizer-preview.js b/inc/builder/type/footer/widget/assets/js/unminified/customizer-preview.js new file mode 100644 index 0000000..ce30144 --- /dev/null +++ b/inc/builder/type/footer/widget/assets/js/unminified/customizer-preview.js @@ -0,0 +1,15 @@ +/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra Builder
+ * @since 3.0.0
+ */
+
+( function( $ ) {
+
+ astra_builder_widget_css('footer');
+
+} )( jQuery );
diff --git a/inc/builder/type/footer/widget/class-astra-footer-widget-component-loader.php b/inc/builder/type/footer/widget/class-astra-footer-widget-component-loader.php new file mode 100644 index 0000000..d08f616 --- /dev/null +++ b/inc/builder/type/footer/widget/class-astra-footer-widget-component-loader.php @@ -0,0 +1,64 @@ +<?php +/** + * WIDGET Styling Loader for Astra theme. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Customizer Initialization + * + * @since 3.0.0 + */ +class Astra_Footer_Widget_Component_Loader { + + /** + * Constructor + * + * @since 3.0.0 + */ + public function __construct() { + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); + } + + /** + * Customizer Preview + * + * @since 3.0.0 + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-footer-widget-customizer-preview-js', ASTRA_BUILDER_FOOTER_WIDGET_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + + // Localize variables for WIDGET JS. + wp_localize_script( + 'astra-footer-widget-customizer-preview-js', + 'AstraBuilderWidgetData', + array( + 'footer_widget_count' => defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_footer_widgets, + 'tablet_break_point' => astra_get_tablet_breakpoint(), + 'mobile_break_point' => astra_get_mobile_breakpoint(), + 'is_flex_based_css' => Astra_Builder_Helper::apply_flex_based_css(), + 'has_block_editor' => astra_has_widgets_block_editor(), + ) + ); + } +} + +/** +* Kicking this off by creating the object of the class. +*/ +new Astra_Footer_Widget_Component_Loader(); diff --git a/inc/builder/type/footer/widget/class-astra-footer-widget-component.php b/inc/builder/type/footer/widget/class-astra-footer-widget-component.php new file mode 100644 index 0000000..e1bf09d --- /dev/null +++ b/inc/builder/type/footer/widget/class-astra-footer-widget-component.php @@ -0,0 +1,45 @@ +<?php +/** + * WIDGET component. + * + * @package Astra Builder + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +define( 'ASTRA_BUILDER_FOOTER_WIDGET_DIR', ASTRA_THEME_DIR . 'inc/builder/type/footer/widget' ); +define( 'ASTRA_BUILDER_FOOTER_WIDGET_URI', ASTRA_THEME_URI . 'inc/builder/type/footer/widget' ); + +/** + * Heading Initial Setup + * + * @since 3.0.0 + */ +class Astra_Footer_Widget_Component { + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_BUILDER_FOOTER_WIDGET_DIR . '/class-astra-footer-widget-component-loader.php'; + + // Include front end files. + if ( ! is_admin() ) { + require_once ASTRA_BUILDER_FOOTER_WIDGET_DIR . '/dynamic-css/dynamic.css.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } +} + +/** + * Kicking this off by creating an object. + */ +new Astra_Footer_Widget_Component(); diff --git a/inc/builder/type/footer/widget/dynamic-css/dynamic.css.php b/inc/builder/type/footer/widget/dynamic-css/dynamic.css.php new file mode 100644 index 0000000..b53af19 --- /dev/null +++ b/inc/builder/type/footer/widget/dynamic-css/dynamic.css.php @@ -0,0 +1,78 @@ +<?php +/** + * WIdget control - Dynamic CSS + * + * @package Astra Builder + * @since 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Heading Colors + */ +add_filter( 'astra_dynamic_theme_css', 'astra_fb_widget_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for Heading Colors. + * + * @since 3.0.0 + */ +function astra_fb_widget_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + for ( $index = 1; $index <= Astra_Builder_Helper::$num_of_footer_widgets; $index++ ) { + + if ( ! Astra_Builder_Helper::is_component_loaded( 'widget-' . $index, 'footer' ) ) { + continue; + } + + $selector = '.footer-widget-area[data-section="sidebar-widgets-footer-widget-' . $index . '"]'; + + $alignment = astra_get_option( 'footer-widget-alignment-' . $index ); + + $desktop_alignment = ( isset( $alignment['desktop'] ) ) ? $alignment['desktop'] : ''; + $tablet_alignment = ( isset( $alignment['tablet'] ) ) ? $alignment['tablet'] : ''; + $mobile_alignment = ( isset( $alignment['mobile'] ) ) ? $alignment['mobile'] : ''; + + /** + * Widget CSS. + */ + if ( Astra_Builder_Helper::apply_flex_based_css() ) { + $footer_widget_selector = $selector . '.footer-widget-area-inner'; + } else { + $footer_widget_selector = $selector . ' .footer-widget-area-inner'; + } + $css_output_desktop = array( + $footer_widget_selector => array( + 'text-align' => $desktop_alignment, + ), + ); + $css_output_tablet = array( + $footer_widget_selector => array( + 'text-align' => $tablet_alignment, + ), + ); + $css_output_mobile = array( + $footer_widget_selector => array( + 'text-align' => $mobile_alignment, + ), + ); + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output_desktop ); + $css_output .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); + $css_output .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); + + $dynamic_css .= $css_output; + + $dynamic_css .= Astra_Widget_Component_Dynamic_CSS::astra_widget_dynamic_css( 'footer' ); + } + + return $dynamic_css; +} |