From 69c17f9c1942fd0d6a5ea941636e87723b8a6fe2 Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Wed, 21 Jul 2021 16:19:29 -0500 Subject: dos2unix on all .php files, begin paring down admin page and site branding. --- inc/core/builder/class-astra-builder-options.php | 4 +- inc/core/class-astra-admin-helper.php | 174 +- inc/core/class-astra-admin-settings.php | 2385 +++++++---------- inc/core/class-astra-attr.php | 230 +- inc/core/class-astra-enqueue-scripts.php | 778 +++--- inc/core/class-astra-theme-options.php | 1060 ++++---- inc/core/class-astra-walker-page.php | 274 +- inc/core/class-gutenberg-editor-css.php | 2232 ++++++++-------- inc/core/class-theme-strings.php | 216 +- inc/core/common-functions.php | 3052 +++++++++++----------- inc/core/deprecated/deprecated-filters.php | 174 +- inc/core/deprecated/deprecated-functions.php | 290 +- inc/core/deprecated/deprecated-hooks.php | 68 +- inc/core/index.php | 18 +- inc/core/sidebar-manager.php | 164 +- inc/core/theme-hooks.php | 998 +++---- inc/core/view-general.php | 90 +- 17 files changed, 5829 insertions(+), 6378 deletions(-) (limited to 'inc/core') diff --git a/inc/core/builder/class-astra-builder-options.php b/inc/core/builder/class-astra-builder-options.php index 4046448..f0cfc32 100644 --- a/inc/core/builder/class-astra-builder-options.php +++ b/inc/core/builder/class-astra-builder-options.php @@ -1045,7 +1045,7 @@ function prepare_button_defaults( $defaults, $index ) { $defaults[ 'header-' . $_prefix . '-text' ] = __( 'Button', 'astra' ); $defaults[ 'header-' . $_prefix . '-link-option' ] = array( - 'url' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ), + 'url' => apply_filters( 'astra_site_url', 'https://www.adelielinux.org/' ), 'new_tab' => false, 'link_rel' => '', ); @@ -1126,7 +1126,7 @@ function prepare_button_defaults( $defaults, $index ) { $defaults[ 'footer-' . $_prefix . '-text' ] = __( 'Button', 'astra' ); $defaults[ 'footer-' . $_prefix . '-link-option' ] = array( - 'url' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ), + 'url' => apply_filters( 'astra_site_url', 'https://www.adelielinux.org/' ), 'new_tab' => false, 'link_rel' => '', ); diff --git a/inc/core/class-astra-admin-helper.php b/inc/core/class-astra-admin-helper.php index ea35e7d..1763fff 100644 --- a/inc/core/class-astra-admin-helper.php +++ b/inc/core/class-astra-admin-helper.php @@ -1,87 +1,87 @@ - 'astra-sites-on-active', - 'type' => 'info', - 'message' => sprintf( - '
-
-
-

- %2$s -

-

%3$s

- -
', - $image_path, - __( 'Thank you for installing Astra!', 'astra' ), - __( 'Did you know Astra comes with dozens of ready-to-use starter templates? Install the Starter Templates plugin to get started.', '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'] ) - ), - '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 - ); - } - } - - /** - * 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 ); - } - } - - /** - * Enqueue Astra Notices CSS. - * - * @since 2.0.0 - * - * @return void - */ - public static function notice_assets() { - if ( is_rtl() ) { - wp_enqueue_style( 'astra-notices-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-notices-rtl.css', array(), ASTRA_THEME_VERSION ); - } else { - wp_enqueue_style( 'astra-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['button_text'] = __( 'See Library »', 'astra' ); - $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['button_text'] = __( 'Activate Importer Plugin', 'astra' ); - $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['button_text'] = __( 'Activate Importer Plugin', 'astra' ); - $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['button_text'] = __( 'Install Importer Plugin', 'astra' ); - $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['button_text'] = __( 'See Library »', 'astra' ); - $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; - - if ( in_array( $post_type, (array) $post_types ) ) { - - echo ''; - } - } - /* Add CSS for the Submenu for BSF plugins added in Appearance Menu */ - - if ( ! is_customize_preview() ) { - - if ( ! current_user_can( 'manage_options' ) ) { - return; - } - - wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false ); - - $localize = array( - 'ajaxUrl' => admin_url( 'admin-ajax.php' ), - 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '…', - 'astraSitesLink' => admin_url( 'themes.php?page=' ), - 'astraSitesLinkTitle' => __( 'See Library »', 'astra' ), - 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '…', - 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '…', - 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ), - 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ), - 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ), - 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ), - ); - - wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) ); - } - } - - /** - * Enqueues the needed CSS/JS for the builder's admin settings page. - * - * @since 1.0 - */ - public static function styles_scripts() { - - // Styles. - if ( is_rtl() ) { - wp_enqueue_style( 'astra-admin-settings-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings-rtl.css', array(), ASTRA_THEME_VERSION ); - } else { - wp_enqueue_style( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings.css', array(), ASTRA_THEME_VERSION ); - } - - if ( ! current_user_can( 'manage_options' ) ) { - return; - } - - wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false ); - - $localize = array( - 'ajaxUrl' => admin_url( 'admin-ajax.php' ), - 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '…', - 'astraSitesLink' => admin_url( 'themes.php?page=' ), - 'astraSitesLinkTitle' => __( 'See Library »', 'astra' ), - 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '…', - 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '…', - 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ), - 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ), - 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ), - 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ), - 'ajax_nonce' => wp_create_nonce( 'astra-builder-module-nonce' ), - 'old_header_footer' => __( 'Use Old Header/Footer', 'astra' ), - 'migrate_to_builder' => __( 'Use New Header/Footer Builder', 'astra' ), - ); - wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) ); - - // Script. - wp_enqueue_script( 'astra-admin-settings' ); - - if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) { - // For starter site plugin popup detail "Details »" on Astra Options page. - wp_enqueue_script( 'plugin-install' ); - wp_enqueue_script( 'thickbox' ); - wp_enqueue_style( 'thickbox' ); - } - } - - - /** - * 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 = self::$default_menu_position; - - if ( strpos( $parent_page, '?' ) !== false ) { - $query_var = '&page=' . self::$plugin_slug; - } else { - $query_var = '?page=' . self::$plugin_slug; - } - - $parent_page_url = admin_url( $parent_page . $query_var ); - - $url = $parent_page_url . '&action=' . $menu_slug; - - return esc_url( $url ); - } - - /** - * Add main menu - * - * @since 1.0 - */ - public static function add_admin_menu() { - - $parent_page = self::$default_menu_position; - $page_title = self::$menu_page_title; - $capability = 'manage_options'; - $page_menu_slug = self::$plugin_slug; - $page_menu_func = __CLASS__ . '::menu_callback'; - - if ( apply_filters( 'astra_dashboard_admin_menu', true ) ) { - add_theme_page( $page_title, $page_title, $capability, $page_menu_slug, $page_menu_func ); - } else { - do_action( 'asta_register_admin_menu', $parent_page, $page_title, $capability, $page_menu_slug, $page_menu_func ); - } - } - - /** - * Menu callback - * - * @since 1.0 - */ - public static function menu_callback() { - - $current_slug = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : self::$current_slug; // phpcs:ignore WordPress.Security.NonceVerification.Recommended - - $current_slug = str_replace( '-', '_', $current_slug ); - - $ast_icon = apply_filters( 'astra_page_top_icon', true ); - $ast_visit_site_url = apply_filters( 'astra_site_url', 'https://wpastra.com' ); - $ast_wrapper_class = apply_filters( 'astra_welcome_wrapper_class', array( $current_slug ) ); - - ?> -
-
-
- - - - -
-
- - -
- - -
-

- -

-
- -
-
- - - -
-

- - -

- Starter Templates -
-

- ' . esc_html( $astra_starter_sites_doc_link_text ) . '' : - esc_html( $astra_starter_sites_doc_link_text ) - ); - ?> -

-

- -

- %8$s ', - esc_attr( $ast_sites_notice_btn['class'] ), - 'href="' . esc_url( astra_get_prop( $ast_sites_notice_btn, 'link', '' ) ) . '"', - 'data-slug="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_slug', '' ) ) . '"', - 'data-init="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_init', '' ) ) . '"', - 'data-settings-link-text="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_settings_link_text', '' ) ) . '"', - 'data-settings-link="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_settings_link', '' ) ) . '"', - 'data-activating-text="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'activating_text', '' ) ) . '"', - esc_html( $ast_sites_notice_btn['button_text'] ) - ); - printf( - ' %3$s ', - isset( $ast_sites_notice_btn['detail_link_class'] ) ? esc_attr( $ast_sites_notice_btn['detail_link_class'] ) : '', - isset( $ast_sites_notice_btn['detail_link'] ) ? 'href="' . esc_url( $ast_sites_notice_btn['detail_link'] ) . '"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - isset( $ast_sites_notice_btn['detail_link_class'] ) ? esc_html( $ast_sites_notice_btn['detail_link_text'] ) : '' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - ); - ?> -
-
-
-
- - array( - 'title' => __( 'Header Options', 'astra' ), - 'dashicon' => 'dashicons-align-center', - 'quick_url' => admin_url( 'customize.php?autofocus[panel]=panel-header-group' ), - ), - 'logo-favicon' => array( - 'title' => __( 'Upload Logo', 'astra' ), - 'dashicon' => 'dashicons-format-image', - 'quick_url' => admin_url( 'customize.php?autofocus[control]=custom_logo' ), - ), - 'footer' => array( - 'title' => __( 'Footer Settings', 'astra' ), - 'dashicon' => 'dashicons-align-wide', - 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-footer-group' ), - ), - 'colors' => array( - 'title' => __( 'Set Colors', 'astra' ), - 'dashicon' => 'dashicons-admin-customizer', - 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-colors-background' ), - ), - 'layout' => array( - 'title' => __( 'Layout Options', 'astra' ), - 'dashicon' => 'dashicons-layout', - 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-container-layout' ), - ), - 'typography' => array( - 'title' => __( 'Customize Fonts', 'astra' ), - 'dashicon' => 'dashicons-editor-textcolor', - 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-typography' ), - ), - 'blog-layout' => array( - 'title' => __( 'Blog Layouts', 'astra' ), - 'dashicon' => 'dashicons-welcome-write-blog', - 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-blog-group' ), - ), - 'sidebars' => array( - 'title' => __( 'Sidebar Options', 'astra' ), - 'dashicon' => 'dashicons-align-left', - 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-sidebars' ), - ), - ) - ); - - $extensions = apply_filters( - 'astra_addon_list', - array( - 'colors-and-background' => array( - 'title' => __( 'Colors & Background', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/colors-background-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/colors-background-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'typography' => array( - 'title' => __( 'Typography', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/typography-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/typography-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'spacing' => array( - 'title' => __( 'Spacing', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/spacing-addon-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/spacing-addon-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'blog-pro' => array( - 'title' => __( 'Blog Pro', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/blog-pro-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/blog-pro-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'mobile-header' => array( - 'title' => __( 'Mobile Header', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/mobile-header-with-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/mobile-header-with-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'header-sections' => array( - 'title' => __( 'Header Sections', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/header-sections-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/header-sections-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'nav-menu' => array( - 'title' => __( 'Nav Menu', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/nav-menu-addon/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/nav-menu-addon/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'sticky-header' => array( - 'title' => __( 'Sticky Header', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/sticky-header-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/sticky-header-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'advanced-headers' => array( - 'title' => __( 'Page Headers', 'astra' ), - 'description' => __( 'Make your header layouts look more appealing and sexy!', 'astra' ), - 'manage_settings' => true, - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/page-headers-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/page-headers-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'advanced-hooks' => array( - 'title' => __( 'Custom Layouts', 'astra' ), - // 'icon' => ASTRA_THEME_URI . 'assets/img/astra-advanced-hooks.png', - 'description' => __( 'Add content conditionally in the various hook areas of the theme.', 'astra' ), - 'manage_settings' => true, - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/custom-layouts-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/custom-layouts-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'site-layouts' => array( - 'title' => __( 'Site Layouts', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/site-layout-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/site-layout-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'advanced-footer' => array( - 'title' => __( 'Footer Widgets', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/footer-widgets-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/footer-widgets-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'scroll-to-top' => array( - 'title' => __( 'Scroll To Top', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/scroll-to-top-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/scroll-to-top-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'woocommerce' => array( - 'title' => __( 'WooCommerce', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/woocommerce-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/woocommerce-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'edd' => array( - 'title' => __( 'Easy Digital Downloads', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/easy-digital-downloads-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/easy-digital-downloads-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'learndash' => array( - 'title' => __( 'LearnDash', 'astra' ), - 'description' => __( 'Supercharge your LearnDash website with amazing design features.', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/learndash-integration-in-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/learndash-integration-in-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'lifterlms' => array( - 'title' => __( 'LifterLMS', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/lifterlms-module-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/lifterlms-module-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - 'white-label' => array( - 'title' => __( 'White Label', 'astra' ), - 'class' => 'ast-addon', - 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/how-to-white-label-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'links' => array( - array( - 'link_class' => 'ast-learn-more', - 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/how-to-white-label-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ), - 'link_text' => __( 'Learn More »', 'astra' ), - 'target_blank' => true, - ), - ), - ), - ) - ); - ?> -
-

-
- - - -
-
- -
-

- -

-
- -
-
    - $info ) { - $title_url = ( isset( $info['title_url'] ) && ! empty( $info['title_url'] ) ) ? 'href="' . esc_url( $info['title_url'] ) . '"' : ''; - $anchor_target = ( isset( $info['title_url'] ) && ! empty( $info['title_url'] ) ) ? "target='_blank' rel='noopener'" : ''; - - echo '
  • ' . esc_html( $info['title'] ) . '
  • '; - } - ?> -
-
- -
-
- - - array( - 'plugin-name' => __( 'Import / Export Customizer Settings', 'astra' ), - 'plugin-init' => 'astra-import-export/astra-import-export.php', - 'settings-link' => '', - 'settings-link-text' => 'Settings', - ), - 'reset-astra-customizer' => - array( - 'plugin-name' => __( 'Astra Customizer Reset', 'astra' ), - 'plugin-init' => 'reset-astra-customizer/class-astra-theme-customizer-reset.php', - 'settings-link' => admin_url( 'customize.php' ), - 'settings-link-text' => 'Settings', - ), - - 'customizer-search' => - array( - 'plugin-name' => __( 'Customizer Search', 'astra' ), - 'plugin-init' => 'customizer-search/customizer-search.php', - 'settings-link' => admin_url( 'customize.php' ), - 'settings-link-text' => 'Settings', - ), - - 'astra-bulk-edit' => - array( - 'plugin-name' => __( 'Astra Bulk Edit', 'astra' ), - 'plugin-init' => 'astra-bulk-edit/astra-bulk-edit.php', - 'settings-link' => '', - 'settings-link-text' => 'Settings', - ), - - 'astra-widgets' => - array( - 'plugin-name' => __( 'Astra Widgets', 'astra' ), - 'plugin-init' => 'astra-widgets/astra-widgets.php', - 'settings-link' => admin_url( 'widgets.php' ), - 'settings-link-text' => 'Settings', - ), - - 'custom-fonts' => - array( - 'plugin-name' => __( 'Custom Fonts', 'astra' ), - 'plugin-init' => 'custom-fonts/custom-fonts.php', - 'settings-link' => admin_url( 'edit-tags.php?taxonomy=bsf_custom_fonts' ), - 'settings-link-text' => 'Settings', - ), - - 'custom-typekit-fonts' => - array( - 'plugin-name' => __( 'Custom Typekit Fonts', 'astra' ), - 'plugin-init' => 'custom-typekit-fonts/custom-typekit-fonts.php', - 'settings-link' => admin_url( 'themes.php?page=custom-typekit-fonts' ), - 'settings-link-text' => 'Settings', - ), - - 'sidebar-manager' => - array( - 'plugin-name' => __( 'Sidebar Manager', 'astra' ), - 'plugin-init' => 'sidebar-manager/sidebar-manager.php', - 'settings-link' => admin_url( 'edit.php?post_type=bsf-sidebar' ), - 'settings-link-text' => 'Settings', - ), - - 'ultimate-addons-for-gutenberg' => - array( - 'plugin-name' => __( 'Ultimate Addons for Gutenberg', 'astra' ), - 'plugin-init' => 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php', - 'settings-link' => admin_url( 'options-general.php?page=uag' ), - 'settings-link-text' => 'Settings', - 'display' => function_exists( 'register_block_type' ), - ), - ) - ); - - if ( apply_filters( 'astra_show_free_extend_plugins', true ) ) { - ?> - -
-

-

-
- -
- -
- -
-
- - false, - 'message' => __( 'No plugin specified', 'astra' ), - ) - ); - } - - $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : ''; - - $activate = activate_plugin( $plugin_init, '', false, true ); - - if ( '/astra-pro-sites/astra-pro-sites.php' === $plugin_init || '/astra-sites/astra-sites.php' === $plugin_init ) { - self::get_starter_templates_slug(); - } - - if ( is_wp_error( $activate ) ) { - wp_send_json_error( - array( - 'success' => false, - 'message' => $activate->get_error_message(), - 'starter_template_slug' => self::$starter_templates_slug, - ) - ); - } - - wp_send_json_success( - array( - 'success' => true, - 'message' => __( 'Plugin Successfully Activated', 'astra' ), - 'starter_template_slug' => self::$starter_templates_slug, - ) - ); - } - - /** - * Required Plugin Activate - * - * @since 1.2.4 - */ - public static function required_plugin_deactivate() { - - $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : ''; - - if ( false === wp_verify_nonce( $nonce, 'astra-recommended-plugin-nonce' ) ) { - wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'astra' ) ); - } - - if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) { - wp_send_json_error( - array( - 'success' => false, - 'message' => __( 'No plugin specified', 'astra' ), - ) - ); - } - - $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : ''; - - $deactivate = deactivate_plugins( $plugin_init, '', false ); - - if ( is_wp_error( $deactivate ) ) { - wp_send_json_error( - array( - 'success' => false, - 'message' => $deactivate->get_error_message(), - ) - ); - } - - wp_send_json_success( - array( - 'success' => true, - 'message' => __( 'Plugin Successfully Deactivated', 'astra' ), - ) - ); - - } - - /** - * Astra Header Right Section Links - * - * @since 1.2.4 - */ - public static function top_header_right_section() { - - $top_links = apply_filters( - 'astra_header_top_links', - array( - 'astra-theme-info' => array( - 'title' => 'Astra Lightning Speed' . __( ' Lightning Fast & Fully Customizable WordPress theme!', 'astra' ), - ), - ) - ); - - if ( ! empty( $top_links ) ) { - ?> - - - #menu-appearance a[href^="edit.php?post_type=astra-"]:before, - #menu-appearance a[href^="themes.php?page=astra-"]:before, - #menu-appearance a[href^="edit.php?post_type=astra_"]:before, - #menu-appearance a[href^="edit-tags.php?taxonomy=bsf_custom_fonts"]:before, - #menu-appearance a[href^="themes.php?page=custom-typekit-fonts"]:before, - #menu-appearance a[href^="edit.php?post_type=bsf-sidebar"]:before { - content: "\21B3"; - margin-right: 0.5em; - opacity: 0.5; - } - '; - - } - } - - new Astra_Admin_Settings(); -} + 'astra-sites-on-active', + 'type' => 'info', + 'message' => sprintf( + '
+
+
+

+ %2$s +

+

%3$s

+ +
', + $image_path, + __( 'Thank you for installing Adélie Linux WordPress Theme!', 'astra' ), + __( 'Did you know Astra comes with dozens of ready-to-use starter templates? Install the Starter Templates plugin to get started.', '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'] ) + ), + '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 + ); + } + } + + /** + * 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 ); + } + } + + /** + * Enqueue Astra Notices CSS. + * + * @since 2.0.0 + * + * @return void + */ + public static function notice_assets() { + if ( is_rtl() ) { + wp_enqueue_style( 'astra-notices-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-notices-rtl.css', array(), ASTRA_THEME_VERSION ); + } else { + wp_enqueue_style( 'astra-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['button_text'] = __( 'See Library »', 'astra' ); + $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['button_text'] = __( 'Activate Importer Plugin', 'astra' ); + $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['button_text'] = __( 'Activate Importer Plugin', 'astra' ); + $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['button_text'] = __( 'Install Importer Plugin', 'astra' ); + $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['button_text'] = __( 'See Library »', 'astra' ); + $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; + + if ( in_array( $post_type, (array) $post_types ) ) { + + echo ''; + } + } + /* Add CSS for the Submenu for BSF plugins added in Appearance Menu */ + + if ( ! is_customize_preview() ) { + + if ( ! current_user_can( 'manage_options' ) ) { + return; + } + + wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false ); + + $localize = array( + 'ajaxUrl' => admin_url( 'admin-ajax.php' ), + 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '…', + 'astraSitesLink' => admin_url( 'themes.php?page=' ), + 'astraSitesLinkTitle' => __( 'See Library »', 'astra' ), + 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '…', + 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '…', + 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ), + 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ), + 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ), + 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ), + ); + + wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) ); + } + } + + /** + * Enqueues the needed CSS/JS for the builder's admin settings page. + * + * @since 1.0 + */ + public static function styles_scripts() { + + // Styles. + if ( is_rtl() ) { + wp_enqueue_style( 'astra-admin-settings-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings-rtl.css', array(), ASTRA_THEME_VERSION ); + } else { + wp_enqueue_style( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings.css', array(), ASTRA_THEME_VERSION ); + } + + if ( ! current_user_can( 'manage_options' ) ) { + return; + } + + wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false ); + + $localize = array( + 'ajaxUrl' => admin_url( 'admin-ajax.php' ), + 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '…', + 'astraSitesLink' => admin_url( 'themes.php?page=' ), + 'astraSitesLinkTitle' => __( 'See Library »', 'astra' ), + 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '…', + 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '…', + 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ), + 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ), + 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ), + 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ), + 'ajax_nonce' => wp_create_nonce( 'astra-builder-module-nonce' ), + 'old_header_footer' => __( 'Use Old Header/Footer', 'astra' ), + 'migrate_to_builder' => __( 'Use New Header/Footer Builder', 'astra' ), + ); + wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) ); + + // Script. + wp_enqueue_script( 'astra-admin-settings' ); + + if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) { + // For starter site plugin popup detail "Details »" on Astra Options page. + wp_enqueue_script( 'plugin-install' ); + wp_enqueue_script( 'thickbox' ); + wp_enqueue_style( 'thickbox' ); + } + } + + + /** + * 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 = self::$default_menu_position; + + if ( strpos( $parent_page, '?' ) !== false ) { + $query_var = '&page=' . self::$plugin_slug; + } else { + $query_var = '?page=' . self::$plugin_slug; + } + + $parent_page_url = admin_url( $parent_page . $query_var ); + + $url = $parent_page_url . '&action=' . $menu_slug; + + return esc_url( $url ); + } + + /** + * Add main menu + * + * @since 1.0 + */ + public static function add_admin_menu() { + + $parent_page = self::$default_menu_position; + $page_title = self::$menu_page_title; + $capability = 'manage_options'; + $page_menu_slug = self::$plugin_slug; + $page_menu_func = __CLASS__ . '::menu_callback'; + + if ( apply_filters( 'astra_dashboard_admin_menu', true ) ) { + add_theme_page( $page_title, $page_title, $capability, $page_menu_slug, $page_menu_func ); + } else { + do_action( 'asta_register_admin_menu', $parent_page, $page_title, $capability, $page_menu_slug, $page_menu_func ); + } + } + + /** + * Menu callback + * + * @since 1.0 + */ + public static function menu_callback() { + + $current_slug = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : self::$current_slug; // phpcs:ignore WordPress.Security.NonceVerification.Recommended + + $current_slug = str_replace( '-', '_', $current_slug ); + + $ast_icon = apply_filters( 'astra_page_top_icon', true ); + $ast_visit_site_url = apply_filters( 'astra_site_url', 'https://www.adelielinux.org/' ); + $ast_wrapper_class = apply_filters( 'astra_welcome_wrapper_class', array( $current_slug ) ); + + ?> +
+
+
+ + + + +
+
+ + +
+ + +
+

+ +

+
+ +
+
+ + array( + 'title' => __( 'Header Options', 'astra' ), + 'dashicon' => 'dashicons-align-center', + 'quick_url' => admin_url( 'customize.php?autofocus[panel]=panel-header-group' ), + ), + 'logo-favicon' => array( + 'title' => __( 'Upload Logo', 'astra' ), + 'dashicon' => 'dashicons-format-image', + 'quick_url' => admin_url( 'customize.php?autofocus[control]=custom_logo' ), + ), + 'footer' => array( + 'title' => __( 'Footer Settings', 'astra' ), + 'dashicon' => 'dashicons-align-wide', + 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-footer-group' ), + ), + 'colors' => array( + 'title' => __( 'Set Colors', 'astra' ), + 'dashicon' => 'dashicons-admin-customizer', + 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-colors-background' ), + ), + 'layout' => array( + 'title' => __( 'Layout Options', 'astra' ), + 'dashicon' => 'dashicons-layout', + 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-container-layout' ), + ), + 'typography' => array( + 'title' => __( 'Customize Fonts', 'astra' ), + 'dashicon' => 'dashicons-editor-textcolor', + 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-typography' ), + ), + 'blog-layout' => array( + 'title' => __( 'Blog Layouts', 'astra' ), + 'dashicon' => 'dashicons-welcome-write-blog', + 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-blog-group' ), + ), + 'sidebars' => array( + 'title' => __( 'Sidebar Options', 'astra' ), + 'dashicon' => 'dashicons-align-left', + 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-sidebars' ), + ), + ) + ); + + $extensions = apply_filters( + 'astra_addon_list', + array( + ) + ); + ?> +
+

+
+ + + +
+
+ + false, + 'message' => __( 'No plugin specified', 'astra' ), + ) + ); + } + + $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : ''; + + $activate = activate_plugin( $plugin_init, '', false, true ); + + if ( '/astra-pro-sites/astra-pro-sites.php' === $plugin_init || '/astra-sites/astra-sites.php' === $plugin_init ) { + self::get_starter_templates_slug(); + } + + if ( is_wp_error( $activate ) ) { + wp_send_json_error( + array( + 'success' => false, + 'message' => $activate->get_error_message(), + 'starter_template_slug' => self::$starter_templates_slug, + ) + ); + } + + wp_send_json_success( + array( + 'success' => true, + 'message' => __( 'Plugin Successfully Activated', 'astra' ), + 'starter_template_slug' => self::$starter_templates_slug, + ) + ); + } + + /** + * Required Plugin Activate + * + * @since 1.2.4 + */ + public static function required_plugin_deactivate() { + + $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : ''; + + if ( false === wp_verify_nonce( $nonce, 'astra-recommended-plugin-nonce' ) ) { + wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'astra' ) ); + } + + if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) { + wp_send_json_error( + array( + 'success' => false, + 'message' => __( 'No plugin specified', 'astra' ), + ) + ); + } + + $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : ''; + + $deactivate = deactivate_plugins( $plugin_init, '', false ); + + if ( is_wp_error( $deactivate ) ) { + wp_send_json_error( + array( + 'success' => false, + 'message' => $deactivate->get_error_message(), + ) + ); + } + + wp_send_json_success( + array( + 'success' => true, + 'message' => __( 'Plugin Successfully Deactivated', 'astra' ), + ) + ); + + } + + /** + * Astra Header Right Section Links + * + * @since 1.2.4 + */ + public static function top_header_right_section() { + + if ( ! empty( $top_links ) ) { + ?> + + + #menu-appearance a[href^="edit.php?post_type=astra-"]:before, + #menu-appearance a[href^="themes.php?page=astra-"]:before, + #menu-appearance a[href^="edit.php?post_type=astra_"]:before, + #menu-appearance a[href^="edit-tags.php?taxonomy=bsf_custom_fonts"]:before, + #menu-appearance a[href^="themes.php?page=custom-typekit-fonts"]:before, + #menu-appearance a[href^="edit.php?post_type=bsf-sidebar"]:before { + content: "\21B3"; + margin-right: 0.5em; + opacity: 0.5; + } + '; + + } + } + + new Astra_Admin_Settings(); +} diff --git a/inc/core/class-astra-attr.php b/inc/core/class-astra-attr.php index 2f55e46..9154c47 100644 --- a/inc/core/class-astra-attr.php +++ b/inc/core/class-astra-attr.php @@ -1,115 +1,115 @@ -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(); +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(); diff --git a/inc/core/class-astra-enqueue-scripts.php b/inc/core/class-astra-enqueue-scripts.php index c249445..9772037 100644 --- a/inc/core/class-astra-enqueue-scripts.php +++ b/inc/core/class-astra-enqueue-scripts.php @@ -1,389 +1,389 @@ - - - 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 ( ( ( '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; - } - - $post_id = get_the_ID(); - - if ( $post_id ) { - $meta_content_layout = get_post_meta( $post_id, 'site-content-layout', true ); - } - - if ( ( isset( $meta_content_layout ) && ! empty( $meta_content_layout ) ) && 'default' !== $meta_content_layout ) { - $content_layout = $meta_content_layout; - } else { - $content_layout = astra_get_option( 'site-content-layout' ); - } - - 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'; - } - - $site_layout = astra_get_option( 'site-layout' ); - if ( 'ast-box-layout' === $site_layout ) { - $classes .= ' ast-max-width-layout'; - } - - $classes .= ' ast-' . astra_page_layout(); - - 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 ( Astra_Builder_Helper::is_component_loaded( 'edd-cart', 'header' ) || - Astra_Builder_Helper::is_component_loaded( 'woo-cart', 'header' ) ) { - $default_assets['js']['astra-mobile-cart'] = 'mobile-cart'; - } - } - 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/' . $dir_name . '/'; - - /** - * 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' . $file_prefix . '.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 . $file_prefix . '.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/' . $dir_name . '/menu-animation' . $rtl . $file_prefix . '.css' ); - } else { - wp_register_style( 'astra-menu-animation', $css_uri . 'menu-animation' . $file_prefix . '.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 ); - } - } - - $astra_localize = array( - 'break_point' => astra_header_break_point(), // Header Break Point. - 'isRtl' => is_rtl(), - ); - - wp_localize_script( 'astra-theme-js', 'astra', apply_filters( 'astra_theme_js_localize', $astra_localize ) ); - } - - /** - * 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'; - } - - $css_uri = ASTRA_THEME_URI . 'inc/assets/css/block-editor-styles' . $rtl . '.css'; - $js_uri = ASTRA_THEME_URI . 'inc/assets/js/block-editor-script.js'; - - wp_enqueue_style( 'astra-block-editor-styles', $css_uri, false, ASTRA_THEME_VERSION, 'all' ); - wp_enqueue_script( 'astra-block-editor-script', $js_uri, false, ASTRA_THEME_VERSION, 'all' ); - - // Render fonts in Gutenberg layout. - Astra_Fonts::render_fonts(); - - wp_add_inline_style( 'astra-block-editor-styles', apply_filters( 'astra_block_editor_dynamic_css', Gutenberg_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(); -} + + + 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 ( ( ( '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; + } + + $post_id = get_the_ID(); + + if ( $post_id ) { + $meta_content_layout = get_post_meta( $post_id, 'site-content-layout', true ); + } + + if ( ( isset( $meta_content_layout ) && ! empty( $meta_content_layout ) ) && 'default' !== $meta_content_layout ) { + $content_layout = $meta_content_layout; + } else { + $content_layout = astra_get_option( 'site-content-layout' ); + } + + 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'; + } + + $site_layout = astra_get_option( 'site-layout' ); + if ( 'ast-box-layout' === $site_layout ) { + $classes .= ' ast-max-width-layout'; + } + + $classes .= ' ast-' . astra_page_layout(); + + 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 ( Astra_Builder_Helper::is_component_loaded( 'edd-cart', 'header' ) || + Astra_Builder_Helper::is_component_loaded( 'woo-cart', 'header' ) ) { + $default_assets['js']['astra-mobile-cart'] = 'mobile-cart'; + } + } + 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/' . $dir_name . '/'; + + /** + * 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' . $file_prefix . '.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 . $file_prefix . '.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/' . $dir_name . '/menu-animation' . $rtl . $file_prefix . '.css' ); + } else { + wp_register_style( 'astra-menu-animation', $css_uri . 'menu-animation' . $file_prefix . '.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 ); + } + } + + $astra_localize = array( + 'break_point' => astra_header_break_point(), // Header Break Point. + 'isRtl' => is_rtl(), + ); + + wp_localize_script( 'astra-theme-js', 'astra', apply_filters( 'astra_theme_js_localize', $astra_localize ) ); + } + + /** + * 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'; + } + + $css_uri = ASTRA_THEME_URI . 'inc/assets/css/block-editor-styles' . $rtl . '.css'; + $js_uri = ASTRA_THEME_URI . 'inc/assets/js/block-editor-script.js'; + + wp_enqueue_style( 'astra-block-editor-styles', $css_uri, false, ASTRA_THEME_VERSION, 'all' ); + wp_enqueue_script( 'astra-block-editor-script', $js_uri, false, ASTRA_THEME_VERSION, 'all' ); + + // Render fonts in Gutenberg layout. + Astra_Fonts::render_fonts(); + + wp_add_inline_style( 'astra-block-editor-styles', apply_filters( 'astra_block_editor_dynamic_css', Gutenberg_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(); +} diff --git a/inc/core/class-astra-theme-options.php b/inc/core/class-astra-theme-options.php index 3521399..3bac1e6 100644 --- a/inc/core/class-astra-theme-options.php +++ b/inc/core/class-astra-theme-options.php @@ -1,530 +1,530 @@ - array( - 'single-image', - 'single-title-meta', - ), - - 'blog-single-width' => 'default', - 'blog-single-max-width' => 1200, - 'blog-single-meta' => array( - 'comments', - 'category', - 'author', - ), - // Blog. - 'blog-post-structure' => array( - 'image', - 'title-meta', - ), - 'blog-width' => 'default', - 'blog-max-width' => 1200, - 'blog-post-content' => 'excerpt', - 'blog-meta' => array( - 'comments', - 'category', - 'author', - ), - // Colors. - 'text-color' => '#3a3a3a', - 'link-color' => '#0170B9', - 'theme-color' => '#0170B9', - 'link-h-color' => '#3a3a3a', - - // Footer Bar Background. - 'footer-bg-obj' => array( - 'background-color' => '', - 'background-image' => '', - 'background-repeat' => 'repeat', - 'background-position' => 'center center', - 'background-size' => 'auto', - 'background-attachment' => 'scroll', - 'background-type' => '', - 'background-media' => '', - ), - 'footer-color' => '', - 'footer-link-color' => '', - 'footer-link-h-color' => '', - - // Footer Widgets Background. - 'footer-adv-bg-obj' => array( - 'background-color' => '', - 'background-image' => '', - 'background-repeat' => 'repeat', - 'background-position' => 'center center', - 'background-size' => 'auto', - 'background-attachment' => 'scroll', - 'background-type' => '', - 'background-media' => '', - ), - 'footer-adv-text-color' => '', - 'footer-adv-link-color' => '', - 'footer-adv-link-h-color' => '', - 'footer-adv-wgt-title-color' => '', - - // Buttons. - 'button-color' => '', - 'button-h-color' => '', - 'button-bg-color' => '', - 'button-bg-h-color' => '', - 'theme-button-padding' => array( - 'desktop' => array( - 'top' => $apply_new_default_values ? 15 : 10, - 'right' => $apply_new_default_values ? 30 : 40, - 'bottom' => $apply_new_default_values ? 15 : 10, - 'left' => $apply_new_default_values ? 30 : 40, - ), - 'tablet' => array( - 'top' => $apply_new_default_values ? 14 : '', - 'right' => $apply_new_default_values ? 28 : '', - 'bottom' => $apply_new_default_values ? 14 : '', - 'left' => $apply_new_default_values ? 28 : '', - ), - 'mobile' => array( - 'top' => $apply_new_default_values ? 12 : '', - 'right' => $apply_new_default_values ? 24 : '', - 'bottom' => $apply_new_default_values ? 12 : '', - 'left' => $apply_new_default_values ? 24 : '', - ), - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - 'button-radius' => 2, - 'theme-button-border-group-border-size' => array( - 'top' => '', - 'right' => '', - 'bottom' => '', - 'left' => '', - ), - // Footer - Small. - 'footer-sml-layout' => 'footer-sml-layout-1', - 'footer-sml-section-1' => 'custom', - 'footer-sml-section-1-credit' => __( 'Copyright © [current_year] [site_title] | Powered by [theme_author]', 'astra' ), - 'footer-sml-section-2' => '', - 'footer-sml-section-2-credit' => __( 'Copyright © [current_year] [site_title] | Powered by [theme_author]', 'astra' ), - 'footer-sml-dist-equal-align' => true, - 'footer-sml-divider' => 1, - 'footer-sml-divider-color' => '#7a7a7a', - 'footer-layout-width' => 'content', - // General. - 'ast-header-retina-logo' => '', - 'ast-header-logo-width' => '', - 'ast-header-responsive-logo-width' => array( - 'desktop' => '', - 'tablet' => '', - 'mobile' => '', - ), - 'header-color-site-title' => '', - 'header-color-h-site-title' => '', - 'header-color-site-tagline' => '', - 'display-site-title-responsive' => array( - 'desktop' => 1, - 'tablet' => 1, - 'mobile' => 1, - ), - 'display-site-tagline-responsive' => array( - 'desktop' => 0, - 'tablet' => 0, - 'mobile' => 0, - ), - 'logo-title-inline' => 1, - // Header - Primary. - 'disable-primary-nav' => false, - 'header-layouts' => 'header-main-layout-1', - 'header-main-rt-section' => 'none', - 'header-display-outside-menu' => false, - 'header-main-rt-section-html' => '', - 'header-main-rt-section-button-text' => __( 'Button', 'astra' ), - 'header-main-rt-section-button-link' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ), - 'header-main-rt-section-button-link-option' => array( - 'url' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ), - 'new_tab' => false, - 'link_rel' => '', - ), - 'header-main-rt-section-button-style' => 'theme-button', - 'header-main-rt-section-button-text-color' => '', - 'header-main-rt-section-button-back-color' => '', - 'header-main-rt-section-button-text-h-color' => '', - 'header-main-rt-section-button-back-h-color' => '', - 'header-main-rt-section-button-padding' => array( - 'desktop' => array( - 'top' => '', - 'right' => '', - 'bottom' => '', - 'left' => '', - ), - 'tablet' => array( - 'top' => '', - 'right' => '', - 'bottom' => '', - 'left' => '', - ), - 'mobile' => array( - 'top' => '', - 'right' => '', - 'bottom' => '', - 'left' => '', - ), - ), - 'header-main-rt-section-button-border-size' => array( - 'top' => '', - 'right' => '', - 'bottom' => '', - 'left' => '', - ), - 'header-main-sep' => 1, - 'header-main-sep-color' => '', - 'header-main-layout-width' => 'content', - // Header - Sub menu Border. - 'primary-submenu-border' => array( - 'top' => '2', - 'right' => '0', - 'bottom' => '0', - 'left' => '0', - ), - 'primary-submenu-item-border' => false, - 'primary-submenu-b-color' => '', - 'primary-submenu-item-b-color' => '', - - // Primary header button typo options. - 'primary-header-button-font-family' => 'inherit', - 'primary-header-button-font-weight' => 'inherit', - 'primary-header-button-font-size' => array( - 'desktop' => '', - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - 'primary-header-button-text-transform' => '', - 'primary-header-button-line-height' => 1, - 'primary-header-button-letter-spacing' => '', - - 'header-main-menu-label' => '', - 'header-main-menu-align' => 'inline', - 'header-main-submenu-container-animation' => '', - 'mobile-header-breakpoint' => '', - 'mobile-header-logo' => '', - 'mobile-header-logo-width' => '', - // Site Layout. - 'site-layout' => 'ast-full-width-layout', - 'site-content-width' => 1200, - 'site-layout-outside-bg-obj-responsive' => array( - 'desktop' => array( - 'background-color' => '', - 'background-image' => '', - 'background-repeat' => 'repeat', - 'background-position' => 'center center', - 'background-size' => 'auto', - 'background-attachment' => 'scroll', - 'background-type' => '', - 'background-media' => '', - ), - 'tablet' => array( - 'background-color' => '', - 'background-image' => '', - 'background-repeat' => 'repeat', - 'background-position' => 'center center', - 'background-size' => 'auto', - 'background-attachment' => 'scroll', - 'background-type' => '', - 'background-media' => '', - ), - 'mobile' => array( - 'background-color' => '', - 'background-image' => '', - 'background-repeat' => 'repeat', - 'background-position' => 'center center', - 'background-size' => 'auto', - 'background-attachment' => 'scroll', - 'background-type' => '', - 'background-media' => '', - ), - ), - // Container. - 'site-content-layout' => 'content-boxed-container', - 'single-page-content-layout' => 'default', - 'single-post-content-layout' => 'default', - 'archive-post-content-layout' => 'default', - // Typography. - 'body-font-family' => 'inherit', - 'body-font-variant' => '', - 'body-font-weight' => 'inherit', - 'font-size-body' => array( - 'desktop' => 15, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - - 'body-line-height' => '', - 'para-margin-bottom' => '', - 'underline-content-links' => true, - 'body-text-transform' => '', - 'headings-font-family' => 'inherit', - 'headings-font-weight' => 'inherit', - 'headings-text-transform' => '', - 'headings-line-height' => '', - 'font-size-site-title' => array( - 'desktop' => 35, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - 'font-size-site-tagline' => array( - 'desktop' => 15, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - 'font-size-entry-title' => array( - 'desktop' => 30, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - 'font-size-archive-summary-title' => array( - 'desktop' => 40, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - 'font-size-page-title' => array( - 'desktop' => 30, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - 'font-size-h1' => array( - 'desktop' => 40, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - 'font-size-h2' => array( - 'desktop' => 30, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - 'font-size-h3' => array( - 'desktop' => 25, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - 'font-size-h4' => array( - 'desktop' => 20, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - 'font-size-h5' => array( - 'desktop' => 18, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - 'font-size-h6' => array( - 'desktop' => 15, - 'tablet' => '', - 'mobile' => '', - 'desktop-unit' => 'px', - 'tablet-unit' => 'px', - 'mobile-unit' => 'px', - ), - - // Sidebar. - 'site-sidebar-layout' => 'right-sidebar', - 'site-sidebar-width' => 30, - 'single-page-sidebar-layout' => 'default', - 'single-post-sidebar-layout' => 'default', - 'archive-post-sidebar-layout' => 'default', - - // Sidebar. - 'footer-adv' => 'disabled', - 'footer-adv-border-width' => '', - 'footer-adv-border-color' => '#7a7a7a', - - // toogle menu style. - 'mobile-header-toggle-btn-style' => 'minimal', - 'hide-custom-menu-mobile' => 1, - - // toogle menu target. - 'mobile-header-toggle-target' => 'icon', - - // Performance. - 'load-google-fonts-locally' => false, - 'preload-local-fonts' => false, - ) - ); - - return self::$defaults; - } - - /** - * Get theme options from static array() - * - * @return array Return array of theme options. - */ - public static function get_options() { - return self::$db_options; - } - - /** - * Update theme static option array. - */ - public static function refresh() { - self::$db_options = wp_parse_args( - self::get_db_options(), - self::defaults() - ); - } - - /** - * Get theme options from static array() from database - * - * @return array Return array of theme options from database. - */ - public static function get_db_options() { - self::$db_options_no_defaults = get_option( ASTRA_THEME_SETTINGS ); - return self::$db_options_no_defaults; - } - } -} -/** - * Kicking this off by calling 'get_instance()' method - */ -Astra_Theme_Options::get_instance(); + array( + 'single-image', + 'single-title-meta', + ), + + 'blog-single-width' => 'default', + 'blog-single-max-width' => 1200, + 'blog-single-meta' => array( + 'comments', + 'category', + 'author', + ), + // Blog. + 'blog-post-structure' => array( + 'image', + 'title-meta', + ), + 'blog-width' => 'default', + 'blog-max-width' => 1200, + 'blog-post-content' => 'excerpt', + 'blog-meta' => array( + 'comments', + 'category', + 'author', + ), + // Colors. + 'text-color' => '#3a3a3a', + 'link-color' => '#0170B9', + 'theme-color' => '#0170B9', + 'link-h-color' => '#3a3a3a', + + // Footer Bar Background. + 'footer-bg-obj' => array( + 'background-color' => '', + 'background-image' => '', + 'background-repeat' => 'repeat', + 'background-position' => 'center center', + 'background-size' => 'auto', + 'background-attachment' => 'scroll', + 'background-type' => '', + 'background-media' => '', + ), + 'footer-color' => '', + 'footer-link-color' => '', + 'footer-link-h-color' => '', + + // Footer Widgets Background. + 'footer-adv-bg-obj' => array( + 'background-color' => '', + 'background-image' => '', + 'background-repeat' => 'repeat', + 'background-position' => 'center center', + 'background-size' => 'auto', + 'background-attachment' => 'scroll', + 'background-type' => '', + 'background-media' => '', + ), + 'footer-adv-text-color' => '', + 'footer-adv-link-color' => '', + 'footer-adv-link-h-color' => '', + 'footer-adv-wgt-title-color' => '', + + // Buttons. + 'button-color' => '', + 'button-h-color' => '', + 'button-bg-color' => '', + 'button-bg-h-color' => '', + 'theme-button-padding' => array( + 'desktop' => array( + 'top' => $apply_new_default_values ? 15 : 10, + 'right' => $apply_new_default_values ? 30 : 40, + 'bottom' => $apply_new_default_values ? 15 : 10, + 'left' => $apply_new_default_values ? 30 : 40, + ), + 'tablet' => array( + 'top' => $apply_new_default_values ? 14 : '', + 'right' => $apply_new_default_values ? 28 : '', + 'bottom' => $apply_new_default_values ? 14 : '', + 'left' => $apply_new_default_values ? 28 : '', + ), + 'mobile' => array( + 'top' => $apply_new_default_values ? 12 : '', + 'right' => $apply_new_default_values ? 24 : '', + 'bottom' => $apply_new_default_values ? 12 : '', + 'left' => $apply_new_default_values ? 24 : '', + ), + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + 'button-radius' => 2, + 'theme-button-border-group-border-size' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + // Footer - Small. + 'footer-sml-layout' => 'footer-sml-layout-1', + 'footer-sml-section-1' => 'custom', + 'footer-sml-section-1-credit' => __( 'Copyright © [current_year] [site_title] | Powered by [theme_author]', 'astra' ), + 'footer-sml-section-2' => '', + 'footer-sml-section-2-credit' => __( 'Copyright © [current_year] [site_title] | Powered by [theme_author]', 'astra' ), + 'footer-sml-dist-equal-align' => true, + 'footer-sml-divider' => 1, + 'footer-sml-divider-color' => '#7a7a7a', + 'footer-layout-width' => 'content', + // General. + 'ast-header-retina-logo' => '', + 'ast-header-logo-width' => '', + 'ast-header-responsive-logo-width' => array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ), + 'header-color-site-title' => '', + 'header-color-h-site-title' => '', + 'header-color-site-tagline' => '', + 'display-site-title-responsive' => array( + 'desktop' => 1, + 'tablet' => 1, + 'mobile' => 1, + ), + 'display-site-tagline-responsive' => array( + 'desktop' => 0, + 'tablet' => 0, + 'mobile' => 0, + ), + 'logo-title-inline' => 1, + // Header - Primary. + 'disable-primary-nav' => false, + 'header-layouts' => 'header-main-layout-1', + 'header-main-rt-section' => 'none', + 'header-display-outside-menu' => false, + 'header-main-rt-section-html' => '', + 'header-main-rt-section-button-text' => __( 'Button', 'astra' ), + 'header-main-rt-section-button-link' => apply_filters( 'astra_site_url', 'https://www.adelielinux.org/' ), + 'header-main-rt-section-button-link-option' => array( + 'url' => apply_filters( 'astra_site_url', 'https://www.adelielinux.org/' ), + 'new_tab' => false, + 'link_rel' => '', + ), + 'header-main-rt-section-button-style' => 'theme-button', + 'header-main-rt-section-button-text-color' => '', + 'header-main-rt-section-button-back-color' => '', + 'header-main-rt-section-button-text-h-color' => '', + 'header-main-rt-section-button-back-h-color' => '', + 'header-main-rt-section-button-padding' => array( + 'desktop' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + 'tablet' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + 'mobile' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + ), + 'header-main-rt-section-button-border-size' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + 'header-main-sep' => 1, + 'header-main-sep-color' => '', + 'header-main-layout-width' => 'content', + // Header - Sub menu Border. + 'primary-submenu-border' => array( + 'top' => '2', + 'right' => '0', + 'bottom' => '0', + 'left' => '0', + ), + 'primary-submenu-item-border' => false, + 'primary-submenu-b-color' => '', + 'primary-submenu-item-b-color' => '', + + // Primary header button typo options. + 'primary-header-button-font-family' => 'inherit', + 'primary-header-button-font-weight' => 'inherit', + 'primary-header-button-font-size' => array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + 'primary-header-button-text-transform' => '', + 'primary-header-button-line-height' => 1, + 'primary-header-button-letter-spacing' => '', + + 'header-main-menu-label' => '', + 'header-main-menu-align' => 'inline', + 'header-main-submenu-container-animation' => '', + 'mobile-header-breakpoint' => '', + 'mobile-header-logo' => '', + 'mobile-header-logo-width' => '', + // Site Layout. + 'site-layout' => 'ast-full-width-layout', + 'site-content-width' => 1200, + 'site-layout-outside-bg-obj-responsive' => array( + 'desktop' => array( + 'background-color' => '', + 'background-image' => '', + 'background-repeat' => 'repeat', + 'background-position' => 'center center', + 'background-size' => 'auto', + 'background-attachment' => 'scroll', + 'background-type' => '', + 'background-media' => '', + ), + 'tablet' => array( + 'background-color' => '', + 'background-image' => '', + 'background-repeat' => 'repeat', + 'background-position' => 'center center', + 'background-size' => 'auto', + 'background-attachment' => 'scroll', + 'background-type' => '', + 'background-media' => '', + ), + 'mobile' => array( + 'background-color' => '', + 'background-image' => '', + 'background-repeat' => 'repeat', + 'background-position' => 'center center', + 'background-size' => 'auto', + 'background-attachment' => 'scroll', + 'background-type' => '', + 'background-media' => '', + ), + ), + // Container. + 'site-content-layout' => 'content-boxed-container', + 'single-page-content-layout' => 'default', + 'single-post-content-layout' => 'default', + 'archive-post-content-layout' => 'default', + // Typography. + 'body-font-family' => 'inherit', + 'body-font-variant' => '', + 'body-font-weight' => 'inherit', + 'font-size-body' => array( + 'desktop' => 15, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + + 'body-line-height' => '', + 'para-margin-bottom' => '', + 'underline-content-links' => true, + 'body-text-transform' => '', + 'headings-font-family' => 'inherit', + 'headings-font-weight' => 'inherit', + 'headings-text-transform' => '', + 'headings-line-height' => '', + 'font-size-site-title' => array( + 'desktop' => 35, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + 'font-size-site-tagline' => array( + 'desktop' => 15, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + 'font-size-entry-title' => array( + 'desktop' => 30, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + 'font-size-archive-summary-title' => array( + 'desktop' => 40, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + 'font-size-page-title' => array( + 'desktop' => 30, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + 'font-size-h1' => array( + 'desktop' => 40, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + 'font-size-h2' => array( + 'desktop' => 30, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + 'font-size-h3' => array( + 'desktop' => 25, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + 'font-size-h4' => array( + 'desktop' => 20, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + 'font-size-h5' => array( + 'desktop' => 18, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + 'font-size-h6' => array( + 'desktop' => 15, + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ), + + // Sidebar. + 'site-sidebar-layout' => 'right-sidebar', + 'site-sidebar-width' => 30, + 'single-page-sidebar-layout' => 'default', + 'single-post-sidebar-layout' => 'default', + 'archive-post-sidebar-layout' => 'default', + + // Sidebar. + 'footer-adv' => 'disabled', + 'footer-adv-border-width' => '', + 'footer-adv-border-color' => '#7a7a7a', + + // toogle menu style. + 'mobile-header-toggle-btn-style' => 'minimal', + 'hide-custom-menu-mobile' => 1, + + // toogle menu target. + 'mobile-header-toggle-target' => 'icon', + + // Performance. + 'load-google-fonts-locally' => false, + 'preload-local-fonts' => false, + ) + ); + + return self::$defaults; + } + + /** + * Get theme options from static array() + * + * @return array Return array of theme options. + */ + public static function get_options() { + return self::$db_options; + } + + /** + * Update theme static option array. + */ + public static function refresh() { + self::$db_options = wp_parse_args( + self::get_db_options(), + self::defaults() + ); + } + + /** + * Get theme options from static array() from database + * + * @return array Return array of theme options from database. + */ + public static function get_db_options() { + self::$db_options_no_defaults = get_option( ASTRA_THEME_SETTINGS ); + return self::$db_options_no_defaults; + } + } +} +/** + * Kicking this off by calling 'get_instance()' method + */ +Astra_Theme_Options::get_instance(); diff --git a/inc/core/class-astra-walker-page.php b/inc/core/class-astra-walker-page.php index b4d0082..ecaf99c 100644 --- a/inc/core/class-astra-walker-page.php +++ b/inc/core/class-astra-walker-page.php @@ -1,137 +1,137 @@ -{$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 = '' . $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 = ''; - } - } else { - if ( isset( $page->post_parent ) && 0 === $page->post_parent ) { - $mobile_icon = ''; - } - } - } - - 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 ) ); - - $args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before']; - $args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after']; - - $output .= sprintf( - '
  • %s%s%s%s%s', - $css_classes, - get_permalink( $page->ID ), - $args['link_before'], - apply_filters( 'the_title', $page->post_title, $page->ID ), - $args['link_after'], - $icon, - $mobile_icon - ); - } - } - -} +{$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 = '' . $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 = ''; + } + } else { + if ( isset( $page->post_parent ) && 0 === $page->post_parent ) { + $mobile_icon = ''; + } + } + } + + 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 ) ); + + $args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before']; + $args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after']; + + $output .= sprintf( + '
  • %s%s%s%s%s', + $css_classes, + get_permalink( $page->ID ), + $args['link_before'], + apply_filters( 'the_title', $page->post_title, $page->ID ), + $args['link_after'], + $icon, + $mobile_icon + ); + } + } + +} diff --git a/inc/core/class-gutenberg-editor-css.php b/inc/core/class-gutenberg-editor-css.php index c77182b..6a681b4 100644 --- a/inc/core/class-gutenberg-editor-css.php +++ b/inc/core/class-gutenberg-editor-css.php @@ -1,1116 +1,1116 @@ - array( - 'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 6.25, '%' ), - ), - '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-default-block-appender,.block-editor-block-list__block' => array( - 'max-width' => astra_get_css_value( $site_content_width, 'px' ), - ), - '.block-editor-block-list__block[data-align=wide]' => array( - 'max-width' => astra_get_css_value( $site_content_width + 200, 'px' ), - ), - '.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' => 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-size' => astra_responsive_font( $single_post_title_font_size, 'desktop' ), - '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, .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 .wp-block-heading, .edit-post-visual-editor .wp-block-uagb-advanced-heading h1, .edit-post-visual-editor .wp-block-uagb-advanced-heading h2, .edit-post-visual-editor .wp-block-uagb-advanced-heading h3, .edit-post-visual-editor .wp-block-uagb-advanced-heading h4, .edit-post-visual-editor .wp-block-uagb-advanced-heading h5, .edit-post-visual-editor .wp-block-uagb-advanced-heading h6' => 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. - '.edit-post-visual-editor .block-editor-block-list__block 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, .edit-post-visual-editor 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 ), - ), - '.edit-post-visual-editor .block-editor-block-list__block 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, .edit-post-visual-editor 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 ), - ), - '.edit-post-visual-editor .block-editor-block-list__block 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, .edit-post-visual-editor 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 ), - ), - '.edit-post-visual-editor .block-editor-block-list__block 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, .edit-post-visual-editor h4.block-editor-block-list__block' => array( - 'font-size' => astra_responsive_font( $heading_h4_font_size, 'desktop' ), - 'line-height' => esc_attr( $h4_line_height ), - ), - '.edit-post-visual-editor .block-editor-block-list__block 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, .edit-post-visual-editor h5.block-editor-block-list__block' => array( - 'font-size' => astra_responsive_font( $heading_h5_font_size, 'desktop' ), - 'line-height' => esc_attr( $h5_line_height ), - ), - '.edit-post-visual-editor .block-editor-block-list__block 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, .edit-post-visual-editor h6.block-editor-block-list__block' => array( - 'font-size' => astra_responsive_font( $heading_h6_font_size, 'desktop' ), - 'line-height' => esc_attr( $h6_line_height ), - ), - /** - * 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-radius' => astra_get_css_value( $btn_border_radius, 'px' ), - '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' ), - ), - ); - - if ( astra_wp_version_compare( '5.7', '>=' ) ) { - $base_background_color = astra_get_responsive_background_obj( $box_bg_obj, 'desktop' ); - if ( empty( $base_background_color ) ) { - $background_style_data = array( - 'background-color' => '#ffffff', - ); - } else { - $background_style_data = $base_background_color; - } - - $desktop_css['.edit-post-visual-editor'] = array( - 'padding' => '20px', - 'padding-top' => 'calc(2em + 20px)', - ); - $desktop_css['.ast-page-builder-template .edit-post-visual-editor'] = array( - 'padding' => '0', - 'padding-top' => '2em', - ); - $desktop_css['.ast-separate-container .editor-post-title'] = array( - 'margin-top' => '0', - ); - $desktop_css['.editor-styles-wrapper .block-editor-writing-flow'] = array( - 'height' => '100%', - 'padding' => '10px', - ); - $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-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 ( ( ( ! in_array( 'single-title-meta', $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', - ); - } - - $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' : ''; - - $button_desktop_css = array( - /** - * Gutenberg button compatibility for default styling. - */ - '.wp-block-button .wp-block-button__link' . $search_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' ), - 'font-size' => astra_responsive_font( $theme_btn_font_size, 'desktop' ), - 'border-radius' => astra_get_css_value( $btn_border_radius, 'px' ), - '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 => 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 ( $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 ); - - $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', - ), - ); - } - - $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 ); - } - - $tablet_css = array( - '.editor-post-title__block .editor-post-title__input' => array( - 'font-size' => astra_responsive_font( $single_post_title_font_size, 'tablet', 30 ), - ), - // 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( - '.editor-post-title__block .editor-post-title__input' => array( - 'font-size' => astra_responsive_font( $single_post_title_font_size, 'mobile', 30 ), - ), - - // 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, .ast-two-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' => 'calc( 5.34em - 19px)', - 'padding-bottom' => '5.34em', - 'padding-left' => 'calc( 6.67em - 28px )', - 'padding-right' => 'calc( 6.67em - 28px )', - ), - - '.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', - ), - ); - - $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' => 'calc( 2.34em - 19px)', - 'padding-left' => 'calc( 3.67em - 28px )', - 'padding-right' => 'calc( 3.67em - 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', - ), - ); - - $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"], .wp-block[data-align="center"]' => array( - 'max-width' => '100%', - 'width' => '100%', - ), - '.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', - ), - '.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', - ), - '.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', - ), - '.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' ), - ), - '.ast-plain-container .wp-block[data-align="wide"]' => array( - 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ), - ), - ); - } 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 ( 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 ); - - } - - return $css; - } - } - -endif; + array( + 'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 6.25, '%' ), + ), + '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-default-block-appender,.block-editor-block-list__block' => array( + 'max-width' => astra_get_css_value( $site_content_width, 'px' ), + ), + '.block-editor-block-list__block[data-align=wide]' => array( + 'max-width' => astra_get_css_value( $site_content_width + 200, 'px' ), + ), + '.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' => 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-size' => astra_responsive_font( $single_post_title_font_size, 'desktop' ), + '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, .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 .wp-block-heading, .edit-post-visual-editor .wp-block-uagb-advanced-heading h1, .edit-post-visual-editor .wp-block-uagb-advanced-heading h2, .edit-post-visual-editor .wp-block-uagb-advanced-heading h3, .edit-post-visual-editor .wp-block-uagb-advanced-heading h4, .edit-post-visual-editor .wp-block-uagb-advanced-heading h5, .edit-post-visual-editor .wp-block-uagb-advanced-heading h6' => 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. + '.edit-post-visual-editor .block-editor-block-list__block 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, .edit-post-visual-editor 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 ), + ), + '.edit-post-visual-editor .block-editor-block-list__block 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, .edit-post-visual-editor 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 ), + ), + '.edit-post-visual-editor .block-editor-block-list__block 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, .edit-post-visual-editor 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 ), + ), + '.edit-post-visual-editor .block-editor-block-list__block 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, .edit-post-visual-editor h4.block-editor-block-list__block' => array( + 'font-size' => astra_responsive_font( $heading_h4_font_size, 'desktop' ), + 'line-height' => esc_attr( $h4_line_height ), + ), + '.edit-post-visual-editor .block-editor-block-list__block 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, .edit-post-visual-editor h5.block-editor-block-list__block' => array( + 'font-size' => astra_responsive_font( $heading_h5_font_size, 'desktop' ), + 'line-height' => esc_attr( $h5_line_height ), + ), + '.edit-post-visual-editor .block-editor-block-list__block 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, .edit-post-visual-editor h6.block-editor-block-list__block' => array( + 'font-size' => astra_responsive_font( $heading_h6_font_size, 'desktop' ), + 'line-height' => esc_attr( $h6_line_height ), + ), + /** + * 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-radius' => astra_get_css_value( $btn_border_radius, 'px' ), + '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' ), + ), + ); + + if ( astra_wp_version_compare( '5.7', '>=' ) ) { + $base_background_color = astra_get_responsive_background_obj( $box_bg_obj, 'desktop' ); + if ( empty( $base_background_color ) ) { + $background_style_data = array( + 'background-color' => '#ffffff', + ); + } else { + $background_style_data = $base_background_color; + } + + $desktop_css['.edit-post-visual-editor'] = array( + 'padding' => '20px', + 'padding-top' => 'calc(2em + 20px)', + ); + $desktop_css['.ast-page-builder-template .edit-post-visual-editor'] = array( + 'padding' => '0', + 'padding-top' => '2em', + ); + $desktop_css['.ast-separate-container .editor-post-title'] = array( + 'margin-top' => '0', + ); + $desktop_css['.editor-styles-wrapper .block-editor-writing-flow'] = array( + 'height' => '100%', + 'padding' => '10px', + ); + $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-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 ( ( ( ! in_array( 'single-title-meta', $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', + ); + } + + $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' : ''; + + $button_desktop_css = array( + /** + * Gutenberg button compatibility for default styling. + */ + '.wp-block-button .wp-block-button__link' . $search_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' ), + 'font-size' => astra_responsive_font( $theme_btn_font_size, 'desktop' ), + 'border-radius' => astra_get_css_value( $btn_border_radius, 'px' ), + '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 => 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 ( $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 ); + + $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', + ), + ); + } + + $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 ); + } + + $tablet_css = array( + '.editor-post-title__block .editor-post-title__input' => array( + 'font-size' => astra_responsive_font( $single_post_title_font_size, 'tablet', 30 ), + ), + // 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( + '.editor-post-title__block .editor-post-title__input' => array( + 'font-size' => astra_responsive_font( $single_post_title_font_size, 'mobile', 30 ), + ), + + // 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, .ast-two-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' => 'calc( 5.34em - 19px)', + 'padding-bottom' => '5.34em', + 'padding-left' => 'calc( 6.67em - 28px )', + 'padding-right' => 'calc( 6.67em - 28px )', + ), + + '.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', + ), + ); + + $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' => 'calc( 2.34em - 19px)', + 'padding-left' => 'calc( 3.67em - 28px )', + 'padding-right' => 'calc( 3.67em - 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', + ), + ); + + $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"], .wp-block[data-align="center"]' => array( + 'max-width' => '100%', + 'width' => '100%', + ), + '.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', + ), + '.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', + ), + '.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', + ), + '.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' ), + ), + '.ast-plain-container .wp-block[data-align="wide"]' => array( + 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ), + ), + ); + } 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 ( 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 ); + + } + + return $css; + } + } + +endif; diff --git a/inc/core/class-theme-strings.php b/inc/core/class-theme-strings.php index 089de87..e5cd74b 100644 --- a/inc/core/class-theme-strings.php +++ b/inc/core/class-theme-strings.php @@ -1,108 +1,108 @@ - __( '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 »', 'astra' ), - '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 Page', 'astra' ) . ' ', - 'string-blog-navigation-previous' => ' ' . __( 'Previous Page', '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 Page', 'astra' ) . ' '; - $defaults['string-blog-navigation-previous'] = ' ' . __( 'Previous Page', '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; - } - } -} + __( '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 »', 'astra' ), + '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 Page', 'astra' ) . ' ', + 'string-blog-navigation-previous' => ' ' . __( 'Previous Page', '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 Page', 'astra' ) . ' '; + $defaults['string-blog-navigation-previous'] = ' ' . __( 'Previous Page', '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; + } + } +} diff --git a/inc/core/common-functions.php b/inc/core/common-functions.php index 3c9ae29..e7888ac 100644 --- a/inc/core/common-functions.php +++ b/inc/core/common-functions.php @@ -1,1526 +1,1526 @@ - 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 ) { - - if ( '' == $value && 0 !== $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. - */ -if ( ! function_exists( 'astra_get_option' ) ) { - - /** - * Return Theme options. - * - * @param string $option Option key. - * @param string $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 ); - } -} - -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. - $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 ( 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; - } - } - } -} - -/** - * 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 = ''; - $blog_post_title = astra_get_option( 'blog-post-structure' ); - $single_post_title = astra_get_option( 'blog-single-post-structure' ); - - if ( ( ! is_singular() && in_array( 'title-meta', $blog_post_title ) ) || ( is_single() && in_array( 'single-title-meta', $single_post_title ) ) || is_page() ) { - 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() ) { - - /* translators: 1: search string */ - $title = apply_filters( 'astra_the_search_page_title', sprintf( __( 'Search Results for: %s', 'astra' ), '' . get_search_query() . '' ) ); - - } 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; - } - } -} - -/** - * Archive Page Title - */ -if ( ! function_exists( 'astra_archive_page_info' ) ) { - - /** - * Wrapper function for the_title() - * - * Displays title only if the page title bar is disabled. - */ - function astra_archive_page_info() { - - if ( apply_filters( 'astra_the_title_enabled', true ) ) { - - // Author. - if ( is_author() ) { ?> - -
    -
    - -

    - -

    - -
    -
    - -
    -
    - - - -
    - -

    - - - -
    - - - -
    - -

    - - - -
    - - - -
    - - ' . get_search_query() . '' ) ); - ?> -

    - -
    - - - -
    - - ', '' ); ?> - - - -
    - - 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 boolean $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 $url URL fo the site. - * @param string $source utm source. - * @param string $medium utm medium. - * @param string $campaign utm campaign. - * @return mixed - */ - function astra_get_pro_url( $url, $source = '', $medium = '', $campaign = '' ) { - - $astra_pro_url = trailingslashit( $url ); - - // Set up our URL if we have a source. - if ( isset( $source ) ) { - $astra_pro_url = add_query_arg( 'utm_source', sanitize_text_field( $source ), $url ); - } - // Set up our URL if we have a medium. - if ( isset( $medium ) ) { - $astra_pro_url = add_query_arg( 'utm_medium', sanitize_text_field( $medium ), $url ); - } - // Set up our URL if we have a campaign. - if ( isset( $campaign ) ) { - $astra_pro_url = add_query_arg( 'utm_campaign', sanitize_text_field( $campaign ), $url ); - } - - return esc_url( apply_filters( 'astra_get_pro_url', $astra_pro_url, $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 string $min min. - * @param string $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 string $min min. - * @param string $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' ); -} - -/** - * Return Theme options from database. - * - * @param string $option Option key. - * @param string $default Option default value. - * @param string $deprecated Option default value. - * @return Mixed Return option value. - */ -function astra_get_db_option( $option, $default = '', $deprecated = '' ) { - - if ( '' != $deprecated ) { - $default = $deprecated; - } - - $theme_options = Astra_Theme_Options::get_db_options(); - - /** - * Filter the options array for Astra Settings. - * - * @since 1.0.20 - * @var Array - */ - $theme_options = apply_filters( 'astra_get_db_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_db_option_{$option}", $value, $option, $default ); -} - -/** - * 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 { - $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 { - $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': - if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) { - $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');'; - } - if ( '' === $bg_color || is_numeric( strpos( $bg_color, 'linear-gradient' ) ) || is_numeric( strpos( $bg_color, 'radial-gradient' ) ) && '' !== $bg_img ) { - $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 is_astra_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 is_current_post_comment_enabled() { - return ( is_singular() && comments_open() ); -} + 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 ) { + + if ( '' == $value && 0 !== $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. + */ +if ( ! function_exists( 'astra_get_option' ) ) { + + /** + * Return Theme options. + * + * @param string $option Option key. + * @param string $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 ); + } +} + +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. + $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 ( 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; + } + } + } +} + +/** + * 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 = ''; + $blog_post_title = astra_get_option( 'blog-post-structure' ); + $single_post_title = astra_get_option( 'blog-single-post-structure' ); + + if ( ( ! is_singular() && in_array( 'title-meta', $blog_post_title ) ) || ( is_single() && in_array( 'single-title-meta', $single_post_title ) ) || is_page() ) { + 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() ) { + + /* translators: 1: search string */ + $title = apply_filters( 'astra_the_search_page_title', sprintf( __( 'Search Results for: %s', 'astra' ), '' . get_search_query() . '' ) ); + + } 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; + } + } +} + +/** + * Archive Page Title + */ +if ( ! function_exists( 'astra_archive_page_info' ) ) { + + /** + * Wrapper function for the_title() + * + * Displays title only if the page title bar is disabled. + */ + function astra_archive_page_info() { + + if ( apply_filters( 'astra_the_title_enabled', true ) ) { + + // Author. + if ( is_author() ) { ?> + +
    +
    + +

    + +

    + +
    +
    + +
    +
    + + + +
    + +

    + + + +
    + + + +
    + +

    + + + +
    + + + +
    + + ' . get_search_query() . '' ) ); + ?> +

    + +
    + + + +
    + + ', '' ); ?> + + + +
    + + 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 boolean $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 $url URL fo the site. + * @param string $source utm source. + * @param string $medium utm medium. + * @param string $campaign utm campaign. + * @return mixed + */ + function astra_get_pro_url( $url, $source = '', $medium = '', $campaign = '' ) { + + $astra_pro_url = trailingslashit( $url ); + + // Set up our URL if we have a source. + if ( isset( $source ) ) { + $astra_pro_url = add_query_arg( 'utm_source', sanitize_text_field( $source ), $url ); + } + // Set up our URL if we have a medium. + if ( isset( $medium ) ) { + $astra_pro_url = add_query_arg( 'utm_medium', sanitize_text_field( $medium ), $url ); + } + // Set up our URL if we have a campaign. + if ( isset( $campaign ) ) { + $astra_pro_url = add_query_arg( 'utm_campaign', sanitize_text_field( $campaign ), $url ); + } + + return esc_url( apply_filters( 'astra_get_pro_url', $astra_pro_url, $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 string $min min. + * @param string $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 string $min min. + * @param string $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' ); +} + +/** + * Return Theme options from database. + * + * @param string $option Option key. + * @param string $default Option default value. + * @param string $deprecated Option default value. + * @return Mixed Return option value. + */ +function astra_get_db_option( $option, $default = '', $deprecated = '' ) { + + if ( '' != $deprecated ) { + $default = $deprecated; + } + + $theme_options = Astra_Theme_Options::get_db_options(); + + /** + * Filter the options array for Astra Settings. + * + * @since 1.0.20 + * @var Array + */ + $theme_options = apply_filters( 'astra_get_db_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_db_option_{$option}", $value, $option, $default ); +} + +/** + * 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 { + $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 { + $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': + if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) { + $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');'; + } + if ( '' === $bg_color || is_numeric( strpos( $bg_color, 'linear-gradient' ) ) || is_numeric( strpos( $bg_color, 'radial-gradient' ) ) && '' !== $bg_img ) { + $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 is_astra_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 is_current_post_comment_enabled() { + return ( is_singular() && comments_open() ); +} diff --git a/inc/core/deprecated/deprecated-filters.php b/inc/core/deprecated/deprecated-filters.php index ae044ee..bd3da36 100644 --- a/inc/core/deprecated/deprecated-filters.php +++ b/inc/core/deprecated/deprecated-filters.php @@ -1,87 +1,87 @@ -= 4.6 */ - return apply_filters_deprecated( $tag, $args, $version, $replacement, $message ); - } else { - return apply_filters_ref_array( $tag, $args ); - } - } -} += 4.6 */ + return apply_filters_deprecated( $tag, $args, $version, $replacement, $message ); + } else { + return apply_filters_ref_array( $tag, $args ); + } + } +} diff --git a/inc/core/deprecated/deprecated-functions.php b/inc/core/deprecated/deprecated-functions.php index 779d474..99dea01 100644 --- a/inc/core/deprecated/deprecated-functions.php +++ b/inc/core/deprecated/deprecated-functions.php @@ -1,145 +1,145 @@ -= 4.6 */ - do_action_deprecated( $tag, $args, $version, $replacement, $message ); - } else { - do_action_ref_array( $tag, $args ); - } - } -} += 4.6 */ + do_action_deprecated( $tag, $args, $version, $replacement, $message ); + } else { + do_action_ref_array( $tag, $args ); + } + } +} diff --git a/inc/core/index.php b/inc/core/index.php index 8b96815..820bcb9 100644 --- a/inc/core/index.php +++ b/inc/core/index.php @@ -1,9 +1,9 @@ - - * // 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