本文整理汇总了PHP中xml::write_master_tag方法的典型用法代码示例。如果您正苦于以下问题:PHP xml::write_master_tag方法的具体用法?PHP xml::write_master_tag怎么用?PHP xml::write_master_tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml
的用法示例。
在下文中一共展示了xml::write_master_tag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GenerateNewsfeed
function GenerateNewsfeed()
{
global $db, $cfg, $func;
include_once "inc/classes/class_xml.php";
$xml = new xml();
$output = '<?xml version="1.0" encoding="UTF-8"?' . '>' . "\r\n";
$channel = $xml->write_tag("title", $cfg['sys_page_title'], 2);
$channel .= $xml->write_tag("link", $cfg["sys_partyurl"], 2);
$channel .= $xml->write_tag("description", $cfg["news_description"], 2);
$channel .= $xml->write_tag("language", "de-de", 2);
$channel .= $xml->write_tag("copyright", $cfg["news_copyright"], 2);
if ($cfg["news_logourl"]) {
$image = $xml->write_tag("url", $cfg["news_logourl"], 3);
$image .= $xml->write_tag("title", $cfg['sys_page_title'] . " - Logo", 3);
$image .= $xml->write_tag("link", $cfg["sys_partyurl"], 3);
$channel .= $xml->write_master_tag("image", $image, 2);
}
$get_news = $db->qry("SELECT n.*, UNIX_TIMESTAMP(n.date) AS date, u.name, u.firstname, u.username FROM %prefix%news n\n LEFT JOIN %prefix%user u ON u.userid = n.poster\n ORDER BY n.date DESC");
while ($news = $db->fetch_array($get_news)) {
$item = $xml->write_tag("title", $news["caption"], 3);
$item .= $xml->write_tag("description", $func->Entity2Uml(strip_tags($news["text"])), 3);
$item .= $xml->write_tag("author", $func->Entity2Uml("{$news['firstname']} {$news['name']} ({$news['username']})"), 3);
$item .= $xml->write_tag("pubDate", date("D, j M Y H:i:s O", $news['date']), 3);
$path = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], "index.php"));
$item .= $xml->write_tag("link", "http://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}{$path}index.php?mod=news&action=comment&newsid=" . $news['newsid'], 3);
$channel .= $xml->write_master_tag("item", $item, 2);
}
$db->free_result($get_news);
$rss = $xml->write_master_tag("channel", $channel, 1);
$output .= $xml->write_master_tag("rss version=\"0.91\"", $rss, 0);
if (is_writable("ext_inc/newsfeed/")) {
if ($fp = @fopen("ext_inc/newsfeed/news.xml", "w")) {
if (@fwrite($fp, $output)) {
$func->log_event(t('Newsfeed wurde erfolgreich aktuallisiert'), 1, t('Newsfeed'));
} else {
$func->log_event(t('Konnte Newsfeed nicht erstellen. Fehler beim Schreiben in der Datei ext_inc/newsfeed/news.xml'), 2, t('Newsfeed wurde erfolgreich aktuallisiert'));
}
@fclose($fp);
} else {
$func->log_event(t('Konnte Newsfeed nicht erstellen. Fehler beim Öffnen der Datei ext_inc/newsfeed/news.xml'), 2, t('Newsfeed wurde erfolgreich aktuallisiert'));
}
} else {
$func->log_event(t('Konnte Newsfeed nicht erstellen. Keine Schreibrechte im Ordner ext_inc/newsfeed/'), 2, t('Newsfeed wurde erfolgreich aktuallisiert'));
}
}
示例2: LSTableHead
function LSTableHead($filename = NULL)
{
global $xml;
include_once "inc/classes/class_xml.php";
$xml = new xml();
if ($filename) {
$this->filename = $filename;
} else {
$this->filename = "lansuite_" . date("ymd") . ".xml";
}
$this->output = '<?xml version="1.0" encoding="UTF-8"?' . ">\r\n\r\n";
/* Header */
$header = $xml->write_tag("filetype", "LanSuite", 2);
$header .= $xml->write_tag("version", "2.0", 2);
$header .= $xml->write_tag("source", "http://www.lansuite.de", 2);
$header .= $xml->write_tag("date", date("Y-m-d h:i"), 2);
$this->lansuite = $xml->write_master_tag("header", $header, 1);
}
示例3: WriteXMLStatFile
function WriteXMLStatFile()
{
global $cfg, $db, $config;
include_once 'inc/classes/class_xml.php';
$xml = new xml();
$output = '<?xml version="1.0" encoding="UTF-8"?' . '>' . "\r\n";
$system = $xml->write_tag('version', $config['lansuite']['version'], 2);
$system .= $xml->write_tag('name', $cfg['feed_partyname'], 2);
$system .= $xml->write_tag('link', $cfg['sys_partyurl'], 2);
$system .= $xml->write_tag('language', 'de-de', 2);
$system .= $xml->write_tag('current_party', $cfg['signon_partyid'], 2);
$row = $db->qry_first("SELECT COUNT(*) AS anz FROM %prefix%user WHERE type > 0");
$system .= $xml->write_tag('users', $row['anz'], 2);
$lansuite = $xml->write_master_tag('system', $system, 1);
$res = $db->qry("SELECT party_id, name, max_guest, ort, plz, startdate, enddate FROM %prefix%partys");
$partys = '';
while ($row = $db->fetch_array($res)) {
$party = $xml->write_tag('partyid', $row['party_id'], 3);
$party .= $xml->write_tag('name', $row['name'], 3);
$party .= $xml->write_tag('max_guest', $row['max_guest'], 3);
$party .= $xml->write_tag('ort', $row['ort'], 3);
$party .= $xml->write_tag('plz', $row['plz'], 3);
$party .= $xml->write_tag('startdate', $row['startdate'], 3);
$party .= $xml->write_tag('enddate', $row['enddate'], 3);
$party .= $xml->write_tag('sstartdate', $row['sstartdate'], 3);
$party .= $xml->write_tag('senddate', $row['senddate'], 3);
$row2 = $db->qry_first("SELECT count(userid) as anz FROM %prefix%user AS user\n LEFT JOIN %prefix%party_user AS party ON user.userid = party.user_id\n WHERE party_id=%int% AND (type >= 1)", $row['party_id']);
$party .= $xml->write_tag('registered', $row2['anz'], 3);
$row2 = $db->qry_first("SELECT count(userid) as anz FROM %prefix%user AS user\n LEFT JOIN %prefix%party_user AS party ON user.userid = party.user_id\n WHERE (party.paid > 0) AND party_id=%int% AND (type >= 1)", $row['party_id']);
$party .= $xml->write_tag('paid', $row2['anz'], 3);
$partys .= $xml->write_master_tag('party', $party, 2);
}
$db->free_result($res);
$lansuite .= $xml->write_master_tag('partys', $partys, 1);
$output .= $xml->write_master_tag('lansuite', $lansuite, 0);
if (is_writable('ext_inc/party_infos/')) {
if ($fp = @fopen('ext_inc/party_infos/infos.xml', 'w')) {
if (!@fwrite($fp, $output)) {
return false;
}
@fclose($fp);
} else {
return false;
}
} else {
return false;
}
return true;
}
示例4: xml
/**
* Read complete Modultranslation from DB and write to back File
* This will be only used for maintenace Translation
*
* @param string Modulname
* @return boolean Success
* @todo Errorhandler for xml and fileacces
*/
function xml_write_db_to_file($modul)
{
global $db;
include_once "inc/classes/class_xml.php";
$xml = new xml();
$output = '<?xml version="1.0" encoding="UTF-8"?' . ">\r\n\r\n";
$header = $xml->write_tag("filetype", "LanSuite", 2);
$header .= $xml->write_tag("version", "2.0", 2);
$header .= $xml->write_tag("source", "http://www.lansuite.de", 2);
$header .= $xml->write_tag("date", date("Y-m-d h:i"), 2);
$header = $xml->write_master_tag("header", $header, 1);
$table_head = $xml->write_tag('name', 'translation', 3);
$tables = $xml->write_master_tag("table_head", $table_head, 2);
$content = '';
// read normal Translation
$res = $db->qry("SELECT * FROM %prefix%translation WHERE file = %string% AND obsolete = 0", $modul);
while ($row = $db->fetch_array($res)) {
if ($row['id'] != '') {
$entry = $xml->write_tag('id', $row['id'], 4);
$entry .= $xml->write_tag('org', $row['org'], 4);
if ($row['de'] != '') {
$entry .= $xml->write_tag('de', $row['de'], 4);
}
if ($row['en'] != '') {
$entry .= $xml->write_tag('en', $row['en'], 4);
}
if ($row['es'] != '') {
$entry .= $xml->write_tag('es', $row['es'], 4);
}
if ($row['fr'] != '') {
$entry .= $xml->write_tag('fr', $row['fr'], 4);
}
if ($row['nl'] != '') {
$entry .= $xml->write_tag('nl', $row['nl'], 4);
}
if ($row['it'] != '') {
$entry .= $xml->write_tag('it', $row['it'], 4);
}
$entry .= $xml->write_tag('file', $modul, 4);
$content .= $xml->write_master_tag("entry", $entry, 3);
}
}
$db->free_result($res);
// read long Translation
$res2 = $db->qry("SELECT * FROM %prefix%translation_long WHERE file = %string% AND obsolete = 0", $modul);
while ($row2 = $db->fetch_array($res2)) {
$entry = $xml->write_tag('id', $row['id'], 4);
$entry .= $xml->write_tag('org', $row['org'], 4);
if ($row['de'] != '') {
$entry .= $xml->write_tag('de', $row['de'], 4);
}
if ($row['en'] != '') {
$entry .= $xml->write_tag('en', $row['en'], 4);
}
if ($row['es'] != '') {
$entry .= $xml->write_tag('es', $row['es'], 4);
}
if ($row['fr'] != '') {
$entry .= $xml->write_tag('fr', $row['fr'], 4);
}
if ($row['nl'] != '') {
$entry .= $xml->write_tag('nl', $row['nl'], 4);
}
if ($row['it'] != '') {
$entry .= $xml->write_tag('it', $row['it'], 4);
}
$entry .= $xml->write_tag('file', $modul, 4);
$content .= $xml->write_master_tag("entry", $entry, 3);
}
$db->free_result($res2);
$tables .= $xml->write_master_tag("content", $content, 2);
$lansuite .= $xml->write_master_tag("table", $tables, 1);
$output .= $xml->write_master_tag("lansuite", $header . $lansuite, 0);
// Filehandler. Make Backupcopy if Translationsfile exits
$file = $this->get_trans_filename($modul);
//if (file_exists($file)) copy($file, $file.time().'.bak'); // Backup
$file_handle = fopen($file, "w");
fputs($file_handle, $output);
fclose($file_handle);
}