pwa->get_filetypes(); $filetypes = []; foreach ( $all_filetypes as $key => $details ) { $filetypes[ $key ] = $details['label']; } $cache_first_defaults = [ 'images', 'scripts', 'styles', 'fonts' ]; $network_first_defaults = []; /** * WIP $all_pages = get_pages(); $pages = []; foreach ( $all_pages as $page ) { $pages [ $page->ID ] = $page->post_title; } */ $pwa_enabled = ( function_exists( 'wp_register_service_worker_caching_route' ) && class_exists( 'WP_Service_Worker_Caching_Routes' ) ); $is_https = ( false !== strpos( home_url(), 'https' ) ); // Is the JS compiler enabled? $js_compiler_enabled = ( ! isset( $settings['js_compiler'] ) || ( '1' === $settings['js_compiler'] || 1 === $settings['js_compiler'] || true === $settings['js_compiler'] ) ); $is_htaccess_writable = true; if ( is_admin() && isset( $_GET['page'] ) && 'avada_options' === $_GET['page'] || function_exists( 'fusion_is_builder_frame' ) && fusion_is_builder_frame() ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, $is_htaccess_writable = Avada_Server_Rules::get_instance()->is_htaccess_writable(); } if ( isset( $settings['critical_css'] ) && '1' === $settings['critical_css'] ) { /* translators: Critical CSS page link */ $critical_description = sprintf( __( 'Set to \'on\' to enable the generation of critical CSS. Once turned on you can manage it from the critical CSS page.', 'Avada' ), admin_url( 'admin.php?page=avada-critical' ) ); } else { $critical_description = __( 'Set to \'on\' to enable the generation of critical CSS. Once enabled, a critical CSS page will be added to the Avada dashboard.', 'Avada' ); } $sections['performance'] = [ 'label' => esc_html__( 'Performance', 'Avada' ), 'id' => 'heading_performance', 'is_panel' => true, 'priority' => 25, 'icon' => 'el-icon-time-alt', 'alt_icon' => 'fusiona-check', 'fields' => [ 'svg_upload' => [ 'label' => esc_html__( 'SVG Media Upload', 'Avada' ), 'description' => esc_html__( 'Enable upload of SVG files and improve performance through their smaller image and logo file size.', 'Avada' ), 'id' => 'svg_upload', 'default' => 'disabled', 'type' => 'radio-buttonset', 'choices' => [ 'enabled' => esc_html__( 'Enable', 'Avada' ), 'disabled' => esc_html__( 'Disable', 'Avada' ), ], // No need to refresh the page. 'transport' => 'postMessage', ], 'pw_jpeg_quality' => [ 'label' => esc_html__( 'WordPress Image Quality', 'Avada' ), /* translators: "Regenerate Thumbnails" plugin link. */ 'description' => sprintf( __( 'Controls the quality of the generated image sizes for every uploaded image. Ranges between 0 and 100 percent. Higher values lead to better image qualities but also higher file sizes. NOTE: After changing this value, please install and run the %s plugin once.', 'Avada' ), '' . esc_html__( 'Regenerate Thumbnails', 'Avada' ) . '' ), 'id' => 'pw_jpeg_quality', 'default' => '82', 'type' => 'slider', 'choices' => [ 'min' => '1', 'max' => '100', 'step' => '1', ], // No need to refresh the page. 'transport' => 'postMessage', ], 'awb_image_sizes' => [ 'label' => esc_html__( 'Avada Image Sizes', 'Avada' ), 'description' => sprintf( __( 'Choose which Avada image sizes should be created for every image uploaded to the Media Library. NOTE: Image sizes used in legacy areas/features of Avada are marked with (L). When you remove image sizes here, please check your site to make sure all layouts display correctly. After changing this value, please install and run the %s plugin once.', 'Avada' ), '' . esc_html__( 'Regenerate Thumbnails', 'Avada' ) . '' ), 'id' => 'awb_image_sizes', 'default' => [ 'fusion-200', 'fusion-400', 'fusion-600', 'fusion-800', 'fusion-1200', 'blog-large', 'blog-medium', 'recent-posts', 'recent-works-thumbnail', 'portfolio-full', 'portfolio-one', 'portfolio-two', 'portfolio-three', 'portfolio-five' ], 'type' => 'select', 'multi' => true, 'choices' => [ 'fusion-200' => esc_html__( '200px Width', 'Avada' ), 'fusion-400' => esc_html__( '400px Width', 'Avada' ), 'fusion-600' => esc_html__( '600px Width', 'Avada' ), 'fusion-800' => esc_html__( '800px Width', 'Avada' ), 'fusion-1200' => esc_html__( '1200px Width', 'Avada' ), 'blog-large' => esc_html__( 'Blog Large (L)', 'Avada' ), 'blog-medium' => esc_html__( 'Blog Medium (L)', 'Avada' ), 'recent-posts' => esc_html__( 'Recent Posts (L)', 'Avada' ), 'recent-works-thumbnail' => esc_html__( 'Recent Works (L)', 'Avada' ), 'portfolio-full' => esc_html__( 'Portfolio Full (L)', 'Avada' ), 'portfolio-one' => esc_html__( 'Portfolio 1 Col (L)', 'Avada' ), 'portfolio-two' => esc_html__( 'Portfolio 2 Col (L)', 'Avada' ), 'portfolio-three' => esc_html__( 'Portfolio 3 Col (L)', 'Avada' ), 'portfolio-five' => esc_html__( 'Portfolio 5 Col (L)', 'Avada' ), ], // No need to refresh the page. 'transport' => 'postMessage', ], 'wp_big_image_size_threshold' => [ 'label' => esc_html__( 'WordPress Big Image Size Threshold', 'Avada' ), 'description' => esc_html__( 'Sets the threshold for image height and width, above which WordPress will scale down newly uploaded images to this values as max-width or max-height. Set to "0" to disable the threshold completely.', 'Avada' ), 'id' => 'wp_big_image_size_threshold', 'default' => '2560', 'type' => 'slider', 'choices' => [ 'min' => '0', 'max' => '5000', 'step' => '1', ], // No need to refresh the page. 'transport' => 'postMessage', ], 'lazy_load' => [ 'label' => esc_html__( 'Image Lazy Loading', 'Avada' ), 'description' => __( 'Choose your preferred lazy loading method for your website\'s images to improve performance. IMPORTANT: The WordPress native method can cause issues with dynamically loaded elements like image carousels.', 'Avada' ), 'id' => 'lazy_load', 'default' => 'none', 'type' => 'radio-buttonset', 'choices' => [ 'avada' => esc_html__( 'Avada', 'Avada' ), 'wordpress' => esc_html__( 'WordPress', 'Avada' ), 'none' => esc_html__( 'None', 'Avada' ), ], 'transport' => 'postMessage', // No need to refresh the page. ], 'lazy_load_iframes' => [ 'label' => esc_html__( 'Iframe Lazy Loading', 'Avada' ), 'description' => __( 'Choose your preferred lazy loading method for your website\'s iframe to improve performance.', 'Avada' ), 'id' => 'lazy_load_iframes', 'default' => 'none', 'type' => 'radio-buttonset', 'choices' => [ 'avada' => esc_html__( 'Avada', 'Avada' ), 'wordpress' => esc_html__( 'WordPress', 'Avada' ), 'none' => esc_html__( 'None', 'Avada' ), ], 'transport' => 'postMessage', // No need to refresh the page. ], 'font_face_display' => [ 'label' => esc_html__( 'Font Face Rendering', 'Avada' ), 'description' => esc_html__( 'Choose "Swap All" for faster rendering with possible flash of unstyled text (FOUT) or "Block" for clean rendering but longer wait time until first paint. "Swap Non-Icon Fonts" will use a mix of the first 2 methods ("swap" for text fonts and "block" for icon-fonts).', 'Avada' ), 'id' => 'font_face_display', 'default' => 'block', 'type' => 'radio-buttonset', 'choices' => [ 'block' => esc_html__( 'Block', 'Avada' ), 'swap' => esc_html__( 'Swap Non-Icon Fonts', 'Avada' ), 'swap-all' => esc_html__( 'Swap All', 'Avada' ), ], 'transport' => 'postMessage', // No need to refresh the page. ], 'preload_fonts' => [ 'label' => esc_html__( 'Preload Key Fonts', 'Avada' ), 'description' => esc_html__( 'Make a selection to prioritize fetching resources that will be requested later in page load. This improves page load time as the browser caches preloaded resources so they are available immediately when needed.', 'Avada' ), 'id' => 'preload_fonts', 'default' => 'icon_fonts', 'type' => 'radio-buttonset', 'choices' => [ 'all' => esc_html__( 'All', 'Avada' ), 'google_fonts' => esc_html__( 'Google Fonts', 'Avada' ), 'icon_fonts' => esc_html__( 'Icon Fonts', 'Avada' ), 'none' => esc_html__( 'None', 'Avada' ), ], 'transport' => 'postMessage', // No need to refresh the page. ], 'preload_fonts_variants' => [ 'label' => esc_html__( 'Preload Google Font Variants', 'Avada' ), 'description' => esc_html__( 'Select the variants of Google fonts that should get preloaded. Leave empty to preload all variants.', 'Avada' ), 'id' => 'preload_fonts_variants', 'default' => '400', 'type' => 'select', 'multi' => true, 'choices' => [ '100' => esc_html__( 'Ultra-Light 100', 'Avada' ), '100-italic' => esc_html__( 'Ultra-Light 100 Italic', 'Avada' ), '200' => esc_html__( 'Light 200', 'Avada' ), '200-italic' => esc_html__( 'Light 200 Italic', 'Avada' ), '300' => esc_html__( 'Book 300', 'Avada' ), '300-italic' => esc_html__( 'Book 300 Italic', 'Avada' ), '400' => esc_html__( 'Normal 400', 'Avada' ), '400-italic' => esc_html__( 'Normal 400 Italic', 'Avada' ), '500' => esc_html__( 'Medium 500', 'Avada' ), '500-italic' => esc_html__( 'Medium 500 Italic', 'Avada' ), '600' => esc_html__( 'Semi-Bold 600', 'Avada' ), '600-italic' => esc_html__( 'Semi-Bold 600 Italic', 'Avada' ), '700' => esc_html__( 'Bold 700', 'Avada' ), '700-italic' => esc_html__( 'Bold 700 Italic', 'Avada' ), '800' => esc_html__( 'Extra-Bold 800', 'Avada' ), '800-italic' => esc_html__( 'Extra-Bold 800 Italic', 'Avada' ), '900' => esc_html__( 'Ultra-Bold 900', 'Avada' ), '900-italic' => esc_html__( 'Ultra-Bold 900 Italic', 'Avada' ), ], 'required' => [ [ 'setting' => 'preload_fonts', 'operator' => '!=', 'value' => 'none', ], [ 'setting' => 'preload_fonts', 'operator' => '!=', 'value' => 'icon_fonts', ], ], // No need to refresh the page. 'transport' => 'postMessage', ], 'preload_fonts_subsets' => [ 'label' => esc_html__( 'Preload Google Font Subsets', 'Avada' ), 'description' => esc_html__( 'Select the subsets of Google fonts that should get preloaded. Leave empty to preload all subsets.', 'Avada' ), 'id' => 'preload_fonts_subsets', 'default' => 'latin', 'type' => 'select', 'multi' => true, 'choices' => [ 'arabic' => esc_html__( 'Latin', 'Avada' ), 'bengali' => esc_html__( 'Bengali', 'Avada' ), 'chinese-hongkong' => esc_html__( 'Chinese Hongkong', 'Avada' ), 'chinese-simplified' => esc_html__( 'Chinese Simplified', 'Avada' ), 'chinese-traditional' => esc_html__( 'Chinese Traditional', 'Avada' ), 'cyrillic' => esc_html__( 'Cyrillic', 'Avada' ), 'cyrillic-ext' => esc_html__( 'Cyrillic Extended', 'Avada' ), 'devanagari' => esc_html__( 'Devanagari', 'Avada' ), 'greek' => esc_html__( 'Greek', 'Avada' ), 'greek-ext' => esc_html__( 'Greek Extended', 'Avada' ), 'gujarati' => esc_html__( 'Gujarati', 'Avada' ), 'gurmukhi' => esc_html__( 'Gurmukhi', 'Avada' ), 'hebrew' => esc_html__( 'Hebrew', 'Avada' ), 'japanese' => esc_html__( 'Japanese', 'Avada' ), 'kannada' => esc_html__( 'Kannada', 'Avada' ), 'khmer' => esc_html__( 'Khmer', 'Avada' ), 'korean' => esc_html__( 'Korean', 'Avada' ), 'latin' => esc_html__( 'Latin', 'Avada' ), 'latin-ext' => esc_html__( 'Latin Extended', 'Avada' ), 'malayalam' => esc_html__( 'Malayalam', 'Avada' ), 'myanmar' => esc_html__( 'Myanmar', 'Avada' ), 'oriya' => esc_html__( 'Oriya', 'Avada' ), 'sinhala' => esc_html__( 'Sinhala', 'Avada' ), 'tamil' => esc_html__( 'Tamil', 'Avada' ), 'telugu' => esc_html__( 'Telugu', 'Avada' ), 'thai' => esc_html__( 'Thai', 'Avada' ), 'tibetan' => esc_html__( 'Tibetan', 'Avada' ), 'vietnamese' => esc_html__( 'Vietnamese', 'Avada' ), ], 'required' => [ [ 'setting' => 'preload_fonts', 'operator' => '!=', 'value' => 'none', ], [ 'setting' => 'preload_fonts', 'operator' => '!=', 'value' => 'icon_fonts', ], ], // No need to refresh the page. 'transport' => 'postMessage', ], 'emojis_disabled' => [ 'label' => esc_html__( 'Emojis Script', 'Avada' ), 'description' => esc_html__( 'If you don\'t use emojis you can improve performance by removing WordPress\' emojis script.', 'Avada' ), 'id' => 'emojis_disabled', 'default' => 'enabled', 'type' => 'radio-buttonset', 'choices' => [ 'enabled' => esc_html__( 'Enable', 'Avada' ), 'disabled' => esc_html__( 'Disable', 'Avada' ), ], // No need to refresh the page. 'transport' => 'postMessage', ], 'jquery_migrate_disabled' => [ 'label' => esc_html__( 'jQuery Migrate Script', 'Avada' ), 'description' => esc_html__( 'If you are not using any deprecated jQuery code, you can disable this script to improve performance.', 'Avada' ), 'id' => 'jquery_migrate_disabled', 'default' => 'enabled', 'type' => 'radio-buttonset', 'choices' => [ 'enabled' => esc_html__( 'Enable', 'Avada' ), 'disabled' => esc_html__( 'Disable', 'Avada' ), ], // No need to refresh the page. 'transport' => 'postMessage', ], 'defer_jquery' => [ 'label' => esc_html__( 'Load jQuery In Footer', 'Avada' ), 'description' => esc_html__( 'Set to \'on\' to defer loading of jQuery to the footer of the page. This will only take effect if no other jQuery dependent scripts are added to the head. Turning this on can cause JS scripts to break, use with caution.', 'Avada' ), 'id' => 'defer_jquery', 'default' => '0', 'type' => 'switch', // No need to refresh the page. 'transport' => 'postMessage', ], 'defer_styles' => [ 'label' => esc_html__( 'Load Stylesheets In Footer', 'Avada' ), 'description' => esc_html__( 'Set to \'on\' to defer loading of the stylesheets to the footer of the page. This improves page load time by making the styles non-render-blocking. Depending on the connection speed, a flash of unstyled content (FOUC) might occur.', 'Avada' ), 'id' => 'defer_styles', 'default' => '0', 'type' => 'switch', // No need to refresh the page. 'transport' => 'postMessage', ], 'gzip_note' => $is_htaccess_writable ? [] : [ 'label' => '', 'description' => '
uploads/fusion-styles. %2$s: uploads/fusion-scripts. */
'description' => ( is_multisite() && is_main_site() ) ? sprintf( esc_html__( 'Resets all Dynamic CSS & Dynamic JS, cleans-up the database and deletes the %1$s and %2$s folders. When resetting the caches on the main site of a multisite installation, caches for all sub-sites will be reset. IMPORTANT NOTE: On large multisite installations with a low PHP timeout setting, bulk-resetting the caches may timeout.', 'Avada' ), 'uploads/fusion-styles', 'uploads/fusion-scripts' ) : sprintf( esc_html__( 'Resets all Dynamic CSS & Dynamic JS, cleans-up the database and deletes the %1$s and %2$s folders.', 'Avada' ), 'uploads/fusion-styles', 'uploads/fusion-scripts' ),
'id' => 'reset_caches_button',
'default' => '',
'type' => 'raw',
'content' => '' . esc_html__( 'Reset Avada Caches', 'Avada' ) . '',
'full_width' => false,
'transport' => 'postMessage', // No need to refresh the page.
'hide_on_front' => true,
],
'pwa_section' => [
'label' => esc_html__( 'Progressive Web App', 'Avada' ),
'id' => 'pwa_section',
'icon' => true,
'type' => 'info',
],
'pwa_required_notice' => ! $pwa_enabled ? [
'label' => '',
'description' => sprintf(
/* translators: URL for the plugins page. */
'