From cf3dc1c92d0bc29f5be96c895f588e4098aa9f54 Mon Sep 17 00:00:00 2001 From: Matias Benedetto Date: Mon, 19 Jun 2023 15:46:35 +0200 Subject: [PATCH] fix theme folder when the original theme comes from a subfolder --- admin/create-theme/cbt-zip-archive.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/admin/create-theme/cbt-zip-archive.php b/admin/create-theme/cbt-zip-archive.php index 4862fc9d..3799192c 100644 --- a/admin/create-theme/cbt-zip-archive.php +++ b/admin/create-theme/cbt-zip-archive.php @@ -8,21 +8,24 @@ class CbtZipArchive extends ZipArchive { private string $theme_slug; function __construct( $theme_slug ) { - $this->theme_slug = $theme_slug; + // If the original theme is in a subfolder the theme slug will be the last part of the path + $complete_slug = explode( DIRECTORY_SEPARATOR, $theme_slug ); + $folder = end( $complete_slug ); + $this->theme_folder = $folder; } function addFromStringToTheme( $name, $content ) { - $name = $this->theme_slug . '/' . $name; + $name = $this->theme_folder . '/' . $name; return parent::addFromString( $name, $content ); } function addFileToTheme( $filepath, $entryname ) { - $entryname = $this->theme_slug . '/' . $entryname; + $entryname = $this->theme_folder . '/' . $entryname; return parent::addFile( $filepath, $entryname ); } function addThemeDir( $dirname ) { - $dirname = $this->theme_slug . '/' . $dirname; + $dirname = $this->theme_folder . '/' . $dirname; return parent::addEmptyDir( $dirname ); }