Public Member Functions | |
t3lib_xml ($topLevelName) | |
Constructor, setting topLevelName to the input var. | |
setRecFields ($table, $list) | |
When outputting a input record in XML only fields listed in $this->XML_recFields for the current table will be rendered. | |
getResult () | |
Returns the result of the XML rendering, basically this is imploding the internal ->lines array with linebreaks. | |
WAPHeader () | |
Initialize WML (WAP) document with <?xml + <!DOCTYPE header tags and setting ->topLevelName as the first level. | |
renderHeader () | |
Initialize "anonymous" XML document with <?xml + <!DOCTYPE header tags and setting ->topLevelName as the first level. | |
renderFooter () | |
Sets the footer (of ->topLevelName). | |
newLevel ($name, $beginEndFlag=0, $params=array()) | |
Indents/Outdents a new level named, $name. | |
indent ($b) | |
Function that will return the content from string $content. | |
renderRecords ($table, $res) | |
Takes a SQL result for $table and traverses it, adding rows. | |
addRecord ($table, $row) | |
Adds record, $row, from table, $table, to the internal array of XML-lines. | |
getRowInXML ($table, $row) | |
Internal function for adding the actual content of the $row from $table to the internal structure. | |
utf8 ($content) | |
UTF-8 encodes the input content (from ISO-8859-1!). | |
substNewline ($string) | |
Substitutes chr(10) characters with a '<newline/>' tag. | |
fieldWrap ($field, $value) | |
Wraps the value in tags with element name, $field. | |
WAPback () | |
Creates the BACK button for WAP documents. | |
addLine ($str) | |
Add a line to the internal XML structure (automatically prefixed with ->Icode. | |
Public Attributes | |
$topLevelName = 'typo3_test' | |
$XML_recFields = array() | |
$XMLIndent = 0 | |
$Icode = '' | |
$XMLdebug = 0 | |
$includeNonEmptyValues = 0 | |
$lines = array() |
|
Constructor, setting topLevelName to the input var.
Definition at line 102 of file class.t3lib_xml.php. 00102 { 00103 $this->topLevelName = $topLevelName; 00104 }
|
|
Add a line to the internal XML structure (automatically prefixed with ->Icode.
Definition at line 315 of file class.t3lib_xml.php. Referenced by WAPback(). 00315 { 00316 $this->lines[]=$this->Icode.$str; 00317 }
|
|
Adds record, $row, from table, $table, to the internal array of XML-lines.
Definition at line 237 of file class.t3lib_xml.php. References getRowInXML(), indent(), and table(). Referenced by renderRecords(). 00237 { 00238 $this->lines[]=$this->Icode.'<'.$table.' uid="'.$row["uid"].'">'; 00239 $this->indent(1); 00240 $this->getRowInXML($table,$row); 00241 $this->indent(0); 00242 $this->lines[]=$this->Icode.'</'.$table.'>'; 00243 }
|
|
Wraps the value in tags with element name, $field.
Definition at line 292 of file class.t3lib_xml.php. 00292 { 00293 return '<'.$field.'>'.$value.'</'.$field.'>'; 00294 }
|
|
Returns the result of the XML rendering, basically this is imploding the internal ->lines array with linebreaks.
Definition at line 122 of file class.t3lib_xml.php. References $content. 00122 { 00123 $content = implode(chr(10),$this->lines); 00124 return $this->output($content); 00125 }
|
|
Internal function for adding the actual content of the $row from $table to the internal structure. Notice that only fields from $table that are listed in $this->XML_recFields[$table] (set by setRecFields()) will be rendered (and in the order found in that array!) Content from the row will be htmlspecialchar()'ed, UTF-8 encoded and have chr(10) (newlines) exchanged for '<newline/>' tags. The element name for a value equals the fieldname from the record.
Definition at line 255 of file class.t3lib_xml.php. References table(). Referenced by addRecord(). 00255 { 00256 $fields = t3lib_div::trimExplode(',',$this->XML_recFields[$table],1); 00257 reset($fields); 00258 while(list(,$field)=each($fields)) { 00259 if ($row[$field] || $this->includeNonEmptyValues) { 00260 $this->lines[]=$this->Icode.$this->fieldWrap($field,$this->substNewline($this->utf8(htmlspecialchars($row[$field])))); 00261 } 00262 } 00263 }
|
|
Function that will return the content from string $content. If the internal ->XMLdebug flag is set the content returned will be formatted in -tags
Definition at line 208 of file class.t3lib_xml.php. References $a. Referenced by addRecord(), and newLevel(). 00208 { 00209 if ($b) $this->XMLIndent++; else $this->XMLIndent--; 00210 $this->Icode=''; 00211 for ($a=0;$a<$this->XMLIndent;$a++) { 00212 $this->Icode.=chr(9); 00213 } 00214 return $this->Icode; 00215 }
|
|
Indents/Outdents a new level named, $name.
Definition at line 167 of file class.t3lib_xml.php. References $key, and indent(). Referenced by renderFooter(), renderHeader(), WAPback(), and WAPHeader(). 00167 { 00168 if ($beginEndFlag) { 00169 $pList=''; 00170 if (count($params)) { 00171 $par=array(); 00172 reset($params); 00173 while(list($key,$val)=each($params)) { 00174 $par[]=$key.'="'.htmlspecialchars($val).'"'; 00175 } 00176 $pList=' '.implode(' ',$par); 00177 } 00178 $this->lines[]=$this->Icode.'<'.$name.$pList.'>'; 00179 $this->indent(1); 00180 } else { 00181 $this->indent(0); 00182 $this->lines[]=$this->Icode.'</'.$name.'>'; 00183 } 00184 }
|
|
Sets the footer (of ->topLevelName).
Definition at line 155 of file class.t3lib_xml.php. References newLevel(). 00155 { 00156 $this->newLevel($this->topLevelName,0); 00157 }
|
|
Initialize "anonymous" XML document with <?xml + <!DOCTYPE header tags and setting ->topLevelName as the first level. Encoding is set to UTF-8!
Definition at line 144 of file class.t3lib_xml.php. References newLevel(). 00144 { 00145 $this->lines[]='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'; 00146 $this->lines[]='<!DOCTYPE '.$this->topLevelName.'>'; 00147 $this->newLevel($this->topLevelName,1); 00148 }
|
|
Takes a SQL result for $table and traverses it, adding rows.
Definition at line 224 of file class.t3lib_xml.php. References addRecord(), and table(). 00224 { 00225 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00226 $this->addRecord($table,$row); 00227 } 00228 }
|
|
When outputting a input record in XML only fields listed in $this->XML_recFields for the current table will be rendered.
Definition at line 113 of file class.t3lib_xml.php. 00113 { 00114 $this->XML_recFields[$table]=$list; 00115 }
|
|
Substitutes chr(10) characters with a '<newline/>' tag.
Definition at line 281 of file class.t3lib_xml.php. 00281 {
00282 return ereg_replace(chr(10),'<newline/>',$string);
00283 }
|
|
UTF-8 encodes the input content (from ISO-8859-1!).
Definition at line 271 of file class.t3lib_xml.php. 00271 {
00272 return utf8_encode($content);
00273 }
|
|
Creates the BACK button for WAP documents.
Definition at line 301 of file class.t3lib_xml.php. References addLine(), and newLevel(). 00301 { 00302 $this->newLevel('template',1); 00303 $this->newLevel('do',1,array('type'=>'accept','label'=>'Back')); 00304 $this->addLine('<prev/>'); 00305 $this->newLevel('do'); 00306 $this->newLevel('template'); 00307 }
|
|
Initialize WML (WAP) document with <?xml + <!DOCTYPE header tags and setting ->topLevelName as the first level.
Definition at line 132 of file class.t3lib_xml.php. References newLevel(). 00132 { 00133 $this->lines[]='<?xml version="1.0"?>'; 00134 $this->lines[]='<!DOCTYPE '.$this->topLevelName.' PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">'; 00135 $this->newLevel($this->topLevelName,1); 00136 }
|
|
Definition at line 91 of file class.t3lib_xml.php. |
|
Definition at line 93 of file class.t3lib_xml.php. |
|
Definition at line 94 of file class.t3lib_xml.php. |
|
Definition at line 87 of file class.t3lib_xml.php. |
|
Definition at line 88 of file class.t3lib_xml.php. |
|
Definition at line 92 of file class.t3lib_xml.php. |
|
Definition at line 90 of file class.t3lib_xml.php. |