From 69c17f9c1942fd0d6a5ea941636e87723b8a6fe2 Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Wed, 21 Jul 2021 16:19:29 -0500 Subject: dos2unix on all .php files, begin paring down admin page and site branding. --- .../astra-pro/class-astra-pro-customizer.php | 158 +- .../class-astra-pro-upgrade-link-configs.php | 114 +- inc/customizer/astra-pro/index.php | 18 +- inc/customizer/class-astra-customizer-callback.php | 124 +- inc/customizer/class-astra-customizer-partials.php | 316 +- ...s-astra-customizer-register-sections-panels.php | 778 ++--- .../class-astra-customizer-sanitizes.php | 1364 ++++----- inc/customizer/class-astra-customizer.php | 3068 ++++++++++---------- inc/customizer/class-astra-font-families.php | 342 +-- inc/customizer/class-astra-fonts-data.php | 88 +- inc/customizer/class-astra-fonts.php | 400 +-- .../class-astra-customizer-button-configs.php | 968 +++--- .../class-astra-existing-button-configs.php | 904 +++--- .../class-astra-customizer-config-base.php | 200 +- .../class-astra-advanced-footer-colors-configs.php | 358 +-- .../class-astra-body-colors-configs.php | 198 +- .../class-astra-footer-colors-configs.php | 204 +- .../layout/class-astra-blog-layout-configs.php | 346 +-- .../class-astra-blog-single-layout-configs.php | 312 +- .../layout/class-astra-footer-layout-configs.php | 964 +++--- .../layout/class-astra-header-layout-configs.php | 1368 ++++----- .../layout/class-astra-sidebar-layout-configs.php | 310 +- .../class-astra-site-container-layout-configs.php | 314 +- .../layout/class-astra-site-identity-configs.php | 990 +++---- .../layout/class-astra-site-layout-configs.php | 138 +- .../class-astra-archive-typo-configs.php | 394 +-- .../typography/class-astra-body-typo-configs.php | 554 ++-- .../class-astra-content-typo-configs.php | 544 ++-- .../typography/class-astra-header-typo-configs.php | 460 +-- .../typography/class-astra-single-typo-configs.php | 272 +- .../class-astra-customizer-control-base.php | 476 +-- .../class-astra-control-customizer-link.php | 138 +- .../class-astra-control-description.php | 114 +- inc/customizer/custom-controls/index.php | 18 +- .../typography/class-astra-control-typography.php | 378 +-- .../custom-controls/typography/index.php | 18 +- inc/customizer/customizer-controls.php | 48 +- .../class-astra-wp-customize-panel.php | 130 +- .../class-astra-wp-customize-section.php | 136 +- .../class-astra-wp-customize-separator.php | 98 +- inc/customizer/index.php | 18 +- inc/customizer/override-defaults.php | 140 +- 42 files changed, 9140 insertions(+), 9140 deletions(-) (limited to 'inc/customizer') diff --git a/inc/customizer/astra-pro/class-astra-pro-customizer.php b/inc/customizer/astra-pro/class-astra-pro-customizer.php index a9a8f4c..6d1455d 100644 --- a/inc/customizer/astra-pro/class-astra-pro-customizer.php +++ b/inc/customizer/astra-pro/class-astra-pro-customizer.php @@ -1,79 +1,79 @@ -pro_url ); - return $json; - } - - /** - * Outputs the Underscore.js template. - * - * @since 1.0.10 - * @access public - * @return void - */ - protected function render_template() { - ?> -
  • -

    - <# if ( data.title && data.pro_url ) { #> - {{ data.title }} - <# } #> -

    -
  • - pro_url ); + return $json; + } + + /** + * Outputs the Underscore.js template. + * + * @since 1.0.10 + * @access public + * @return void + */ + protected function render_template() { + ?> +
  • +

    + <# if ( data.title && data.pro_url ) { #> + {{ data.title }} + <# } #> +

    +
  • + 'astra-pro', - 'type' => 'section', - 'ast_type' => 'astra-pro', - 'title' => esc_html__( 'More Options Available in Astra Pro!', 'astra' ), - 'pro_url' => htmlspecialchars_decode( astra_get_pro_url( 'https://wpastra.com/pricing/', 'customizer', 'upgrade-link', 'upgrade-to-pro' ) ), - 'priority' => 1, - 'section_callback' => 'Astra_Pro_Customizer', - ), - - array( - 'name' => ASTRA_THEME_SETTINGS . '[astra-pro-section-notice]', - 'type' => 'control', - 'transport' => 'postMessage', - 'control' => 'ast-hidden', - 'section' => 'astra-pro', - 'priority' => 0, - ), - - ); - - return array_merge( $configurations, $_configs ); - - } - } -} - -new Astra_Pro_Upgrade_Link_Configs(); + 'astra-pro', + 'type' => 'section', + 'ast_type' => 'astra-pro', + 'title' => esc_html__( 'More Options Available in Astra Pro!', 'astra' ), + 'pro_url' => htmlspecialchars_decode( astra_get_pro_url( 'https://wpastra.com/pricing/', 'customizer', 'upgrade-link', 'upgrade-to-pro' ) ), + 'priority' => 1, + 'section_callback' => 'Astra_Pro_Customizer', + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[astra-pro-section-notice]', + 'type' => 'control', + 'transport' => 'postMessage', + 'control' => 'ast-hidden', + 'section' => 'astra-pro', + 'priority' => 0, + ), + + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Pro_Upgrade_Link_Configs(); diff --git a/inc/customizer/astra-pro/index.php b/inc/customizer/astra-pro/index.php index 8b96815..820bcb9 100644 --- a/inc/customizer/astra-pro/index.php +++ b/inc/customizer/astra-pro/index.php @@ -1,9 +1,9 @@ - ' . $custom_button_text . ' '; - return do_shortcode( $html ); - } - - /** - * Render Partial Text Header Site Title & Tagline - * - * @since 2.2.0 - * - * @return mixed - */ - public static function render_header_site_title_tagline() { - $site_title = astra_get_option( 'display-site-title-responsive' ); - $display_site_title = ( $site_title['desktop'] || $site_title['tablet'] || $site_title['mobile'] ) ? true : false; - $site_tagline = astra_get_option( 'display-site-tagline-responsive' ); - $display_site_tagline = ( $site_tagline['desktop'] || $site_tagline['tablet'] || $site_tagline['mobile'] ) ? true : false; - - - $html = astra_get_site_title_tagline( $display_site_title, $display_site_tagline ); - - return do_shortcode( $html ); - } - - /** - * Render Partial Footer Section 1 Credit - * - * @since 1.0.0 - * - * @return mixed - */ - public static function render_footer_sml_section_1_credit() { - - $output = astra_get_small_footer_custom_text( 'footer-sml-section-1-credit' ); - return do_shortcode( $output ); - } - - /** - * Render Partial Footer Section 2 Credit - * - * @since 1.0.0 - * - * @return mixed - */ - public static function render_footer_sml_section_2_credit() { - - $output = astra_get_small_footer_custom_text( 'footer-sml-section-2-credit' ); - return do_shortcode( $output ); - } - - /** - * Render Partial text for the mobile toggle menu - * - * @since 2.6.0 - * - * @return mixed - */ - public static function mobile_toggle_menu() { - - $output = astra_masthead_toggle_buttons_primary(); - return do_shortcode( $output ); - } - } -} + ' . $custom_button_text . ' '; + return do_shortcode( $html ); + } + + /** + * Render Partial Text Header Site Title & Tagline + * + * @since 2.2.0 + * + * @return mixed + */ + public static function render_header_site_title_tagline() { + $site_title = astra_get_option( 'display-site-title-responsive' ); + $display_site_title = ( $site_title['desktop'] || $site_title['tablet'] || $site_title['mobile'] ) ? true : false; + $site_tagline = astra_get_option( 'display-site-tagline-responsive' ); + $display_site_tagline = ( $site_tagline['desktop'] || $site_tagline['tablet'] || $site_tagline['mobile'] ) ? true : false; + + + $html = astra_get_site_title_tagline( $display_site_title, $display_site_tagline ); + + return do_shortcode( $html ); + } + + /** + * Render Partial Footer Section 1 Credit + * + * @since 1.0.0 + * + * @return mixed + */ + public static function render_footer_sml_section_1_credit() { + + $output = astra_get_small_footer_custom_text( 'footer-sml-section-1-credit' ); + return do_shortcode( $output ); + } + + /** + * Render Partial Footer Section 2 Credit + * + * @since 1.0.0 + * + * @return mixed + */ + public static function render_footer_sml_section_2_credit() { + + $output = astra_get_small_footer_custom_text( 'footer-sml-section-2-credit' ); + return do_shortcode( $output ); + } + + /** + * Render Partial text for the mobile toggle menu + * + * @since 2.6.0 + * + * @return mixed + */ + public static function mobile_toggle_menu() { + + $output = astra_masthead_toggle_buttons_primary(); + return do_shortcode( $output ); + } + } +} diff --git a/inc/customizer/class-astra-customizer-register-sections-panels.php b/inc/customizer/class-astra-customizer-register-sections-panels.php index 1212216..f8362c0 100644 --- a/inc/customizer/class-astra-customizer-register-sections-panels.php +++ b/inc/customizer/class-astra-customizer-register-sections-panels.php @@ -1,389 +1,389 @@ - 'panel-global', - 'type' => 'panel', - 'priority' => 10, - 'title' => __( 'Global', 'astra' ), - ), - - array( - 'name' => 'section-container-layout', - 'type' => 'section', - 'priority' => 17, - 'title' => __( 'Container', 'astra' ), - 'panel' => 'panel-global', - 'description_hidden' => true, - 'description' => $this->section_get_description( - array( - 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', - 'links' => array( - array( - 'text' => __( 'Site Layout Overview', 'astra' ) . ' »', - 'attrs' => array( - 'href' => astra_get_pro_url( 'https://wpastra.com/docs/site-layout-overview/', 'customizer', 'site-layout', 'helpful-information' ), - ), - ), - array( - 'text' => __( 'Container Overview', 'astra' ) . ' »', - 'attrs' => array( - 'href' => astra_get_pro_url( 'https://wpastra.com/docs/container-overview/', 'customizer', 'container', 'helpful-information' ), - ), - ), - ), - ) - ), - ), - - /* - * Header section - * - * @since 1.4.0 - */ - array( - 'name' => 'panel-header-group', - 'type' => 'panel', - 'priority' => 20, - 'title' => __( 'Header', 'astra' ), - ), - - /* - * Update the Site Identity section inside Layout -> Header - * - * @since 1.4.0 - */ - array( - 'name' => 'title_tagline', - 'type' => 'section', - 'priority' => 5, - 'title' => __( 'Site Identity', 'astra' ), - 'panel' => 'panel-header-group', - 'description_hidden' => true, - 'description' => $this->section_get_description( - array( - 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', - 'links' => array( - array( - 'text' => __( 'Site Identity Overview', 'astra' ) . ' »', - 'attrs' => array( - 'href' => astra_get_pro_url( 'https://wpastra.com/docs/site-identity-free/', 'customizer', 'site-identity', 'helpful-information' ), - ), - ), - ), - ) - ), - ), - - /* - * Update the Primary Header section - * - * @since 1.4.0 - */ - array( - 'name' => 'section-header', - 'type' => 'section', - 'priority' => 15, - 'title' => __( 'Primary Header', 'astra' ), - 'panel' => 'panel-header-group', - 'description_hidden' => true, - 'description' => $this->section_get_description( - array( - 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', - 'links' => array( - array( - 'text' => __( 'Primary Header Overview', 'astra' ) . ' »', - 'attrs' => array( - 'href' => astra_get_pro_url( 'https://wpastra.com/docs/header-overview/', 'customizer', 'primary-header', 'helpful-information' ), - ), - ), - ), - ) - ), - ), - - array( - 'name' => 'section-primary-menu', - 'type' => 'section', - 'priority' => 15, - 'title' => __( 'Primary Menu', 'astra' ), - 'panel' => 'panel-header-group', - ), - array( - 'name' => 'section-footer-group', - 'type' => 'section', - 'title' => __( 'Footer', 'astra' ), - 'priority' => 55, - ), - - array( - 'name' => 'section-separator', - 'type' => 'section', - 'ast_type' => 'ast-section-separator', - 'priority' => 70, - 'section_callback' => 'Astra_WP_Customize_Separator', - ), - - /** - * Footer Widgets Section - */ - - array( - 'name' => 'section-footer-adv', - 'type' => 'section', - 'title' => __( 'Footer Widgets', 'astra' ), - 'section' => 'section-footer-group', - 'priority' => 5, - ), - - array( - 'name' => 'section-footer-small', - 'type' => 'section', - 'title' => __( 'Footer Bar', 'astra' ), - 'section' => 'section-footer-group', - 'priority' => 10, - 'description_hidden' => true, - 'description' => $this->section_get_description( - array( - 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', - 'links' => array( - array( - 'text' => __( 'Footer Bar Overview', 'astra' ) . ' »', - 'attrs' => array( - 'href' => astra_get_pro_url( 'https://wpastra.com/docs/footer-bar/', 'customizer', 'footer-bar', 'helpful-information' ), - ), - ), - ), - ) - ), - ), - - array( - 'name' => 'section-blog-group', - 'type' => 'section', - 'priority' => 40, - 'title' => __( 'Blog', 'astra' ), - ), - array( - 'name' => 'section-blog', - 'type' => 'section', - 'priority' => 5, - 'title' => __( 'Blog / Archive', 'astra' ), - 'section' => 'section-blog-group', - ), - array( - 'name' => 'section-blog-single', - 'type' => 'section', - 'priority' => 10, - 'title' => __( 'Single Post', 'astra' ), - 'section' => 'section-blog-group', - ), - - array( - 'name' => 'section-sidebars', - 'type' => 'section', - 'priority' => 50, - 'title' => __( 'Sidebar', 'astra' ), - 'description_hidden' => true, - 'description' => $this->section_get_description( - array( - 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', - 'links' => array( - array( - 'text' => __( 'Sidebar Overview', 'astra' ) . ' »', - 'attrs' => array( - 'href' => astra_get_pro_url( 'https://wpastra.com/docs/sidebar-free/', 'customizer', 'sidebar', 'helpful-information' ), - ), - ), - ), - ) - ), - ), - - /** - * Performance Panel - * - * @since 3.6.0 - */ - array( - 'name' => 'section-performance', - 'type' => 'section', - 'priority' => 65, - 'title' => __( 'Performance', 'astra' ), - ), - - /** - * Colors Panel - */ - array( - 'name' => 'section-colors-background', - 'type' => 'section', - 'priority' => 16, - 'title' => __( 'Colors', 'astra' ), - 'description_hidden' => true, - 'description' => $this->section_get_description( - array( - 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', - 'links' => array( - array( - 'text' => __( 'Colors & Background Overview', 'astra' ) . ' »', - 'attrs' => array( - 'href' => astra_get_pro_url( 'https://wpastra.com/docs/colors-background/', 'customizer', 'colors-background', 'helpful-information' ), - ), - ), - ), - ) - ), - 'panel' => 'panel-global', - ), - - array( - 'name' => 'section-colors-body', - 'type' => 'section', - 'title' => __( 'Base Colors', 'astra' ), - 'panel' => 'panel-global', - 'priority' => 1, - 'section' => 'section-colors-background', - ), - - array( - 'name' => 'section-footer-adv-color-bg', - 'type' => 'section', - 'title' => __( 'Footer Widgets', 'astra' ), - 'panel' => 'panel-colors-background', - 'priority' => 55, - ), - - /** - * Typography Panel - */ - array( - 'name' => 'section-typography', - 'type' => 'section', - 'title' => __( 'Typography', 'astra' ), - 'priority' => 15, - 'description_hidden' => true, - 'description' => $this->section_get_description( - array( - 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', - 'links' => array( - array( - 'text' => __( 'Typography Overview', 'astra' ) . ' »', - 'attrs' => array( - 'href' => astra_get_pro_url( 'https://wpastra.com/docs/typography-free/', 'customizer', 'typography', 'helpful-information' ), - ), - ), - ), - ) - ), - 'panel' => 'panel-global', - ), - - array( - 'name' => 'section-body-typo', - 'type' => 'section', - 'title' => __( 'Base Typography', 'astra' ), - 'section' => 'section-typography', - 'priority' => 1, - 'panel' => 'panel-global', - ), - - array( - 'name' => 'section-content-typo', - 'type' => 'section', - 'title' => __( 'Headings', 'astra' ), - 'section' => 'section-typography', - 'priority' => 35, - 'panel' => 'panel-global', - ), - - /** - * Buttons Section - */ - array( - 'name' => 'section-buttons', - 'type' => 'section', - 'priority' => 50, - 'title' => __( 'Buttons', 'astra' ), - 'panel' => 'panel-global', - ), - - /** - * Header Buttons - */ - array( - 'name' => 'section-header-button', - 'type' => 'section', - 'priority' => 10, - 'title' => __( 'Header Button', 'astra' ), - 'section' => 'section-buttons', - ), - - /** - * Header Button - Default - */ - array( - 'name' => 'section-header-button-default', - 'type' => 'section', - 'priority' => 10, - 'title' => __( 'Primary Header Button', 'astra' ), - 'section' => 'section-header-button', - ), - - /** - * Header Button - Transparent - */ - array( - 'name' => 'section-header-button-transparent', - 'type' => 'section', - 'priority' => 10, - 'title' => __( 'Transparent Header Button', 'astra' ), - 'section' => 'section-header-button', - ), - - ); - return array_merge( $configurations, $configs ); - } - } -} - - -/** - * Kicking this off by calling 'get_instance()' method - */ -new Astra_Customizer_Register_Sections_Panels(); + 'panel-global', + 'type' => 'panel', + 'priority' => 10, + 'title' => __( 'Global', 'astra' ), + ), + + array( + 'name' => 'section-container-layout', + 'type' => 'section', + 'priority' => 17, + 'title' => __( 'Container', 'astra' ), + 'panel' => 'panel-global', + 'description_hidden' => true, + 'description' => $this->section_get_description( + array( + 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', + 'links' => array( + array( + 'text' => __( 'Site Layout Overview', 'astra' ) . ' »', + 'attrs' => array( + 'href' => astra_get_pro_url( 'https://wpastra.com/docs/site-layout-overview/', 'customizer', 'site-layout', 'helpful-information' ), + ), + ), + array( + 'text' => __( 'Container Overview', 'astra' ) . ' »', + 'attrs' => array( + 'href' => astra_get_pro_url( 'https://wpastra.com/docs/container-overview/', 'customizer', 'container', 'helpful-information' ), + ), + ), + ), + ) + ), + ), + + /* + * Header section + * + * @since 1.4.0 + */ + array( + 'name' => 'panel-header-group', + 'type' => 'panel', + 'priority' => 20, + 'title' => __( 'Header', 'astra' ), + ), + + /* + * Update the Site Identity section inside Layout -> Header + * + * @since 1.4.0 + */ + array( + 'name' => 'title_tagline', + 'type' => 'section', + 'priority' => 5, + 'title' => __( 'Site Identity', 'astra' ), + 'panel' => 'panel-header-group', + 'description_hidden' => true, + 'description' => $this->section_get_description( + array( + 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', + 'links' => array( + array( + 'text' => __( 'Site Identity Overview', 'astra' ) . ' »', + 'attrs' => array( + 'href' => astra_get_pro_url( 'https://wpastra.com/docs/site-identity-free/', 'customizer', 'site-identity', 'helpful-information' ), + ), + ), + ), + ) + ), + ), + + /* + * Update the Primary Header section + * + * @since 1.4.0 + */ + array( + 'name' => 'section-header', + 'type' => 'section', + 'priority' => 15, + 'title' => __( 'Primary Header', 'astra' ), + 'panel' => 'panel-header-group', + 'description_hidden' => true, + 'description' => $this->section_get_description( + array( + 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', + 'links' => array( + array( + 'text' => __( 'Primary Header Overview', 'astra' ) . ' »', + 'attrs' => array( + 'href' => astra_get_pro_url( 'https://wpastra.com/docs/header-overview/', 'customizer', 'primary-header', 'helpful-information' ), + ), + ), + ), + ) + ), + ), + + array( + 'name' => 'section-primary-menu', + 'type' => 'section', + 'priority' => 15, + 'title' => __( 'Primary Menu', 'astra' ), + 'panel' => 'panel-header-group', + ), + array( + 'name' => 'section-footer-group', + 'type' => 'section', + 'title' => __( 'Footer', 'astra' ), + 'priority' => 55, + ), + + array( + 'name' => 'section-separator', + 'type' => 'section', + 'ast_type' => 'ast-section-separator', + 'priority' => 70, + 'section_callback' => 'Astra_WP_Customize_Separator', + ), + + /** + * Footer Widgets Section + */ + + array( + 'name' => 'section-footer-adv', + 'type' => 'section', + 'title' => __( 'Footer Widgets', 'astra' ), + 'section' => 'section-footer-group', + 'priority' => 5, + ), + + array( + 'name' => 'section-footer-small', + 'type' => 'section', + 'title' => __( 'Footer Bar', 'astra' ), + 'section' => 'section-footer-group', + 'priority' => 10, + 'description_hidden' => true, + 'description' => $this->section_get_description( + array( + 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', + 'links' => array( + array( + 'text' => __( 'Footer Bar Overview', 'astra' ) . ' »', + 'attrs' => array( + 'href' => astra_get_pro_url( 'https://wpastra.com/docs/footer-bar/', 'customizer', 'footer-bar', 'helpful-information' ), + ), + ), + ), + ) + ), + ), + + array( + 'name' => 'section-blog-group', + 'type' => 'section', + 'priority' => 40, + 'title' => __( 'Blog', 'astra' ), + ), + array( + 'name' => 'section-blog', + 'type' => 'section', + 'priority' => 5, + 'title' => __( 'Blog / Archive', 'astra' ), + 'section' => 'section-blog-group', + ), + array( + 'name' => 'section-blog-single', + 'type' => 'section', + 'priority' => 10, + 'title' => __( 'Single Post', 'astra' ), + 'section' => 'section-blog-group', + ), + + array( + 'name' => 'section-sidebars', + 'type' => 'section', + 'priority' => 50, + 'title' => __( 'Sidebar', 'astra' ), + 'description_hidden' => true, + 'description' => $this->section_get_description( + array( + 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', + 'links' => array( + array( + 'text' => __( 'Sidebar Overview', 'astra' ) . ' »', + 'attrs' => array( + 'href' => astra_get_pro_url( 'https://wpastra.com/docs/sidebar-free/', 'customizer', 'sidebar', 'helpful-information' ), + ), + ), + ), + ) + ), + ), + + /** + * Performance Panel + * + * @since 3.6.0 + */ + array( + 'name' => 'section-performance', + 'type' => 'section', + 'priority' => 65, + 'title' => __( 'Performance', 'astra' ), + ), + + /** + * Colors Panel + */ + array( + 'name' => 'section-colors-background', + 'type' => 'section', + 'priority' => 16, + 'title' => __( 'Colors', 'astra' ), + 'description_hidden' => true, + 'description' => $this->section_get_description( + array( + 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', + 'links' => array( + array( + 'text' => __( 'Colors & Background Overview', 'astra' ) . ' »', + 'attrs' => array( + 'href' => astra_get_pro_url( 'https://wpastra.com/docs/colors-background/', 'customizer', 'colors-background', 'helpful-information' ), + ), + ), + ), + ) + ), + 'panel' => 'panel-global', + ), + + array( + 'name' => 'section-colors-body', + 'type' => 'section', + 'title' => __( 'Base Colors', 'astra' ), + 'panel' => 'panel-global', + 'priority' => 1, + 'section' => 'section-colors-background', + ), + + array( + 'name' => 'section-footer-adv-color-bg', + 'type' => 'section', + 'title' => __( 'Footer Widgets', 'astra' ), + 'panel' => 'panel-colors-background', + 'priority' => 55, + ), + + /** + * Typography Panel + */ + array( + 'name' => 'section-typography', + 'type' => 'section', + 'title' => __( 'Typography', 'astra' ), + 'priority' => 15, + 'description_hidden' => true, + 'description' => $this->section_get_description( + array( + 'description' => '

    ' . __( 'Helpful Information', 'astra' ) . '

    ', + 'links' => array( + array( + 'text' => __( 'Typography Overview', 'astra' ) . ' »', + 'attrs' => array( + 'href' => astra_get_pro_url( 'https://wpastra.com/docs/typography-free/', 'customizer', 'typography', 'helpful-information' ), + ), + ), + ), + ) + ), + 'panel' => 'panel-global', + ), + + array( + 'name' => 'section-body-typo', + 'type' => 'section', + 'title' => __( 'Base Typography', 'astra' ), + 'section' => 'section-typography', + 'priority' => 1, + 'panel' => 'panel-global', + ), + + array( + 'name' => 'section-content-typo', + 'type' => 'section', + 'title' => __( 'Headings', 'astra' ), + 'section' => 'section-typography', + 'priority' => 35, + 'panel' => 'panel-global', + ), + + /** + * Buttons Section + */ + array( + 'name' => 'section-buttons', + 'type' => 'section', + 'priority' => 50, + 'title' => __( 'Buttons', 'astra' ), + 'panel' => 'panel-global', + ), + + /** + * Header Buttons + */ + array( + 'name' => 'section-header-button', + 'type' => 'section', + 'priority' => 10, + 'title' => __( 'Header Button', 'astra' ), + 'section' => 'section-buttons', + ), + + /** + * Header Button - Default + */ + array( + 'name' => 'section-header-button-default', + 'type' => 'section', + 'priority' => 10, + 'title' => __( 'Primary Header Button', 'astra' ), + 'section' => 'section-header-button', + ), + + /** + * Header Button - Transparent + */ + array( + 'name' => 'section-header-button-transparent', + 'type' => 'section', + 'priority' => 10, + 'title' => __( 'Transparent Header Button', 'astra' ), + 'section' => 'section-header-button', + ), + + ); + return array_merge( $configurations, $configs ); + } + } +} + + +/** + * Kicking this off by calling 'get_instance()' method + */ +new Astra_Customizer_Register_Sections_Panels(); diff --git a/inc/customizer/class-astra-customizer-sanitizes.php b/inc/customizer/class-astra-customizer-sanitizes.php index a95787b..53e884d 100644 --- a/inc/customizer/class-astra-customizer-sanitizes.php +++ b/inc/customizer/class-astra-customizer-sanitizes.php @@ -1,682 +1,682 @@ -manager->get_control( $setting->id )->input_attrs ) ) { - $input_attrs = $setting->manager->get_control( $setting->id )->input_attrs; - } - - if ( isset( $input_attrs ) ) { - - $input_attrs['min'] = isset( $input_attrs['min'] ) ? $input_attrs['min'] : 0; - $input_attrs['step'] = isset( $input_attrs['step'] ) ? $input_attrs['step'] : 1; - - if ( isset( $input_attrs['max'] ) && $val > $input_attrs['max'] ) { - $val = $input_attrs['max']; - } elseif ( $val < $input_attrs['min'] ) { - $val = $input_attrs['min']; - } - - $dv = (float) $val / $input_attrs['step']; - - $dv = round( $dv ); - - $val = $dv * $input_attrs['step']; - - $val = number_format( (float) $val, 2, '.', '' ); - if ( $val == (int) $val ) { - $val = (int) $val; - } - } - - return is_numeric( $val ) ? $val : 0; - } - - /** - * Sanitize Integer - * - * @param number $val Customizer setting input number. - * @return number Return number. - */ - public static function sanitize_number_n_blank( $val ) { - return is_numeric( $val ) ? $val : ''; - } - - /** - * Sanitize Spacing - * - * @param number $val Customizer setting input number. - * @return number Return number. - * @since 1.0.6 - */ - public static function sanitize_spacing( $val ) { - - foreach ( $val as $key => $value ) { - $val[ $key ] = ( is_numeric( $val[ $key ] ) && $val[ $key ] >= 0 ) ? $val[ $key ] : ''; - } - - return $val; - } - - /** - * Sanitize link - * - * @param array $val Customizer setting link. - * @return array Return array. - * @since 2.3.0 - */ - public static function sanitize_link( $val ) { - - $link = array(); - - $link['url'] = esc_url_raw( $val['url'] ); - $link['new_tab'] = esc_attr( $val['new_tab'] ); - $link['link_rel'] = esc_attr( $val['link_rel'] ); - - return $link; - } - - /** - * Sanitize responsive Spacing - * - * @param number $val Customizer setting input number. - * @return number Return number. - * @since 1.2.1 - */ - public static function sanitize_responsive_spacing( $val ) { - - $spacing = array( - 'desktop' => array( - 'top' => '', - 'right' => '', - 'bottom' => '', - 'left' => '', - ), - 'tablet' => array( - 'top' => '', - 'right' => '', - 'bottom' => '', - 'left' => '', - ), - 'mobile' => array( - 'top' => '', - 'right' => '', - 'bottom' => '', - 'left' => '', - ), - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ); - - if ( isset( $val['desktop'] ) ) { - $spacing['desktop'] = array_map( 'self::check_numberic_values', $val['desktop'] ); - - $spacing['tablet'] = array_map( 'self::check_numberic_values', $val['tablet'] ); - - $spacing['mobile'] = array_map( 'self::check_numberic_values', $val['mobile'] ); - - if ( isset( $val['desktop-unit'] ) ) { - $spacing['desktop-unit'] = $val['desktop-unit']; - } - - if ( isset( $val['tablet-unit'] ) ) { - $spacing['tablet-unit'] = $val['tablet-unit']; - } - - if ( isset( $val['mobile-unit'] ) ) { - $spacing['mobile-unit'] = $val['mobile-unit']; - } - - return $spacing; - - } else { - foreach ( $val as $key => $value ) { - $val[ $key ] = is_numeric( $val[ $key ] ) ? $val[ $key ] : ''; - } - return $val; - } - - } - - /** - * Check numeric values. - * - * @param int|string $value Value of variable. - * @return string|int Return empty if $value is not integer. - * - * @since 2.5.4 - */ - public static function check_numberic_values( $value ) { - return ( is_numeric( $value ) ) ? $value : ''; - } - - /** - * Sanitize Responsive Slider - * - * @param array|number $val Customizer setting input number. - * @param object $setting Setting Onject. - * @return array Return number. - */ - public static function sanitize_responsive_slider( $val, $setting ) { - - $input_attrs = array(); - if ( isset( $setting->manager->get_control( $setting->id )->input_attrs ) ) { - $input_attrs = $setting->manager->get_control( $setting->id )->input_attrs; - } - - $responsive = array( - 'desktop' => '', - 'tablet' => '', - 'mobile' => '', - ); - if ( is_array( $val ) ) { - $responsive['desktop'] = is_numeric( $val['desktop'] ) ? $val['desktop'] : ''; - $responsive['tablet'] = is_numeric( $val['tablet'] ) ? $val['tablet'] : ''; - $responsive['mobile'] = is_numeric( $val['mobile'] ) ? $val['mobile'] : ''; - } else { - $responsive['desktop'] = is_numeric( $val ) ? $val : ''; - } - - foreach ( $responsive as $key => $value ) { - $value = isset( $input_attrs['min'] ) && ( ! empty( $value ) ) && ( $input_attrs['min'] > $value ) ? $input_attrs['min'] : $value; - $value = isset( $input_attrs['max'] ) && ( ! empty( $value ) ) && ( $input_attrs['max'] < $value ) ? $input_attrs['max'] : $value; - $responsive[ $key ] = $value; - } - - return $responsive; - } - - /** - * Sanitize Responsive Typography - * - * @param array|number $val Customizer setting input number. - * @return array Return number. - */ - public static function sanitize_responsive_typo( $val ) { - - $responsive = array( - 'desktop' => '', - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => '', - 'tablet-unit' => '', - 'mobile-unit' => '', - ); - if ( is_array( $val ) ) { - $responsive['desktop'] = ( isset( $val['desktop'] ) && is_numeric( $val['desktop'] ) ) ? $val['desktop'] : ''; - $responsive['tablet'] = ( isset( $val['tablet'] ) && is_numeric( $val['tablet'] ) ) ? $val['tablet'] : ''; - $responsive['mobile'] = ( isset( $val['mobile'] ) && is_numeric( $val['mobile'] ) ) ? $val['mobile'] : ''; - $responsive['desktop-unit'] = ( isset( $val['desktop-unit'] ) && in_array( $val['desktop-unit'], array( '', 'px', 'em', 'rem', '%' ) ) ) ? $val['desktop-unit'] : 'px'; - $responsive['tablet-unit'] = ( isset( $val['tablet-unit'] ) && in_array( $val['tablet-unit'], array( '', 'px', 'em', 'rem', '%' ) ) ) ? $val['tablet-unit'] : 'px'; - $responsive['mobile-unit'] = ( isset( $val['mobile-unit'] ) && in_array( $val['mobile-unit'], array( '', 'px', 'em', 'rem', '%' ) ) ) ? $val['mobile-unit'] : 'px'; - } else { - $responsive['desktop'] = is_numeric( $val ) ? $val : ''; - } - return $responsive; - } - - /** - * Validate Email - * - * @param object $validity setting input validity. - * @param string $value setting input value. - * @return object Return the validity object. - */ - public static function validate_email( $validity, $value ) { - if ( ! is_email( $value ) ) { - $validity->add( 'required', __( 'Enter valid email address!', 'astra' ) ); - } - return $validity; - } - - /** - * Validate Sidebar Content Width - * - * @param number $value Sidebar content width. - * @return number Sidebar content width value. - */ - public static function validate_sidebar_content_width( $value ) { - $value = intval( $value ); - if ( $value > 50 ) { - $value = 50; - } elseif ( $value < 15 ) { - $value = 15; - } - return $value; - } - - /** - * Validate Site width - * - * @param number $value Site width. - * @return number Site width value. - */ - public static function validate_site_width( $value ) { - $value = intval( $value ); - if ( 1920 < $value ) { - $value = 1920; - } elseif ( 768 > $value ) { - $value = 768; - } - return $value; - } - - /** - * Validate Site padding - * - * @param number $value Site padding. - * @return number Site padding value. - */ - public static function validate_site_padding( $value ) { - $value = intval( $value ); - if ( 200 < $value ) { - $value = 200; - } elseif ( 1 > $value ) { - $value = 1; - } - return $value; - } - - /** - * Validate Site margin - * - * @param number $value Site margin. - * @return number Site margin value. - */ - public static function validate_site_margin( $value ) { - $value = intval( $value ); - if ( 600 < $value ) { - $value = 600; - } elseif ( 0 > $value ) { - $value = 0; - } - return $value; - } - - /** - * Sanitize checkbox - * - * @param number $input setting input. - * @return number setting input value. - */ - public static function sanitize_checkbox( $input ) { - if ( $input ) { - $output = '1'; - } else { - $output = false; - } - return $output; - } - - /** - * Sanitize HEX color - * - * @param string $color setting input. - * @return string setting input value. - */ - public static function sanitize_hex_color( $color ) { - - if ( '' === $color ) { - return ''; - } - - // 3 or 6 hex digits, or the empty string. - if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) { - return $color; - } - - return ''; - } - - /** - * Sanitize Alpha color - * - * @param string $color setting input. - * @return string setting input value. - */ - public static function sanitize_alpha_color( $color ) { - - if ( '' === $color ) { - return ''; - } - - if ( false === strpos( $color, 'rgba' ) ) { - /* Hex sanitize */ - return self::sanitize_hex_color( $color ); - } - - /* rgba sanitize */ - $color = str_replace( ' ', '', $color ); - sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha ); - return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')'; - } - - /** - * Sanitize html - * - * @param string $input setting input. - * @return mixed setting input value. - */ - public static function sanitize_html( $input ) { - return wp_kses_post( $input ); - } - - /** - * Sanitize Select choices - * - * @param string $input setting input. - * @param object $setting setting object. - * @return mixed setting input value. - */ - public static function sanitize_multi_choices( $input, $setting ) { - - // Get list of choices from the control - // associated with the setting. - $choices = $setting->manager->get_control( $setting->id )->choices; - $input_keys = $input; - - foreach ( $input_keys as $key => $value ) { - if ( ! array_key_exists( $value, $choices ) ) { - unset( $input[ $key ] ); - } - } - - // If the input is a valid key, return it; - // otherwise, return the default. - return ( is_array( $input ) ? $input : $setting->default ); - } - - /** - * Sanitize Select choices - * - * @param string $input setting input. - * @param object $setting setting object. - * @return mixed setting input value. - */ - public static function sanitize_choices( $input, $setting ) { - - // Ensure input is a slug. - $input = sanitize_key( $input ); - - // Get list of choices from the control - // associated with the setting. - $choices = $setting->manager->get_control( $setting->id )->choices; - - // If the input is a valid key, return it; - // otherwise, return the default. - return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); - } - - /** - * Sanitize Font weight - * - * @param mixed $input setting input. - * @return mixed setting input value. - */ - public static function sanitize_font_weight( $input ) { - - $valid = array( - 'normal', - 'bold', - '100', - '200', - '300', - '400', - '500', - '600', - '700', - '800', - '900', - ); - - if ( in_array( $input, $valid ) ) { - return $input; - } else { - return 'normal'; - } - } - - /** - * Sanitize Font variant - * - * @param mixed $input setting input. - * @return mixed setting input value. - */ - public static function sanitize_font_variant( $input ) { - - if ( is_array( $input ) ) { - $input = implode( ',', $input ); - } - return sanitize_text_field( $input ); - } - - /** - * Sanitize Background Obj - * - * @param mixed $bg_obj setting input. - * @return array setting input value. - */ - public static function sanitize_background_obj( $bg_obj ) { - - $out_bg_obj = array( - 'background-color' => '', - 'background-image' => '', - 'background-repeat' => 'repeat', - 'background-position' => 'center center', - 'background-size' => 'auto', - 'background-attachment' => 'scroll', - 'background-media' => '', - 'background-type' => '', - ); - - if ( is_array( $bg_obj ) ) { - - foreach ( $out_bg_obj as $key => $value ) { - - if ( isset( $bg_obj[ $key ] ) ) { - - if ( 'background-image' === $key ) { - $out_bg_obj[ $key ] = esc_url_raw( $bg_obj[ $key ] ); - } else { - $out_bg_obj[ $key ] = esc_attr( $bg_obj[ $key ] ); - } - } - } - } - - return $out_bg_obj; - } - - /** - * Sanitize Border Typography - * - * @since 1.4.0 - * @param array|number $val Customizer setting input number. - * @return array Return number. - */ - public static function sanitize_border( $val ) { - - $border = array( - 'top' => '', - 'right' => '', - 'bottom' => '', - 'left' => '', - ); - if ( is_array( $val ) ) { - $border['top'] = is_numeric( $val['top'] ) ? $val['top'] : ''; - $border['right'] = is_numeric( $val['right'] ) ? $val['right'] : ''; - $border['bottom'] = is_numeric( $val['bottom'] ) ? $val['bottom'] : ''; - $border['left'] = is_numeric( $val['left'] ) ? $val['left'] : ''; - } - return $border; - } - - /** - * Sanitize Customizer Link param. - * - * @param Array $val array( - * linked : Linked Customizer Section, - * link_text : Link Text. - * ). - * - * @since 1.6.0 - * - * @return Array - */ - public static function sanitize_customizer_links( $val ) { - $val['linked'] = sanitize_text_field( $val['linked'] ); - $val['link_text'] = esc_html( $val['link_text'] ); - $val['link_type'] = esc_html( $val['link_type'] ); - - return $val; - } - - /** - * Sanitize Responsive Background Image - * - * @param array $bg_obj Background object. - * @return array Background object. - */ - public static function sanitize_responsive_background( $bg_obj ) { - - // Default Responsive Background Image. - $defaults = array( - 'desktop' => array( - 'background-color' => '', - 'background-image' => '', - 'background-repeat' => 'repeat', - 'background-position' => 'center center', - 'background-size' => 'auto', - 'background-attachment' => 'scroll', - 'background-media' => '', - 'background-type' => '', - ), - 'tablet' => array( - 'background-color' => '', - 'background-image' => '', - 'background-repeat' => 'repeat', - 'background-position' => 'center center', - 'background-size' => 'auto', - 'background-attachment' => 'scroll', - 'background-media' => '', - 'background-type' => '', - ), - 'mobile' => array( - 'background-color' => '', - 'background-image' => '', - 'background-repeat' => 'repeat', - 'background-position' => 'center center', - 'background-size' => 'auto', - 'background-attachment' => 'scroll', - 'background-media' => '', - 'background-type' => '', - ), - ); - - // Merge responsive background object and default object into $out_bg_obj array. - $out_bg_obj = wp_parse_args( $bg_obj, $defaults ); - - foreach ( $out_bg_obj as $device => $bg ) { - foreach ( $bg as $key => $value ) { - if ( 'background-image' === $key ) { - $out_bg_obj[ $device ] [ $key ] = esc_url_raw( $value ); - } - if ( 'background-media' === $key ) { - $out_bg_obj[ $device ] [ $key ] = floatval( $value ); - } else { - $out_bg_obj[ $device ] [ $key ] = esc_attr( $value ); - } - } - } - return $out_bg_obj; - } - - /** - * Sanitize Toggle Control param. - * - * @param bool $val for True|False. - * - * @since 3.1.0 - * - * @return bool True|False - */ - public static function sanitize_toggle_control( $val ) { - // returns true if checkbox is checked. - return ( isset( $val ) && is_bool( $val ) ? $val : '' ); - } - } -} - -/** - * Kicking this off by calling 'get_instance()' method - */ -Astra_Customizer_Sanitizes::get_instance(); +manager->get_control( $setting->id )->input_attrs ) ) { + $input_attrs = $setting->manager->get_control( $setting->id )->input_attrs; + } + + if ( isset( $input_attrs ) ) { + + $input_attrs['min'] = isset( $input_attrs['min'] ) ? $input_attrs['min'] : 0; + $input_attrs['step'] = isset( $input_attrs['step'] ) ? $input_attrs['step'] : 1; + + if ( isset( $input_attrs['max'] ) && $val > $input_attrs['max'] ) { + $val = $input_attrs['max']; + } elseif ( $val < $input_attrs['min'] ) { + $val = $input_attrs['min']; + } + + $dv = (float) $val / $input_attrs['step']; + + $dv = round( $dv ); + + $val = $dv * $input_attrs['step']; + + $val = number_format( (float) $val, 2, '.', '' ); + if ( $val == (int) $val ) { + $val = (int) $val; + } + } + + return is_numeric( $val ) ? $val : 0; + } + + /** + * Sanitize Integer + * + * @param number $val Customizer setting input number. + * @return number Return number. + */ + public static function sanitize_number_n_blank( $val ) { + return is_numeric( $val ) ? $val : ''; + } + + /** + * Sanitize Spacing + * + * @param number $val Customizer setting input number. + * @return number Return number. + * @since 1.0.6 + */ + public static function sanitize_spacing( $val ) { + + foreach ( $val as $key => $value ) { + $val[ $key ] = ( is_numeric( $val[ $key ] ) && $val[ $key ] >= 0 ) ? $val[ $key ] : ''; + } + + return $val; + } + + /** + * Sanitize link + * + * @param array $val Customizer setting link. + * @return array Return array. + * @since 2.3.0 + */ + public static function sanitize_link( $val ) { + + $link = array(); + + $link['url'] = esc_url_raw( $val['url'] ); + $link['new_tab'] = esc_attr( $val['new_tab'] ); + $link['link_rel'] = esc_attr( $val['link_rel'] ); + + return $link; + } + + /** + * Sanitize responsive Spacing + * + * @param number $val Customizer setting input number. + * @return number Return number. + * @since 1.2.1 + */ + public static function sanitize_responsive_spacing( $val ) { + + $spacing = array( + 'desktop' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + 'tablet' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + 'mobile' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ); + + if ( isset( $val['desktop'] ) ) { + $spacing['desktop'] = array_map( 'self::check_numberic_values', $val['desktop'] ); + + $spacing['tablet'] = array_map( 'self::check_numberic_values', $val['tablet'] ); + + $spacing['mobile'] = array_map( 'self::check_numberic_values', $val['mobile'] ); + + if ( isset( $val['desktop-unit'] ) ) { + $spacing['desktop-unit'] = $val['desktop-unit']; + } + + if ( isset( $val['tablet-unit'] ) ) { + $spacing['tablet-unit'] = $val['tablet-unit']; + } + + if ( isset( $val['mobile-unit'] ) ) { + $spacing['mobile-unit'] = $val['mobile-unit']; + } + + return $spacing; + + } else { + foreach ( $val as $key => $value ) { + $val[ $key ] = is_numeric( $val[ $key ] ) ? $val[ $key ] : ''; + } + return $val; + } + + } + + /** + * Check numeric values. + * + * @param int|string $value Value of variable. + * @return string|int Return empty if $value is not integer. + * + * @since 2.5.4 + */ + public static function check_numberic_values( $value ) { + return ( is_numeric( $value ) ) ? $value : ''; + } + + /** + * Sanitize Responsive Slider + * + * @param array|number $val Customizer setting input number. + * @param object $setting Setting Onject. + * @return array Return number. + */ + public static function sanitize_responsive_slider( $val, $setting ) { + + $input_attrs = array(); + if ( isset( $setting->manager->get_control( $setting->id )->input_attrs ) ) { + $input_attrs = $setting->manager->get_control( $setting->id )->input_attrs; + } + + $responsive = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + if ( is_array( $val ) ) { + $responsive['desktop'] = is_numeric( $val['desktop'] ) ? $val['desktop'] : ''; + $responsive['tablet'] = is_numeric( $val['tablet'] ) ? $val['tablet'] : ''; + $responsive['mobile'] = is_numeric( $val['mobile'] ) ? $val['mobile'] : ''; + } else { + $responsive['desktop'] = is_numeric( $val ) ? $val : ''; + } + + foreach ( $responsive as $key => $value ) { + $value = isset( $input_attrs['min'] ) && ( ! empty( $value ) ) && ( $input_attrs['min'] > $value ) ? $input_attrs['min'] : $value; + $value = isset( $input_attrs['max'] ) && ( ! empty( $value ) ) && ( $input_attrs['max'] < $value ) ? $input_attrs['max'] : $value; + $responsive[ $key ] = $value; + } + + return $responsive; + } + + /** + * Sanitize Responsive Typography + * + * @param array|number $val Customizer setting input number. + * @return array Return number. + */ + public static function sanitize_responsive_typo( $val ) { + + $responsive = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => '', + 'tablet-unit' => '', + 'mobile-unit' => '', + ); + if ( is_array( $val ) ) { + $responsive['desktop'] = ( isset( $val['desktop'] ) && is_numeric( $val['desktop'] ) ) ? $val['desktop'] : ''; + $responsive['tablet'] = ( isset( $val['tablet'] ) && is_numeric( $val['tablet'] ) ) ? $val['tablet'] : ''; + $responsive['mobile'] = ( isset( $val['mobile'] ) && is_numeric( $val['mobile'] ) ) ? $val['mobile'] : ''; + $responsive['desktop-unit'] = ( isset( $val['desktop-unit'] ) && in_array( $val['desktop-unit'], array( '', 'px', 'em', 'rem', '%' ) ) ) ? $val['desktop-unit'] : 'px'; + $responsive['tablet-unit'] = ( isset( $val['tablet-unit'] ) && in_array( $val['tablet-unit'], array( '', 'px', 'em', 'rem', '%' ) ) ) ? $val['tablet-unit'] : 'px'; + $responsive['mobile-unit'] = ( isset( $val['mobile-unit'] ) && in_array( $val['mobile-unit'], array( '', 'px', 'em', 'rem', '%' ) ) ) ? $val['mobile-unit'] : 'px'; + } else { + $responsive['desktop'] = is_numeric( $val ) ? $val : ''; + } + return $responsive; + } + + /** + * Validate Email + * + * @param object $validity setting input validity. + * @param string $value setting input value. + * @return object Return the validity object. + */ + public static function validate_email( $validity, $value ) { + if ( ! is_email( $value ) ) { + $validity->add( 'required', __( 'Enter valid email address!', 'astra' ) ); + } + return $validity; + } + + /** + * Validate Sidebar Content Width + * + * @param number $value Sidebar content width. + * @return number Sidebar content width value. + */ + public static function validate_sidebar_content_width( $value ) { + $value = intval( $value ); + if ( $value > 50 ) { + $value = 50; + } elseif ( $value < 15 ) { + $value = 15; + } + return $value; + } + + /** + * Validate Site width + * + * @param number $value Site width. + * @return number Site width value. + */ + public static function validate_site_width( $value ) { + $value = intval( $value ); + if ( 1920 < $value ) { + $value = 1920; + } elseif ( 768 > $value ) { + $value = 768; + } + return $value; + } + + /** + * Validate Site padding + * + * @param number $value Site padding. + * @return number Site padding value. + */ + public static function validate_site_padding( $value ) { + $value = intval( $value ); + if ( 200 < $value ) { + $value = 200; + } elseif ( 1 > $value ) { + $value = 1; + } + return $value; + } + + /** + * Validate Site margin + * + * @param number $value Site margin. + * @return number Site margin value. + */ + public static function validate_site_margin( $value ) { + $value = intval( $value ); + if ( 600 < $value ) { + $value = 600; + } elseif ( 0 > $value ) { + $value = 0; + } + return $value; + } + + /** + * Sanitize checkbox + * + * @param number $input setting input. + * @return number setting input value. + */ + public static function sanitize_checkbox( $input ) { + if ( $input ) { + $output = '1'; + } else { + $output = false; + } + return $output; + } + + /** + * Sanitize HEX color + * + * @param string $color setting input. + * @return string setting input value. + */ + public static function sanitize_hex_color( $color ) { + + if ( '' === $color ) { + return ''; + } + + // 3 or 6 hex digits, or the empty string. + if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) { + return $color; + } + + return ''; + } + + /** + * Sanitize Alpha color + * + * @param string $color setting input. + * @return string setting input value. + */ + public static function sanitize_alpha_color( $color ) { + + if ( '' === $color ) { + return ''; + } + + if ( false === strpos( $color, 'rgba' ) ) { + /* Hex sanitize */ + return self::sanitize_hex_color( $color ); + } + + /* rgba sanitize */ + $color = str_replace( ' ', '', $color ); + sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha ); + return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')'; + } + + /** + * Sanitize html + * + * @param string $input setting input. + * @return mixed setting input value. + */ + public static function sanitize_html( $input ) { + return wp_kses_post( $input ); + } + + /** + * Sanitize Select choices + * + * @param string $input setting input. + * @param object $setting setting object. + * @return mixed setting input value. + */ + public static function sanitize_multi_choices( $input, $setting ) { + + // Get list of choices from the control + // associated with the setting. + $choices = $setting->manager->get_control( $setting->id )->choices; + $input_keys = $input; + + foreach ( $input_keys as $key => $value ) { + if ( ! array_key_exists( $value, $choices ) ) { + unset( $input[ $key ] ); + } + } + + // If the input is a valid key, return it; + // otherwise, return the default. + return ( is_array( $input ) ? $input : $setting->default ); + } + + /** + * Sanitize Select choices + * + * @param string $input setting input. + * @param object $setting setting object. + * @return mixed setting input value. + */ + public static function sanitize_choices( $input, $setting ) { + + // Ensure input is a slug. + $input = sanitize_key( $input ); + + // Get list of choices from the control + // associated with the setting. + $choices = $setting->manager->get_control( $setting->id )->choices; + + // If the input is a valid key, return it; + // otherwise, return the default. + return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); + } + + /** + * Sanitize Font weight + * + * @param mixed $input setting input. + * @return mixed setting input value. + */ + public static function sanitize_font_weight( $input ) { + + $valid = array( + 'normal', + 'bold', + '100', + '200', + '300', + '400', + '500', + '600', + '700', + '800', + '900', + ); + + if ( in_array( $input, $valid ) ) { + return $input; + } else { + return 'normal'; + } + } + + /** + * Sanitize Font variant + * + * @param mixed $input setting input. + * @return mixed setting input value. + */ + public static function sanitize_font_variant( $input ) { + + if ( is_array( $input ) ) { + $input = implode( ',', $input ); + } + return sanitize_text_field( $input ); + } + + /** + * Sanitize Background Obj + * + * @param mixed $bg_obj setting input. + * @return array setting input value. + */ + public static function sanitize_background_obj( $bg_obj ) { + + $out_bg_obj = array( + 'background-color' => '', + 'background-image' => '', + 'background-repeat' => 'repeat', + 'background-position' => 'center center', + 'background-size' => 'auto', + 'background-attachment' => 'scroll', + 'background-media' => '', + 'background-type' => '', + ); + + if ( is_array( $bg_obj ) ) { + + foreach ( $out_bg_obj as $key => $value ) { + + if ( isset( $bg_obj[ $key ] ) ) { + + if ( 'background-image' === $key ) { + $out_bg_obj[ $key ] = esc_url_raw( $bg_obj[ $key ] ); + } else { + $out_bg_obj[ $key ] = esc_attr( $bg_obj[ $key ] ); + } + } + } + } + + return $out_bg_obj; + } + + /** + * Sanitize Border Typography + * + * @since 1.4.0 + * @param array|number $val Customizer setting input number. + * @return array Return number. + */ + public static function sanitize_border( $val ) { + + $border = array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ); + if ( is_array( $val ) ) { + $border['top'] = is_numeric( $val['top'] ) ? $val['top'] : ''; + $border['right'] = is_numeric( $val['right'] ) ? $val['right'] : ''; + $border['bottom'] = is_numeric( $val['bottom'] ) ? $val['bottom'] : ''; + $border['left'] = is_numeric( $val['left'] ) ? $val['left'] : ''; + } + return $border; + } + + /** + * Sanitize Customizer Link param. + * + * @param Array $val array( + * linked : Linked Customizer Section, + * link_text : Link Text. + * ). + * + * @since 1.6.0 + * + * @return Array + */ + public static function sanitize_customizer_links( $val ) { + $val['linked'] = sanitize_text_field( $val['linked'] ); + $val['link_text'] = esc_html( $val['link_text'] ); + $val['link_type'] = esc_html( $val['link_type'] ); + + return $val; + } + + /** + * Sanitize Responsive Background Image + * + * @param array $bg_obj Background object. + * @return array Background object. + */ + public static function sanitize_responsive_background( $bg_obj ) { + + // Default Responsive Background Image. + $defaults = array( + 'desktop' => array( + 'background-color' => '', + 'background-image' => '', + 'background-repeat' => 'repeat', + 'background-position' => 'center center', + 'background-size' => 'auto', + 'background-attachment' => 'scroll', + 'background-media' => '', + 'background-type' => '', + ), + 'tablet' => array( + 'background-color' => '', + 'background-image' => '', + 'background-repeat' => 'repeat', + 'background-position' => 'center center', + 'background-size' => 'auto', + 'background-attachment' => 'scroll', + 'background-media' => '', + 'background-type' => '', + ), + 'mobile' => array( + 'background-color' => '', + 'background-image' => '', + 'background-repeat' => 'repeat', + 'background-position' => 'center center', + 'background-size' => 'auto', + 'background-attachment' => 'scroll', + 'background-media' => '', + 'background-type' => '', + ), + ); + + // Merge responsive background object and default object into $out_bg_obj array. + $out_bg_obj = wp_parse_args( $bg_obj, $defaults ); + + foreach ( $out_bg_obj as $device => $bg ) { + foreach ( $bg as $key => $value ) { + if ( 'background-image' === $key ) { + $out_bg_obj[ $device ] [ $key ] = esc_url_raw( $value ); + } + if ( 'background-media' === $key ) { + $out_bg_obj[ $device ] [ $key ] = floatval( $value ); + } else { + $out_bg_obj[ $device ] [ $key ] = esc_attr( $value ); + } + } + } + return $out_bg_obj; + } + + /** + * Sanitize Toggle Control param. + * + * @param bool $val for True|False. + * + * @since 3.1.0 + * + * @return bool True|False + */ + public static function sanitize_toggle_control( $val ) { + // returns true if checkbox is checked. + return ( isset( $val ) && is_bool( $val ) ? $val : '' ); + } + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +Astra_Customizer_Sanitizes::get_instance(); diff --git a/inc/customizer/class-astra-customizer.php b/inc/customizer/class-astra-customizer.php index 037e052..cfc7aea 100644 --- a/inc/customizer/class-astra-customizer.php +++ b/inc/customizer/class-astra-customizer.php @@ -1,1534 +1,1534 @@ -' ) && is_customize_preview() ) { - add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' ); - } - - add_action( 'customize_controls_enqueue_scripts', array( $this, 'controls_scripts' ) ); - add_filter( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_customizer_scripts' ), 999 ); - - add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_footer_scripts' ) ); - - add_action( 'customize_register', array( $this, 'customize_register_panel' ), 2 ); - add_action( 'customize_register', array( $this, 'customize_register' ) ); - add_action( 'customize_save_after', array( $this, 'customize_save' ) ); - add_action( 'customize_save_after', array( $this, 'delete_cached_partials' ) ); - add_action( 'wp_head', array( $this, 'preview_styles' ) ); - add_action( 'wp_ajax_astra_regenerate_fonts_folder', array( $this, 'regenerate_astra_fonts_folder' ) ); - } - - /** - * Reset font folder - * - * @access public - * @return void - * - * @since 3.6.0 - */ - public function regenerate_astra_fonts_folder() { - - check_ajax_referer( 'astra-regenerate-local-fonts', 'nonce' ); - - if ( ! current_user_can( 'edit_theme_options' ) ) { - wp_send_json_error( 'invalid_permissions' ); - } - - if ( astra_get_option( 'load-google-fonts-locally' ) ) { - $local_font_loader = astra_webfont_loader_instance( '' ); - $flushed = $local_font_loader->astra_delete_fonts_folder(); - - if ( ! $flushed ) { - wp_send_json_error( 'failed_to_flush' ); - } - wp_send_json_success(); - } - - wp_send_json_error( 'no_font_loader' ); - } - - /** - * Delete the cached partial configs. - */ - public function delete_cached_partials() { - delete_option( 'astra_partials_config_cache' ); - - // Delete previously stored local fonts data, if exists. - if ( astra_get_option( 'load-google-fonts-locally' ) ) { - $local_webfont_loader = astra_webfont_loader_instance( '' ); - $local_webfont_loader->astra_delete_fonts_folder(); - } - } - - /** - * Add dynamic control partial refresh. - * - * @since 3.1.0 - * @param array $partial_args partial configs. - * @param string $partial_id partial id. - * @return array|mixed - */ - public function filter_dynamic_partial_args( $partial_args, $partial_id ) { - - if ( isset( self::$dynamic_options['partials'][ $partial_id ] ) ) { - if ( false === $partial_args ) { - $partial_args = array(); - } - $partial_args = array_merge( $partial_args, self::$dynamic_options['partials'][ $partial_id ] ); - } - - return $partial_args; - - } - - - /** - * Add dynamic control settings. - * - * @since 3.1.0 - * @param array $setting_args setting configs. - * @param string $setting_id setting id. - * @return mixed - */ - public function filter_dynamic_setting_args( $setting_args, $setting_id ) { - - if ( isset( self::$dynamic_options['settings'][ $setting_id ] ) ) { - return self::$dynamic_options['settings'][ $setting_id ]; - } - - return $setting_args; - } - - /** - * Prepare Contexts and choices. - * - * @since 3.0.0 - */ - public function prepare_customizer_javascript_configs() { - - global $wp_customize; - - $cached_data = get_option( 'astra_partials_config_cache', false ); - - if ( $wp_customize->selective_refresh->is_render_partials_request() && $cached_data ) { - self::$dynamic_options = $cached_data; - return; - } - - $configurations = $this->get_customizer_configurations(); - - $defaults = $this->get_astra_customizer_configuration_defaults(); - - foreach ( $configurations as $key => $configuration ) { - - $config = wp_parse_args( $configuration, $defaults ); - - if ( isset( $configuration['context'] ) ) { - self::$contexts[ $configuration['name'] ] = $configuration['context']; - } else { - if ( isset( $configuration['type'] ) && ( ( 'control' === $configuration['type'] ) || ( 'sub-control' === $configuration['type'] ) ) ) { - if ( ( isset( $configuration['control'] ) && 'ast-builder-header-control' !== $configuration['control'] ) && ( isset( $configuration['name'] ) && strpos( $configuration['name'], 'ast-callback-notice' ) === false ) ) { - self::$contexts[ $configuration['name'] ] = Astra_Builder_Helper::$general_tab; - } - } - } - - if ( isset( $configuration['choices'] ) ) { - self::$choices[ $configuration['name'] ] = $configuration['choices']; - } - - switch ( $config['type'] ) { - - case 'panel': - $this->prepare_javascript_panel_configs( $config ); - break; - case 'section': - $this->prepare_javascript_section_configs( $config ); - break; - - case 'sub-control': - $this->prepare_javascript_sub_control_configs( $config ); - break; - case 'control': - $this->prepare_javascript_control_configs( $config ); - break; - } - } - - update_option( 'astra_partials_config_cache', self::$dynamic_options, false ); - - } - - /** - * Get control default. - * - * @param string $setting_key setting key. - * @param array $default_values default value array. - * @return mixed|string - */ - private function get_default_value( $setting_key, $default_values ) { - $return = ''; - preg_match( '#astra-settings\[(.*?)\]#', $setting_key, $match ); - if ( ! empty( $match ) && isset( $match[1] ) ) { - $return = isset( $default_values[ $match[1] ] ) ? $default_values[ $match[1] ] : ''; - } - return $return; - } - - /** - * Prepare tabbed sections for dynamic controls to optimize frontend JS calls. - */ - private static function prepare_tabbed_sections() { - - if ( ! isset( self::$js_configs['controls'] ) ) { - return; - } - - foreach ( self::$js_configs['controls'] as $section_id => $controls ) { - $tab_id = $section_id . '-ast-context-tabs'; - $control_names = wp_list_pluck( $controls, 'name' ); - if ( in_array( $tab_id, $control_names, true ) ) { - array_push( self::$tabbed_sections, $section_id ); - } - } - - } - - /** - * Print Footer Scripts - * - * @since 1.0.0 - * @return void - */ - public function print_footer_scripts() { - $output = ''; - - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - } - - /** - * Set default context for WP default controls. - */ - private static function set_default_context() { - - if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) { - return; - } - - self::$contexts['blogname'] = array( - Astra_Builder_Helper::$general_tab_config, - - ); - - self::$contexts['blogdescription'] = array( - Astra_Builder_Helper::$general_tab_config, - - ); - - } - - /** - * Bypass JS configs for Controls. - * - * @param array $configuration configuration. - */ - public static function bypass_control_configs( $configuration ) { - - $val = ''; - - if ( isset( $configuration['name'] ) ) { - - $data = explode( '[', rtrim( $configuration['name'], ']' ) ); - - if ( isset( $data[1] ) ) { - $val = astra_get_option( $data[1] ); - } - } - - if ( isset( $val ) && ! empty( $val ) ) { - - $configuration['value'] = $val; - } - - switch ( $configuration['type'] ) { - - case 'ast-builder': - if ( is_array( $configuration['default'] ) && ! isset( $configuration['default']['popup'] ) ) { - $configuration['default']['popup'] = array( 'popup_content' => array() ); - } - break; - case 'ast-responsive-spacing': - if ( ! is_array( $val ) || is_numeric( $val ) ) { - - $configuration['value'] = array( - 'desktop' => array( - 'top' => $val, - 'right' => '', - 'bottom' => $val, - 'left' => '', - ), - 'tablet' => array( - 'top' => $val, - 'right' => '', - 'bottom' => $val, - 'left' => '', - ), - 'mobile' => array( - 'top' => $val, - 'right' => '', - 'bottom' => $val, - 'left' => '', - ), - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ); - } - - break; - case 'ast-radio-image': - $configuration['value'] = $val; - - if ( isset( $configuration['choices'] ) && is_array( $configuration['choices'] ) ) { - - foreach ( $configuration['choices'] as $key => $value ) { - $configuration['choices'][ $key ] = $value['path']; - $configuration['choices_titles'][ $key ] = $value['label']; - } - } - if ( isset( $configuration['input_attrs'] ) ) { - - $configuration['inputAttrs'] = ''; - $configuration['labelStyle'] = ''; - foreach ( $configuration['input_attrs'] as $attr => $value ) { - if ( 'style' !== $attr ) { - $configuration['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; - } else { - $configuration['labelStyle'] = 'style="' . esc_attr( $value ) . '" '; - } - } - } - break; - case 'ast-border': - $configuration['value'] = $val; - - break; - case 'ast-responsive-slider': - if ( ! is_array( $val ) || is_numeric( $val ) ) { - - $configuration['value'] = array( - 'desktop' => $val, - 'tablet' => '', - 'mobile' => '', - ); - } - break; - case 'ast-responsive-background': - $configuration['value'] = $val; - - break; - case 'ast-responsive': - if ( ! is_array( $val ) || is_numeric( $val ) ) { - - $configuration['value'] = array( - 'desktop' => $val, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => '', - 'tablet-unit' => '', - 'mobile-unit' => '', - ); - } - break; - case 'ast-link': - $configuration['value'] = $val; - - break; - case 'ast-hidden': - $configuration['value'] = $val; - - break; - case 'ast-settings-group': - $config = array(); - - if ( isset( self::$group_configs[ $configuration['name'] ]['tabs'] ) ) { - $tab = array_keys( self::$group_configs[ $configuration['name'] ]['tabs'] ); - rsort( $tab ); - foreach ( $tab as $key => $value ) { - - $config['tabs'][ $value ] = wp_list_sort( self::$group_configs[ $configuration['name'] ]['tabs'][ $value ], 'priority' ); - } - } else { - if ( isset( self::$group_configs[ $configuration['name'] ] ) ) { - $config = wp_list_sort( self::$group_configs[ $configuration['name'] ], 'priority' ); - } - } - $configuration['ast_fields'] = $config; - break; - case 'ast-font-weight': - $configuration['ast_all_font_weight'] = array( - '100' => __( 'Thin 100', 'astra' ), - '100italic' => __( '100 Italic', 'astra' ), - '200' => __( 'Extra-Light 200', 'astra' ), - '200italic' => __( '200 Italic', 'astra' ), - '300' => __( 'Light 300', 'astra' ), - '300italic' => __( '300 Italic', 'astra' ), - '400' => __( 'Normal 400', 'astra' ), - 'italic' => __( '400 Italic', 'astra' ), - '500' => __( 'Medium 500', 'astra' ), - '500italic' => __( '500 Italic', 'astra' ), - '600' => __( 'Semi-Bold 600', 'astra' ), - '600italic' => __( '600 Italic', 'astra' ), - '700' => __( 'Bold 700', 'astra' ), - '700italic' => __( '700 Italic', 'astra' ), - '800' => __( 'Extra-Bold 800', 'astra' ), - '800italic' => __( '800 Italic', 'astra' ), - '900' => __( 'Ultra-Bold 900', 'astra' ), - '900italic' => __( '900 Italic', 'astra' ), - ); - break; - case 'ast-sortable': - $configuration['value'] = $val; - - break; - - } // Switch End. - - if ( isset( $configuration['id'] ) ) { - - $configuration['link'] = self::get_control_link( $configuration['id'] ); - } - $exclude_controls = array( 'ast-builder', 'ast-radio-image' ); - - if ( isset( $configuration['type'] ) && ! in_array( $configuration['type'], $exclude_controls ) && isset( $configuration['input_attrs'] ) && is_array( $configuration['input_attrs'] ) ) { - - $configuration['inputAttrs'] = ''; - - foreach ( $configuration['input_attrs'] as $attr => $value ) { - - if ( ! is_array( $value ) ) { - - $configuration['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; - } - } - } - - return $configuration; - } - - /** - * Prepare Panel Configs for Javascript. - * - * @since 3.0.0 - * @param array $config configs. - */ - public function prepare_javascript_panel_configs( $config ) { - - $panel_name = astra_get_prop( $config, 'name' ); - - unset( $config['type'] ); - $config['type'] = 'ast_panel'; - $config['active'] = true; - $config['id'] = $panel_name; - self::$js_configs['panels'][ $panel_name ] = $config; - } - - /** - * Prepare Section Configs for Javascript. - * - * @since 3.0.0 - * @param array $config configs. - */ - public function prepare_javascript_section_configs( $config ) { - - $section_name = astra_get_prop( $config, 'name' ); - - - - unset( $config['type'] ); - $config['type'] = isset( $config['ast_type'] ) ? $config['ast_type'] : 'ast_section'; - $config['active'] = true; - $config['id'] = $section_name; - $config['customizeAction'] = sprintf( 'Customizing â–¸ %s', astra_get_prop( $config, 'title' ) ); - - if ( isset( $config['clone_type'] ) && isset( $config['clone_index'] ) ) { - - if ( isset( Astra_Builder_Helper::$component_count_array[ $config['clone_type'] ] ) ) { - if ( in_array( $section_name, Astra_Builder_Helper::$component_count_array['removed-items'], true ) || Astra_Builder_Helper::$component_count_array[ $config['clone_type'] ] < $config['clone_index'] ) { - self::$js_configs['clone_sections'][ $section_name ] = $config; - } else { - self::$js_configs['sections'][ $section_name ] = $config; - } - } - } else { - self::$js_configs['sections'][ $section_name ] = $config; - } - - - } - - /** - * Prepare Sub Control Configs for Javascript. - * - * @since 3.0.0 - * @param array $config configs. - */ - public function prepare_javascript_sub_control_configs( $config ) { - - global $wp_customize; - unset( $config['type'] ); - - $sub_control_name = ASTRA_THEME_SETTINGS . '[' . astra_get_prop( $config, 'name' ) . ']'; - $parent = astra_get_prop( $config, 'parent' ); - - $ignore_controls = array( 'ast-settings-group', 'ast-sortable', 'ast-radio-image', 'ast-slider', 'ast-responsive-slider' ); - - $sanitize_callback = ( in_array( $config['control'], $ignore_controls, true ) ) ? false : astra_get_prop( $config, 'sanitize_callback', Astra_Customizer_Control_Base::get_sanitize_call( astra_get_prop( $config, 'control' ) ) ); - - if ( ! $sanitize_callback ) { - $config = $this->sanitize_control( $config ); - } - - $new_config = array( - 'name' => $sub_control_name, - 'datastore_type' => 'option', - 'transport' => 'postMessage', - 'control' => 'ast-hidden', - 'section' => astra_get_prop( $config, 'section', 'title_tagline' ), - 'title' => astra_get_prop( $config, 'title' ), - 'priority' => astra_get_prop( $config, 'priority', '10' ), - 'default' => astra_get_prop( $config, 'default' ), - 'sanitize_callback' => $sanitize_callback, - 'suffix' => astra_get_prop( $config, 'suffix' ), - 'control_type' => astra_get_prop( $config, 'control' ), - ); - - - self::$dynamic_options['settings'][ astra_get_prop( $new_config, 'name' ) ] = array( - 'default' => astra_get_prop( $new_config, 'default' ), - 'type' => astra_get_prop( $new_config, 'datastore_type' ), - 'transport' => astra_get_prop( $new_config, 'transport', 'refresh' ), - 'sanitize_callback' => astra_get_prop( $new_config, 'sanitize_callback', Astra_Customizer_Control_Base::get_sanitize_call( astra_get_prop( $new_config, 'control' ) ) ), - ); - - $new_config['type'] = astra_get_prop( $new_config, 'control' ); - $new_config['id'] = astra_get_prop( $new_config, 'name' ); - $new_config['settings'] = array( 'default' => astra_get_prop( $new_config, 'name' ) ); - $new_config = self::bypass_control_configs( $new_config ); - self::$js_configs ['sub_controls'] [ $parent ] [] = $new_config; - } - - /** - * Get the Link for Control. - * - * @since 3.0.0 - * @param array $id Control ID. - */ - public static function get_control_link( $id ) { - if ( isset( $id ) ) { - return 'data-customize-setting-link="' . $id . '"'; - } else { - return 'data-customize-setting-key-link="default"'; - } - } - - /** - * Prepare Control Configs for Javascript. - * - * @since 3.0.0 - * @param array $config configs. - */ - public function prepare_javascript_control_configs( $config ) { - - global $wp_customize; - // Remove type from configuration. - unset( $config['type'] ); - - $ignore_controls = array( 'ast-settings-group', 'ast-sortable', 'ast-radio-image', 'ast-slider', 'ast-responsive-slider' ); - - if ( ! isset( $config['control'] ) ) { - return; - } - - $sanitize_callback = ( in_array( $config['control'], $ignore_controls, true ) ) ? false : astra_get_prop( $config, 'sanitize_callback', Astra_Customizer_Control_Base::get_sanitize_call( astra_get_prop( $config, 'control' ) ) ); - - - if ( ! $sanitize_callback ) { - $config = $this->sanitize_control( $config ); - } - - $config['label'] = astra_get_prop( $config, 'title' ); - $config['type'] = astra_get_prop( $config, 'control' ); - - if ( false !== astra_get_prop( $config, 'font-type', false ) ) { - $config['type'] = astra_get_prop( $config, 'font-type', false ); - } - - if ( 'image' === $config['type'] ) { - $this->prepare_preload_controls( $config ); - } - - if ( isset( $config['active_callback'] ) ) { - - self::$js_configs ['skip_context'] [] = astra_get_prop( $config, 'name' ); - $this->prepare_preload_controls( $config ); - return; - } - - self::$dynamic_options['settings'][ astra_get_prop( $config, 'name' ) ] = array( - 'default' => astra_get_prop( $config, 'default' ), - 'type' => astra_get_prop( $config, 'datastore_type' ), - 'transport' => astra_get_prop( $config, 'transport', 'refresh' ), - 'sanitize_callback' => $sanitize_callback, - ); - - if ( astra_get_prop( $config, 'partial', false ) ) { - self::$dynamic_options['partials'][ astra_get_prop( $config, 'name' ) ] = array( - 'selector' => astra_get_prop( $config['partial'], 'selector' ), - 'render_callback' => astra_get_prop( $config['partial'], 'render_callback' ), - 'containerInclusive' => astra_get_prop( $config['partial'], 'container_inclusive' ), - 'fallbackRefresh' => astra_get_prop( $config['partial'], 'fallback_refresh', true ), - ); - } - - $config['id'] = astra_get_prop( $config, 'name' ); - $config['settings'] = array( 'default' => astra_get_prop( $config, 'name' ) ); - $config = self::bypass_control_configs( $config ); - - if ( isset( $config['section'] ) ) { - self::$js_configs ['controls'] [ $config['section'] ] [] = $config; - } - } - - /** - * Map and add sanitize callback to JS configs. - * - * @param array $config js config array. - * @return mixed - */ - public function sanitize_control( $config ) { - - $control_type = isset( $config['control'] ) ? $config['control'] : ''; - switch ( $control_type ) { - case 'color': - $config['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_hex_color' ); - break; - case 'ast-border': - $config['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_border' ); - break; - case 'ast-html-editor': - $config['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_html' ); - break; - case 'ast-color': - $config['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ); - break; - case 'ast-sortable': - $config ['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ); - break; - case 'ast-radio-image': - $config ['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ); - break; - case 'ast-link': - $config ['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_link' ); - break; - case 'ast-customizer-link': - $config ['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_customizer_links' ); - break; - case 'ast-responsive-slider': - $config ['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ); - break; - case 'ast-toggle-control': - $config ['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_toggle_control' ); - break; - default: - break; - } - - return $config; - - } - - /** - * Add controls for which active_callback is added. - * - * @since 3.0.0 - * @param array $config config. - */ - public function prepare_preload_controls( $config ) { - - global $wp_customize; - - $instance = Astra_Customizer_Control_Base::get_control_instance( astra_get_prop( $config, 'control' ) ); - - // Forwarding to the DOM as default control. - if ( 'title_tagline' !== $config['section'] ) { - self::$js_configs ['wp_defaults'][ astra_get_prop( $config, 'name' ) ] = $config['section']; - $config['section'] = 'title_tagline'; - } - - $wp_customize->add_setting( - astra_get_prop( $config, 'name' ), - array( - 'default' => astra_get_prop( $config, 'default' ), - 'type' => astra_get_prop( $config, 'datastore_type' ), - 'transport' => astra_get_prop( $config, 'transport', 'refresh' ), - 'sanitize_callback' => astra_get_prop( $config, 'sanitize_callback', Astra_Customizer_Control_Base::get_sanitize_call( astra_get_prop( $config, 'control' ) ) ), - ) - ); - - if ( false !== $instance ) { - $wp_customize->add_control( - new $instance( $wp_customize, astra_get_prop( $config, 'name' ), $config ) - ); - } else { - $wp_customize->add_control( astra_get_prop( $config, 'name' ), $config ); - } - } - - /** - * Prepare Group configs to visible sub-controls. - * - * @since 3.0.0 - * @param object $wp_customize customizer object. - */ - public function prepare_group_configs( $wp_customize ) { - - if ( $wp_customize->selective_refresh->is_render_partials_request() ) { - return; - } - - $configurations = $this->get_customizer_configurations(); - $defaults = $this->get_astra_customizer_configuration_defaults(); - - foreach ( $configurations as $key => $configuration ) { - $config = wp_parse_args( $configuration, $defaults ); - if ( 'sub-control' === $config['type'] ) { - unset( $config['type'] ); - $parent = astra_get_prop( $config, 'parent' ); - $tab = astra_get_prop( $config, 'tab' ); - - if ( empty( self::$group_configs[ $parent ] ) ) { - self::$group_configs[ $parent ] = array(); - } - - if ( array_key_exists( 'tab', $config ) ) { - self::$group_configs[ $parent ]['tabs'][ $tab ][] = $config; - } else { - self::$group_configs[ $parent ][] = $config; - } - } - } - } - - /** - * Prepare context. - * - * @return mixed|void - */ - public static function get_contexts() { - - self::set_default_context(); - // Return contexts. - return apply_filters( 'astra_customizer_context', self::$contexts ); - } - - /** - * Prepare choices. - * - * @return mixed|void - */ - public static function get_choices() { - // Return contexts. - return apply_filters( 'astra_customizer_choices', self::$choices ); - } - - /** - * Prepare javascript configs. - * - * @return mixed|void - */ - public static function get_js_configs() { - - // Return contexts. - return apply_filters( 'astra_javascript_configurations', self::$js_configs ); - } - - /** - * Prepare tabbed sections. - * - * @return mixed|void - */ - public static function get_tabbed_sections() { - - self::prepare_tabbed_sections(); - // Return contexts. - return apply_filters( 'astra_customizer_tabbed_sections', self::$tabbed_sections ); - } - - /** - * Prepare default values for the control. - * - * @return array - */ - private function get_control_defaults() { - - $defaults = array(); - $default_values = Astra_Theme_Options::defaults(); - $default_controls = array_merge( self::$js_configs['controls'], self::$js_configs['sub_controls'] ); - - foreach ( $default_controls as $section_controls ) { - foreach ( $section_controls as $control ) { - $control_id = astra_get_prop( $control, 'name' ); - if ( 'ast-responsive-spacing' === $control['control'] ) { - $defaults[ $control_id ] = array( - 'desktop' => array( - 'top' => '', - 'right' => '', - 'bottom' => '', - 'left' => '', - ), - 'tablet' => array( - 'top' => '', - 'right' => '', - 'bottom' => '', - 'left' => '', - ), - 'mobile' => array( - 'top' => '', - 'right' => '', - 'bottom' => '', - 'left' => '', - ), - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ); - } else { - $defaults[ $control_id ] = $this->get_default_value( $control_id, $default_values ); - } - } - } - - return $defaults; - - } - - /** - * Add customizer script. - * - * @since 3.0.0 - */ - public function enqueue_customizer_scripts() { - - // Localize variables for Dev mode > Customizer JS. - wp_localize_script( - SCRIPT_DEBUG ? 'astra-custom-control-react-script' : 'astra-custom-control-script', - 'AstraBuilderCustomizerData', - array( - 'contexts' => self::get_contexts(), - 'dynamic_setting_options' => self::$dynamic_options['settings'], - 'choices' => self::get_choices(), - 'js_configs' => self::get_js_configs(), - 'tabbed_sections' => self::get_tabbed_sections(), - 'component_limit' => Astra_Builder_Helper::$component_limit, - 'is_site_rtl' => is_rtl(), - 'defaults' => $this->get_control_defaults(), - 'astraRegenerateFonts' => wp_create_nonce( 'astra-regenerate-local-fonts' ), - 'initialFlushText' => __( 'Flush Local Font Files', 'astra' ), - 'successFlushed' => __( 'Successfully Flushed', 'astra' ), - 'failedFlushed' => __( 'Failed, Please try again later.', 'astra' ), - ) - ); - - if ( is_rtl() ) { - $builder_customizer_css_file = 'ast-builder-customizer-rtl'; - } else { - $builder_customizer_css_file = 'ast-builder-customizer'; - } - - // Enqueue Builder CSS. - wp_enqueue_style( - 'ahfb-customizer-style', - ASTRA_THEME_URI . 'inc/assets/css/' . $builder_customizer_css_file . '.css', - array( 'wp-components' ), - ASTRA_THEME_VERSION - ); - } - - /** - * Check if string is start with a string provided. - * - * @param string $string main string. - * @param string $start_string string to search. - * @since 2.0.0 - * @return bool. - */ - public function starts_with( $string, $start_string ) { - $len = strlen( $start_string ); - return ( substr( $string, 0, $len ) === $start_string ); - } - - /** - * Filter and return Customizer Configurations. - * - * @since 1.4.3 - * @return Array Customizer Configurations for registering Sections/Panels/Controls. - */ - private function get_customizer_configurations() { - - global $wp_customize; - - if ( ! is_null( self::$configuration ) ) { - return self::$configuration; - } - - self::$configuration = apply_filters( 'astra_customizer_configurations', array(), $wp_customize ); - return self::$configuration; - } - - /** - * Return default values for the Customize Configurations. - * - * @since 1.4.3 - * @return Array default values for the Customizer Configurations. - */ - private function get_astra_customizer_configuration_defaults() { - return apply_filters( - 'astra_customizer_configuration_defaults', - array( - 'priority' => null, - 'title' => null, - 'label' => null, - 'name' => null, - 'type' => null, - 'description' => null, - 'capability' => null, - 'datastore_type' => 'option', // theme_mod or option. Default option. - 'settings' => null, - 'active_callback' => null, - 'sanitize_callback' => null, - 'sanitize_js_callback' => null, - 'theme_supports' => null, - 'transport' => null, - 'default' => null, - 'selector' => null, - 'ast_fields' => array(), - ) - ); - } - - /** - * Include Customizer Configuration files. - * - * @since 1.4.3 - * @return void - */ - public function include_configurations() { - // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound - require ASTRA_THEME_DIR . 'inc/customizer/configurations/class-astra-customizer-config-base.php'; - - /** - * Register Sections & Panels - */ - require ASTRA_THEME_DIR . 'inc/customizer/class-astra-customizer-register-sections-panels.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/buttons/class-astra-customizer-button-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-site-layout-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-site-identity-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-blog-layout-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-blog-single-layout-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-sidebar-layout-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-site-container-layout-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/colors-background/class-astra-body-colors-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/typography/class-astra-archive-typo-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/typography/class-astra-body-typo-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/typography/class-astra-content-typo-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/typography/class-astra-header-typo-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/typography/class-astra-single-typo-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/performance/class-astra-performance-configs.php'; - - if ( astra_existing_header_footer_configs() ) { - require ASTRA_THEME_DIR . 'inc/customizer/configurations/buttons/class-astra-existing-button-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-header-layout-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-footer-layout-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/colors-background/class-astra-advanced-footer-colors-configs.php'; - require ASTRA_THEME_DIR . 'inc/customizer/configurations/colors-background/class-astra-footer-colors-configs.php'; - } - // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound - } - - /** - * Register custom section and panel. - * - * @since 1.0.0 - * @param WP_Customize_Manager $wp_customize Theme Customizer object. - */ - public function customize_register_panel( $wp_customize ) { - - /** - * Register Extended Panel - */ - $wp_customize->register_panel_type( 'Astra_WP_Customize_Panel' ); - $wp_customize->register_section_type( 'Astra_WP_Customize_Section' ); - $wp_customize->register_section_type( 'Astra_WP_Customize_Separator' ); - - if ( ! defined( 'ASTRA_EXT_VER' ) ) { - $wp_customize->register_section_type( 'Astra_Pro_Customizer' ); - } - - // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound - require ASTRA_THEME_DIR . 'inc/customizer/extend-customizer/class-astra-wp-customize-panel.php'; - require ASTRA_THEME_DIR . 'inc/customizer/extend-customizer/class-astra-wp-customize-section.php'; - require ASTRA_THEME_DIR . 'inc/customizer/extend-customizer/class-astra-wp-customize-separator.php'; - require ASTRA_THEME_DIR . 'inc/customizer/customizer-controls.php'; - // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound - - /** - * Add Controls - */ - - Astra_Customizer_Control_Base::add_control( - 'image', - array( - 'callback' => 'WP_Customize_Image_Control', - 'sanitize_callback' => 'esc_url_raw', - ) - ); - - Astra_Customizer_Control_Base::add_control( - 'ast-font', - array( - 'callback' => 'Astra_Control_Typography', - 'sanitize_callback' => 'sanitize_text_field', - ) - ); - - Astra_Customizer_Control_Base::add_control( - 'ast-font-variant', - array( - 'callback' => 'Astra_Control_Font_Variant', - 'sanitize_callback' => 'sanitize_text_field', - ) - ); - - Astra_Customizer_Control_Base::add_control( - 'ast-description', - array( - 'callback' => 'Astra_Control_Description', - 'sanitize_callback' => '', - ) - ); - - Astra_Customizer_Control_Base::add_control( - 'ast-customizer-link', - array( - 'callback' => 'Astra_Control_Customizer_Link', - 'santize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_customizer_links' ), - ) - ); - - /** - * Helper files - */ - // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound - require ASTRA_THEME_DIR . 'inc/customizer/class-astra-customizer-partials.php'; - require ASTRA_THEME_DIR . 'inc/customizer/class-astra-customizer-callback.php'; - require ASTRA_THEME_DIR . 'inc/customizer/class-astra-customizer-sanitizes.php'; - // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound - } - - /** - * Add postMessage support for site title and description for the Theme Customizer. - * - * @since 1.0.0 - * @param WP_Customize_Manager $wp_customize Theme Customizer object. - */ - public function customize_register( $wp_customize ) { - - /** - * Override Defaults - */ - require ASTRA_THEME_DIR . 'inc/customizer/override-defaults.php';// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound - } - - /** - * Add upgrade link configurations controls. - * - * @since 1.0.0 - * @param WP_Customize_Manager $wp_customize Theme Customizer object. - */ - public function astra_pro_upgrade_configurations( $wp_customize ) { - - if ( ! defined( 'ASTRA_EXT_VER' ) ) { - require ASTRA_THEME_DIR . 'inc/customizer/astra-pro/class-astra-pro-customizer.php';// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound - require ASTRA_THEME_DIR . 'inc/customizer/astra-pro/class-astra-pro-upgrade-link-configs.php';// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound - } - } - - /** - * Customizer Controls - * - * @since 1.0.0 - * @return void - */ - public function controls_scripts() { - - $js_prefix = '.min.js'; - $css_prefix = '.min.css'; - $dir = 'minified'; - if ( SCRIPT_DEBUG ) { - $js_prefix = '.js'; - $css_prefix = '.css'; - $dir = 'unminified'; - } - - if ( is_rtl() ) { - $css_prefix = '.min-rtl.css'; - if ( SCRIPT_DEBUG ) { - $css_prefix = '-rtl.css'; - } - } - - wp_enqueue_style( 'wp-components' ); - wp_enqueue_script( 'thickbox' ); - wp_enqueue_style( 'thickbox' ); - - // Customizer Core. - wp_enqueue_script( 'astra-customizer-controls-toggle-js', ASTRA_THEME_URI . 'assets/js/' . $dir . '/customizer-controls-toggle' . $js_prefix, array(), ASTRA_THEME_VERSION, true ); - - // Extended Customizer Assets - Panel extended. - wp_enqueue_style( 'astra-extend-customizer-css', ASTRA_THEME_URI . 'assets/css/' . $dir . '/extend-customizer' . $css_prefix, null, ASTRA_THEME_VERSION ); - wp_enqueue_script( 'astra-extend-customizer-js', ASTRA_THEME_URI . 'assets/js/' . $dir . '/extend-customizer' . $js_prefix, array(), ASTRA_THEME_VERSION, true ); - - // Customizer Controls. - wp_enqueue_style( 'astra-customizer-controls-css', ASTRA_THEME_URI . 'assets/css/' . $dir . '/customizer-controls' . $css_prefix, null, ASTRA_THEME_VERSION ); - - $string = $this->generate_font_dropdown(); - - $template = '
    - -
    '; - - wp_localize_script( - 'astra-customizer-controls-toggle-js', - 'astra', - apply_filters( - 'astra_theme_customizer_js_localize', - array( - 'customizer' => array( - 'settings' => array( - 'sidebars' => array( - 'single' => array( - 'single-post-sidebar-layout', - 'single-page-sidebar-layout', - ), - 'archive' => array( - 'archive-post-sidebar-layout', - ), - ), - 'container' => array( - 'single' => array( - 'single-post-content-layout', - 'single-page-content-layout', - ), - 'archive' => array( - 'archive-post-content-layout', - ), - ), - 'google_fonts' => $string, - ), - 'group_modal_tmpl' => $template, - 'is_pro' => defined( 'ASTRA_EXT_VER' ), - 'upgrade_link' => htmlspecialchars_decode( astra_get_pro_url( 'https://wpastra.com/pricing/', 'customizer', 'upgrade-link', 'upgrade-to-pro' ) ), - 'is_block_widget' => astra_has_widgets_block_editor(), - ), - 'theme' => array( - 'option' => ASTRA_THEME_SETTINGS, - ), - ) - ) - ); - } - - /** - * Generates HTML for font dropdown. - * - * @return string - */ - public function generate_font_dropdown() { - - ob_start(); - - ?> - - - - - $variants ) { - ?> - - - - - - $single_font ) { - $variants = astra_get_prop( $single_font, '0' ); - $category = astra_get_prop( $single_font, '1' ); - - ?> - - - astra_header_break_point(), - 'includeAnchorsInHeadindsCss' => Astra_Dynamic_CSS::anchors_in_css_selectors_heading(), - 'googleFonts' => Astra_Font_Families::get_google_fonts(), - 'page_builder_button_style_css' => Astra_Dynamic_CSS::page_builder_button_style_css(), - 'elementor_default_color_font_setting' => Astra_Dynamic_CSS::elementor_default_color_font_setting(), - 'dynamic_partial_options' => self::$dynamic_options['partials'], - 'gb_outline_buttons_patterns_support' => Astra_Dynamic_CSS::gutenberg_core_patterns_compat(), - 'font_weights_widget_title_support' => Astra_Dynamic_CSS::support_font_css_to_widget_and_in_editor(), - 'has_block_editor_support' => Astra_Dynamic_CSS::is_block_editor_support_enabled(), - 'updated_gb_outline_button_patterns' => astra_button_default_padding_updated(), - ); - - wp_localize_script( 'astra-customizer-preview-js', 'astraCustomizer', $localize_array ); - } - - /** - * Called by the customize_save_after action to refresh - * the cached CSS when Customizer settings are saved. - * - * @since 1.0.0 - * @return void - */ - public function customize_save() { - - // Update variables. - Astra_Theme_Options::refresh(); - - if ( apply_filters( 'astra_resize_logo', true ) ) { - - /* Generate Header Logo */ - $custom_logo_id = get_theme_mod( 'custom_logo' ); - - add_filter( 'intermediate_image_sizes_advanced', 'Astra_Customizer::logo_image_sizes', 10, 2 ); - self::generate_logo_by_width( $custom_logo_id ); - remove_filter( 'intermediate_image_sizes_advanced', 'Astra_Customizer::logo_image_sizes', 10 ); - - } else { - // Regenerate the logo without custom image sizes. - $custom_logo_id = get_theme_mod( 'custom_logo' ); - self::generate_logo_by_width( $custom_logo_id ); - } - - do_action( 'astra_customizer_save' ); - - } - - /** - * Add logo image sizes in filter. - * - * @since 1.0.0 - * @param array $sizes Sizes. - * @param array $metadata attachment data. - * - * @return array - */ - public static function logo_image_sizes( $sizes, $metadata ) { - - $logo_width = astra_get_option( 'ast-header-responsive-logo-width' ); - - if ( is_array( $sizes ) && '' != $logo_width['desktop'] ) { - $max_value = max( $logo_width ); - $sizes['ast-logo-size'] = array( - 'width' => (int) $max_value, - 'height' => 0, - 'crop' => false, - ); - } - - return $sizes; - } - - /** - * Generate logo image by its width. - * - * @since 1.0.0 - * @param int $custom_logo_id Logo id. - */ - public static function generate_logo_by_width( $custom_logo_id ) { - if ( $custom_logo_id ) { - - $image = get_post( $custom_logo_id ); - - if ( $image ) { - $fullsizepath = get_attached_file( $image->ID ); - - if ( false !== $fullsizepath || file_exists( $fullsizepath ) ) { - - if ( ! function_exists( 'wp_generate_attachment_metadata' ) ) { - require_once ABSPATH . 'wp-admin/includes/image.php';// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound - } - - $metadata = wp_generate_attachment_metadata( $image->ID, $fullsizepath ); - - if ( ! is_wp_error( $metadata ) && ! empty( $metadata ) ) { - wp_update_attachment_metadata( $image->ID, $metadata ); - } - } - } - } - } - - /** - * Customizer Preview icon CSS - * - * @since 1.0.0 - * @return void - */ - public function preview_styles() { - if ( is_customize_preview() ) { - echo ''; - echo ''; - } - } - } -} - -/** - * Kicking this off by calling 'get_instance()' method - */ -Astra_Customizer::get_instance(); +' ) && is_customize_preview() ) { + add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' ); + } + + add_action( 'customize_controls_enqueue_scripts', array( $this, 'controls_scripts' ) ); + add_filter( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_customizer_scripts' ), 999 ); + + add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_footer_scripts' ) ); + + add_action( 'customize_register', array( $this, 'customize_register_panel' ), 2 ); + add_action( 'customize_register', array( $this, 'customize_register' ) ); + add_action( 'customize_save_after', array( $this, 'customize_save' ) ); + add_action( 'customize_save_after', array( $this, 'delete_cached_partials' ) ); + add_action( 'wp_head', array( $this, 'preview_styles' ) ); + add_action( 'wp_ajax_astra_regenerate_fonts_folder', array( $this, 'regenerate_astra_fonts_folder' ) ); + } + + /** + * Reset font folder + * + * @access public + * @return void + * + * @since 3.6.0 + */ + public function regenerate_astra_fonts_folder() { + + check_ajax_referer( 'astra-regenerate-local-fonts', 'nonce' ); + + if ( ! current_user_can( 'edit_theme_options' ) ) { + wp_send_json_error( 'invalid_permissions' ); + } + + if ( astra_get_option( 'load-google-fonts-locally' ) ) { + $local_font_loader = astra_webfont_loader_instance( '' ); + $flushed = $local_font_loader->astra_delete_fonts_folder(); + + if ( ! $flushed ) { + wp_send_json_error( 'failed_to_flush' ); + } + wp_send_json_success(); + } + + wp_send_json_error( 'no_font_loader' ); + } + + /** + * Delete the cached partial configs. + */ + public function delete_cached_partials() { + delete_option( 'astra_partials_config_cache' ); + + // Delete previously stored local fonts data, if exists. + if ( astra_get_option( 'load-google-fonts-locally' ) ) { + $local_webfont_loader = astra_webfont_loader_instance( '' ); + $local_webfont_loader->astra_delete_fonts_folder(); + } + } + + /** + * Add dynamic control partial refresh. + * + * @since 3.1.0 + * @param array $partial_args partial configs. + * @param string $partial_id partial id. + * @return array|mixed + */ + public function filter_dynamic_partial_args( $partial_args, $partial_id ) { + + if ( isset( self::$dynamic_options['partials'][ $partial_id ] ) ) { + if ( false === $partial_args ) { + $partial_args = array(); + } + $partial_args = array_merge( $partial_args, self::$dynamic_options['partials'][ $partial_id ] ); + } + + return $partial_args; + + } + + + /** + * Add dynamic control settings. + * + * @since 3.1.0 + * @param array $setting_args setting configs. + * @param string $setting_id setting id. + * @return mixed + */ + public function filter_dynamic_setting_args( $setting_args, $setting_id ) { + + if ( isset( self::$dynamic_options['settings'][ $setting_id ] ) ) { + return self::$dynamic_options['settings'][ $setting_id ]; + } + + return $setting_args; + } + + /** + * Prepare Contexts and choices. + * + * @since 3.0.0 + */ + public function prepare_customizer_javascript_configs() { + + global $wp_customize; + + $cached_data = get_option( 'astra_partials_config_cache', false ); + + if ( $wp_customize->selective_refresh->is_render_partials_request() && $cached_data ) { + self::$dynamic_options = $cached_data; + return; + } + + $configurations = $this->get_customizer_configurations(); + + $defaults = $this->get_astra_customizer_configuration_defaults(); + + foreach ( $configurations as $key => $configuration ) { + + $config = wp_parse_args( $configuration, $defaults ); + + if ( isset( $configuration['context'] ) ) { + self::$contexts[ $configuration['name'] ] = $configuration['context']; + } else { + if ( isset( $configuration['type'] ) && ( ( 'control' === $configuration['type'] ) || ( 'sub-control' === $configuration['type'] ) ) ) { + if ( ( isset( $configuration['control'] ) && 'ast-builder-header-control' !== $configuration['control'] ) && ( isset( $configuration['name'] ) && strpos( $configuration['name'], 'ast-callback-notice' ) === false ) ) { + self::$contexts[ $configuration['name'] ] = Astra_Builder_Helper::$general_tab; + } + } + } + + if ( isset( $configuration['choices'] ) ) { + self::$choices[ $configuration['name'] ] = $configuration['choices']; + } + + switch ( $config['type'] ) { + + case 'panel': + $this->prepare_javascript_panel_configs( $config ); + break; + case 'section': + $this->prepare_javascript_section_configs( $config ); + break; + + case 'sub-control': + $this->prepare_javascript_sub_control_configs( $config ); + break; + case 'control': + $this->prepare_javascript_control_configs( $config ); + break; + } + } + + update_option( 'astra_partials_config_cache', self::$dynamic_options, false ); + + } + + /** + * Get control default. + * + * @param string $setting_key setting key. + * @param array $default_values default value array. + * @return mixed|string + */ + private function get_default_value( $setting_key, $default_values ) { + $return = ''; + preg_match( '#astra-settings\[(.*?)\]#', $setting_key, $match ); + if ( ! empty( $match ) && isset( $match[1] ) ) { + $return = isset( $default_values[ $match[1] ] ) ? $default_values[ $match[1] ] : ''; + } + return $return; + } + + /** + * Prepare tabbed sections for dynamic controls to optimize frontend JS calls. + */ + private static function prepare_tabbed_sections() { + + if ( ! isset( self::$js_configs['controls'] ) ) { + return; + } + + foreach ( self::$js_configs['controls'] as $section_id => $controls ) { + $tab_id = $section_id . '-ast-context-tabs'; + $control_names = wp_list_pluck( $controls, 'name' ); + if ( in_array( $tab_id, $control_names, true ) ) { + array_push( self::$tabbed_sections, $section_id ); + } + } + + } + + /** + * Print Footer Scripts + * + * @since 1.0.0 + * @return void + */ + public function print_footer_scripts() { + $output = ''; + + echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + } + + /** + * Set default context for WP default controls. + */ + private static function set_default_context() { + + if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) { + return; + } + + self::$contexts['blogname'] = array( + Astra_Builder_Helper::$general_tab_config, + + ); + + self::$contexts['blogdescription'] = array( + Astra_Builder_Helper::$general_tab_config, + + ); + + } + + /** + * Bypass JS configs for Controls. + * + * @param array $configuration configuration. + */ + public static function bypass_control_configs( $configuration ) { + + $val = ''; + + if ( isset( $configuration['name'] ) ) { + + $data = explode( '[', rtrim( $configuration['name'], ']' ) ); + + if ( isset( $data[1] ) ) { + $val = astra_get_option( $data[1] ); + } + } + + if ( isset( $val ) && ! empty( $val ) ) { + + $configuration['value'] = $val; + } + + switch ( $configuration['type'] ) { + + case 'ast-builder': + if ( is_array( $configuration['default'] ) && ! isset( $configuration['default']['popup'] ) ) { + $configuration['default']['popup'] = array( 'popup_content' => array() ); + } + break; + case 'ast-responsive-spacing': + if ( ! is_array( $val ) || is_numeric( $val ) ) { + + $configuration['value'] = array( + 'desktop' => array( + 'top' => $val, + 'right' => '', + 'bottom' => $val, + 'left' => '', + ), + 'tablet' => array( + 'top' => $val, + 'right' => '', + 'bottom' => $val, + 'left' => '', + ), + 'mobile' => array( + 'top' => $val, + 'right' => '', + 'bottom' => $val, + 'left' => '', + ), + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ); + } + + break; + case 'ast-radio-image': + $configuration['value'] = $val; + + if ( isset( $configuration['choices'] ) && is_array( $configuration['choices'] ) ) { + + foreach ( $configuration['choices'] as $key => $value ) { + $configuration['choices'][ $key ] = $value['path']; + $configuration['choices_titles'][ $key ] = $value['label']; + } + } + if ( isset( $configuration['input_attrs'] ) ) { + + $configuration['inputAttrs'] = ''; + $configuration['labelStyle'] = ''; + foreach ( $configuration['input_attrs'] as $attr => $value ) { + if ( 'style' !== $attr ) { + $configuration['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; + } else { + $configuration['labelStyle'] = 'style="' . esc_attr( $value ) . '" '; + } + } + } + break; + case 'ast-border': + $configuration['value'] = $val; + + break; + case 'ast-responsive-slider': + if ( ! is_array( $val ) || is_numeric( $val ) ) { + + $configuration['value'] = array( + 'desktop' => $val, + 'tablet' => '', + 'mobile' => '', + ); + } + break; + case 'ast-responsive-background': + $configuration['value'] = $val; + + break; + case 'ast-responsive': + if ( ! is_array( $val ) || is_numeric( $val ) ) { + + $configuration['value'] = array( + 'desktop' => $val, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => '', + 'tablet-unit' => '', + 'mobile-unit' => '', + ); + } + break; + case 'ast-link': + $configuration['value'] = $val; + + break; + case 'ast-hidden': + $configuration['value'] = $val; + + break; + case 'ast-settings-group': + $config = array(); + + if ( isset( self::$group_configs[ $configuration['name'] ]['tabs'] ) ) { + $tab = array_keys( self::$group_configs[ $configuration['name'] ]['tabs'] ); + rsort( $tab ); + foreach ( $tab as $key => $value ) { + + $config['tabs'][ $value ] = wp_list_sort( self::$group_configs[ $configuration['name'] ]['tabs'][ $value ], 'priority' ); + } + } else { + if ( isset( self::$group_configs[ $configuration['name'] ] ) ) { + $config = wp_list_sort( self::$group_configs[ $configuration['name'] ], 'priority' ); + } + } + $configuration['ast_fields'] = $config; + break; + case 'ast-font-weight': + $configuration['ast_all_font_weight'] = array( + '100' => __( 'Thin 100', 'astra' ), + '100italic' => __( '100 Italic', 'astra' ), + '200' => __( 'Extra-Light 200', 'astra' ), + '200italic' => __( '200 Italic', 'astra' ), + '300' => __( 'Light 300', 'astra' ), + '300italic' => __( '300 Italic', 'astra' ), + '400' => __( 'Normal 400', 'astra' ), + 'italic' => __( '400 Italic', 'astra' ), + '500' => __( 'Medium 500', 'astra' ), + '500italic' => __( '500 Italic', 'astra' ), + '600' => __( 'Semi-Bold 600', 'astra' ), + '600italic' => __( '600 Italic', 'astra' ), + '700' => __( 'Bold 700', 'astra' ), + '700italic' => __( '700 Italic', 'astra' ), + '800' => __( 'Extra-Bold 800', 'astra' ), + '800italic' => __( '800 Italic', 'astra' ), + '900' => __( 'Ultra-Bold 900', 'astra' ), + '900italic' => __( '900 Italic', 'astra' ), + ); + break; + case 'ast-sortable': + $configuration['value'] = $val; + + break; + + } // Switch End. + + if ( isset( $configuration['id'] ) ) { + + $configuration['link'] = self::get_control_link( $configuration['id'] ); + } + $exclude_controls = array( 'ast-builder', 'ast-radio-image' ); + + if ( isset( $configuration['type'] ) && ! in_array( $configuration['type'], $exclude_controls ) && isset( $configuration['input_attrs'] ) && is_array( $configuration['input_attrs'] ) ) { + + $configuration['inputAttrs'] = ''; + + foreach ( $configuration['input_attrs'] as $attr => $value ) { + + if ( ! is_array( $value ) ) { + + $configuration['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; + } + } + } + + return $configuration; + } + + /** + * Prepare Panel Configs for Javascript. + * + * @since 3.0.0 + * @param array $config configs. + */ + public function prepare_javascript_panel_configs( $config ) { + + $panel_name = astra_get_prop( $config, 'name' ); + + unset( $config['type'] ); + $config['type'] = 'ast_panel'; + $config['active'] = true; + $config['id'] = $panel_name; + self::$js_configs['panels'][ $panel_name ] = $config; + } + + /** + * Prepare Section Configs for Javascript. + * + * @since 3.0.0 + * @param array $config configs. + */ + public function prepare_javascript_section_configs( $config ) { + + $section_name = astra_get_prop( $config, 'name' ); + + + + unset( $config['type'] ); + $config['type'] = isset( $config['ast_type'] ) ? $config['ast_type'] : 'ast_section'; + $config['active'] = true; + $config['id'] = $section_name; + $config['customizeAction'] = sprintf( 'Customizing â–¸ %s', astra_get_prop( $config, 'title' ) ); + + if ( isset( $config['clone_type'] ) && isset( $config['clone_index'] ) ) { + + if ( isset( Astra_Builder_Helper::$component_count_array[ $config['clone_type'] ] ) ) { + if ( in_array( $section_name, Astra_Builder_Helper::$component_count_array['removed-items'], true ) || Astra_Builder_Helper::$component_count_array[ $config['clone_type'] ] < $config['clone_index'] ) { + self::$js_configs['clone_sections'][ $section_name ] = $config; + } else { + self::$js_configs['sections'][ $section_name ] = $config; + } + } + } else { + self::$js_configs['sections'][ $section_name ] = $config; + } + + + } + + /** + * Prepare Sub Control Configs for Javascript. + * + * @since 3.0.0 + * @param array $config configs. + */ + public function prepare_javascript_sub_control_configs( $config ) { + + global $wp_customize; + unset( $config['type'] ); + + $sub_control_name = ASTRA_THEME_SETTINGS . '[' . astra_get_prop( $config, 'name' ) . ']'; + $parent = astra_get_prop( $config, 'parent' ); + + $ignore_controls = array( 'ast-settings-group', 'ast-sortable', 'ast-radio-image', 'ast-slider', 'ast-responsive-slider' ); + + $sanitize_callback = ( in_array( $config['control'], $ignore_controls, true ) ) ? false : astra_get_prop( $config, 'sanitize_callback', Astra_Customizer_Control_Base::get_sanitize_call( astra_get_prop( $config, 'control' ) ) ); + + if ( ! $sanitize_callback ) { + $config = $this->sanitize_control( $config ); + } + + $new_config = array( + 'name' => $sub_control_name, + 'datastore_type' => 'option', + 'transport' => 'postMessage', + 'control' => 'ast-hidden', + 'section' => astra_get_prop( $config, 'section', 'title_tagline' ), + 'title' => astra_get_prop( $config, 'title' ), + 'priority' => astra_get_prop( $config, 'priority', '10' ), + 'default' => astra_get_prop( $config, 'default' ), + 'sanitize_callback' => $sanitize_callback, + 'suffix' => astra_get_prop( $config, 'suffix' ), + 'control_type' => astra_get_prop( $config, 'control' ), + ); + + + self::$dynamic_options['settings'][ astra_get_prop( $new_config, 'name' ) ] = array( + 'default' => astra_get_prop( $new_config, 'default' ), + 'type' => astra_get_prop( $new_config, 'datastore_type' ), + 'transport' => astra_get_prop( $new_config, 'transport', 'refresh' ), + 'sanitize_callback' => astra_get_prop( $new_config, 'sanitize_callback', Astra_Customizer_Control_Base::get_sanitize_call( astra_get_prop( $new_config, 'control' ) ) ), + ); + + $new_config['type'] = astra_get_prop( $new_config, 'control' ); + $new_config['id'] = astra_get_prop( $new_config, 'name' ); + $new_config['settings'] = array( 'default' => astra_get_prop( $new_config, 'name' ) ); + $new_config = self::bypass_control_configs( $new_config ); + self::$js_configs ['sub_controls'] [ $parent ] [] = $new_config; + } + + /** + * Get the Link for Control. + * + * @since 3.0.0 + * @param array $id Control ID. + */ + public static function get_control_link( $id ) { + if ( isset( $id ) ) { + return 'data-customize-setting-link="' . $id . '"'; + } else { + return 'data-customize-setting-key-link="default"'; + } + } + + /** + * Prepare Control Configs for Javascript. + * + * @since 3.0.0 + * @param array $config configs. + */ + public function prepare_javascript_control_configs( $config ) { + + global $wp_customize; + // Remove type from configuration. + unset( $config['type'] ); + + $ignore_controls = array( 'ast-settings-group', 'ast-sortable', 'ast-radio-image', 'ast-slider', 'ast-responsive-slider' ); + + if ( ! isset( $config['control'] ) ) { + return; + } + + $sanitize_callback = ( in_array( $config['control'], $ignore_controls, true ) ) ? false : astra_get_prop( $config, 'sanitize_callback', Astra_Customizer_Control_Base::get_sanitize_call( astra_get_prop( $config, 'control' ) ) ); + + + if ( ! $sanitize_callback ) { + $config = $this->sanitize_control( $config ); + } + + $config['label'] = astra_get_prop( $config, 'title' ); + $config['type'] = astra_get_prop( $config, 'control' ); + + if ( false !== astra_get_prop( $config, 'font-type', false ) ) { + $config['type'] = astra_get_prop( $config, 'font-type', false ); + } + + if ( 'image' === $config['type'] ) { + $this->prepare_preload_controls( $config ); + } + + if ( isset( $config['active_callback'] ) ) { + + self::$js_configs ['skip_context'] [] = astra_get_prop( $config, 'name' ); + $this->prepare_preload_controls( $config ); + return; + } + + self::$dynamic_options['settings'][ astra_get_prop( $config, 'name' ) ] = array( + 'default' => astra_get_prop( $config, 'default' ), + 'type' => astra_get_prop( $config, 'datastore_type' ), + 'transport' => astra_get_prop( $config, 'transport', 'refresh' ), + 'sanitize_callback' => $sanitize_callback, + ); + + if ( astra_get_prop( $config, 'partial', false ) ) { + self::$dynamic_options['partials'][ astra_get_prop( $config, 'name' ) ] = array( + 'selector' => astra_get_prop( $config['partial'], 'selector' ), + 'render_callback' => astra_get_prop( $config['partial'], 'render_callback' ), + 'containerInclusive' => astra_get_prop( $config['partial'], 'container_inclusive' ), + 'fallbackRefresh' => astra_get_prop( $config['partial'], 'fallback_refresh', true ), + ); + } + + $config['id'] = astra_get_prop( $config, 'name' ); + $config['settings'] = array( 'default' => astra_get_prop( $config, 'name' ) ); + $config = self::bypass_control_configs( $config ); + + if ( isset( $config['section'] ) ) { + self::$js_configs ['controls'] [ $config['section'] ] [] = $config; + } + } + + /** + * Map and add sanitize callback to JS configs. + * + * @param array $config js config array. + * @return mixed + */ + public function sanitize_control( $config ) { + + $control_type = isset( $config['control'] ) ? $config['control'] : ''; + switch ( $control_type ) { + case 'color': + $config['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_hex_color' ); + break; + case 'ast-border': + $config['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_border' ); + break; + case 'ast-html-editor': + $config['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_html' ); + break; + case 'ast-color': + $config['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ); + break; + case 'ast-sortable': + $config ['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ); + break; + case 'ast-radio-image': + $config ['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ); + break; + case 'ast-link': + $config ['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_link' ); + break; + case 'ast-customizer-link': + $config ['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_customizer_links' ); + break; + case 'ast-responsive-slider': + $config ['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ); + break; + case 'ast-toggle-control': + $config ['sanitize_callback'] = array( 'Astra_Customizer_Sanitizes', 'sanitize_toggle_control' ); + break; + default: + break; + } + + return $config; + + } + + /** + * Add controls for which active_callback is added. + * + * @since 3.0.0 + * @param array $config config. + */ + public function prepare_preload_controls( $config ) { + + global $wp_customize; + + $instance = Astra_Customizer_Control_Base::get_control_instance( astra_get_prop( $config, 'control' ) ); + + // Forwarding to the DOM as default control. + if ( 'title_tagline' !== $config['section'] ) { + self::$js_configs ['wp_defaults'][ astra_get_prop( $config, 'name' ) ] = $config['section']; + $config['section'] = 'title_tagline'; + } + + $wp_customize->add_setting( + astra_get_prop( $config, 'name' ), + array( + 'default' => astra_get_prop( $config, 'default' ), + 'type' => astra_get_prop( $config, 'datastore_type' ), + 'transport' => astra_get_prop( $config, 'transport', 'refresh' ), + 'sanitize_callback' => astra_get_prop( $config, 'sanitize_callback', Astra_Customizer_Control_Base::get_sanitize_call( astra_get_prop( $config, 'control' ) ) ), + ) + ); + + if ( false !== $instance ) { + $wp_customize->add_control( + new $instance( $wp_customize, astra_get_prop( $config, 'name' ), $config ) + ); + } else { + $wp_customize->add_control( astra_get_prop( $config, 'name' ), $config ); + } + } + + /** + * Prepare Group configs to visible sub-controls. + * + * @since 3.0.0 + * @param object $wp_customize customizer object. + */ + public function prepare_group_configs( $wp_customize ) { + + if ( $wp_customize->selective_refresh->is_render_partials_request() ) { + return; + } + + $configurations = $this->get_customizer_configurations(); + $defaults = $this->get_astra_customizer_configuration_defaults(); + + foreach ( $configurations as $key => $configuration ) { + $config = wp_parse_args( $configuration, $defaults ); + if ( 'sub-control' === $config['type'] ) { + unset( $config['type'] ); + $parent = astra_get_prop( $config, 'parent' ); + $tab = astra_get_prop( $config, 'tab' ); + + if ( empty( self::$group_configs[ $parent ] ) ) { + self::$group_configs[ $parent ] = array(); + } + + if ( array_key_exists( 'tab', $config ) ) { + self::$group_configs[ $parent ]['tabs'][ $tab ][] = $config; + } else { + self::$group_configs[ $parent ][] = $config; + } + } + } + } + + /** + * Prepare context. + * + * @return mixed|void + */ + public static function get_contexts() { + + self::set_default_context(); + // Return contexts. + return apply_filters( 'astra_customizer_context', self::$contexts ); + } + + /** + * Prepare choices. + * + * @return mixed|void + */ + public static function get_choices() { + // Return contexts. + return apply_filters( 'astra_customizer_choices', self::$choices ); + } + + /** + * Prepare javascript configs. + * + * @return mixed|void + */ + public static function get_js_configs() { + + // Return contexts. + return apply_filters( 'astra_javascript_configurations', self::$js_configs ); + } + + /** + * Prepare tabbed sections. + * + * @return mixed|void + */ + public static function get_tabbed_sections() { + + self::prepare_tabbed_sections(); + // Return contexts. + return apply_filters( 'astra_customizer_tabbed_sections', self::$tabbed_sections ); + } + + /** + * Prepare default values for the control. + * + * @return array + */ + private function get_control_defaults() { + + $defaults = array(); + $default_values = Astra_Theme_Options::defaults(); + $default_controls = array_merge( self::$js_configs['controls'], self::$js_configs['sub_controls'] ); + + foreach ( $default_controls as $section_controls ) { + foreach ( $section_controls as $control ) { + $control_id = astra_get_prop( $control, 'name' ); + if ( 'ast-responsive-spacing' === $control['control'] ) { + $defaults[ $control_id ] = array( + 'desktop' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + 'tablet' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + 'mobile' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ); + } else { + $defaults[ $control_id ] = $this->get_default_value( $control_id, $default_values ); + } + } + } + + return $defaults; + + } + + /** + * Add customizer script. + * + * @since 3.0.0 + */ + public function enqueue_customizer_scripts() { + + // Localize variables for Dev mode > Customizer JS. + wp_localize_script( + SCRIPT_DEBUG ? 'astra-custom-control-react-script' : 'astra-custom-control-script', + 'AstraBuilderCustomizerData', + array( + 'contexts' => self::get_contexts(), + 'dynamic_setting_options' => self::$dynamic_options['settings'], + 'choices' => self::get_choices(), + 'js_configs' => self::get_js_configs(), + 'tabbed_sections' => self::get_tabbed_sections(), + 'component_limit' => Astra_Builder_Helper::$component_limit, + 'is_site_rtl' => is_rtl(), + 'defaults' => $this->get_control_defaults(), + 'astraRegenerateFonts' => wp_create_nonce( 'astra-regenerate-local-fonts' ), + 'initialFlushText' => __( 'Flush Local Font Files', 'astra' ), + 'successFlushed' => __( 'Successfully Flushed', 'astra' ), + 'failedFlushed' => __( 'Failed, Please try again later.', 'astra' ), + ) + ); + + if ( is_rtl() ) { + $builder_customizer_css_file = 'ast-builder-customizer-rtl'; + } else { + $builder_customizer_css_file = 'ast-builder-customizer'; + } + + // Enqueue Builder CSS. + wp_enqueue_style( + 'ahfb-customizer-style', + ASTRA_THEME_URI . 'inc/assets/css/' . $builder_customizer_css_file . '.css', + array( 'wp-components' ), + ASTRA_THEME_VERSION + ); + } + + /** + * Check if string is start with a string provided. + * + * @param string $string main string. + * @param string $start_string string to search. + * @since 2.0.0 + * @return bool. + */ + public function starts_with( $string, $start_string ) { + $len = strlen( $start_string ); + return ( substr( $string, 0, $len ) === $start_string ); + } + + /** + * Filter and return Customizer Configurations. + * + * @since 1.4.3 + * @return Array Customizer Configurations for registering Sections/Panels/Controls. + */ + private function get_customizer_configurations() { + + global $wp_customize; + + if ( ! is_null( self::$configuration ) ) { + return self::$configuration; + } + + self::$configuration = apply_filters( 'astra_customizer_configurations', array(), $wp_customize ); + return self::$configuration; + } + + /** + * Return default values for the Customize Configurations. + * + * @since 1.4.3 + * @return Array default values for the Customizer Configurations. + */ + private function get_astra_customizer_configuration_defaults() { + return apply_filters( + 'astra_customizer_configuration_defaults', + array( + 'priority' => null, + 'title' => null, + 'label' => null, + 'name' => null, + 'type' => null, + 'description' => null, + 'capability' => null, + 'datastore_type' => 'option', // theme_mod or option. Default option. + 'settings' => null, + 'active_callback' => null, + 'sanitize_callback' => null, + 'sanitize_js_callback' => null, + 'theme_supports' => null, + 'transport' => null, + 'default' => null, + 'selector' => null, + 'ast_fields' => array(), + ) + ); + } + + /** + * Include Customizer Configuration files. + * + * @since 1.4.3 + * @return void + */ + public function include_configurations() { + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require ASTRA_THEME_DIR . 'inc/customizer/configurations/class-astra-customizer-config-base.php'; + + /** + * Register Sections & Panels + */ + require ASTRA_THEME_DIR . 'inc/customizer/class-astra-customizer-register-sections-panels.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/buttons/class-astra-customizer-button-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-site-layout-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-site-identity-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-blog-layout-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-blog-single-layout-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-sidebar-layout-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-site-container-layout-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/colors-background/class-astra-body-colors-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/typography/class-astra-archive-typo-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/typography/class-astra-body-typo-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/typography/class-astra-content-typo-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/typography/class-astra-header-typo-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/typography/class-astra-single-typo-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/performance/class-astra-performance-configs.php'; + + if ( astra_existing_header_footer_configs() ) { + require ASTRA_THEME_DIR . 'inc/customizer/configurations/buttons/class-astra-existing-button-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-header-layout-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/layout/class-astra-footer-layout-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/colors-background/class-astra-advanced-footer-colors-configs.php'; + require ASTRA_THEME_DIR . 'inc/customizer/configurations/colors-background/class-astra-footer-colors-configs.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + + /** + * Register custom section and panel. + * + * @since 1.0.0 + * @param WP_Customize_Manager $wp_customize Theme Customizer object. + */ + public function customize_register_panel( $wp_customize ) { + + /** + * Register Extended Panel + */ + $wp_customize->register_panel_type( 'Astra_WP_Customize_Panel' ); + $wp_customize->register_section_type( 'Astra_WP_Customize_Section' ); + $wp_customize->register_section_type( 'Astra_WP_Customize_Separator' ); + + if ( ! defined( 'ASTRA_EXT_VER' ) ) { + $wp_customize->register_section_type( 'Astra_Pro_Customizer' ); + } + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require ASTRA_THEME_DIR . 'inc/customizer/extend-customizer/class-astra-wp-customize-panel.php'; + require ASTRA_THEME_DIR . 'inc/customizer/extend-customizer/class-astra-wp-customize-section.php'; + require ASTRA_THEME_DIR . 'inc/customizer/extend-customizer/class-astra-wp-customize-separator.php'; + require ASTRA_THEME_DIR . 'inc/customizer/customizer-controls.php'; + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + + /** + * Add Controls + */ + + Astra_Customizer_Control_Base::add_control( + 'image', + array( + 'callback' => 'WP_Customize_Image_Control', + 'sanitize_callback' => 'esc_url_raw', + ) + ); + + Astra_Customizer_Control_Base::add_control( + 'ast-font', + array( + 'callback' => 'Astra_Control_Typography', + 'sanitize_callback' => 'sanitize_text_field', + ) + ); + + Astra_Customizer_Control_Base::add_control( + 'ast-font-variant', + array( + 'callback' => 'Astra_Control_Font_Variant', + 'sanitize_callback' => 'sanitize_text_field', + ) + ); + + Astra_Customizer_Control_Base::add_control( + 'ast-description', + array( + 'callback' => 'Astra_Control_Description', + 'sanitize_callback' => '', + ) + ); + + Astra_Customizer_Control_Base::add_control( + 'ast-customizer-link', + array( + 'callback' => 'Astra_Control_Customizer_Link', + 'santize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_customizer_links' ), + ) + ); + + /** + * Helper files + */ + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require ASTRA_THEME_DIR . 'inc/customizer/class-astra-customizer-partials.php'; + require ASTRA_THEME_DIR . 'inc/customizer/class-astra-customizer-callback.php'; + require ASTRA_THEME_DIR . 'inc/customizer/class-astra-customizer-sanitizes.php'; + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + + /** + * Add postMessage support for site title and description for the Theme Customizer. + * + * @since 1.0.0 + * @param WP_Customize_Manager $wp_customize Theme Customizer object. + */ + public function customize_register( $wp_customize ) { + + /** + * Override Defaults + */ + require ASTRA_THEME_DIR . 'inc/customizer/override-defaults.php';// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + + /** + * Add upgrade link configurations controls. + * + * @since 1.0.0 + * @param WP_Customize_Manager $wp_customize Theme Customizer object. + */ + public function astra_pro_upgrade_configurations( $wp_customize ) { + + if ( ! defined( 'ASTRA_EXT_VER' ) ) { + require ASTRA_THEME_DIR . 'inc/customizer/astra-pro/class-astra-pro-customizer.php';// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require ASTRA_THEME_DIR . 'inc/customizer/astra-pro/class-astra-pro-upgrade-link-configs.php';// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + } + + /** + * Customizer Controls + * + * @since 1.0.0 + * @return void + */ + public function controls_scripts() { + + $js_prefix = '.min.js'; + $css_prefix = '.min.css'; + $dir = 'minified'; + if ( SCRIPT_DEBUG ) { + $js_prefix = '.js'; + $css_prefix = '.css'; + $dir = 'unminified'; + } + + if ( is_rtl() ) { + $css_prefix = '.min-rtl.css'; + if ( SCRIPT_DEBUG ) { + $css_prefix = '-rtl.css'; + } + } + + wp_enqueue_style( 'wp-components' ); + wp_enqueue_script( 'thickbox' ); + wp_enqueue_style( 'thickbox' ); + + // Customizer Core. + wp_enqueue_script( 'astra-customizer-controls-toggle-js', ASTRA_THEME_URI . 'assets/js/' . $dir . '/customizer-controls-toggle' . $js_prefix, array(), ASTRA_THEME_VERSION, true ); + + // Extended Customizer Assets - Panel extended. + wp_enqueue_style( 'astra-extend-customizer-css', ASTRA_THEME_URI . 'assets/css/' . $dir . '/extend-customizer' . $css_prefix, null, ASTRA_THEME_VERSION ); + wp_enqueue_script( 'astra-extend-customizer-js', ASTRA_THEME_URI . 'assets/js/' . $dir . '/extend-customizer' . $js_prefix, array(), ASTRA_THEME_VERSION, true ); + + // Customizer Controls. + wp_enqueue_style( 'astra-customizer-controls-css', ASTRA_THEME_URI . 'assets/css/' . $dir . '/customizer-controls' . $css_prefix, null, ASTRA_THEME_VERSION ); + + $string = $this->generate_font_dropdown(); + + $template = '
    +
      +
    +
    '; + + wp_localize_script( + 'astra-customizer-controls-toggle-js', + 'astra', + apply_filters( + 'astra_theme_customizer_js_localize', + array( + 'customizer' => array( + 'settings' => array( + 'sidebars' => array( + 'single' => array( + 'single-post-sidebar-layout', + 'single-page-sidebar-layout', + ), + 'archive' => array( + 'archive-post-sidebar-layout', + ), + ), + 'container' => array( + 'single' => array( + 'single-post-content-layout', + 'single-page-content-layout', + ), + 'archive' => array( + 'archive-post-content-layout', + ), + ), + 'google_fonts' => $string, + ), + 'group_modal_tmpl' => $template, + 'is_pro' => defined( 'ASTRA_EXT_VER' ), + 'upgrade_link' => htmlspecialchars_decode( astra_get_pro_url( 'https://wpastra.com/pricing/', 'customizer', 'upgrade-link', 'upgrade-to-pro' ) ), + 'is_block_widget' => astra_has_widgets_block_editor(), + ), + 'theme' => array( + 'option' => ASTRA_THEME_SETTINGS, + ), + ) + ) + ); + } + + /** + * Generates HTML for font dropdown. + * + * @return string + */ + public function generate_font_dropdown() { + + ob_start(); + + ?> + + + + + $variants ) { + ?> + + + + + + $single_font ) { + $variants = astra_get_prop( $single_font, '0' ); + $category = astra_get_prop( $single_font, '1' ); + + ?> + + + astra_header_break_point(), + 'includeAnchorsInHeadindsCss' => Astra_Dynamic_CSS::anchors_in_css_selectors_heading(), + 'googleFonts' => Astra_Font_Families::get_google_fonts(), + 'page_builder_button_style_css' => Astra_Dynamic_CSS::page_builder_button_style_css(), + 'elementor_default_color_font_setting' => Astra_Dynamic_CSS::elementor_default_color_font_setting(), + 'dynamic_partial_options' => self::$dynamic_options['partials'], + 'gb_outline_buttons_patterns_support' => Astra_Dynamic_CSS::gutenberg_core_patterns_compat(), + 'font_weights_widget_title_support' => Astra_Dynamic_CSS::support_font_css_to_widget_and_in_editor(), + 'has_block_editor_support' => Astra_Dynamic_CSS::is_block_editor_support_enabled(), + 'updated_gb_outline_button_patterns' => astra_button_default_padding_updated(), + ); + + wp_localize_script( 'astra-customizer-preview-js', 'astraCustomizer', $localize_array ); + } + + /** + * Called by the customize_save_after action to refresh + * the cached CSS when Customizer settings are saved. + * + * @since 1.0.0 + * @return void + */ + public function customize_save() { + + // Update variables. + Astra_Theme_Options::refresh(); + + if ( apply_filters( 'astra_resize_logo', true ) ) { + + /* Generate Header Logo */ + $custom_logo_id = get_theme_mod( 'custom_logo' ); + + add_filter( 'intermediate_image_sizes_advanced', 'Astra_Customizer::logo_image_sizes', 10, 2 ); + self::generate_logo_by_width( $custom_logo_id ); + remove_filter( 'intermediate_image_sizes_advanced', 'Astra_Customizer::logo_image_sizes', 10 ); + + } else { + // Regenerate the logo without custom image sizes. + $custom_logo_id = get_theme_mod( 'custom_logo' ); + self::generate_logo_by_width( $custom_logo_id ); + } + + do_action( 'astra_customizer_save' ); + + } + + /** + * Add logo image sizes in filter. + * + * @since 1.0.0 + * @param array $sizes Sizes. + * @param array $metadata attachment data. + * + * @return array + */ + public static function logo_image_sizes( $sizes, $metadata ) { + + $logo_width = astra_get_option( 'ast-header-responsive-logo-width' ); + + if ( is_array( $sizes ) && '' != $logo_width['desktop'] ) { + $max_value = max( $logo_width ); + $sizes['ast-logo-size'] = array( + 'width' => (int) $max_value, + 'height' => 0, + 'crop' => false, + ); + } + + return $sizes; + } + + /** + * Generate logo image by its width. + * + * @since 1.0.0 + * @param int $custom_logo_id Logo id. + */ + public static function generate_logo_by_width( $custom_logo_id ) { + if ( $custom_logo_id ) { + + $image = get_post( $custom_logo_id ); + + if ( $image ) { + $fullsizepath = get_attached_file( $image->ID ); + + if ( false !== $fullsizepath || file_exists( $fullsizepath ) ) { + + if ( ! function_exists( 'wp_generate_attachment_metadata' ) ) { + require_once ABSPATH . 'wp-admin/includes/image.php';// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + + $metadata = wp_generate_attachment_metadata( $image->ID, $fullsizepath ); + + if ( ! is_wp_error( $metadata ) && ! empty( $metadata ) ) { + wp_update_attachment_metadata( $image->ID, $metadata ); + } + } + } + } + } + + /** + * Customizer Preview icon CSS + * + * @since 1.0.0 + * @return void + */ + public function preview_styles() { + if ( is_customize_preview() ) { + echo ''; + echo ''; + } + } + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +Astra_Customizer::get_instance(); diff --git a/inc/customizer/class-astra-font-families.php b/inc/customizer/class-astra-font-families.php index 6da5e29..92b44ec 100644 --- a/inc/customizer/class-astra-font-families.php +++ b/inc/customizer/class-astra-font-families.php @@ -1,171 +1,171 @@ - array( - 'fallback' => 'Verdana, Arial, sans-serif', - 'weights' => array( - '300', - '400', - '700', - ), - ), - 'Verdana' => array( - 'fallback' => 'Helvetica, Arial, sans-serif', - 'weights' => array( - '300', - '400', - '700', - ), - ), - 'Arial' => array( - 'fallback' => 'Helvetica, Verdana, sans-serif', - 'weights' => array( - '300', - '400', - '700', - ), - ), - 'Times' => array( - 'fallback' => 'Georgia, serif', - 'weights' => array( - '300', - '400', - '700', - ), - ), - 'Georgia' => array( - 'fallback' => 'Times, serif', - 'weights' => array( - '300', - '400', - '700', - ), - ), - 'Courier' => array( - 'fallback' => 'monospace', - 'weights' => array( - '300', - '400', - '700', - ), - ), - ); - } - - return apply_filters( 'astra_system_fonts', self::$system_fonts ); - } - - /** - * Custom Fonts - * - * @since 1.0.19 - * - * @return Array All the custom fonts in Astra - */ - public static function get_custom_fonts() { - $custom_fonts = array(); - - return apply_filters( 'astra_custom_fonts', $custom_fonts ); - } - - /** - * Google Fonts used in astra. - * Array is generated from the google-fonts.json file. - * - * @since 1.0.19 - * - * @return Array Array of Google Fonts. - */ - public static function get_google_fonts() { - - if ( empty( self::$google_fonts ) ) { - - /** - * Deprecating the Filter to change the Google Fonts JSON file path. - * - * @since 2.5.0 - * @param string $json_file File where google fonts json format added. - * @return array - */ - $google_fonts_file = apply_filters( 'astra_google_fonts_php_file', ASTRA_THEME_DIR . 'inc/google-fonts.php' ); - - if ( ! file_exists( $google_fonts_file ) ) { - return array(); - } - - $google_fonts_arr = include $google_fonts_file;// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound - - foreach ( $google_fonts_arr as $key => $font ) { - $name = key( $font ); - foreach ( $font[ $name ] as $font_key => $single_font ) { - - if ( 'variants' === $font_key ) { - - foreach ( $single_font as $variant_key => $variant ) { - - if ( 'regular' == $variant ) { - $font[ $name ][ $font_key ][ $variant_key ] = '400'; - } - } - } - - self::$google_fonts[ $name ] = array_values( $font[ $name ] ); - } - } - } - - return apply_filters( 'astra_google_fonts', self::$google_fonts ); - } - - } - -endif; + array( + 'fallback' => 'Verdana, Arial, sans-serif', + 'weights' => array( + '300', + '400', + '700', + ), + ), + 'Verdana' => array( + 'fallback' => 'Helvetica, Arial, sans-serif', + 'weights' => array( + '300', + '400', + '700', + ), + ), + 'Arial' => array( + 'fallback' => 'Helvetica, Verdana, sans-serif', + 'weights' => array( + '300', + '400', + '700', + ), + ), + 'Times' => array( + 'fallback' => 'Georgia, serif', + 'weights' => array( + '300', + '400', + '700', + ), + ), + 'Georgia' => array( + 'fallback' => 'Times, serif', + 'weights' => array( + '300', + '400', + '700', + ), + ), + 'Courier' => array( + 'fallback' => 'monospace', + 'weights' => array( + '300', + '400', + '700', + ), + ), + ); + } + + return apply_filters( 'astra_system_fonts', self::$system_fonts ); + } + + /** + * Custom Fonts + * + * @since 1.0.19 + * + * @return Array All the custom fonts in Astra + */ + public static function get_custom_fonts() { + $custom_fonts = array(); + + return apply_filters( 'astra_custom_fonts', $custom_fonts ); + } + + /** + * Google Fonts used in astra. + * Array is generated from the google-fonts.json file. + * + * @since 1.0.19 + * + * @return Array Array of Google Fonts. + */ + public static function get_google_fonts() { + + if ( empty( self::$google_fonts ) ) { + + /** + * Deprecating the Filter to change the Google Fonts JSON file path. + * + * @since 2.5.0 + * @param string $json_file File where google fonts json format added. + * @return array + */ + $google_fonts_file = apply_filters( 'astra_google_fonts_php_file', ASTRA_THEME_DIR . 'inc/google-fonts.php' ); + + if ( ! file_exists( $google_fonts_file ) ) { + return array(); + } + + $google_fonts_arr = include $google_fonts_file;// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + + foreach ( $google_fonts_arr as $key => $font ) { + $name = key( $font ); + foreach ( $font[ $name ] as $font_key => $single_font ) { + + if ( 'variants' === $font_key ) { + + foreach ( $single_font as $variant_key => $variant ) { + + if ( 'regular' == $variant ) { + $font[ $name ][ $font_key ][ $variant_key ] = '400'; + } + } + } + + self::$google_fonts[ $name ] = array_values( $font[ $name ] ); + } + } + } + + return apply_filters( 'astra_google_fonts', self::$google_fonts ); + } + + } + +endif; diff --git a/inc/customizer/class-astra-fonts-data.php b/inc/customizer/class-astra-fonts-data.php index fc5f52c..bce8dd6 100644 --- a/inc/customizer/class-astra-fonts-data.php +++ b/inc/customizer/class-astra-fonts-data.php @@ -1,44 +1,44 @@ - (array) $variants, - ); - } - } - - /** - * Get Fonts - */ - public static function get_fonts() { - - do_action( 'astra_get_fonts' ); - return apply_filters( 'astra_add_fonts', self::$fonts ); - } - - /** - * Renders the tag for all fonts in the $fonts array. - * - * @since 1.0.16 Added the filter 'astra_render_fonts' to support custom fonts. - * @since 1.0.0 - * @return void - */ - public static function render_fonts() { - - $font_list = apply_filters( 'astra_render_fonts', self::get_fonts() ); - - $google_fonts = array(); - $font_subset = array(); - - $system_fonts = Astra_Font_Families::get_system_fonts(); - - foreach ( $font_list as $name => $font ) { - if ( ! empty( $name ) && ! isset( $system_fonts[ $name ] ) ) { - - // Add font variants. - $google_fonts[ $name ] = $font['variants']; - - // Add Subset. - $subset = apply_filters( 'astra_font_subset', '', $name ); - if ( ! empty( $subset ) ) { - $font_subset[] = $subset; - } - } - } - - $google_font_url = self::google_fonts_url( $google_fonts, $font_subset ); - - // Do not load Google font remote or local font asset if not any font selected. - if ( '' === $google_font_url ) { - return; - } - - /** - * Support self hosted Google Fonts. - * - * @since 3.6.0 - */ - if ( astra_get_option( 'load-google-fonts-locally' ) && ! is_customize_preview() && ! is_admin() ) { - if ( astra_get_option( 'preload-local-fonts' ) ) { - ast_load_preload_local_fonts( $google_font_url ); - } - wp_enqueue_style( 'astra-google-fonts', ast_get_webfont_url( $google_font_url ), array(), ASTRA_THEME_VERSION, 'all' ); - } else { - wp_enqueue_style( 'astra-google-fonts', $google_font_url, array(), ASTRA_THEME_VERSION, 'all' ); - } - } - - /** - * Google Font URL - * Combine multiple google font in one URL - * - * @link https://shellcreeper.com/?p=1476 - * @param array $fonts Google Fonts array. - * @param array $subsets Font's Subsets array. - * - * @return string - */ - public static function google_fonts_url( $fonts, $subsets = array() ) { - - /* URL */ - $base_url = 'https://fonts.googleapis.com/css'; - $font_args = array(); - $family = array(); - - // This is deprecated filter hook. - $fonts = apply_filters( 'astra_google_fonts', $fonts ); - - $fonts = apply_filters( 'astra_google_fonts_selected', $fonts ); - - /* Format Each Font Family in Array */ - foreach ( $fonts as $font_name => $font_weight ) { - $font_name = str_replace( ' ', '+', $font_name ); - if ( ! empty( $font_weight ) ) { - if ( is_array( $font_weight ) ) { - $font_weight = implode( ',', $font_weight ); - } - $font_family = explode( ',', $font_name ); - $font_family = str_replace( "'", '', astra_get_prop( $font_family, 0 ) ); - $family[] = trim( $font_family . ':' . rawurlencode( trim( $font_weight ) ) ); - } else { - $family[] = trim( $font_name ); - } - } - - /* Only return URL if font family defined. */ - if ( ! empty( $family ) ) { - - /* Make Font Family a String */ - $family = implode( '|', $family ); - - /* Add font family in args */ - $font_args['family'] = $family; - - /* Add font subsets in args */ - if ( ! empty( $subsets ) ) { - - /* format subsets to string */ - if ( is_array( $subsets ) ) { - $subsets = implode( ',', $subsets ); - } - - $font_args['subset'] = rawurlencode( trim( $subsets ) ); - } - - $font_args['display'] = astra_get_fonts_display_property(); - - return add_query_arg( $font_args, $base_url ); - } - - return ''; - } -} + (array) $variants, + ); + } + } + + /** + * Get Fonts + */ + public static function get_fonts() { + + do_action( 'astra_get_fonts' ); + return apply_filters( 'astra_add_fonts', self::$fonts ); + } + + /** + * Renders the tag for all fonts in the $fonts array. + * + * @since 1.0.16 Added the filter 'astra_render_fonts' to support custom fonts. + * @since 1.0.0 + * @return void + */ + public static function render_fonts() { + + $font_list = apply_filters( 'astra_render_fonts', self::get_fonts() ); + + $google_fonts = array(); + $font_subset = array(); + + $system_fonts = Astra_Font_Families::get_system_fonts(); + + foreach ( $font_list as $name => $font ) { + if ( ! empty( $name ) && ! isset( $system_fonts[ $name ] ) ) { + + // Add font variants. + $google_fonts[ $name ] = $font['variants']; + + // Add Subset. + $subset = apply_filters( 'astra_font_subset', '', $name ); + if ( ! empty( $subset ) ) { + $font_subset[] = $subset; + } + } + } + + $google_font_url = self::google_fonts_url( $google_fonts, $font_subset ); + + // Do not load Google font remote or local font asset if not any font selected. + if ( '' === $google_font_url ) { + return; + } + + /** + * Support self hosted Google Fonts. + * + * @since 3.6.0 + */ + if ( astra_get_option( 'load-google-fonts-locally' ) && ! is_customize_preview() && ! is_admin() ) { + if ( astra_get_option( 'preload-local-fonts' ) ) { + ast_load_preload_local_fonts( $google_font_url ); + } + wp_enqueue_style( 'astra-google-fonts', ast_get_webfont_url( $google_font_url ), array(), ASTRA_THEME_VERSION, 'all' ); + } else { + wp_enqueue_style( 'astra-google-fonts', $google_font_url, array(), ASTRA_THEME_VERSION, 'all' ); + } + } + + /** + * Google Font URL + * Combine multiple google font in one URL + * + * @link https://shellcreeper.com/?p=1476 + * @param array $fonts Google Fonts array. + * @param array $subsets Font's Subsets array. + * + * @return string + */ + public static function google_fonts_url( $fonts, $subsets = array() ) { + + /* URL */ + $base_url = 'https://fonts.googleapis.com/css'; + $font_args = array(); + $family = array(); + + // This is deprecated filter hook. + $fonts = apply_filters( 'astra_google_fonts', $fonts ); + + $fonts = apply_filters( 'astra_google_fonts_selected', $fonts ); + + /* Format Each Font Family in Array */ + foreach ( $fonts as $font_name => $font_weight ) { + $font_name = str_replace( ' ', '+', $font_name ); + if ( ! empty( $font_weight ) ) { + if ( is_array( $font_weight ) ) { + $font_weight = implode( ',', $font_weight ); + } + $font_family = explode( ',', $font_name ); + $font_family = str_replace( "'", '', astra_get_prop( $font_family, 0 ) ); + $family[] = trim( $font_family . ':' . rawurlencode( trim( $font_weight ) ) ); + } else { + $family[] = trim( $font_name ); + } + } + + /* Only return URL if font family defined. */ + if ( ! empty( $family ) ) { + + /* Make Font Family a String */ + $family = implode( '|', $family ); + + /* Add font family in args */ + $font_args['family'] = $family; + + /* Add font subsets in args */ + if ( ! empty( $subsets ) ) { + + /* format subsets to string */ + if ( is_array( $subsets ) ) { + $subsets = implode( ',', $subsets ); + } + + $font_args['subset'] = rawurlencode( trim( $subsets ) ); + } + + $font_args['display'] = astra_get_fonts_display_property(); + + return add_query_arg( $font_args, $base_url ); + } + + return ''; + } +} diff --git a/inc/customizer/configurations/buttons/class-astra-customizer-button-configs.php b/inc/customizer/configurations/buttons/class-astra-customizer-button-configs.php index b153ee6..7c49a4d 100644 --- a/inc/customizer/configurations/buttons/class-astra-customizer-button-configs.php +++ b/inc/customizer/configurations/buttons/class-astra-customizer-button-configs.php @@ -1,484 +1,484 @@ - ASTRA_THEME_SETTINGS . '[theme-button-color-group]', - 'default' => astra_get_option( 'theme-button-color-group' ), - 'type' => 'control', - 'control' => 'ast-color-group', - 'title' => __( 'Text Color', 'astra' ), - 'section' => 'section-buttons', - 'transport' => 'postMessage', - 'priority' => 18, - ), - - /** - * Group: Theme Button background colors Group - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[theme-button-bg-color-group]', - 'default' => astra_get_option( 'theme-button-bg-color-group' ), - 'type' => 'control', - 'control' => 'ast-color-group', - 'title' => __( 'Background Color', 'astra' ), - 'section' => 'section-buttons', - 'transport' => 'postMessage', - 'priority' => 18.5, - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - /** - * Option: Button Color - */ - array( - 'name' => 'button-color', - 'default' => astra_get_option( 'button-color' ), - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[theme-button-color-group]', - 'section' => 'section-buttons', - 'control' => 'ast-color', - 'title' => __( 'Normal', 'astra' ), - ), - - /** - * Option: Button Hover Color - */ - array( - 'name' => 'button-h-color', - 'default' => astra_get_option( 'button-h-color' ), - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[theme-button-color-group]', - 'section' => 'section-buttons', - 'control' => 'ast-color', - 'title' => __( 'Hover', 'astra' ), - 'priority' => 39, - ), - - /** - * Option: Button Background Color - */ - array( - 'name' => 'button-bg-color', - 'default' => astra_get_option( 'button-bg-color' ), - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[theme-button-bg-color-group]', - 'section' => 'section-buttons', - 'control' => 'ast-color', - 'title' => __( 'Normal', 'astra' ), - ), - - /** - * Option: Button Background Hover Color - */ - array( - 'name' => 'button-bg-h-color', - 'default' => astra_get_option( 'button-bg-h-color' ), - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[theme-button-bg-color-group]', - 'section' => 'section-buttons', - 'control' => 'ast-color', - 'title' => __( 'Hover', 'astra' ), - 'priority' => 40, - ), - - /** - * Option: Global Button Border Size - */ - array( - 'type' => 'control', - 'section' => 'section-buttons', - 'control' => 'ast-border', - 'name' => ASTRA_THEME_SETTINGS . '[theme-button-border-group-border-size]', - 'transport' => 'postMessage', - 'linked_choices' => true, - 'priority' => 19, - 'default' => astra_get_option( 'theme-button-border-group-border-size' ), - 'title' => __( 'Border Width', 'astra' ), - 'choices' => array( - 'top' => __( 'Top', 'astra' ), - 'right' => __( 'Right', 'astra' ), - 'bottom' => __( 'Bottom', 'astra' ), - 'left' => __( 'Left', 'astra' ), - ), - ), - - /** - * Group: Theme Button Border Group - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[theme-button-border-color-group]', - 'default' => astra_get_option( 'theme-button-border-color-group' ), - 'type' => 'control', - 'control' => 'ast-color-group', - 'title' => __( 'Border Color', 'astra' ), - 'section' => 'section-buttons', - 'transport' => 'postMessage', - 'priority' => 19, - ), - - /** - * Option: Global Button Border Color - */ - array( - 'name' => 'theme-button-border-group-border-color', - 'parent' => ASTRA_THEME_SETTINGS . '[theme-button-border-color-group]', - 'default' => astra_get_option( 'theme-button-border-group-border-color' ), - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'section' => 'section-buttons', - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 19, - 'title' => __( 'Border Color', 'astra' ), - ), - - /** - * Option: Global Button Border Hover Color - */ - array( - 'name' => 'theme-button-border-group-border-h-color', - 'default' => astra_get_option( 'theme-button-border-group-border-h-color' ), - 'parent' => ASTRA_THEME_SETTINGS . '[theme-button-border-color-group]', - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'section' => 'section-buttons', - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 19, - 'title' => __( 'Border Hover Color', 'astra' ), - ), - - /** - * Option: Global Button Radius - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[button-radius]', - 'default' => astra_get_option( 'button-radius' ), - 'type' => 'control', - 'section' => 'section-buttons', - 'control' => 'ast-slider', - 'priority' => 19, - 'suffix' => 'px', - 'title' => __( 'Border Radius', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - 'step' => 1, - 'max' => 200, - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - /** - * Option: Theme Button Padding - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[theme-button-padding]', - 'default' => astra_get_option( 'theme-button-padding' ), - 'type' => 'control', - 'control' => 'ast-responsive-spacing', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), - 'section' => 'section-buttons', - 'title' => __( 'Padding', 'astra' ), - 'linked_choices' => true, - 'transport' => 'postMessage', - 'unit_choices' => array( 'px', 'em', '%' ), - 'choices' => array( - 'top' => __( 'Top', 'astra' ), - 'right' => __( 'Right', 'astra' ), - 'bottom' => __( 'Bottom', 'astra' ), - 'left' => __( 'Left', 'astra' ), - ), - 'priority' => 35, - 'connected' => false, - ), - - ); - - if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) { - - $_trans_config = array( - /** - * Option: Transparent Header Button Colors Divider - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-button-color-divider]', - 'type' => 'control', - 'control' => 'ast-heading', - 'section' => 'section-transparent-header', - 'title' => __( 'Header Button', 'astra' ), - 'settings' => array(), - 'priority' => 40, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', - 'operator' => '===', - 'value' => 'custom-button', - ), - ), - ), - /** - * Group: Transparent Header Button Colors Group - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-button-color-group]', - 'default' => astra_get_option( 'transparent-header-button-color-group' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => __( 'Colors', 'astra' ), - 'section' => 'section-transparent-header', - 'transport' => 'postMessage', - 'priority' => 40, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', - 'operator' => '===', - 'value' => 'custom-button', - ), - ), - ), - /** - * Group: Transparent Header Button Border Group - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-button-border-group]', - 'default' => astra_get_option( 'transparent-header-button-border-group' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => __( 'Border', 'astra' ), - 'section' => 'section-transparent-header', - 'transport' => 'postMessage', - 'priority' => 40, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', - 'operator' => '===', - 'value' => 'custom-button', - ), - ), - ), - - /** - * Option: Button Text Color - */ - array( - 'name' => 'header-main-rt-trans-section-button-text-color', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'header-main-rt-trans-section-button-text-color' ), - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-color-group]', - 'section' => 'section-transparent-header', - 'tab' => __( 'Normal', 'astra' ), - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 10, - 'title' => __( 'Text Color', 'astra' ), - ), - - /** - * Option: Button Text Hover Color - */ - array( - 'name' => 'header-main-rt-trans-section-button-text-h-color', - 'default' => astra_get_option( 'header-main-rt-trans-section-button-text-h-color' ), - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-color-group]', - 'section' => 'section-transparent-header', - 'tab' => __( 'Hover', 'astra' ), - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 10, - 'title' => __( 'Text Color', 'astra' ), - ), - - /** - * Option: Button Background Color - */ - array( - 'name' => 'header-main-rt-trans-section-button-back-color', - 'default' => astra_get_option( 'header-main-rt-trans-section-button-back-color' ), - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-color-group]', - 'section' => 'section-transparent-header', - 'tab' => __( 'Normal', 'astra' ), - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 10, - 'title' => __( 'Background Color', 'astra' ), - ), - - /** - * Option: Button Button Hover Color - */ - array( - 'name' => 'header-main-rt-trans-section-button-back-h-color', - 'default' => astra_get_option( 'header-main-rt-trans-section-button-back-h-color' ), - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-color-group]', - 'section' => 'section-transparent-header', - 'tab' => __( 'Hover', 'astra' ), - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 10, - 'title' => __( 'Background Color', 'astra' ), - ), - - // Option: Custom Menu Button Border. - array( - 'type' => 'control', - 'control' => 'ast-responsive-spacing', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), - 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-trans-section-button-padding]', - 'section' => 'section-transparent-header', - 'transport' => 'postMessage', - 'linked_choices' => true, - 'priority' => 40, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', - 'operator' => '===', - 'value' => 'custom-button', - ), - ), - 'default' => astra_get_option( 'header-main-rt-trans-section-button-padding' ), - 'title' => __( 'Padding', 'astra' ), - 'choices' => array( - 'top' => __( 'Top', 'astra' ), - 'right' => __( 'Right', 'astra' ), - 'bottom' => __( 'Bottom', 'astra' ), - 'left' => __( 'Left', 'astra' ), - ), - ), - - /** - * Option: Button Border Size - */ - array( - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-border-group]', - 'section' => 'section-transparent-header', - 'control' => 'ast-border', - 'name' => 'header-main-rt-trans-section-button-border-size', - 'transport' => 'postMessage', - 'linked_choices' => true, - 'priority' => 10, - 'default' => astra_get_option( 'header-main-rt-trans-section-button-border-size' ), - 'title' => __( 'Width', 'astra' ), - 'choices' => array( - 'top' => __( 'Top', 'astra' ), - 'right' => __( 'Right', 'astra' ), - 'bottom' => __( 'Bottom', 'astra' ), - 'left' => __( 'Left', 'astra' ), - ), - ), - - /** - * Option: Button Border Color - */ - array( - 'name' => 'header-main-rt-trans-section-button-border-color', - 'default' => astra_get_option( 'header-main-rt-trans-section-button-border-color' ), - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-border-group]', - 'section' => 'section-transparent-header', - 'transport' => 'postMessage', - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 12, - 'title' => __( 'Color', 'astra' ), - ), - - /** - * Option: Button Border Hover Color - */ - array( - 'name' => 'header-main-rt-trans-section-button-border-h-color', - 'default' => astra_get_option( 'header-main-rt-trans-section-button-border-h-color' ), - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-border-group]', - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 14, - 'title' => __( 'Hover Color', 'astra' ), - ), - - /** - * Option: Button Border Radius - */ - array( - 'name' => 'header-main-rt-trans-section-button-border-radius', - 'default' => astra_get_option( 'header-main-rt-trans-section-button-border-radius' ), - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-border-group]', - 'section' => 'section-transparent-header', - 'control' => 'ast-slider', - 'suffix' => 'px', - 'transport' => 'postMessage', - 'priority' => 16, - 'title' => __( 'Border Radius', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - 'step' => 1, - 'max' => 100, - ), - ), - ); - $_configs = array_merge( $_configs, $_trans_config ); - - } - - return array_merge( $configurations, $_configs ); - } - } -} - -/** - * Kicking this off by calling 'get_instance()' method - */ -new Astra_Customizer_Button_Configs(); + ASTRA_THEME_SETTINGS . '[theme-button-color-group]', + 'default' => astra_get_option( 'theme-button-color-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Text Color', 'astra' ), + 'section' => 'section-buttons', + 'transport' => 'postMessage', + 'priority' => 18, + ), + + /** + * Group: Theme Button background colors Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[theme-button-bg-color-group]', + 'default' => astra_get_option( 'theme-button-bg-color-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Background Color', 'astra' ), + 'section' => 'section-buttons', + 'transport' => 'postMessage', + 'priority' => 18.5, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Button Color + */ + array( + 'name' => 'button-color', + 'default' => astra_get_option( 'button-color' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[theme-button-color-group]', + 'section' => 'section-buttons', + 'control' => 'ast-color', + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Button Hover Color + */ + array( + 'name' => 'button-h-color', + 'default' => astra_get_option( 'button-h-color' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[theme-button-color-group]', + 'section' => 'section-buttons', + 'control' => 'ast-color', + 'title' => __( 'Hover', 'astra' ), + 'priority' => 39, + ), + + /** + * Option: Button Background Color + */ + array( + 'name' => 'button-bg-color', + 'default' => astra_get_option( 'button-bg-color' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[theme-button-bg-color-group]', + 'section' => 'section-buttons', + 'control' => 'ast-color', + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Button Background Hover Color + */ + array( + 'name' => 'button-bg-h-color', + 'default' => astra_get_option( 'button-bg-h-color' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[theme-button-bg-color-group]', + 'section' => 'section-buttons', + 'control' => 'ast-color', + 'title' => __( 'Hover', 'astra' ), + 'priority' => 40, + ), + + /** + * Option: Global Button Border Size + */ + array( + 'type' => 'control', + 'section' => 'section-buttons', + 'control' => 'ast-border', + 'name' => ASTRA_THEME_SETTINGS . '[theme-button-border-group-border-size]', + 'transport' => 'postMessage', + 'linked_choices' => true, + 'priority' => 19, + 'default' => astra_get_option( 'theme-button-border-group-border-size' ), + 'title' => __( 'Border Width', 'astra' ), + 'choices' => array( + 'top' => __( 'Top', 'astra' ), + 'right' => __( 'Right', 'astra' ), + 'bottom' => __( 'Bottom', 'astra' ), + 'left' => __( 'Left', 'astra' ), + ), + ), + + /** + * Group: Theme Button Border Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[theme-button-border-color-group]', + 'default' => astra_get_option( 'theme-button-border-color-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Border Color', 'astra' ), + 'section' => 'section-buttons', + 'transport' => 'postMessage', + 'priority' => 19, + ), + + /** + * Option: Global Button Border Color + */ + array( + 'name' => 'theme-button-border-group-border-color', + 'parent' => ASTRA_THEME_SETTINGS . '[theme-button-border-color-group]', + 'default' => astra_get_option( 'theme-button-border-group-border-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'section' => 'section-buttons', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 19, + 'title' => __( 'Border Color', 'astra' ), + ), + + /** + * Option: Global Button Border Hover Color + */ + array( + 'name' => 'theme-button-border-group-border-h-color', + 'default' => astra_get_option( 'theme-button-border-group-border-h-color' ), + 'parent' => ASTRA_THEME_SETTINGS . '[theme-button-border-color-group]', + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'section' => 'section-buttons', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 19, + 'title' => __( 'Border Hover Color', 'astra' ), + ), + + /** + * Option: Global Button Radius + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[button-radius]', + 'default' => astra_get_option( 'button-radius' ), + 'type' => 'control', + 'section' => 'section-buttons', + 'control' => 'ast-slider', + 'priority' => 19, + 'suffix' => 'px', + 'title' => __( 'Border Radius', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 200, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Theme Button Padding + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[theme-button-padding]', + 'default' => astra_get_option( 'theme-button-padding' ), + 'type' => 'control', + 'control' => 'ast-responsive-spacing', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), + 'section' => 'section-buttons', + 'title' => __( 'Padding', 'astra' ), + 'linked_choices' => true, + 'transport' => 'postMessage', + 'unit_choices' => array( 'px', 'em', '%' ), + 'choices' => array( + 'top' => __( 'Top', 'astra' ), + 'right' => __( 'Right', 'astra' ), + 'bottom' => __( 'Bottom', 'astra' ), + 'left' => __( 'Left', 'astra' ), + ), + 'priority' => 35, + 'connected' => false, + ), + + ); + + if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) { + + $_trans_config = array( + /** + * Option: Transparent Header Button Colors Divider + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-button-color-divider]', + 'type' => 'control', + 'control' => 'ast-heading', + 'section' => 'section-transparent-header', + 'title' => __( 'Header Button', 'astra' ), + 'settings' => array(), + 'priority' => 40, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', + 'operator' => '===', + 'value' => 'custom-button', + ), + ), + ), + /** + * Group: Transparent Header Button Colors Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-button-color-group]', + 'default' => astra_get_option( 'transparent-header-button-color-group' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Colors', 'astra' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 40, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', + 'operator' => '===', + 'value' => 'custom-button', + ), + ), + ), + /** + * Group: Transparent Header Button Border Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-button-border-group]', + 'default' => astra_get_option( 'transparent-header-button-border-group' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Border', 'astra' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 40, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', + 'operator' => '===', + 'value' => 'custom-button', + ), + ), + ), + + /** + * Option: Button Text Color + */ + array( + 'name' => 'header-main-rt-trans-section-button-text-color', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'header-main-rt-trans-section-button-text-color' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-color-group]', + 'section' => 'section-transparent-header', + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 10, + 'title' => __( 'Text Color', 'astra' ), + ), + + /** + * Option: Button Text Hover Color + */ + array( + 'name' => 'header-main-rt-trans-section-button-text-h-color', + 'default' => astra_get_option( 'header-main-rt-trans-section-button-text-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-color-group]', + 'section' => 'section-transparent-header', + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 10, + 'title' => __( 'Text Color', 'astra' ), + ), + + /** + * Option: Button Background Color + */ + array( + 'name' => 'header-main-rt-trans-section-button-back-color', + 'default' => astra_get_option( 'header-main-rt-trans-section-button-back-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-color-group]', + 'section' => 'section-transparent-header', + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 10, + 'title' => __( 'Background Color', 'astra' ), + ), + + /** + * Option: Button Button Hover Color + */ + array( + 'name' => 'header-main-rt-trans-section-button-back-h-color', + 'default' => astra_get_option( 'header-main-rt-trans-section-button-back-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-color-group]', + 'section' => 'section-transparent-header', + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 10, + 'title' => __( 'Background Color', 'astra' ), + ), + + // Option: Custom Menu Button Border. + array( + 'type' => 'control', + 'control' => 'ast-responsive-spacing', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), + 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-trans-section-button-padding]', + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'linked_choices' => true, + 'priority' => 40, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', + 'operator' => '===', + 'value' => 'custom-button', + ), + ), + 'default' => astra_get_option( 'header-main-rt-trans-section-button-padding' ), + 'title' => __( 'Padding', 'astra' ), + 'choices' => array( + 'top' => __( 'Top', 'astra' ), + 'right' => __( 'Right', 'astra' ), + 'bottom' => __( 'Bottom', 'astra' ), + 'left' => __( 'Left', 'astra' ), + ), + ), + + /** + * Option: Button Border Size + */ + array( + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-border-group]', + 'section' => 'section-transparent-header', + 'control' => 'ast-border', + 'name' => 'header-main-rt-trans-section-button-border-size', + 'transport' => 'postMessage', + 'linked_choices' => true, + 'priority' => 10, + 'default' => astra_get_option( 'header-main-rt-trans-section-button-border-size' ), + 'title' => __( 'Width', 'astra' ), + 'choices' => array( + 'top' => __( 'Top', 'astra' ), + 'right' => __( 'Right', 'astra' ), + 'bottom' => __( 'Bottom', 'astra' ), + 'left' => __( 'Left', 'astra' ), + ), + ), + + /** + * Option: Button Border Color + */ + array( + 'name' => 'header-main-rt-trans-section-button-border-color', + 'default' => astra_get_option( 'header-main-rt-trans-section-button-border-color' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-border-group]', + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 12, + 'title' => __( 'Color', 'astra' ), + ), + + /** + * Option: Button Border Hover Color + */ + array( + 'name' => 'header-main-rt-trans-section-button-border-h-color', + 'default' => astra_get_option( 'header-main-rt-trans-section-button-border-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-border-group]', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 14, + 'title' => __( 'Hover Color', 'astra' ), + ), + + /** + * Option: Button Border Radius + */ + array( + 'name' => 'header-main-rt-trans-section-button-border-radius', + 'default' => astra_get_option( 'header-main-rt-trans-section-button-border-radius' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-button-border-group]', + 'section' => 'section-transparent-header', + 'control' => 'ast-slider', + 'suffix' => 'px', + 'transport' => 'postMessage', + 'priority' => 16, + 'title' => __( 'Border Radius', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 100, + ), + ), + ); + $_configs = array_merge( $_configs, $_trans_config ); + + } + + return array_merge( $configurations, $_configs ); + } + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +new Astra_Customizer_Button_Configs(); diff --git a/inc/customizer/configurations/buttons/class-astra-existing-button-configs.php b/inc/customizer/configurations/buttons/class-astra-existing-button-configs.php index 707420a..15d5a81 100644 --- a/inc/customizer/configurations/buttons/class-astra-existing-button-configs.php +++ b/inc/customizer/configurations/buttons/class-astra-existing-button-configs.php @@ -1,452 +1,452 @@ - ASTRA_THEME_SETTINGS . '[primary-header-button-color-divider]', - 'type' => 'control', - 'control' => 'ast-heading', - 'section' => 'section-primary-menu', - 'title' => __( 'Header Button', 'astra' ), - 'settings' => array(), - 'priority' => 17, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', - 'operator' => '===', - 'value' => 'custom-button', - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'operator' => '==', - 'value' => 'button', - ), - ), - - ), - /** - * Group: Primary Header Button Colors Group - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[primary-header-button-color-group]', - 'default' => astra_get_option( 'primary-header-button-color-group' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => __( 'Colors', 'astra' ), - 'section' => 'section-primary-menu', - 'transport' => 'postMessage', - 'priority' => 18, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', - 'operator' => '===', - 'value' => 'custom-button', - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'operator' => '==', - 'value' => 'button', - ), - ), - ), - /** - * Group: Primary Header Button Border Group - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[primary-header-button-border-group]', - 'default' => astra_get_option( 'primary-header-button-border-group' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => __( 'Border', 'astra' ), - 'section' => 'section-primary-menu', - 'transport' => 'postMessage', - 'priority' => 19, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', - 'operator' => '===', - 'value' => 'custom-button', - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'operator' => '==', - 'value' => 'button', - ), - ), - ), - - /** - * Option: Button Text Color - */ - array( - 'name' => 'header-main-rt-section-button-text-color', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'header-main-rt-section-button-text-color' ), - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-color-group]', - 'section' => 'section-primary-menu', - 'tab' => __( 'Normal', 'astra' ), - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 10, - 'title' => __( 'Text Color', 'astra' ), - ), - - /** - * Option: Button Text Hover Color - */ - array( - 'name' => 'header-main-rt-section-button-text-h-color', - 'default' => astra_get_option( 'header-main-rt-section-button-text-h-color' ), - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-color-group]', - 'section' => 'section-primary-menu', - 'tab' => __( 'Hover', 'astra' ), - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 10, - 'title' => __( 'Text Color', 'astra' ), - ), - - /** - * Option: Button Background Color - */ - array( - 'name' => 'header-main-rt-section-button-back-color', - 'default' => astra_get_option( 'header-main-rt-section-button-back-color' ), - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-color-group]', - 'section' => 'section-primary-menu', - 'tab' => __( 'Normal', 'astra' ), - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 10, - 'title' => __( 'Background Color', 'astra' ), - ), - - /** - * Option: Button Button Hover Color - */ - array( - 'name' => 'header-main-rt-section-button-back-h-color', - 'default' => astra_get_option( 'header-main-rt-section-button-back-h-color' ), - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-color-group]', - 'section' => 'section-primary-menu', - 'tab' => __( 'Hover', 'astra' ), - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 10, - 'title' => __( 'Background Color', 'astra' ), - ), - - /** - * Option: Primary Header Button Typography - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', - 'default' => astra_get_option( 'primary-header-button-text-typography' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => __( 'Typography', 'astra' ), - 'section' => 'section-primary-menu', - 'transport' => 'postMessage', - 'priority' => 20, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', - 'operator' => '===', - 'value' => 'custom-button', - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'operator' => '==', - 'value' => 'button', - ), - ), - ), - - /** - * Option: Primary Header Button Font Family - */ - array( - 'name' => 'primary-header-button-font-family', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', - 'section' => 'section-primary-menu', - 'control' => 'ast-font', - 'font_type' => 'ast-font-family', - 'title' => __( 'Family', 'astra' ), - 'default' => astra_get_option( 'primary-header-button-font-family' ), - 'connect' => ASTRA_THEME_SETTINGS . '[primary-header-button-font-weight]', - 'priority' => 1, - ), - - /** - * Option: Primary Header Button Font Size - */ - array( - 'name' => 'primary-header-button-font-size', - 'transport' => 'postMessage', - 'title' => __( 'Size', 'astra' ), - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', - 'section' => 'section-primary-menu', - 'control' => 'ast-responsive', - 'default' => astra_get_option( 'primary-header-button-font-size' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - ), - - /** - * Option: Primary Header Button Font Weight - */ - array( - 'name' => 'primary-header-button-font-weight', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', - 'section' => 'section-primary-menu', - 'control' => 'ast-font', - 'font_type' => 'ast-font-weight', - 'title' => __( 'Weight', 'astra' ), - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), - 'default' => astra_get_option( 'primary-header-button-font-weight' ), - 'connect' => 'primary-header-button-font-family', - 'priority' => 2, - ), - - /** - * Option: Primary Header Button Text Transform - */ - array( - 'name' => 'primary-header-button-text-transform', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'primary-header-button-text-transform' ), - 'title' => __( 'Text Transform', 'astra' ), - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', - 'section' => 'section-primary-menu', - 'control' => 'ast-select', - 'priority' => 3, - 'choices' => array( - '' => __( 'Inherit', 'astra' ), - 'none' => __( 'None', 'astra' ), - 'capitalize' => __( 'Capitalize', 'astra' ), - 'uppercase' => __( 'Uppercase', 'astra' ), - 'lowercase' => __( 'Lowercase', 'astra' ), - ), - ), - - /** - * Option: Primary Header Button Line Height - */ - array( - 'name' => 'primary-header-button-line-height', - 'control' => 'ast-slider', - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'default' => astra_get_option( 'primary-header-button-line-height' ), - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', - 'section' => 'section-primary-menu', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), - 'title' => __( 'Line Height', 'astra' ), - 'suffix' => 'em', - 'priority' => 4, - 'input_attrs' => array( - 'min' => 1, - 'step' => 0.01, - 'max' => 5, - ), - ), - - /** - * Option: Primary Header Button Letter Spacing - */ - array( - 'name' => 'primary-header-button-letter-spacing', - 'control' => 'ast-slider', - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'default' => astra_get_option( 'primary-header-button-letter-spacing' ), - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', - 'section' => 'section-primary-menu', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), - 'title' => __( 'Letter Spacing', 'astra' ), - 'suffix' => 'px', - 'priority' => 5, - 'input_attrs' => array( - 'min' => 1, - 'step' => 1, - 'max' => 100, - ), - ), - - // Option: Custom Menu Button Border. - array( - 'type' => 'control', - 'control' => 'ast-responsive-spacing', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), - 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-padding]', - 'section' => 'section-primary-menu', - 'transport' => 'postMessage', - 'linked_choices' => true, - 'priority' => 21, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', - 'operator' => '===', - 'value' => 'custom-button', - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'operator' => '==', - 'value' => 'button', - ), - ), - 'default' => astra_get_option( 'header-main-rt-section-button-padding' ), - 'title' => __( 'Padding', 'astra' ), - 'choices' => array( - 'top' => __( 'Top', 'astra' ), - 'right' => __( 'Right', 'astra' ), - 'bottom' => __( 'Bottom', 'astra' ), - 'left' => __( 'Left', 'astra' ), - ), - ), - - /** - * Option: Button Border Size - */ - array( - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-border-group]', - 'section' => 'section-primary-menu', - 'control' => 'ast-border', - 'name' => 'header-main-rt-section-button-border-size', - 'transport' => 'postMessage', - 'linked_choices' => true, - 'priority' => 10, - 'default' => astra_get_option( 'header-main-rt-section-button-border-size' ), - 'title' => __( 'Width', 'astra' ), - 'choices' => array( - 'top' => __( 'Top', 'astra' ), - 'right' => __( 'Right', 'astra' ), - 'bottom' => __( 'Bottom', 'astra' ), - 'left' => __( 'Left', 'astra' ), - ), - ), - - /** - * Option: Button Border Color - */ - array( - 'name' => 'header-main-rt-section-button-border-color', - 'default' => astra_get_option( 'header-main-rt-section-button-border-color' ), - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-border-group]', - 'section' => 'section-primary-menu', - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 12, - 'title' => __( 'Color', 'astra' ), - ), - - /** - * Option: Button Border Hover Color - */ - array( - 'name' => 'header-main-rt-section-button-border-h-color', - 'default' => astra_get_option( 'header-main-rt-section-button-border-h-color' ), - 'transport' => 'postMessage', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-border-group]', - 'section' => 'section-primary-menu', - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'priority' => 14, - 'title' => __( 'Hover Color', 'astra' ), - ), - - /** - * Option: Button Border Radius - */ - array( - 'name' => 'header-main-rt-section-button-border-radius', - 'default' => astra_get_option( 'header-main-rt-section-button-border-radius' ), - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-border-group]', - 'section' => 'section-primary-menu', - 'control' => 'ast-slider', - 'suffix' => 'px', - 'transport' => 'postMessage', - 'priority' => 16, - 'title' => __( 'Border Radius', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - 'step' => 1, - 'max' => 100, - ), - ), - ); - - return array_merge( $configurations, $_configs ); - } - } -} - -/** - * Kicking this off by calling 'get_instance()' method - */ -new Astra_Existing_Button_Configs(); + ASTRA_THEME_SETTINGS . '[primary-header-button-color-divider]', + 'type' => 'control', + 'control' => 'ast-heading', + 'section' => 'section-primary-menu', + 'title' => __( 'Header Button', 'astra' ), + 'settings' => array(), + 'priority' => 17, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', + 'operator' => '===', + 'value' => 'custom-button', + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'operator' => '==', + 'value' => 'button', + ), + ), + + ), + /** + * Group: Primary Header Button Colors Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[primary-header-button-color-group]', + 'default' => astra_get_option( 'primary-header-button-color-group' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Colors', 'astra' ), + 'section' => 'section-primary-menu', + 'transport' => 'postMessage', + 'priority' => 18, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', + 'operator' => '===', + 'value' => 'custom-button', + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'operator' => '==', + 'value' => 'button', + ), + ), + ), + /** + * Group: Primary Header Button Border Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[primary-header-button-border-group]', + 'default' => astra_get_option( 'primary-header-button-border-group' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Border', 'astra' ), + 'section' => 'section-primary-menu', + 'transport' => 'postMessage', + 'priority' => 19, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', + 'operator' => '===', + 'value' => 'custom-button', + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'operator' => '==', + 'value' => 'button', + ), + ), + ), + + /** + * Option: Button Text Color + */ + array( + 'name' => 'header-main-rt-section-button-text-color', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'header-main-rt-section-button-text-color' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-color-group]', + 'section' => 'section-primary-menu', + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 10, + 'title' => __( 'Text Color', 'astra' ), + ), + + /** + * Option: Button Text Hover Color + */ + array( + 'name' => 'header-main-rt-section-button-text-h-color', + 'default' => astra_get_option( 'header-main-rt-section-button-text-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-color-group]', + 'section' => 'section-primary-menu', + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 10, + 'title' => __( 'Text Color', 'astra' ), + ), + + /** + * Option: Button Background Color + */ + array( + 'name' => 'header-main-rt-section-button-back-color', + 'default' => astra_get_option( 'header-main-rt-section-button-back-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-color-group]', + 'section' => 'section-primary-menu', + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 10, + 'title' => __( 'Background Color', 'astra' ), + ), + + /** + * Option: Button Button Hover Color + */ + array( + 'name' => 'header-main-rt-section-button-back-h-color', + 'default' => astra_get_option( 'header-main-rt-section-button-back-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-color-group]', + 'section' => 'section-primary-menu', + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 10, + 'title' => __( 'Background Color', 'astra' ), + ), + + /** + * Option: Primary Header Button Typography + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', + 'default' => astra_get_option( 'primary-header-button-text-typography' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Typography', 'astra' ), + 'section' => 'section-primary-menu', + 'transport' => 'postMessage', + 'priority' => 20, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', + 'operator' => '===', + 'value' => 'custom-button', + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'operator' => '==', + 'value' => 'button', + ), + ), + ), + + /** + * Option: Primary Header Button Font Family + */ + array( + 'name' => 'primary-header-button-font-family', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', + 'section' => 'section-primary-menu', + 'control' => 'ast-font', + 'font_type' => 'ast-font-family', + 'title' => __( 'Family', 'astra' ), + 'default' => astra_get_option( 'primary-header-button-font-family' ), + 'connect' => ASTRA_THEME_SETTINGS . '[primary-header-button-font-weight]', + 'priority' => 1, + ), + + /** + * Option: Primary Header Button Font Size + */ + array( + 'name' => 'primary-header-button-font-size', + 'transport' => 'postMessage', + 'title' => __( 'Size', 'astra' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', + 'section' => 'section-primary-menu', + 'control' => 'ast-responsive', + 'default' => astra_get_option( 'primary-header-button-font-size' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + + /** + * Option: Primary Header Button Font Weight + */ + array( + 'name' => 'primary-header-button-font-weight', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', + 'section' => 'section-primary-menu', + 'control' => 'ast-font', + 'font_type' => 'ast-font-weight', + 'title' => __( 'Weight', 'astra' ), + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), + 'default' => astra_get_option( 'primary-header-button-font-weight' ), + 'connect' => 'primary-header-button-font-family', + 'priority' => 2, + ), + + /** + * Option: Primary Header Button Text Transform + */ + array( + 'name' => 'primary-header-button-text-transform', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'primary-header-button-text-transform' ), + 'title' => __( 'Text Transform', 'astra' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', + 'section' => 'section-primary-menu', + 'control' => 'ast-select', + 'priority' => 3, + 'choices' => array( + '' => __( 'Inherit', 'astra' ), + 'none' => __( 'None', 'astra' ), + 'capitalize' => __( 'Capitalize', 'astra' ), + 'uppercase' => __( 'Uppercase', 'astra' ), + 'lowercase' => __( 'Lowercase', 'astra' ), + ), + ), + + /** + * Option: Primary Header Button Line Height + */ + array( + 'name' => 'primary-header-button-line-height', + 'control' => 'ast-slider', + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'default' => astra_get_option( 'primary-header-button-line-height' ), + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', + 'section' => 'section-primary-menu', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), + 'title' => __( 'Line Height', 'astra' ), + 'suffix' => 'em', + 'priority' => 4, + 'input_attrs' => array( + 'min' => 1, + 'step' => 0.01, + 'max' => 5, + ), + ), + + /** + * Option: Primary Header Button Letter Spacing + */ + array( + 'name' => 'primary-header-button-letter-spacing', + 'control' => 'ast-slider', + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'default' => astra_get_option( 'primary-header-button-letter-spacing' ), + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-text-typography]', + 'section' => 'section-primary-menu', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), + 'title' => __( 'Letter Spacing', 'astra' ), + 'suffix' => 'px', + 'priority' => 5, + 'input_attrs' => array( + 'min' => 1, + 'step' => 1, + 'max' => 100, + ), + ), + + // Option: Custom Menu Button Border. + array( + 'type' => 'control', + 'control' => 'ast-responsive-spacing', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), + 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-padding]', + 'section' => 'section-primary-menu', + 'transport' => 'postMessage', + 'linked_choices' => true, + 'priority' => 21, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', + 'operator' => '===', + 'value' => 'custom-button', + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'operator' => '==', + 'value' => 'button', + ), + ), + 'default' => astra_get_option( 'header-main-rt-section-button-padding' ), + 'title' => __( 'Padding', 'astra' ), + 'choices' => array( + 'top' => __( 'Top', 'astra' ), + 'right' => __( 'Right', 'astra' ), + 'bottom' => __( 'Bottom', 'astra' ), + 'left' => __( 'Left', 'astra' ), + ), + ), + + /** + * Option: Button Border Size + */ + array( + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-border-group]', + 'section' => 'section-primary-menu', + 'control' => 'ast-border', + 'name' => 'header-main-rt-section-button-border-size', + 'transport' => 'postMessage', + 'linked_choices' => true, + 'priority' => 10, + 'default' => astra_get_option( 'header-main-rt-section-button-border-size' ), + 'title' => __( 'Width', 'astra' ), + 'choices' => array( + 'top' => __( 'Top', 'astra' ), + 'right' => __( 'Right', 'astra' ), + 'bottom' => __( 'Bottom', 'astra' ), + 'left' => __( 'Left', 'astra' ), + ), + ), + + /** + * Option: Button Border Color + */ + array( + 'name' => 'header-main-rt-section-button-border-color', + 'default' => astra_get_option( 'header-main-rt-section-button-border-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-border-group]', + 'section' => 'section-primary-menu', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 12, + 'title' => __( 'Color', 'astra' ), + ), + + /** + * Option: Button Border Hover Color + */ + array( + 'name' => 'header-main-rt-section-button-border-h-color', + 'default' => astra_get_option( 'header-main-rt-section-button-border-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-border-group]', + 'section' => 'section-primary-menu', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 14, + 'title' => __( 'Hover Color', 'astra' ), + ), + + /** + * Option: Button Border Radius + */ + array( + 'name' => 'header-main-rt-section-button-border-radius', + 'default' => astra_get_option( 'header-main-rt-section-button-border-radius' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[primary-header-button-border-group]', + 'section' => 'section-primary-menu', + 'control' => 'ast-slider', + 'suffix' => 'px', + 'transport' => 'postMessage', + 'priority' => 16, + 'title' => __( 'Border Radius', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 100, + ), + ), + ); + + return array_merge( $configurations, $_configs ); + } + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +new Astra_Existing_Button_Configs(); diff --git a/inc/customizer/configurations/class-astra-customizer-config-base.php b/inc/customizer/configurations/class-astra-customizer-config-base.php index 47a4688..862ad90 100644 --- a/inc/customizer/configurations/class-astra-customizer-config-base.php +++ b/inc/customizer/configurations/class-astra-customizer-config-base.php @@ -1,100 +1,100 @@ -'; - $content .= wp_kses_post( astra_get_prop( $args, 'description' ) ); - - // Links. - if ( astra_get_prop( $args, 'links' ) ) { - $content .= '
      '; - foreach ( $args['links'] as $index => $link ) { - - if ( astra_get_prop( $link, 'attrs' ) ) { - - $content .= '
    • '; - - // Attribute mapping. - $attributes = ' target="_blank" '; - foreach ( astra_get_prop( $link, 'attrs' ) as $attr => $attr_value ) { - $attributes .= ' ' . $attr . '="' . esc_attr( $attr_value ) . '" '; - } - $content .= '' . esc_html( astra_get_prop( $link, 'text' ) ) . '
    • '; - - $content .= ''; - } - } - $content .= '
    '; - } - - $content .= ''; - - return $content; - } - - } -} - -/** - * Kicking this off by calling 'get_instance()' method - */ -new Astra_Customizer_Config_Base(); +'; + $content .= wp_kses_post( astra_get_prop( $args, 'description' ) ); + + // Links. + if ( astra_get_prop( $args, 'links' ) ) { + $content .= '
      '; + foreach ( $args['links'] as $index => $link ) { + + if ( astra_get_prop( $link, 'attrs' ) ) { + + $content .= '
    • '; + + // Attribute mapping. + $attributes = ' target="_blank" '; + foreach ( astra_get_prop( $link, 'attrs' ) as $attr => $attr_value ) { + $attributes .= ' ' . $attr . '="' . esc_attr( $attr_value ) . '" '; + } + $content .= '' . esc_html( astra_get_prop( $link, 'text' ) ) . '
    • '; + + $content .= ''; + } + } + $content .= '
    '; + } + + $content .= ''; + + return $content; + } + + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +new Astra_Customizer_Config_Base(); diff --git a/inc/customizer/configurations/colors-background/class-astra-advanced-footer-colors-configs.php b/inc/customizer/configurations/colors-background/class-astra-advanced-footer-colors-configs.php index c216adb..f6ba1dc 100644 --- a/inc/customizer/configurations/colors-background/class-astra-advanced-footer-colors-configs.php +++ b/inc/customizer/configurations/colors-background/class-astra-advanced-footer-colors-configs.php @@ -1,179 +1,179 @@ - ASTRA_THEME_SETTINGS . '[footer-widget-background-group]', - 'default' => astra_get_option( 'footer-widget-background-group' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => __( 'Background Color', 'astra' ), - 'section' => 'section-footer-adv', - 'transport' => 'postMessage', - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'priority' => 47, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-adv]', - 'operator' => '!=', - 'value' => 'disabled', - ), - - ), - ), - - /** - * Option: Footer Bar Content Group - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-widget-content-group]', - 'default' => astra_get_option( 'footer-widget-content-group' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => __( 'Content Colors', 'astra' ), - 'section' => 'section-footer-adv', - 'transport' => 'postMessage', - 'priority' => 48, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-adv]', - 'operator' => '!=', - 'value' => 'disabled', - ), - ), - ), - - /** - * Option: Footer Bar Content Group - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-widget-link-color-group]', - 'default' => astra_get_option( 'footer-widget-link-color-group' ), - 'type' => 'control', - 'control' => 'ast-color-group', - 'title' => __( 'Link Color', 'astra' ), - 'section' => 'section-footer-adv', - 'transport' => 'postMessage', - 'priority' => 48, - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-adv]', - 'operator' => '!=', - 'value' => 'disabled', - ), - - ), - ), - - /** - * Option: Widget Title Color - */ - array( - 'name' => 'footer-adv-wgt-title-color', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[footer-widget-content-group]', - 'section' => 'section-footer-adv', - 'control' => 'ast-color', - 'title' => __( 'Title Color', 'astra' ), - 'default' => astra_get_option( 'footer-adv-wgt-title-color' ), - ), - - /** - * Option: Text Color - */ - array( - 'name' => 'footer-adv-text-color', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[footer-widget-content-group]', - 'section' => 'section-footer-adv', - 'control' => 'ast-color', - 'title' => __( 'Text Color', 'astra' ), - 'default' => astra_get_option( 'footer-adv-text-color' ), - ), - - /** - * Option: Link Color - */ - array( - 'name' => 'footer-adv-link-color', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[footer-widget-link-color-group]', - 'section' => 'section-footer-adv', - 'control' => 'ast-color', - 'title' => __( 'Normal', 'astra' ), - 'default' => astra_get_option( 'footer-adv-link-color' ), - ), - - /** - * Option: Link Hover Color - */ - array( - 'name' => 'footer-adv-link-h-color', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[footer-widget-link-color-group]', - 'section' => 'section-footer-adv', - 'control' => 'ast-color', - 'title' => __( 'Hover', 'astra' ), - 'default' => astra_get_option( 'footer-adv-link-h-color' ), - ), - - /** - * Option: Footer widget Background - */ - array( - 'name' => 'footer-adv-bg-obj', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[footer-widget-background-group]', - 'section' => 'section-footer-adv', - 'control' => 'ast-background', - 'default' => astra_get_option( 'footer-adv-bg-obj' ), - 'label' => __( 'Background', 'astra' ), - ), - ); - - $configurations = array_merge( $configurations, $_configs ); - - return $configurations; - } - } -} - -new Astra_Advanced_Footer_Colors_Configs(); - - + ASTRA_THEME_SETTINGS . '[footer-widget-background-group]', + 'default' => astra_get_option( 'footer-widget-background-group' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Background Color', 'astra' ), + 'section' => 'section-footer-adv', + 'transport' => 'postMessage', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'priority' => 47, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-adv]', + 'operator' => '!=', + 'value' => 'disabled', + ), + + ), + ), + + /** + * Option: Footer Bar Content Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-widget-content-group]', + 'default' => astra_get_option( 'footer-widget-content-group' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Content Colors', 'astra' ), + 'section' => 'section-footer-adv', + 'transport' => 'postMessage', + 'priority' => 48, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-adv]', + 'operator' => '!=', + 'value' => 'disabled', + ), + ), + ), + + /** + * Option: Footer Bar Content Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-widget-link-color-group]', + 'default' => astra_get_option( 'footer-widget-link-color-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Link Color', 'astra' ), + 'section' => 'section-footer-adv', + 'transport' => 'postMessage', + 'priority' => 48, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-adv]', + 'operator' => '!=', + 'value' => 'disabled', + ), + + ), + ), + + /** + * Option: Widget Title Color + */ + array( + 'name' => 'footer-adv-wgt-title-color', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[footer-widget-content-group]', + 'section' => 'section-footer-adv', + 'control' => 'ast-color', + 'title' => __( 'Title Color', 'astra' ), + 'default' => astra_get_option( 'footer-adv-wgt-title-color' ), + ), + + /** + * Option: Text Color + */ + array( + 'name' => 'footer-adv-text-color', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[footer-widget-content-group]', + 'section' => 'section-footer-adv', + 'control' => 'ast-color', + 'title' => __( 'Text Color', 'astra' ), + 'default' => astra_get_option( 'footer-adv-text-color' ), + ), + + /** + * Option: Link Color + */ + array( + 'name' => 'footer-adv-link-color', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[footer-widget-link-color-group]', + 'section' => 'section-footer-adv', + 'control' => 'ast-color', + 'title' => __( 'Normal', 'astra' ), + 'default' => astra_get_option( 'footer-adv-link-color' ), + ), + + /** + * Option: Link Hover Color + */ + array( + 'name' => 'footer-adv-link-h-color', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[footer-widget-link-color-group]', + 'section' => 'section-footer-adv', + 'control' => 'ast-color', + 'title' => __( 'Hover', 'astra' ), + 'default' => astra_get_option( 'footer-adv-link-h-color' ), + ), + + /** + * Option: Footer widget Background + */ + array( + 'name' => 'footer-adv-bg-obj', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[footer-widget-background-group]', + 'section' => 'section-footer-adv', + 'control' => 'ast-background', + 'default' => astra_get_option( 'footer-adv-bg-obj' ), + 'label' => __( 'Background', 'astra' ), + ), + ); + + $configurations = array_merge( $configurations, $_configs ); + + return $configurations; + } + } +} + +new Astra_Advanced_Footer_Colors_Configs(); + + diff --git a/inc/customizer/configurations/colors-background/class-astra-body-colors-configs.php b/inc/customizer/configurations/colors-background/class-astra-body-colors-configs.php index b332f3c..67be0c6 100644 --- a/inc/customizer/configurations/colors-background/class-astra-body-colors-configs.php +++ b/inc/customizer/configurations/colors-background/class-astra-body-colors-configs.php @@ -1,99 +1,99 @@ - ASTRA_THEME_SETTINGS . '[text-color]', - 'default' => astra_get_option( 'text-color' ), - 'type' => 'control', - 'control' => 'ast-color', - 'section' => $_section, - 'priority' => 5, - 'title' => __( 'Text Color', 'astra' ), - ), - - /** - * Option: Theme Color - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[theme-color]', - 'type' => 'control', - 'control' => 'ast-color', - 'section' => $_section, - 'default' => astra_get_option( 'theme-color' ), - 'priority' => 5, - 'title' => __( 'Theme Color', 'astra' ), - ), - - /** - * Option: Link Color - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[link-color]', - 'section' => $_section, - 'type' => 'control', - 'control' => 'ast-color', - 'default' => astra_get_option( 'link-color' ), - 'priority' => 5, - 'title' => __( 'Link Color', 'astra' ), - ), - - /** - * Option: Link Hover Color - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[link-h-color]', - 'section' => $_section, - 'default' => astra_get_option( 'link-h-color' ), - 'type' => 'control', - 'control' => 'ast-color', - 'priority' => 15, - 'title' => __( 'Link Hover Color', 'astra' ), - ), - ); - - $configurations = array_merge( $configurations, $_configs ); - - return $configurations; - } - } -} - -new Astra_Body_Colors_Configs(); - - + ASTRA_THEME_SETTINGS . '[text-color]', + 'default' => astra_get_option( 'text-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'section' => $_section, + 'priority' => 5, + 'title' => __( 'Text Color', 'astra' ), + ), + + /** + * Option: Theme Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[theme-color]', + 'type' => 'control', + 'control' => 'ast-color', + 'section' => $_section, + 'default' => astra_get_option( 'theme-color' ), + 'priority' => 5, + 'title' => __( 'Theme Color', 'astra' ), + ), + + /** + * Option: Link Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[link-color]', + 'section' => $_section, + 'type' => 'control', + 'control' => 'ast-color', + 'default' => astra_get_option( 'link-color' ), + 'priority' => 5, + 'title' => __( 'Link Color', 'astra' ), + ), + + /** + * Option: Link Hover Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[link-h-color]', + 'section' => $_section, + 'default' => astra_get_option( 'link-h-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'priority' => 15, + 'title' => __( 'Link Hover Color', 'astra' ), + ), + ); + + $configurations = array_merge( $configurations, $_configs ); + + return $configurations; + } + } +} + +new Astra_Body_Colors_Configs(); + + diff --git a/inc/customizer/configurations/colors-background/class-astra-footer-colors-configs.php b/inc/customizer/configurations/colors-background/class-astra-footer-colors-configs.php index 9c0cf7f..bca23ba 100644 --- a/inc/customizer/configurations/colors-background/class-astra-footer-colors-configs.php +++ b/inc/customizer/configurations/colors-background/class-astra-footer-colors-configs.php @@ -1,102 +1,102 @@ - 'footer-color', - 'type' => 'sub-control', - 'priority' => 5, - 'parent' => ASTRA_THEME_SETTINGS . '[footer-bar-content-group]', - 'section' => 'section-footer-small', - 'control' => 'ast-color', - 'title' => __( 'Text Color', 'astra' ), - 'default' => astra_get_option( 'footer-color' ), - ), - - /** - * Option: Link Color - */ - array( - 'name' => 'footer-link-color', - 'type' => 'sub-control', - 'priority' => 6, - 'parent' => ASTRA_THEME_SETTINGS . '[footer-bar-link-color-group]', - 'section' => 'section-footer-small', - 'control' => 'ast-color', - 'default' => astra_get_option( 'footer-link-color' ), - 'title' => __( 'Normal', 'astra' ), - ), - - /** - * Option: Link Hover Color - */ - array( - 'name' => 'footer-link-h-color', - 'type' => 'sub-control', - 'priority' => 5, - 'parent' => ASTRA_THEME_SETTINGS . '[footer-bar-link-color-group]', - 'section' => 'section-footer-small', - 'control' => 'ast-color', - 'title' => __( 'Hover', 'astra' ), - 'default' => astra_get_option( 'section-footer-small' ), - ), - - /** - * Option: Footer Background - */ - array( - 'name' => 'footer-bg-obj', - 'type' => 'sub-control', - 'priority' => 7, - 'parent' => ASTRA_THEME_SETTINGS . '[footer-bar-background-group]', - 'section' => 'section-footer-small', - 'transport' => 'postMessage', - 'control' => 'ast-background', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_background_obj' ), - 'default' => astra_get_option( 'footer-bg-obj' ), - 'label' => __( 'Background', 'astra' ), - ), - ); - - $configurations = array_merge( $configurations, $_configs ); - - return $configurations; - } - } -} - -new Astra_Footer_Colors_Configs(); - - + 'footer-color', + 'type' => 'sub-control', + 'priority' => 5, + 'parent' => ASTRA_THEME_SETTINGS . '[footer-bar-content-group]', + 'section' => 'section-footer-small', + 'control' => 'ast-color', + 'title' => __( 'Text Color', 'astra' ), + 'default' => astra_get_option( 'footer-color' ), + ), + + /** + * Option: Link Color + */ + array( + 'name' => 'footer-link-color', + 'type' => 'sub-control', + 'priority' => 6, + 'parent' => ASTRA_THEME_SETTINGS . '[footer-bar-link-color-group]', + 'section' => 'section-footer-small', + 'control' => 'ast-color', + 'default' => astra_get_option( 'footer-link-color' ), + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Link Hover Color + */ + array( + 'name' => 'footer-link-h-color', + 'type' => 'sub-control', + 'priority' => 5, + 'parent' => ASTRA_THEME_SETTINGS . '[footer-bar-link-color-group]', + 'section' => 'section-footer-small', + 'control' => 'ast-color', + 'title' => __( 'Hover', 'astra' ), + 'default' => astra_get_option( 'section-footer-small' ), + ), + + /** + * Option: Footer Background + */ + array( + 'name' => 'footer-bg-obj', + 'type' => 'sub-control', + 'priority' => 7, + 'parent' => ASTRA_THEME_SETTINGS . '[footer-bar-background-group]', + 'section' => 'section-footer-small', + 'transport' => 'postMessage', + 'control' => 'ast-background', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_background_obj' ), + 'default' => astra_get_option( 'footer-bg-obj' ), + 'label' => __( 'Background', 'astra' ), + ), + ); + + $configurations = array_merge( $configurations, $_configs ); + + return $configurations; + } + } +} + +new Astra_Footer_Colors_Configs(); + + diff --git a/inc/customizer/configurations/layout/class-astra-blog-layout-configs.php b/inc/customizer/configurations/layout/class-astra-blog-layout-configs.php index 854604e..8a88f54 100644 --- a/inc/customizer/configurations/layout/class-astra-blog-layout-configs.php +++ b/inc/customizer/configurations/layout/class-astra-blog-layout-configs.php @@ -1,173 +1,173 @@ - ASTRA_THEME_SETTINGS . '[blog-width]', - 'default' => astra_get_option( 'blog-width' ), - 'type' => 'control', - 'control' => 'ast-selector', - 'section' => 'section-blog', - 'priority' => 50, - 'transport' => 'postMessage', - 'title' => __( 'Content Width', 'astra' ), - 'choices' => array( - 'default' => __( 'Default', 'astra' ), - 'custom' => __( 'Custom', 'astra' ), - ), - 'responsive' => false, - 'renderAs' => 'text', - ), - - /** - * Option: Enter Width - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[blog-max-width]', - 'type' => 'control', - 'control' => 'ast-slider', - 'section' => 'section-blog', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'blog-max-width' ), - 'priority' => 50, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[blog-width]', - 'operator' => '===', - 'value' => 'custom', - ), - ), - 'title' => __( 'Custom Width', 'astra' ), - 'suffix' => 'px', - 'input_attrs' => array( - 'min' => 768, - 'step' => 1, - 'max' => 1920, - ), - ), - - /** - * Option: Blog Post Content - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[blog-post-content]', - 'section' => 'section-blog', - 'title' => __( 'Post Content', 'astra' ), - 'default' => astra_get_option( 'blog-post-content' ), - 'type' => 'control', - 'control' => 'ast-selector', - 'priority' => 75, - 'choices' => array( - 'full-content' => __( 'Full Content', 'astra' ), - 'excerpt' => __( 'Excerpt', 'astra' ), - ), - 'responsive' => false, - 'renderAs' => 'text', - ), - - /** - * Option: Display Post Structure - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[blog-post-structure]', - 'default' => astra_get_option( 'blog-post-structure' ), - 'type' => 'control', - 'control' => 'ast-sortable', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), - 'section' => 'section-blog', - 'priority' => 50, - 'title' => __( 'Post Structure', 'astra' ), - 'divider' => array( 'ast_class' => 'ast-top-divider' ), - 'choices' => array( - 'image' => __( 'Featured Image', 'astra' ), - 'title-meta' => __( 'Title & Blog Meta', 'astra' ), - ), - ), - - ); - - if ( ! defined( 'ASTRA_EXT_VER' ) ) { - $_configs[] = array( - 'name' => ASTRA_THEME_SETTINGS . '[blog-meta]', - 'type' => 'control', - 'control' => 'ast-sortable', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), - 'section' => 'section-blog', - 'default' => astra_get_option( 'blog-meta' ), - 'priority' => 50, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[blog-post-structure]', - 'operator' => 'contains', - 'value' => 'title-meta', - ), - ), - 'title' => __( 'Meta', 'astra' ), - 'choices' => array( - 'comments' => __( 'Comments', 'astra' ), - 'category' => __( 'Category', 'astra' ), - 'author' => __( 'Author', 'astra' ), - 'date' => __( 'Publish Date', 'astra' ), - 'tag' => __( 'Tag', 'astra' ), - ), - ); - } - - if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { - - $_configs[] = array( - 'name' => 'section-blog-ast-context-tabs', - 'section' => 'section-blog', - 'type' => 'control', - 'control' => 'ast-builder-header-control', - 'priority' => 0, - 'description' => '', - ); - - } - - $configurations = array_merge( $configurations, $_configs ); - - return $configurations; - - } - } -} - - -new Astra_Blog_Layout_Configs(); + ASTRA_THEME_SETTINGS . '[blog-width]', + 'default' => astra_get_option( 'blog-width' ), + 'type' => 'control', + 'control' => 'ast-selector', + 'section' => 'section-blog', + 'priority' => 50, + 'transport' => 'postMessage', + 'title' => __( 'Content Width', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'custom' => __( 'Custom', 'astra' ), + ), + 'responsive' => false, + 'renderAs' => 'text', + ), + + /** + * Option: Enter Width + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[blog-max-width]', + 'type' => 'control', + 'control' => 'ast-slider', + 'section' => 'section-blog', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'blog-max-width' ), + 'priority' => 50, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[blog-width]', + 'operator' => '===', + 'value' => 'custom', + ), + ), + 'title' => __( 'Custom Width', 'astra' ), + 'suffix' => 'px', + 'input_attrs' => array( + 'min' => 768, + 'step' => 1, + 'max' => 1920, + ), + ), + + /** + * Option: Blog Post Content + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[blog-post-content]', + 'section' => 'section-blog', + 'title' => __( 'Post Content', 'astra' ), + 'default' => astra_get_option( 'blog-post-content' ), + 'type' => 'control', + 'control' => 'ast-selector', + 'priority' => 75, + 'choices' => array( + 'full-content' => __( 'Full Content', 'astra' ), + 'excerpt' => __( 'Excerpt', 'astra' ), + ), + 'responsive' => false, + 'renderAs' => 'text', + ), + + /** + * Option: Display Post Structure + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[blog-post-structure]', + 'default' => astra_get_option( 'blog-post-structure' ), + 'type' => 'control', + 'control' => 'ast-sortable', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), + 'section' => 'section-blog', + 'priority' => 50, + 'title' => __( 'Post Structure', 'astra' ), + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + 'choices' => array( + 'image' => __( 'Featured Image', 'astra' ), + 'title-meta' => __( 'Title & Blog Meta', 'astra' ), + ), + ), + + ); + + if ( ! defined( 'ASTRA_EXT_VER' ) ) { + $_configs[] = array( + 'name' => ASTRA_THEME_SETTINGS . '[blog-meta]', + 'type' => 'control', + 'control' => 'ast-sortable', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), + 'section' => 'section-blog', + 'default' => astra_get_option( 'blog-meta' ), + 'priority' => 50, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[blog-post-structure]', + 'operator' => 'contains', + 'value' => 'title-meta', + ), + ), + 'title' => __( 'Meta', 'astra' ), + 'choices' => array( + 'comments' => __( 'Comments', 'astra' ), + 'category' => __( 'Category', 'astra' ), + 'author' => __( 'Author', 'astra' ), + 'date' => __( 'Publish Date', 'astra' ), + 'tag' => __( 'Tag', 'astra' ), + ), + ); + } + + if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { + + $_configs[] = array( + 'name' => 'section-blog-ast-context-tabs', + 'section' => 'section-blog', + 'type' => 'control', + 'control' => 'ast-builder-header-control', + 'priority' => 0, + 'description' => '', + ); + + } + + $configurations = array_merge( $configurations, $_configs ); + + return $configurations; + + } + } +} + + +new Astra_Blog_Layout_Configs(); diff --git a/inc/customizer/configurations/layout/class-astra-blog-single-layout-configs.php b/inc/customizer/configurations/layout/class-astra-blog-single-layout-configs.php index 7437479..9f8938e 100644 --- a/inc/customizer/configurations/layout/class-astra-blog-single-layout-configs.php +++ b/inc/customizer/configurations/layout/class-astra-blog-single-layout-configs.php @@ -1,156 +1,156 @@ - ASTRA_THEME_SETTINGS . '[blog-single-width]', - 'type' => 'control', - 'control' => 'ast-selector', - 'section' => 'section-blog-single', - 'default' => astra_get_option( 'blog-single-width' ), - 'priority' => 5, - 'title' => __( 'Content Width', 'astra' ), - 'choices' => array( - 'default' => __( 'Default', 'astra' ), - 'custom' => __( 'Custom', 'astra' ), - ), - 'transport' => 'postMessage', - 'responsive' => false, - 'renderAs' => 'text', - ), - - /** - * Option: Enter Width - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[blog-single-max-width]', - 'type' => 'control', - 'control' => 'ast-slider', - 'section' => 'section-blog-single', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'blog-single-max-width' ), - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[blog-single-width]', - 'operator' => '===', - 'value' => 'custom', - ), - ), - 'priority' => 5, - 'title' => __( 'Custom Width', 'astra' ), - 'suffix' => 'px', - 'input_attrs' => array( - 'min' => 768, - 'step' => 1, - 'max' => 1920, - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - - /** - * Option: Display Post Structure - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[blog-single-post-structure]', - 'type' => 'control', - 'control' => 'ast-sortable', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), - 'section' => 'section-blog-single', - 'default' => astra_get_option( 'blog-single-post-structure' ), - 'priority' => 5, - 'title' => __( 'Structure', 'astra' ), - 'choices' => array( - 'single-image' => __( 'Featured Image', 'astra' ), - 'single-title-meta' => __( 'Title & Blog Meta', 'astra' ), - ), - ), - - ); - - if ( ! defined( 'ASTRA_EXT_VER' ) ) { - $_configs[] = array( - 'name' => ASTRA_THEME_SETTINGS . '[blog-single-meta]', - 'type' => 'control', - 'control' => 'ast-sortable', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), - 'default' => astra_get_option( 'blog-single-meta' ), - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[blog-single-post-structure]', - 'operator' => 'contains', - 'value' => 'single-title-meta', - ), - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'section' => 'section-blog-single', - 'priority' => 5, - 'title' => __( 'Meta', 'astra' ), - 'choices' => array( - 'comments' => __( 'Comments', 'astra' ), - 'category' => __( 'Category', 'astra' ), - 'author' => __( 'Author', 'astra' ), - 'date' => __( 'Publish Date', 'astra' ), - 'tag' => __( 'Tag', 'astra' ), - ), - ); - } - - if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { - - $_configs[] = array( - 'name' => 'section-blog-single-ast-context-tabs', - 'section' => 'section-blog-single', - 'type' => 'control', - 'control' => 'ast-builder-header-control', - 'priority' => 0, - 'description' => '', - ); - - } - - $configurations = array_merge( $configurations, $_configs ); - - return $configurations; - - } - } -} - - -new Astra_Blog_Single_Layout_Configs(); + ASTRA_THEME_SETTINGS . '[blog-single-width]', + 'type' => 'control', + 'control' => 'ast-selector', + 'section' => 'section-blog-single', + 'default' => astra_get_option( 'blog-single-width' ), + 'priority' => 5, + 'title' => __( 'Content Width', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'custom' => __( 'Custom', 'astra' ), + ), + 'transport' => 'postMessage', + 'responsive' => false, + 'renderAs' => 'text', + ), + + /** + * Option: Enter Width + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[blog-single-max-width]', + 'type' => 'control', + 'control' => 'ast-slider', + 'section' => 'section-blog-single', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'blog-single-max-width' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[blog-single-width]', + 'operator' => '===', + 'value' => 'custom', + ), + ), + 'priority' => 5, + 'title' => __( 'Custom Width', 'astra' ), + 'suffix' => 'px', + 'input_attrs' => array( + 'min' => 768, + 'step' => 1, + 'max' => 1920, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + + /** + * Option: Display Post Structure + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[blog-single-post-structure]', + 'type' => 'control', + 'control' => 'ast-sortable', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), + 'section' => 'section-blog-single', + 'default' => astra_get_option( 'blog-single-post-structure' ), + 'priority' => 5, + 'title' => __( 'Structure', 'astra' ), + 'choices' => array( + 'single-image' => __( 'Featured Image', 'astra' ), + 'single-title-meta' => __( 'Title & Blog Meta', 'astra' ), + ), + ), + + ); + + if ( ! defined( 'ASTRA_EXT_VER' ) ) { + $_configs[] = array( + 'name' => ASTRA_THEME_SETTINGS . '[blog-single-meta]', + 'type' => 'control', + 'control' => 'ast-sortable', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), + 'default' => astra_get_option( 'blog-single-meta' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[blog-single-post-structure]', + 'operator' => 'contains', + 'value' => 'single-title-meta', + ), + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'section' => 'section-blog-single', + 'priority' => 5, + 'title' => __( 'Meta', 'astra' ), + 'choices' => array( + 'comments' => __( 'Comments', 'astra' ), + 'category' => __( 'Category', 'astra' ), + 'author' => __( 'Author', 'astra' ), + 'date' => __( 'Publish Date', 'astra' ), + 'tag' => __( 'Tag', 'astra' ), + ), + ); + } + + if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { + + $_configs[] = array( + 'name' => 'section-blog-single-ast-context-tabs', + 'section' => 'section-blog-single', + 'type' => 'control', + 'control' => 'ast-builder-header-control', + 'priority' => 0, + 'description' => '', + ); + + } + + $configurations = array_merge( $configurations, $_configs ); + + return $configurations; + + } + } +} + + +new Astra_Blog_Single_Layout_Configs(); diff --git a/inc/customizer/configurations/layout/class-astra-footer-layout-configs.php b/inc/customizer/configurations/layout/class-astra-footer-layout-configs.php index 68eba96..79da36a 100644 --- a/inc/customizer/configurations/layout/class-astra-footer-layout-configs.php +++ b/inc/customizer/configurations/layout/class-astra-footer-layout-configs.php @@ -1,482 +1,482 @@ - ASTRA_THEME_SETTINGS . '[footer-sml-layout]', - 'type' => 'control', - 'control' => 'ast-radio-image', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), - 'default' => astra_get_option( 'footer-sml-layout' ), - 'section' => 'section-footer-small', - 'priority' => 5, - 'title' => __( 'Layout', 'astra' ), - 'choices' => array( - 'disabled' => array( - 'label' => __( 'Disabled', 'astra' ), - 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'disabled' ), - ), - 'footer-sml-layout-1' => array( - 'label' => __( 'Footer Bar Layout 1', 'astra' ), - 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'footer-layout-1' ), - ), - 'footer-sml-layout-2' => array( - 'label' => __( 'Footer Bar Layout 2', 'astra' ), - 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'footer-layout-2' ), - ), - ), - 'partial' => array( - 'selector' => '.ast-small-footer', - 'container_inclusive' => false, - ), - ), - - /** - * Section: Section 1 - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-sml-section-1]', - 'control' => 'ast-selector', - 'default' => astra_get_option( 'footer-sml-section-1' ), - 'type' => 'control', - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', - 'operator' => '!=', - 'value' => 'disabled', - ), - ), - 'section' => 'section-footer-small', - 'priority' => 15, - 'title' => __( 'Section 1', 'astra' ), - 'divider' => array( 'ast_class' => 'ast-top-divider' ), - 'choices' => array( - '' => __( 'None', 'astra' ), - 'custom' => __( 'Text', 'astra' ), - 'widget' => __( 'Widget', 'astra' ), - 'menu' => __( 'Footer Menu', 'astra' ), - ), - 'partial' => array( - 'selector' => '.ast-small-footer .ast-container .ast-footer-widget-1-area .ast-no-widget-row, .ast-small-footer .ast-container .ast-small-footer-section-1 .footer-primary-navigation .nav-menu', - 'container_inclusive' => false, - ), - 'responsive' => false, - 'renderAs' => 'text', - ), - /** - * Option: Section 1 Custom Text - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-sml-section-1-credit]', - 'default' => astra_get_option( 'footer-sml-section-1-credit' ), - 'type' => 'control', - 'control' => 'textarea', - 'transport' => 'postMessage', - 'section' => 'section-footer-small', - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-section-1]', - 'operator' => '==', - 'value' => array( 'custom' ), - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', - 'operator' => '!=', - 'value' => 'disabled', - ), - ), - 'priority' => 20, - 'title' => __( 'Section 1 Custom Text', 'astra' ), - 'choices' => array( - '' => __( 'None', 'astra' ), - 'custom' => __( 'Custom Text', 'astra' ), - 'widget' => __( 'Widget', 'astra' ), - 'menu' => __( 'Footer Menu', 'astra' ), - ), - 'partial' => array( - 'selector' => '.ast-small-footer .ast-container .ast-small-footer-section.ast-small-footer-section-1:has(> .ast-footer-site-title)', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Customizer_Partials::render_footer_sml_section_1_credit', - ), - ), - - /** - * Option: Section 2 - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-sml-section-2]', - 'type' => 'control', - 'control' => 'ast-selector', - 'default' => astra_get_option( 'footer-sml-section-2' ), - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', - 'operator' => '!=', - 'value' => 'disabled', - ), - ), - 'section' => 'section-footer-small', - 'priority' => 25, - 'title' => __( 'Section 2', 'astra' ), - 'choices' => array( - '' => __( 'None', 'astra' ), - 'custom' => __( 'Text', 'astra' ), - 'widget' => __( 'Widget', 'astra' ), - 'menu' => __( 'Footer Menu', 'astra' ), - ), - 'partial' => array( - 'selector' => '.ast-small-footer .ast-container .ast-footer-widget-2-area .ast-no-widget-row, .ast-small-footer .ast-container .ast-small-footer-section-2 .footer-primary-navigation .nav-menu', - 'container_inclusive' => false, - ), - 'responsive' => false, - 'renderAs' => 'text', - ), - - /** - * Option: Section 2 Custom Text - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-sml-section-2-credit]', - 'type' => 'control', - 'control' => 'textarea', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'footer-sml-section-2-credit' ), - 'section' => 'section-footer-small', - 'priority' => 30, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-section-2]', - 'operator' => '==', - 'value' => 'custom', - ), - ), - 'title' => __( 'Section 2 Custom Text', 'astra' ), - 'partial' => array( - 'selector' => '.ast-small-footer-section-2', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Customizer_Partials::render_footer_sml_section_2_credit', - ), - 'partial' => array( - 'selector' => '.ast-small-footer .ast-container .ast-small-footer-section.ast-small-footer-section-2:has(> .ast-footer-site-title)', - 'container_inclusive' => false, - ), - ), - - /** - * Option: Footer Top Border - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-sml-divider]', - 'type' => 'control', - 'control' => 'ast-slider', - 'default' => astra_get_option( 'footer-sml-divider' ), - 'section' => 'section-footer-small', - 'priority' => 40, - 'suffix' => 'px', - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', - 'operator' => '!=', - 'value' => 'disabled', - ), - ), - 'title' => __( 'Border Size', 'astra' ), - 'transport' => 'postMessage', - 'input_attrs' => array( - 'min' => 0, - 'step' => 1, - 'max' => 600, - ), - ), - - /** - * Option: Footer Top Border Color - */ - - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-sml-divider-color]', - 'section' => 'section-footer-small', - 'default' => astra_get_option( 'footer-sml-divider-color', '#7a7a7a' ), - 'type' => 'control', - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-divider]', - 'operator' => '>=', - 'value' => 1, - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', - 'operator' => '!=', - 'value' => 'disabled', - ), - ), - 'priority' => 45, - 'title' => __( 'Border Color', 'astra' ), - 'transport' => 'postMessage', - ), - - /** - * Option: Footer Bar Content Group - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-bar-background-group]', - 'default' => astra_get_option( 'footer-bar-background-group' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => __( 'Background Color', 'astra' ), - 'section' => 'section-footer-small', - 'transport' => 'postMessage', - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'priority' => 47, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', - 'operator' => '!=', - 'value' => 'disabled', - ), - ), - ), - - /** - * Option: Footer Bar Content Group - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-bar-content-group]', - 'default' => astra_get_option( 'footer-bar-content-group' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => __( 'Content Colors', 'astra' ), - 'section' => 'section-footer-small', - 'transport' => 'postMessage', - 'priority' => 47, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', - 'operator' => '!=', - 'value' => 'disabled', - ), - ), - ), - - /** - * Option: Footer Bar Content Group - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-bar-link-color-group]', - 'default' => astra_get_option( 'footer-bar-link-color-group' ), - 'type' => 'control', - 'control' => 'ast-color-group', - 'title' => __( 'Link Color', 'astra' ), - 'section' => 'section-footer-small', - 'transport' => 'postMessage', - 'priority' => 47, - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', - 'operator' => '!=', - 'value' => 'disabled', - ), - ), - ), - - /** - * Option: Header Width - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-layout-width]', - 'type' => 'control', - 'control' => 'ast-selector', - 'default' => astra_get_option( 'footer-layout-width' ), - 'section' => 'section-footer-small', - 'divider' => array( 'ast_class' => 'ast-top-divider ast-bottom-divider' ), - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[site-layout]', - 'operator' => '!=', - 'value' => 'ast-box-layout', - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[site-layout]', - 'operator' => '!=', - 'value' => 'ast-fluid-width-layout', - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', - 'operator' => '!=', - 'value' => 'disabled', - ), - ), - 'priority' => 35, - 'title' => __( 'Width', 'astra' ), - 'choices' => array( - 'full' => __( 'Full Width', 'astra' ), - 'content' => __( 'Content Width', 'astra' ), - ), - 'responsive' => false, - 'renderAs' => 'text', - ), - - /** - * Option: Footer Top Border - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-adv-border-width]', - 'type' => 'control', - 'control' => 'ast-slider', - 'transport' => 'postMessage', - 'section' => 'section-footer-adv', - 'default' => astra_get_option( 'footer-adv-border-width' ), - 'priority' => 40, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-adv]', - 'operator' => '!=', - 'value' => 'disabled', - ), - ), - 'suffix' => 'px', - 'title' => __( 'Top Border Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - 'step' => 1, - 'max' => 600, - ), - ), - - /** - * Option: Footer Top Border Color - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-adv-border-color]', - 'section' => 'section-footer-adv', - 'title' => __( 'Top Border Color', 'astra' ), - 'type' => 'control', - 'transport' => 'postMessage', - 'control' => 'ast-color', - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'default' => astra_get_option( 'footer-adv-border-color' ), - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[footer-adv]', - 'operator' => '!=', - 'value' => 'disabled', - ), - ), - 'priority' => 45, - ), - ); - - $configurations = array_merge( $configurations, $_configs ); - - // Learn More link if Astra Pro is not activated. - if ( ! defined( 'ASTRA_EXT_VER' ) || ( defined( 'ASTRA_EXT_VER' ) && false === Astra_Ext_Extension::is_active( 'advanced-footer' ) ) ) { - - $config = array( - - /** - * Option: Footer Widgets Layout Layout - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[footer-adv]', - 'type' => 'control', - 'priority' => 0, - 'control' => 'ast-radio-image', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), - 'default' => astra_get_option( 'footer-adv' ), - 'title' => __( 'Layout', 'astra' ), - 'section' => 'section-footer-adv', - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'choices' => array( - 'disabled' => array( - 'label' => __( 'Disable', 'astra' ), - 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'disabled' ), - ), - 'layout-4' => array( - 'label' => __( 'Layout 4', 'astra' ), - 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'footer-layout-4' ), - ), - ), - 'partial' => array( - 'selector' => '.footer-adv .ast-container', - 'container_inclusive' => false, - ), - ), - - /** - * Option: Learn More about Footer Widget - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[ast-footer-widget-more-feature-description]', - 'type' => 'control', - 'control' => 'ast-description', - 'section' => 'section-footer-adv', - 'priority' => 999, - 'label' => '', - 'help' => '

    ' . __( 'More Options Available in Astra Pro!', 'astra' ) . '

    ' . __( 'Learn More', 'astra' ) . '', - 'settings' => array(), - ), - - ); - - $configurations = array_merge( $configurations, $config ); - } - - return $configurations; - - } - } -} - - -new Astra_Footer_Layout_Configs(); + ASTRA_THEME_SETTINGS . '[footer-sml-layout]', + 'type' => 'control', + 'control' => 'ast-radio-image', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), + 'default' => astra_get_option( 'footer-sml-layout' ), + 'section' => 'section-footer-small', + 'priority' => 5, + 'title' => __( 'Layout', 'astra' ), + 'choices' => array( + 'disabled' => array( + 'label' => __( 'Disabled', 'astra' ), + 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'disabled' ), + ), + 'footer-sml-layout-1' => array( + 'label' => __( 'Footer Bar Layout 1', 'astra' ), + 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'footer-layout-1' ), + ), + 'footer-sml-layout-2' => array( + 'label' => __( 'Footer Bar Layout 2', 'astra' ), + 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'footer-layout-2' ), + ), + ), + 'partial' => array( + 'selector' => '.ast-small-footer', + 'container_inclusive' => false, + ), + ), + + /** + * Section: Section 1 + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-sml-section-1]', + 'control' => 'ast-selector', + 'default' => astra_get_option( 'footer-sml-section-1' ), + 'type' => 'control', + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', + 'operator' => '!=', + 'value' => 'disabled', + ), + ), + 'section' => 'section-footer-small', + 'priority' => 15, + 'title' => __( 'Section 1', 'astra' ), + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + 'choices' => array( + '' => __( 'None', 'astra' ), + 'custom' => __( 'Text', 'astra' ), + 'widget' => __( 'Widget', 'astra' ), + 'menu' => __( 'Footer Menu', 'astra' ), + ), + 'partial' => array( + 'selector' => '.ast-small-footer .ast-container .ast-footer-widget-1-area .ast-no-widget-row, .ast-small-footer .ast-container .ast-small-footer-section-1 .footer-primary-navigation .nav-menu', + 'container_inclusive' => false, + ), + 'responsive' => false, + 'renderAs' => 'text', + ), + /** + * Option: Section 1 Custom Text + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-sml-section-1-credit]', + 'default' => astra_get_option( 'footer-sml-section-1-credit' ), + 'type' => 'control', + 'control' => 'textarea', + 'transport' => 'postMessage', + 'section' => 'section-footer-small', + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-section-1]', + 'operator' => '==', + 'value' => array( 'custom' ), + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', + 'operator' => '!=', + 'value' => 'disabled', + ), + ), + 'priority' => 20, + 'title' => __( 'Section 1 Custom Text', 'astra' ), + 'choices' => array( + '' => __( 'None', 'astra' ), + 'custom' => __( 'Custom Text', 'astra' ), + 'widget' => __( 'Widget', 'astra' ), + 'menu' => __( 'Footer Menu', 'astra' ), + ), + 'partial' => array( + 'selector' => '.ast-small-footer .ast-container .ast-small-footer-section.ast-small-footer-section-1:has(> .ast-footer-site-title)', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Customizer_Partials::render_footer_sml_section_1_credit', + ), + ), + + /** + * Option: Section 2 + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-sml-section-2]', + 'type' => 'control', + 'control' => 'ast-selector', + 'default' => astra_get_option( 'footer-sml-section-2' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', + 'operator' => '!=', + 'value' => 'disabled', + ), + ), + 'section' => 'section-footer-small', + 'priority' => 25, + 'title' => __( 'Section 2', 'astra' ), + 'choices' => array( + '' => __( 'None', 'astra' ), + 'custom' => __( 'Text', 'astra' ), + 'widget' => __( 'Widget', 'astra' ), + 'menu' => __( 'Footer Menu', 'astra' ), + ), + 'partial' => array( + 'selector' => '.ast-small-footer .ast-container .ast-footer-widget-2-area .ast-no-widget-row, .ast-small-footer .ast-container .ast-small-footer-section-2 .footer-primary-navigation .nav-menu', + 'container_inclusive' => false, + ), + 'responsive' => false, + 'renderAs' => 'text', + ), + + /** + * Option: Section 2 Custom Text + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-sml-section-2-credit]', + 'type' => 'control', + 'control' => 'textarea', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'footer-sml-section-2-credit' ), + 'section' => 'section-footer-small', + 'priority' => 30, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-section-2]', + 'operator' => '==', + 'value' => 'custom', + ), + ), + 'title' => __( 'Section 2 Custom Text', 'astra' ), + 'partial' => array( + 'selector' => '.ast-small-footer-section-2', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Customizer_Partials::render_footer_sml_section_2_credit', + ), + 'partial' => array( + 'selector' => '.ast-small-footer .ast-container .ast-small-footer-section.ast-small-footer-section-2:has(> .ast-footer-site-title)', + 'container_inclusive' => false, + ), + ), + + /** + * Option: Footer Top Border + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-sml-divider]', + 'type' => 'control', + 'control' => 'ast-slider', + 'default' => astra_get_option( 'footer-sml-divider' ), + 'section' => 'section-footer-small', + 'priority' => 40, + 'suffix' => 'px', + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', + 'operator' => '!=', + 'value' => 'disabled', + ), + ), + 'title' => __( 'Border Size', 'astra' ), + 'transport' => 'postMessage', + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 600, + ), + ), + + /** + * Option: Footer Top Border Color + */ + + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-sml-divider-color]', + 'section' => 'section-footer-small', + 'default' => astra_get_option( 'footer-sml-divider-color', '#7a7a7a' ), + 'type' => 'control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-divider]', + 'operator' => '>=', + 'value' => 1, + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', + 'operator' => '!=', + 'value' => 'disabled', + ), + ), + 'priority' => 45, + 'title' => __( 'Border Color', 'astra' ), + 'transport' => 'postMessage', + ), + + /** + * Option: Footer Bar Content Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-bar-background-group]', + 'default' => astra_get_option( 'footer-bar-background-group' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Background Color', 'astra' ), + 'section' => 'section-footer-small', + 'transport' => 'postMessage', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'priority' => 47, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', + 'operator' => '!=', + 'value' => 'disabled', + ), + ), + ), + + /** + * Option: Footer Bar Content Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-bar-content-group]', + 'default' => astra_get_option( 'footer-bar-content-group' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Content Colors', 'astra' ), + 'section' => 'section-footer-small', + 'transport' => 'postMessage', + 'priority' => 47, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', + 'operator' => '!=', + 'value' => 'disabled', + ), + ), + ), + + /** + * Option: Footer Bar Content Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-bar-link-color-group]', + 'default' => astra_get_option( 'footer-bar-link-color-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Link Color', 'astra' ), + 'section' => 'section-footer-small', + 'transport' => 'postMessage', + 'priority' => 47, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', + 'operator' => '!=', + 'value' => 'disabled', + ), + ), + ), + + /** + * Option: Header Width + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-layout-width]', + 'type' => 'control', + 'control' => 'ast-selector', + 'default' => astra_get_option( 'footer-layout-width' ), + 'section' => 'section-footer-small', + 'divider' => array( 'ast_class' => 'ast-top-divider ast-bottom-divider' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[site-layout]', + 'operator' => '!=', + 'value' => 'ast-box-layout', + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[site-layout]', + 'operator' => '!=', + 'value' => 'ast-fluid-width-layout', + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-sml-layout]', + 'operator' => '!=', + 'value' => 'disabled', + ), + ), + 'priority' => 35, + 'title' => __( 'Width', 'astra' ), + 'choices' => array( + 'full' => __( 'Full Width', 'astra' ), + 'content' => __( 'Content Width', 'astra' ), + ), + 'responsive' => false, + 'renderAs' => 'text', + ), + + /** + * Option: Footer Top Border + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-adv-border-width]', + 'type' => 'control', + 'control' => 'ast-slider', + 'transport' => 'postMessage', + 'section' => 'section-footer-adv', + 'default' => astra_get_option( 'footer-adv-border-width' ), + 'priority' => 40, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-adv]', + 'operator' => '!=', + 'value' => 'disabled', + ), + ), + 'suffix' => 'px', + 'title' => __( 'Top Border Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 600, + ), + ), + + /** + * Option: Footer Top Border Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-adv-border-color]', + 'section' => 'section-footer-adv', + 'title' => __( 'Top Border Color', 'astra' ), + 'type' => 'control', + 'transport' => 'postMessage', + 'control' => 'ast-color', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'default' => astra_get_option( 'footer-adv-border-color' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[footer-adv]', + 'operator' => '!=', + 'value' => 'disabled', + ), + ), + 'priority' => 45, + ), + ); + + $configurations = array_merge( $configurations, $_configs ); + + // Learn More link if Astra Pro is not activated. + if ( ! defined( 'ASTRA_EXT_VER' ) || ( defined( 'ASTRA_EXT_VER' ) && false === Astra_Ext_Extension::is_active( 'advanced-footer' ) ) ) { + + $config = array( + + /** + * Option: Footer Widgets Layout Layout + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-adv]', + 'type' => 'control', + 'priority' => 0, + 'control' => 'ast-radio-image', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), + 'default' => astra_get_option( 'footer-adv' ), + 'title' => __( 'Layout', 'astra' ), + 'section' => 'section-footer-adv', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'choices' => array( + 'disabled' => array( + 'label' => __( 'Disable', 'astra' ), + 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'disabled' ), + ), + 'layout-4' => array( + 'label' => __( 'Layout 4', 'astra' ), + 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'footer-layout-4' ), + ), + ), + 'partial' => array( + 'selector' => '.footer-adv .ast-container', + 'container_inclusive' => false, + ), + ), + + /** + * Option: Learn More about Footer Widget + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[ast-footer-widget-more-feature-description]', + 'type' => 'control', + 'control' => 'ast-description', + 'section' => 'section-footer-adv', + 'priority' => 999, + 'label' => '', + 'help' => '

    ' . __( 'More Options Available in Astra Pro!', 'astra' ) . '

    ' . __( 'Learn More', 'astra' ) . '', + 'settings' => array(), + ), + + ); + + $configurations = array_merge( $configurations, $config ); + } + + return $configurations; + + } + } +} + + +new Astra_Footer_Layout_Configs(); diff --git a/inc/customizer/configurations/layout/class-astra-header-layout-configs.php b/inc/customizer/configurations/layout/class-astra-header-layout-configs.php index 29d25df..8c6549e 100644 --- a/inc/customizer/configurations/layout/class-astra-header-layout-configs.php +++ b/inc/customizer/configurations/layout/class-astra-header-layout-configs.php @@ -1,684 +1,684 @@ - ASTRA_THEME_SETTINGS . '[header-layouts]', - 'default' => astra_get_option( 'header-layouts' ), - 'section' => 'section-header', - 'priority' => 4, - 'title' => __( 'Layout', 'astra' ), - 'type' => 'control', - 'control' => 'ast-radio-image', - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), - 'choices' => array( - 'header-main-layout-1' => array( - 'label' => __( 'Logo Left', 'astra' ), - 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'header-main-layout-1' ), - ), - 'header-main-layout-2' => array( - 'label' => __( 'Logo Center', 'astra' ), - 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'header-main-layout-2' ), - ), - 'header-main-layout-3' => array( - 'label' => __( 'Logo Right', 'astra' ), - 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'header-main-layout-3' ), - ), - ), - ), - - /** - * Option: Header Width - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-main-layout-width]', - 'default' => astra_get_option( 'header-main-layout-width' ), - 'type' => 'control', - 'control' => 'ast-select', - 'section' => 'section-header', - 'priority' => 4, - 'title' => __( 'Width', 'astra' ), - 'choices' => array( - 'full' => __( 'Full Width', 'astra' ), - 'content' => __( 'Content Width', 'astra' ), - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - /** - * Option: Bottom Border Size - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-main-sep]', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'header-main-sep' ), - 'type' => 'control', - 'control' => 'number', - 'section' => 'section-header', - 'priority' => 4, - 'title' => __( 'Bottom Border Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - 'step' => 1, - 'max' => 600, - ), - ), - - /** - * Option: Bottom Border Color - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-main-sep-color]', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'header-main-sep-color' ), - 'type' => 'control', - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-sep]', - 'operator' => '>=', - 'value' => 1, - ), - ), - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'section' => 'section-header', - 'priority' => 4, - 'title' => __( 'Bottom Border Color', 'astra' ), - ), - - array( - 'name' => ASTRA_THEME_SETTINGS . '[disable-primary-nav]', - 'default' => astra_get_option( 'disable-primary-nav' ), - 'type' => 'control', - 'control' => 'ast-toggle-control', - 'section' => 'section-primary-menu', - 'title' => __( 'Disable Menu', 'astra' ), - 'priority' => 5, - 'partial' => array( - 'selector' => '.main-header-bar .main-navigation', - 'container_inclusive' => false, - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'default' => astra_get_option( 'header-main-rt-section' ), - 'type' => 'control', - 'control' => 'ast-select', - 'section' => 'section-primary-menu', - 'priority' => 7, - 'title' => __( 'Last Item in Menu', 'astra' ), - 'choices' => apply_filters( - 'astra_header_section_elements', - array( - 'none' => __( 'None', 'astra' ), - 'search' => __( 'Search', 'astra' ), - 'button' => __( 'Button', 'astra' ), - 'text-html' => __( 'Text / HTML', 'astra' ), - 'widget' => __( 'Widget', 'astra' ), - ), - 'primary-header' - ), - 'partial' => array( - 'selector' => '.main-header-bar .main-navigation .main-header-menu .ast-masthead-custom-menu-items.search-custom-menu-item .ast-search-icon .astra-search-icon, .main-header-bar .main-navigation .main-header-menu .ast-masthead-custom-menu-items.woocommerce-custom-menu-item, .main-header-bar .ast-masthead-custom-menu-items.widget-custom-menu-item .ast-header-widget-area .widget.ast-no-widget-row, .main-header-bar .main-navigation .main-header-menu .ast-masthead-custom-menu-items.edd-custom-menu-item', - 'container_inclusive' => false, - ), - ), - - /** - * Option: Button Text - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-text]', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'header-main-rt-section-button-text' ), - 'type' => 'control', - 'control' => 'text', - 'section' => 'section-primary-menu', - 'partial' => array( - 'selector' => '.button-custom-menu-item', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Customizer_Partials::render_header_main_rt_section_button_text', - ), - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'operator' => '===', - 'value' => 'button', - ), - ), - 'priority' => 10, - 'title' => __( 'Button Text', 'astra' ), - ), - - /** - * Option: Button Link - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-link-option]', - 'default' => astra_get_option( 'header-main-rt-section-button-link-option' ), - 'type' => 'control', - 'control' => 'ast-link', - 'section' => 'section-primary-menu', - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'operator' => '===', - 'value' => 'button', - ), - ), - 'priority' => 10, - 'title' => __( 'Button Link', 'astra' ), - ), - - /** - * Option: Button Style - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', - 'default' => astra_get_option( 'header-main-rt-section-button-style' ), - 'type' => 'control', - 'control' => 'ast-select', - 'section' => 'section-primary-menu', - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'operator' => '===', - 'value' => 'button', - ), - ), - 'priority' => 10, - 'choices' => array( - 'theme-button' => __( 'Theme Button', 'astra' ), - 'custom-button' => __( 'Header Button', 'astra' ), - ), - 'title' => __( 'Button Style', 'astra' ), - ), - - /** - * Option: Theme Button Style edit link - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-button-style-link]', - 'default' => astra_get_option( 'header-button-style-link' ), - 'type' => 'control', - 'control' => 'ast-customizer-link', - 'section' => 'section-primary-menu', - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'operator' => '===', - 'value' => 'button', - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', - 'operator' => '===', - 'value' => 'theme-button', - ), - ), - 'priority' => 10, - 'link_type' => 'section', - 'linked' => 'section-buttons', - 'link_text' => __( 'Customize Button Style.', 'astra' ), - ), - - /** - * Option: Right Section Text / HTML - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-html]', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'header-main-rt-section-html' ), - 'type' => 'control', - 'control' => 'textarea', - 'section' => 'section-primary-menu', - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'operator' => '===', - 'value' => 'text-html', - ), - ), - 'priority' => 10, - 'partial' => array( - 'selector' => '.main-header-bar .ast-masthead-custom-menu-items .ast-custom-html', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Customizer_Partials::render_header_main_rt_section_html', - ), - 'title' => __( 'Custom Menu Text / HTML', 'astra' ), - ), - - array( - 'name' => 'primary-header-sub-menu-label-divider', - 'type' => 'control', - 'control' => 'ast-heading', - 'priority' => 30, - 'title' => __( 'Sub Menu', 'astra' ), - 'section' => 'section-primary-menu', - 'settings' => array(), - ), - - /** - * Option: Submenu Container Animation - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-main-submenu-container-animation]', - 'default' => astra_get_option( 'header-main-submenu-container-animation' ), - 'type' => 'control', - 'control' => 'ast-select', - 'section' => 'section-primary-menu', - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[disable-primary-nav]', - 'operator' => '!=', - 'value' => true, - ), - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'priority' => 30, - 'title' => __( 'Submenu Animation', 'astra' ), - 'choices' => array( - '' => __( 'None', 'astra' ), - 'slide-down' => __( 'Slide Down', 'astra' ), - 'slide-up' => __( 'Slide Up', 'astra' ), - 'fade' => __( 'Fade', 'astra' ), - ), - ), - - // Option: Primary Menu Border. - array( - 'type' => 'control', - 'control' => 'ast-border', - 'transport' => 'postMessage', - 'name' => ASTRA_THEME_SETTINGS . '[primary-submenu-border]', - 'section' => 'section-primary-menu', - 'linked_choices' => true, - 'priority' => 30, - 'default' => astra_get_option( 'primary-submenu-border' ), - 'title' => __( 'Container Border', 'astra' ), - 'choices' => array( - 'top' => __( 'Top', 'astra' ), - 'right' => __( 'Right', 'astra' ), - 'bottom' => __( 'Bottom', 'astra' ), - 'left' => __( 'Left', 'astra' ), - ), - ), - - // Option: Submenu Container Border Color. - array( - 'type' => 'control', - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'transport' => 'postMessage', - 'name' => ASTRA_THEME_SETTINGS . '[primary-submenu-b-color]', - 'default' => astra_get_option( 'primary-submenu-b-color' ), - 'title' => __( 'Border Color', 'astra' ), - 'section' => 'section-primary-menu', - 'priority' => 30, - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - array( - 'type' => 'control', - 'control' => 'ast-toggle-control', - 'transport' => 'postMessage', - 'name' => ASTRA_THEME_SETTINGS . '[primary-submenu-item-border]', - 'section' => 'section-primary-menu', - 'priority' => 30, - 'default' => astra_get_option( 'primary-submenu-item-border' ), - 'title' => __( 'Submenu Divider', 'astra' ), - ), - - // Option: Submenu item Border Color. - array( - 'type' => 'control', - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'transport' => 'postMessage', - 'name' => ASTRA_THEME_SETTINGS . '[primary-submenu-item-b-color]', - 'default' => astra_get_option( 'primary-submenu-item-b-color' ), - 'title' => __( 'Divider Color', 'astra' ), - 'section' => 'section-primary-menu', - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[primary-submenu-item-border]', - 'operator' => '==', - 'value' => true, - ), - ), - 'priority' => 30, - ), - - /** - * Option: Mobile Menu Label Divider - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-main-menu-label-divider]', - 'type' => 'control', - 'control' => 'ast-heading', - 'section' => 'section-header', - 'priority' => 35, - 'title' => __( 'Mobile Header', 'astra' ), - 'settings' => array(), - ), - - /** - * Option: Mobile Menu Alignment - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-main-menu-align]', - 'default' => astra_get_option( 'header-main-menu-align' ), - 'type' => 'control', - 'control' => 'ast-radio-image', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), - 'choices' => array( - 'inline' => array( - 'label' => __( 'Inline', 'astra' ), - 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'menu-inline' ), - ), - 'stack' => array( - 'label' => __( 'Stack', 'astra' ), - 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'menu-stack' ), - ), - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'section' => 'section-header', - 'priority' => 40, - 'title' => __( 'Layout', 'astra' ), - ), - - /** - * Option: Hide Last item in Menu on mobile device - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[hide-custom-menu-mobile]', - 'default' => astra_get_option( 'hide-custom-menu-mobile' ), - 'type' => 'control', - 'control' => 'ast-toggle-control', - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'operator' => 'in', - 'value' => array( 'button', 'text-html' ), - ), - ), - 'section' => 'section-primary-menu', - 'title' => __( 'Hide Last Item in Menu on Mobile', 'astra' ), - 'priority' => 7, - 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-top-divider' ), - ), - - /** - * Option: Display outside menu - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-display-outside-menu]', - 'type' => 'control', - 'control' => 'ast-toggle-control', - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[hide-custom-menu-mobile]', - 'operator' => '!=', - 'value' => '1', - ), - ), - 'default' => astra_get_option( 'header-display-outside-menu' ), - 'section' => 'section-primary-menu', - 'title' => __( 'Take Last Item Outside Menu', 'astra' ), - 'priority' => 7, - ), - - array( - 'name' => 'primary-menu-label-divider', - 'type' => 'control', - 'control' => 'ast-heading', - 'priority' => 39, - 'title' => __( 'Mobile Menu', 'astra' ), - 'section' => 'section-primary-menu', - 'settings' => array(), - ), - - /** - * Option: Mobile Header Breakpoint - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-breakpoint]', - 'default' => astra_get_option( 'mobile-header-breakpoint' ), - 'type' => 'control', - 'control' => 'ast-slider', - 'section' => 'section-primary-menu', - 'priority' => 40, - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), - 'title' => __( 'Menu Breakpoint', 'astra' ), - 'suffix' => 'px', - 'input_attrs' => array( - 'min' => 0, - 'step' => 10, - 'max' => 6000, - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - /** - * Option: Notice to add # link to parent menu when Link option selected in Dropdown Target. - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-target-link-notice]', - 'type' => 'control', - 'control' => 'ast-description', - 'section' => 'section-header', - 'priority' => 41, - 'title' => '', - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-target]', - 'operator' => '==', - 'value' => 'link', - ), - ), - 'help' => __( 'The parent menu should have a # link for the submenu to open on a link.', 'astra' ), - 'settings' => array(), - ), - - /** - * Option: Mobile Menu Label. - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-main-menu-label]', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'header-main-menu-label' ), - 'section' => 'section-primary-menu', - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'context' => array( - 'relation' => 'AND', - ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab, - array( - 'relation' => 'OR', - array( - 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', - 'operator' => '!=', - 'value' => array( 'none' ), - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[disable-primary-nav]', - 'operator' => '!=', - 'value' => array( '1' ), - ), - ), - ), - 'priority' => 40, - 'title' => __( 'Menu Label', 'astra' ), - 'type' => 'control', - 'control' => 'text', - 'partial' => array( - 'selector' => '.ast-button-wrap', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Customizer_Partials::mobile_toggle_menu', - ), - ), - - /** - * Option: Toggle Button Style - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-btn-style]', - 'default' => astra_get_option( 'mobile-header-toggle-btn-style' ), - 'section' => 'section-primary-menu', - 'title' => __( 'Toggle Button Style', 'astra' ), - 'type' => 'control', - 'control' => 'ast-select', - 'priority' => 42, - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[disable-primary-nav]', - 'operator' => '!=', - 'value' => true, - ), - ), - 'choices' => array( - 'fill' => __( 'Fill', 'astra' ), - 'outline' => __( 'Outline', 'astra' ), - 'minimal' => __( 'Minimal', 'astra' ), - ), - ), - - /** - * Option: Toggle Button Color - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-btn-style-color]', - 'default' => astra_get_option( 'mobile-header-toggle-btn-style-color' ), - 'type' => 'control', - 'control' => 'ast-color', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[mobile-menu-style]', - 'operator' => '!=', - 'value' => 'no-toggle', - ), - ), - 'title' => __( 'Toggle Button Color', 'astra' ), - 'section' => 'section-primary-menu', - 'transport' => 'postMessage', - 'priority' => 42, - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - /** - * Option: Border Radius - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-btn-border-radius]', - 'default' => astra_get_option( 'mobile-header-toggle-btn-border-radius' ), - 'type' => 'control', - 'control' => 'ast-slider', - 'section' => 'section-primary-menu', - 'title' => __( 'Border Radius', 'astra' ), - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-btn-style]', - 'operator' => '!=', - 'value' => 'minimal', - ), - ), - 'priority' => 42, - 'suffix' => 'px', - 'transport' => 'postMessage', - 'input_attrs' => array( - 'min' => 0, - 'step' => 1, - 'max' => 100, - ), - ), - - /** - * Option: Toggle on click of button or link. - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-target]', - 'default' => astra_get_option( 'mobile-header-toggle-target' ), - 'type' => 'control', - 'control' => 'ast-select', - 'section' => 'section-primary-menu', - 'priority' => 42, - 'title' => __( 'Dropdown Target', 'astra' ), - 'suffix' => '', - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'choices' => array( - 'icon' => __( 'Icon', 'astra' ), - 'link' => __( 'Link', 'astra' ), - ), - ), - - ); - - $configurations = array_merge( $configurations, $_configs ); - - // Learn More link if Astra Pro is not activated. - if ( ! defined( 'ASTRA_EXT_VER' ) ) { - - $config = array( - - /** - * Option: Learn More about Mobile Header - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-more-feature-description]', - 'type' => 'control', - 'control' => 'ast-description', - 'section' => 'section-header', - 'priority' => 999, - 'title' => '', - 'help' => '

    ' . __( 'More Options Available in Astra Pro!', 'astra' ) . '

    ' . __( 'Learn More', 'astra' ) . '', - 'settings' => array(), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - ); - - $configurations = array_merge( $configurations, $config ); - } - - return $configurations; - } - } -} - - -new Astra_Header_Layout_Configs(); + ASTRA_THEME_SETTINGS . '[header-layouts]', + 'default' => astra_get_option( 'header-layouts' ), + 'section' => 'section-header', + 'priority' => 4, + 'title' => __( 'Layout', 'astra' ), + 'type' => 'control', + 'control' => 'ast-radio-image', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), + 'choices' => array( + 'header-main-layout-1' => array( + 'label' => __( 'Logo Left', 'astra' ), + 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'header-main-layout-1' ), + ), + 'header-main-layout-2' => array( + 'label' => __( 'Logo Center', 'astra' ), + 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'header-main-layout-2' ), + ), + 'header-main-layout-3' => array( + 'label' => __( 'Logo Right', 'astra' ), + 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'header-main-layout-3' ), + ), + ), + ), + + /** + * Option: Header Width + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-main-layout-width]', + 'default' => astra_get_option( 'header-main-layout-width' ), + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-header', + 'priority' => 4, + 'title' => __( 'Width', 'astra' ), + 'choices' => array( + 'full' => __( 'Full Width', 'astra' ), + 'content' => __( 'Content Width', 'astra' ), + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Bottom Border Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-main-sep]', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'header-main-sep' ), + 'type' => 'control', + 'control' => 'number', + 'section' => 'section-header', + 'priority' => 4, + 'title' => __( 'Bottom Border Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 600, + ), + ), + + /** + * Option: Bottom Border Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-main-sep-color]', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'header-main-sep-color' ), + 'type' => 'control', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-sep]', + 'operator' => '>=', + 'value' => 1, + ), + ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'section' => 'section-header', + 'priority' => 4, + 'title' => __( 'Bottom Border Color', 'astra' ), + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[disable-primary-nav]', + 'default' => astra_get_option( 'disable-primary-nav' ), + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'section' => 'section-primary-menu', + 'title' => __( 'Disable Menu', 'astra' ), + 'priority' => 5, + 'partial' => array( + 'selector' => '.main-header-bar .main-navigation', + 'container_inclusive' => false, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'default' => astra_get_option( 'header-main-rt-section' ), + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-primary-menu', + 'priority' => 7, + 'title' => __( 'Last Item in Menu', 'astra' ), + 'choices' => apply_filters( + 'astra_header_section_elements', + array( + 'none' => __( 'None', 'astra' ), + 'search' => __( 'Search', 'astra' ), + 'button' => __( 'Button', 'astra' ), + 'text-html' => __( 'Text / HTML', 'astra' ), + 'widget' => __( 'Widget', 'astra' ), + ), + 'primary-header' + ), + 'partial' => array( + 'selector' => '.main-header-bar .main-navigation .main-header-menu .ast-masthead-custom-menu-items.search-custom-menu-item .ast-search-icon .astra-search-icon, .main-header-bar .main-navigation .main-header-menu .ast-masthead-custom-menu-items.woocommerce-custom-menu-item, .main-header-bar .ast-masthead-custom-menu-items.widget-custom-menu-item .ast-header-widget-area .widget.ast-no-widget-row, .main-header-bar .main-navigation .main-header-menu .ast-masthead-custom-menu-items.edd-custom-menu-item', + 'container_inclusive' => false, + ), + ), + + /** + * Option: Button Text + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-text]', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'header-main-rt-section-button-text' ), + 'type' => 'control', + 'control' => 'text', + 'section' => 'section-primary-menu', + 'partial' => array( + 'selector' => '.button-custom-menu-item', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Customizer_Partials::render_header_main_rt_section_button_text', + ), + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'operator' => '===', + 'value' => 'button', + ), + ), + 'priority' => 10, + 'title' => __( 'Button Text', 'astra' ), + ), + + /** + * Option: Button Link + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-link-option]', + 'default' => astra_get_option( 'header-main-rt-section-button-link-option' ), + 'type' => 'control', + 'control' => 'ast-link', + 'section' => 'section-primary-menu', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'operator' => '===', + 'value' => 'button', + ), + ), + 'priority' => 10, + 'title' => __( 'Button Link', 'astra' ), + ), + + /** + * Option: Button Style + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', + 'default' => astra_get_option( 'header-main-rt-section-button-style' ), + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-primary-menu', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'operator' => '===', + 'value' => 'button', + ), + ), + 'priority' => 10, + 'choices' => array( + 'theme-button' => __( 'Theme Button', 'astra' ), + 'custom-button' => __( 'Header Button', 'astra' ), + ), + 'title' => __( 'Button Style', 'astra' ), + ), + + /** + * Option: Theme Button Style edit link + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-button-style-link]', + 'default' => astra_get_option( 'header-button-style-link' ), + 'type' => 'control', + 'control' => 'ast-customizer-link', + 'section' => 'section-primary-menu', + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'operator' => '===', + 'value' => 'button', + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-button-style]', + 'operator' => '===', + 'value' => 'theme-button', + ), + ), + 'priority' => 10, + 'link_type' => 'section', + 'linked' => 'section-buttons', + 'link_text' => __( 'Customize Button Style.', 'astra' ), + ), + + /** + * Option: Right Section Text / HTML + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-main-rt-section-html]', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'header-main-rt-section-html' ), + 'type' => 'control', + 'control' => 'textarea', + 'section' => 'section-primary-menu', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'operator' => '===', + 'value' => 'text-html', + ), + ), + 'priority' => 10, + 'partial' => array( + 'selector' => '.main-header-bar .ast-masthead-custom-menu-items .ast-custom-html', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Customizer_Partials::render_header_main_rt_section_html', + ), + 'title' => __( 'Custom Menu Text / HTML', 'astra' ), + ), + + array( + 'name' => 'primary-header-sub-menu-label-divider', + 'type' => 'control', + 'control' => 'ast-heading', + 'priority' => 30, + 'title' => __( 'Sub Menu', 'astra' ), + 'section' => 'section-primary-menu', + 'settings' => array(), + ), + + /** + * Option: Submenu Container Animation + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-main-submenu-container-animation]', + 'default' => astra_get_option( 'header-main-submenu-container-animation' ), + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-primary-menu', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[disable-primary-nav]', + 'operator' => '!=', + 'value' => true, + ), + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'priority' => 30, + 'title' => __( 'Submenu Animation', 'astra' ), + 'choices' => array( + '' => __( 'None', 'astra' ), + 'slide-down' => __( 'Slide Down', 'astra' ), + 'slide-up' => __( 'Slide Up', 'astra' ), + 'fade' => __( 'Fade', 'astra' ), + ), + ), + + // Option: Primary Menu Border. + array( + 'type' => 'control', + 'control' => 'ast-border', + 'transport' => 'postMessage', + 'name' => ASTRA_THEME_SETTINGS . '[primary-submenu-border]', + 'section' => 'section-primary-menu', + 'linked_choices' => true, + 'priority' => 30, + 'default' => astra_get_option( 'primary-submenu-border' ), + 'title' => __( 'Container Border', 'astra' ), + 'choices' => array( + 'top' => __( 'Top', 'astra' ), + 'right' => __( 'Right', 'astra' ), + 'bottom' => __( 'Bottom', 'astra' ), + 'left' => __( 'Left', 'astra' ), + ), + ), + + // Option: Submenu Container Border Color. + array( + 'type' => 'control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'transport' => 'postMessage', + 'name' => ASTRA_THEME_SETTINGS . '[primary-submenu-b-color]', + 'default' => astra_get_option( 'primary-submenu-b-color' ), + 'title' => __( 'Border Color', 'astra' ), + 'section' => 'section-primary-menu', + 'priority' => 30, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + array( + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'transport' => 'postMessage', + 'name' => ASTRA_THEME_SETTINGS . '[primary-submenu-item-border]', + 'section' => 'section-primary-menu', + 'priority' => 30, + 'default' => astra_get_option( 'primary-submenu-item-border' ), + 'title' => __( 'Submenu Divider', 'astra' ), + ), + + // Option: Submenu item Border Color. + array( + 'type' => 'control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'transport' => 'postMessage', + 'name' => ASTRA_THEME_SETTINGS . '[primary-submenu-item-b-color]', + 'default' => astra_get_option( 'primary-submenu-item-b-color' ), + 'title' => __( 'Divider Color', 'astra' ), + 'section' => 'section-primary-menu', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[primary-submenu-item-border]', + 'operator' => '==', + 'value' => true, + ), + ), + 'priority' => 30, + ), + + /** + * Option: Mobile Menu Label Divider + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-main-menu-label-divider]', + 'type' => 'control', + 'control' => 'ast-heading', + 'section' => 'section-header', + 'priority' => 35, + 'title' => __( 'Mobile Header', 'astra' ), + 'settings' => array(), + ), + + /** + * Option: Mobile Menu Alignment + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-main-menu-align]', + 'default' => astra_get_option( 'header-main-menu-align' ), + 'type' => 'control', + 'control' => 'ast-radio-image', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), + 'choices' => array( + 'inline' => array( + 'label' => __( 'Inline', 'astra' ), + 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'menu-inline' ), + ), + 'stack' => array( + 'label' => __( 'Stack', 'astra' ), + 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'menu-stack' ), + ), + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'section' => 'section-header', + 'priority' => 40, + 'title' => __( 'Layout', 'astra' ), + ), + + /** + * Option: Hide Last item in Menu on mobile device + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[hide-custom-menu-mobile]', + 'default' => astra_get_option( 'hide-custom-menu-mobile' ), + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'operator' => 'in', + 'value' => array( 'button', 'text-html' ), + ), + ), + 'section' => 'section-primary-menu', + 'title' => __( 'Hide Last Item in Menu on Mobile', 'astra' ), + 'priority' => 7, + 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-top-divider' ), + ), + + /** + * Option: Display outside menu + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-display-outside-menu]', + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[hide-custom-menu-mobile]', + 'operator' => '!=', + 'value' => '1', + ), + ), + 'default' => astra_get_option( 'header-display-outside-menu' ), + 'section' => 'section-primary-menu', + 'title' => __( 'Take Last Item Outside Menu', 'astra' ), + 'priority' => 7, + ), + + array( + 'name' => 'primary-menu-label-divider', + 'type' => 'control', + 'control' => 'ast-heading', + 'priority' => 39, + 'title' => __( 'Mobile Menu', 'astra' ), + 'section' => 'section-primary-menu', + 'settings' => array(), + ), + + /** + * Option: Mobile Header Breakpoint + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-breakpoint]', + 'default' => astra_get_option( 'mobile-header-breakpoint' ), + 'type' => 'control', + 'control' => 'ast-slider', + 'section' => 'section-primary-menu', + 'priority' => 40, + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), + 'title' => __( 'Menu Breakpoint', 'astra' ), + 'suffix' => 'px', + 'input_attrs' => array( + 'min' => 0, + 'step' => 10, + 'max' => 6000, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Notice to add # link to parent menu when Link option selected in Dropdown Target. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-target-link-notice]', + 'type' => 'control', + 'control' => 'ast-description', + 'section' => 'section-header', + 'priority' => 41, + 'title' => '', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-target]', + 'operator' => '==', + 'value' => 'link', + ), + ), + 'help' => __( 'The parent menu should have a # link for the submenu to open on a link.', 'astra' ), + 'settings' => array(), + ), + + /** + * Option: Mobile Menu Label. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-main-menu-label]', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'header-main-menu-label' ), + 'section' => 'section-primary-menu', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'context' => array( + 'relation' => 'AND', + ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab, + array( + 'relation' => 'OR', + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-main-rt-section]', + 'operator' => '!=', + 'value' => array( 'none' ), + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[disable-primary-nav]', + 'operator' => '!=', + 'value' => array( '1' ), + ), + ), + ), + 'priority' => 40, + 'title' => __( 'Menu Label', 'astra' ), + 'type' => 'control', + 'control' => 'text', + 'partial' => array( + 'selector' => '.ast-button-wrap', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Customizer_Partials::mobile_toggle_menu', + ), + ), + + /** + * Option: Toggle Button Style + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-btn-style]', + 'default' => astra_get_option( 'mobile-header-toggle-btn-style' ), + 'section' => 'section-primary-menu', + 'title' => __( 'Toggle Button Style', 'astra' ), + 'type' => 'control', + 'control' => 'ast-select', + 'priority' => 42, + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[disable-primary-nav]', + 'operator' => '!=', + 'value' => true, + ), + ), + 'choices' => array( + 'fill' => __( 'Fill', 'astra' ), + 'outline' => __( 'Outline', 'astra' ), + 'minimal' => __( 'Minimal', 'astra' ), + ), + ), + + /** + * Option: Toggle Button Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-btn-style-color]', + 'default' => astra_get_option( 'mobile-header-toggle-btn-style-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[mobile-menu-style]', + 'operator' => '!=', + 'value' => 'no-toggle', + ), + ), + 'title' => __( 'Toggle Button Color', 'astra' ), + 'section' => 'section-primary-menu', + 'transport' => 'postMessage', + 'priority' => 42, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Border Radius + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-btn-border-radius]', + 'default' => astra_get_option( 'mobile-header-toggle-btn-border-radius' ), + 'type' => 'control', + 'control' => 'ast-slider', + 'section' => 'section-primary-menu', + 'title' => __( 'Border Radius', 'astra' ), + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-btn-style]', + 'operator' => '!=', + 'value' => 'minimal', + ), + ), + 'priority' => 42, + 'suffix' => 'px', + 'transport' => 'postMessage', + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 100, + ), + ), + + /** + * Option: Toggle on click of button or link. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-toggle-target]', + 'default' => astra_get_option( 'mobile-header-toggle-target' ), + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-primary-menu', + 'priority' => 42, + 'title' => __( 'Dropdown Target', 'astra' ), + 'suffix' => '', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'choices' => array( + 'icon' => __( 'Icon', 'astra' ), + 'link' => __( 'Link', 'astra' ), + ), + ), + + ); + + $configurations = array_merge( $configurations, $_configs ); + + // Learn More link if Astra Pro is not activated. + if ( ! defined( 'ASTRA_EXT_VER' ) ) { + + $config = array( + + /** + * Option: Learn More about Mobile Header + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-more-feature-description]', + 'type' => 'control', + 'control' => 'ast-description', + 'section' => 'section-header', + 'priority' => 999, + 'title' => '', + 'help' => '

    ' . __( 'More Options Available in Astra Pro!', 'astra' ) . '

    ' . __( 'Learn More', 'astra' ) . '', + 'settings' => array(), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + ); + + $configurations = array_merge( $configurations, $config ); + } + + return $configurations; + } + } +} + + +new Astra_Header_Layout_Configs(); diff --git a/inc/customizer/configurations/layout/class-astra-sidebar-layout-configs.php b/inc/customizer/configurations/layout/class-astra-sidebar-layout-configs.php index 279675d..14a303b 100644 --- a/inc/customizer/configurations/layout/class-astra-sidebar-layout-configs.php +++ b/inc/customizer/configurations/layout/class-astra-sidebar-layout-configs.php @@ -1,155 +1,155 @@ - ASTRA_THEME_SETTINGS . '[site-sidebar-layout]', - 'type' => 'control', - 'control' => 'ast-select', - 'section' => 'section-sidebars', - 'default' => astra_get_option( 'site-sidebar-layout' ), - 'priority' => 5, - 'title' => __( 'Default Layout', 'astra' ), - 'choices' => array( - 'no-sidebar' => __( 'No Sidebar', 'astra' ), - 'left-sidebar' => __( 'Left Sidebar', 'astra' ), - 'right-sidebar' => __( 'Right Sidebar', 'astra' ), - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - /** - * Option: Page - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[single-page-sidebar-layout]', - 'type' => 'control', - 'control' => 'ast-select', - 'section' => 'section-sidebars', - 'default' => astra_get_option( 'single-page-sidebar-layout' ), - 'priority' => 5, - 'title' => __( 'Pages', 'astra' ), - 'choices' => array( - 'default' => __( 'Default', 'astra' ), - 'no-sidebar' => __( 'No Sidebar', 'astra' ), - 'left-sidebar' => __( 'Left Sidebar', 'astra' ), - 'right-sidebar' => __( 'Right Sidebar', 'astra' ), - ), - ), - - /** - * Option: Blog Post - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[single-post-sidebar-layout]', - 'type' => 'control', - 'control' => 'ast-select', - 'default' => astra_get_option( 'single-post-sidebar-layout' ), - 'section' => 'section-sidebars', - 'priority' => 5, - 'title' => __( 'Blog Posts', 'astra' ), - 'choices' => array( - 'default' => __( 'Default', 'astra' ), - 'no-sidebar' => __( 'No Sidebar', 'astra' ), - 'left-sidebar' => __( 'Left Sidebar', 'astra' ), - 'right-sidebar' => __( 'Right Sidebar', 'astra' ), - ), - ), - - /** - * Option: Blog Post Archive - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[archive-post-sidebar-layout]', - 'type' => 'control', - 'control' => 'ast-select', - 'default' => astra_get_option( 'archive-post-sidebar-layout' ), - 'section' => 'section-sidebars', - 'priority' => 5, - 'title' => __( 'Archives', 'astra' ), - 'choices' => array( - 'default' => __( 'Default', 'astra' ), - 'no-sidebar' => __( 'No Sidebar', 'astra' ), - 'left-sidebar' => __( 'Left Sidebar', 'astra' ), - 'right-sidebar' => __( 'Right Sidebar', 'astra' ), - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - /** - * Option: Primary Content Width - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[site-sidebar-width]', - 'type' => 'control', - 'control' => 'ast-slider', - 'default' => astra_get_option( 'site-sidebar-width' ), - 'section' => 'section-sidebars', - 'priority' => 15, - 'title' => __( 'Sidebar Width', 'astra' ), - 'suffix' => '%', - 'transport' => 'postMessage', - 'input_attrs' => array( - 'min' => 15, - 'step' => 1, - 'max' => 50, - ), - ), - - array( - 'name' => ASTRA_THEME_SETTINGS . '[site-sidebar-width-description]', - 'type' => 'control', - 'control' => 'ast-description', - 'section' => 'section-sidebars', - 'priority' => 15, - 'title' => '', - 'help' => __( 'Sidebar width will apply only when one of the above sidebar is set.', 'astra' ), - 'settings' => array(), - ), - ); - - return array_merge( $configurations, $_configs ); - } - } -} - - -new Astra_Sidebar_Layout_Configs(); - - - - - + ASTRA_THEME_SETTINGS . '[site-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-sidebars', + 'default' => astra_get_option( 'site-sidebar-layout' ), + 'priority' => 5, + 'title' => __( 'Default Layout', 'astra' ), + 'choices' => array( + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Page + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[single-page-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-sidebars', + 'default' => astra_get_option( 'single-page-sidebar-layout' ), + 'priority' => 5, + 'title' => __( 'Pages', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + ), + + /** + * Option: Blog Post + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[single-post-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'default' => astra_get_option( 'single-post-sidebar-layout' ), + 'section' => 'section-sidebars', + 'priority' => 5, + 'title' => __( 'Blog Posts', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + ), + + /** + * Option: Blog Post Archive + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[archive-post-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'default' => astra_get_option( 'archive-post-sidebar-layout' ), + 'section' => 'section-sidebars', + 'priority' => 5, + 'title' => __( 'Archives', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Primary Content Width + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[site-sidebar-width]', + 'type' => 'control', + 'control' => 'ast-slider', + 'default' => astra_get_option( 'site-sidebar-width' ), + 'section' => 'section-sidebars', + 'priority' => 15, + 'title' => __( 'Sidebar Width', 'astra' ), + 'suffix' => '%', + 'transport' => 'postMessage', + 'input_attrs' => array( + 'min' => 15, + 'step' => 1, + 'max' => 50, + ), + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[site-sidebar-width-description]', + 'type' => 'control', + 'control' => 'ast-description', + 'section' => 'section-sidebars', + 'priority' => 15, + 'title' => '', + 'help' => __( 'Sidebar width will apply only when one of the above sidebar is set.', 'astra' ), + 'settings' => array(), + ), + ); + + return array_merge( $configurations, $_configs ); + } + } +} + + +new Astra_Sidebar_Layout_Configs(); + + + + + diff --git a/inc/customizer/configurations/layout/class-astra-site-container-layout-configs.php b/inc/customizer/configurations/layout/class-astra-site-container-layout-configs.php index e930c89..cb38b95 100644 --- a/inc/customizer/configurations/layout/class-astra-site-container-layout-configs.php +++ b/inc/customizer/configurations/layout/class-astra-site-container-layout-configs.php @@ -1,157 +1,157 @@ - ASTRA_THEME_SETTINGS . '[site-content-layout]', - 'type' => 'control', - 'default' => astra_get_option( 'site-content-layout' ), - 'control' => 'ast-select', - 'section' => 'section-container-layout', - 'priority' => 50, - 'title' => __( 'Layout', 'astra' ), - 'choices' => array( - 'boxed-container' => __( 'Boxed', 'astra' ), - 'content-boxed-container' => __( 'Content Boxed', 'astra' ), - 'plain-container' => __( 'Full Width / Contained', 'astra' ), - 'page-builder' => __( 'Full Width / Stretched', 'astra' ), - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - /** - * Option: Single Page Content Layout - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[single-page-content-layout]', - 'type' => 'control', - 'control' => 'ast-select', - 'default' => astra_get_option( 'single-page-content-layout' ), - 'section' => 'section-container-layout', - 'title' => __( 'Page Layout', 'astra' ), - 'priority' => 55, - 'choices' => array( - 'default' => __( 'Default', 'astra' ), - 'boxed-container' => __( 'Boxed', 'astra' ), - 'content-boxed-container' => __( 'Content Boxed', 'astra' ), - 'plain-container' => __( 'Full Width / Contained', 'astra' ), - 'page-builder' => __( 'Full Width / Stretched', 'astra' ), - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - array( - 'name' => ASTRA_THEME_SETTINGS . '[single-post-content-layout]', - 'type' => 'control', - 'control' => 'ast-select', - 'default' => astra_get_option( 'single-post-content-layout' ), - 'section' => 'section-container-layout', - 'priority' => 60, - 'title' => __( 'Blog Post Layout', 'astra' ), - 'choices' => array( - 'default' => __( 'Default', 'astra' ), - 'boxed-container' => __( 'Boxed', 'astra' ), - 'content-boxed-container' => __( 'Content Boxed', 'astra' ), - 'plain-container' => __( 'Full Width / Contained', 'astra' ), - 'page-builder' => __( 'Full Width / Stretched', 'astra' ), - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - /** - * Option: Archive Post Content Layout - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[archive-post-content-layout]', - 'type' => 'control', - 'control' => 'ast-select', - 'default' => astra_get_option( 'archive-post-content-layout' ), - 'section' => 'section-container-layout', - 'priority' => 65, - 'title' => __( 'Archives Layout', 'astra' ), - 'choices' => array( - 'default' => __( 'Default', 'astra' ), - 'boxed-container' => __( 'Boxed', 'astra' ), - 'content-boxed-container' => __( 'Content Boxed', 'astra' ), - 'plain-container' => __( 'Full Width / Contained', 'astra' ), - 'page-builder' => __( 'Full Width / Stretched', 'astra' ), - ), - ), - - /** - * Option: Body Background - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[site-layout-outside-bg-obj-responsive]', - 'type' => 'control', - 'control' => 'ast-responsive-background', - 'default' => astra_get_option( 'site-layout-outside-bg-obj-responsive' ), - 'section' => ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'colors-and-background' ) ) ? 'section-colors-body' : 'section-colors-background', - 'transport' => 'postMessage', - 'priority' => 25, - 'title' => __( 'Background', 'astra' ), - ), - ); - - $configurations = array_merge( $configurations, $_configs ); - - // Learn More link if Astra Pro is not activated. - if ( ! defined( 'ASTRA_EXT_VER' ) ) { - - $config = array( - - array( - 'name' => ASTRA_THEME_SETTINGS . '[ast-container-more-feature-description]', - 'type' => 'control', - 'control' => 'ast-description', - 'section' => 'section-container-layout', - 'priority' => 999, - 'title' => '', - 'help' => '

    ' . __( 'More Options Available in Astra Pro!', 'astra' ) . '

    ' . __( 'Learn More', 'astra' ) . '', - 'settings' => array(), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - ); - - $configurations = array_merge( $configurations, $config ); - } - - return $configurations; - } - } -} - -new Astra_Site_Container_Layout_Configs(); + ASTRA_THEME_SETTINGS . '[site-content-layout]', + 'type' => 'control', + 'default' => astra_get_option( 'site-content-layout' ), + 'control' => 'ast-select', + 'section' => 'section-container-layout', + 'priority' => 50, + 'title' => __( 'Layout', 'astra' ), + 'choices' => array( + 'boxed-container' => __( 'Boxed', 'astra' ), + 'content-boxed-container' => __( 'Content Boxed', 'astra' ), + 'plain-container' => __( 'Full Width / Contained', 'astra' ), + 'page-builder' => __( 'Full Width / Stretched', 'astra' ), + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Single Page Content Layout + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[single-page-content-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'default' => astra_get_option( 'single-page-content-layout' ), + 'section' => 'section-container-layout', + 'title' => __( 'Page Layout', 'astra' ), + 'priority' => 55, + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'boxed-container' => __( 'Boxed', 'astra' ), + 'content-boxed-container' => __( 'Content Boxed', 'astra' ), + 'plain-container' => __( 'Full Width / Contained', 'astra' ), + 'page-builder' => __( 'Full Width / Stretched', 'astra' ), + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[single-post-content-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'default' => astra_get_option( 'single-post-content-layout' ), + 'section' => 'section-container-layout', + 'priority' => 60, + 'title' => __( 'Blog Post Layout', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'boxed-container' => __( 'Boxed', 'astra' ), + 'content-boxed-container' => __( 'Content Boxed', 'astra' ), + 'plain-container' => __( 'Full Width / Contained', 'astra' ), + 'page-builder' => __( 'Full Width / Stretched', 'astra' ), + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Archive Post Content Layout + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[archive-post-content-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'default' => astra_get_option( 'archive-post-content-layout' ), + 'section' => 'section-container-layout', + 'priority' => 65, + 'title' => __( 'Archives Layout', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'boxed-container' => __( 'Boxed', 'astra' ), + 'content-boxed-container' => __( 'Content Boxed', 'astra' ), + 'plain-container' => __( 'Full Width / Contained', 'astra' ), + 'page-builder' => __( 'Full Width / Stretched', 'astra' ), + ), + ), + + /** + * Option: Body Background + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[site-layout-outside-bg-obj-responsive]', + 'type' => 'control', + 'control' => 'ast-responsive-background', + 'default' => astra_get_option( 'site-layout-outside-bg-obj-responsive' ), + 'section' => ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'colors-and-background' ) ) ? 'section-colors-body' : 'section-colors-background', + 'transport' => 'postMessage', + 'priority' => 25, + 'title' => __( 'Background', 'astra' ), + ), + ); + + $configurations = array_merge( $configurations, $_configs ); + + // Learn More link if Astra Pro is not activated. + if ( ! defined( 'ASTRA_EXT_VER' ) ) { + + $config = array( + + array( + 'name' => ASTRA_THEME_SETTINGS . '[ast-container-more-feature-description]', + 'type' => 'control', + 'control' => 'ast-description', + 'section' => 'section-container-layout', + 'priority' => 999, + 'title' => '', + 'help' => '

    ' . __( 'More Options Available in Astra Pro!', 'astra' ) . '

    ' . __( 'Learn More', 'astra' ) . '', + 'settings' => array(), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + ); + + $configurations = array_merge( $configurations, $config ); + } + + return $configurations; + } + } +} + +new Astra_Site_Container_Layout_Configs(); diff --git a/inc/customizer/configurations/layout/class-astra-site-identity-configs.php b/inc/customizer/configurations/layout/class-astra-site-identity-configs.php index d01af50..c046a97 100644 --- a/inc/customizer/configurations/layout/class-astra-site-identity-configs.php +++ b/inc/customizer/configurations/layout/class-astra-site-identity-configs.php @@ -1,495 +1,495 @@ - ASTRA_THEME_SETTINGS . '[ast-callback-notice-header-transparent-header-logo]', - 'type' => 'control', - 'control' => 'ast-description', - 'section' => $_section, - 'priority' => 1, - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]', - 'operator' => '==', - 'value' => true, - ), - ), - 'active_callback' => array( $this, 'is_transparent_header_enabled' ), - 'help' => $this->get_help_text_notice( 'transparent-header' ), - ), - - /** - * Option: Transparent Header Section - Link. - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[ast-callback-notice-header-transparent-header-logo-link]', - 'type' => 'control', - 'control' => 'ast-customizer-link', - 'section' => $_section, - 'priority' => 1, - 'link_type' => 'control', - 'linked' => ASTRA_THEME_SETTINGS . '[transparent-header-logo]', - 'context' => array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]', - 'operator' => '==', - 'value' => true, - ), - ), - 'link_text' => '' . __( 'Customize Transparent Header.', 'astra' ) . '', - 'active_callback' => array( $this, 'is_transparent_header_enabled' ), - ), - - - /** - * Option: Different retina logo - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[different-retina-logo]', - 'type' => 'control', - 'control' => 'ast-toggle-control', - 'section' => $_section, - 'title' => __( 'Different Logo For Retina Devices?', 'astra' ), - 'default' => astra_get_option( 'different-retina-logo' ), - 'priority' => 5, - 'transport' => 'postMessage', - 'divider' => array( 'ast_class' => 'ast-top-divider' ), - 'context' => array( - array( - 'setting' => 'custom_logo', - 'operator' => '!=', - 'value' => '', - ), - Astra_Builder_Helper::$general_tab_config, - ), - 'partial' => array( - 'selector' => '.site-branding', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Builder_Header::site_identity', - ), - ), - - /** - * Option: Retina logo selector - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[ast-header-retina-logo]', - 'default' => astra_get_option( 'ast-header-retina-logo' ), - 'type' => 'control', - 'control' => 'image', - 'sanitize_callback' => 'esc_url_raw', - 'section' => 'title_tagline', - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[different-retina-logo]', - 'operator' => '!=', - 'value' => 0, - ), - Astra_Builder_Helper::$general_tab_config, - ), - 'priority' => 6, - 'title' => __( 'Retina Logo', 'astra' ), - 'library_filter' => array( 'gif', 'jpg', 'jpeg', 'png', 'ico' ), - 'transport' => 'postMessage', - 'partial' => array( - 'selector' => '.site-branding', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Builder_Header::site_identity', - ), - ), - - /** - * Option: Inherit Desktop logo - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[different-mobile-logo]', - 'type' => 'control', - 'control' => 'ast-toggle-control', - 'default' => astra_get_option( 'different-mobile-logo' ), - 'section' => 'title_tagline', - 'title' => __( 'Different Logo For Mobile Devices?', 'astra' ), - 'priority' => 5, - 'context' => array( - array( - 'setting' => 'custom_logo', - 'operator' => '!=', - 'value' => '', - ), - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => 'ast_selected_device', - 'operator' => 'in', - 'value' => array( 'tablet', 'mobile' ), - ), - ), - 'transport' => 'postMessage', - 'partial' => array( - 'selector' => '.site-branding', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Builder_Header::site_identity', - ), - ), - - /** - * Option: Mobile header logo - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-logo]', - 'default' => astra_get_option( 'mobile-header-logo' ), - 'type' => 'control', - 'control' => 'image', - 'sanitize_callback' => 'esc_url_raw', - 'section' => 'title_tagline', - 'priority' => 5.5, - 'title' => __( 'Mobile Logo (optional)', 'astra' ), - 'library_filter' => array( 'gif', 'jpg', 'jpeg', 'png', 'ico' ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'context' => array( - array( - 'setting' => ASTRA_THEME_SETTINGS . '[different-mobile-logo]', - 'operator' => '==', - 'value' => '1', - ), - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => 'ast_selected_device', - 'operator' => 'in', - 'value' => array( 'tablet', 'mobile' ), - ), - ), - ), - - /** - * Option: Logo Width - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[ast-header-responsive-logo-width]', - 'type' => 'control', - 'control' => 'ast-responsive-slider', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), - 'section' => $_section, - 'transport' => 'postMessage', - 'default' => astra_get_option( 'ast-header-responsive-logo-width' ), - 'priority' => 7, - 'title' => __( 'Logo Width', 'astra' ), - 'suffix' => 'px', - 'input_attrs' => array( - 'min' => 0, - 'step' => 1, - 'max' => 600, - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-top-divider' ), - ), - - /** - * Option: Display Title - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', - 'type' => 'control', - 'control' => 'ast-responsive-toggle-control', - 'default' => astra_get_option( 'display-site-title-responsive' ), - 'section' => 'title_tagline', - 'title' => __( 'Display Site Title', 'astra' ), - 'priority' => 7, - 'transport' => 'postMessage', - 'partial' => array( - 'selector' => '.site-branding', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Builder_Header::site_identity', - ), - ), - - /** - * Option: Divider - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[ast-site-title-tagline-divider]', - 'type' => 'control', - 'section' => $_section, - 'control' => 'ast-divider', - 'priority' => 13, - 'settings' => array(), - 'context' => array( Astra_Builder_Helper::$general_tab_config ), - ), - - /** - * Option: Display Tagline - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', - 'type' => 'control', - 'control' => 'ast-responsive-toggle-control', - 'default' => astra_get_option( 'display-site-tagline-responsive' ), - 'section' => 'title_tagline', - 'priority' => 11, - 'title' => __( 'Display Site Tagline', 'astra' ), - 'transport' => 'postMessage', - 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-top-divider' ), - 'partial' => array( - - 'selector' => '.site-branding', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Builder_Header::site_identity', - ), - ), - - /** - * Option: Logo inline title. - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[logo-title-inline]', - 'default' => astra_get_option( 'logo-title-inline' ), - 'type' => 'control', - 'context' => array( Astra_Builder_Helper::$general_tab_config ), - 'control' => 'ast-toggle-control', - 'divider' => array( 'ast_class' => 'ast-top-divider' ), - 'section' => $_section, - 'title' => __( 'Inline Logo & Site Title', 'astra' ), - 'priority' => 8, - 'transport' => 'postMessage', - 'partial' => array( - 'selector' => '.site-branding', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Builder_Header::site_identity', - ), - ), - ); - - /** - * We adding this control only to maintain backwards. Remove this condition after 2-3 updates of add-on. - * Moving Site Title color & Tagline color option into theme. - * - * @since 3.5.0 - */ - $load_site_tagline_color_controls = true; - if ( is_astra_addon_3_5_0_version() ) { - $load_site_tagline_color_controls = false; - } - - if ( $load_site_tagline_color_controls ) { - $_configs = array_merge( - $_configs, - array( - // Color Group control for site title colors. - array( - 'name' => ASTRA_THEME_SETTINGS . '[site-identity-title-color-group]', - 'default' => astra_get_option( 'site-identity-title-color-group' ), - 'type' => 'control', - 'control' => 'ast-color-group', - 'title' => Astra_Builder_Helper::$is_header_footer_builder_active ? __( 'Title Color', 'astra' ) : __( 'Colors', 'astra' ), - 'section' => $_section, - 'responsive' => false, - 'transport' => 'postMessage', - 'priority' => 8, - 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? array( Astra_Builder_Helper::$design_tab_config ) : '', - ), - - // Option: Site Title Color. - array( - 'name' => 'header-color-site-title', - 'parent' => ASTRA_THEME_SETTINGS . '[site-identity-title-color-group]', - 'section' => 'title_tagline', - 'type' => 'sub-control', - 'control' => 'ast-color', - 'priority' => 5, - 'default' => astra_get_option( 'header-color-site-title' ), - 'transport' => 'postMessage', - 'title' => __( 'Normal', 'astra' ), - 'context' => Astra_Builder_Helper::$design_tab, - ), - - // Option: Site Title Hover Color. - array( - 'name' => 'header-color-h-site-title', - 'parent' => ASTRA_THEME_SETTINGS . '[site-identity-title-color-group]', - 'section' => 'title_tagline', - 'type' => 'sub-control', - 'control' => 'ast-color', - 'priority' => 10, - 'transport' => 'postMessage', - 'default' => astra_get_option( 'header-color-h-site-title' ), - 'title' => __( 'Hover', 'astra' ), - 'context' => Astra_Builder_Helper::$design_tab, - ), - - // Option: Site Tagline Color. - array( - 'name' => ASTRA_THEME_SETTINGS . '[header-color-site-tagline]', - 'type' => 'control', - 'control' => 'ast-color', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'header-color-site-tagline' ), - 'title' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? __( 'Tagline', 'astra' ) : __( 'Color', 'astra' ), - 'section' => 'title_tagline', - 'priority' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? 8 : 12, - 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? array( Astra_Builder_Helper::$design_tab_config ) : '', - ), - ) - ); - } - - if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { - - $_configs = array_merge( - $_configs, - array( - /** - * Notice - Transparent meta header enabled on page. - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[ast-callback-notice-header-transparent-meta-enabled]', - 'type' => 'control', - 'control' => 'ast-description', - 'section' => 'section-header-builder-layout', - 'priority' => 1, - 'active_callback' => array( $this, 'is_transparent_header_enabled' ), - 'help' => $this->get_help_text_notice( 'transparent-meta' ), - ), - - /** - * Notice Link - Transparent meta header enabled on page. - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[ast-callback-notice-header-transparent-header-meta-link]', - 'type' => 'control', - 'control' => 'ast-customizer-link', - 'section' => 'section-header-builder-layout', - 'priority' => 1, - 'link_type' => 'section', - 'linked' => 'section-transparent-header', - 'link_text' => '' . __( 'Customize Transparent Header.', 'astra' ) . '', - 'active_callback' => array( $this, 'is_transparent_header_enabled' ), - ), - ) - ); - } - - if ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'typography' ) ) { - - $new_configs = array( - - /** - * Option: Header Site Title. - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[site-title-typography]', - 'default' => astra_get_option( 'site-title-typography' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? __( 'Title Font', 'astra' ) : __( 'Typography', 'astra' ), - 'section' => $_section, - 'transport' => 'postMessage', - 'priority' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? 16 : 8, - 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? array( Astra_Builder_Helper::$design_tab_config ) : '', - ), - - /** - * Options: Site Tagline. - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[site-tagline-typography]', - 'default' => astra_get_option( 'site-tagline-typography' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? __( 'Tagline Font', 'astra' ) : __( 'Typography', 'astra' ), - 'section' => $_section, - 'transport' => 'postMessage', - 'priority' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? 20 : 11, - 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? array( Astra_Builder_Helper::$design_tab_config ) : '', - ), - ); - - $_configs = array_merge( $_configs, $new_configs ); - } - - $configurations = array_merge( $configurations, $_configs ); - return $configurations; - - } - - /** - * Check if transparent header is enabled on the page being previewed. - * - * @since 2.4.5 - * @return boolean True - If Transparent Header is enabled, False if not. - */ - public function is_transparent_header_enabled() { - $status = Astra_Ext_Transparent_Header_Markup::is_transparent_header(); - return ( true === $status ? true : false ); - } - - /** - * Help notice message to be displayed when the page that is being previewed has Logo set from Transparent Header. - * - * @since 2.4.5 - * @param String $context Type of notice message to be returned. - * @return String HTML Markup for the help notice. - */ - private function get_help_text_notice( $context ) { - - switch ( $context ) { - case 'transparent-header': - $notice = '

    The Logo on this page is set from the Transparent Header Section. Please click the link below to customize Transparent Header Logo.

    '; - break; - case 'transparent-meta': - $notice = '

    The header on this page is set from the Transparent Header.

    Please click the link below to customize Transparent Header

    '; - break; - default: - $notice = ''; - } - return $notice; - } - } -} - - -new Astra_Site_Identity_Configs(); + ASTRA_THEME_SETTINGS . '[ast-callback-notice-header-transparent-header-logo]', + 'type' => 'control', + 'control' => 'ast-description', + 'section' => $_section, + 'priority' => 1, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]', + 'operator' => '==', + 'value' => true, + ), + ), + 'active_callback' => array( $this, 'is_transparent_header_enabled' ), + 'help' => $this->get_help_text_notice( 'transparent-header' ), + ), + + /** + * Option: Transparent Header Section - Link. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[ast-callback-notice-header-transparent-header-logo-link]', + 'type' => 'control', + 'control' => 'ast-customizer-link', + 'section' => $_section, + 'priority' => 1, + 'link_type' => 'control', + 'linked' => ASTRA_THEME_SETTINGS . '[transparent-header-logo]', + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]', + 'operator' => '==', + 'value' => true, + ), + ), + 'link_text' => '' . __( 'Customize Transparent Header.', 'astra' ) . '', + 'active_callback' => array( $this, 'is_transparent_header_enabled' ), + ), + + + /** + * Option: Different retina logo + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[different-retina-logo]', + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'section' => $_section, + 'title' => __( 'Different Logo For Retina Devices?', 'astra' ), + 'default' => astra_get_option( 'different-retina-logo' ), + 'priority' => 5, + 'transport' => 'postMessage', + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + 'context' => array( + array( + 'setting' => 'custom_logo', + 'operator' => '!=', + 'value' => '', + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'partial' => array( + 'selector' => '.site-branding', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Builder_Header::site_identity', + ), + ), + + /** + * Option: Retina logo selector + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[ast-header-retina-logo]', + 'default' => astra_get_option( 'ast-header-retina-logo' ), + 'type' => 'control', + 'control' => 'image', + 'sanitize_callback' => 'esc_url_raw', + 'section' => 'title_tagline', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[different-retina-logo]', + 'operator' => '!=', + 'value' => 0, + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'priority' => 6, + 'title' => __( 'Retina Logo', 'astra' ), + 'library_filter' => array( 'gif', 'jpg', 'jpeg', 'png', 'ico' ), + 'transport' => 'postMessage', + 'partial' => array( + 'selector' => '.site-branding', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Builder_Header::site_identity', + ), + ), + + /** + * Option: Inherit Desktop logo + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[different-mobile-logo]', + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'default' => astra_get_option( 'different-mobile-logo' ), + 'section' => 'title_tagline', + 'title' => __( 'Different Logo For Mobile Devices?', 'astra' ), + 'priority' => 5, + 'context' => array( + array( + 'setting' => 'custom_logo', + 'operator' => '!=', + 'value' => '', + ), + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => 'ast_selected_device', + 'operator' => 'in', + 'value' => array( 'tablet', 'mobile' ), + ), + ), + 'transport' => 'postMessage', + 'partial' => array( + 'selector' => '.site-branding', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Builder_Header::site_identity', + ), + ), + + /** + * Option: Mobile header logo + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[mobile-header-logo]', + 'default' => astra_get_option( 'mobile-header-logo' ), + 'type' => 'control', + 'control' => 'image', + 'sanitize_callback' => 'esc_url_raw', + 'section' => 'title_tagline', + 'priority' => 5.5, + 'title' => __( 'Mobile Logo (optional)', 'astra' ), + 'library_filter' => array( 'gif', 'jpg', 'jpeg', 'png', 'ico' ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[different-mobile-logo]', + 'operator' => '==', + 'value' => '1', + ), + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => 'ast_selected_device', + 'operator' => 'in', + 'value' => array( 'tablet', 'mobile' ), + ), + ), + ), + + /** + * Option: Logo Width + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[ast-header-responsive-logo-width]', + 'type' => 'control', + 'control' => 'ast-responsive-slider', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'default' => astra_get_option( 'ast-header-responsive-logo-width' ), + 'priority' => 7, + 'title' => __( 'Logo Width', 'astra' ), + 'suffix' => 'px', + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 600, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-top-divider' ), + ), + + /** + * Option: Display Title + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', + 'type' => 'control', + 'control' => 'ast-responsive-toggle-control', + 'default' => astra_get_option( 'display-site-title-responsive' ), + 'section' => 'title_tagline', + 'title' => __( 'Display Site Title', 'astra' ), + 'priority' => 7, + 'transport' => 'postMessage', + 'partial' => array( + 'selector' => '.site-branding', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Builder_Header::site_identity', + ), + ), + + /** + * Option: Divider + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[ast-site-title-tagline-divider]', + 'type' => 'control', + 'section' => $_section, + 'control' => 'ast-divider', + 'priority' => 13, + 'settings' => array(), + 'context' => array( Astra_Builder_Helper::$general_tab_config ), + ), + + /** + * Option: Display Tagline + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', + 'type' => 'control', + 'control' => 'ast-responsive-toggle-control', + 'default' => astra_get_option( 'display-site-tagline-responsive' ), + 'section' => 'title_tagline', + 'priority' => 11, + 'title' => __( 'Display Site Tagline', 'astra' ), + 'transport' => 'postMessage', + 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-top-divider' ), + 'partial' => array( + + 'selector' => '.site-branding', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Builder_Header::site_identity', + ), + ), + + /** + * Option: Logo inline title. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[logo-title-inline]', + 'default' => astra_get_option( 'logo-title-inline' ), + 'type' => 'control', + 'context' => array( Astra_Builder_Helper::$general_tab_config ), + 'control' => 'ast-toggle-control', + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + 'section' => $_section, + 'title' => __( 'Inline Logo & Site Title', 'astra' ), + 'priority' => 8, + 'transport' => 'postMessage', + 'partial' => array( + 'selector' => '.site-branding', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Builder_Header::site_identity', + ), + ), + ); + + /** + * We adding this control only to maintain backwards. Remove this condition after 2-3 updates of add-on. + * Moving Site Title color & Tagline color option into theme. + * + * @since 3.5.0 + */ + $load_site_tagline_color_controls = true; + if ( is_astra_addon_3_5_0_version() ) { + $load_site_tagline_color_controls = false; + } + + if ( $load_site_tagline_color_controls ) { + $_configs = array_merge( + $_configs, + array( + // Color Group control for site title colors. + array( + 'name' => ASTRA_THEME_SETTINGS . '[site-identity-title-color-group]', + 'default' => astra_get_option( 'site-identity-title-color-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => Astra_Builder_Helper::$is_header_footer_builder_active ? __( 'Title Color', 'astra' ) : __( 'Colors', 'astra' ), + 'section' => $_section, + 'responsive' => false, + 'transport' => 'postMessage', + 'priority' => 8, + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? array( Astra_Builder_Helper::$design_tab_config ) : '', + ), + + // Option: Site Title Color. + array( + 'name' => 'header-color-site-title', + 'parent' => ASTRA_THEME_SETTINGS . '[site-identity-title-color-group]', + 'section' => 'title_tagline', + 'type' => 'sub-control', + 'control' => 'ast-color', + 'priority' => 5, + 'default' => astra_get_option( 'header-color-site-title' ), + 'transport' => 'postMessage', + 'title' => __( 'Normal', 'astra' ), + 'context' => Astra_Builder_Helper::$design_tab, + ), + + // Option: Site Title Hover Color. + array( + 'name' => 'header-color-h-site-title', + 'parent' => ASTRA_THEME_SETTINGS . '[site-identity-title-color-group]', + 'section' => 'title_tagline', + 'type' => 'sub-control', + 'control' => 'ast-color', + 'priority' => 10, + 'transport' => 'postMessage', + 'default' => astra_get_option( 'header-color-h-site-title' ), + 'title' => __( 'Hover', 'astra' ), + 'context' => Astra_Builder_Helper::$design_tab, + ), + + // Option: Site Tagline Color. + array( + 'name' => ASTRA_THEME_SETTINGS . '[header-color-site-tagline]', + 'type' => 'control', + 'control' => 'ast-color', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'header-color-site-tagline' ), + 'title' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? __( 'Tagline', 'astra' ) : __( 'Color', 'astra' ), + 'section' => 'title_tagline', + 'priority' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? 8 : 12, + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? array( Astra_Builder_Helper::$design_tab_config ) : '', + ), + ) + ); + } + + if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { + + $_configs = array_merge( + $_configs, + array( + /** + * Notice - Transparent meta header enabled on page. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[ast-callback-notice-header-transparent-meta-enabled]', + 'type' => 'control', + 'control' => 'ast-description', + 'section' => 'section-header-builder-layout', + 'priority' => 1, + 'active_callback' => array( $this, 'is_transparent_header_enabled' ), + 'help' => $this->get_help_text_notice( 'transparent-meta' ), + ), + + /** + * Notice Link - Transparent meta header enabled on page. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[ast-callback-notice-header-transparent-header-meta-link]', + 'type' => 'control', + 'control' => 'ast-customizer-link', + 'section' => 'section-header-builder-layout', + 'priority' => 1, + 'link_type' => 'section', + 'linked' => 'section-transparent-header', + 'link_text' => '' . __( 'Customize Transparent Header.', 'astra' ) . '', + 'active_callback' => array( $this, 'is_transparent_header_enabled' ), + ), + ) + ); + } + + if ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'typography' ) ) { + + $new_configs = array( + + /** + * Option: Header Site Title. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[site-title-typography]', + 'default' => astra_get_option( 'site-title-typography' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? __( 'Title Font', 'astra' ) : __( 'Typography', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? 16 : 8, + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? array( Astra_Builder_Helper::$design_tab_config ) : '', + ), + + /** + * Options: Site Tagline. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[site-tagline-typography]', + 'default' => astra_get_option( 'site-tagline-typography' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? __( 'Tagline Font', 'astra' ) : __( 'Typography', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? 20 : 11, + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? array( Astra_Builder_Helper::$design_tab_config ) : '', + ), + ); + + $_configs = array_merge( $_configs, $new_configs ); + } + + $configurations = array_merge( $configurations, $_configs ); + return $configurations; + + } + + /** + * Check if transparent header is enabled on the page being previewed. + * + * @since 2.4.5 + * @return boolean True - If Transparent Header is enabled, False if not. + */ + public function is_transparent_header_enabled() { + $status = Astra_Ext_Transparent_Header_Markup::is_transparent_header(); + return ( true === $status ? true : false ); + } + + /** + * Help notice message to be displayed when the page that is being previewed has Logo set from Transparent Header. + * + * @since 2.4.5 + * @param String $context Type of notice message to be returned. + * @return String HTML Markup for the help notice. + */ + private function get_help_text_notice( $context ) { + + switch ( $context ) { + case 'transparent-header': + $notice = '

    The Logo on this page is set from the Transparent Header Section. Please click the link below to customize Transparent Header Logo.

    '; + break; + case 'transparent-meta': + $notice = '

    The header on this page is set from the Transparent Header.

    Please click the link below to customize Transparent Header

    '; + break; + default: + $notice = ''; + } + return $notice; + } + } +} + + +new Astra_Site_Identity_Configs(); diff --git a/inc/customizer/configurations/layout/class-astra-site-layout-configs.php b/inc/customizer/configurations/layout/class-astra-site-layout-configs.php index caf3e85..e8af125 100644 --- a/inc/customizer/configurations/layout/class-astra-site-layout-configs.php +++ b/inc/customizer/configurations/layout/class-astra-site-layout-configs.php @@ -1,69 +1,69 @@ - ASTRA_THEME_SETTINGS . '[site-content-width]', - 'type' => 'control', - 'control' => 'ast-slider', - 'default' => astra_get_option( 'site-content-width' ), - 'section' => 'section-container-layout', - 'priority' => 10, - 'title' => __( 'Container Width', 'astra' ), - 'context' => ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'site-layouts' ) ) ? array( - Astra_Builder_Helper::$general_tab_config, - array( - 'setting' => ASTRA_THEME_SETTINGS . '[site-layout]', - 'operator' => '==', - 'value' => 'ast-full-width-layout', - ), - ) : array(), - 'suffix' => 'px', - 'input_attrs' => array( - 'min' => 768, - 'step' => 1, - 'max' => 1920, - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - ); - - return array_merge( $configurations, $_configs ); - } - } -} - -/** - * Kicking this off by calling 'get_instance()' method - */ -new Astra_Site_Layout_Configs(); + ASTRA_THEME_SETTINGS . '[site-content-width]', + 'type' => 'control', + 'control' => 'ast-slider', + 'default' => astra_get_option( 'site-content-width' ), + 'section' => 'section-container-layout', + 'priority' => 10, + 'title' => __( 'Container Width', 'astra' ), + 'context' => ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'site-layouts' ) ) ? array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[site-layout]', + 'operator' => '==', + 'value' => 'ast-full-width-layout', + ), + ) : array(), + 'suffix' => 'px', + 'input_attrs' => array( + 'min' => 768, + 'step' => 1, + 'max' => 1920, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + ); + + return array_merge( $configurations, $_configs ); + } + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +new Astra_Site_Layout_Configs(); diff --git a/inc/customizer/configurations/typography/class-astra-archive-typo-configs.php b/inc/customizer/configurations/typography/class-astra-archive-typo-configs.php index 746ccd3..71ee4d6 100644 --- a/inc/customizer/configurations/typography/class-astra-archive-typo-configs.php +++ b/inc/customizer/configurations/typography/class-astra-archive-typo-configs.php @@ -1,197 +1,197 @@ - ASTRA_THEME_SETTINGS . '[ast-blog-typography-more-feature-description]', - 'type' => 'control', - 'control' => 'ast-description', - 'section' => 'section-blog', - 'priority' => 999, - 'title' => '', - 'help' => '

    ' . __( 'More Options Available in Astra Pro!', 'astra' ) . '

    ' . __( 'Learn More', 'astra' ) . '', - 'settings' => array(), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - ); - } - - if ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'typography' ) ) { - - $new_configs = array( - - /** - * Option: Blog / Archive Typography - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[blog-content-archive-summary-typo]', - 'default' => astra_get_option( 'blog-content-archive-summary-typo' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => __( 'Archive Title Font', 'astra' ), - 'section' => 'section-blog', - 'transport' => 'postMessage', - 'priority' => 140, - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? - Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, - ), - - /** - * Option: Archive Summary Box Title Font Size - */ - array( - 'name' => 'font-size-archive-summary-title', - 'parent' => ASTRA_THEME_SETTINGS . '[blog-content-archive-summary-typo]', - 'section' => 'section-blog', - 'type' => 'sub-control', - 'control' => 'ast-responsive', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'font-size-archive-summary-title' ), - 'priority' => 8, - 'title' => __( 'Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - ), - - array( - 'name' => ASTRA_THEME_SETTINGS . '[blog-content-blog-post-title-typo]', - 'default' => astra_get_option( 'blog-content-blog-post-title-typo' ), - 'type' => 'control', - 'control' => 'ast-settings-group', - 'title' => __( 'Post Title Font', 'astra' ), - 'section' => 'section-blog', - 'transport' => 'postMessage', - 'priority' => 140, - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? - Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, - ), - - /** - * Option: Blog - Post Title Font Size - */ - array( - 'name' => 'font-size-page-title', - 'parent' => ASTRA_THEME_SETTINGS . '[blog-content-blog-post-title-typo]', - 'section' => 'section-blog', - 'type' => 'sub-control', - 'control' => 'ast-responsive', - 'transport' => 'postMessage', - 'priority' => 2, - 'default' => astra_get_option( 'font-size-page-title' ), - 'title' => __( 'Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - ), - ); - } else { - - $new_configs = array( - - /** - * Option: Archive Summary Box Title Font Size - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[font-size-archive-summary-title]', - 'section' => 'section-blog', - 'type' => 'control', - 'control' => 'ast-responsive', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'font-size-archive-summary-title' ), - 'title' => __( 'Archive Title Font Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - 'priority' => 140, - 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? - Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, - ), - - /** - * Option: Blog - Post Title Font Size - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[font-size-page-title]', - 'section' => 'section-blog', - 'type' => 'control', - 'control' => 'ast-responsive', - 'transport' => 'postMessage', - 'default' => astra_get_option( 'font-size-page-title' ), - 'title' => __( 'Post Title Font Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - 'priority' => 140, - 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? - Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, - ), - ); - } - - $_configs = array_merge( $_configs, $new_configs ); - - $configurations = array_merge( $configurations, $_configs ); - - return $configurations; - } - } -} - -new Astra_Archive_Typo_Configs(); + ASTRA_THEME_SETTINGS . '[ast-blog-typography-more-feature-description]', + 'type' => 'control', + 'control' => 'ast-description', + 'section' => 'section-blog', + 'priority' => 999, + 'title' => '', + 'help' => '

    ' . __( 'More Options Available in Astra Pro!', 'astra' ) . '

    ' . __( 'Learn More', 'astra' ) . '', + 'settings' => array(), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + ); + } + + if ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'typography' ) ) { + + $new_configs = array( + + /** + * Option: Blog / Archive Typography + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[blog-content-archive-summary-typo]', + 'default' => astra_get_option( 'blog-content-archive-summary-typo' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Archive Title Font', 'astra' ), + 'section' => 'section-blog', + 'transport' => 'postMessage', + 'priority' => 140, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? + Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + ), + + /** + * Option: Archive Summary Box Title Font Size + */ + array( + 'name' => 'font-size-archive-summary-title', + 'parent' => ASTRA_THEME_SETTINGS . '[blog-content-archive-summary-typo]', + 'section' => 'section-blog', + 'type' => 'sub-control', + 'control' => 'ast-responsive', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'font-size-archive-summary-title' ), + 'priority' => 8, + 'title' => __( 'Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[blog-content-blog-post-title-typo]', + 'default' => astra_get_option( 'blog-content-blog-post-title-typo' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Post Title Font', 'astra' ), + 'section' => 'section-blog', + 'transport' => 'postMessage', + 'priority' => 140, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? + Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + ), + + /** + * Option: Blog - Post Title Font Size + */ + array( + 'name' => 'font-size-page-title', + 'parent' => ASTRA_THEME_SETTINGS . '[blog-content-blog-post-title-typo]', + 'section' => 'section-blog', + 'type' => 'sub-control', + 'control' => 'ast-responsive', + 'transport' => 'postMessage', + 'priority' => 2, + 'default' => astra_get_option( 'font-size-page-title' ), + 'title' => __( 'Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + ); + } else { + + $new_configs = array( + + /** + * Option: Archive Summary Box Title Font Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-size-archive-summary-title]', + 'section' => 'section-blog', + 'type' => 'control', + 'control' => 'ast-responsive', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'font-size-archive-summary-title' ), + 'title' => __( 'Archive Title Font Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + 'priority' => 140, + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? + Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + ), + + /** + * Option: Blog - Post Title Font Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-size-page-title]', + 'section' => 'section-blog', + 'type' => 'control', + 'control' => 'ast-responsive', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'font-size-page-title' ), + 'title' => __( 'Post Title Font Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + 'priority' => 140, + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? + Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + ), + ); + } + + $_configs = array_merge( $_configs, $new_configs ); + + $configurations = array_merge( $configurations, $_configs ); + + return $configurations; + } + } +} + +new Astra_Archive_Typo_Configs(); diff --git a/inc/customizer/configurations/typography/class-astra-body-typo-configs.php b/inc/customizer/configurations/typography/class-astra-body-typo-configs.php index 400af19..21276a1 100644 --- a/inc/customizer/configurations/typography/class-astra-body-typo-configs.php +++ b/inc/customizer/configurations/typography/class-astra-body-typo-configs.php @@ -1,277 +1,277 @@ - ASTRA_THEME_SETTINGS . '[body-font-family]', - 'type' => 'control', - 'control' => 'ast-font', - 'font-type' => 'ast-font-family', - 'ast_inherit' => __( 'Default System Font', 'astra' ), - 'default' => astra_get_option( 'body-font-family' ), - 'section' => 'section-body-typo', - 'priority' => 5, - 'title' => __( 'Body Font Family', 'astra' ), - 'connect' => ASTRA_THEME_SETTINGS . '[body-font-weight]', - 'variant' => ASTRA_THEME_SETTINGS . '[body-font-variant]', - ), - - /** - * Option: Font Variant - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[body-font-variant]', - 'type' => 'control', - 'control' => 'ast-font-variant', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_variant' ), - 'default' => astra_get_option( 'body-font-variant' ), - 'ast_inherit' => __( 'Default', 'astra' ), - 'section' => 'section-body-typo', - 'priority' => 6, - 'title' => __( 'Variants', 'astra' ), - 'variant' => ASTRA_THEME_SETTINGS . '[body-font-family]', - ), - - /** - * Option: Font Weight - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[body-font-weight]', - 'type' => 'control', - 'control' => 'ast-font', - 'font-type' => 'ast-font-weight', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), - 'default' => astra_get_option( 'body-font-weight' ), - 'ast_inherit' => __( 'Default', 'astra' ), - 'section' => 'section-body-typo', - 'priority' => 15, - 'title' => __( 'Weight', 'astra' ), - 'connect' => ASTRA_THEME_SETTINGS . '[body-font-family]', - ), - - /** - * Option: Body Text Transform - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[body-text-transform]', - 'type' => 'control', - 'control' => 'ast-select', - 'section' => 'section-body-typo', - 'default' => astra_get_option( 'body-text-transform' ), - 'priority' => 20, - 'title' => __( 'Text Transform', 'astra' ), - 'choices' => array( - '' => __( 'Default', 'astra' ), - 'none' => __( 'None', 'astra' ), - 'capitalize' => __( 'Capitalize', 'astra' ), - 'uppercase' => __( 'Uppercase', 'astra' ), - 'lowercase' => __( 'Lowercase', 'astra' ), - ), - ), - - /** - * Option: Body Font Size - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[font-size-body]', - 'type' => 'control', - 'control' => 'ast-responsive-slider', - 'section' => 'section-body-typo', - 'default' => astra_get_option( 'font-size-body' ), - 'priority' => 10, - 'title' => __( 'Size', 'astra' ), - 'suffix' => 'px', - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - ), - ), - - /** - * Option: Body Line Height - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[body-line-height]', - 'type' => 'control', - 'control' => 'ast-slider', - 'section' => 'section-body-typo', - 'default' => astra_get_option( 'body-line-height' ), - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), - 'priority' => 25, - 'title' => __( 'Line Height', 'astra' ), - 'suffix' => 'em', - 'input_attrs' => array( - 'min' => 1, - 'step' => 0.01, - 'max' => 5, - ), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - /** - * Option: Paragraph Margin Bottom - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[para-margin-bottom]', - 'type' => 'control', - 'control' => 'ast-slider', - 'default' => astra_get_option( 'para-margin-bottom' ), - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), - 'transport' => 'postMessage', - 'section' => 'section-body-typo', - 'priority' => 25, - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - 'title' => __( 'Paragraph Margin Bottom', 'astra' ), - 'suffix' => 'em', - 'input_attrs' => array( - 'min' => 0.5, - 'step' => 0.01, - 'max' => 5, - ), - ), - - /** - * Option: Underline links in entry-content. - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[underline-content-links]', - 'default' => astra_get_option( 'underline-content-links' ), - 'type' => 'control', - 'control' => 'ast-toggle-control', - 'section' => 'section-body-typo', - 'priority' => 27, - 'title' => __( 'Underline Content Links', 'astra' ), - 'transport' => 'postMessage', - ), - - /** - * Option: Headings Font Family - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[headings-font-family]', - 'type' => 'control', - 'control' => 'ast-font', - 'font-type' => 'ast-font-family', - 'default' => astra_get_option( 'headings-font-family' ), - 'title' => __( 'Heading Font Family', 'astra' ), - 'section' => 'section-content-typo', - 'priority' => 3, - 'connect' => ASTRA_THEME_SETTINGS . '[headings-font-weight]', - 'variant' => ASTRA_THEME_SETTINGS . '[headings-font-variant]', - ), - - /** - * Option: Font Variant - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[headings-font-variant]', - 'type' => 'control', - 'control' => 'ast-font-variant', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_variant' ), - 'default' => astra_get_option( 'headings-font-variant' ), - 'ast_inherit' => __( 'Default', 'astra' ), - 'section' => 'section-content-typo', - 'priority' => 3, - 'title' => __( 'Variants', 'astra' ), - 'variant' => ASTRA_THEME_SETTINGS . '[headings-font-family]', - ), - - /** - * Option: Headings Font Weight - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[headings-font-weight]', - 'type' => 'control', - 'control' => 'ast-font', - 'font-type' => 'ast-font-weight', - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), - 'default' => astra_get_option( 'headings-font-weight' ), - 'title' => __( 'Weight', 'astra' ), - 'section' => 'section-content-typo', - 'priority' => 3, - 'connect' => ASTRA_THEME_SETTINGS . '[headings-font-family]', - ), - - /** - * Option: Headings Text Transform - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[headings-text-transform]', - 'type' => 'control', - 'control' => 'ast-select', - 'section' => 'section-content-typo', - 'title' => __( 'Text Transform', 'astra' ), - 'default' => astra_get_option( 'headings-text-transform' ), - 'priority' => 3, - 'choices' => array( - '' => __( 'Inherit', 'astra' ), - 'none' => __( 'None', 'astra' ), - 'capitalize' => __( 'Capitalize', 'astra' ), - 'uppercase' => __( 'Uppercase', 'astra' ), - 'lowercase' => __( 'Lowercase', 'astra' ), - ), - ), - - /** - * Option: Heading

    Line Height - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[headings-line-height]', - 'section' => 'section-content-typo', - 'default' => astra_get_option( 'headings-line-height' ), - 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), - 'type' => 'control', - 'control' => 'ast-slider', - 'title' => __( 'Line Height', 'astra' ), - 'transport' => 'postMessage', - 'priority' => 4, - 'suffix' => 'em', - 'input_attrs' => array( - 'min' => 1, - 'step' => 0.01, - 'max' => 5, - ), - ), - ); - - return array_merge( $configurations, $_configs ); - } - } -} - -new Astra_Body_Typo_Configs(); + ASTRA_THEME_SETTINGS . '[body-font-family]', + 'type' => 'control', + 'control' => 'ast-font', + 'font-type' => 'ast-font-family', + 'ast_inherit' => __( 'Default System Font', 'astra' ), + 'default' => astra_get_option( 'body-font-family' ), + 'section' => 'section-body-typo', + 'priority' => 5, + 'title' => __( 'Body Font Family', 'astra' ), + 'connect' => ASTRA_THEME_SETTINGS . '[body-font-weight]', + 'variant' => ASTRA_THEME_SETTINGS . '[body-font-variant]', + ), + + /** + * Option: Font Variant + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[body-font-variant]', + 'type' => 'control', + 'control' => 'ast-font-variant', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_variant' ), + 'default' => astra_get_option( 'body-font-variant' ), + 'ast_inherit' => __( 'Default', 'astra' ), + 'section' => 'section-body-typo', + 'priority' => 6, + 'title' => __( 'Variants', 'astra' ), + 'variant' => ASTRA_THEME_SETTINGS . '[body-font-family]', + ), + + /** + * Option: Font Weight + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[body-font-weight]', + 'type' => 'control', + 'control' => 'ast-font', + 'font-type' => 'ast-font-weight', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), + 'default' => astra_get_option( 'body-font-weight' ), + 'ast_inherit' => __( 'Default', 'astra' ), + 'section' => 'section-body-typo', + 'priority' => 15, + 'title' => __( 'Weight', 'astra' ), + 'connect' => ASTRA_THEME_SETTINGS . '[body-font-family]', + ), + + /** + * Option: Body Text Transform + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[body-text-transform]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-body-typo', + 'default' => astra_get_option( 'body-text-transform' ), + 'priority' => 20, + 'title' => __( 'Text Transform', 'astra' ), + 'choices' => array( + '' => __( 'Default', 'astra' ), + 'none' => __( 'None', 'astra' ), + 'capitalize' => __( 'Capitalize', 'astra' ), + 'uppercase' => __( 'Uppercase', 'astra' ), + 'lowercase' => __( 'Lowercase', 'astra' ), + ), + ), + + /** + * Option: Body Font Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-size-body]', + 'type' => 'control', + 'control' => 'ast-responsive-slider', + 'section' => 'section-body-typo', + 'default' => astra_get_option( 'font-size-body' ), + 'priority' => 10, + 'title' => __( 'Size', 'astra' ), + 'suffix' => 'px', + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + ), + ), + + /** + * Option: Body Line Height + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[body-line-height]', + 'type' => 'control', + 'control' => 'ast-slider', + 'section' => 'section-body-typo', + 'default' => astra_get_option( 'body-line-height' ), + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), + 'priority' => 25, + 'title' => __( 'Line Height', 'astra' ), + 'suffix' => 'em', + 'input_attrs' => array( + 'min' => 1, + 'step' => 0.01, + 'max' => 5, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Paragraph Margin Bottom + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[para-margin-bottom]', + 'type' => 'control', + 'control' => 'ast-slider', + 'default' => astra_get_option( 'para-margin-bottom' ), + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), + 'transport' => 'postMessage', + 'section' => 'section-body-typo', + 'priority' => 25, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'title' => __( 'Paragraph Margin Bottom', 'astra' ), + 'suffix' => 'em', + 'input_attrs' => array( + 'min' => 0.5, + 'step' => 0.01, + 'max' => 5, + ), + ), + + /** + * Option: Underline links in entry-content. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[underline-content-links]', + 'default' => astra_get_option( 'underline-content-links' ), + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'section' => 'section-body-typo', + 'priority' => 27, + 'title' => __( 'Underline Content Links', 'astra' ), + 'transport' => 'postMessage', + ), + + /** + * Option: Headings Font Family + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[headings-font-family]', + 'type' => 'control', + 'control' => 'ast-font', + 'font-type' => 'ast-font-family', + 'default' => astra_get_option( 'headings-font-family' ), + 'title' => __( 'Heading Font Family', 'astra' ), + 'section' => 'section-content-typo', + 'priority' => 3, + 'connect' => ASTRA_THEME_SETTINGS . '[headings-font-weight]', + 'variant' => ASTRA_THEME_SETTINGS . '[headings-font-variant]', + ), + + /** + * Option: Font Variant + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[headings-font-variant]', + 'type' => 'control', + 'control' => 'ast-font-variant', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_variant' ), + 'default' => astra_get_option( 'headings-font-variant' ), + 'ast_inherit' => __( 'Default', 'astra' ), + 'section' => 'section-content-typo', + 'priority' => 3, + 'title' => __( 'Variants', 'astra' ), + 'variant' => ASTRA_THEME_SETTINGS . '[headings-font-family]', + ), + + /** + * Option: Headings Font Weight + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[headings-font-weight]', + 'type' => 'control', + 'control' => 'ast-font', + 'font-type' => 'ast-font-weight', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), + 'default' => astra_get_option( 'headings-font-weight' ), + 'title' => __( 'Weight', 'astra' ), + 'section' => 'section-content-typo', + 'priority' => 3, + 'connect' => ASTRA_THEME_SETTINGS . '[headings-font-family]', + ), + + /** + * Option: Headings Text Transform + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[headings-text-transform]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-content-typo', + 'title' => __( 'Text Transform', 'astra' ), + 'default' => astra_get_option( 'headings-text-transform' ), + 'priority' => 3, + 'choices' => array( + '' => __( 'Inherit', 'astra' ), + 'none' => __( 'None', 'astra' ), + 'capitalize' => __( 'Capitalize', 'astra' ), + 'uppercase' => __( 'Uppercase', 'astra' ), + 'lowercase' => __( 'Lowercase', 'astra' ), + ), + ), + + /** + * Option: Heading

    Line Height + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[headings-line-height]', + 'section' => 'section-content-typo', + 'default' => astra_get_option( 'headings-line-height' ), + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), + 'type' => 'control', + 'control' => 'ast-slider', + 'title' => __( 'Line Height', 'astra' ), + 'transport' => 'postMessage', + 'priority' => 4, + 'suffix' => 'em', + 'input_attrs' => array( + 'min' => 1, + 'step' => 0.01, + 'max' => 5, + ), + ), + ); + + return array_merge( $configurations, $_configs ); + } + } +} + +new Astra_Body_Typo_Configs(); diff --git a/inc/customizer/configurations/typography/class-astra-content-typo-configs.php b/inc/customizer/configurations/typography/class-astra-content-typo-configs.php index e6a99d2..777d9a0 100644 --- a/inc/customizer/configurations/typography/class-astra-content-typo-configs.php +++ b/inc/customizer/configurations/typography/class-astra-content-typo-configs.php @@ -1,272 +1,272 @@ - ASTRA_THEME_SETTINGS . '[divider-section-h1]', - 'type' => 'control', - 'control' => 'ast-heading', - 'section' => 'section-content-typo', - 'priority' => 4, - 'title' => __( 'Heading 1', 'astra' ), - 'settings' => array(), - ), - - /** - * Option: Heading 1 (H1) Font Size - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[font-size-h1]', - 'type' => 'control', - 'control' => 'ast-responsive', - 'section' => 'section-content-typo', - 'default' => astra_get_option( 'font-size-h1' ), - 'transport' => 'postMessage', - 'priority' => 6, - 'title' => __( 'Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - ), - - /** - * Option: Heading 2 (H2) Divider - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[divider-section-h2]', - 'type' => 'control', - 'control' => 'ast-heading', - 'section' => 'section-content-typo', - 'priority' => 9, - 'title' => __( 'Heading 2', 'astra' ), - 'settings' => array(), - ), - - /** - * Option: Heading 2 (H2) Font Size - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[font-size-h2]', - 'type' => 'control', - 'control' => 'ast-responsive', - 'section' => 'section-content-typo', - 'default' => astra_get_option( 'font-size-h2' ), - 'transport' => 'postMessage', - 'priority' => 11, - 'title' => __( 'Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - ), - - /** - * Option: Heading 3 (H3) Divider - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[divider-section-h3]', - 'type' => 'control', - 'control' => 'ast-heading', - 'section' => 'section-content-typo', - 'priority' => 15, - 'title' => __( 'Heading 3', 'astra' ), - 'settings' => array(), - ), - - /** - * Option: Heading 3 (H3) Font Size - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[font-size-h3]', - 'type' => 'control', - 'control' => 'ast-responsive', - 'section' => 'section-content-typo', - 'priority' => 16, - 'default' => astra_get_option( 'font-size-h3' ), - 'transport' => 'postMessage', - 'title' => __( 'Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - ), - - /** - * Option: Heading 4 (H4) Divider - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[divider-section-h4]', - 'type' => 'control', - 'title' => __( 'Heading 4', 'astra' ), - 'section' => 'section-content-typo', - 'control' => 'ast-heading', - 'priority' => 20, - 'settings' => array(), - ), - - /** - * Option: Heading 4 (H4) Font Size - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[font-size-h4]', - 'type' => 'control', - 'control' => 'ast-responsive', - 'section' => 'section-content-typo', - 'default' => astra_get_option( 'font-size-h4' ), - 'transport' => 'postMessage', - 'priority' => 21, - 'title' => __( 'Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - ), - - /** - * Option: Heading 5 (H5) Divider - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[divider-section-h5]', - 'type' => 'control', - 'control' => 'ast-heading', - 'section' => 'section-content-typo', - 'priority' => 25, - 'title' => __( 'Heading 5', 'astra' ), - 'settings' => array(), - ), - - /** - * Option: Heading 5 (H5) Font Size - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[font-size-h5]', - 'type' => 'control', - 'control' => 'ast-responsive', - 'section' => 'section-content-typo', - 'default' => astra_get_option( 'font-size-h5' ), - 'transport' => 'postMessage', - 'priority' => 26, - 'title' => __( 'Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - ), - - /** - * Option: Heading 6 (H6) Divider - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[divider-section-h6]', - 'type' => 'control', - 'control' => 'ast-heading', - 'title' => __( 'Heading 6', 'astra' ), - 'section' => 'section-content-typo', - 'priority' => 30, - 'settings' => array(), - ), - - /** - * Option: Heading 6 (H6) Font Size - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[font-size-h6]', - 'type' => 'control', - 'control' => 'ast-responsive', - 'section' => 'section-content-typo', - 'default' => astra_get_option( 'font-size-h6' ), - 'transport' => 'postMessage', - 'priority' => 31, - 'title' => __( 'Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - ), - ); - - $configurations = array_merge( $configurations, $_configs ); - - // Learn More link if Astra Pro is not activated. - if ( ! defined( 'ASTRA_EXT_VER' ) ) { - - $_configs = array( - /** - * Option: Learn More about Contant Typography - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[ast-content-typography-more-feature-description]', - 'type' => 'control', - 'control' => 'ast-description', - 'section' => 'section-content-typo', - 'priority' => 999, - 'title' => '', - 'help' => '

    ' . __( 'More Options Available in Astra Pro!', 'astra' ) . '

    ' . __( 'Learn More', 'astra' ) . '', - 'settings' => array(), - ), - ); - - $configurations = array_merge( $configurations, $_configs ); - - } - - return $configurations; - } - } -} - -new Astra_Content_Typo_Configs(); - - + ASTRA_THEME_SETTINGS . '[divider-section-h1]', + 'type' => 'control', + 'control' => 'ast-heading', + 'section' => 'section-content-typo', + 'priority' => 4, + 'title' => __( 'Heading 1', 'astra' ), + 'settings' => array(), + ), + + /** + * Option: Heading 1 (H1) Font Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-size-h1]', + 'type' => 'control', + 'control' => 'ast-responsive', + 'section' => 'section-content-typo', + 'default' => astra_get_option( 'font-size-h1' ), + 'transport' => 'postMessage', + 'priority' => 6, + 'title' => __( 'Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + + /** + * Option: Heading 2 (H2) Divider + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[divider-section-h2]', + 'type' => 'control', + 'control' => 'ast-heading', + 'section' => 'section-content-typo', + 'priority' => 9, + 'title' => __( 'Heading 2', 'astra' ), + 'settings' => array(), + ), + + /** + * Option: Heading 2 (H2) Font Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-size-h2]', + 'type' => 'control', + 'control' => 'ast-responsive', + 'section' => 'section-content-typo', + 'default' => astra_get_option( 'font-size-h2' ), + 'transport' => 'postMessage', + 'priority' => 11, + 'title' => __( 'Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + + /** + * Option: Heading 3 (H3) Divider + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[divider-section-h3]', + 'type' => 'control', + 'control' => 'ast-heading', + 'section' => 'section-content-typo', + 'priority' => 15, + 'title' => __( 'Heading 3', 'astra' ), + 'settings' => array(), + ), + + /** + * Option: Heading 3 (H3) Font Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-size-h3]', + 'type' => 'control', + 'control' => 'ast-responsive', + 'section' => 'section-content-typo', + 'priority' => 16, + 'default' => astra_get_option( 'font-size-h3' ), + 'transport' => 'postMessage', + 'title' => __( 'Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + + /** + * Option: Heading 4 (H4) Divider + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[divider-section-h4]', + 'type' => 'control', + 'title' => __( 'Heading 4', 'astra' ), + 'section' => 'section-content-typo', + 'control' => 'ast-heading', + 'priority' => 20, + 'settings' => array(), + ), + + /** + * Option: Heading 4 (H4) Font Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-size-h4]', + 'type' => 'control', + 'control' => 'ast-responsive', + 'section' => 'section-content-typo', + 'default' => astra_get_option( 'font-size-h4' ), + 'transport' => 'postMessage', + 'priority' => 21, + 'title' => __( 'Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + + /** + * Option: Heading 5 (H5) Divider + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[divider-section-h5]', + 'type' => 'control', + 'control' => 'ast-heading', + 'section' => 'section-content-typo', + 'priority' => 25, + 'title' => __( 'Heading 5', 'astra' ), + 'settings' => array(), + ), + + /** + * Option: Heading 5 (H5) Font Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-size-h5]', + 'type' => 'control', + 'control' => 'ast-responsive', + 'section' => 'section-content-typo', + 'default' => astra_get_option( 'font-size-h5' ), + 'transport' => 'postMessage', + 'priority' => 26, + 'title' => __( 'Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + + /** + * Option: Heading 6 (H6) Divider + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[divider-section-h6]', + 'type' => 'control', + 'control' => 'ast-heading', + 'title' => __( 'Heading 6', 'astra' ), + 'section' => 'section-content-typo', + 'priority' => 30, + 'settings' => array(), + ), + + /** + * Option: Heading 6 (H6) Font Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-size-h6]', + 'type' => 'control', + 'control' => 'ast-responsive', + 'section' => 'section-content-typo', + 'default' => astra_get_option( 'font-size-h6' ), + 'transport' => 'postMessage', + 'priority' => 31, + 'title' => __( 'Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + ); + + $configurations = array_merge( $configurations, $_configs ); + + // Learn More link if Astra Pro is not activated. + if ( ! defined( 'ASTRA_EXT_VER' ) ) { + + $_configs = array( + /** + * Option: Learn More about Contant Typography + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[ast-content-typography-more-feature-description]', + 'type' => 'control', + 'control' => 'ast-description', + 'section' => 'section-content-typo', + 'priority' => 999, + 'title' => '', + 'help' => '

    ' . __( 'More Options Available in Astra Pro!', 'astra' ) . '

    ' . __( 'Learn More', 'astra' ) . '', + 'settings' => array(), + ), + ); + + $configurations = array_merge( $configurations, $_configs ); + + } + + return $configurations; + } + } +} + +new Astra_Content_Typo_Configs(); + + diff --git a/inc/customizer/configurations/typography/class-astra-header-typo-configs.php b/inc/customizer/configurations/typography/class-astra-header-typo-configs.php index 6bff400..f1d0d64 100644 --- a/inc/customizer/configurations/typography/class-astra-header-typo-configs.php +++ b/inc/customizer/configurations/typography/class-astra-header-typo-configs.php @@ -1,230 +1,230 @@ - 'font-size-site-title', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[site-title-typography]', - 'section' => 'title_tagline', - 'control' => 'ast-responsive', - 'default' => astra_get_option( 'font-size-site-title' ), - 'transport' => 'postMessage', - 'priority' => 9, - 'title' => __( 'Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - ), - - /** - * Option: Site Tagline Font Size - */ - array( - 'name' => 'font-size-site-tagline', - 'type' => 'sub-control', - 'parent' => ASTRA_THEME_SETTINGS . '[site-tagline-typography]', - 'section' => 'title_tagline', - 'control' => 'ast-responsive', - 'default' => astra_get_option( 'font-size-site-tagline' ), - 'transport' => 'postMessage', - 'priority' => 14, - 'title' => __( 'Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - ), - ); - } else { - - $_configs = array( - - /** - * Option: Site Title Font Size - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[font-size-site-title]', - 'type' => 'control', - 'section' => 'title_tagline', - 'control' => 'ast-responsive', - 'default' => astra_get_option( 'font-size-site-title' ), - 'transport' => 'postMessage', - 'priority' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? 16 : 8, - 'title' => __( 'Title Font Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? array( - Astra_Builder_Helper::$design_tab_config, - array( - 'relation' => 'OR', - array( - 'setting' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', - 'setting-key' => 'desktop', - 'operator' => '==', - 'value' => true, - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', - 'setting-key' => 'tablet', - 'operator' => '==', - 'value' => true, - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', - 'setting-key' => 'mobile', - 'operator' => '==', - 'value' => true, - ), - ), - ) : array( - array( - 'relation' => 'OR', - array( - 'setting' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', - 'setting-key' => 'desktop', - 'operator' => '==', - 'value' => true, - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', - 'setting-key' => 'tablet', - 'operator' => '==', - 'value' => true, - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', - 'setting-key' => 'mobile', - 'operator' => '==', - 'value' => true, - ), - ), - ), - ), - - /** - * Option: Site Tagline Font Size - */ - array( - 'name' => ASTRA_THEME_SETTINGS . '[font-size-site-tagline]', - 'type' => 'control', - 'section' => 'title_tagline', - 'control' => 'ast-responsive', - 'default' => astra_get_option( 'font-size-site-tagline' ), - 'transport' => 'postMessage', - 'priority' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? 20 : 12, - 'title' => __( 'Tagline Font Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? array( - Astra_Builder_Helper::$design_tab_config, - array( - 'relation' => 'OR', - array( - 'setting' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', - 'setting-key' => 'desktop', - 'operator' => '==', - 'value' => true, - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', - 'setting-key' => 'tablet', - 'operator' => '==', - 'value' => true, - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', - 'setting-key' => 'mobile', - 'operator' => '==', - 'value' => true, - ), - ), - ) : array( - array( - 'relation' => 'OR', - array( - 'setting' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', - 'setting-key' => 'desktop', - 'operator' => '==', - 'value' => true, - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', - 'setting-key' => 'tablet', - 'operator' => '==', - 'value' => true, - ), - array( - 'setting' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', - 'setting-key' => 'mobile', - 'operator' => '==', - 'value' => true, - ), - ), - ), - ), - ); - } - - $configurations = array_merge( $configurations, $_configs ); - - return $configurations; - } - } -} - -new Astra_Header_Typo_Configs(); - - + 'font-size-site-title', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[site-title-typography]', + 'section' => 'title_tagline', + 'control' => 'ast-responsive', + 'default' => astra_get_option( 'font-size-site-title' ), + 'transport' => 'postMessage', + 'priority' => 9, + 'title' => __( 'Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + + /** + * Option: Site Tagline Font Size + */ + array( + 'name' => 'font-size-site-tagline', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[site-tagline-typography]', + 'section' => 'title_tagline', + 'control' => 'ast-responsive', + 'default' => astra_get_option( 'font-size-site-tagline' ), + 'transport' => 'postMessage', + 'priority' => 14, + 'title' => __( 'Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + ); + } else { + + $_configs = array( + + /** + * Option: Site Title Font Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-size-site-title]', + 'type' => 'control', + 'section' => 'title_tagline', + 'control' => 'ast-responsive', + 'default' => astra_get_option( 'font-size-site-title' ), + 'transport' => 'postMessage', + 'priority' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? 16 : 8, + 'title' => __( 'Title Font Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? array( + Astra_Builder_Helper::$design_tab_config, + array( + 'relation' => 'OR', + array( + 'setting' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', + 'setting-key' => 'desktop', + 'operator' => '==', + 'value' => true, + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', + 'setting-key' => 'tablet', + 'operator' => '==', + 'value' => true, + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', + 'setting-key' => 'mobile', + 'operator' => '==', + 'value' => true, + ), + ), + ) : array( + array( + 'relation' => 'OR', + array( + 'setting' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', + 'setting-key' => 'desktop', + 'operator' => '==', + 'value' => true, + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', + 'setting-key' => 'tablet', + 'operator' => '==', + 'value' => true, + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[display-site-title-responsive]', + 'setting-key' => 'mobile', + 'operator' => '==', + 'value' => true, + ), + ), + ), + ), + + /** + * Option: Site Tagline Font Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-size-site-tagline]', + 'type' => 'control', + 'section' => 'title_tagline', + 'control' => 'ast-responsive', + 'default' => astra_get_option( 'font-size-site-tagline' ), + 'transport' => 'postMessage', + 'priority' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? 20 : 12, + 'title' => __( 'Tagline Font Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? array( + Astra_Builder_Helper::$design_tab_config, + array( + 'relation' => 'OR', + array( + 'setting' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', + 'setting-key' => 'desktop', + 'operator' => '==', + 'value' => true, + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', + 'setting-key' => 'tablet', + 'operator' => '==', + 'value' => true, + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', + 'setting-key' => 'mobile', + 'operator' => '==', + 'value' => true, + ), + ), + ) : array( + array( + 'relation' => 'OR', + array( + 'setting' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', + 'setting-key' => 'desktop', + 'operator' => '==', + 'value' => true, + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', + 'setting-key' => 'tablet', + 'operator' => '==', + 'value' => true, + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[display-site-tagline-responsive]', + 'setting-key' => 'mobile', + 'operator' => '==', + 'value' => true, + ), + ), + ), + ), + ); + } + + $configurations = array_merge( $configurations, $_configs ); + + return $configurations; + } + } +} + +new Astra_Header_Typo_Configs(); + + diff --git a/inc/customizer/configurations/typography/class-astra-single-typo-configs.php b/inc/customizer/configurations/typography/class-astra-single-typo-configs.php index a1dd398..2977f4a 100644 --- a/inc/customizer/configurations/typography/class-astra-single-typo-configs.php +++ b/inc/customizer/configurations/typography/class-astra-single-typo-configs.php @@ -1,136 +1,136 @@ - ASTRA_THEME_SETTINGS . '[ast-sngle-blog-typography-more-feature-description]', - 'type' => 'control', - 'control' => 'ast-description', - 'section' => 'section-blog-single', - 'priority' => 999, - 'title' => '', - 'help' => '

    ' . __( 'More Options Available in Astra Pro!', 'astra' ) . '

    ' . __( 'Learn More', 'astra' ) . '', - 'settings' => array(), - 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), - ), - - ); - } - - if ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'typography' ) ) { - - $new_configs = array( - - array( - 'name' => ASTRA_THEME_SETTINGS . '[blog-single-title-typo]', - 'type' => 'control', - 'priority' => Astra_Builder_Helper::$is_header_footer_builder_active ? - 13 : 20, - 'control' => 'ast-settings-group', - 'title' => __( 'Post / Page Title Font', 'astra' ), - 'section' => 'section-blog-single', - 'transport' => 'postMessage', - 'context' => Astra_Builder_Helper::$is_header_footer_builder_active ? - Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, - ), - - /** - * Option: Single Post / Page Title Font Size - */ - array( - 'name' => 'font-size-entry-title', - 'parent' => ASTRA_THEME_SETTINGS . '[blog-single-title-typo]', - 'section' => 'section-blog-single', - 'type' => 'sub-control', - 'control' => 'ast-responsive', - 'default' => astra_get_option( 'font-size-entry-title' ), - 'transport' => 'postMessage', - 'priority' => 8, - 'title' => __( 'Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - ), - ); - } else { - - $new_configs = array(); - - /** - * Option: Single Post / Page Title Font Size - */ - $new_configs[] = array( - 'name' => ASTRA_THEME_SETTINGS . '[font-size-entry-title]', - 'section' => 'section-blog-single', - 'type' => 'control', - 'control' => 'ast-responsive', - 'default' => astra_get_option( 'font-size-entry-title' ), - 'transport' => 'postMessage', - 'priority' => 9, - 'title' => __( 'Post / Page Title Font Size', 'astra' ), - 'input_attrs' => array( - 'min' => 0, - ), - 'units' => array( - 'px' => 'px', - 'em' => 'em', - ), - 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? - Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, - ); - } - - $_configs = array_merge( $_configs, $new_configs ); - - $configurations = array_merge( $configurations, $_configs ); - - return $configurations; - } - } -} - -new Astra_Single_Typo_Configs(); + ASTRA_THEME_SETTINGS . '[ast-sngle-blog-typography-more-feature-description]', + 'type' => 'control', + 'control' => 'ast-description', + 'section' => 'section-blog-single', + 'priority' => 999, + 'title' => '', + 'help' => '

    ' . __( 'More Options Available in Astra Pro!', 'astra' ) . '

    ' . __( 'Learn More', 'astra' ) . '', + 'settings' => array(), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + ); + } + + if ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'typography' ) ) { + + $new_configs = array( + + array( + 'name' => ASTRA_THEME_SETTINGS . '[blog-single-title-typo]', + 'type' => 'control', + 'priority' => Astra_Builder_Helper::$is_header_footer_builder_active ? + 13 : 20, + 'control' => 'ast-settings-group', + 'title' => __( 'Post / Page Title Font', 'astra' ), + 'section' => 'section-blog-single', + 'transport' => 'postMessage', + 'context' => Astra_Builder_Helper::$is_header_footer_builder_active ? + Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + ), + + /** + * Option: Single Post / Page Title Font Size + */ + array( + 'name' => 'font-size-entry-title', + 'parent' => ASTRA_THEME_SETTINGS . '[blog-single-title-typo]', + 'section' => 'section-blog-single', + 'type' => 'sub-control', + 'control' => 'ast-responsive', + 'default' => astra_get_option( 'font-size-entry-title' ), + 'transport' => 'postMessage', + 'priority' => 8, + 'title' => __( 'Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + ); + } else { + + $new_configs = array(); + + /** + * Option: Single Post / Page Title Font Size + */ + $new_configs[] = array( + 'name' => ASTRA_THEME_SETTINGS . '[font-size-entry-title]', + 'section' => 'section-blog-single', + 'type' => 'control', + 'control' => 'ast-responsive', + 'default' => astra_get_option( 'font-size-entry-title' ), + 'transport' => 'postMessage', + 'priority' => 9, + 'title' => __( 'Post / Page Title Font Size', 'astra' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? + Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + ); + } + + $_configs = array_merge( $_configs, $new_configs ); + + $configurations = array_merge( $configurations, $_configs ); + + return $configurations; + } + } +} + +new Astra_Single_Typo_Configs(); diff --git a/inc/customizer/custom-controls/class-astra-customizer-control-base.php b/inc/customizer/custom-controls/class-astra-customizer-control-base.php index 8af15db..da1d0ae 100644 --- a/inc/customizer/custom-controls/class-astra-customizer-control-base.php +++ b/inc/customizer/custom-controls/class-astra-customizer-control-base.php @@ -1,238 +1,238 @@ - __( 'Thin 100', 'astra' ), - '100italic' => __( '100 Italic', 'astra' ), - '200' => __( 'Extra-Light 200', 'astra' ), - '200italic' => __( '200 Italic', 'astra' ), - '300' => __( 'Light 300', 'astra' ), - '300italic' => __( '300 Italic', 'astra' ), - '400' => __( 'Normal 400', 'astra' ), - 'italic' => __( '400 Italic', 'astra' ), - '500' => __( 'Medium 500', 'astra' ), - '500italic' => __( '500 Italic', 'astra' ), - '600' => __( 'Semi-Bold 600', 'astra' ), - '600italic' => __( '600 Italic', 'astra' ), - '700' => __( 'Bold 700', 'astra' ), - '700italic' => __( '700 Italic', 'astra' ), - '800' => __( 'Extra-Bold 800', 'astra' ), - '800italic' => __( '800 Italic', 'astra' ), - '900' => __( 'Ultra-Bold 900', 'astra' ), - '900italic' => __( '900 Italic', 'astra' ), - ); - - wp_localize_script( 'astra-custom-control-script', 'astraTypo', $astra_typo_localize ); - $localize_array = array( - 'colors' => astra_color_palette(), - ); - - wp_localize_script( 'astra-custom-control-script', 'astColorPalette', $localize_array ); - - } else { - - // Enqueue Customizer Plain script. - $custom_controls_plain_deps = array( - 'jquery', - 'customize-base', - 'jquery-ui-tabs', - 'jquery-ui-sortable', - ); - wp_enqueue_script( 'astra-custom-control-plain-script', $js_uri . 'custom-controls-plain' . $file_prefix . '.js', $custom_controls_plain_deps, ASTRA_THEME_VERSION, true ); - - // Enqueue Customizer React.JS script. - $custom_controls_react_deps = array( - 'astra-custom-control-plain-script', - 'wp-i18n', - 'wp-components', - 'wp-element', - 'wp-media-utils', - 'wp-block-editor', - ); - - $css_uri = ASTRA_THEME_URI . 'inc/customizer/custom-controls/typography/'; - - wp_enqueue_style( 'astra-select-woo-style', $css_uri . 'selectWoo.css', null, ASTRA_THEME_VERSION ); - - wp_enqueue_script( 'astra-custom-control-react-script', ASTRA_THEME_URI . 'inc/customizer/extend-custom-controls/build/index.js', $custom_controls_react_deps, ASTRA_THEME_VERSION, true ); - - $localize_array = array( - 'colors' => astra_color_palette(), - ); - - $astra_typo_localize = array( - '100' => __( 'Thin 100', 'astra' ), - '100italic' => __( '100 Italic', 'astra' ), - '200' => __( 'Extra-Light 200', 'astra' ), - '200italic' => __( '200 Italic', 'astra' ), - '300' => __( 'Light 300', 'astra' ), - '300italic' => __( '300 Italic', 'astra' ), - '400' => __( 'Normal 400', 'astra' ), - 'italic' => __( '400 Italic', 'astra' ), - '500' => __( 'Medium 500', 'astra' ), - '500italic' => __( '500 Italic', 'astra' ), - '600' => __( 'Semi-Bold 600', 'astra' ), - '600italic' => __( '600 Italic', 'astra' ), - '700' => __( 'Bold 700', 'astra' ), - '700italic' => __( '700 Italic', 'astra' ), - '800' => __( 'Extra-Bold 800', 'astra' ), - '800italic' => __( '800 Italic', 'astra' ), - '900' => __( 'Ultra-Bold 900', 'astra' ), - '900italic' => __( '900 Italic', 'astra' ), - ); - - wp_localize_script( 'astra-custom-control-react-script', 'astColorPalette', $localize_array ); - wp_localize_script( 'astra-custom-control-react-script', 'astraTypo', $astra_typo_localize ); - } - } - - /** - * Add Control to self::$controls and Register control to WordPress Customizer. - * - * @param String $name Slug for the control. - * @param Array $atts Control Attributes. - * @return void - */ - public static function add_control( $name, $atts ) { - global $wp_customize; - self::$controls[ $name ] = $atts; - - if ( isset( $atts['callback'] ) ) { - /** - * Register controls - */ - $wp_customize->register_control_type( $atts['callback'] ); - } - } - - /** - * Returns control instance - * - * @param string $control_type control type. - * @since 1.4.3 - * @return string - */ - public static function get_control_instance( $control_type ) { - $control_class = self::get_control( $control_type ); - - if ( isset( $control_class['callback'] ) ) { - return class_exists( $control_class['callback'] ) ? $control_class['callback'] : false; - } - - return false; - } - - /** - * Returns control and its attributes - * - * @param string $control_type control type. - * @since 1.4.3 - * @return array - */ - public static function get_control( $control_type ) { - if ( isset( self::$controls[ $control_type ] ) ) { - return self::$controls[ $control_type ]; - } - - return array(); - } - - /** - * Returns Santize callback for control - * - * @param string $control control. - * @since 1.4.3 - * @return string - */ - public static function get_sanitize_call( $control ) { - - if ( isset( self::$controls[ $control ]['sanitize_callback'] ) ) { - return self::$controls[ $control ]['sanitize_callback']; - } - - return false; - } - } -} - -/** - * Kicking this off by calling 'get_instance()' method - */ -new Astra_Customizer_Control_Base(); + __( 'Thin 100', 'astra' ), + '100italic' => __( '100 Italic', 'astra' ), + '200' => __( 'Extra-Light 200', 'astra' ), + '200italic' => __( '200 Italic', 'astra' ), + '300' => __( 'Light 300', 'astra' ), + '300italic' => __( '300 Italic', 'astra' ), + '400' => __( 'Normal 400', 'astra' ), + 'italic' => __( '400 Italic', 'astra' ), + '500' => __( 'Medium 500', 'astra' ), + '500italic' => __( '500 Italic', 'astra' ), + '600' => __( 'Semi-Bold 600', 'astra' ), + '600italic' => __( '600 Italic', 'astra' ), + '700' => __( 'Bold 700', 'astra' ), + '700italic' => __( '700 Italic', 'astra' ), + '800' => __( 'Extra-Bold 800', 'astra' ), + '800italic' => __( '800 Italic', 'astra' ), + '900' => __( 'Ultra-Bold 900', 'astra' ), + '900italic' => __( '900 Italic', 'astra' ), + ); + + wp_localize_script( 'astra-custom-control-script', 'astraTypo', $astra_typo_localize ); + $localize_array = array( + 'colors' => astra_color_palette(), + ); + + wp_localize_script( 'astra-custom-control-script', 'astColorPalette', $localize_array ); + + } else { + + // Enqueue Customizer Plain script. + $custom_controls_plain_deps = array( + 'jquery', + 'customize-base', + 'jquery-ui-tabs', + 'jquery-ui-sortable', + ); + wp_enqueue_script( 'astra-custom-control-plain-script', $js_uri . 'custom-controls-plain' . $file_prefix . '.js', $custom_controls_plain_deps, ASTRA_THEME_VERSION, true ); + + // Enqueue Customizer React.JS script. + $custom_controls_react_deps = array( + 'astra-custom-control-plain-script', + 'wp-i18n', + 'wp-components', + 'wp-element', + 'wp-media-utils', + 'wp-block-editor', + ); + + $css_uri = ASTRA_THEME_URI . 'inc/customizer/custom-controls/typography/'; + + wp_enqueue_style( 'astra-select-woo-style', $css_uri . 'selectWoo.css', null, ASTRA_THEME_VERSION ); + + wp_enqueue_script( 'astra-custom-control-react-script', ASTRA_THEME_URI . 'inc/customizer/extend-custom-controls/build/index.js', $custom_controls_react_deps, ASTRA_THEME_VERSION, true ); + + $localize_array = array( + 'colors' => astra_color_palette(), + ); + + $astra_typo_localize = array( + '100' => __( 'Thin 100', 'astra' ), + '100italic' => __( '100 Italic', 'astra' ), + '200' => __( 'Extra-Light 200', 'astra' ), + '200italic' => __( '200 Italic', 'astra' ), + '300' => __( 'Light 300', 'astra' ), + '300italic' => __( '300 Italic', 'astra' ), + '400' => __( 'Normal 400', 'astra' ), + 'italic' => __( '400 Italic', 'astra' ), + '500' => __( 'Medium 500', 'astra' ), + '500italic' => __( '500 Italic', 'astra' ), + '600' => __( 'Semi-Bold 600', 'astra' ), + '600italic' => __( '600 Italic', 'astra' ), + '700' => __( 'Bold 700', 'astra' ), + '700italic' => __( '700 Italic', 'astra' ), + '800' => __( 'Extra-Bold 800', 'astra' ), + '800italic' => __( '800 Italic', 'astra' ), + '900' => __( 'Ultra-Bold 900', 'astra' ), + '900italic' => __( '900 Italic', 'astra' ), + ); + + wp_localize_script( 'astra-custom-control-react-script', 'astColorPalette', $localize_array ); + wp_localize_script( 'astra-custom-control-react-script', 'astraTypo', $astra_typo_localize ); + } + } + + /** + * Add Control to self::$controls and Register control to WordPress Customizer. + * + * @param String $name Slug for the control. + * @param Array $atts Control Attributes. + * @return void + */ + public static function add_control( $name, $atts ) { + global $wp_customize; + self::$controls[ $name ] = $atts; + + if ( isset( $atts['callback'] ) ) { + /** + * Register controls + */ + $wp_customize->register_control_type( $atts['callback'] ); + } + } + + /** + * Returns control instance + * + * @param string $control_type control type. + * @since 1.4.3 + * @return string + */ + public static function get_control_instance( $control_type ) { + $control_class = self::get_control( $control_type ); + + if ( isset( $control_class['callback'] ) ) { + return class_exists( $control_class['callback'] ) ? $control_class['callback'] : false; + } + + return false; + } + + /** + * Returns control and its attributes + * + * @param string $control_type control type. + * @since 1.4.3 + * @return array + */ + public static function get_control( $control_type ) { + if ( isset( self::$controls[ $control_type ] ) ) { + return self::$controls[ $control_type ]; + } + + return array(); + } + + /** + * Returns Santize callback for control + * + * @param string $control control. + * @since 1.4.3 + * @return string + */ + public static function get_sanitize_call( $control ) { + + if ( isset( self::$controls[ $control ]['sanitize_callback'] ) ) { + return self::$controls[ $control ]['sanitize_callback']; + } + + return false; + } + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +new Astra_Customizer_Control_Base(); diff --git a/inc/customizer/custom-controls/customizer-link/class-astra-control-customizer-link.php b/inc/customizer/custom-controls/customizer-link/class-astra-control-customizer-link.php index a1af417..14ce81a 100644 --- a/inc/customizer/custom-controls/customizer-link/class-astra-control-customizer-link.php +++ b/inc/customizer/custom-controls/customizer-link/class-astra-control-customizer-link.php @@ -1,69 +1,69 @@ -json['link_text'] = $this->link_text; - $this->json['linked'] = $this->linked; - $this->json['link_type'] = $this->link_type; - } - - /** - * Render the control's content. - * - * @see WP_Customize_Control::render_content() - */ - protected function render_content() {} -} +json['link_text'] = $this->link_text; + $this->json['linked'] = $this->linked; + $this->json['link_type'] = $this->link_type; + } + + /** + * Render the control's content. + * + * @see WP_Customize_Control::render_content() + */ + protected function render_content() {} +} diff --git a/inc/customizer/custom-controls/description/class-astra-control-description.php b/inc/customizer/custom-controls/description/class-astra-control-description.php index dd38119..66edf42 100644 --- a/inc/customizer/custom-controls/description/class-astra-control-description.php +++ b/inc/customizer/custom-controls/description/class-astra-control-description.php @@ -1,57 +1,57 @@ -json['label'] = esc_html( $this->label ); - $this->json['description'] = $this->description; - $this->json['help'] = $this->help; - } - - /** - * Render the control's content. - * - * @see WP_Customize_Control::render_content() - */ - protected function render_content() {} -} +json['label'] = esc_html( $this->label ); + $this->json['description'] = $this->description; + $this->json['help'] = $this->help; + } + + /** + * Render the control's content. + * + * @see WP_Customize_Control::render_content() + */ + protected function render_content() {} +} diff --git a/inc/customizer/custom-controls/index.php b/inc/customizer/custom-controls/index.php index 8b96815..820bcb9 100644 --- a/inc/customizer/custom-controls/index.php +++ b/inc/customizer/custom-controls/index.php @@ -1,9 +1,9 @@ -ast_inherit = __( 'Inherit', 'astra' ); - $this->ast_all_font_weight = array( - '100' => __( 'Thin 100', 'astra' ), - '100italic' => __( '100 Italic', 'astra' ), - '200' => __( 'Extra-Light 200', 'astra' ), - '200italic' => __( '200 Italic', 'astra' ), - '300' => __( 'Light 300', 'astra' ), - '300italic' => __( '300 Italic', 'astra' ), - '400' => __( 'Normal 400', 'astra' ), - 'italic' => __( '400 Italic', 'astra' ), - '500' => __( 'Medium 500', 'astra' ), - '500italic' => __( '500 Italic', 'astra' ), - '600' => __( 'Semi-Bold 600', 'astra' ), - '600italic' => __( '600 Italic', 'astra' ), - '700' => __( 'Bold 700', 'astra' ), - '700italic' => __( '700 Italic', 'astra' ), - '800' => __( 'Extra-Bold 800', 'astra' ), - '800italic' => __( '800 Italic', 'astra' ), - '900' => __( 'Ultra-Bold 900', 'astra' ), - '900italic' => __( '900 Italic', 'astra' ), - ); - parent::__construct( $manager, $id, $args ); - } - - /** - * Refresh the parameters passed to the JavaScript via JSON. - * - * @see WP_Customize_Control::to_json() - */ - public function to_json() { - - parent::to_json(); - - $this->json['label'] = esc_html( $this->label ); - $this->json['description'] = $this->description; - $this->json['name'] = $this->name; - $this->json['value'] = $this->value(); - $this->json['connect'] = $this->connect; - $this->json['variant'] = $this->variant; - $this->json['link'] = $this->get_link(); - $this->json['ast_all_font_weight'] = $this->ast_all_font_weight; - } - - /** - * An Underscore (JS) template for this control's content (but not its container). - * - * Class variables for this control class are available in the `data` JS object; - * export custom variables by overriding {@see WP_Customize_Control::to_json()}. - * - * @see WP_Customize_Control::print_template() - * - * @access protected - */ - protected function content_template() { - - ?> - - - - - ast_inherit = __( 'Inherit', 'astra' ); + $this->ast_all_font_weight = array( + '100' => __( 'Thin 100', 'astra' ), + '100italic' => __( '100 Italic', 'astra' ), + '200' => __( 'Extra-Light 200', 'astra' ), + '200italic' => __( '200 Italic', 'astra' ), + '300' => __( 'Light 300', 'astra' ), + '300italic' => __( '300 Italic', 'astra' ), + '400' => __( 'Normal 400', 'astra' ), + 'italic' => __( '400 Italic', 'astra' ), + '500' => __( 'Medium 500', 'astra' ), + '500italic' => __( '500 Italic', 'astra' ), + '600' => __( 'Semi-Bold 600', 'astra' ), + '600italic' => __( '600 Italic', 'astra' ), + '700' => __( 'Bold 700', 'astra' ), + '700italic' => __( '700 Italic', 'astra' ), + '800' => __( 'Extra-Bold 800', 'astra' ), + '800italic' => __( '800 Italic', 'astra' ), + '900' => __( 'Ultra-Bold 900', 'astra' ), + '900italic' => __( '900 Italic', 'astra' ), + ); + parent::__construct( $manager, $id, $args ); + } + + /** + * Refresh the parameters passed to the JavaScript via JSON. + * + * @see WP_Customize_Control::to_json() + */ + public function to_json() { + + parent::to_json(); + + $this->json['label'] = esc_html( $this->label ); + $this->json['description'] = $this->description; + $this->json['name'] = $this->name; + $this->json['value'] = $this->value(); + $this->json['connect'] = $this->connect; + $this->json['variant'] = $this->variant; + $this->json['link'] = $this->get_link(); + $this->json['ast_all_font_weight'] = $this->ast_all_font_weight; + } + + /** + * An Underscore (JS) template for this control's content (but not its container). + * + * Class variables for this control class are available in the `data` JS object; + * export custom variables by overriding {@see WP_Customize_Control::to_json()}. + * + * @see WP_Customize_Control::print_template() + * + * @access protected + */ + protected function content_template() { + + ?> + + + + + title, ENT_QUOTES, get_bloginfo( 'charset' ) ); - $array['content'] = $this->get_content(); - $array['active'] = $this->active(); - $array['instanceNumber'] = $this->instance_number; - - return $array; - } - } - -} - +title, ENT_QUOTES, get_bloginfo( 'charset' ) ); + $array['content'] = $this->get_content(); + $array['active'] = $this->active(); + $array['instanceNumber'] = $this->instance_number; + + return $array; + } + } + +} + diff --git a/inc/customizer/extend-customizer/class-astra-wp-customize-section.php b/inc/customizer/extend-customizer/class-astra-wp-customize-section.php index 363ff36..cd2719a 100644 --- a/inc/customizer/extend-customizer/class-astra-wp-customize-section.php +++ b/inc/customizer/extend-customizer/class-astra-wp-customize-section.php @@ -1,68 +1,68 @@ -title, ENT_QUOTES, get_bloginfo( 'charset' ) ); - $array['content'] = $this->get_content(); - $array['active'] = $this->active(); - $array['instanceNumber'] = $this->instance_number; - - if ( $this->panel ) { - $array['customizeAction'] = sprintf( 'Customizing ▸ %s', esc_html( $this->manager->get_panel( $this->panel )->title ) ); - } else { - $array['customizeAction'] = 'Customizing'; - } - - return $array; - } - } -} +title, ENT_QUOTES, get_bloginfo( 'charset' ) ); + $array['content'] = $this->get_content(); + $array['active'] = $this->active(); + $array['instanceNumber'] = $this->instance_number; + + if ( $this->panel ) { + $array['customizeAction'] = sprintf( 'Customizing ▸ %s', esc_html( $this->manager->get_panel( $this->panel )->title ) ); + } else { + $array['customizeAction'] = 'Customizing'; + } + + return $array; + } + } +} diff --git a/inc/customizer/extend-customizer/class-astra-wp-customize-separator.php b/inc/customizer/extend-customizer/class-astra-wp-customize-separator.php index 0f195f7..a2f1ab1 100644 --- a/inc/customizer/extend-customizer/class-astra-wp-customize-separator.php +++ b/inc/customizer/extend-customizer/class-astra-wp-customize-separator.php @@ -1,49 +1,49 @@ - -
  • - +
  • + get_section( 'title_tagline' )->priority = 5; -$wp_customize->get_section( 'title_tagline' )->panel = 'panel-header-group'; - -/** - * Override Settings - */ -$wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; -$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; -$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; -$wp_customize->get_setting( 'custom_logo' )->transport = 'refresh'; - -/** - * Override Controls - */ -$wp_customize->get_control( 'custom_logo' )->priority = 5; -$wp_customize->get_control( 'blogname' )->priority = 8; -$wp_customize->get_control( 'blogdescription' )->priority = 12; -$wp_customize->get_control( 'header_textcolor' )->priority = 9; -$wp_customize->get_control( 'site_icon' )->priority = 16; -$wp_customize->get_control( 'site_icon' )->label = ''; - -if ( isset( $wp_customize->selective_refresh ) ) { - $wp_customize->selective_refresh->add_partial( - 'blogname', - array( - 'selector' => '.main-header-bar .site-title a, .ast-small-footer-wrap .ast-footer-site-title', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Customizer_Partials::render_partial_site_title', - ) - ); -} - -if ( isset( $wp_customize->selective_refresh ) ) { - $wp_customize->selective_refresh->add_partial( - 'blogdescription', - array( - 'selector' => '.main-header-bar .site-description', - 'container_inclusive' => false, - 'render_callback' => 'Astra_Customizer_Partials::render_partial_site_tagline', - ) - ); -} - -/* - * Modify WooCommerce default section priorities -*/ -if ( class_exists( 'WooCommerce' ) ) { - $wp_customize->get_section( 'woocommerce_store_notice' )->priority = 9; - $wp_customize->get_section( 'woocommerce_product_catalog' )->priority = 11; - $wp_customize->get_section( 'woocommerce_checkout' )->priority = 21; - $wp_customize->get_panel( 'woocommerce' )->priority = 70; -} +get_section( 'title_tagline' )->priority = 5; +$wp_customize->get_section( 'title_tagline' )->panel = 'panel-header-group'; + +/** + * Override Settings + */ +$wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; +$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; +$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; +$wp_customize->get_setting( 'custom_logo' )->transport = 'refresh'; + +/** + * Override Controls + */ +$wp_customize->get_control( 'custom_logo' )->priority = 5; +$wp_customize->get_control( 'blogname' )->priority = 8; +$wp_customize->get_control( 'blogdescription' )->priority = 12; +$wp_customize->get_control( 'header_textcolor' )->priority = 9; +$wp_customize->get_control( 'site_icon' )->priority = 16; +$wp_customize->get_control( 'site_icon' )->label = ''; + +if ( isset( $wp_customize->selective_refresh ) ) { + $wp_customize->selective_refresh->add_partial( + 'blogname', + array( + 'selector' => '.main-header-bar .site-title a, .ast-small-footer-wrap .ast-footer-site-title', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Customizer_Partials::render_partial_site_title', + ) + ); +} + +if ( isset( $wp_customize->selective_refresh ) ) { + $wp_customize->selective_refresh->add_partial( + 'blogdescription', + array( + 'selector' => '.main-header-bar .site-description', + 'container_inclusive' => false, + 'render_callback' => 'Astra_Customizer_Partials::render_partial_site_tagline', + ) + ); +} + +/* + * Modify WooCommerce default section priorities +*/ +if ( class_exists( 'WooCommerce' ) ) { + $wp_customize->get_section( 'woocommerce_store_notice' )->priority = 9; + $wp_customize->get_section( 'woocommerce_product_catalog' )->priority = 11; + $wp_customize->get_section( 'woocommerce_checkout' )->priority = 21; + $wp_customize->get_panel( 'woocommerce' )->priority = 70; +} -- cgit v1.2.3-70-g09d2