Copy searchform and images when creating site theme from default theme. http://mosquito.wordpress.org/view.php?id=852

git-svn-id: https://develop.svn.wordpress.org/trunk@2293 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2005-02-12 19:34:50 +00:00
parent e5ba4f2302
commit 941a2e7c07
1 changed files with 28 additions and 7 deletions

View File

@ -592,14 +592,18 @@ function make_site_theme_from_default($theme_name, $template) {
$site_dir = ABSPATH . "wp-content/themes/$template"; $site_dir = ABSPATH . "wp-content/themes/$template";
$default_dir = ABSPATH . 'wp-content/themes/default'; $default_dir = ABSPATH . 'wp-content/themes/default';
// Copy files from the default theme to the site theme. // Copy files from the default theme to the site theme.
$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css'); //$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');
foreach ($files as $file) { $theme_dir = @ dir("$default_dir");
if (! @copy("$default_dir/$file", "$site_dir/$file")) if ($theme_dir) {
return; while(($theme_file = $theme_dir->read()) !== false) {
if (is_dir("$default_dir/$theme_file"))
chmod("$site_dir/$file", 0777); continue;
if (! @copy("$default_dir/$theme_file", "$site_dir/$theme_file"))
return;
chmod("$site_dir/$theme_file", 0777);
}
} }
// Rewrite the theme header. // Rewrite the theme header.
@ -617,6 +621,23 @@ function make_site_theme_from_default($theme_name, $template) {
} }
fclose($f); fclose($f);
} }
// Copy the images.
umask(0);
if (! mkdir("$site_dir/images", 0777)) {
return false;
}
$images_dir = @ dir("$default_dir/images");
if ($images_dir) {
while(($image = $images_dir->read()) !== false) {
if (is_dir("$default_dir/images/$image"))
continue;
if (! @copy("$default_dir/images/$image", "$site_dir/images/$image"))
return;
chmod("$site_dir/images/$image", 0777);
}
}
} }
// Create a site theme from the default theme. // Create a site theme from the default theme.