function copyEntireTheme($copiedThemeName, $newThemeName) { $newThemePath = SJB_TemplatePathManager::getAbsoluteThemePath($copiedThemeName); $copiedThemePath = SJB_TemplatePathManager::getAbsoluteThemePath($newThemeName); SJB_Filesystem::copy($newThemePath, $copiedThemePath); SJB_Filesystem::mkpath(SJB_TemplatePathManager::getAbsoluteThemeCachePath($newThemeName)); $themeFields = SJB_FormBuilderManager::getFieldsByTheme($copiedThemeName); foreach ($themeFields as $themeField) { SJB_FormBuilderManager::insertField($newThemeName, $themeField); } $screenFile = $copiedThemePath . "main/images/{$copiedThemeName}.png"; $newScreenFile = $copiedThemePath . "main/images/{$newThemeName}.png"; if (file_exists($screenFile)) { rename($screenFile, $newScreenFile); } $listingTypes = SJB_ListingTypeDBManager::getAllListingTypesInfo(); foreach ($listingTypes as $listingType) { SJB_Settings::addSetting("display_layout_{$listingType['id']}_{$newThemeName}", SJB_Settings::getSettingByName("display_layout_{$listingType['id']}_{$copiedThemeName}")); } }