get_active_folders_column( 'path' ); $themes = array(); if ( $custom_folders ) { $custom_folders = array_combine( $custom_folders, $custom_folders ); $custom_folders = array_map( array( 'Imagify_Files_Scan', 'remove_placeholder' ), $custom_folders ); $custom_folders = array_map( 'trailingslashit', $custom_folders ); $custom_folders = array_filter( $custom_folders, array( 'Imagify_Files_Scan', 'is_path_autorized' ) ); } if ( $custom_folders ) { $custom_folders = array_map( array( $this->filesystem, 'make_path_relative' ), $custom_folders ); $custom_folders = array_map( 'untrailingslashit', $custom_folders ); natcasesort( $custom_folders ); $custom_folders = array_map( 'trailingslashit', $custom_folders ); if ( isset( $custom_folders['{{ROOT}}/'] ) ) { $custom_folders['{{ROOT}}/'] = __( 'Site\'s root', 'imagify' ); } } // Current used theme(s). if ( ! is_network_admin() ) { $current_theme = wp_get_theme(); $themes_not_added = array(); foreach ( array( $current_theme, $current_theme->parent() ) as $theme ) { if ( ! $theme || ! $theme->exists() ) { continue; } $theme_path = trailingslashit( $theme->get_stylesheet_directory() ); if ( ! Imagify_Files_Scan::is_path_forbidden( $theme_path ) ) { $theme = array( 'name' => $theme->display( 'Name' ), 'path' => Imagify_Files_Scan::add_placeholder( $theme_path ), 'label' => $this->filesystem->make_path_relative( $theme_path ), ); $themes[ $theme['path'] ] = $theme; $added = false; $rel_path = strtolower( $theme['label'] ); foreach ( $custom_folders as $path => $label ) { if ( strpos( $rel_path, strtolower( $label ) ) === 0 ) { $added = true; break; } } if ( ! $added ) { $themes_not_added[] = $theme['path']; } } } $themes_count = count( $themes ); } ?>

' . $theme['name'] . '' ); if ( $themes_count > 1 ) { $theme = end( $themes ); echo '
'; /* translators: %s is a theme name. */ printf( __( 'child theme of %s', 'imagify' ), '' . $theme['name'] . '' ); } ?>

$theme ) { $themes[ $path ] = esc_attr( $theme['path'] ) . '#///#' . esc_attr( $theme['label'] ); } ?>

$label ) { $this->print_template( 'part-settings-row-custom-folder', array( 'value' => $placeholder, 'label' => $label, ) ); } } ?>

opening and closing tags. */ __( '%1$sSelecting a folder will also optimize images in sub-folders.%2$s The only exception is "Site’s root": when selected, only images that are directly at the site’s root will be optimized (sub-folders can be selected separately).', 'imagify' ), '', '' ); ?>