本文整理匯總了PHP中TemplateManager::_validateTemplateInformation方法的典型用法代碼示例。如果您正苦於以下問題:PHP TemplateManager::_validateTemplateInformation方法的具體用法?PHP TemplateManager::_validateTemplateInformation怎麽用?PHP TemplateManager::_validateTemplateInformation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TemplateManager
的用法示例。
在下文中一共展示了TemplateManager::_validateTemplateInformation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadTemplateByRemote
public static function loadTemplateByRemote($folder)
{
$path = Core::GetConfig("templateProvider") . "?do=download&folderName=" . $folder;
$remoteFileURL = Utils::getWebContent($path);
$localFile = Core::GetConfig("dirIntScripts") . "installing.zip";
$tempDirectory = Core::GetConfig("dirIntScripts") . "installing/";
if (file_exists($localFile)) {
unlink($localFile);
}
if (is_dir($tempDirectory)) {
Utils::rmdir_recursive($tempDirectory);
}
// Download and prepare
Utils::downloadFile($localFile, $remoteFileURL);
Utils::unzip($localFile, $tempDirectory);
// XML and Data
if (file_exists($tempDirectory . "info.xml")) {
$xmltext = file_get_contents($tempDirectory . "info.xml");
$xml = simplexml_load_string($xmltext);
$data = TemplateManager::_validateTemplateInformation(Utils::xmlToArray($xml));
// Create Template
$t = new Template();
$t->setSetting("scriptVersion", $data["scriptVersion"]);
$t->setSetting("gameName", $data["gameName"]);
$t->setSetting("iconFile", $data["iconFile"]);
$t->setSetting("folderName", $folder);
$t->setSetting("infoxml", $xmltext);
if (isset($data["settingsFile"])) {
$t->setSetting("settingsxml", Template::replaceVariablesWithValues(file_get_contents($tempDirectory . $data["settingsFile"])));
}
// Base Template (One-Time-Install. No Gameserver)
if (isset($data['isBaseTemplate'])) {
if ($data['isBaseTemplate'] == "True") {
$t->setSetting("baseTemplate", 1);
} else {
$t->setSetting("baseTemplate", 0);
}
} else {
$t->setSetting("baseTemplate", 0);
}
$t->saveToDatabase();
// Move Icon File
$tempIcon = $tempDirectory . $t->getData("iconFile");
$newIcon = $t->getIconFile();
copy($tempIcon, $newIcon);
Utils::rmdir_recursive($tempDirectory);
if ($t->getData("id") != 0) {
rename($localFile, $t->getZipFile());
} else {
unlink($localFile);
}
return $t;
} else {
throw new Exception("Info.xml doesnt exists in downloaded script. Aborting.");
}
}