diff options
Diffstat (limited to 'inc/builder/type/footer/html')
5 files changed, 241 insertions, 0 deletions
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; +} |