make_site_theme_from_oldschool [ WordPress Function ]
make_site_theme_from_oldschool ( $theme_name, $template )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: make_site_theme_from_default, make_site_theme, get_theme_mods, get_theme_roots, get_theme_mod
{@internal Missing Short Description}}
{@internal Missing Long Description}}
Source
<?php
function make_site_theme_from_oldschool($theme_name, $template) {
$home_path = get_home_path();
$site_dir = WP_CONTENT_DIR . "/themes/$template";
if (! file_exists("$home_path/index.php"))
return false;
// Copy files from the old locations to the site theme.
// TODO: This does not copy arbitrary include dependencies. Only the
// standard WP files are copied.
$files = array('index.php' => 'index.php', 'wp-layout.css' => 'style.css', 'wp-comments.php' => 'comments.php', 'wp-comments-popup.php' => 'comments-popup.php');
foreach ($files as $oldfile => $newfile) {
if ($oldfile == 'index.php')
$oldpath = $home_path;
else
$oldpath = ABSPATH;
if ($oldfile == 'index.php') { // Check to make sure it's not a new index
$index = implode('', file("$oldpath/$oldfile"));
if (strpos($index, 'WP_USE_THEMES') !== false) {
if (! @copy(WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile"))
return false;
continue; // Don't copy anything
}
}
if (! @copy("$oldpath/$oldfile", "$site_dir/$newfile"))
return false;
chmod("$site_dir/$newfile", 0777);
// Update the blog header include in each file.
$lines = explode("\n", implode('', file("$site_dir/$newfile")));
if ($lines) {
$f = fopen("$site_dir/$newfile", 'w');
foreach ($lines as $line) {
if (preg_match('/require.*wp-blog-header/', $line))
$line = '//' . $line;
// Update stylesheet references.
$line = str_replace("<?php echo __get_option('siteurl'); ?>/wp-layout.css", "<?php bloginfo('stylesheet_url'); ?>", $line);
// Update comments template inclusion.
$line = str_replace("<?php include(ABSPATH . 'wp-comments.php'); ?>", "<?php comments_template(); ?>", $line);
fwrite($f, "{$line}\n");
}
fclose($f);
}
}
// Add a theme header.
$header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option('siteurl') . "\nDescription: A theme automatically created by the update.\nVersion: 1.0\nAuthor: Moi\n*/\n";
$stylelines = file_get_contents("$site_dir/style.css");
if ($stylelines) {
$f = fopen("$site_dir/style.css", 'w');
fwrite($f, $header);
fwrite($f, $stylelines);
fclose($f);
}
return true;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Docs for page upgrade.php
make_site_theme_from_oldschool (line 1729). since: 1.5.0. unknown make_site_theme_from_oldschool (unknown_type $theme_name, unknown_type ...
phpdoc.wordpress.org - allow-wp-content-directory-outside-of-webroot.patch - WordPress Trac
1077, 1077. 1078, 1078, function make_site_theme_from_oldschool($ theme_name, $template) {. 1079, 1079, $home_path = get_home_path(); ...
core.trac.wordpress.org - PHPXRef 0.7 : WordPress : Detail view of upgrade.php
make_db_current_silent() make_site_theme_from_oldschool() ...
phpxref.ftwr.co.uk - xPHP » New Threat: Pokosa Malware
Feb 9, 2012 ... and is located in the function make_site_theme_from_oldschool. In the last for loop, below the comment. // Update stylesheet references.
www.xphp.info