#js&&****&……PK ZM M class-astra-admin-helper.phpnu [
tag in admin page
*
* @param String $classes body classes returned from the filter.
* @return String body classes to be added to
tag in admin page
*/
public function admin_body_class( $classes ) {
global $pagenow;
$screen = get_current_screen();
if ( true === apply_filters( 'astra_block_editor_hover_effect', true ) ) {
$classes .= ' ast-highlight-wpblock-onhover';
}
if ( ( ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) && ( defined( 'ASTRA_ADVANCED_HOOKS_POST_TYPE' ) && ASTRA_ADVANCED_HOOKS_POST_TYPE == $screen->post_type ) ) || 'widgets.php' == $pagenow ) {
return $classes;
}
$post_id = get_the_ID();
$is_boxed = astra_is_content_style_boxed( $post_id );
$is_sidebar_boxed = astra_is_sidebar_style_boxed( $post_id );
$classes .= $is_boxed ? ' ast-default-content-style-boxed' : ' ast-default-content-unboxed';
$classes .= $is_sidebar_boxed ? ' ast-default-sidebar-style-boxed' : ' ast-default-sidebar-unboxed';
if ( $post_id ) {
$meta_content_layout = astra_toggle_layout( 'ast-site-content-layout', 'meta', $post_id );
}
if ( ( isset( $meta_content_layout ) && ! empty( $meta_content_layout ) ) && 'default' !== $meta_content_layout ) {
$content_layout = $meta_content_layout;
} else {
$content_layout = astra_toggle_layout( 'ast-site-content-layout', 'global', false );
}
$editor_default_content_layout = astra_toggle_layout( 'single-' . strval( get_post_type() ) . '-ast-content-layout', 'single', false );
if ( 'default' === $editor_default_content_layout || empty( $editor_default_content_layout ) ) {
// Get the GLOBAL content layout value.
// NOTE: Here not used `true` in the below function call.
$editor_default_content_layout = astra_toggle_layout( 'ast-site-content-layout', 'global', false );
$editor_default_content_layout = astra_apply_boxed_layouts( $editor_default_content_layout, $is_boxed, $is_sidebar_boxed, $post_id );
$classes .= ' ast-default-layout-' . $editor_default_content_layout;
} else {
$editor_default_content_layout = astra_apply_boxed_layouts( $editor_default_content_layout, $is_boxed, $is_sidebar_boxed, $post_id );
$classes .= ' ast-default-layout-' . $editor_default_content_layout;
}
$content_layout = astra_apply_boxed_layouts( $content_layout, $is_boxed, $is_sidebar_boxed, $post_id );
if ( 'content-boxed-container' == $content_layout ) {
$classes .= ' ast-separate-container';
} elseif ( 'boxed-container' == $content_layout ) {
$classes .= ' ast-separate-container ast-two-container';
} elseif ( 'page-builder' == $content_layout ) {
$classes .= ' ast-page-builder-template';
} elseif ( 'plain-container' == $content_layout ) {
$classes .= ' ast-plain-container';
} elseif ( 'narrow-container' == $content_layout ) {
$classes .= ' ast-narrow-container';
}
$site_layout = astra_get_option( 'site-layout' );
if ( 'ast-box-layout' === $site_layout ) {
$classes .= ' ast-max-width-layout';
}
// block CSS class.
if ( astra_block_based_legacy_setup() ) {
$classes .= ' ast-block-legacy';
} else {
$classes .= ' ast-block-custom';
}
$classes .= ' ast-' . astra_page_layout();
$classes .= ' ast-sidebar-default-' . astra_get_sidebar_layout_for_editor( strval( get_post_type() ) );
return $classes;
}
/**
* List of all assets.
*
* @return array assets array.
*/
public static function theme_assets() {
$default_assets = array(
// handle => location ( in /assets/js/ ) ( without .js ext).
'js' => array(
'astra-theme-js' => 'style',
),
// handle => location ( in /assets/css/ ) ( without .css ext).
'css' => array(
'astra-theme-css' => Astra_Builder_Helper::apply_flex_based_css() ? 'style-flex' : 'style',
),
);
if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
$default_assets = array(
// handle => location ( in /assets/js/ ) ( without .js ext).
'js' => array(
'astra-theme-js' => 'frontend',
),
// handle => location ( in /assets/css/ ) ( without .css ext).
'css' => array(
'astra-theme-css' => Astra_Builder_Helper::apply_flex_based_css() ? 'main' : 'frontend',
),
);
if ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, '3.5.9', '<' ) ) {
$default_assets['js']['astra-theme-js-pro'] = 'frontend-pro';
}
if ( ( class_exists( 'Easy_Digital_Downloads' ) && Astra_Builder_Helper::is_component_loaded( 'edd-cart', 'header' ) ) ||
( class_exists( 'WooCommerce' ) && Astra_Builder_Helper::is_component_loaded( 'woo-cart', 'header' ) ) ) {
$default_assets['js']['astra-mobile-cart'] = 'mobile-cart';
}
/** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( ( true === Astra_Builder_Helper::$is_header_footer_builder_active && Astra_Builder_Helper::is_component_loaded( 'search', 'header' ) && astra_get_option( 'live-search', false ) ) || ( is_search() && true === astra_get_option( 'ast-search-live-search' ) ) ) {
/** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$default_assets['js']['astra-live-search'] = 'live-search';
}
if ( class_exists( 'WooCommerce' ) ) {
if ( is_product() && astra_get_option( 'single-product-sticky-add-to-cart' ) ) {
$default_assets['js']['astra-sticky-add-to-cart'] = 'sticky-add-to-cart';
}
if ( ! is_customize_preview() ) {
$astra_shop_add_to_cart = astra_get_option( 'shop-add-to-cart-action' );
if ( $astra_shop_add_to_cart && 'default' !== $astra_shop_add_to_cart ) {
$default_assets['js']['astra-shop-add-to-cart'] = 'shop-add-to-cart';
}
}
/** @psalm-suppress UndefinedFunction */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$astra_add_to_cart_quantity_btn_enabled = apply_filters( 'astra_add_to_cart_quantity_btn_enabled', astra_get_option( 'single-product-plus-minus-button' ) );
if ( $astra_add_to_cart_quantity_btn_enabled ) {
$default_assets['js']['astra-add-to-cart-quantity-btn'] = 'add-to-cart-quantity-btn';
}
}
}
if ( astra_get_option( 'site-sticky-sidebar', false ) ) {
$default_assets['js']['astra-sticky-sidebar'] = 'sticky-sidebar';
}
return apply_filters( 'astra_theme_assets', $default_assets );
}
/**
* Add Fonts
*/
public function add_fonts() {
$font_family = astra_get_option( 'body-font-family' );
$font_weight = astra_get_option( 'body-font-weight' );
$font_variant = astra_get_option( 'body-font-variant' );
Astra_Fonts::add_font( $font_family, $font_weight );
Astra_Fonts::add_font( $font_family, $font_variant );
// Render headings font.
$heading_font_family = astra_get_option( 'headings-font-family' );
$heading_font_weight = astra_get_option( 'headings-font-weight' );
$heading_font_variant = astra_get_option( 'headings-font-variant' );
Astra_Fonts::add_font( $heading_font_family, $heading_font_weight );
Astra_Fonts::add_font( $heading_font_family, $heading_font_variant );
}
/**
* Enqueue Scripts
*/
public function enqueue_scripts() {
if ( false === self::enqueue_theme_assets() ) {
return;
}
/* Directory and Extension */
$file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
$dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
$js_uri = ASTRA_THEME_URI . 'assets/js/' . $dir_name . '/';
$css_uri = ASTRA_THEME_URI . 'assets/css/minified/';
/**
* IE Only Js and CSS Files.
*/
// Flexibility.js for flexbox IE10 support.
wp_enqueue_script( 'astra-flexibility', $js_uri . 'flexibility' . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, false );
wp_add_inline_script( 'astra-flexibility', 'flexibility(document.documentElement);' );
wp_script_add_data( 'astra-flexibility', 'conditional', 'IE' );
// Polyfill for CustomEvent for IE.
wp_register_script( 'astra-customevent', $js_uri . 'custom-events-polyfill' . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, false );
wp_register_style( 'astra-galleries-css', $css_uri . 'galleries.min.css', array(), ASTRA_THEME_VERSION, 'all' );
// All assets.
$all_assets = self::theme_assets();
$styles = $all_assets['css'];
$scripts = $all_assets['js'];
if ( is_array( $styles ) && ! empty( $styles ) ) {
// Register & Enqueue Styles.
foreach ( $styles as $key => $style ) {
$dependency = array();
// Add dynamic CSS dependency for all styles except for theme's style.css.
if ( 'astra-theme-css' !== $key && class_exists( 'Astra_Cache_Base' ) ) {
if ( ! Astra_Cache_Base::inline_assets() ) {
$dependency[] = 'astra-theme-dynamic';
}
}
// Generate CSS URL.
$css_file = $css_uri . $style . '.min.css';
// Register.
wp_register_style( $key, $css_file, $dependency, ASTRA_THEME_VERSION, 'all' );
// Enqueue.
wp_enqueue_style( $key );
// RTL support.
wp_style_add_data( $key, 'rtl', 'replace' );
}
}
// Fonts - Render Fonts.
Astra_Fonts::render_fonts();
/**
* Inline styles
*/
add_filter( 'astra_dynamic_theme_css', array( 'Astra_Dynamic_CSS', 'return_output' ) );
add_filter( 'astra_dynamic_theme_css', array( 'Astra_Dynamic_CSS', 'return_meta_output' ) );
$menu_animation = astra_get_option( 'header-main-submenu-container-animation' );
// Submenu Container Animation for header builder.
if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
for ( $index = 1; $index <= Astra_Builder_Helper::$component_limit; $index++ ) {
$menu_animation_enable = astra_get_option( 'header-menu' . $index . '-submenu-container-animation' );
if ( Astra_Builder_Helper::is_component_loaded( 'menu-' . $index, 'header' ) && ! empty( $menu_animation_enable ) ) {
$menu_animation = 'is_animated';
break;
}
}
}
$rtl = ( is_rtl() ) ? '-rtl' : '';
if ( ! empty( $menu_animation ) || is_customize_preview() ) {
if ( class_exists( 'Astra_Cache' ) ) {
Astra_Cache::add_css_file( ASTRA_THEME_DIR . 'assets/css/minified/menu-animation' . $rtl . '.min.css' );
} else {
wp_register_style( 'astra-menu-animation', $css_uri . 'menu-animation.min.css', null, ASTRA_THEME_VERSION, 'all' );
wp_enqueue_style( 'astra-menu-animation' );
}
}
if ( ! class_exists( 'Astra_Cache' ) ) {
$theme_css_data = apply_filters( 'astra_dynamic_theme_css', '' );
wp_add_inline_style( 'astra-theme-css', $theme_css_data );
}
if ( astra_is_amp_endpoint() ) {
return;
}
// Comment assets.
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_array( $scripts ) && ! empty( $scripts ) ) {
// Register & Enqueue Scripts.
foreach ( $scripts as $key => $script ) {
// Register.
wp_register_script( $key, $js_uri . $script . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, true );
// Enqueue.
wp_enqueue_script( $key );
}
}
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$quantity_type = ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'woocommerce' ) ) ? astra_get_option( 'cart-plus-minus-button-type' ) : 'normal';
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$astra_localize = array(
'break_point' => astra_header_break_point(), // Header Break Point.
'isRtl' => is_rtl(),
'is_scroll_to_id' => astra_get_option( 'enable-scroll-to-id' ),
'is_scroll_to_top' => astra_get_option( 'scroll-to-top-enable' ),
'is_header_footer_builder_active' => Astra_Builder_Helper::$is_header_footer_builder_active,
'responsive_cart_click' => astra_get_option( 'responsive-cart-click-action' ),
);
wp_localize_script( 'astra-theme-js', 'astra', apply_filters( 'astra_theme_js_localize', $astra_localize ) );
$astra_qty_btn_localize = array(
'plus_qty' => __( 'Plus Quantity', 'astra' ),
'minus_qty' => __( 'Minus Quantity', 'astra' ),
'style_type' => $quantity_type, // Quantity button type.
);
wp_localize_script( 'astra-add-to-cart-quantity-btn', 'astra_qty_btn', apply_filters( 'astra_qty_btn_js_localize', $astra_qty_btn_localize ) );
$astra_cart_localize_data = array(
'desktop_layout' => astra_get_option( 'woo-header-cart-click-action' ), // WooCommerce sidebar flyout desktop.
'responsive_cart_click' => astra_get_option( 'responsive-cart-click-action' ), // WooCommerce responsive devices flyout.
);
wp_localize_script( 'astra-mobile-cart', 'astra_cart', apply_filters( 'astra_cart_js_localize', $astra_cart_localize_data ) );
if ( ( true === Astra_Builder_Helper::$is_header_footer_builder_active && Astra_Builder_Helper::is_component_loaded( 'search', 'header' ) && astra_get_option( 'live-search', false ) ) || ( is_search() && true === astra_get_option( 'ast-search-live-search' ) ) ) {
$search_post_types = array();
$search_post_type_label = array();
$search_within_val = astra_get_option( 'live-search-post-types' );
if ( ! empty( $search_within_val ) && is_array( $search_within_val ) ) {
foreach ( $search_within_val as $post_type => $value ) {
if ( $value && post_type_exists( $post_type ) ) {
$search_post_types[] = $post_type;
/** @psalm-suppress PossiblyNullPropertyFetch */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$post_type_object = get_post_type_object( $post_type );
$search_post_type_label[ $post_type ] = is_object( $post_type_object ) && isset( $post_type_object->labels->name ) ? esc_html( $post_type_object->labels->name ) : $post_type;
/** @psalm-suppress PossiblyNullPropertyFetch */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
}
}
}
$search_page_post_types = array();
$search_page_post_type_label = array();
$search_page_within_val = astra_get_option( 'ast-search-live-search-post-types' );
if ( is_search() && ! empty( $search_page_within_val ) && is_array( $search_page_within_val ) ) {
foreach ( $search_page_within_val as $post_type => $value ) {
if ( $value && post_type_exists( $post_type ) ) {
$search_page_post_types[] = $post_type;
/** @psalm-suppress PossiblyNullPropertyFetch */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$post_type_object = get_post_type_object( $post_type );
$search_page_post_type_label[ $post_type ] = is_object( $post_type_object ) && isset( $post_type_object->labels->name ) ? esc_html( $post_type_object->labels->name ) : $post_type;
/** @psalm-suppress PossiblyNullPropertyFetch */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
}
}
}
$astra_live_search_localize_data = array(
'rest_api_url' => get_rest_url(),
'search_posts_per_page' => 5,
'search_post_types' => $search_post_types,
'search_post_types_labels' => $search_post_type_label,
'search_language' => astra_get_current_language_slug(),
'no_live_results_found' => __( 'No results found', 'astra' ),
'search_page_condition' => is_search() && true === astra_get_option( 'ast-search-live-search' ) ? true : false,
'search_page_post_types' => $search_page_post_types,
'search_page_post_type_labels' => $search_page_post_type_label,
);
wp_localize_script( 'astra-live-search', 'astra_search', apply_filters( 'astra_search_js_localize', $astra_live_search_localize_data ) );
}
if ( class_exists( 'woocommerce' ) ) {
$is_astra_pro = function_exists( 'astra_has_pro_woocommerce_addon' ) ? astra_has_pro_woocommerce_addon() : false;
$astra_shop_add_to_cart_localize_data = array(
'shop_add_to_cart_action' => astra_get_option( 'shop-add-to-cart-action' ),
'cart_url' => wc_get_cart_url(),
'checkout_url' => wc_get_checkout_url(),
'is_astra_pro' => $is_astra_pro,
);
wp_localize_script( 'astra-shop-add-to-cart', 'astra_shop_add_to_cart', apply_filters( 'astra_shop_add_to_cart_js_localize', $astra_shop_add_to_cart_localize_data ) );
}
$sticky_sidebar = astra_get_option( 'site-sticky-sidebar', false );
if ( $sticky_sidebar ) {
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$sticky_header_addon = ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'sticky-header' ) );
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$astra_sticky_sidebar_localize_data = array(
'sticky_sidebar_on' => $sticky_sidebar,
'header_above_height' => astra_get_option( 'hba-header-height' ),
'header_height' => astra_get_option( 'hb-header-height' ),
'header_below_height' => astra_get_option( 'hbb-header-height' ),
'header_above_stick' => astra_get_option( 'header-above-stick', false ),
'header_main_stick' => astra_get_option( 'header-main-stick', false ),
'header_below_stick' => astra_get_option( 'header-below-stick', false ),
'sticky_header_addon' => $sticky_header_addon,
'desktop_breakpoint' => astra_get_tablet_breakpoint( '', 1 ),
);
wp_localize_script( 'astra-sticky-sidebar', 'astra_sticky_sidebar', apply_filters( 'astra_sticky_sidebar_js_localize', $astra_sticky_sidebar_localize_data ) );
}
}
/**
* Trim CSS
*
* @since 1.0.0
* @param string $css CSS content to trim.
* @return string
*/
public static function trim_css( $css = '' ) {
// Trim white space for faster page loading.
if ( ! empty( $css ) ) {
$css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css );
$css = str_replace( array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), '', $css );
$css = str_replace( ', ', ',', $css );
}
return $css;
}
/**
* Enqueue Gutenberg assets.
*
* @since 1.5.2
*
* @return void
*/
public function gutenberg_assets() {
/* Directory and Extension */
$rtl = '';
if ( is_rtl() ) {
$rtl = '-rtl';
}
$js_uri = ASTRA_THEME_URI . 'inc/assets/js/block-editor-script.js';
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
wp_enqueue_script( 'astra-block-editor-script', $js_uri, false, ASTRA_THEME_VERSION, 'all' );
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$content_bg_obj = astra_get_option( 'content-bg-obj-responsive' );
$site_bg_obj = astra_get_option( 'site-layout-outside-bg-obj-responsive' );
$site_builder_url = admin_url( 'admin.php?page=theme-builder' );
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$is_astra_pro_colors_activated = ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'colors-and-background' ) );
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$astra_global_palette_instance = new Astra_Global_Palette();
$astra_colors = array(
'var(--ast-global-color-0)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-0)' ),
'var(--ast-global-color-1)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-1)' ),
'var(--ast-global-color-2)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-2)' ),
'var(--ast-global-color-3)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-3)' ),
'var(--ast-global-color-4)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-4)' ),
'var(--ast-global-color-5)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-5)' ),
'var(--ast-global-color-6)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-6)' ),
'var(--ast-global-color-7)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-7)' ),
'var(--ast-global-color-8)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-8)' ),
'ast_wp_version_higher_6_3' => astra_wp_version_compare( '6.2.99', '>' ),
'ast_wp_version_higher_6_4' => astra_wp_version_compare( '6.4.99', '>' ),
'apply_content_bg_fullwidth' => astra_apply_content_background_fullwidth_layouts(),
'customizer_content_bg_obj' => $content_bg_obj,
'customizer_site_bg_obj' => $site_bg_obj,
'is_astra_pro_colors_activated' => $is_astra_pro_colors_activated,
'site_builder_url' => $site_builder_url,
'mobile_logo' => astra_get_option( 'mobile-header-logo' ),
'mobile_logo_state' => astra_get_option( 'different-mobile-logo' ),
);
wp_localize_script( 'astra-block-editor-script', 'astraColors', apply_filters( 'astra_theme_root_colors', $astra_colors ) );
// Render fonts in Gutenberg layout.
Astra_Fonts::render_fonts();
if ( astra_block_based_legacy_setup() ) {
$css_uri = ASTRA_THEME_URI . 'inc/assets/css/block-editor-styles' . $rtl . '.css';
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
wp_enqueue_style( 'astra-block-editor-styles', $css_uri, false, ASTRA_THEME_VERSION, 'all' );
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
wp_add_inline_style( 'astra-block-editor-styles', apply_filters( 'astra_block_editor_dynamic_css', Gutenberg_Editor_CSS::get_css() ) );
} else {
$css_uri = ASTRA_THEME_URI . 'inc/assets/css/wp-editor-styles' . $rtl . '.css';
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
wp_enqueue_style( 'astra-wp-editor-styles', $css_uri, false, ASTRA_THEME_VERSION, 'all' );
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
wp_add_inline_style( 'astra-wp-editor-styles', apply_filters( 'astra_block_editor_dynamic_css', Astra_WP_Editor_CSS::get_css() ) );
}
}
/**
* Function to check if enqueuing of Astra assets are disabled.
*
* @since 2.1.0
* @return boolean
*/
public static function enqueue_theme_assets() {
return apply_filters( 'astra_enqueue_theme_assets', true );
}
/**
* Enqueue galleries relates CSS on gallery_style filter.
*
* @param string $gallery_style gallery style and div.
* @since 3.5.0
* @return string
*/
public function enqueue_galleries_style( $gallery_style ) {
wp_enqueue_style( 'astra-galleries-css' );
return $gallery_style;
}
}
new Astra_Enqueue_Scripts();
}
PK ZUpc pc class-astra-admin-settings.phpnu [ '4.1.0',
'4.0.2' => '4.0.0',
'3.9.4' => '3.9.2',
'3.9.1' => '3.9.0',
'3.8.5' => '3.6.11',
'3.8.4' => '3.6.10',
'3.8.2' => '3.6.3',
'3.7.4' => '3.6.2',
'3.7.3' => '3.6.0',
'3.6.9' => '3.5.8',
'3.6.7' => '3.5.5',
'3.6.4' => '3.5.0',
'3.4.8' => '3.4.2',
'3.4.2' => '3.4.0',
'3.3.3' => '3.3.2',
'3.3.2' => '3.3.1',
'3.3.1' => '3.3.0',
'3.2.0' => '3.1.0',
'3.0.3' => '3.0.0',
);
/**
* Constructor
*/
public function __construct() {
if ( ! is_admin() ) {
return;
}
self::get_starter_templates_slug();
add_action( 'after_setup_theme', __CLASS__ . '::init_admin_settings', 99 );
}
/**
* Admin settings init
*/
public static function init_admin_settings() {
add_action( 'admin_enqueue_scripts', __CLASS__ . '::register_scripts' );
add_action( 'customize_controls_enqueue_scripts', __CLASS__ . '::customizer_scripts' );
add_action( 'astra_notice_before_markup_astra-sites-on-active', __CLASS__ . '::load_astra_admin_script' );
add_action( 'admin_init', __CLASS__ . '::register_notices' );
add_action( 'astra_notice_before_markup', __CLASS__ . '::notice_assets' );
add_action( 'admin_init', __CLASS__ . '::minimum_addon_version_notice' );
add_action( 'admin_init', __CLASS__ . '::minimum_addon_supported_version_notice' );
if ( astra_showcase_upgrade_notices() ) {
add_action( 'admin_init', __CLASS__ . '::upgrade_to_pro_wc_notice' );
add_action( 'wp_nav_menu_item_custom_fields', __CLASS__ . '::add_custom_fields', 10, 4 );
}
}
/**
* Add custom megamenu fields data to the menu.
*
* @param int $id menu item id.
* @param object $item A single menu item.
* @param int $depth menu item depth.
* @param array $args menu item arguments.
* @return void
*
* @since 3.9.4
*/
public static function add_custom_fields( $id, $item, $depth, $args ) {
?>
admin_url( 'admin-ajax.php' ),
'astraSitesLink' => admin_url( 'themes.php?page=starter-templates' ),
'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '…',
'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '…',
'recommendedPluiginActivateText' => __( 'Activate', 'astra' ),
'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ),
'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ),
'astraPluginManagerNonce' => wp_create_nonce( 'astra_plugin_manager_nonce' ),
);
wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) );
// Script.
wp_enqueue_script( 'astra-admin-settings' );
}
/**
* Ask Theme Rating
*
* @since 1.4.0
*/
public static function register_notices() {
// Return if white labeled.
/** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( astra_is_white_labelled() || ! ASTRA_THEME_ORG_VERSION || false === apply_filters( 'astra_showcase_starter_templates_notice', true ) || ! Astra_Menu::is_promoting_starter_templates() ) {
/** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
return;
}
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$current_slug = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
// Force Astra welcome notice on theme activation.
if ( current_user_can( 'install_plugins' ) && ! defined( 'ASTRA_SITES_NAME' ) && '1' == get_option( 'fresh_site' ) && ! in_array( $current_slug, array( 'astra-advanced-hook', 'astra_adv_header' ), true ) ) {
// Do not display admin welcome banner notice on theme upload page.
/** @psalm-suppress InvalidGlobal */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
global $pagenow;
/** @psalm-suppress InvalidGlobal */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( isset( $pagenow ) && 'update.php' === $pagenow ) {
return;
}
$image_path = ASTRA_THEME_URI . 'inc/assets/images/astra-banner.png';
$gb_image_path = ASTRA_THEME_URI . 'inc/assets/images/gb-logo.svg';
$ele_image_path = ASTRA_THEME_URI . 'inc/assets/images/ele-logo.svg';
$bb_image_path = ASTRA_THEME_URI . 'inc/assets/images/bb-logo.jpg';
$ai_image_path = ASTRA_THEME_URI . 'inc/assets/images/ai-logo.svg';
$ast_sites_notice_btn = self::astra_sites_notice_button();
$ast_sites_notice_btn['button_text'] = __( 'Let’s Get Started with Starter Templates', 'astra' );
if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
$ast_sites_notice_btn['class'] .= ' button button-primary';
} elseif ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
$ast_sites_notice_btn['class'] .= ' button button-primary';
// Astra Premium Sites - Active.
} else {
$ast_sites_notice_btn['class'] = ' button button-primary astra-notice-close';
}
$astra_sites_notice_args = array(
'id' => 'astra-sites-on-active',
'type' => 'info',
'message' => sprintf(
'
%1$s
%2$s
%3$s
%11$s
%13$s
',
__( 'Thank you for choosing the Astra theme!', 'astra' ),
__( 'Build Your Dream Site in Minutes With AI 🚀', 'astra' ),
__( 'Say goodbye to the days of spending weeks designing and building your website. With Astra and our Starter Templates plugin, you can now create professional-grade websites in minutes.', 'astra' ),
esc_attr( $ast_sites_notice_btn['class'] ),
'href="' . astra_get_prop( $ast_sites_notice_btn, 'link', '' ) . '"',
'data-slug="' . astra_get_prop( $ast_sites_notice_btn, 'data_slug', '' ) . '"',
'data-init="' . astra_get_prop( $ast_sites_notice_btn, 'data_init', '' ) . '"',
'data-settings-link-text="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link_text', '' ) . '"',
'data-settings-link="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link', '' ) . '"',
'data-activating-text="' . astra_get_prop( $ast_sites_notice_btn, 'activating_text', '' ) . '"',
esc_html( $ast_sites_notice_btn['button_text'] ),
$image_path,
__( 'I want to build this website from scratch', 'astra' ),
__( '280+ Templates', 'astra' ),
$gb_image_path,
$ele_image_path,
$bb_image_path,
$ai_image_path,
),
'priority' => 5,
'display-with-other-notices' => false,
'show_if' => class_exists( 'Astra_Ext_White_Label_Markup' ) ? Astra_Ext_White_Label_Markup::show_branding() : true,
);
Astra_Notices::add_notice(
$astra_sites_notice_args
);
}
}
/**
* Upgrade to Pro notice for Astra on WooCommerce pages.
*
* @since 3.9.4
*/
public static function upgrade_to_pro_wc_notice() {
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$current_slug = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( '' !== $current_slug && function_exists( 'WC' ) && in_array( $current_slug, array( 'wc-admin', 'wc-reports', 'wc-status', 'wc-addons', 'wc-settings' ), true ) ) {
$image_path = ASTRA_THEME_URI . 'inc/assets/images/astra-logo.svg';
$astra_sites_notice_args = array(
'id' => 'astra-upgrade-pro-wc',
'type' => 'info',
'message' => sprintf(
'
',
$image_path,
__( 'Astra Works Seamlessly with WooCommerce!', 'astra' ),
__( 'Use every tool at your disposal to optimize your online store for conversion. All the advantages you need to make more profit!', 'astra' ),
esc_attr( 'button button-primary' ),
'href="' . astra_get_pro_url( '/pricing/', 'free-theme', 'dashboard', 'woocommerce' ) . '" target="_blank"',
__( 'Upgrade Now', 'astra' )
),
'priority' => 5,
'show_if' => is_admin() ? true : false,
'display-with-other-notices' => false,
);
Astra_Notices::add_notice(
$astra_sites_notice_args
);
}
}
/**
* Display notice for minimun version for Astra addon.
*
* @since 2.0.0
*/
public static function minimum_addon_version_notice() {
if ( ! defined( 'ASTRA_EXT_VER' ) ) {
return;
}
if ( version_compare( ASTRA_EXT_VER, ASTRA_EXT_MIN_VER ) < 0 ) {
$message = sprintf(
/* translators: %1$1s: Theme Name, %2$2s: Minimum Required version of the addon */
__( 'Please update the %1$1s to version %2$2s or higher. Ignore if already updated.', 'astra' ),
astra_get_addon_name(),
ASTRA_EXT_MIN_VER
);
$min_version = get_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', true );
if ( ! $min_version ) {
update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER );
}
if ( version_compare( $min_version, ASTRA_EXT_MIN_VER, '!=' ) ) {
delete_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice' );
update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER );
}
$notice_args = array(
'id' => 'ast-minimum-addon-version-notice',
'type' => 'warning',
'message' => $message,
'show_if' => true,
'repeat-notice-after' => false,
'priority' => 18,
'display-with-other-notices' => true,
);
Astra_Notices::add_notice( $notice_args );
}
}
/**
* Get minimum supported version for Astra addon.
* This function will be used to inform the user about incompatible version of Astra addon.
*
* @param string $input_version Input version of the addon.
*
* @since 4.3.0
*/
public static function get_astra_addon_min_supported_version( $input_version ) {
if ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, ASTRA_EXT_MIN_VER ) < 0 ) {
return ASTRA_EXT_MIN_VER;
}
$supported_version = '';
// First, check if the exact version is supported
if ( isset( self::$astra_addon_supported_version_map[ $input_version ] ) ) {
$supported_version = self::$astra_addon_supported_version_map[ $input_version ];
} else {
foreach ( self::$astra_addon_supported_version_map as $index => $supported ) {
/** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( '' !== $supported_version || version_compare( $input_version, $index ) > 0 ) {
/** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$supported_version = $supported;
break;
}
}
}
return $supported_version;
}
/**
* This constant will be used to inform the user about incompatible version of Astra addon.
*
* @since 4.3.0
*/
public static function minimum_addon_supported_version_notice() {
if ( ! defined( 'ASTRA_EXT_VER' ) ) {
return;
}
// ASTRA_EXT_MIN_VER < ASTRA_EXT_VER && ASTRA_EXT_VER < 4.0.0.
if ( version_compare( ASTRA_EXT_VER, ASTRA_EXT_MIN_VER ) >= 0 || version_compare( '4.0.0', ASTRA_EXT_VER ) < 0 ) {
return;
}
$astra_addon_supported_version = self::get_astra_addon_min_supported_version( ASTRA_EXT_VER );
$message = sprintf(
/* translators: %1$s: Plugin Name, %2$s: Theme name, %3$s: Supported required version of the addon */
'Your current version of %1$s plugin is incompatible with %2$s theme. Please update to at least version %3$s for optimal functionality.',
astra_get_addon_name(),
astra_get_theme_name(),
$astra_addon_supported_version
);
$ext_min_supported_version = get_user_meta( get_current_user_id(), 'ast-addon-supported-version-notice', true );
if ( ! $ext_min_supported_version ) {
update_user_meta( get_current_user_id(), 'ast-addon-supported-version-notice', $astra_addon_supported_version );
}
if ( version_compare( $ext_min_supported_version, $astra_addon_supported_version, '!=' ) ) {
delete_user_meta( get_current_user_id(), 'ast-addon-minimum-supported-version-notice' );
update_user_meta( get_current_user_id(), 'ast-addon-supported-version-notice', $astra_addon_supported_version );
}
$notice_args = array(
'id' => 'ast-addon-minimum-supported-version-notice',
'type' => 'warning',
'message' => $message,
'show_if' => true,
'repeat-notice-after' => false,
'priority' => 20,
'display-with-other-notices' => false,
);
Astra_Notices::add_notice( $notice_args );
}
/**
* Enqueue Astra Notices CSS.
*
* @since 2.0.0
*
* @return void
*/
public static function notice_assets() {
if ( is_rtl() ) {
wp_enqueue_style( 'astra-custom-notices-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-notices-rtl.css', array(), ASTRA_THEME_VERSION );
} else {
wp_enqueue_style( 'astra-custom-notices', ASTRA_THEME_URI . 'inc/assets/css/astra-notices.css', array(), ASTRA_THEME_VERSION );
}
}
/**
* Render button for Astra Site notices
*
* @since 1.6.5
* @return array $ast_sites_notice_btn Rendered button
*/
public static function astra_sites_notice_button() {
$ast_sites_notice_btn = array();
// Any of the Starter Templtes plugin - Active.
if ( is_plugin_active( 'astra-pro-sites/astra-pro-sites.php' ) || is_plugin_active( 'astra-sites/astra-sites.php' ) ) {
$ast_sites_notice_btn['class'] = 'active';
$ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
return $ast_sites_notice_btn;
}
// Starter Templates PRO Plugin - Installed but Inactive.
if ( file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
$ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin';
$ast_sites_notice_btn['data_slug'] = 'astra-pro-sites';
$ast_sites_notice_btn['data_init'] = '/astra-pro-sites/astra-pro-sites.php';
$ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
$ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library »', 'astra' );
$ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '…';
return $ast_sites_notice_btn;
}
// Starter Templates FREE Plugin - Installed but Inactive.
if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) ) {
$ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin';
$ast_sites_notice_btn['data_slug'] = 'astra-sites';
$ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php';
$ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
$ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library »', 'astra' );
$ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '…';
return $ast_sites_notice_btn;
}
// Any of the Starter Templates plugin not available.
if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) || ! file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) ) {
$ast_sites_notice_btn['class'] = 'astra-install-recommended-plugin';
$ast_sites_notice_btn['data_slug'] = 'astra-sites';
$ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php';
$ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
$ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library »', 'astra' );
$ast_sites_notice_btn['detail_link_class'] = 'plugin-detail thickbox open-plugin-details-modal astra-starter-sites-detail-link';
$ast_sites_notice_btn['detail_link'] = network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=astra-sites&TB_iframe=true&width=772&height=400' );
$ast_sites_notice_btn['detail_link_text'] = __( 'Details »', 'astra' );
return $ast_sites_notice_btn;
}
$ast_sites_notice_btn['class'] = 'active';
$ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
return $ast_sites_notice_btn;
}
/**
* Check if installed Starter Sites plugin is new.
*
* @since 2.3.2
*/
public static function get_starter_templates_slug() {
if ( defined( 'ASTRA_PRO_SITES_VER' ) && version_compare( ASTRA_PRO_SITES_VER, '2.0.0', '>=' ) ) {
self::$starter_templates_slug = 'starter-templates';
}
if ( defined( 'ASTRA_SITES_VER' ) && version_compare( ASTRA_SITES_VER, '2.0.0', '>=' ) ) {
self::$starter_templates_slug = 'starter-templates';
}
}
/**
* Load the scripts and styles in the customizer controls.
*
* @since 1.2.1
*/
public static function customizer_scripts() {
$color_palettes = wp_json_encode( astra_color_palette() );
wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $color_palettes . ';' );
}
/**
* Register admin scripts.
*
* @param String $hook Screen name where the hook is fired.
* @return void
*/
public static function register_scripts( $hook ) {
if ( in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) {
$post_types = get_post_types( array( 'public' => true ) );
$screen = get_current_screen();
$post_type = $screen->id;
// Check if block editor is enabled or not.
if ( null !== $post_type && is_callable( 'use_block_editor_for_post_type' ) && use_block_editor_for_post_type( $post_type ) && in_array( $post_type, (array) $post_types ) ) {
echo '';
/**
* Register admin script for missing Layout option from nested Column Blocks inside Group/Cover blocks.
*
* @see https://github.com/WordPress/gutenberg/issues/33374 & https://gist.github.com/Luehrsen/c4aad3b33435058c19ea80f5f1c268e8 - Remove this once the issue is fixed.
*
* @since 3.7.9
*/
wp_enqueue_script( 'astra-column-block-comp-js', ASTRA_THEME_URI . 'inc/assets/js/column-block-compatibility.js', array( 'wp-util', 'wp-hooks', 'wp-blocks' ), ASTRA_THEME_VERSION, false );
}
}
}
/**
* Get and return page URL
*
* @param string $menu_slug Menu name.
* @since 1.0
* @return string page url
*/
public static function get_page_url( $menu_slug ) {
$parent_page = 'themes.php';
/** @psalm-suppress InvalidLiteralArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( strpos( $parent_page, '?' ) !== false ) {
/** @psalm-suppress InvalidLiteralArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$query_var = '&page=' . Astra_Menu::get_theme_page_slug();
} else {
$query_var = '?page=' . Astra_Menu::get_theme_page_slug();
}
$parent_page_url = admin_url( $parent_page . $query_var );
$url = $parent_page_url . '&action=' . $menu_slug;
return esc_url( $url );
}
}
new Astra_Admin_Settings();
}
PK ZU> > class-astra-wp-editor-css.phpnu [ array(
'top' => $desktop_top_block_space,
'right' => $desktop_right_block_space,
'bottom' => $desktop_bottom_block_space,
'left' => $desktop_left_block_space,
),
'tablet' => array(
'top' => $tablet_top_block_space,
'right' => $tablet_right_block_space,
'bottom' => $tablet_bottom_block_space,
'left' => $tablet_left_block_space,
),
'mobile' => array(
'top' => $mobile_top_block_space,
'right' => $mobile_right_block_space,
'bottom' => $mobile_bottom_block_space,
'left' => $mobile_left_block_space,
),
);
}
/**
* Get dynamic CSS required for the block editor to make editing experience similar to how it looks on frontend.
*
* @return String CSS to be loaded in the editor interface.
*/
public static function get_css() {
$ltr_left = is_rtl() ? 'right' : 'left';
$site_content_width = astra_get_option( 'site-content-width', 1200 );
$headings_font_family = astra_get_option( 'headings-font-family' );
$headings_font_weight = astra_get_option( 'headings-font-weight' );
$headings_text_transform = astra_get_font_extras( astra_get_option( 'headings-font-extras' ), 'text-transform' );
$headings_line_height = astra_get_font_extras( astra_get_option( 'headings-font-extras' ), 'line-height', 'line-height-unit' );
$body_font_family = astra_body_font_family();
$para_margin_bottom = astra_get_option( 'para-margin-bottom', '1.6' );
$theme_color = astra_get_option( 'theme-color' );
$heading_base_color = astra_get_option( 'heading-base-color' );
$highlight_theme_color = astra_get_foreground_color( $theme_color );
$body_font_weight = astra_get_option( 'body-font-weight' );
$body_font_size = astra_get_option( 'font-size-body' );
$body_line_height = astra_get_font_extras( astra_get_option( 'body-font-extras' ), 'line-height', 'line-height-unit' );
$body_text_transform = astra_get_font_extras( astra_get_option( 'body-font-extras' ), 'text-transform' );
$body_letter_spacing = astra_get_font_extras( astra_get_option( 'body-font-extras' ), 'letter-spacing', 'letter-spacing-unit' );
$body_text_decoration = astra_get_font_extras( astra_get_option( 'body-font-extras' ), 'text-decoration' );
$text_color = astra_get_option( 'text-color' );
$heading_h1_font_size = astra_get_option( 'font-size-h1' );
$heading_h2_font_size = astra_get_option( 'font-size-h2' );
$heading_h3_font_size = astra_get_option( 'font-size-h3' );
$heading_h4_font_size = astra_get_option( 'font-size-h4' );
$heading_h5_font_size = astra_get_option( 'font-size-h5' );
$heading_h6_font_size = astra_get_option( 'font-size-h6' );
$link_color = astra_get_option( 'link-color', $theme_color );
$link_h_color = astra_get_option( 'link-h-color' );
/**
* Button theme compatibility.
*/
$btn_color = astra_get_option( 'button-color' );
$btn_bg_color = astra_get_option( 'button-bg-color', '', $theme_color );
$btn_h_color = astra_get_option( 'button-h-color' );
$btn_bg_h_color = astra_get_option( 'button-bg-h-color', '', $link_h_color );
$btn_border_radius_fields = astra_get_option( 'button-radius-fields' );
$theme_btn_padding = astra_get_option( 'theme-button-padding' );
$btn_border_size = astra_get_option( 'theme-button-border-group-border-size' );
$btn_border_color = astra_get_option( 'theme-button-border-group-border-color' );
$btn_border_h_color = astra_get_option( 'theme-button-border-group-border-h-color' );
$theme_btn_font_family = astra_get_option( 'font-family-button' );
$theme_btn_font_size = astra_get_option( 'font-size-button' );
$theme_btn_font_weight = astra_get_option( 'font-weight-button' );
$theme_btn_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-button' ), 'text-transform' );
$theme_btn_line_height = astra_get_font_extras( astra_get_option( 'font-extras-button' ), 'line-height', 'line-height-unit' );
$theme_btn_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-button' ), 'letter-spacing', 'letter-spacing-unit' );
$theme_btn_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-button' ), 'text-decoration' );
$theme_btn_top_border = ( isset( $btn_border_size['top'] ) && ( '' !== $btn_border_size['top'] && '0' !== $btn_border_size['top'] ) ) ? astra_get_css_value( $btn_border_size['top'], 'px' ) : '';
$theme_btn_right_border = ( isset( $btn_border_size['right'] ) && ( '' !== $btn_border_size['right'] && '0' !== $btn_border_size['right'] ) ) ? astra_get_css_value( $btn_border_size['right'], 'px' ) : '';
$theme_btn_left_border = ( isset( $btn_border_size['left'] ) && ( '' !== $btn_border_size['left'] && '0' !== $btn_border_size['left'] ) ) ? astra_get_css_value( $btn_border_size['left'], 'px' ) : '';
$theme_btn_bottom_border = ( isset( $btn_border_size['bottom'] ) && ( '' !== $btn_border_size['bottom'] && '0' !== $btn_border_size['bottom'] ) ) ? astra_get_css_value( $btn_border_size['bottom'], 'px' ) : '';
/**
* Headings typography.
*/
$h1_font_family = astra_get_option( 'font-family-h1' );
$h1_font_weight = astra_get_option( 'font-weight-h1' );
$h1_line_height = astra_get_font_extras( astra_get_option( 'font-extras-h1' ), 'line-height', 'line-height-unit' );
$h1_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-h1' ), 'text-transform' );
$h1_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-h1' ), 'letter-spacing', 'letter-spacing-unit' );
$h1_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-h1' ), 'text-decoration' );
$h2_font_family = astra_get_option( 'font-family-h2' );
$h2_font_weight = astra_get_option( 'font-weight-h2' );
$h2_line_height = astra_get_font_extras( astra_get_option( 'font-extras-h2' ), 'line-height', 'line-height-unit' );
$h2_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-h2' ), 'text-transform' );
$h2_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-h2' ), 'letter-spacing', 'letter-spacing-unit' );
$h2_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-h2' ), 'text-decoration' );
$h3_font_family = astra_get_option( 'font-family-h3' );
$h3_font_weight = astra_get_option( 'font-weight-h3' );
$h3_line_height = astra_get_font_extras( astra_get_option( 'font-extras-h3' ), 'line-height', 'line-height-unit' );
$h3_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-h3' ), 'text-transform' );
$h3_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-h3' ), 'letter-spacing', 'letter-spacing-unit' );
$h3_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-h3' ), 'text-decoration' );
$h4_font_family = astra_get_option( 'font-family-h4' );
$h4_font_weight = astra_get_option( 'font-weight-h4' );
$h4_line_height = astra_get_font_extras( astra_get_option( 'font-extras-h4' ), 'line-height', 'line-height-unit' );
$h4_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-h4' ), 'text-transform' );
$h4_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-h4' ), 'letter-spacing', 'letter-spacing-unit' );
$h4_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-h4' ), 'text-decoration' );
$h5_font_family = astra_get_option( 'font-family-h5' );
$h5_font_weight = astra_get_option( 'font-weight-h5' );
$h5_line_height = astra_get_font_extras( astra_get_option( 'font-extras-h5' ), 'line-height', 'line-height-unit' );
$h5_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-h5' ), 'text-transform' );
$h5_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-h5' ), 'letter-spacing', 'letter-spacing-unit' );
$h5_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-h5' ), 'text-decoration' );
$h6_font_family = astra_get_option( 'font-family-h6' );
$h6_font_weight = astra_get_option( 'font-weight-h6' );
$h6_line_height = astra_get_font_extras( astra_get_option( 'font-extras-h6' ), 'line-height', 'line-height-unit' );
$h6_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-h6' ), 'text-transform' );
$h6_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-h6' ), 'letter-spacing', 'letter-spacing-unit' );
$h6_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-h6' ), 'text-decoration' );
// Fallback for H1 - headings typography.
if ( 'inherit' === $h1_font_family ) {
$h1_font_family = $headings_font_family;
}
if ( 'inherit' === $h1_font_weight && 'inherit' === $headings_font_weight ) {
$h1_font_weight = 'normal';
}
if ( '' == $h1_text_transform ) {
$h1_text_transform = $headings_text_transform;
}
if ( '' == $h1_line_height ) {
$h1_line_height = $headings_line_height;
}
// Fallback for H2 - headings typography.
if ( 'inherit' === $h2_font_family ) {
$h2_font_family = $headings_font_family;
}
if ( 'inherit' === $h2_font_weight && 'inherit' === $headings_font_weight ) {
$h2_font_weight = 'normal';
}
if ( '' == $h2_text_transform ) {
$h2_text_transform = $headings_text_transform;
}
if ( '' == $h2_line_height ) {
$h2_line_height = $headings_line_height;
}
// Fallback for H3 - headings typography.
if ( 'inherit' === $h3_font_family ) {
$h3_font_family = $headings_font_family;
}
if ( 'inherit' === $h3_font_weight && 'inherit' === $headings_font_weight ) {
$h3_font_weight = 'normal';
}
if ( '' == $h3_text_transform ) {
$h3_text_transform = $headings_text_transform;
}
if ( '' == $h3_line_height ) {
$h3_line_height = $headings_line_height;
}
// Fallback for H4 - headings typography.
if ( 'inherit' === $h4_font_family ) {
$h4_font_family = $headings_font_family;
}
if ( 'inherit' === $h4_font_weight && 'inherit' === $headings_font_weight ) {
$h4_font_weight = 'normal';
}
if ( '' == $h4_text_transform ) {
$h4_text_transform = $headings_text_transform;
}
if ( '' == $h4_line_height ) {
$h4_line_height = $headings_line_height;
}
// Fallback for H5 - headings typography.
if ( 'inherit' === $h5_font_family ) {
$h5_font_family = $headings_font_family;
}
if ( 'inherit' === $h5_font_weight && 'inherit' === $headings_font_weight ) {
$h5_font_weight = 'normal';
}
if ( '' == $h5_text_transform ) {
$h5_text_transform = $headings_text_transform;
}
if ( '' == $h5_line_height ) {
$h5_line_height = $headings_line_height;
}
// Fallback for H6 - headings typography.
if ( 'inherit' === $h6_font_family ) {
$h6_font_family = $headings_font_family;
}
if ( 'inherit' === $h6_font_weight && 'inherit' === $headings_font_weight ) {
$h6_font_weight = 'normal';
}
if ( '' == $h6_text_transform ) {
$h6_text_transform = $headings_text_transform;
}
if ( '' == $h6_line_height ) {
$h6_line_height = $headings_line_height;
}
// Fallback for button settings.
if ( empty( $btn_color ) ) {
$btn_color = astra_get_foreground_color( $theme_color );
}
if ( empty( $btn_h_color ) ) {
$btn_h_color = astra_get_foreground_color( $link_h_color );
}
if ( is_array( $body_font_size ) ) {
$body_font_size_desktop = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15;
// Convert to appropriate pixels if the unit is 'rem'.
$body_font_size_desktop = ! empty( $body_font_size['desktop-unit'] ) && $body_font_size['desktop-unit'] === 'rem' ? $body_font_size_desktop * 16 : $body_font_size_desktop;
} else {
$body_font_size_desktop = ( '' != $body_font_size ) ? $body_font_size : 15;
}
$site_background = astra_get_option( 'site-layout-outside-bg-obj-responsive' );
$content_background = astra_get_option( 'content-bg-obj-responsive' );
$background_style_data = astra_get_responsive_background_obj( $site_background, 'desktop' );
if (
empty( $background_style_data ) ||
(
( empty( $background_style_data['background-color'] ) || ';' === $background_style_data['background-color'] ) &&
( empty( $background_style_data['background-image'] ) && 'none;' === $background_style_data['background-image'] )
)
) {
$background_style_data = array(
'background-color' => '#f5f5f5',
);
}
// Site title (Page Title) on Block Editor.
$post_type = strval( get_post_type() );
$site_title_font_family = astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-family', astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-text-font-family' ) );
$site_title_font_weight = astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-weight', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-weight' ) );
$site_title_font_size = astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-size', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-size' ) );
$site_title_font_extras = astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-text-font-extras' );
$site_title_text_transform = astra_get_font_extras( astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-extras', $site_title_font_extras ), 'text-transform' );
$site_title_spacing = astra_get_font_extras( astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-extras', $site_title_font_extras ), 'letter-spacing', 'letter-spacing-unit' );
$site_title_decoration = astra_get_font_extras( astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-extras', $site_title_font_extras ), 'text-decoration' );
$is_widget_title_support_font_weight = Astra_Dynamic_CSS::support_font_css_to_widget_and_in_editor();
$font_weight_prop = ( $is_widget_title_support_font_weight ) ? 'inherit' : 'normal';
$btn_preset_style = astra_get_option( 'button-preset-style' );
$border_color = astra_get_option( 'border-color' );
// Fallback for Site title (Page Title).
if ( 'inherit' == $site_title_font_family ) {
$site_title_font_family = $headings_font_family;
}
if ( $font_weight_prop === $site_title_font_weight ) {
$site_title_font_weight = $headings_font_weight;
}
if ( '' == $site_title_text_transform ) {
$site_title_text_transform = '' === $headings_text_transform ? astra_get_option( 'text-transform-h1' ) : $headings_text_transform;
}
if ( 'inherit' == $site_title_font_weight || '' == $site_title_font_weight ) {
$site_title_font_weight = Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-weight' );
}
// check the selection color in-case of empty/no theme color.
$selection_text_color = ( 'transparent' === $highlight_theme_color ) ? '' : $highlight_theme_color;
$astra_is_block_editor_v2_ui = astra_get_option( 'wp-blocks-v2-ui', true );
$astra_container_width = $site_content_width . 'px';
$block_appender_width = $astra_is_block_editor_v2_ui ? 'var(--wp--custom--ast-content-width-size)' : 'var(--wp--custom--ast-wide-width-size)';
$astra_wide_particular_selector = $astra_is_block_editor_v2_ui ? '.editor-styles-wrapper .block-editor-block-list__layout.is-root-container .block-list-appender' : '.editor-styles-wrapper .block-editor-block-list__layout.is-root-container > p, .editor-styles-wrapper .block-editor-block-list__layout.is-root-container .block-list-appender';
$blocks_spacings = self::astra_get_block_spacings();
$color_palette_reorganize = Astra_Dynamic_CSS::astra_4_8_9_compatibility();
$desktop_top_spacing = isset( $blocks_spacings['desktop']['top'] ) ? $blocks_spacings['desktop']['top'] : '';
$desktop_right_spacing = isset( $blocks_spacings['desktop']['right'] ) ? $blocks_spacings['desktop']['right'] : '';
$desktop_bottom_spacing = isset( $blocks_spacings['desktop']['bottom'] ) ? $blocks_spacings['desktop']['bottom'] : '';
$desktop_left_spacing = isset( $blocks_spacings['desktop']['left'] ) ? $blocks_spacings['desktop']['left'] : '';
$tablet_top_spacing = isset( $blocks_spacings['tablet']['top'] ) ? $blocks_spacings['tablet']['top'] : '';
$tablet_right_spacing = isset( $blocks_spacings['tablet']['right'] ) ? $blocks_spacings['tablet']['right'] : '';
$tablet_bottom_spacing = isset( $blocks_spacings['tablet']['bottom'] ) ? $blocks_spacings['tablet']['bottom'] : '';
$tablet_left_spacing = isset( $blocks_spacings['tablet']['left'] ) ? $blocks_spacings['tablet']['left'] : '';
$mobile_top_spacing = isset( $blocks_spacings['mobile']['top'] ) ? $blocks_spacings['mobile']['top'] : '';
$mobile_right_spacing = isset( $blocks_spacings['mobile']['right'] ) ? $blocks_spacings['mobile']['right'] : '';
$mobile_bottom_spacing = isset( $blocks_spacings['mobile']['bottom'] ) ? $blocks_spacings['mobile']['bottom'] : '';
$mobile_left_spacing = isset( $blocks_spacings['mobile']['left'] ) ? $blocks_spacings['mobile']['left'] : '';
$ast_content_width = apply_filters( 'astra_block_content_width', $astra_is_block_editor_v2_ui ? $astra_container_width : '910px' );
$ast_wide_width = apply_filters( 'astra_block_wide_width', $astra_is_block_editor_v2_ui ? 'calc(' . esc_attr( $astra_container_width ) . ' + var(--wp--custom--ast-default-block-left-padding) + var(--wp--custom--ast-default-block-right-padding))' : $astra_container_width );
$ast_narrow_width = astra_get_option( 'narrow-container-max-width', apply_filters( 'astra_narrow_container_width', 750 ) ) . 'px';
$primary_color = $color_palette_reorganize ? 'var(--ast-global-color-4)' : 'var(--ast-global-color-5)';
$secondary_color = $color_palette_reorganize ? 'var(--ast-global-color-5)' : 'var(--ast-global-color-4)';
$alternate_color = $color_palette_reorganize ? 'var(--ast-global-color-6)' : 'var(--ast-global-color-7)';
$subtle_color = $color_palette_reorganize ? 'var(--ast-global-color-7)' : 'var(--ast-global-color-6)';
$css = ':root, body .editor-styles-wrapper {
--wp--custom--ast-default-block-top-padding: ' . $desktop_top_spacing . ';
--wp--custom--ast-default-block-right-padding: ' . $desktop_right_spacing . ';
--wp--custom--ast-default-block-bottom-padding: ' . $desktop_bottom_spacing . ';
--wp--custom--ast-default-block-left-padding: ' . $desktop_left_spacing . ';
--wp--custom--ast-content-width-size: ' . $ast_content_width . ';
--wp--custom--ast-wide-width-size: ' . $ast_wide_width . ';
--ast-global-color-primary: ' . $primary_color . ';
--ast-global-color-secondary: ' . $secondary_color . ';
--ast-global-color-alternate-background: ' . $alternate_color . ';
--ast-global-color-subtle-background: ' . $subtle_color . ';
}';
$css .= '.ast-narrow-container .editor-styles-wrapper {
--wp--custom--ast-content-width-size: ' . $ast_narrow_width . ';
}';
// Overriding the previous CSS vars in customizer because there is block editor in customizer widget, where if any container block is used in sidebar widgets then as customizer widget editor is already small (left panel) the blocks does not looks good.
if ( is_customize_preview() ) {
$css = '';
}
/** @psalm-suppress InvalidScalarArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$html_font_size = astra_get_font_css_value( (int) $body_font_size_desktop * 6.25, '%' );
/** @psalm-suppress InvalidScalarArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** Primary button styles */
$theme_color = astra_get_option( 'theme-color' );
$btn_border_color = astra_get_option( 'theme-button-border-group-border-color' );
$btn_bg_color = astra_get_option( 'button-bg-color', $theme_color );
$btn_border_color = astra_get_option( 'theme-button-border-group-border-color' );
$btn_border_h_color = astra_get_option( 'theme-button-border-group-border-h-color' );
$link_hover_color = astra_get_option( 'link-h-color' );
$btn_bg_hover_color = astra_get_option( 'button-bg-h-color', $link_hover_color );
// Apply button 4-6 preset styles same as frontend.
if ( 'button_04' === $btn_preset_style || 'button_05' === $btn_preset_style || 'button_06' === $btn_preset_style ) {
if ( empty( $btn_border_color ) ) {
$btn_border_color = $btn_bg_color;
}
if ( '' === astra_get_option( 'button-bg-color' ) && '' === astra_get_option( 'button-color' ) ) {
$btn_color = $theme_color;
} elseif ( '' === astra_get_option( 'button-color' ) ) {
$btn_color = $btn_bg_color;
}
$btn_bg_color = 'transparent';
}
/**
* Apply text hover color depends on link hover color
*/
$btn_text_hover_color = astra_get_option( 'button-h-color' );
if ( empty( $btn_text_hover_color ) ) {
$btn_text_hover_color = astra_get_foreground_color( $link_hover_color );
}
$desktop_css = array(
':root' => Astra_Global_Palette::generate_global_palette_style(),
'html' => array(
'font-size' => $html_font_size,
),
$astra_wide_particular_selector => array(
'max-width' => esc_attr( $block_appender_width ),
'margin' => '0 auto',
),
'.editor-styles-wrapper a' => array(
'color' => esc_attr( $link_color ),
),
'.block-editor-block-list__block' => array(
'color' => esc_attr( $text_color ),
),
'.has-text-color .block-editor-block-list__block:not(.wp-block-heading)' => array(
'color' => 'inherit',
),
'.wp-block-cover:not(.has-text-color.has-link-color) .wp-block-cover__inner-container .block-editor-rich-text__editable.wp-block-paragraph' => array(
'color' => esc_attr( $text_color ),
),
// Global selection CSS.
'.block-editor-block-list__layout .block-editor-block-list__block ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit:before' => array(
'background-color' => esc_attr( $theme_color ),
),
'.block-editor-block-list__layout .block-editor-block-list__block ::selection, .block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit' => array(
'color' => esc_attr( $selection_text_color ),
),
'#editor .edit-post-visual-editor' => $background_style_data,
'.editor-styles-wrapper' => astra_get_responsive_background_obj( $content_background, 'desktop' ),
'.editor-styles-wrapper, #customize-controls .editor-styles-wrapper' => array(
'font-family' => astra_get_font_family( $body_font_family ),
'font-weight' => esc_attr( $body_font_weight ),
'font-size' => astra_responsive_font( $body_font_size, 'desktop' ),
'line-height' => esc_attr( $body_line_height ),
'text-transform' => esc_attr( $body_text_transform ),
'text-decoration' => esc_attr( $body_text_decoration ),
'letter-spacing' => esc_attr( $body_letter_spacing ),
),
'.editor-styles-wrapper h1, .editor-styles-wrapper h2, .editor-styles-wrapper h3, .editor-styles-wrapper h4, .editor-styles-wrapper h5, .editor-styles-wrapper h6' => astra_get_font_array_css( astra_get_option( 'headings-font-family' ), astra_get_option( 'headings-font-weight' ), array(), 'headings-font-extras', $heading_base_color ),
".wp-block-cover:not([class*='background-color']):not(.has-text-color.has-link-color):not(.wp-block-cover__inner-container .wp-block-cover ). block-editor-block-list__block" => astra_get_font_array_css( astra_get_option( 'headings-font-family' ), astra_get_option( 'headings-font-weight' ), array(), 'headings-font-extras', $heading_base_color ),
// Headings H1 - H6 typography.
'.editor-styles-wrapper h1' => array(
'font-size' => astra_responsive_font( $heading_h1_font_size, 'desktop' ),
'font-family' => astra_get_css_value( $h1_font_family, 'font' ),
'font-weight' => astra_get_css_value( $h1_font_weight, 'font' ),
'line-height' => esc_attr( $h1_line_height ),
'text-transform' => esc_attr( $h1_text_transform ),
'text-decoration' => esc_attr( $h1_text_decoration ),
'letter-spacing' => esc_attr( $h1_letter_spacing ),
),
'.editor-styles-wrapper h2' => array(
'font-size' => astra_responsive_font( $heading_h2_font_size, 'desktop' ),
'font-family' => astra_get_css_value( $h2_font_family, 'font' ),
'font-weight' => astra_get_css_value( $h2_font_weight, 'font' ),
'line-height' => esc_attr( $h2_line_height ),
'text-transform' => esc_attr( $h2_text_transform ),
'text-decoration' => esc_attr( $h2_text_decoration ),
'letter-spacing' => esc_attr( $h2_letter_spacing ),
),
'.editor-styles-wrapper h3, #customize-controls .editor-styles-wrapper h3' => array(
'font-size' => astra_responsive_font( $heading_h3_font_size, 'desktop' ),
'font-family' => astra_get_css_value( $h3_font_family, 'font' ),
'font-weight' => astra_get_css_value( $h3_font_weight, 'font' ),
'line-height' => esc_attr( $h3_line_height ),
'text-transform' => esc_attr( $h3_text_transform ),
'text-decoration' => esc_attr( $h3_text_decoration ),
'letter-spacing' => esc_attr( $h3_letter_spacing ),
),
'.editor-styles-wrapper h4' => array(
'font-size' => astra_responsive_font( $heading_h4_font_size, 'desktop' ),
'font-family' => astra_get_css_value( $h4_font_family, 'font' ),
'font-weight' => astra_get_css_value( $h4_font_weight, 'font' ),
'line-height' => esc_attr( $h4_line_height ),
'text-transform' => esc_attr( $h4_text_transform ),
'text-decoration' => esc_attr( $h4_text_decoration ),
'letter-spacing' => esc_attr( $h4_letter_spacing ),
),
'.editor-styles-wrapper h5' => array(
'font-size' => astra_responsive_font( $heading_h5_font_size, 'desktop' ),
'font-family' => astra_get_css_value( $h5_font_family, 'font' ),
'font-weight' => astra_get_css_value( $h5_font_weight, 'font' ),
'line-height' => esc_attr( $h5_line_height ),
'text-transform' => esc_attr( $h5_text_transform ),
'text-decoration' => esc_attr( $h5_text_decoration ),
'letter-spacing' => esc_attr( $h5_letter_spacing ),
),
'.editor-styles-wrapper h6' => array(
'font-size' => astra_responsive_font( $heading_h6_font_size, 'desktop' ),
'font-family' => astra_get_css_value( $h6_font_family, 'font' ),
'font-weight' => astra_get_css_value( $h6_font_weight, 'font' ),
'line-height' => esc_attr( $h6_line_height ),
'text-transform' => esc_attr( $h6_text_transform ),
'text-decoration' => esc_attr( $h6_text_decoration ),
'letter-spacing' => esc_attr( $h6_letter_spacing ),
),
'.editor-styles-wrapper .block-editor-block-list__layout.is-root-container p' => array(
'margin-bottom' => astra_get_css_value( $para_margin_bottom, 'em' ),
),
'.editor-styles-wrapper .wp-block-quote:not(.has-text-align-right):not(.has-text-align-center)' => array(
'border-' . esc_attr( $ltr_left ) => '5px solid rgba(0, 0, 0, 0.05)',
),
// Gutenberg button compatibility for default styling.
'.editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link, .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button, .block-editor-writing-flow .wp-block-file .wp-block-file__button, .editor-styles-wrapper button.wc-block-components-button' => array(
'border-style' => ( $theme_btn_top_border || $theme_btn_right_border || $theme_btn_left_border || $theme_btn_bottom_border ) ? 'solid' : '',
'border-top-width' => $theme_btn_top_border,
'border-right-width' => $theme_btn_right_border,
'border-left-width' => $theme_btn_left_border,
'border-bottom-width' => $theme_btn_bottom_border,
'color' => esc_attr( $btn_color ),
'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
'background-color' => esc_attr( $btn_bg_color ),
'font-family' => astra_get_font_family( $theme_btn_font_family ),
'font-weight' => esc_attr( $theme_btn_font_weight ),
'line-height' => esc_attr( $theme_btn_line_height ),
'text-transform' => esc_attr( $theme_btn_text_transform ),
'letter-spacing' => astra_get_css_value( $theme_btn_letter_spacing, 'px' ),
'text-decoration' => esc_attr( $theme_btn_text_decoration ),
'font-size' => astra_responsive_font( $theme_btn_font_size, 'desktop' ),
'border-top-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'top', 'desktop' ),
'border-top-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'right', 'desktop' ),
'border-bottom-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'desktop' ),
'border-bottom-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'left', 'desktop' ),
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'desktop' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'desktop' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'desktop' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'desktop' ),
),
'.wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus, .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:hover, .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:focus, .block-editor-writing-flow .wp-block-file .wp-block-file__button:hover, .block-editor-writing-flow .wp-block-file .wp-block-file__button:focus' => array(
'color' => esc_attr( $btn_h_color ),
'background-color' => esc_attr( $btn_bg_h_color ),
'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_h_color ) : esc_attr( $btn_border_h_color ),
),
'.wp-block-button.is-style-outline > .wp-block-button__link:hover, .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color):hover' => array(
'color' => esc_attr( $btn_h_color ),
'background-color' => esc_attr( $btn_bg_h_color ),
),
'.wp-block-button.is-style-outline > .wp-block-button__link.has-text-color' => array(
'border-color' => 'initial',
),
'.wp-block-button.is-style-outline > .wp-block-button__link' => array(
'padding' => '.667em 1.333em',
),
'.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color)' => array(
'color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
),
// Margin bottom same as applied on frontend.
'.editor-styles-wrapper .is-root-container.block-editor-block-list__layout > .wp-block-heading' => array(
'margin-bottom' => '20px',
),
'.editor-styles-wrapper p' => array(
'line-height' => esc_attr( $body_line_height ),
),
);
if ( Astra_Dynamic_CSS::astra_4_6_0_compatibility() && astra_get_option( 'single-content-images-shadow', false ) ) {
$desktop_css['.wp-block-image img'] = array(
'box-shadow' => '0 0 30px 0 rgba(0,0,0,.15)',
'-webkit-box-shadow' => '0 0 30px 0 rgba(0,0,0,.15)',
'-moz-box-shadow' => '0 0 30px 0 rgba(0,0,0,.15)',
);
}
if ( Astra_Dynamic_CSS::astra_4_6_4_compatibility() ) {
$desktop_css['.uagb-buttons-repeater.ast-outline-button'] = array(
'border-radius' => '9999px',
);
}
// Boxed, Content-Boxed, page title alignment with Spectra Container Blocks.
$desktop_css['.ast-separate-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > .uagb-is-root-container'] = array(
'max-width' => 'var(--wp--custom--ast-content-width-size)',
);
// Full-Width Stretched Layout page title alignment.
$desktop_css['.ast-page-builder-template .edit-post-visual-editor__post-title-wrapper'] = array(
'max-width' => 'calc( 100% - 5px ) !important',
);
// Full-Width Contained Layout page title wrapper crops in stacked view fix.
$desktop_css['.ast-plain-container .ast-stacked-title-visibility .edit-post-visual-editor__post-title-wrapper'] = array(
'padding-left' => '3px',
'padding-right' => '3px',
);
// Core / Spectra blocks compatibility to occupy same width as narrow container.
$desktop_css['.ast-narrow-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container'] = array(
'max-width' => 'var(--wp--custom--ast-content-width-size)',
'margin-left' => 'auto',
'margin-right' => 'auto',
);
$desktop_css['.ast-narrow-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > *.wp-block, .ast-narrow-container .is-root-container > .alignfull > :where(:not(.alignleft):not(.alignright))'] = array(
'max-width' => 'var(--wp--custom--ast-content-width-size)',
'margin-left' => 'auto',
'margin-right' => 'auto',
);
$desktop_css['.ast-narrow-container .is-root-container > .alignwide > :where(:not(.alignleft):not(.alignright))'] = array(
'max-width' => 'var(--wp--custom--ast-content-width-size)',
'margin-left' => 'auto',
'margin-right' => 'auto',
);
$desktop_css['.ast-narrow-container .editor-styles-wrapper .is-root-container .wp-block-uagb-image--align-full .wp-block-uagb-image__figure'] = array(
'max-width' => '100%',
'margin-left' => 'auto',
'margin-right' => 'auto',
);
/**
* Desktop site title.
*/
$desktop_css['.editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper > h1'] = array(
'font-size' => astra_responsive_font( $site_title_font_size, 'desktop' ),
'font-weight' => astra_get_css_value( $site_title_font_weight, 'font' ),
'font-family' => astra_get_css_value( $site_title_font_family, 'font', $body_font_family ),
'text-transform' => esc_attr( $site_title_text_transform ),
'letter-spacing' => esc_attr( $site_title_spacing ),
'text-decoration' => esc_attr( $site_title_decoration ),
);
$desktop_css['.editor-styles-wrapper .wp-block-search__input'] = array(
'padding' => '0 10px',
'border-color' => esc_attr( $border_color ),
);
$desktop_css['.wp-block-table figcaption'] = array(
'text-align' => esc_attr( $ltr_left ),
);
$default_border_size = '2px';
if ( astra_button_default_padding_updated() ) {
$default_border_size = '';
}
// Secondary button editor compatibility.
$scndry_btn_text_color = astra_get_option( 'secondary-button-color' );
$scndry_btn_border_color = astra_get_option( 'secondary-theme-button-border-group-border-color' );
$scndry_btn_border_h_color = astra_get_option( 'secondary-theme-button-border-group-border-h-color' );
$global_scndry_custom_button_border_size = astra_get_option( 'secondary-theme-button-border-group-border-size' );
$scndry_theme_btn_top_border = ( isset( $global_scndry_custom_button_border_size['top'] ) && ( '' !== $global_scndry_custom_button_border_size['top'] && '0' !== $global_scndry_custom_button_border_size['top'] ) ) ? astra_get_css_value( $global_scndry_custom_button_border_size['top'], 'px' ) : $default_border_size;
$scndry_theme_btn_right_border = ( isset( $global_scndry_custom_button_border_size['right'] ) && ( '' !== $global_scndry_custom_button_border_size['right'] && '0' !== $global_scndry_custom_button_border_size['right'] ) ) ? astra_get_css_value( $global_scndry_custom_button_border_size['right'], 'px' ) : $default_border_size;
$scndry_theme_btn_left_border = ( isset( $global_scndry_custom_button_border_size['left'] ) && ( '' !== $global_scndry_custom_button_border_size['left'] && '0' !== $global_scndry_custom_button_border_size['left'] ) ) ? astra_get_css_value( $global_scndry_custom_button_border_size['left'], 'px' ) : $default_border_size;
$scndry_theme_btn_bottom_border = ( isset( $global_scndry_custom_button_border_size['bottom'] ) && ( '' !== $global_scndry_custom_button_border_size['bottom'] && '0' !== $global_scndry_custom_button_border_size['bottom'] ) ) ? astra_get_css_value( $global_scndry_custom_button_border_size['bottom'], 'px' ) : $default_border_size;
$scndry_theme_btn_font_family = astra_get_option( 'secondary-font-family-button' );
$scndry_theme_btn_font_size = astra_get_option( 'secondary-font-size-button' );
$scndry_theme_btn_font_weight = astra_get_option( 'secondary-font-weight-button' );
$scndry_theme_btn_text_transform = astra_get_font_extras( astra_get_option( 'secondary-font-extras-button' ), 'text-transform' );
$scndry_theme_btn_line_height = astra_get_font_extras( astra_get_option( 'secondary-font-extras-button' ), 'line-height', 'line-height-unit' );
$scndry_theme_btn_letter_spacing = astra_get_font_extras( astra_get_option( 'secondary-font-extras-button' ), 'letter-spacing', 'letter-spacing-unit' );
$scndry_theme_btn_text_decoration = astra_get_font_extras( astra_get_option( 'secondary-font-extras-button' ), 'text-decoration' );
$scndry_theme_btn_padding = astra_get_option( 'secondary-theme-button-padding' );
$scndry_btn_border_radius_fields = astra_get_option( 'secondary-button-radius-fields' );
$scndry_btn_bg_color = astra_get_option( 'secondary-button-bg-color' );
$scndry_btn_bg_hover_color = astra_get_option( 'secondary-button-bg-h-color' );
$scndry_btn_text_hover_color = astra_get_option( 'secondary-button-h-color' );
$scndry_btn_border_radius_top = astra_responsive_spacing( $scndry_btn_border_radius_fields, 'top', 'desktop' );
$scndry_btn_border_radius_right = astra_responsive_spacing( $scndry_btn_border_radius_fields, 'right', 'desktop' );
$scndry_btn_border_radius_bottom = astra_responsive_spacing( $scndry_btn_border_radius_fields, 'bottom', 'desktop' );
$scndry_btn_border_radius_left = astra_responsive_spacing( $scndry_btn_border_radius_fields, 'left', 'desktop' );
// Secondary color.
if ( empty( $scndry_btn_text_color ) ) {
$btn_color_val = empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color );
} else {
$btn_color_val = $scndry_btn_text_color;
}
// Secondary border color.
if ( empty( $scndry_btn_border_color ) && empty( $scndry_btn_bg_color ) ) {
$btn_border_color_val = empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color );
} else {
$btn_border_color_val = empty( $scndry_btn_border_color ) ? esc_attr( $scndry_btn_bg_color ) : esc_attr( $scndry_btn_border_color );
}
// Secondary border hover color.
if ( empty( $scndry_btn_border_h_color ) ) {
$btn_border_h_color_val = empty( $btn_border_h_color ) ? esc_attr( $btn_bg_hover_color ) : esc_attr( $btn_border_h_color );
} else {
$btn_border_h_color_val = $scndry_btn_border_h_color;
}
// Fallback to primary border radius if secondary border radius is not set.
if ( empty( $scndry_btn_border_radius_top ) && empty( $scndry_btn_border_radius_right ) && empty( $scndry_btn_border_radius_bottom ) && empty( $scndry_btn_border_radius_left ) ) {
$scndry_btn_border_radius_top = astra_responsive_spacing( $btn_border_radius_fields, 'top', 'desktop' );
$scndry_btn_border_radius_right = astra_responsive_spacing( $btn_border_radius_fields, 'right', 'desktop' );
$scndry_btn_border_radius_bottom = astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'desktop' );
$scndry_btn_border_radius_left = astra_responsive_spacing( $btn_border_radius_fields, 'left', 'desktop' );
}
// Secondary button preset compatibility.
$secondary_btn_preset_style = astra_get_option( 'secondary-button-preset-style' );
if ( 'button_04' === $secondary_btn_preset_style || 'button_05' === $secondary_btn_preset_style || 'button_06' === $secondary_btn_preset_style ) {
if ( empty( $scndry_btn_border_color ) ) {
$btn_border_color_val = $scndry_btn_bg_color;
}
if ( '' === astra_get_option( 'secondary-button-bg-color' ) && '' === astra_get_option( 'secondary-button-color' ) ) {
$btn_color_val = $theme_color;
} elseif ( '' === astra_get_option( 'secondary-button-color' ) ) {
$btn_color_val = $scndry_btn_bg_color;
}
$scndry_btn_bg_color = 'transparent';
}
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$secondary_btn_desktop_font_size = is_array( $scndry_theme_btn_font_size ) && isset( $scndry_theme_btn_font_size['desktop'] ) && isset( $scndry_theme_btn_font_size['desktop-unit'] ) ? astra_get_font_css_value( $scndry_theme_btn_font_size['desktop'], $scndry_theme_btn_font_size['desktop-unit'] ) : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$outline_button_css_desktop = array(
'.editor-styles-wrapper .wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link, .ast-outline-button' => array(
'border-color' => esc_attr( $btn_border_color_val ),
'border-top-width' => esc_attr( $scndry_theme_btn_top_border ),
'border-right-width' => esc_attr( $scndry_theme_btn_right_border ),
'border-bottom-width' => esc_attr( $scndry_theme_btn_bottom_border ),
'border-left-width' => esc_attr( $scndry_theme_btn_left_border ),
'font-family' => astra_get_font_family( $scndry_theme_btn_font_family ),
'font-weight' => esc_attr( $scndry_theme_btn_font_weight ),
'font-size' => esc_attr( $secondary_btn_desktop_font_size ),
'line-height' => esc_attr( $scndry_theme_btn_line_height ),
'text-transform' => esc_attr( $scndry_theme_btn_text_transform ),
'text-decoration' => esc_attr( $scndry_theme_btn_text_decoration ),
'letter-spacing' => esc_attr( $scndry_theme_btn_letter_spacing ),
'padding-top' => astra_responsive_spacing( $scndry_theme_btn_padding, 'top', 'desktop' ),
'padding-right' => astra_responsive_spacing( $scndry_theme_btn_padding, 'right', 'desktop' ),
'padding-bottom' => astra_responsive_spacing( $scndry_theme_btn_padding, 'bottom', 'desktop' ),
'padding-left' => astra_responsive_spacing( $scndry_theme_btn_padding, 'left', 'desktop' ),
'border-top-left-radius' => esc_attr( $scndry_btn_border_radius_top ),
'border-top-right-radius' => esc_attr( $scndry_btn_border_radius_right ),
'border-bottom-right-radius' => esc_attr( $scndry_btn_border_radius_bottom ),
'border-bottom-left-radius' => esc_attr( $scndry_btn_border_radius_left ),
'background-color' => empty( $scndry_btn_bg_color ) ? 'transparent' : esc_attr( $scndry_btn_bg_color ),
),
'.editor-styles-wrapper .uagb-buttons-repeater.ast-outline-button' => array(
'border-top-left-radius' => esc_attr( $scndry_btn_border_radius_top ),
'border-top-right-radius' => esc_attr( $scndry_btn_border_radius_right ),
'border-bottom-right-radius' => esc_attr( $scndry_btn_border_radius_bottom ),
'border-bottom-left-radius' => esc_attr( $scndry_btn_border_radius_left ),
),
'.editor-styles-wrapper .wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color), .wp-block-buttons .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color), .ast-outline-button' => array(
'color' => esc_attr( $btn_color_val ),
),
'.editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link:focus, .wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color):hover, .wp-block-buttons .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color):hover, .ast-outline-button:hover, .ast-outline-button:focus, .editor-styles-wrapper .uagb-buttons-repeater.ast-outline-button:hover, .editor-styles-wrapper .uagb-buttons-repeater.ast-outline-button:focus' => array(
'color' => empty( $scndry_btn_text_hover_color ) ? esc_attr( $btn_text_hover_color ) : esc_attr( $scndry_btn_text_hover_color ),
'background-color' => empty( $scndry_btn_bg_hover_color ) ? esc_attr( $btn_bg_hover_color ) : esc_attr( $scndry_btn_bg_hover_color ),
'border-color' => esc_attr( $btn_border_h_color_val ),
),
// Primary hover styles.
'.editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link:hover, .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:hover, .block-editor-writing-flow .wp-block-file .wp-block-file__button:hover' => array(
'color' => esc_attr( $btn_text_hover_color ),
'background-color' => esc_attr( $btn_bg_hover_color ),
'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_hover_color ) : esc_attr( $btn_border_h_color ),
),
);
// Secondary button preset compatibility.
if ( 'button_01' === $secondary_btn_preset_style || 'button_02' === $secondary_btn_preset_style || 'button_03' === $secondary_btn_preset_style ) {
if ( empty( $scndry_btn_text_color ) ) {
$scndry_btn_text_color = astra_get_foreground_color( $theme_color );
}
$outline_button_css_desktop['.wp-block-buttons .wp-block-button .wp-block-button__link.is-style-outline:not(.has-background), .wp-block-buttons .wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background)'] = array(
'background-color' => empty( $scndry_btn_bg_color ) ? esc_attr( $theme_color ) : esc_attr( $scndry_btn_bg_color ),
'color' => esc_attr( $scndry_btn_text_color ),
);
}
$desktop_css = array_merge( $desktop_css, $outline_button_css_desktop );
$content_links_underline = astra_get_option( 'underline-content-links' );
if ( $content_links_underline ) {
$desktop_css['.editor-styles-wrapper .is-root-container a'] = array(
'text-decoration' => 'underline',
);
$reset_underline_from_anchors = Astra_Dynamic_CSS::unset_builder_elements_underline();
$buttons_excluded_selectors = Astra_Dynamic_CSS::astra_4_6_4_compatibility() ? '.edit-post-visual-editor a.uagb-tabs-list, .edit-post-visual-editor .uagb-ifb-cta a, .edit-post-visual-editor a.uagb-marketing-btn__link, .edit-post-visual-editor .uagb-post-grid a, .edit-post-visual-editor .uagb-toc__wrap a, .edit-post-visual-editor .uagb-taxomony-box a, .edit-post-visual-editor .uagb_review_block a, .editor-styles-wrapper .uagb-blockquote a, .editor-styles-wrapper .is-root-container .wc-block-components-product-name, .editor-styles-wrapper .is-root-container .wc-block-components-totals-coupon-link' : '.edit-post-visual-editor a.uagb-tabs-list, .edit-post-visual-editor .uagb-ifb-cta a, .edit-post-visual-editor a.uagb-marketing-btn__link, .edit-post-visual-editor .uagb-post-grid a, .edit-post-visual-editor .uagb-toc__wrap a, .edit-post-visual-editor .uagb-taxomony-box a, .edit-post-visual-editor .uagb_review_block a, .editor-styles-wrapper .uagb-blockquote a, .editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link, .editor-styles-wrapper .wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link, .ast-outline-button, .editor-styles-wrapper .is-root-container .wc-block-components-product-name, .editor-styles-wrapper .is-root-container .wc-block-components-totals-coupon-link';
$excluding_anchor_selectors = $reset_underline_from_anchors ? $buttons_excluded_selectors : '';
$desktop_css[ $excluding_anchor_selectors ] = array(
'text-decoration' => 'none',
);
}
if ( $astra_is_block_editor_v2_ui ) {
$single_post_continer_spacing = astra_get_option( 'single-post-inside-spacing' );
$astra_continer_left_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_continer_spacing, 'left', 'desktop' ) ? astra_responsive_spacing( $single_post_continer_spacing, 'left', 'desktop' ) : '6.67em';
$astra_continer_right_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_continer_spacing, 'right', 'desktop', '6.67' ) ? astra_responsive_spacing( $single_post_continer_spacing, 'right', 'desktop', '6.67' ) : '6.67em';
$alignwide_left_negative_margin = $astra_continer_left_spacing ? 'calc(-1 * min(' . $astra_continer_left_spacing . ', 40px))' : '-40px';
$alignwide_right_negative_margin = $astra_continer_right_spacing ? 'calc(-1 * min(' . $astra_continer_right_spacing . ', 40px))' : '-40px';
$heading_width_comp = Astra_Dynamic_CSS::astra_4_8_0_compatibility() ? 'none' : 'var(--wp--custom--ast-content-width-size)';
$container_width_comp = Astra_Dynamic_CSS::astra_4_8_4_compatibility() ? 'var(--wp--custom--ast-content-width-size)' : '';
$desktop_css['.editor-styles-wrapper .wp-block-latest-posts > li > a'] = array(
'text-decoration' => 'none',
'font-size' => '1.25rem',
);
$desktop_css['.ast-plain-container.ast-no-sidebar .editor-styles-wrapper .is-root-container.block-editor-block-list__layout > .alignwide.uagb-is-root-container '] = array(
'max-width' => $container_width_comp,
);
$desktop_css['.ast-separate-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container .alignwide, .ast-plain-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container .alignwide'] = array(
'margin-left' => $alignwide_left_negative_margin,
'margin-right' => $alignwide_right_negative_margin,
);
$desktop_css['.ast-page-builder-template .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > *.wp-block, .ast-page-builder-template .is-root-container > .alignfull:not(.wp-block-group) > :where(:not(.alignleft):not(.alignright)), .editor-styles-wrapper .is-root-container > .wp-block-cover.alignfull .wp-block-cover__image-background'] = array(
'max-width' => 'none',
);
$desktop_css['.ast-page-builder-template .is-root-container > .alignwide > :where(:not(.alignleft):not(.alignright)), .editor-styles-wrapper .is-root-container > .wp-block-cover.alignwide .wp-block-cover__image-background'] = array(
'max-width' => 'var(--wp--custom--ast-wide-width-size)',
);
$desktop_css['.ast-page-builder-template .is-root-container > .inherit-container-width > *, .ast-page-builder-template .is-root-container > *:not(.wp-block-group) > :where(:not(.alignleft):not(.alignright)), .is-root-container .wp-block-cover .wp-block-cover__inner-container, .editor-styles-wrapper .is-root-container > .wp-block-cover .wp-block-cover__inner-container, .is-root-container > .wp-block-cover .wp-block-cover__image-background'] = array(
'max-width' => $heading_width_comp, // phpcs:ignore WordPress.Arrays.ArrayIndentation.ItemNotAligned
'margin-right' => 'auto', // phpcs:ignore WordPress.Arrays.ArrayIndentation.ItemNotAligned
'margin-left' => 'auto', // phpcs:ignore WordPress.Arrays.ArrayIndentation.ItemNotAligned
); // phpcs:ignore WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned
} else {
$desktop_css['.editor-styles-wrapper .wp-block-latest-posts > li > a'] = array(
'text-decoration' => 'none',
'color' => esc_attr( $heading_base_color ),
);
}
$tablet_css = array(
':root, body .editor-styles-wrapper' => array(
'--wp--custom--ast-default-block-top-padding' => $tablet_top_spacing,
'--wp--custom--ast-default-block-right-padding' => $tablet_right_spacing,
'--wp--custom--ast-default-block-bottom-padding' => $tablet_bottom_spacing,
'--wp--custom--ast-default-block-left-padding' => $tablet_left_spacing,
),
// Heading H1 - H6 font size.
'.editor-styles-wrapper h1' => array(
'font-size' => astra_responsive_font( $heading_h1_font_size, 'tablet', '30' ),
),
'.editor-styles-wrapper h2' => array(
'font-size' => astra_responsive_font( $heading_h2_font_size, 'tablet', '25' ),
),
'.editor-styles-wrapper h3' => array(
'font-size' => astra_responsive_font( $heading_h3_font_size, 'tablet', '20' ),
),
'.editor-styles-wrapper h4' => array(
'font-size' => astra_responsive_font( $heading_h4_font_size, 'tablet' ),
),
'.editor-styles-wrapper h5' => array(
'font-size' => astra_responsive_font( $heading_h5_font_size, 'tablet' ),
),
'.editor-styles-wrapper h6' => array(
'font-size' => astra_responsive_font( $heading_h6_font_size, 'tablet' ),
),
'.edit-post-visual-editor__post-title-wrapper' => array(
'margin-top' => '0',
),
'#editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $site_background, 'tablet' ),
'.editor-styles-wrapper' => astra_get_responsive_background_obj( $content_background, 'tablet' ),
);
/**
* Tablet site title.
*/
$tablet_css['.editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper > h1'] = array(
'font-size' => astra_responsive_font( $site_title_font_size, 'tablet' ),
);
$mobile_css = array(
':root, body .editor-styles-wrapper' => array(
'--wp--custom--ast-default-block-top-padding' => $mobile_top_spacing,
'--wp--custom--ast-default-block-right-padding' => $mobile_right_spacing,
'--wp--custom--ast-default-block-bottom-padding' => $mobile_bottom_spacing,
'--wp--custom--ast-default-block-left-padding' => $mobile_left_spacing,
),
// Heading H1 - H6 font size.
'.editor-styles-wrapper h1' => array(
'font-size' => astra_responsive_font( $heading_h1_font_size, 'mobile', '30' ),
),
'.editor-styles-wrapper h2' => array(
'font-size' => astra_responsive_font( $heading_h2_font_size, 'mobile', '25' ),
),
'.editor-styles-wrapper h3' => array(
'font-size' => astra_responsive_font( $heading_h3_font_size, 'mobile', '20' ),
),
'.editor-styles-wrapper h4' => array(
'font-size' => astra_responsive_font( $heading_h4_font_size, 'mobile' ),
),
'.editor-styles-wrapper h5' => array(
'font-size' => astra_responsive_font( $heading_h5_font_size, 'mobile' ),
),
'.editor-styles-wrapper h6' => array(
'font-size' => astra_responsive_font( $heading_h6_font_size, 'mobile' ),
),
'#editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $site_background, 'mobile' ),
'.editor-styles-wrapper' => astra_get_responsive_background_obj( $content_background, 'mobile' ),
);
/**
* Mobile site title.
*/
$mobile_css['.editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper > h1'] = array(
'font-size' => astra_responsive_font( $site_title_font_size, 'mobile' ),
);
/**
* Core blocks custom spacing support.
* Case :- Do not apply custom padding for custom layout group, cover & column blocks.
*/
if ( 'astra-advanced-hook' !== $post_type ) {
$desktop_css['.block-editor-block-list__layout.is-root-container > .wp-block-group, .block-editor-block-list__layout.is-root-container > [data-align="wide"] > .wp-block-group, .block-editor-block-list__layout.is-root-container > [data-align="full"] > .wp-block-group, .block-editor-block-list__layout.is-root-container > .wp-block-cover, .block-editor-block-list__layout.is-root-container > [data-align="wide"] > .wp-block-cover, .block-editor-block-list__layout.is-root-container > [data-align="full"] > .wp-block-cover, .block-editor-block-list__layout.is-root-container > .wp-block-columns, .block-editor-block-list__layout.is-root-container > [data-align="wide"] > .wp-block-columns, .block-editor-block-list__layout.is-root-container > [data-align="full"] > .wp-block-columns'] = array(
'padding-top' => 'var(--wp--custom--ast-default-block-top-padding)',
'padding-right' => 'var(--wp--custom--ast-default-block-right-padding)',
'padding-bottom' => 'var(--wp--custom--ast-default-block-bottom-padding)',
'padding-left' => 'var(--wp--custom--ast-default-block-left-padding)',
);
}
$css .= astra_parse_css( $desktop_css );
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$css .= astra_parse_css( $tablet_css, '', astra_get_tablet_breakpoint() );
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$css .= astra_parse_css( $mobile_css, '', astra_get_mobile_breakpoint() );
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
return $css;
}
}
PK Z_] sidebar-manager.phpnu [ {$n}";
$output = apply_filters( 'astra_caret_wrap_filter', $output, $args['sort_column'] );
}
/**
* Outputs the beginning of the current element in the tree.
*
* @see Walker::start_el()
* @since 1.7.2
*
* @param string $output Used to append additional content. Passed by reference.
* @param WP_Post $page Page data object.
* @param int $depth Optional. Depth of page. Used for padding. Default 0.
* @param array $args Optional. Array of arguments. Default empty array.
* @param int $current_page Optional. Page ID. Default 0.
*/
public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
$css_class = array( 'page_item', 'page-item-' . $page->ID );
$icon = '';
$mobile_icon = '';
if ( isset( $args['pages_with_children'][ $page->ID ] ) ) {
$css_class[] = 'menu-item-has-children';
$icon = Astra_Icons::get_icons( 'arrow' );
$icon = '';
// Add toggle button if menu is from Astra.
if ( true === is_object( $args ) ) {
if ( isset( $args->theme_location ) &&
( 'primary' === $args->theme_location ||
'above_header_menu' === $args->theme_location ||
'below_header_menu' === $args->theme_location )
) {
$mobile_icon = ' 'false',
),
$page
) . '>' . __( 'Menu Toggle', 'astra' ) . ' ' . Astra_Icons::get_icons( 'arrow' ) . ' ';
}
} else {
if ( isset( $page->post_parent ) && 0 === $page->post_parent ) {
$mobile_icon = ' 'false',
),
$page
) . '>' . __( 'Menu Toggle', 'astra' ) . ' ' . Astra_Icons::get_icons( 'arrow' ) . ' ';
}
}
}
if ( ! empty( $current_page ) ) {
$_current_page = get_post( $current_page );
if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) {
$css_class[] = 'current-menu-ancestor';
}
if ( $page->ID == $current_page ) {
$css_class[] = 'current-menu-item';
} elseif ( $_current_page && $page->ID == $_current_page->post_parent ) {
$css_class[] = 'current-menu-parent';
}
} elseif ( get_option( 'page_for_posts' ) == $page->ID ) {
$css_class[] = 'current-menu-parent';
}
$css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
$args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before'];
$args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after'];
$output .= sprintf(
'%s',
$css_classes,
get_permalink( $page->ID ),
$args['link_before'],
apply_filters( 'the_title', $page->post_title, $page->ID ), // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
$args['link_after'],
$icon,
$mobile_icon
);
}
}
}
PK Z)R# # theme-hooks.phpnu [
* // Declare support for all hook types
* add_theme_support( 'astra_hooks', array( 'all' ) );
*
* // Declare support for certain hook types only
* add_theme_support( 'astra_hooks', array( 'header', 'content', 'footer' ) );
*
*/
add_theme_support(
'astra_hooks',
array(
/**
* As a Theme developer, use the 'all' parameter, to declare support for all
* hook types.
* Please make sure you then actually reference all the hooks in this file,
* Plugin developers depend on it!
*/
'all',
/**
* Themes can also choose to only support certain hook types.
* Please make sure you then actually reference all the hooks in this type
* family.
*
* When the 'all' parameter was set, specific hook types do not need to be
* added explicitly.
*/
'html',
'body',
'head',
'header',
'content',
'entry',
'comments',
'sidebars',
'sidebar',
'footer',
/**
* If/when WordPress Core implements similar methodology, Themes and Plugins
* will be able to check whether the version of THA supplied by the theme
* supports Core hooks.
*/
)
);
/**
* Determines, whether the specific hook type is actually supported.
*
* Plugin developers should always check for the support of a specific
* hook type before hooking a callback function to a hook of this type.
*
* Example:
*
* if ( current_theme_supports( 'astra_hooks', 'header' ) )
* add_action( 'astra_head_top', 'prefix_header_top' );
*
*
* @param bool $bool true.
* @param array $args The hook type being checked.
* @param array $registered All registered hook types.
*
* @return bool
*/
function astra_current_theme_supports( $bool, $args, $registered ) {
return in_array( $args[0], $registered[0] ) || in_array( 'all', $registered[0] );
}
add_filter( 'current_theme_supports-astra_hooks', 'astra_current_theme_supports', 10, 3 );
/**
* HTML hook
* Special case, useful for , etc.
* $astra_supports[] = 'html;
*/
function astra_html_before() {
do_action( 'astra_html_before' );
}
/**
* HTML hooks
* $astra_supports[] = 'body';
*/
function astra_body_top() {
do_action( 'astra_body_top' );
}
/**
* Body Bottom
*/
function astra_body_bottom() {
do_action( 'astra_body_bottom' );
}
/**
* HTML hooks
*
* $astra_supports[] = 'head';
*/
function astra_head_top() {
do_action( 'astra_head_top' );
}
/**
* Head Bottom
*/
function astra_head_bottom() {
do_action( 'astra_head_bottom' );
}
/**
* Semantic hooks
*
* $astra_supports[] = 'header';
*/
function astra_header_before() {
do_action( 'astra_header_before' );
}
/**
* Site Header
*/
function astra_header() {
do_action( 'astra_header' );
}
/**
* Masthead Top
*/
function astra_masthead_top() {
do_action( 'astra_masthead_top' );
}
/**
* Masthead
*/
function astra_masthead() {
do_action( 'astra_masthead' );
}
/**
* Masthead Bottom
*/
function astra_masthead_bottom() {
do_action( 'astra_masthead_bottom' );
}
/**
* Header After
*/
function astra_header_after() {
do_action( 'astra_header_after' );
}
/**
* Main Header bar top
*/
function astra_main_header_bar_top() {
do_action( 'astra_main_header_bar_top' );
}
/**
* Main Header bar bottom
*/
function astra_main_header_bar_bottom() {
do_action( 'astra_main_header_bar_bottom' );
}
/**
* Main Header Content
*/
function astra_masthead_content() {
do_action( 'astra_masthead_content' );
}
/**
* Main toggle button before
*/
function astra_masthead_toggle_buttons_before() {
do_action( 'astra_masthead_toggle_buttons_before' );
}
/**
* Main toggle buttons
*/
function astra_masthead_toggle_buttons() {
do_action( 'astra_masthead_toggle_buttons' );
}
/**
* Main toggle button after
*/
function astra_masthead_toggle_buttons_after() {
do_action( 'astra_masthead_toggle_buttons_after' );
}
/**
* Semantic hooks
*
* $astra_supports[] = 'content';
*/
function astra_content_before() {
do_action( 'astra_content_before' );
}
/**
* Content after
*/
function astra_content_after() {
do_action( 'astra_content_after' );
}
/**
* Content top
*/
function astra_content_top() {
do_action( 'astra_content_top' );
}
/**
* Content bottom
*/
function astra_content_bottom() {
do_action( 'astra_content_bottom' );
}
/**
* Content while before
*/
function astra_content_while_before() {
do_action( 'astra_content_while_before' );
}
/**
* Content loop
*/
function astra_content_loop() {
do_action( 'astra_content_loop' );
}
/**
* Conten Page Loop.
*
* Called from page.php
*/
function astra_content_page_loop() {
do_action( 'astra_content_page_loop' );
}
/**
* Content while after
*/
function astra_content_while_after() {
do_action( 'astra_content_while_after' );
}
/**
* Semantic hooks
*
* $astra_supports[] = 'entry';
*/
function astra_entry_before() {
do_action( 'astra_entry_before' );
}
/**
* Entry after
*/
function astra_entry_after() {
do_action( 'astra_entry_after' );
}
/**
* Entry content before
*/
function astra_entry_content_before() {
do_action( 'astra_entry_content_before' );
}
/**
* Entry content after
*/
function astra_entry_content_after() {
do_action( 'astra_entry_content_after' );
}
/**
* Entry Top
*/
function astra_entry_top() {
do_action( 'astra_entry_top' );
}
/**
* Entry bottom
*/
function astra_entry_bottom() {
do_action( 'astra_entry_bottom' );
}
/**
* Single Post Header Before
*/
function astra_single_header_before() {
do_action( 'astra_single_header_before' );
}
/**
* Single Post Header After
*/
function astra_single_header_after() {
do_action( 'astra_single_header_after' );
}
/**
* Single Post Header Top
*/
function astra_single_header_top() {
do_action( 'astra_single_header_top' );
}
/**
* Single Post Header Bottom
*/
function astra_single_header_bottom() {
do_action( 'astra_single_header_bottom' );
}
/**
* Comments block hooks
*
* $astra_supports[] = 'comments';
*/
function astra_comments_before() {
do_action( 'astra_comments_before' );
}
/**
* Comments after.
*/
function astra_comments_after() {
do_action( 'astra_comments_after' );
}
/**
* Semantic hooks
*
* $astra_supports[] = 'sidebar';
*/
function astra_sidebars_before() {
do_action( 'astra_sidebars_before' );
}
/**
* Sidebars after
*/
function astra_sidebars_after() {
do_action( 'astra_sidebars_after' );
}
/**
* Semantic hooks
*
* $astra_supports[] = 'footer';
*/
function astra_footer() {
do_action( 'astra_footer' );
}
/**
* Footer before
*/
function astra_footer_before() {
do_action( 'astra_footer_before' );
}
/**
* Footer after
*/
function astra_footer_after() {
do_action( 'astra_footer_after' );
}
/**
* Footer top
*/
function astra_footer_content_top() {
do_action( 'astra_footer_content_top' );
}
/**
* Footer
*/
function astra_footer_content() {
do_action( 'astra_footer_content' );
}
/**
* Footer bottom
*/
function astra_footer_content_bottom() {
do_action( 'astra_footer_content_bottom' );
}
/**
* Archive header
*/
function astra_archive_header() {
do_action( 'astra_archive_header' );
}
/**
* Pagination
*/
function astra_pagination() {
do_action( 'astra_pagination' );
}
/**
* Entry content single
*/
function astra_entry_content_single() {
do_action( 'astra_entry_content_single' );
}
/**
* Entry content single-page.
*
* @since 4.0.0
*/
function astra_entry_content_single_page() {
do_action( 'astra_entry_content_single_page' );
}
/**
* 404
*/
function astra_entry_content_404_page() {
do_action( 'astra_entry_content_404_page' );
}
/**
* Entry content blog
*/
function astra_entry_content_blog() {
do_action( 'astra_entry_content_blog' );
}
/**
* Blog featured post section
*/
function astra_blog_post_featured_format() {
do_action( 'astra_blog_post_featured_format' );
}
/**
* Primary Content Top
*/
function astra_primary_content_top() {
do_action( 'astra_primary_content_top' );
}
/**
* Primary Content Bottom
*/
function astra_primary_content_bottom() {
do_action( 'astra_primary_content_bottom' );
}
/**
* 404 Page content template action.
*/
function astra_404_content_template() {
do_action( 'astra_404_content_template' );
}
if ( ! function_exists( 'wp_body_open' ) ) {
/**
* Fire the wp_body_open action.
* Adds backward compatibility for WordPress versions < 5.2
*
* @since 1.8.7
*/
function wp_body_open() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
do_action( 'wp_body_open' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
}
}
PK ZN class-theme-strings.phpnu [ __( 'Skip to content', 'astra' ),
// 404 Page Strings.
'string-404-sub-title' => __( 'It looks like the link pointing here was faulty. Maybe try searching?', 'astra' ),
// Search Page Strings.
'string-search-nothing-found' => __( 'Nothing Found', 'astra' ),
'string-search-nothing-found-message' => __( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'astra' ),
'string-full-width-search-message' => __( 'Start typing and press enter to search', 'astra' ),
'string-full-width-search-placeholder' => __( 'Search...', 'astra' ),
'string-header-cover-search-placeholder' => __( 'Search...', 'astra' ),
'string-search-input-placeholder' => __( 'Search...', 'astra' ),
// Comment Template Strings.
'string-comment-reply-link' => __( 'Reply', 'astra' ),
'string-comment-edit-link' => __( 'Edit', 'astra' ),
'string-comment-awaiting-moderation' => __( 'Your comment is awaiting moderation.', 'astra' ),
'string-comment-title-reply' => __( 'Leave a Comment', 'astra' ),
'string-comment-cancel-reply-link' => __( 'Cancel Reply', 'astra' ),
'string-comment-label-submit' => $post_comment_dynamic_string,
'string-comment-label-message' => __( 'Type here..', 'astra' ),
'string-comment-label-name' => __( 'Name', 'astra' ),
'string-comment-label-email' => __( 'Email', 'astra' ),
'string-comment-label-website' => __( 'Website', 'astra' ),
'string-comment-closed' => __( 'Comments are closed.', 'astra' ),
'string-comment-navigation-title' => __( 'Comment navigation', 'astra' ),
'string-comment-navigation-next' => __( 'Newer Comments', 'astra' ),
'string-comment-navigation-previous' => __( 'Older Comments', 'astra' ),
// Blog Default Strings.
'string-blog-page-links-before' => __( 'Pages:', 'astra' ),
'string-blog-meta-author-by' => __( 'By ', 'astra' ),
'string-blog-meta-leave-a-comment' => __( 'Leave a Comment', 'astra' ),
'string-blog-meta-one-comment' => __( '1 Comment', 'astra' ),
'string-blog-meta-multiple-comment' => __( '% Comments', 'astra' ),
'string-blog-navigation-next' => __( 'Next', 'astra' ) . ' → ',
'string-blog-navigation-previous' => '← ' . __( 'Previous', 'astra' ),
'string-next-text' => __( 'Next', 'astra' ),
'string-previous-text' => __( 'Previous', 'astra' ),
// Single Post Default Strings.
'string-single-page-links-before' => __( 'Pages:', 'astra' ),
/* translators: 1: Post type label */
'string-single-navigation-next' => __( 'Next %s', 'astra' ) . ' → ',
/* translators: 1: Post type label */
'string-single-navigation-previous' => '← ' . __( 'Previous %s', 'astra' ),
// Content None.
'string-content-nothing-found-message' => __( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'astra' ),
)
);
if ( is_rtl() ) {
$defaults['string-blog-navigation-next'] = __( 'Next', 'astra' ) . ' ← ';
$defaults['string-blog-navigation-previous'] = '→ ' . __( 'Previous', 'astra' );
/* translators: 1: Post type label */
$defaults['string-single-navigation-next'] = __( 'Next %s', 'astra' ) . ' ← ';
/* translators: 1: Post type label */
$defaults['string-single-navigation-previous'] = '→ ' . __( 'Previous %s', 'astra' );
}
$output = isset( $defaults[ $key ] ) ? $defaults[ $key ] : '';
/**
* Print or return
*/
if ( $echo ) {
echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $output;
}
}
}
PK Z common-functions.phpnu [ get_color_by_palette_variable( $overlay_color );
}
if ( '#' === $updated_overlay_color[0] ) {
$updated_overlay_color = astra_hex_to_rgba( $updated_overlay_color, $overlay_opacity );
}
}
$gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $updated_overlay_color . ', ' . $updated_overlay_color . '), url(' . $bg_img . ');';
} elseif ( 'gradient' === $overlay_type && '' !== $overlay_grad ) {
$gen_bg_css['background-image'] = $overlay_grad . ', url(' . $bg_img . ');';
} else {
$gen_bg_css['background-image'] = 'url(' . $bg_img . ');';
}
} else {
$gen_bg_css['background-image'] = 'url(' . $bg_img . ');';
}
}
break;
case 'gradient':
if ( isset( $bg_color ) ) {
$gen_bg_css['background-image'] = $bg_color . ';';
}
break;
default:
break;
}
} elseif ( '' !== $bg_color ) {
$gen_bg_css['background-color'] = $bg_color . ';';
}
if ( '' !== $bg_img ) {
if ( isset( $bg_obj['background-repeat'] ) ) {
$gen_bg_css['background-repeat'] = esc_attr( $bg_obj['background-repeat'] );
}
if ( isset( $bg_obj['background-position'] ) ) {
$gen_bg_css['background-position'] = esc_attr( $bg_obj['background-position'] );
}
if ( isset( $bg_obj['background-size'] ) ) {
$gen_bg_css['background-size'] = esc_attr( $bg_obj['background-size'] );
}
if ( isset( $bg_obj['background-attachment'] ) ) {
$gen_bg_css['background-attachment'] = esc_attr( $bg_obj['background-attachment'] );
}
}
return $gen_bg_css;
}
}
/**
* Parse CSS
*/
if ( ! function_exists( 'astra_parse_css' ) ) {
/**
* Parse CSS
*
* @param array $css_output Array of CSS.
* @param mixed $min_media Min Media breakpoint.
* @param mixed $max_media Max Media breakpoint.
* @return string Generated CSS.
*/
function astra_parse_css( $css_output = array(), $min_media = '', $max_media = '' ) {
$parse_css = '';
if ( is_array( $css_output ) && count( $css_output ) > 0 ) {
foreach ( $css_output as $selector => $properties ) {
if ( null === $properties ) {
break;
}
if ( ! count( $properties ) ) {
continue;
}
$temp_parse_css = $selector . '{';
$properties_added = 0;
foreach ( $properties as $property => $value ) {
// to ignore if the value is empty with just !important appended.
if ( ( '' == $value && 0 !== $value ) || '!important' === $value ) {
continue;
}
$properties_added++;
$temp_parse_css .= $property . ':' . $value . ';';
}
$temp_parse_css .= '}';
if ( $properties_added > 0 ) {
$parse_css .= $temp_parse_css;
}
}
if ( '' != $parse_css && ( '' !== $min_media || '' !== $max_media ) ) {
$media_css = '@media ';
$min_media_css = '';
$max_media_css = '';
$media_separator = '';
if ( '' !== $min_media ) {
$min_media_css = '(min-width:' . $min_media . 'px)';
}
if ( '' !== $max_media ) {
$max_media_css = '(max-width:' . $max_media . 'px)';
}
if ( '' !== $min_media && '' !== $max_media ) {
$media_separator = ' and ';
}
$media_css .= $min_media_css . $media_separator . $max_media_css . '{' . $parse_css . '}';
return $media_css;
}
}
return $parse_css;
}
}
/**
* Return theme options from astra-settings option key.
*/
if ( ! function_exists( 'astra_get_options' ) ) {
/**
* Retrieve Astra theme options array.
*
* @return array The theme options array.
*
* @since 4.8.9
*/
function astra_get_options() {
// Ensure we're not interfering during WordPress installation.
if ( wp_installing() ) {
return [];
}
/**
* Filter to bypass the cached Astra options.
*
* Example usage:
* add_filter( 'astra_get_options_nocache', '__return_true' );
*
* @since 4.8.9
* @return bool Whether to bypass the cache. Default is false.
*/
if ( apply_filters( 'astra_get_options_nocache', false ) ) {
$astra_options = get_option( ASTRA_THEME_SETTINGS );
} else {
// Use a static variable to cache the options for this request.
static $cached_astra_options = null;
// Fetch the options once and cache them in the static variable.
if ( is_null( $cached_astra_options ) || is_customize_preview() ) {
$cached_astra_options = Astra_Theme_Options::get_astra_options();
}
$astra_options = $cached_astra_options;
}
/**
* Filter the options array for Astra Settings.
*
* @since 4.8.9
* @return array The theme options array.
*/
return apply_filters( 'astra_get_options', $astra_options );
}
}
/**
* Return Theme option.
*/
if ( ! function_exists( 'astra_get_option' ) ) {
/**
* Return Theme options.
*
* @param string $option Option key.
* @param mixed $default Option default value.
* @param string $deprecated Option default value.
* @return mixed Return option value.
*/
function astra_get_option( $option, $default = '', $deprecated = '' ) {
if ( '' != $deprecated ) {
$default = $deprecated;
}
$theme_options = Astra_Theme_Options::get_options();
/**
* Filter the options array for Astra Settings.
*
* @since 1.0.20
* @var Array
*/
$theme_options = apply_filters( 'astra_get_option_array', $theme_options, $option, $default );
$value = ( isset( $theme_options[ $option ] ) && '' !== $theme_options[ $option ] ) ? $theme_options[ $option ] : $default;
/**
* Dynamic filter astra_get_option_$option.
* $option is the name of the Astra Setting, Refer Astra_Theme_Options::defaults() for option names from the theme.
*
* @since 1.0.20
* @var Mixed.
*/
return apply_filters( "astra_get_option_{$option}", $value, $option, $default );
}
}
/**
* Return translated theme option.
*/
if ( ! function_exists( 'astra_get_i18n_option' ) ) {
/**
* Returns translated string for strings saved in Astra settings.
*
* This function retrieves a theme option value and checks if it needs translation.
* If the option's translation is needed, it looks it up based on the provided context.
* If the translation is not available, it returns the default value.
*
* Usage examples:
* - Retrieve translated theme option with a context description:
* $value = astra_get_i18n_option( 'astra-option-key', esc_html_x( '%astra%', 'Context Description', 'astra-addon' ) );
*
* - Retrieve translated theme option with a different context:
* $value = astra_get_i18n_option( 'astra-option-key', _x( '%astra%', 'Context Description', 'astra-addon' ) );
*
* @param string $option Option key.
* @param string $translated Default translation flag.
* @param mixed $default Option default value.
* @param string $deprecated Option default value.
*
* @return string Return option value.
*
* @since 4.8.1
*/
function astra_get_i18n_option( $option, $translated, $default = '', $deprecated = '' ) {
// #%astra%# is for TranslatePress compatibility.
$is_translated = '%astra%' !== $translated && ! strpos( $translated, '#%astra%#' );
return $is_translated ? $translated : astra_get_option( $option, $default, $deprecated );
}
}
/**
* Return translated string.
*/
if ( ! function_exists( 'astra_get_i18n_string' ) ) {
/**
* Returns translated string.
*
* This function checks if string has translation.
* If the translation is not available, it returns the default value.
*
* Usage examples:
* - Retrieve translated theme option with a context description:
* $value = astra_get_i18n_string( $default, esc_html_x( '%astra%', 'Context Description', 'astra-addon' ) );
*
* - Retrieve translated theme option with a different context:
* $value = astra_get_i18n_string( $default, _x( '%astra%', 'Context Description', 'astra-addon' ) );
*
* @param string $default Default string value.
* @param string $translated Default translation flag.
*
* @return string Return string value.
*
* @since 4.8.1
*/
function astra_get_i18n_string( $default, $translated ) {
// #%astra%# is for TranslatePress compatibility.
$is_translated = '%astra%' !== $translated && ! strpos( $translated, '#%astra%#' );
return $is_translated ? $translated : $default;
}
}
if ( ! function_exists( 'astra_update_option' ) ) {
/**
* Update Theme options.
*
* @param string $option option key.
* @param Mixed $value option value.
* @return void
*/
function astra_update_option( $option, $value ) {
do_action( "astra_before_update_option_{$option}", $value, $option );
// Get all customizer options.
$theme_options = get_option( ASTRA_THEME_SETTINGS );
// Update value in options array.
if ( ! is_array( $theme_options ) ) {
$theme_options = array();
}
$theme_options[ $option ] = $value;
update_option( ASTRA_THEME_SETTINGS, $theme_options );
do_action( "astra_after_update_option_{$option}", $value, $option );
}
}
if ( ! function_exists( 'astra_delete_option' ) ) {
/**
* Update Theme options.
*
* @param string $option option key.
* @return void
*/
function astra_delete_option( $option ) {
do_action( "astra_before_delete_option_{$option}", $option );
// Get all customizer options.
$theme_options = get_option( ASTRA_THEME_SETTINGS );
// Update value in options array.
unset( $theme_options[ $option ] );
update_option( ASTRA_THEME_SETTINGS, $theme_options );
do_action( "astra_after_delete_option_{$option}", $option );
}
}
/**
* Return Theme options from postmeta.
*/
if ( ! function_exists( 'astra_get_option_meta' ) ) {
/**
* Return Theme options from postmeta.
*
* @param string $option_id Option ID.
* @param string $default Option default value.
* @param boolean $only_meta Get only meta value.
* @param string $extension Is value from extension.
* @param string $post_id Get value from specific post by post ID.
* @return Mixed Return option value.
*/
function astra_get_option_meta( $option_id, $default = '', $only_meta = false, $extension = '', $post_id = '' ) {
$post_id = ( '' != $post_id ) ? $post_id : astra_get_post_id();
$value = astra_get_option( $option_id, $default );
// Get value from option 'post-meta'.
if ( is_singular() || ( is_home() && ! is_front_page() ) ) {
$value = get_post_meta( $post_id, $option_id, true );
if ( empty( $value ) || 'default' == $value ) {
if ( true === $only_meta ) {
return false;
}
$value = astra_get_option( $option_id, $default );
}
}
/**
* Dynamic filter astra_get_option_meta_$option.
* $option_id is the name of the Astra Meta Setting.
*
* @since 1.0.20
* @var Mixed.
*/
return apply_filters( "astra_get_option_meta_{$option_id}", $value, $default, $default );
}
}
/**
* Helper function to get the current post id.
*/
if ( ! function_exists( 'astra_get_post_id' ) ) {
/**
* Get post ID.
*
* @param string $post_id_override Get override post ID.
* @return number Post ID.
*/
function astra_get_post_id( $post_id_override = '' ) {
if ( null == Astra_Theme_Options::$post_id ) {
global $post;
$post_id = 0;
if ( is_home() ) {
$post_id = get_option( 'page_for_posts' );
} elseif ( function_exists( 'is_shop' ) && is_shop() && function_exists( 'wc_get_page_id' ) ) {
$post_id = wc_get_page_id( 'shop' );
} elseif ( is_archive() ) {
global $wp_query;
$post_id = $wp_query->get_queried_object_id();
} elseif ( isset( $post->ID ) && ! is_search() && ! is_category() ) {
$post_id = $post->ID;
}
Astra_Theme_Options::$post_id = $post_id;
}
return apply_filters( 'astra_get_post_id', Astra_Theme_Options::$post_id, $post_id_override );
}
}
/**
* Display classes for primary div
*/
if ( ! function_exists( 'astra_primary_class' ) ) {
/**
* Display classes for primary div
*
* @param string|array $class One or more classes to add to the class list.
* @return void Echo classes.
*/
function astra_primary_class( $class = '' ) {
// Separates classes with a single space, collates classes for body element.
echo 'class="' . esc_attr( join( ' ', astra_get_primary_class( $class ) ) ) . '"';
}
}
/**
* Retrieve the classes for the primary element as an array.
*/
if ( ! function_exists( 'astra_get_primary_class' ) ) {
/**
* Retrieve the classes for the primary element as an array.
*
* @param string|array $class One or more classes to add to the class list.
* @return array Return array of classes.
*/
function astra_get_primary_class( $class = '' ) {
// array of class names.
$classes = array();
// default class for content area.
$classes[] = 'content-area';
// primary base class.
$classes[] = 'primary';
if ( ! empty( $class ) ) {
if ( ! is_array( $class ) ) {
$class = preg_split( '#\s+#', $class );
}
$classes = array_merge( $classes, $class );
} else {
// Ensure that we always coerce class to being an array.
$class = array();
}
// Filter primary div class names.
$classes = apply_filters( 'astra_primary_class', $classes, $class );
$classes = array_map( 'sanitize_html_class', $classes );
return array_unique( $classes );
}
}
/**
* Display classes for secondary div
*/
if ( ! function_exists( 'astra_secondary_class' ) ) {
/**
* Retrieve the classes for the secondary element as an array.
*
* @param string|array $class One or more classes to add to the class list.
* @return void echo classes.
*/
function astra_secondary_class( $class = '' ) {
// Separates classes with a single space, collates classes for body element.
echo 'class="' . esc_attr( join( ' ', astra_get_secondary_class( $class ) ) ) . '"';
}
}
/**
* Retrieve the classes for the secondary element as an array.
*/
if ( ! function_exists( 'astra_get_secondary_class' ) ) {
/**
* Retrieve the classes for the secondary element as an array.
*
* @param string|array $class One or more classes to add to the class list.
* @return array Return array of classes.
*/
function astra_get_secondary_class( $class = '' ) {
// array of class names.
$classes = array();
// default class from widget area.
$classes[] = 'widget-area';
// secondary base class.
$classes[] = 'secondary';
if ( ! empty( $class ) ) {
if ( ! is_array( $class ) ) {
$class = preg_split( '#\s+#', $class );
}
$classes = array_merge( $classes, $class );
} else {
// Ensure that we always coerce class to being an array.
$class = array();
}
// Filter secondary div class names.
$classes = apply_filters( 'astra_secondary_class', $classes, $class );
$classes = array_map( 'sanitize_html_class', $classes );
return array_unique( $classes );
}
}
/**
* Get post format
*/
if ( ! function_exists( 'astra_get_post_format' ) ) {
/**
* Get post format
*
* @param string $post_format_override Override post formate.
* @return string Return post format.
*/
function astra_get_post_format( $post_format_override = '' ) {
if ( ( is_home() ) || is_archive() ) {
$post_format = 'blog';
} else {
$post_format = get_post_format();
}
return apply_filters( 'astra_get_post_format', $post_format, $post_format_override );
}
}
/**
* Wrapper function for get_the_title() for blog post.
*/
if ( ! function_exists( 'astra_the_post_title' ) ) {
/**
* Wrapper function for get_the_title() for blog post.
*
* Displays title only if the page title bar is disabled.
*
* @since 1.0.15
* @param string $before Optional. Content to prepend to the title.
* @param string $after Optional. Content to append to the title.
* @param int $post_id Optional, default to 0. Post id.
* @param bool $echo Optional, default to true.Whether to display or return.
* @return string|void String if $echo parameter is false.
*/
function astra_the_post_title( $before = '', $after = '', $post_id = 0, $echo = true ) {
$enabled = apply_filters( 'astra_the_post_title_enabled', true );
if ( $enabled ) {
$title = astra_get_the_title( $post_id );
$before = apply_filters( 'astra_the_post_title_before', $before );
$after = apply_filters( 'astra_the_post_title_after', $after );
// This will work same as `the_title` function but with Custom Title if exits.
if ( $echo ) {
echo $before . $title . $after; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $before . $title . $after;
}
}
}
}
if ( ! function_exists( 'astra_the_search_page_title' ) ) {
/**
* Function to get the search page custom title.
*
* @param string $before Optional. Content to prepend to the title.
* @param string $after Optional. Content to append to the title.
* @param bool $echo Optional, default to true.Whether to display or return.
*
* @return string Returns search page custom title.
*
* @since 4.8.4
*/
function astra_the_search_page_title( $before = '', $after = '', $echo = false ) {
$title = apply_filters(
'astra_the_search_page_title',
sprintf(
/* translators: 1: search title, 2: search string */
'%1$s %2$s',
astra_get_i18n_option( 'section-search-page-title-custom-title', _x( '%astra%', 'Search Page Title: Heading - Text', 'astra' ) ),
'' . get_search_query() . ' '
)
);
if ( $echo ) {
echo $before . $title . $after; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $before . $title . $after;
}
}
}
/**
* Wrapper function for the_title()
*/
if ( ! function_exists( 'astra_the_title' ) ) {
/**
* Wrapper function for the_title()
*
* Displays title only if the page title bar is disabled.
*
* @param string $before Optional. Content to prepend to the title.
* @param string $after Optional. Content to append to the title.
* @param int $post_id Optional, default to 0. Post id.
* @param bool $echo Optional, default to true.Whether to display or return.
* @return string|void String if $echo parameter is false.
*/
function astra_the_title( $before = '', $after = '', $post_id = 0, $echo = true ) {
$title = '';
$post_type = astra_get_post_type();
$blog_post_title = astra_get_option( 'ast-dynamic-archive-' . $post_type . '-structure', array( 'ast-dynamic-archive-' . $post_type . '-title', 'ast-dynamic-archive-' . $post_type . '-description' ) );
$single_post_title = astra_get_option( 'ast-dynamic-single-' . $post_type . '-structure', 'page' === $post_type ? array( 'ast-dynamic-single-' . $post_type . '-image', 'ast-dynamic-single-' . $post_type . '-title' ) : array( 'ast-dynamic-single-' . $post_type . '-title', 'ast-dynamic-single-' . $post_type . '-meta' ) );
if ( ( ! is_singular() && ( in_array( 'ast-dynamic-archive-' . $post_type . '-title', $blog_post_title ) || in_array( 'ast-dynamic-archive-' . $post_type . '-meta', $blog_post_title ) ) )
|| ( is_singular() && ( in_array( 'ast-dynamic-single-' . $post_type . '-title', $single_post_title ) || in_array( 'ast-dynamic-single-' . $post_type . '-meta', $single_post_title ) ) )
) {
if ( apply_filters( 'astra_the_title_enabled', true ) ) {
$title = astra_get_the_title( $post_id );
$before = apply_filters( 'astra_the_title_before', $before );
$after = apply_filters( 'astra_the_title_after', $after );
$title = $before . $title . $after;
}
}
// This will work same as `the_title` function but with Custom Title if exits.
if ( $echo ) {
echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $title;
}
}
}
/**
* Wrapper function for get_the_title()
*/
if ( ! function_exists( 'astra_get_the_title' ) ) {
/**
* Wrapper function for get_the_title()
*
* Return title for Title Bar and Normal Title.
*
* @param int $post_id Optional, default to 0. Post id.
* @param bool $echo Optional, default to false. Whether to display or return.
* @return string|void String if $echo parameter is false.
*/
function astra_get_the_title( $post_id = 0, $echo = false ) {
$title = '';
if ( $post_id || is_singular() ) {
$title = get_the_title( $post_id );
} else {
if ( is_front_page() && is_home() ) {
// Default homepage.
$title = apply_filters( 'astra_the_default_home_page_title', esc_html__( 'Home', 'astra' ) );
} elseif ( is_home() ) {
// blog page.
$title = apply_filters( 'astra_the_blog_home_page_title', get_the_title( get_option( 'page_for_posts', true ) ) );
} elseif ( is_404() ) {
// for 404 page - title always display.
$title = apply_filters( 'astra_the_404_page_title', esc_html__( 'This page doesn\'t seem to exist.', 'astra' ) );
// for search page - title always display.
} elseif ( is_search() ) {
$title = astra_the_search_page_title();
} elseif ( class_exists( 'WooCommerce' ) && is_shop() ) {
$title = woocommerce_page_title( false );
} elseif ( is_archive() ) {
$title = get_the_archive_title();
}
}
$title = apply_filters( 'astra_the_title', $title, $post_id );
// This will work same as `get_the_title` function but with Custom Title if exits.
if ( $echo ) {
echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $title;
}
}
}
/**
* Don't apply direct new layouts to legacy users.
*
* @since 4.0.0
* @return boolean false if it is an existing user , true if not.
*/
function astra_use_dynamic_blog_layouts() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_dynamic_blog_layouts', isset( $astra_settings['dynamic-blog-layouts'] ) ? $astra_settings['dynamic-blog-layouts'] : true );
}
/**
* Get taxonomy archive banner for layout 1.
*
* @since 4.0.0
*/
function astra_get_taxonomy_banner_legacy_layout() {
$post_type = astra_get_post_type();
$banner_structure = is_search() ? astra_get_option( 'section-search-page-title-structure' ) : astra_get_option( 'ast-dynamic-archive-' . $post_type . '-structure', array( 'ast-dynamic-archive-' . $post_type . '-title', 'ast-dynamic-archive-' . $post_type . '-description' ) );
if ( empty( $banner_structure ) ) {
return;
}
?>
', '', true );
} else {
add_filter( 'get_the_archive_title_prefix', '__return_empty_string' );
the_archive_title( '', ' ' );
remove_filter( 'get_the_archive_title_prefix', '__return_empty_string' );
}
do_action( 'astra_after_archive_title' );
break;
case 'archive-breadcrumb':
if ( ! is_author() ) {
do_action( 'astra_before_archive_breadcrumb' );
echo astra_get_breadcrumb(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
do_action( 'astra_after_archive_breadcrumb' );
}
break;
case 'archive-description':
do_action( 'astra_before_archive_description' );
if ( is_search() ) {
$title = have_posts()
? astra_get_i18n_option( 'section-search-page-title-found-custom-description', _x( '%astra%', 'Search Page Custom `When Results Found` Text', 'astra' ) )
: astra_get_i18n_option( 'section-search-page-title-not-found-custom-description', _x( '%astra%', 'Search Page Custom `When Results Not Found` Text', 'astra' ) );
echo wp_kses_post( wpautop( $title ) );
} else {
echo wp_kses_post( wpautop( get_the_archive_description() ) );
}
do_action( 'astra_after_archive_description' );
break;
}
}
?>
hexdec( substr( $hex, 0, 2 ) ),
'g' => hexdec( substr( $hex, 2, 2 ) ),
'b' => hexdec( substr( $hex, 4, 2 ) ),
);
// Should we darken the color?
if ( 'reverse' == $type && $shortcode_atts['r'] + $shortcode_atts['g'] + $shortcode_atts['b'] > 382 ) {
$steps = -$steps;
} elseif ( 'darken' == $type ) {
$steps = -$steps;
}
// Build the new color.
$steps = max( -255, min( 255, $steps ) );
$shortcode_atts['r'] = max( 0, min( 255, $shortcode_atts['r'] + $steps ) );
$shortcode_atts['g'] = max( 0, min( 255, $shortcode_atts['g'] + $steps ) );
$shortcode_atts['b'] = max( 0, min( 255, $shortcode_atts['b'] + $steps ) );
$r_hex = str_pad( dechex( $shortcode_atts['r'] ), 2, '0', STR_PAD_LEFT );
$g_hex = str_pad( dechex( $shortcode_atts['g'] ), 2, '0', STR_PAD_LEFT );
$b_hex = str_pad( dechex( $shortcode_atts['b'] ), 2, '0', STR_PAD_LEFT );
return '#' . $r_hex . $g_hex . $b_hex;
}
} // End if.
/**
* Convert colors from HEX to RGBA
*/
if ( ! function_exists( 'astra_hex_to_rgba' ) ) :
/**
* Convert colors from HEX to RGBA
*
* @param string $color Color code in HEX.
* @param mixed $opacity Color code opacity.
* @return string Color code in RGB or RGBA.
*/
function astra_hex_to_rgba( $color, $opacity = false ) {
$default = 'rgb(0,0,0)';
// Return default if no color provided.
if ( empty( $color ) ) {
return $default;
}
// Sanitize $color if "#" is provided.
if ( '#' == $color[0] ) {
$color = substr( $color, 1 );
}
// Check if color has 6 or 3 characters and get values.
if ( 6 == strlen( $color ) ) {
$hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
} elseif ( 3 == strlen( $color ) ) {
$hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
} else {
return $default;
}
// Convert HEX to RGB.
$rgb = array_map( 'hexdec', $hex );
// Check if opacity is set(RGBA or RGB).
if ( $opacity ) {
if ( 1 < abs( $opacity ) ) {
$opacity = 1.0;
}
$output = 'rgba(' . implode( ',', $rgb ) . ',' . $opacity . ')';
} else {
$output = 'rgb(' . implode( ',', $rgb ) . ')';
}
// Return RGB(a) color string.
return $output;
}
endif;
if ( ! function_exists( 'astra_enable_page_builder_compatibility' ) ) :
/**
* Allow filter to enable/disable page builder compatibility.
*
* @see https://wpastra.com/docs/recommended-settings-beaver-builder-astra/
* @see https://wpastra.com/docs/recommended-settings-for-elementor/
*
* @since 1.2.2
* @return bool True - If the page builder compatibility is enabled. False - IF the page builder compatibility is disabled.
*/
function astra_enable_page_builder_compatibility() {
return apply_filters( 'astra_enable_page_builder_compatibility', true );
}
endif;
if ( ! function_exists( 'astra_get_pro_url' ) ) :
/**
* Returns an URL with utm tags
* the admin settings page.
*
* @param string $path Path for the Website URL.
* @param string $source UMM source.
* @param string $medium UTM medium.
* @param string $campaign UTM campaign.
* @return mixed
*/
function astra_get_pro_url( $path, $source = '', $medium = '', $campaign = '' ) {
$url = esc_url( ASTRA_WEBSITE_BASE_URL . $path );
$astra_pro_url = trailingslashit( $url );
// Set up our URL if we have a source.
if ( ! empty( $source ) ) {
$astra_pro_url = add_query_arg( 'utm_source', sanitize_text_field( $source ), $astra_pro_url );
}
// Modify the utm_source parameter using the UTM ready link function to include tracking information.
if ( is_callable( '\BSF_UTM_Analytics\Inc\Utils::get_utm_ready_link' ) ) {
$astra_pro_url = \BSF_UTM_Analytics\Inc\Utils::get_utm_ready_link( $astra_pro_url, 'astra' );
}
// Set up our URL if we have a medium.
if ( ! empty( $medium ) ) {
$astra_pro_url = add_query_arg( 'utm_medium', sanitize_text_field( $medium ), $astra_pro_url );
}
// Set up our URL if we have a campaign.
if ( ! empty( $campaign ) ) {
$astra_pro_url = add_query_arg( 'utm_campaign', sanitize_text_field( $campaign ), $astra_pro_url );
}
$astra_pro_url = apply_filters( 'astra_get_pro_url', $astra_pro_url, $url );
$astra_pro_url = remove_query_arg( 'bsf', $astra_pro_url );
$ref = get_option( 'astra_partner_url_param', '' );
if ( ! empty( $ref ) ) {
$astra_pro_url = add_query_arg( 'bsf', sanitize_text_field( $ref ), $astra_pro_url );
}
return $astra_pro_url;
}
endif;
/**
* Search Form
*/
if ( ! function_exists( 'astra_get_search_form' ) ) :
/**
* Display search form.
*
* @param bool $echo Default to echo and not return the form.
* @return string|void String when $echo is false.
*/
function astra_get_search_form( $echo = true ) {
$form = get_search_form(
array(
'input_placeholder' => apply_filters( 'astra_search_field_placeholder', esc_attr_x( 'Search...', 'placeholder', 'astra' ) ),
'data_attributes' => apply_filters( 'astra_search_field_toggle_data_attrs', '' ),
'input_value' => get_search_query(),
'show_input_submit' => false,
)
);
/**
* Filters the HTML output of the search form.
*
* @param string $form The search form HTML output.
*/
$result = apply_filters( 'astra_get_search_form', $form );
if ( null === $result ) {
$result = $form;
}
if ( $echo ) {
echo $result; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $result;
}
}
endif;
/**
* Check if we're being delivered AMP
*
* @return bool
*/
function astra_is_amp_endpoint() {
return function_exists( 'is_amp_endpoint' ) && is_amp_endpoint();
}
/*
* Get Responsive Spacing
*/
if ( ! function_exists( 'astra_responsive_spacing' ) ) {
/**
* Get Spacing value
*
* @param array $option CSS value.
* @param string $side top | bottom | left | right.
* @param string $device CSS device.
* @param string $default Default value.
* @param string $prefix Prefix value.
* @return mixed
*/
function astra_responsive_spacing( $option, $side = '', $device = 'desktop', $default = '', $prefix = '' ) {
if ( isset( $option[ $device ][ $side ] ) && isset( $option[ $device . '-unit' ] ) ) {
$spacing = astra_get_css_value( $option[ $device ][ $side ], $option[ $device . '-unit' ], $default );
} elseif ( is_numeric( $option ) ) {
$spacing = astra_get_css_value( $option );
} else {
$spacing = ( ! is_array( $option ) ) ? $option : '';
}
if ( '' !== $prefix && '' !== $spacing ) {
return $prefix . $spacing;
}
return $spacing;
}
}
/**
* Get the tablet breakpoint value.
*
* @param mixed $min min.
* @param mixed $max max.
*
* @since 2.4.0
*
* @return number $breakpoint.
*/
function astra_get_tablet_breakpoint( $min = '', $max = '' ) {
$update_breakpoint = astra_get_option( 'can-update-theme-tablet-breakpoint', true );
// Change default for new users.
$default = ( true === $update_breakpoint ) ? 921 : 768;
$header_breakpoint = apply_filters( 'astra_tablet_breakpoint', $default );
if ( '' !== $min ) {
$header_breakpoint = $header_breakpoint - $min;
} elseif ( '' !== $max ) {
$header_breakpoint = $header_breakpoint + $max;
}
return absint( $header_breakpoint );
}
/**
* Get the mobile breakpoint value.
*
* @param mixed $min min.
* @param mixed $max max.
*
* @since 2.4.0
*
* @return number header_breakpoint.
*/
function astra_get_mobile_breakpoint( $min = '', $max = '' ) {
$header_breakpoint = apply_filters( 'astra_mobile_breakpoint', 544 );
if ( '' !== $min ) {
$header_breakpoint = $header_breakpoint - $min;
} elseif ( '' !== $max ) {
$header_breakpoint = $header_breakpoint + $max;
}
return absint( $header_breakpoint );
}
/*
* Apply CSS for the element
*/
if ( ! function_exists( 'astra_color_responsive_css' ) ) {
/**
* Astra Responsive Colors
*
* @param array $setting Responsive colors.
* @param string $css_property CSS property.
* @param string $selector CSS selector.
* @return string Dynamic responsive CSS.
*/
function astra_color_responsive_css( $setting, $css_property, $selector ) {
$css = '';
if ( isset( $setting['desktop'] ) && ! empty( $setting['desktop'] ) ) {
$css .= $selector . '{' . $css_property . ':' . esc_attr( $setting['desktop'] ) . ';}';
}
if ( isset( $setting['tablet'] ) && ! empty( $setting['tablet'] ) ) {
$css .= '@media (max-width:' . astra_get_tablet_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['tablet'] ) . ';} }';
}
if ( isset( $setting['mobile'] ) && ! empty( $setting['mobile'] ) ) {
$css .= '@media (max-width:' . astra_get_mobile_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['mobile'] ) . ';} }';
}
return $css;
}
}
if ( ! function_exists( 'astra_check_is_bb_themer_layout' ) ) :
/**
* Check if layout is bb themer's layout
*/
function astra_check_is_bb_themer_layout() {
$is_layout = false;
$post_type = get_post_type();
$post_id = get_the_ID();
if ( 'fl-theme-layout' === $post_type && $post_id ) {
$is_layout = true;
}
return $is_layout;
}
endif;
if ( ! function_exists( 'astra_is_white_labelled' ) ) :
/**
* Check if white label option is enabled in astra pro plugin
*/
function astra_is_white_labelled() {
if ( is_callable( 'Astra_Ext_White_Label_Markup::show_branding' ) && ! Astra_Ext_White_Label_Markup::show_branding() ) {
return apply_filters( 'astra_is_white_labelled', true );
}
return apply_filters( 'astra_is_white_labelled', false );
}
endif;
/**
* Get the value for font-display property.
*
* @since 1.8.6
* @return string
*/
function astra_get_fonts_display_property() {
return apply_filters( 'astra_fonts_display_property', 'fallback' );
}
/**
* Generate Responsive Background Color CSS.
*
* @param array $bg_obj_res array of background object.
* @param string $device CSS for which device.
* @return array
*/
function astra_get_responsive_background_obj( $bg_obj_res, $device ) {
$gen_bg_css = array();
if ( ! is_array( $bg_obj_res ) ) {
return;
}
$bg_obj = $bg_obj_res[ $device ];
$bg_img = isset( $bg_obj['background-image'] ) ? $bg_obj['background-image'] : '';
$bg_tab_img = isset( $bg_obj_res['tablet']['background-image'] ) ? $bg_obj_res['tablet']['background-image'] : '';
$bg_desk_img = isset( $bg_obj_res['desktop']['background-image'] ) ? $bg_obj_res['desktop']['background-image'] : '';
$bg_color = isset( $bg_obj['background-color'] ) ? $bg_obj['background-color'] : '';
$tablet_css = ( isset( $bg_obj_res['tablet']['background-image'] ) && $bg_obj_res['tablet']['background-image'] ) ? true : false;
$desktop_css = ( isset( $bg_obj_res['desktop']['background-image'] ) && $bg_obj_res['desktop']['background-image'] ) ? true : false;
$bg_type = ( isset( $bg_obj['background-type'] ) && $bg_obj['background-type'] ) ? $bg_obj['background-type'] : '';
if ( '' !== $bg_type ) {
switch ( $bg_type ) {
case 'color':
if ( '' !== $bg_img && '' !== $bg_color ) {
$gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ')';
} elseif ( 'mobile' === $device ) {
if ( $desktop_css ) {
$gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_desk_img . ')';
} elseif ( $tablet_css ) {
$gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_tab_img . ')';
} else {
if ( '' !== $bg_color ) {
$gen_bg_css['background-color'] = $bg_color;
$gen_bg_css['background-image'] = 'none';
}
}
} elseif ( 'tablet' === $device ) {
if ( $desktop_css ) {
$gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_desk_img . ')';
} else {
if ( '' !== $bg_color ) {
$gen_bg_css['background-color'] = $bg_color;
$gen_bg_css['background-image'] = 'none';
}
}
} elseif ( '' === $bg_img ) {
$gen_bg_css['background-color'] = $bg_color;
$gen_bg_css['background-image'] = 'none';
}
break;
case 'image':
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$overlay_type = isset( $bg_obj['overlay-type'] ) ? $bg_obj['overlay-type'] : 'none';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$overlay_color = isset( $bg_obj['overlay-color'] ) ? $bg_obj['overlay-color'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$overlay_grad = isset( $bg_obj['overlay-gradient'] ) ? $bg_obj['overlay-gradient'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$overlay_opacity = isset( $bg_obj['overlay-opacity'] ) ? $bg_obj['overlay-opacity'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( '' !== $bg_img ) {
if ( 'none' !== $overlay_type ) {
if ( 'classic' === $overlay_type && '' !== $overlay_color ) {
$updated_overlay_color = $overlay_color;
// Compatibility of overlay color opacity to HEX & VAR colors.
if ( '' !== $overlay_opacity ) {
$is_linked_with_gcp = 'var' === substr( $overlay_color, 0, 3 );
if ( $is_linked_with_gcp ) {
$astra_gcp_instance = new Astra_Global_Palette();
$updated_overlay_color = $astra_gcp_instance->get_color_by_palette_variable( $overlay_color );
}
if ( '#' === $updated_overlay_color[0] ) {
$updated_overlay_color = astra_hex_to_rgba( $updated_overlay_color, $overlay_opacity );
}
}
$gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $updated_overlay_color . ', ' . $updated_overlay_color . '), url(' . $bg_img . ')';
} elseif ( 'gradient' === $overlay_type && '' !== $overlay_grad ) {
$gen_bg_css['background-image'] = $overlay_grad . ', url(' . $bg_img . ')';
} else {
$gen_bg_css['background-image'] = 'url(' . $bg_img . ')';
}
} else {
$gen_bg_css['background-image'] = 'url(' . $bg_img . ')';
}
}
break;
case 'gradient':
if ( isset( $bg_color ) ) {
$gen_bg_css['background-image'] = $bg_color;
}
break;
default:
break;
}
} elseif ( '' !== $bg_color ) {
$gen_bg_css['background-color'] = $bg_color;
}
if ( '' !== $bg_img ) {
if ( isset( $bg_obj['background-repeat'] ) ) {
$gen_bg_css['background-repeat'] = esc_attr( $bg_obj['background-repeat'] );
}
if ( isset( $bg_obj['background-position'] ) ) {
$gen_bg_css['background-position'] = esc_attr( $bg_obj['background-position'] );
}
if ( isset( $bg_obj['background-size'] ) ) {
$gen_bg_css['background-size'] = esc_attr( $bg_obj['background-size'] );
}
if ( isset( $bg_obj['background-attachment'] ) ) {
$gen_bg_css['background-attachment'] = esc_attr( $bg_obj['background-attachment'] );
}
}
return $gen_bg_css;
}
/**
* Common function to check is pagination is enabled on current page.
*
* @since 3.0.1
* @return boolean
*/
function astra_check_pagination_enabled() {
global $wp_query;
return ( $wp_query->max_num_pages > 1 && apply_filters( 'astra_pagination_enabled', true ) );
}
/**
* Verify is current post comments are enabled or not for applying dynamic CSS.
*
* @since 3.0.1
* @return boolean
*/
function astra_check_current_post_comment_enabled() {
return ( is_singular() && comments_open() );
}
/**
* Dont apply zero size to existing user.
*
* @since 3.6.9
* @return boolean false if it is an existing user , true if not.
*/
function astra_zero_font_size_case() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_zero_font_size_case', isset( $astra_settings['astra-zero-font-size-case-css'] ) ? false : true );
}
/**
* Check the WordPress version.
*
* @since 2.5.4
* @param string $version WordPress version to compare with the current version.
* @param mixed $compare Comparison value i.e > or < etc.
* @return bool|null True/False based on the $version and $compare value.
*/
function astra_wp_version_compare( $version, $compare ) {
return version_compare( get_bloginfo( 'version' ), $version, $compare );
}
/**
* Check if existing setup is live with old block editor compatibilities.
*
* @return bool true|false.
*/
function astra_block_based_legacy_setup() {
$astra_settings = astra_get_options();
return ( isset( $astra_settings['blocks-legacy-setup'] ) && isset( $astra_settings['wp-blocks-ui'] ) && 'legacy' === $astra_settings['wp-blocks-ui'] ) ? true : false;
}
/**
* Check is new structural things are updated.
*
* @return bool true|false.
*/
function astra_check_is_structural_setup() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_customizer-default-layout-update', isset( $astra_settings['customizer-default-layout-update'] ) ? false : true ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
/**
* Check if the user is old sidebar user.
*
* @since 3.9.4
* @return bool true|false.
*/
function astra_check_old_sidebar_user() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_old_global_sidebar_defaults', isset( $astra_settings['astra-old-global-sidebar-default'] ) ? false : true );
}
/**
* Check if user is old for hiding/showing password icon field for login my-account form.
*
* @since 3.9.2
* @return bool true|false.
*/
function astra_load_woocommerce_login_form_password_icon() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_woo-show-password-icon', isset( $astra_settings['woo-show-password-icon'] ) ? false : true ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
/**
* Function to add narrow width properties in the frontend.
*
* @since 4.0.0
* @param string $location container layout for single-post, archives, pages, page meta.
* @param string $narrow_container_max_width dynamic container width in px.
* @return string Parsed CSS based on $location and $narrow_container_max_width.
*/
function astra_narrow_container_width( $location, $narrow_container_max_width ) {
if ( 'narrow-container' === $location ) {
$narrow_container_css = array(
'.ast-narrow-container .site-content > .ast-container' => array(
'max-width' => astra_get_css_value( $narrow_container_max_width, 'px' ),
),
);
// Remove Sidebar for Narrow Width Container Layout.
if ( 'narrow-container' === astra_get_content_layout() ) {
add_filter(
'astra_page_layout',
function() { // phpcs:ignore PHPCompatibility.FunctionDeclarations.NewClosure.Found
return 'no-sidebar';
}
);
}
return astra_parse_css( $narrow_container_css, astra_get_tablet_breakpoint( '', 1 ) );
} else {
return '';
}
}
/**
* Function which will return the Sidebar Layout to determine default body classes for Editor.
*
* @since 4.2.0
* @param string $post_type Post Type.
* @return string Sidebar Layout.
*/
function astra_get_sidebar_layout_for_editor( $post_type ) {
$sidebar_layout = astra_get_option( 'single-' . $post_type . '-sidebar-layout' );
if ( 'default' === $sidebar_layout ) {
$sidebar_layout = astra_get_option( 'site-sidebar-layout' );
}
return $sidebar_layout;
}
/**
* Gets the SVG for the duotone filter definition.
*
* @since 4.2.2
*
* @param string $filter_id The ID of the filter.
* @param array $color An array of color strings.
* @return string An SVG with a duotone filter definition.
*/
function astra_get_filter_svg( $filter_id, $color ) {
$duotone_values = array(
'r' => array(),
'g' => array(),
'b' => array(),
'a' => array(),
);
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$duotone_values['r'][] = $color['r'] / 255;
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$duotone_values['g'][] = $color['g'] / 255;
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$duotone_values['b'][] = $color['b'] / 255;
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$duotone_values['a'][] = $color['a'];
ob_start();
?>
<', '><', $svg );
$svg = trim( $svg );
return $svg;
}
/**
* Converts HEX to RGB.
*
* @since 4.2.2
*
* @param string $hex Hex color.
* @return array split version of rgb.
*/
function astra_hex_to_rgb( $hex ) {
// @codingStandardsIgnoreStart
/**
* @psalm-suppress PossiblyNullArrayAccess
*/
list($r, $g, $b) = sscanf( $hex, '#%02x%02x%02x' );
// @codingStandardsIgnoreEnd
return array(
'r' => $r,
'g' => $g,
'b' => $b,
'a' => 1,
);
}
/**
* Converts RGBA to split array RGBA.
*
* @since 4.2.2
*
* @param string $rgba RGBA value.
* @return array split version of rgba.
*/
function astra_split_rgba( $rgba ) {
// Remove the "rgba(" and ")" from the input string.
$rgba = str_replace( array( 'rgba(', ')' ), '', $rgba );
// Split the RGBA values by comma.
$values = explode( ',', $rgba );
// Convert each value from string to integer.
$r = intval( $values[0] );
$g = intval( $values[1] );
$b = intval( $values[2] );
$a = floatval( $values[3] );
// Create the split RGBA string.
return array(
'r' => $r,
'g' => $g,
'b' => $b,
'a' => $a,
);
}
/**
* Render svg mask.
*
* @since 4.2.2
*
* @param string $id id.
* @param string $filter_name filter name.
* @param string $color color.
* @return mixed masked svg,
*/
function astra_render_svg_mask( $id, $filter_name, $color ) {
if ( 0 === strpos( $color, 'var(--' ) ) {
$agp = new Astra_Global_Palette();
/** @psalm-suppress UndefinedFunction */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$svg_color = astra_hex_to_rgb( $agp->get_color_by_palette_variable( $color ) );
} elseif ( preg_match( '/^#[a-f0-9]{6}$/i', $color ) ) {
/** @psalm-suppress UndefinedFunction */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$svg_color = astra_hex_to_rgb( $color );
} else {
/** @psalm-suppress UndefinedFunction */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$svg_color = astra_split_rgba( $color );
}
/** @psalm-suppress UndefinedFunction */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
echo astra_get_filter_svg( $id, apply_filters( 'astra_' . $filter_name, $svg_color ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Returns an array of logo svg icons.
*
* @return array
* @since 4.7.0
*/
function astra_get_logo_svg_icons_array() {
static $ast_all_svg_icons = array();
if ( $ast_all_svg_icons ) {
return $ast_all_svg_icons;
}
$icons_dir = ASTRA_THEME_DIR . 'assets/svg/logo-svg-icons';
for ( $i = 0; $i < 4; $i++ ) {
$file = "{$icons_dir}/icons-v6-{$i}.php";
if ( file_exists( $file ) ) {
$icons = include_once $file;
foreach ( $icons as &$icon ) {
$fallback = isset( $icon['svg']['solid'] ) ? $icon['svg']['solid'] : array();
$icon_brand_or_solid = isset( $icon['svg']['brands'] ) ? $icon['svg']['brands'] : $fallback;
$path = isset( $icon_brand_or_solid['path'] ) ? $icon_brand_or_solid['path'] : '';
$width = isset( $icon_brand_or_solid['width'] ) ? $icon_brand_or_solid['width'] : '';
$height = isset( $icon_brand_or_solid['height'] ) ? $icon_brand_or_solid['height'] : '';
$view = (bool) $width && (bool) $height ? "0 0 {$width} {$height}" : null;
if ( $path && $view ) {
ob_start();
?>
taxonomy ?? '';
$post_types = get_post_types();
// Loop through all post types to see which ones support the current taxonomy.
foreach ( $post_types as $type ) {
if ( in_array( $taxonomy, get_object_taxonomies( $type ) ) ) {
// If a custom post type matches the taxonomy, assign it.
$post_type = $type;
break;
}
}
}
}
/**
* Filter the detected post type before returning.
*
* @param string $post_type The detected post type.
*/
return apply_filters( 'astra_get_post_type', strval( $post_type ) );
}
/**
* Get Astra's upgrade URL based on org or woo package version.
*
* @param string $type Type of upgrade URL.
* @since 4.8.4
* @return string Upgrade URL.
*/
function astra_get_upgrade_url( $type = 'pro' ) {
/** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( ! ASTRA_THEME_ORG_VERSION ) {
/** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
return 'https://woo.com/products/astra-pro/';
}
switch ( $type ) {
case 'pricing':
$upgrade_url = astra_get_pro_url( '/pricing/', 'free-theme', 'customizer', 'main-cta' );
break;
case 'dashboard':
$upgrade_url = astra_get_pro_url( '/pricing/', 'free-theme', 'dashboard', 'upgrade' );
break;
case 'customizer':
$upgrade_url = astra_get_pro_url( '/pricing/', 'free-theme', 'dashboard', 'upgrade' );
break;
default:
$upgrade_url = astra_get_pro_url( '/pro/', 'free-theme', 'dashboard', 'upgrade-now' );
break;
}
return $upgrade_url;
}
PK ZXi ! deprecated/deprecated-filters.phpnu [ = 4.6 */
return apply_filters_deprecated( $tag, $args, $version, $replacement, $message );
} else {
return apply_filters_ref_array( $tag, $args ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound
}
}
}
// Deprecating ast_footer_bar_display filter.
add_filter( 'astra_footer_bar_display', 'astra_deprecated_ast_footer_bar_display_filter', 10, 1 );
/**
* Display footer builder markup.
*
* @since 3.7.4
* @param boolean $display_footer true | false.
* @return boolean true for enabled | false for disable.
*/
function astra_deprecated_ast_footer_bar_display_filter( $display_footer ) {
return astra_apply_filters_deprecated( 'ast_footer_bar_display', array( $display_footer ), '3.7.4', 'astra_footer_bar_display', '' );
}
// Deprecating ast_main_header_display filter.
add_filter( 'astra_main_header_display', 'astra_deprecated_ast_main_header_display_filter', 10, 1 );
/**
* Display header builder markup.
*
* @since 3.7.4
* @param boolean $display_header true | false.
* @return boolean true for enabled | false for disable.
*/
function astra_deprecated_ast_main_header_display_filter( $display_header ) {
return astra_apply_filters_deprecated( 'ast_main_header_display', array( $display_header ), '3.7.4', 'astra_main_header_display', '' );
}
// Deprecating secondary_submenu_border_class filter.
add_filter( 'astra_secondary_submenu_border_class', 'astra_deprecated_secondary_submenu_border_class_filter', 10, 1 );
/**
* Border class to secondary submenu
*
* @since 3.7.4
* @param string $class_selector custom class assigned to secondary submenu.
* @return string $class_selector updated class selector.
*/
function astra_deprecated_secondary_submenu_border_class_filter( $class_selector ) {
$class_selector = astra_apply_filters_deprecated( 'secondary_submenu_border_class', array( $class_selector ), '3.7.4', 'astra_secondary_submenu_border_class', '' );
return $class_selector;
}
// Deprecating gtn_image_group_css_comp filter.
add_filter( 'astra_gutenberg_image_group_style_support', 'astra_deprecated_gtn_image_group_css_comp_filter', 10, 1 );
/**
* Image, group compatibility support released in v2.4.4.
*
* @since 3.7.4
* @param boolean $block_support true | false.
* @return boolean true for enabled | false for disable.
*/
function astra_deprecated_gtn_image_group_css_comp_filter( $block_support ) {
return astra_apply_filters_deprecated( 'gtn_image_group_css_comp', array( $block_support ), '3.7.4', 'astra_gutenberg_image_group_style_support', '' );
}
// Deprecating ast_footer_sml_layout filter.
add_filter( 'astra_footer_sml_layout', 'astra_deprecated_ast_footer_sml_layout_filter', 10, 1 );
/**
* Footer bar meta setting option.
*
* @since 3.7.4
* @param boolean $display_footer_bar true | false.
* @return boolean true for enabled | false for disable.
*/
function astra_deprecated_ast_footer_sml_layout_filter( $display_footer_bar ) {
return astra_apply_filters_deprecated( 'ast_footer_sml_layout', array( $display_footer_bar ), '3.7.4', 'astra_footer_sml_layout', '' );
}
// Deprecating primary_submenu_border_class filter.
add_filter( 'astra_primary_submenu_border_class', 'astra_deprecated_primary_submenu_border_class_filter', 10, 1 );
/**
* Border class to primary submenu
*
* @since 3.7.4
* @param string $class_selector custom class assigned to primary submenu.
* @return string $class_selector updated class selector.
*/
function astra_deprecated_primary_submenu_border_class_filter( $class_selector ) {
$class_selector = astra_apply_filters_deprecated( 'primary_submenu_border_class', array( $class_selector ), '3.7.4', 'astra_primary_submenu_border_class', '' );
return $class_selector;
}
// Deprecating astra_single_banner_post_meta filter.
add_filter( 'astra_single_post_meta', 'astra_deprecated_astra_single_banner_post_meta_filter', 10, 1 );
/**
* Single meta markup filter.
*
* @since 4.0.2
* @param string $meta_markup Markup of meta.
* @return string $meta_markup Markup of meta.
*/
function astra_deprecated_astra_single_banner_post_meta_filter( $meta_markup ) {
$meta_markup = astra_apply_filters_deprecated( 'astra_single_banner_post_meta', array( $meta_markup ), '4.0.2', 'astra_single_post_meta', '' );
return $meta_markup;
}
// Deprecating astra_get_option_dynamic-blog-layouts filter.
add_filter( 'astra_get_option_dynamic_blog_layouts', 'astra_deprecated_astra_get_option_dynamic_blog_layouts_filter', 10, 1 );
/**
* Don't apply direct new layouts to legacy users.
*
* @since 4.1.0
* @param string $dynamic_blog_layout false if it is an existing user , true if not.
* @return boolean $dynamic_blog_layout false if it is an existing user , true if not.
*/
function astra_deprecated_astra_get_option_dynamic_blog_layouts_filter( $dynamic_blog_layout ) {
$dynamic_blog_layout = astra_apply_filters_deprecated( 'astra_get_option_dynamic-blog-layouts', array( $dynamic_blog_layout ), '4.1.0', 'astra_get_option_dynamic_blog_layouts', '' );
return $dynamic_blog_layout;
}
PK Zγ5` ` deprecated/deprecated-hooks.phpnu [ = 4.6 */
do_action_deprecated( $tag, $args, $version, $replacement, $message );
} else {
do_action_ref_array( $tag, $args ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound
}
}
}
// Depreciating asta_register_admin_menu hook.
add_action( 'astra_register_admin_menu', 'astra_deprecated_asta_register_admin_menu_hook', 10, 5 );
/**
* Depreciating 'asta_register_admin_menu' action & replacing with 'astra_register_admin_menu'.
*
* @param string $parent_page Admin menu page.
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $page_menu_slug The slug name to refer to this menu by (should be unique for this menu).
* @param callable $page_menu_func The function to be called to output the content for this page.
*
* @since 3.7.4
*/
function astra_deprecated_asta_register_admin_menu_hook( $parent_page, $page_title, $capability, $page_menu_slug, $page_menu_func ) {
astra_do_action_deprecated( 'asta_register_admin_menu', array( $parent_page, $page_title, $capability, $page_menu_slug, $page_menu_func ), '3.7.4', 'astra_register_admin_menu' );
}
/**
* Actions which are deprecated in admin redesign phase.
*
* @since 4.0.0
*/
function astra_show_deprecated_admin_hooks_warnings() {
global $pagenow;
$screen = get_current_screen();
if ( 'admin.php' === $pagenow && is_object( $screen ) && 'toplevel_page_' . Astra_Menu::get_theme_page_slug() === $screen->id ) {
astra_do_action_deprecated( 'astra_welcome_page_content_before', array(), '4.0.0' );
astra_do_action_deprecated( 'astra_welcome_page_content', array(), '4.0.0' );
astra_do_action_deprecated( 'astra_welcome_page_content_after', array(), '4.0.0' );
astra_do_action_deprecated( 'astra_welcome_page_right_sidebar_before', array(), '4.0.0' );
astra_do_action_deprecated( 'astra_welcome_page_right_sidebar_content', array(), '4.0.0' );
astra_do_action_deprecated( 'astra_welcome_page_right_sidebar_after', array(), '4.0.0' );
astra_do_action_deprecated( 'astra_single_post_order_before', array(), '4.0.0' );
astra_do_action_deprecated( 'astra_single_post_title_before', array(), '4.0.0' );
astra_do_action_deprecated( 'astra_single_post_title_after', array(), '4.0.0' );
astra_do_action_deprecated( 'astra_single_post_meta_before', array(), '4.0.0' );
astra_do_action_deprecated( 'astra_single_post_meta_after', array(), '4.0.0' );
astra_do_action_deprecated( 'astra_single_post_order_after', array(), '4.0.0' );
}
}
// Depreciating legacy admin hooks.
add_action( 'admin_notices', 'astra_show_deprecated_admin_hooks_warnings', 999 );
PK Z^t # deprecated/deprecated-functions.phpnu [ astra_parse_attr( $context, $attributes, $args );
$output = '';
// Cycle through attributes, build tag attribute string.
foreach ( $attributes as $key => $value ) {
if ( ! $value ) {
continue;
}
if ( true === $value ) {
$output .= esc_html( $key ) . ' ';
} else {
$output .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
}
}
$output = apply_filters( "astra_attr_{$context}_output", $output, $attributes, $context, $args );
return trim( $output );
}
/**
* Merge array of attributes with defaults, and apply contextual filter on array.
*
* The contextual filter is of the form `astra_attr_{context}`.
*
* @since 1.6.2
*
* @param string $context The context, to build filter name.
* @param array $attributes Optional. Extra attributes to merge with defaults.
* @param array $args Optional. Custom data to pass to filter.
* @return array Merged and filtered attributes.
*/
public function astra_parse_attr( $context, $attributes = array(), $args = array() ) {
$defaults = array(
'class' => sanitize_html_class( $context ),
);
$attributes = wp_parse_args( $attributes, $defaults );
// Contextual filter.
return apply_filters( "astra_attr_{$context}", $attributes, $context, $args );
}
}
endif;
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Attr::get_instance();
PK Z'>; ; class-gutenberg-editor-css.phpnu [ array(
'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 6.25, '%' ),
),
':root' => Astra_Global_Palette::generate_global_palette_style(),
'.block-editor-writing-flow a' => array(
'color' => esc_attr( $link_color ),
),
// Global selection CSS.
'.block-editor-block-list__layout .block-editor-block-list__block ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit:before' => array(
'background-color' => esc_attr( $theme_color ),
),
'.block-editor-block-list__layout .block-editor-block-list__block ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit' => array(
'color' => esc_attr( $selection_text_color ),
),
'.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'desktop' ),
'.editor-post-title__block .editor-post-title__input, .edit-post-visual-editor .block-editor-block-list__block h1, .edit-post-visual-editor .block-editor-block-list__block h2, .edit-post-visual-editor .block-editor-block-list__block h3, .edit-post-visual-editor .block-editor-block-list__block h4, .edit-post-visual-editor .block-editor-block-list__block h5, .edit-post-visual-editor .block-editor-block-list__block h6, .edit-post-visual-editor h1, .edit-post-visual-editor h2, .edit-post-visual-editor h3, .edit-post-visual-editor h4, .edit-post-visual-editor h5, .edit-post-visual-editor h6' => array(
'font-family' => astra_get_css_value( $headings_font_family, 'font' ),
'font-weight' => astra_get_css_value( $headings_font_weight, 'font' ),
'text-transform' => esc_attr( $headings_text_transform ),
),
'.edit-post-visual-editor h1, .edit-post-visual-editor h2, .edit-post-visual-editor h3, .edit-post-visual-editor h4, .edit-post-visual-editor h5, .edit-post-visual-editor h6' => array(
'line-height' => esc_attr( $headings_line_height ),
),
'.edit-post-visual-editor.editor-styles-wrapper p,.block-editor-block-list__block p, .block-editor-block-list__layout, .editor-post-title' => array(
'font-size' => astra_responsive_font( $body_font_size, 'desktop' ),
),
'.edit-post-visual-editor.editor-styles-wrapper p,.block-editor-block-list__block p, .wp-block-latest-posts a,.editor-default-block-appender textarea.editor-default-block-appender__content, .block-editor-block-list__block, .block-editor-block-list__block h1, .block-editor-block-list__block h2, .block-editor-block-list__block h3, .block-editor-block-list__block h4, .block-editor-block-list__block h5, .block-editor-block-list__block h6, .edit-post-visual-editor .editor-styles-wrapper' => array(
'font-family' => astra_get_font_family( $body_font_family ),
'font-weight' => esc_attr( $body_font_weight ),
'font-size' => astra_responsive_font( $body_font_size, 'desktop' ),
'line-height' => esc_attr( $body_line_height ),
'text-transform' => esc_attr( $body_text_transform ),
'margin-bottom' => astra_get_css_value( $para_margin_bottom, 'em' ),
),
'.editor-post-title__block .editor-post-title__input' => array(
'font-family' => ( 'inherit' === $headings_font_family ) ? astra_get_font_family( $body_font_family ) : astra_get_font_family( $headings_font_family ),
'font-weight' => 'normal',
),
'.block-editor-block-list__block' => array(
'color' => esc_attr( $text_color ),
),
/**
* Content base heading color.
*/
'.editor-post-title__block .editor-post-title__input, .wc-block-grid__product-title, .editor-styles-wrapper .block-editor-block-list__block h1, .editor-styles-wrapper .block-editor-block-list__block h2, .editor-styles-wrapper .block-editor-block-list__block h3, .editor-styles-wrapper .block-editor-block-list__block h4, .editor-styles-wrapper .block-editor-block-list__block h5, .editor-styles-wrapper .block-editor-block-list__block h6, .editor-styles-wrapper .wp-block-heading, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6,.editor-styles-wrapper h1.block-editor-block-list__block, .editor-styles-wrapper h2.block-editor-block-list__block, .editor-styles-wrapper h3.block-editor-block-list__block, .editor-styles-wrapper h4.block-editor-block-list__block, .editor-styles-wrapper h5.block-editor-block-list__block, .editor-styles-wrapper h6.block-editor-block-list__block' => array(
'color' => esc_attr( $heading_base_color ),
),
// Blockquote Text Color.
'blockquote' => array(
'color' => astra_adjust_brightness( $text_color, 75, 'darken' ),
),
'blockquote .editor-rich-text__tinymce a' => array(
'color' => astra_hex_to_rgba( $link_color, 1 ),
),
'blockquote' => array(
'border-color' => astra_hex_to_rgba( $link_color, 0.05 ),
),
'.block-editor-block-list__block .wp-block-quote:not(.is-large):not(.is-style-large), .edit-post-visual-editor .wp-block-pullquote blockquote' => array(
'border-color' => astra_hex_to_rgba( $link_color, 0.15 ),
),
// Heading H1 - H6 font size.
'.editor-styles-wrapper .block-editor-block-list__block h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .editor-styles-wrapper .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1, .editor-styles-wrapper h1.block-editor-block-list__block' => array(
'font-size' => astra_responsive_font( $heading_h1_font_size, 'desktop' ),
'font-family' => astra_get_css_value( $h1_font_family, 'font' ),
'font-weight' => astra_get_css_value( $h1_font_weight, 'font' ),
'line-height' => esc_attr( $h1_line_height ),
'text-transform' => esc_attr( $h1_text_transform ),
'text-decoration' => esc_attr( $h1_text_decoration ),
'letter-spacing' => esc_attr( $h1_letter_spacing ),
),
'.editor-styles-wrapper .block-editor-block-list__block h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .editor-styles-wrapper .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2, .editor-styles-wrapper h2.block-editor-block-list__block' => array(
'font-size' => astra_responsive_font( $heading_h2_font_size, 'desktop' ),
'font-family' => astra_get_css_value( $h2_font_family, 'font' ),
'font-weight' => astra_get_css_value( $h2_font_weight, 'font' ),
'line-height' => esc_attr( $h2_line_height ),
'text-transform' => esc_attr( $h2_text_transform ),
'text-decoration' => esc_attr( $h2_text_decoration ),
'letter-spacing' => esc_attr( $h2_letter_spacing ),
),
'.editor-styles-wrapper .block-editor-block-list__block h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .editor-styles-wrapper .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3, .editor-styles-wrapper h3.block-editor-block-list__block' => array(
'font-size' => astra_responsive_font( $heading_h3_font_size, 'desktop' ),
'font-family' => astra_get_css_value( $h3_font_family, 'font' ),
'font-weight' => astra_get_css_value( $h3_font_weight, 'font' ),
'line-height' => esc_attr( $h3_line_height ),
'text-transform' => esc_attr( $h3_text_transform ),
'text-decoration' => esc_attr( $h3_text_decoration ),
'letter-spacing' => esc_attr( $h3_letter_spacing ),
),
'.editor-styles-wrapper .block-editor-block-list__block h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .editor-styles-wrapper .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4, .editor-styles-wrapper h4.block-editor-block-list__block' => array(
'font-size' => astra_responsive_font( $heading_h4_font_size, 'desktop' ),
'font-family' => astra_get_css_value( $h4_font_family, 'font' ),
'font-weight' => astra_get_css_value( $h4_font_weight, 'font' ),
'line-height' => esc_attr( $h4_line_height ),
'text-transform' => esc_attr( $h4_text_transform ),
'text-decoration' => esc_attr( $h4_text_decoration ),
'letter-spacing' => esc_attr( $h4_letter_spacing ),
),
'.editor-styles-wrapper .block-editor-block-list__block h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .editor-styles-wrapper .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5, .editor-styles-wrapper h5.block-editor-block-list__block' => array(
'font-size' => astra_responsive_font( $heading_h5_font_size, 'desktop' ),
'font-family' => astra_get_css_value( $h5_font_family, 'font' ),
'font-weight' => astra_get_css_value( $h5_font_weight, 'font' ),
'line-height' => esc_attr( $h5_line_height ),
'text-transform' => esc_attr( $h5_text_transform ),
'text-decoration' => esc_attr( $h5_text_decoration ),
'letter-spacing' => esc_attr( $h5_letter_spacing ),
),
'.editor-styles-wrapper .block-editor-block-list__block h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .editor-styles-wrapper .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6, .editor-styles-wrapper h6.block-editor-block-list__block' => array(
'font-size' => astra_responsive_font( $heading_h6_font_size, 'desktop' ),
'font-family' => astra_get_css_value( $h6_font_family, 'font' ),
'font-weight' => astra_get_css_value( $h6_font_weight, 'font' ),
'line-height' => esc_attr( $h6_line_height ),
'text-transform' => esc_attr( $h6_text_transform ),
'text-decoration' => esc_attr( $h6_text_decoration ),
'letter-spacing' => esc_attr( $h6_letter_spacing ),
),
/* Seperator block default width */
'.wp-block-separator:not(.is-style-wide):not(.is-style-dots)' => array(
'width' => '100px !important',
),
/**
* WooCommerce Grid Products compatibility.
*/
'.wc-block-grid__product-title' => array(
'color' => esc_attr( $text_color ),
),
'.wc-block-grid__product .wc-block-grid__product-onsale' => array(
'background-color' => $theme_color,
'color' => astra_get_foreground_color( $theme_color ),
),
'.editor-styles-wrapper .wc-block-grid__products .wc-block-grid__product .wp-block-button__link, .wc-block-grid__product-onsale' => array(
'color' => $btn_color,
'border-color' => $btn_bg_color,
'background-color' => $btn_bg_color,
),
'.wc-block-grid__products .wc-block-grid__product .wp-block-button__link:hover' => array(
'color' => $btn_h_color,
'border-color' => $btn_bg_h_color,
'background-color' => $btn_bg_h_color,
),
'.wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array(
'border-top-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'top', 'desktop' ),
'border-top-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'right', 'desktop' ),
'border-bottom-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'desktop' ),
'border-bottom-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'left', 'desktop' ),
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'desktop' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'desktop' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'desktop' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'desktop' ),
),
// Margin bottom same as applied on frontend.
'.editor-styles-wrapper .is-root-container.block-editor-block-list__layout > .wp-block-heading' => array(
'margin-bottom' => '20px',
),
/**
* Site title (Page Title) on Block Editor.
*/
'body .edit-post-visual-editor__post-title-wrapper > h1:first-of-type' => array(
'font-size' => astra_responsive_font( $site_title_font_size, 'desktop' ),
'font-weight' => astra_get_css_value( $site_title_font_weight, 'font' ),
'font-family' => astra_get_css_value( $site_title_font_family, 'font', $body_font_family ),
'line-height' => esc_attr( $site_title_line_height ),
'text-transform' => esc_attr( $site_title_text_transform ),
),
);
if ( false === $improve_gb_ui ) {
$desktop_css['.editor-post-title__block,.editor-default-block-appender,.block-editor-block-list__block'] = array(
'max-width' => astra_get_css_value( $site_content_width, 'px' ),
);
$desktop_css['.block-editor-block-list__block[data-align=wide]'] = array(
'max-width' => astra_get_css_value( $site_content_width + 200, 'px' ),
);
}
$background_style_data = astra_get_responsive_background_obj( $box_bg_obj, 'desktop' );
if ( empty( $background_style_data ) ) {
$background_style_data = array(
'background-color' => '#ffffff',
);
}
if ( astra_wp_version_compare( '5.7', '>=' ) ) {
if ( true === $improve_gb_ui ) {
$desktop_css['.editor-styles-wrapper > .block-editor-block-list__layout'] = array(
'width' => '100%',
'margin' => '0 auto',
'padding' => '0',
);
$desktop_css['.ast-separate-container .edit-post-visual-editor'] = array(
'padding' => '20px',
);
$desktop_css['.edit-post-visual-editor__post-title-wrapper .editor-post-title'] = array(
'margin' => '0',
);
} else {
$desktop_css['.edit-post-visual-editor'] = array(
'padding' => '20px',
'padding-top' => 'calc(2em + 20px)',
);
$desktop_css['.edit-post-visual-editor .editor-styles-wrapper'] = array(
'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
'width' => '100%',
'margin' => '0 auto',
'padding' => '0',
);
$desktop_css['.ast-page-builder-template .edit-post-visual-editor .editor-styles-wrapper'] = array(
'max-width' => '100%',
);
$desktop_css['.ast-separate-container .edit-post-visual-editor .block-editor-block-list__layout .wp-block[data-align="full"] figure.wp-block-image, .ast-separate-container .edit-post-visual-editor .wp-block[data-align="full"] .wp-block-cover'] = array(
'margin-left' => 'calc(-4.8em - 10px)',
'margin-right' => 'calc(-4.8em - 10px)',
);
$desktop_css['.ast-separate-container .editor-post-title'] = array(
'margin-top' => '0',
);
}
$desktop_css['.ast-page-builder-template .edit-post-visual-editor'] = array(
'padding' => '0',
);
$desktop_css['.editor-styles-wrapper .block-editor-writing-flow'] = array(
'height' => '100%',
'padding' => '10px',
);
$desktop_css['.ast-page-builder-template .editor-styles-wrapper .block-editor-writing-flow, .ast-plain-container .editor-styles-wrapper .block-editor-writing-flow, #editor .edit-post-visual-editor'] = $background_style_data;
}
if ( astra_wp_version_compare( '5.8', '>=' ) ) {
$desktop_css['.edit-post-visual-editor__content-area > div'] = array(
'background' => 'inherit !important',
);
$desktop_css['.wp-block[data-align=left]>*'] = array(
'float' => 'left',
);
$desktop_css['.wp-block[data-align=right]>*'] = array(
'float' => 'right',
);
$desktop_css['.wp-block[data-align=left], .wp-block[data-align=right]'] = array(
'float' => 'none !important',
);
if ( false === $astra_apply_content_background ) {
$desktop_css['.ast-page-builder-template .editor-styles-wrapper, .ast-plain-container .editor-styles-wrapper, .ast-narrow-container .editor-styles-wrapper'] = $background_style_data;
}
}
if ( ( ( ! in_array( 'ast-dynamic-single-post-title', $single_post_title ) ) && ( 'post' === get_post_type() ) ) || ( 'disabled' === $title_enabled_from_meta ) ) {
$destop_title_css = array(
'.editor-post-title__block' => array(
'opacity' => '0.2',
),
);
$css .= astra_parse_css( $destop_title_css );
}
$content_links_underline = astra_get_option( 'underline-content-links' );
if ( $content_links_underline ) {
$desktop_css['.edit-post-visual-editor a'] = array(
'text-decoration' => 'underline',
);
$reset_underline_from_anchors = Astra_Dynamic_CSS::unset_builder_elements_underline();
$excluding_anchor_selectors = $reset_underline_from_anchors ? '.edit-post-visual-editor a.uagb-tabs-list, .edit-post-visual-editor .uagb-ifb-cta a, .edit-post-visual-editor a.uagb-marketing-btn__link, .edit-post-visual-editor .uagb-post-grid a, .edit-post-visual-editor .uagb-toc__wrap a, .edit-post-visual-editor .uagb-taxomony-box a, .edit-post-visual-editor .uagb_review_block a' : '';
$desktop_css[ $excluding_anchor_selectors ] = array(
'text-decoration' => 'none',
);
}
$css .= astra_parse_css( $desktop_css );
/**
* Global button CSS - Tablet.
*/
$css_prod_button_tablet = array(
'.wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array(
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'tablet' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'tablet' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'tablet' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'tablet' ),
),
);
if ( astra_wp_version_compare( '5.7', '>=' ) ) {
$css_prod_button_tablet['.ast-page-builder-template .editor-styles-wrapper .block-editor-writing-flow, .ast-plain-container .editor-styles-wrapper .block-editor-writing-flow'] = astra_get_responsive_background_obj( $box_bg_obj, 'tablet' );
}
$css .= astra_parse_css( $css_prod_button_tablet, '', astra_get_tablet_breakpoint() );
/**
* Global button CSS - Mobile.
*/
$css_prod_button_mobile = array(
'.wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array(
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'mobile' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'mobile' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'mobile' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'mobile' ),
),
);
if ( astra_wp_version_compare( '5.7', '>=' ) ) {
$css_prod_button_mobile['.ast-page-builder-template .editor-styles-wrapper .block-editor-writing-flow, .ast-plain-container .editor-styles-wrapper .block-editor-writing-flow'] = astra_get_responsive_background_obj( $box_bg_obj, 'mobile' );
}
$css .= astra_parse_css( $css_prod_button_mobile, '', astra_get_mobile_breakpoint() );
$theme_btn_top_border = ( isset( $global_custom_button_border_size['top'] ) && '' !== $global_custom_button_border_size['top'] ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : '1px';
$theme_btn_right_border = ( isset( $global_custom_button_border_size['right'] ) && '' !== $global_custom_button_border_size['right'] ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : '1px';
$theme_btn_left_border = ( isset( $global_custom_button_border_size['left'] ) && '' !== $global_custom_button_border_size['left'] ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : '1px';
$theme_btn_bottom_border = ( isset( $global_custom_button_border_size['bottom'] ) && '' !== $global_custom_button_border_size['bottom'] ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : '1px';
if ( Astra_Dynamic_CSS::page_builder_button_style_css() ) {
$is_support_wp_5_8 = Astra_Dynamic_CSS::is_block_editor_support_enabled();
$search_button_selector = $is_support_wp_5_8 ? ', .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button' : '';
$search_button_hover_selector = $is_support_wp_5_8 ? ', .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:hover, .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:focus' : '';
$file_block_button_selector = ( true === $improve_gb_ui ) ? ', .block-editor-writing-flow .wp-block-file .wp-block-file__button' : '';
$file_block_button_hover_selector = ( true === $improve_gb_ui ) ? ', .block-editor-writing-flow .wp-block-file .wp-block-file__button:hover, .block-editor-writing-flow .wp-block-file .wp-block-file__button:focus' : '';
$button_desktop_css = array(
/**
* Gutenberg button compatibility for default styling.
*/
'.editor-styles-wrapper .wp-block-button .wp-block-button__link' . $search_button_selector . $file_block_button_selector => array(
'border-style' => 'solid',
'border-top-width' => $theme_btn_top_border,
'border-right-width' => $theme_btn_right_border,
'border-left-width' => $theme_btn_left_border,
'border-bottom-width' => $theme_btn_bottom_border,
'color' => esc_attr( $btn_color ),
'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
'background-color' => esc_attr( $btn_bg_color ),
'font-family' => astra_get_font_family( $theme_btn_font_family ),
'font-weight' => esc_attr( $theme_btn_font_weight ),
'line-height' => esc_attr( $theme_btn_line_height ),
'text-transform' => esc_attr( $theme_btn_text_transform ),
'letter-spacing' => astra_get_css_value( $theme_btn_letter_spacing, 'px' ),
'text-decoration' => esc_attr( $theme_btn_text_decoration ),
'font-size' => astra_responsive_font( $theme_btn_font_size, 'desktop' ),
'border-top-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'top', 'desktop' ),
'border-top-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'right', 'desktop' ),
'border-bottom-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'desktop' ),
'border-bottom-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'left', 'desktop' ),
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'desktop' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'desktop' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'desktop' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'desktop' ),
),
'.wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus' . $search_button_hover_selector . $file_block_button_hover_selector => array(
'color' => esc_attr( $btn_h_color ),
'background-color' => esc_attr( $btn_bg_h_color ),
'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_h_color ) : esc_attr( $btn_border_h_color ),
),
);
if ( true === $improve_gb_ui ) {
$button_desktop_css['.block-editor-writing-flow .wp-block-file__content-wrapper'] = array(
'display' => 'flex',
'align-items' => 'center',
'flex-wrap' => 'wrap',
'justify-content' => 'space-between',
);
}
if ( $is_support_wp_5_8 ) {
$button_desktop_css['.wp-block-search .wp-block-search__input, .wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper'] = array(
'border-color' => '#eaeaea',
'background' => '#fafafa',
);
$button_desktop_css['.block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__input'] = array(
'padding' => '15px',
);
$button_desktop_css['.wp-block-search__button svg'] = array(
'fill' => 'currentColor',
);
}
$css .= astra_parse_css( $button_desktop_css );
/**
* Global button CSS - Tablet.
*/
$css_global_button_tablet = array(
'.wp-block-button .wp-block-button__link' => array(
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'tablet' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'tablet' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'tablet' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'tablet' ),
),
);
$css .= astra_parse_css( $css_global_button_tablet, '', astra_get_tablet_breakpoint() );
/**
* Global button CSS - Mobile.
*/
$css_global_button_mobile = array(
'.wp-block-button .wp-block-button__link' => array(
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'mobile' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'mobile' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'mobile' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'mobile' ),
),
);
$css .= astra_parse_css( $css_global_button_mobile, '', astra_get_mobile_breakpoint() );
}
if ( Astra_Dynamic_CSS::gutenberg_core_patterns_compat() ) {
$link_hover_color = astra_get_option( 'link-h-color' );
$btn_text_hover_color = astra_get_option( 'button-h-color' );
if ( empty( $btn_text_hover_color ) ) {
$btn_text_hover_color = astra_get_foreground_color( $link_hover_color );
}
/**
* When supporting GB button outline patterns in v3.3.0 we have given 2px as default border for GB outline button, where we restrict button border for flat type buttons.
* But now while reverting this change there is no need of default border because whatever customizer border will set it should behave accordingly. Although it is empty ('') WP applying 2px as default border for outline buttons.
*
* @since 3.6.3
*/
$default_border_size = '2px';
if ( ! astra_button_default_padding_updated() ) {
$default_border_size = '';
}
// Outline Gutenberg button compatibility CSS.
$theme_btn_top_border = ( isset( $global_custom_button_border_size['top'] ) && ( '' !== $global_custom_button_border_size['top'] && '0' !== $global_custom_button_border_size['top'] ) ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : $default_border_size;
$theme_btn_right_border = ( isset( $global_custom_button_border_size['right'] ) && ( '' !== $global_custom_button_border_size['right'] && '0' !== $global_custom_button_border_size['right'] ) ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : $default_border_size;
$theme_btn_left_border = ( isset( $global_custom_button_border_size['left'] ) && ( '' !== $global_custom_button_border_size['left'] && '0' !== $global_custom_button_border_size['left'] ) ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : $default_border_size;
$theme_btn_bottom_border = ( isset( $global_custom_button_border_size['bottom'] ) && ( '' !== $global_custom_button_border_size['bottom'] && '0' !== $global_custom_button_border_size['bottom'] ) ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : $default_border_size;
// Added CSS compatibility support for Gutenberg pattern.
$button_patterns_compat_css = array(
'.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color), .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color)' => array(
'color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
),
'.wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-button.is-style-outline .wp-block-button__link:focus' => array(
'color' => esc_attr( $btn_text_hover_color ) . ' !important',
),
'.wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus' => array(
'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_h_color ) : esc_attr( $btn_border_h_color ),
),
);
if ( ! astra_button_default_padding_updated() ) {
$button_patterns_compat_css['.wp-block-button .wp-block-button__link'] = array(
'border' => 'none',
'padding' => '15px 30px',
);
$button_patterns_compat_css['.wp-block-button.is-style-outline .wp-block-button__link'] = array(
'border-style' => 'solid',
'border-top-width' => esc_attr( $theme_btn_top_border ),
'border-right-width' => esc_attr( $theme_btn_right_border ),
'border-bottom-width' => esc_attr( $theme_btn_bottom_border ),
'border-left-width' => esc_attr( $theme_btn_left_border ),
'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
);
}
$css .= astra_parse_css( $button_patterns_compat_css );
if ( ! astra_button_default_padding_updated() ) {
// Tablet CSS.
$button_patterns_tablet_compat_css = array(
'.wp-block-button .wp-block-button__link' => array(
'border' => 'none',
'padding' => '15px 30px',
),
'.wp-block-button.is-style-outline .wp-block-button__link' => array(
'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
),
);
$css .= astra_parse_css( $button_patterns_tablet_compat_css, '', astra_get_tablet_breakpoint() );
// Mobile CSS.
$button_patterns_mobile_compat_css = array(
'.wp-block-button .wp-block-button__link' => array(
'border' => 'none',
'padding' => '15px 30px',
),
'.wp-block-button.is-style-outline .wp-block-button__link' => array(
'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
),
);
$css .= astra_parse_css( $button_patterns_mobile_compat_css, '', astra_get_mobile_breakpoint() );
}
if ( $is_site_rtl ) {
$gb_patterns_min_mobile_css = array(
'.editor-styles-wrapper .alignleft' => array(
'margin-left' => '20px',
),
'.editor-styles-wrapper .alignright' => array(
'margin-right' => '20px',
),
);
} else {
$gb_patterns_min_mobile_css = array(
'.editor-styles-wrapper .alignleft' => array(
'margin-right' => '20px',
),
'.editor-styles-wrapper .alignright' => array(
'margin-left' => '20px',
),
);
}
if ( ! astra_button_default_padding_updated() ) {
$gb_patterns_min_mobile_css['.editor-styles-wrapper p.has-background'] = array(
'padding' => '20px',
);
}
/* Parse CSS from array() -> min-width: (mobile-breakpoint) px CSS */
$css .= astra_parse_css( $gb_patterns_min_mobile_css );
}
if ( Astra_Dynamic_CSS::gutenberg_core_blocks_css_comp() ) {
$desktop_screen_gb_css = array(
'.wp-block-columns' => array(
'margin-bottom' => 'unset',
),
'figure.size-full' => array(
'margin' => '2rem 0',
),
'.wp-block-gallery' => array(
'margin-bottom' => '1.6em',
),
'.wp-block-group' => array(
'padding-top' => '4em',
'padding-bottom' => '4em',
),
'.wp-block-group__inner-container:last-child, .wp-block-table table' => array(
'margin-bottom' => '0',
),
'.blocks-gallery-grid' => array(
'width' => '100%',
),
'.wp-block-navigation-link__content' => array(
'padding' => '5px 0',
),
'.wp-block-group .wp-block-group .has-text-align-center, .wp-block-group .wp-block-column .has-text-align-center' => array(
'max-width' => '100%',
),
'.has-text-align-center' => array(
'margin' => '0 auto',
),
);
/* Parse CSS from array() -> Desktop CSS */
$css .= astra_parse_css( $desktop_screen_gb_css );
if ( false === $improve_gb_ui ) {
$middle_screen_min_gb_css = array(
'.wp-block-cover__inner-container, .alignwide .wp-block-group__inner-container, .alignfull .wp-block-group__inner-container' => array(
'max-width' => '1200px',
'margin' => '0 auto',
),
'.wp-block-group.alignnone, .wp-block-group.aligncenter, .wp-block-group.alignleft, .wp-block-group.alignright, .wp-block-group.alignwide, .wp-block-columns.alignwide' => array(
'margin' => '2rem 0 1rem 0',
),
);
/* Parse CSS from array() -> min-width: (1200)px CSS */
$css .= astra_parse_css( $middle_screen_min_gb_css, '1200' );
}
$middle_screen_max_gb_css = array(
'.wp-block-group' => array(
'padding' => '3em',
),
'.wp-block-group .wp-block-group' => array(
'padding' => '1.5em',
),
'.wp-block-columns, .wp-block-column' => array(
'margin' => '1rem 0',
),
);
/* Parse CSS from array() -> max-width: (1200)px CSS */
$css .= astra_parse_css( $middle_screen_max_gb_css, '', '1200' );
$tablet_screen_min_gb_css = array(
'.wp-block-columns .wp-block-group' => array(
'padding' => '2em',
),
);
/* Parse CSS from array() -> min-width: (tablet-breakpoint)px CSS */
$css .= astra_parse_css( $tablet_screen_min_gb_css, astra_get_tablet_breakpoint() );
$mobile_screen_max_gb_css = array(
'.wp-block-media-text .wp-block-media-text__content' => array(
'padding' => '3em 2em',
),
'.wp-block-cover-image .wp-block-cover__inner-container, .wp-block-cover .wp-block-cover__inner-container' => array(
'width' => 'unset',
),
'.wp-block-cover, .wp-block-cover-image' => array(
'padding' => '2em 0',
),
'.wp-block-group, .wp-block-cover' => array(
'padding' => '2em',
),
'.wp-block-media-text__media img, .wp-block-media-text__media video' => array(
'width' => 'unset',
'max-width' => '100%',
),
'.wp-block-media-text.has-background .wp-block-media-text__content' => array(
'padding' => '1em',
),
);
/* Parse CSS from array() -> max-width: (mobile-breakpoint)px CSS */
$css .= astra_parse_css( $mobile_screen_max_gb_css, '', astra_get_mobile_breakpoint() );
}
if ( Astra_Dynamic_CSS::gutenberg_core_patterns_compat() ) {
// Added CSS compatibility support for Gutenberg Editor's Media & Text block pattern.
if ( $is_site_rtl ) {
$gb_editor_block_pattern_css = array(
'.wp-block-media-text .wp-block-media-text__content .wp-block-group__inner-container' => array(
'padding' => '0 8% 0 0',
),
'.ast-separate-container .block-editor-block-list__layout .wp-block[data-align="full"] .wp-block[data-align="center"] > .wp-block-image' => array(
'margin-right' => 'auto',
'margin-left' => 'auto',
),
);
} else {
$gb_editor_block_pattern_css = array(
'.wp-block-media-text .wp-block-media-text__content .wp-block-group__inner-container' => array(
'padding' => '0 0 0 8%',
),
'.ast-separate-container .block-editor-block-list__layout .wp-block[data-align="full"] .wp-block[data-align="center"] > .wp-block-image' => array(
'margin-right' => 'auto',
'margin-left' => 'auto',
),
);
}
if ( false === $improve_gb_ui ) {
$gb_editor_block_pattern_css['.block-editor-block-list__layout * .block-editor-block-list__block'] = array(
'padding-left' => '20px',
'padding-right' => '20px',
);
}
$css .= astra_parse_css( $gb_editor_block_pattern_css );
}
/**
* Updating core block layouts in editor as well.
*
* @since 3.7.4
*/
if ( true === $improve_gb_ui ) {
$gb_editor_core_blocks_ui_css = array(
'.editor-styles-wrapper' => array(
'padding' => '0',
),
'.block-editor-block-list__layout > .wp-block-cover, .block-editor-block-list__layout > .wp-block-group, .block-editor-block-list__layout > .wp-block-columns, .block-editor-block-list__layout > .wp-block-media-text' => array(
'max-width' => '910px',
'margin' => '0 auto',
),
'.ast-page-builder-template .block-editor-block-list__layout.is-root-container > .wp-block:not(.wp-block-cover):not(.wp-block-group):not(.wp-block-columns):not(.wp-block-media-text):not([data-align=wide]):not([data-align=full]):not([data-align=left]):not([data-align=right]), .editor-styles-wrapper .wp-block.editor-post-title__block' => array(
'max-width' => '100%',
),
'.edit-post-visual-editor .editor-post-title__input, p.wp-block-paragraph, .wp-block[data-align="wide"]' => array(
'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
),
'.block-editor-block-list__layout > .wp-block-group, .block-editor-block-list__layout > .wp-block-cover, .wp-block[data-align=center] .wp-block-cover, .wp-block[data-align=center] .wp-block-group, .edit-post-visual-editor .editor-post-title__input' => array(
'margin' => '0 auto',
),
'.block-editor-block-list__layout.is-root-container > .wp-block' => array(
'margin' => '28px auto',
),
'.editor-styles-wrapper .block-editor-block-list__layout .wp-block [class*="__inner-container"] > .wp-block:not([data-align=wide]):not([data-align=full]):not([data-align=left]):not([data-align=right]):not(p.wp-block-paragraph)' => array(
'max-width' => '50rem',
'width' => '100%',
),
'.block-editor-block-list__layout .wp-block-group, .block-editor-block-list__layout .wp-block-cover, .block-editor-block-list__layout .wp-block-columns.has-background' => array(
'padding' => '4em',
),
'.block-editor-block-list__layout.is-root-container > .wp-block[data-align="wide"] > .wp-block-group, .block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"] > .wp-block-group, .block-editor-block-list__layout.is-root-container > .wp-block[data-align="wide"] > .wp-block-cover, .block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"] > .wp-block-cover, .block-editor-block-list__layout.is-root-container > .wp-block[data-align="wide"] > .wp-block-columns, .block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"] > .wp-block-columns' => array(
'padding' => '6em 4em',
),
'.editor-styles-wrapper .block-editor-block-list__layout.is-root-container > .wp-block[data-align=full]' => array(
'margin-left' => '0',
'margin-right' => '0',
),
'.ast-separate-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > .wp-block[data-align=full]' => array(
'margin-left' => '-20px',
'margin-right' => '-20px',
),
'.editor-styles-wrapper .block-editor-default-block-appender__content' => array(
'margin-bottom' => '0',
),
'.wp-block .wp-block:not(.wp-block-paragraph)' => array(
'margin-top' => '0',
'margin-bottom' => '0',
),
'.block-editor-block-list__layout > .wp-block[data-align="wide"] .wp-block-group:not(.has-background), .block-editor-block-list__layout > .wp-block[data-align="full"] .wp-block-group:not(.has-background), .wp-block-group:not(.has-background)' => array(
'padding' => '2em',
),
'.wp-block[data-align="left"] figure figcaption, .wp-block[data-align="right"] figure figcaption, .wp-block[data-align="center"] figure figcaption' => array(
'padding-left' => '20px',
'padding-right' => '20px',
),
'.wp-block[data-align="right"] figure figcaption' => array(
'text-align' => 'right',
),
'.wp-block-cover .wp-block-cover__inner-container .wp-block-heading' => array(
'color' => '#ffffff',
),
);
$css .= astra_parse_css( $gb_editor_core_blocks_ui_css );
} else {
$block_editor_padding_css = '.edit-post-visual-editor .block-editor-block-list__layout .block-editor-block-list__layout {
padding: 0;
}
.editor-post-title__block {
max-width: 1256px;
}';
$css .= Astra_Enqueue_Scripts::trim_css( $block_editor_padding_css );
}
$tablet_css = array(
// Heading H1 - H6 font size.
'.edit-post-visual-editor h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1' => array(
'font-size' => astra_responsive_font( $heading_h1_font_size, 'tablet', 30 ),
),
'.edit-post-visual-editor h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2' => array(
'font-size' => astra_responsive_font( $heading_h2_font_size, 'tablet', 25 ),
),
'.edit-post-visual-editor h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3' => array(
'font-size' => astra_responsive_font( $heading_h3_font_size, 'tablet', 20 ),
),
'.edit-post-visual-editor h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4' => array(
'font-size' => astra_responsive_font( $heading_h4_font_size, 'tablet' ),
),
'.edit-post-visual-editor h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5' => array(
'font-size' => astra_responsive_font( $heading_h5_font_size, 'tablet' ),
),
'.edit-post-visual-editor h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6' => array(
'font-size' => astra_responsive_font( $heading_h6_font_size, 'tablet' ),
),
'.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'tablet' ),
);
$css .= astra_parse_css( $tablet_css, '', astra_get_tablet_breakpoint() );
$mobile_css = array(
// Heading H1 - H6 font size.
'.edit-post-visual-editor h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1' => array(
'font-size' => astra_responsive_font( $heading_h1_font_size, 'mobile', 30 ),
),
'.edit-post-visual-editor h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2' => array(
'font-size' => astra_responsive_font( $heading_h2_font_size, 'mobile', 25 ),
),
'.edit-post-visual-editor h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3' => array(
'font-size' => astra_responsive_font( $heading_h3_font_size, 'mobile', 20 ),
),
'.edit-post-visual-editor h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4' => array(
'font-size' => astra_responsive_font( $heading_h4_font_size, 'mobile' ),
),
'.edit-post-visual-editor h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5' => array(
'font-size' => astra_responsive_font( $heading_h5_font_size, 'mobile' ),
),
'.edit-post-visual-editor h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6' => array(
'font-size' => astra_responsive_font( $heading_h6_font_size, 'mobile' ),
),
'.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'mobile' ),
);
$css .= astra_parse_css( $mobile_css, '', astra_get_mobile_breakpoint() );
if ( is_callable( 'Astra_Woocommerce::astra_global_btn_woo_comp' ) && Astra_Woocommerce::astra_global_btn_woo_comp() ) {
$woo_global_button_css = array(
'.editor-styles-wrapper .wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array(
'border-top-width' => ( isset( $global_custom_button_border_size['top'] ) && '' !== $global_custom_button_border_size['top'] ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : '0',
'border-right-width' => ( isset( $global_custom_button_border_size['right'] ) && '' !== $global_custom_button_border_size['right'] ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : '0',
'border-left-width' => ( isset( $global_custom_button_border_size['left'] ) && '' !== $global_custom_button_border_size['left'] ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : '0',
'border-bottom-width' => ( isset( $global_custom_button_border_size['bottom'] ) && '' !== $global_custom_button_border_size['bottom'] ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : '0',
'border-color' => $btn_border_color ? $btn_border_color : $btn_bg_color,
),
'.wc-block-grid__products .wc-block-grid__product .wp-block-button__link:hover' => array(
'border-color' => $btn_bg_h_color,
),
);
$css .= astra_parse_css( $woo_global_button_css );
}
if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
$page_builder_css = array(
'.ast-page-builder-template .editor-post-title__block, .ast-page-builder-template .editor-default-block-appender' => array(
'width' => '100%',
'max-width' => '100%',
),
'.ast-page-builder-template .wp-block[data-align="right"] > *' => array(
'max-width' => 'unset',
'width' => 'unset',
),
'.ast-page-builder-template .block-editor-block-list__layout' => array(
'padding-left' => 0,
'padding-right' => 0,
),
'.ast-page-builder-template .editor-block-list__block-edit' => array(
'padding-left' => '20px',
'padding-right' => '20px',
),
'.ast-page-builder-template .editor-block-list__block-edit .editor-block-list__block-edit' => array(
'padding-left' => '0',
'padding-right' => '0',
),
);
} else {
$page_builder_css = array(
'.ast-page-builder-template .editor-post-title__block, .ast-page-builder-template .editor-default-block-appender, .ast-page-builder-template .block-editor-block-list__block' => array(
'width' => '100%',
'max-width' => '100%',
),
'.ast-page-builder-template .block-editor-block-list__layout' => array(
'padding-left' => 0,
'padding-right' => 0,
),
'.ast-page-builder-template .editor-block-list__block-edit' => array(
'padding-left' => '20px',
'padding-right' => '20px',
),
'.ast-page-builder-template .editor-block-list__block-edit .editor-block-list__block-edit' => array(
'padding-left' => '0',
'padding-right' => '0',
),
);
}
$css .= astra_parse_css( $page_builder_css );
$aligned_full_content_css = array(
'.ast-page-builder-template .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit, .ast-plain-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit' => array(
'margin-left' => '0',
'margin-right' => '0',
),
'.ast-page-builder-template .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .ast-plain-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"]' => array(
'margin-left' => '0',
'margin-right' => '0',
),
);
$css .= astra_parse_css( $aligned_full_content_css );
$boxed_container = array(
'.ast-separate-container .block-editor-writing-flow' => array(
'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
'margin' => '0 auto',
'background-color' => '#fff',
),
'.ast-separate-container .gutenberg__editor, .ast-two-container .gutenberg__editor' => array(
'background-color' => '#f5f5f5',
),
'.ast-separate-container .block-editor-block-list__layout, .ast-two-container .editor-block-list__layout' => array(
'padding-top' => '0',
),
'.ast-two-container .editor-post-title, .ast-separate-container .block-editor-block-list__layout, .ast-two-container .editor-post-title' => array(
'padding-top' => 'calc( 5.34em - 19px)',
'padding-bottom' => '5.34em',
'padding-left' => 'calc( 6.67em - 28px )',
'padding-right' => 'calc( 6.67em - 28px )',
),
'.ast-separate-container .block-editor-block-list__layout' => array(
'padding-top' => '0',
'padding-bottom' => '5.34em',
'padding-left' => 'calc( 6.67em - 28px )',
'padding-right' => 'calc( 6.67em - 28px )',
),
'.ast-separate-container .editor-post-title' => array(
'padding-top' => '62px',
'padding-bottom' => '5.34em',
'padding-left' => '72px',
'padding-right' => '72px',
),
'.ast-separate-container .editor-post-title, .ast-two-container .editor-post-title' => array(
'padding-bottom' => '0',
),
'.ast-separate-container .editor-block-list__block, .ast-two-container .editor-block-list__block' => array(
'max-width' => 'calc(' . astra_get_css_value( $site_content_width, 'px' ) . ' - 6.67em)',
),
'.ast-separate-container .editor-block-list__block[data-align=wide], .ast-two-container .editor-block-list__block[data-align=wide]' => array(
'margin-left' => '-20px',
'margin-right' => '-20px',
),
'.ast-separate-container .editor-block-list__block[data-align=full], .ast-two-container .editor-block-list__block[data-align=full]' => array(
'margin-left' => '-6.67em',
'margin-right' => '-6.67em',
),
'.ast-separate-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .ast-separate-container .block-editor-block-list__layout .editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit, .ast-two-container .block-editor-block-list__layout .editor-block-list__block[data-align="full"], .ast-two-container .block-editor-block-list__layout .editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit' => array(
'margin-left' => '0',
'margin-right' => '0',
),
);
if ( true === $improve_gb_ui ) {
$boxed_editor_content_area = '.ast-separate-container .block-editor-block-list__layout.is-root-container, .ast-max-width-layout.ast-plain-container .edit-post-visual-editor .block-editor-block-list__layout.is-root-container, .ast-separate-container .editor-post-title, .ast-two-container .editor-post-title';
$boxed_container = array();
}
$boxed_container_tablet = array();
$boxed_container_mobile = array();
if ( astra_has_gcp_typo_preset_compatibility() ) {
$boxed_editor_content_area = '.ast-separate-container .block-editor-writing-flow, .ast-max-width-layout.ast-plain-container .edit-post-visual-editor .block-editor-writing-flow';
$content_bg_obj = astra_get_option( 'content-bg-obj-responsive' );
$boxed_container_mobile = array();
$boxed_container_tablet = array();
$selector_for_content_background = ( true === $astra_apply_content_background ) ? '.edit-post-visual-editor .editor-styles-wrapper' : $boxed_editor_content_area;
$boxed_container[ $selector_for_content_background ] = astra_get_responsive_background_obj( $content_bg_obj, 'desktop' );
$boxed_container_tablet[ $selector_for_content_background ] = astra_get_responsive_background_obj( $content_bg_obj, 'tablet' );
$boxed_container_mobile[ $selector_for_content_background ] = astra_get_responsive_background_obj( $content_bg_obj, 'mobile' );
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$css .= astra_parse_css( $boxed_container_tablet, '', astra_get_tablet_breakpoint() );
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$css .= astra_parse_css( $boxed_container_mobile, '', astra_get_mobile_breakpoint() );
}
$css .= astra_parse_css( $boxed_container );
// Manage the extra padding applied in the block inster preview of blocks.
$block_inserter_css = array(
'.ast-separate-container .block-editor-inserter__preview .block-editor-block-list__layout' => array(
'padding-top' => '0px',
'padding-bottom' => '0px',
'padding-left' => '0px',
'padding-right' => '0px',
),
);
$css .= astra_parse_css( $block_inserter_css );
// WP 5.5 compatibility fix the extra padding applied for the block patterns in the editor view.
if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
$block_pattern_css = array(
'.ast-separate-container .block-editor-inserter__panel-content .block-editor-block-list__layout' => array(
'padding-top' => '0px',
'padding-bottom' => '0px',
'padding-left' => '0px',
'padding-right' => '0px',
),
'.block-editor-inserter__panel-content .block-editor-block-list__layout' => array(
'margin-left' => '60px',
'margin-right' => '60px',
),
'.block-editor-inserter__panel-content .block-editor-block-list__layout .block-editor-block-list__layout' => array(
'margin-left' => '0px',
'margin-right' => '0px',
),
'.ast-page-builder-template .block-editor-inserter__panel-content .block-editor-block-list__layout' => array(
'margin-left' => '0px',
'margin-right' => '0px',
),
);
$css .= astra_parse_css( $block_pattern_css );
} else {
$full_width_streched_css = array(
'.ast-page-builder-template .block-editor-block-list__layout' => array(
'margin-left' => '60px',
'margin-right' => '60px',
),
'.ast-page-builder-template .block-editor-block-list__layout .block-editor-block-list__layout' => array(
'margin-left' => '0px',
'margin-right' => '0px',
),
);
$css .= astra_parse_css( $full_width_streched_css );
}
$ast_gtn_mobile_css = array(
'.ast-separate-container .editor-post-title' => array(
'padding-top' => '19px',
'padding-left' => '28px',
'padding-right' => '28px',
),
'.ast-separate-container .block-editor-block-list__layout' => array(
'padding-bottom' => '2.34em',
'padding-left' => 'calc( 3.67em - 28px )',
'padding-right' => 'calc( 3.67em - 28px )',
),
'.ast-page-builder-template .block-editor-block-list__layout' => array(
'margin-left' => '30px',
'margin-right' => '30px',
),
'.ast-plain-container .block-editor-block-list__layout' => array(
'padding-left' => '30px',
'padding-right' => '30px',
),
);
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$css .= astra_parse_css( $ast_gtn_mobile_css, '', astra_get_mobile_breakpoint() );
if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
$gtn_full_wide_image_css = array(
'.wp-block[data-align="left"], .wp-block[data-align="right"]' => array(
'max-width' => '100%',
'width' => '100%',
),
);
if ( ! astra_wp_version_compare( '5.8', '>=' ) ) {
$gtn_full_wide_image_css['.ast-separate-container .block-editor-block-list__layout .wp-block[data-align="full"] figure.wp-block-image'] = array(
'margin-left' => '-4.8em',
'margin-right' => '-4.81em',
'max-width' => 'unset',
'width' => 'unset',
);
}
if ( false === $improve_gb_ui ) {
$gtn_full_wide_image_css['.ast-plain-container .wp-block[data-align="left"], .ast-plain-container .wp-block[data-align="right"], .ast-plain-container .wp-block[data-align="center"], .ast-plain-container .wp-block[data-align="full"]'] = array(
'max-width' => astra_get_css_value( $site_content_width, 'px' ),
);
$gtn_full_wide_image_css['.wp-block[data-align="center"]'] = array(
'max-width' => '100%',
'width' => '100%',
);
$gtn_full_wide_image_css['.ast-separate-container .wp-block[data-align="full"] .wp-block-cover'] = array(
'margin-left' => '-4.8em',
'margin-right' => '-4.81em',
'max-width' => 'unset',
'width' => 'unset',
);
$gtn_full_wide_image_css['.ast-plain-container .wp-block[data-align="wide"]'] = array(
'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
);
$gtn_full_wide_image_css['.ast-separate-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"], .ast-plain-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"]'] = array(
'margin-left' => 'auto',
'margin-right' => 'auto',
);
}
} else {
$gtn_full_wide_image_css = array(
'.ast-separate-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] figure.wp-block-image' => array(
'margin-left' => '-4.8em',
'margin-right' => '-4.81em',
'max-width' => 'unset',
'width' => 'unset',
),
'.ast-separate-container .block-editor-block-list__block[data-align="full"] .wp-block-cover' => array(
'margin-left' => '-4.8em',
'margin-right' => '-4.81em',
'max-width' => 'unset',
'width' => 'unset',
),
);
}
$css .= astra_parse_css( $gtn_full_wide_image_css );
if ( true === $improve_gb_ui ) {
$compatibility_css = '
.wp-block-cover__inner-container .wp-block {
color: #ffffff;
}
.edit-post-visual-editor blockquote {
padding: 0 1.2em 1.2em;
}
.editor-styles-wrapper .wp-block-pullquote blockquote::before {
content: "\201D";
font-family: "Helvetica",sans-serif;
display: flex;
transform: rotate( 180deg );
font-size: 6rem;
font-style: normal;
line-height: 1;
font-weight: bold;
align-items: center;
justify-content: center;
}
.editor-styles-wrapper .wp-block-pullquote.is-style-solid-color blockquote {
max-width: 100%;
text-align: inherit;
}
ul.wp-block-categories__list, ul.wp-block-archives-list {
list-style-type: none;
}';
if ( $is_site_rtl ) {
$compatibility_css .= '
.edit-post-visual-editor ul, .edit-post-visual-editor ol {
margin-right: 20px;
}';
} else {
$compatibility_css .= '
.edit-post-visual-editor ul, .edit-post-visual-editor ol {
margin-left: 20px;
}';
}
} else {
$compatibility_css = '
.edit-post-visual-editor blockquote {
padding: 1.2em;
}
';
}
$css .= Astra_Enqueue_Scripts::trim_css( $compatibility_css );
if ( false === $improve_gb_ui && in_array( $pagenow, array( 'post-new.php' ) ) && ! isset( $post ) ) {
$boxed_container = array(
'.block-editor-writing-flow' => array(
'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
'margin' => '0 auto',
'background-color' => '#fff',
),
'.gutenberg__editor' => array(
'background-color' => '#f5f5f5',
),
'.block-editor-block-list__layout, .editor-post-title' => array(
'padding-top' => 'calc( 5.34em - 19px)',
'padding-bottom' => '5.34em',
'padding-left' => 'calc( 6.67em - 28px )',
'padding-right' => 'calc( 6.67em - 28px )',
),
'.block-editor-block-list__layout' => array(
'padding-top' => '0',
),
'.editor-post-title' => array(
'padding-bottom' => '0',
),
'.block-editor-block-list__block' => array(
'max-width' => 'calc(' . astra_get_css_value( $site_content_width, 'px' ) . ' - 6.67em)',
),
'.block-editor-block-list__block[data-align=wide]' => array(
'margin-left' => '-20px',
'margin-right' => '-20px',
),
'.block-editor-block-list__block[data-align=full]' => array(
'margin-left' => '-6.67em',
'margin-right' => '-6.67em',
),
'.block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .editor-block-list__block-edit' => array(
'margin-left' => '0',
'margin-right' => '0',
),
);
$css .= astra_parse_css( $boxed_container );
}
/* Narrow Width Container CSS */
$narrow_container = array(
// Visibility icon alignment.
'.ast-narrow-container .edit-post-visual-editor__post-title-wrapper, .ast-stacked-title-visibility .edit-post-visual-editor__post-title-wrapper' => array(
'max-width' => 'var(--wp--custom--ast-content-width-size)',
'padding' => 0,
),
);
$css .= astra_parse_css( $narrow_container );
return $css;
}
}
endif;
PK üZe~I&