本文整理汇总了PHP中XML::addXMLBranch方法的典型用法代码示例。如果您正苦于以下问题:PHP XML::addXMLBranch方法的具体用法?PHP XML::addXMLBranch怎么用?PHP XML::addXMLBranch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML
的用法示例。
在下文中一共展示了XML::addXMLBranch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHTMLTitlesFormatted
/**
* Returns HTML-formatted RSS items
* @method getHTMLTitlesFormatted
* @returns string HTML-formatted RSS items
*/
function getHTMLTitlesFormatted()
{
$itemBranchesXML = new XML("ul");
reset($this->itemBranches);
foreach ($this->itemBranches as $newsItem) {
$itemXML = new XMLBranch("li");
$itemLinkXML = new XMLBranch("a");
$itemLinkXML->setTagContent($newsItem->getTagContent("item/title"));
$itemLinkXML->setTagAttribute("href", $newsItem->getTagContent("item/link"));
$itemXML->addXMLBranch($itemLinkXML);
$itemBranchesXML->addXMLBranch($itemXML);
}
return $itemBranchesXML->getXMLString();
}
示例2: getClassDocFromClass
/**
* Returns class documentation as a string, formatted in HTML
* @method getClassDocFromClass
* @param object objClass
* @returns string HTML-formatted documentation if successful, false otherwise
*/
function getClassDocFromClass($objClass)
{
if (is_object($objClass) && get_class($objClass) == "phpclass") {
$classDocXML = new XML("html");
// ---------------------- HEAD ---------------------- //
$headXML = new XMLBranch("head");
$headXML->setTagContent($objClass->getInfo("name"), "head/title");
$headXML->setTagContent("", "head/meta");
$headXML->setTagAttribute("http-equiv", "content-type", "head/meta");
$headXML->setTagAttribute("content", "text/html; charset=ISO-8859-1", "head/meta");
$headXML->setTagContent($this->CSSStringDefault, "head/style");
$headXML->setTagAttribute("type", "text/css", "head/style");
// ---------------------- BODY ---------------------- //
$bodyXML = new XMLBranch("body");
$classTitleXML = new XMLBranch("h1");
$classTitleXML->setTagAttribute("class", "classTitle");
$classTitleXML->setTagContent($objClass->getInfo("name") . " Class");
$bodyXML->addXMLBranch($classTitleXML);
foreach ($objClass->info as $infoKey => $infoValue) {
$brXML = new XMLBranch("br");
$bodyXML->addXMLBranch($brXML);
if (is_array($infoValue)) {
$spanXML = new XMLBranch("span");
$spanXML->setTagAttribute("class", $infoKey);
$spanXML->setTagContent(ucfirst($infoKey) . ":");
$ulXML = new XMLBranch("ul");
$ulXML->setTagAttribute("class", $infoKey);
foreach ($infoValue as $value) {
$liXML = new XMLBranch("li");
$liXML->setTagContent($value);
$ulXML->addXMLBranch($liXML);
}
$bodyXML->addXMLBranch($spanXML);
$bodyXML->addXMLBranch($ulXML);
} else {
$spanXML = new XMLBranch("span");
$spanXML->setTagAttribute("class", $infoKey);
$spanXML->setTagContent(ucfirst($infoKey) . ": " . $infoValue);
$bodyXML->addXMLBranch($spanXML);
}
}
$hrXML = new XMLBranch("hr");
$bodyXML->addXMLBranch($hrXML);
$h2XML = new XMLBranch("h2");
$h2XML->setTagAttribute("class", "methodsTitle");
$h2XML->setTagContent("All Methods");
$bodyXML->addXMLBranch($h2XML);
$spanXML = new XMLBranch("span");
$spanXML->setTagAttribute("class", "methodList");
foreach ($objClass->methods as $methodName => $method) {
$aMethodXML = new XMLBranch("a");
$aMethodXML->setTagAttribute("href", "#" . $methodName);
$aMethodXML->setTagContent($methodName);
$brXML = new XMLBranch("br");
$spanXML->addXMLBranch($aMethodXML);
$spanXML->addXMLBranch($brXML);
}
$bodyXML->addXMLBranch($spanXML);
foreach ($objClass->methods as $methodName => $method) {
$hrXML = new XMLBranch("hr");
$bodyXML->addXMLBranch($hrXML);
$pMethodXML = new XMLBranch("p");
$aMethodXML = new XMLBranch("a");
$aMethodXML->setTagAttribute("name", $methodName);
$spanXMLName = new XMLBranch("span");
$spanXMLName->setTagAttribute("class", "methodName");
$spanXMLName->setTagContent($methodName);
$spanXMLArgs = new XMLBranch("span");
$tagContentArgs = " ( ";
if (is_array($method->params) && count($method->params) > 0) {
$paramCount = 0;
foreach ($method->params as $key => $value) {
if ($paramCount > 0) {
$tagContentArgs .= ", ";
}
$tagContentArgs .= $key;
$paramCount++;
}
}
$tagContentArgs .= " )";
$spanXMLArgs->setTagContent($tagContentArgs);
$aMethodXML->addXMLBranch($spanXMLName);
$aMethodXML->addXMLBranch($spanXMLArgs);
$pMethodXML->addXMLBranch($aMethodXML);
$bodyXML->addXMLBranch($pMethodXML);
unset($method->info["name"]);
foreach ($method->info as $infoKey => $infoValue) {
if (is_array($infoValue)) {
$pXML = new XMLBranch("p");
$pXML->setTagAttribute("class", $infoKey);
$pXML->setTagContent(ucfirst($infoKey) . ":");
$ulXML = new XMLBranch("ul");
$ulXML->setTagAttribute("class", $infoKey);
foreach ($infoValue as $value) {
//.........这里部分代码省略.........
示例3: modsRecord
function modsRecord($row)
{
global $databaseBaseURL;
// these variables are defined in 'ini.inc.php'
global $contentTypeCharset;
global $fileVisibility;
global $fileVisibilityException;
global $filesBaseURL;
global $convertExportDataToUTF8;
// defined in 'transtab_unicode_charset.inc.php' and 'transtab_latin1_charset.inc.php'
global $alnum, $alpha, $cntrl, $dash, $digit, $graph, $lower, $print, $punct, $space, $upper, $word, $patternModifiers;
$exportPrivate = True;
// This will be a global variable or will be used
// when modsRow is called and will determine if we
// export user-specific data
$exportRecordURL = True;
// Specifies whether an attribution string containing
// the URL to the refbase database record (and the last
// modification date) shall be written to the notes branch.
// Note that this string is required by the "-A|--append"
// feature of the 'refbase' command line client
// convert this record's modified date/time info to UNIX time stamp format:
// => "date('D, j M Y H:i:s O')", e.g. "Sat, 15 Jul 2006 22:24:16 +0200"
// function 'generateRFC2822TimeStamp()' is defined in 'include.inc.php'
$currentDateTimeStamp = generateRFC2822TimeStamp($row['modified_date'], $row['modified_time']);
// --- BEGIN TYPE * ---
// |
// | These apply to everything
// this is a stupid hack that maps the names of the '$row' array keys to those used
// by the '$formVars' array (which is required by function 'generateCiteKey()')
// (eventually, the '$formVars' array should use the MySQL field names as names for its array keys)
$formVars = buildFormVarsArray($row);
// function 'buildFormVarsArray()' is defined in 'include.inc.php'
// generate or extract the cite key for this record
// (note that charset conversion can only be done *after* the cite key has been generated,
// otherwise cite key generation will produce garbled text!)
$citeKey = generateCiteKey($formVars);
// function 'generateCiteKey()' is defined in 'include.inc.php'
// Create an XML object for a single record.
$record = new XML("mods");
$record->setTagAttribute("version", "3.2");
if (!empty($citeKey)) {
$record->setTagAttribute("ID", $citeKey);
}
// titleInfo
// Regular Title
if (!empty($row['title'])) {
$record->setTagContent(encodeXMLField('title', $row['title']), "mods/titleInfo/title");
}
// Translated Title
// NOTE: This field is excluded by the default cite SELECT method
if (!empty($row['orig_title'])) {
$orig_title = new XMLBranch("titleInfo");
$orig_title->setTagAttribute("type", "translated");
$orig_title->setTagContent(encodeXMLField('orig_title', $row['orig_title']), "titleInfo/title");
$record->addXMLBranch($orig_title);
}
// name
// author
if (!empty($row['author'])) {
if (preg_match("/ *\\(eds?\\)\$/", $row['author'])) {
$author = preg_replace("/[ \r\n]*\\(eds?\\)/i", "", $row['author']);
$nameArray = separateNames("author", "/\\s*;\\s*/", "/\\s*,\\s*/", "/(?<=^|[{$word}])[^-{$word}]+|(?<=^|[{$upper}])(?=\$|[{$upper}])/{$patternModifiers}", $author, "personal", "editor");
} else {
if ($row['type'] == "Map") {
$nameArray = separateNames("author", "/\\s*;\\s*/", "/\\s*,\\s*/", "/(?<=^|[{$word}])[^-{$word}]+|(?<=^|[{$upper}])(?=\$|[{$upper}])/{$patternModifiers}", $row['author'], "personal", "cartographer");
} else {
$nameArray = separateNames("author", "/\\s*;\\s*/", "/\\s*,\\s*/", "/(?<=^|[{$word}])[^-{$word}]+|(?<=^|[{$upper}])(?=\$|[{$upper}])/{$patternModifiers}", $row['author'], "personal", "author");
}
}
foreach ($nameArray as $singleName) {
$record->addXMLBranch($singleName);
}
}
// originInfo
if (!empty($row['year']) || !empty($row['publisher']) || !empty($row['place'])) {
$origin = new XMLBranch("originInfo");
// dateIssued
if (!empty($row['year'])) {
$origin->setTagContent(encodeXMLField('year', $row['year']), "originInfo/dateIssued");
}
// Book Chapters and Journal Articles only have a dateIssued
// (editions, places, and publishers are associated with the host)
if (!preg_match("/^(Book Chapter|Journal Article)\$/", $row['type'])) {
// publisher
if (!empty($row['publisher'])) {
$origin->setTagContent(encodeXMLField('publisher', $row['publisher']), "originInfo/publisher");
}
// place
if (!empty($row['place'])) {
$origin->setTagContent(encodeXMLField('place', $row['place']), "originInfo/place/placeTerm");
$origin->setTagAttribute("type", "text", "originInfo/place/placeTerm");
}
// edition
if (!empty($row['edition'])) {
$origin->setTagContent(encodeXMLField('edition', $row['edition']), "originInfo/edition");
}
}
if ($origin->hasBranch()) {
$record->addXMLBranch($origin);
//.........这里部分代码省略.........
示例4: odfSpreadsheetTableRow
function odfSpreadsheetTableRow($recordExportArray, $rowType)
{
// create an XML object for a single record
$record = new XML("table:table-row");
if ($rowType == "heading") {
$record->setTagAttribute("table:style-name", "ro1");
foreach ($recordExportArray as $odfIndex => $indexValue) {
$tableCell = new XMLBranch("table:table-cell");
$tableCell->setTagAttribute("office:value-type", "string");
$tableCell->setTagContent($odfIndex, "table:table-cell/text:p");
$record->addXMLBranch($tableCell);
}
} else {
$record->setTagAttribute("table:style-name", "ro2");
foreach ($recordExportArray as $odfIndex => $indexValue) {
$tableCell = new XMLBranch("table:table-cell");
if (!empty($indexValue)) {
$tableCell->setTagAttribute("office:value-type", "string");
$tableCell->setTagContent($indexValue, "table:table-cell/text:p");
}
$record->addXMLBranch($tableCell);
}
}
return $record;
}