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 ); } ?>