0 || $_FILES["xmlfile"]["type"] != "text/xml") {
echo "Error: " . $_FILES["xmlfile"]["error"] . "
";
} else {
// load the file
$xml = simplexml_load_file($_FILES["xmlfile"]["tmp_name"]);
}
//Build a list of status updates to tell the user what has been changed.
$status = "
Migrate Site Settings
This plugin will export all your basic site preferences / settings, for re-import later.
Currently it automatically pulls settings from:
General, Writing, Reading, Discussion, Media, Privacy, and Permalinks.
If you find yourself enjoying this plugin, please donate!
Functionality planned:
- allow users to select which preferences they would like to export
- come up with a way to export the fact that plugins are installed, and when you import, install and configure them as well.
- Suggestions and constructive criticism are welcome! Just leave a message for me somewhere on my website!
Hit the button to generate an XML file, and download it for re-use later
An MD5 hash is used to keep people from linking directly to the file.
generateXMLString();
if ( isset($_POST['generatexmlsubmit']) ) {
$filename = $this->generateXMLFile($xml);
}
?>
'."\n";
$xml .= '
'."\n";
foreach($this->optionstosave as $ots){
$option = get_option( $ots );
$option = htmlentities($option);
$xml .= "\t<".$ots.">".$option."".$ots.">\n";
}
$xml .= '';
return $xml;
}
/*
* generateXMLFile
* Save the file to the plugin folder so that the user can download it.
*/
public function generateXMLFile($xmlString) {
$filename = "Settings_Export_".md5(time()).".xml";
$myFile = "../wp-content/plugins/migrate-site-settings/".$filename;
$fh = fopen($myFile, 'w');
fwrite($fh, $xmlString);
fclose($fh);
return $filename;
}
}
}
global $migrateSettings;
$migrateSettings = new Migrate_Site_Settings();
?>