make_site_theme_from_default [ WordPress Function ]
make_site_theme_from_default ( $theme_name, $template )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: make_site_theme_from_oldschool, make_site_theme, preview_theme_ob_filter, get_gmt_from_date, get_theme_data
{@internal Missing Short Description}}
{@internal Missing Long Description}}
Source
<?php
function make_site_theme_from_default($theme_name, $template) {
$site_dir = WP_CONTENT_DIR . "/themes/$template";
$default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_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');
$theme_dir = @ opendir($default_dir);
if ($theme_dir) {
while(($theme_file = readdir( $theme_dir )) !== false) {
if (is_dir("$default_dir/$theme_file"))
continue;
if (! @copy("$default_dir/$theme_file", "$site_dir/$theme_file"))
return;
chmod("$site_dir/$theme_file", 0777);
}
}
@closedir($theme_dir);
// Rewrite the theme header.
$stylelines = explode("\n", implode('', file("$site_dir/style.css")));
if ($stylelines) {
$f = fopen("$site_dir/style.css", 'w');
foreach ($stylelines as $line) {
if (strpos($line, 'Theme Name:') !== false) $line = 'Theme Name: ' . $theme_name;
elseif (strpos($line, 'Theme URI:') !== false) $line = 'Theme URI: ' . __get_option('url');
elseif (strpos($line, 'Description:') !== false) $line = 'Description: Your theme.';
elseif (strpos($line, 'Version:') !== false) $line = 'Version: 1';
elseif (strpos($line, 'Author:') !== false) $line = 'Author: You';
fwrite($f, $line . "\n");
}
fclose($f);
}
// Copy the images.
umask(0);
if (! mkdir("$site_dir/images", 0777)) {
return false;
}
$images_dir = @ opendir("$default_dir/images");
if ($images_dir) {
while(($image = readdir($images_dir)) !== 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);
}
}
@closedir($images_dir);
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- #16937 (make_site_theme_from_default() refactoring) – WordPress ...
Description. just some little refactoring, partly because of new functions available with PHP 5.0.0, but prior to put the duplicated code into a function of it's own.
core.trac.wordpress.org - Docs for page upgrade.php
unknown make_site_theme_from_default (unknown_type $theme_name, unknown_type $template). unknown_type $theme_name; unknown_type $ template ...
phpdoc.wordpress.org - PHPXRef 0.7 : WordPress : Detail view of upgrade.php
make_site_theme_from_default() make_site_theme() ...
phpxref.ftwr.co.uk - Wordpress Functions History Table - Ozh
make_site_theme_from_default, 1.5, ·. make_site_theme_from_oldschool, 1.5, ·. make_url_footnote, 0.71, ·. manage_columns_prefs, 2.7, ·. map_attrs, 1.5, · ...
planetozh.com