ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
HTMLPurifier_ConfigSchema_Builder_Xml Class Reference

Converts HTMLPurifier_ConfigSchema_Interchange to an XML format, which can be further processed to generate documentation. More...

+ Inheritance diagram for HTMLPurifier_ConfigSchema_Builder_Xml:
+ Collaboration diagram for HTMLPurifier_ConfigSchema_Builder_Xml:

Public Member Functions

 build ($interchange)
 
 buildDirective ($directive)
 

Protected Member Functions

 writeHTMLDiv ($html)
 
 export ($var)
 

Protected Attributes

 $interchange
 HTMLPurifier_ConfigSchema_Interchange More...
 

Private Attributes

 $namespace
 string More...
 

Detailed Description

Converts HTMLPurifier_ConfigSchema_Interchange to an XML format, which can be further processed to generate documentation.

Definition at line 7 of file Xml.php.

Member Function Documentation

◆ build()

HTMLPurifier_ConfigSchema_Builder_Xml::build (   $interchange)
Parameters
HTMLPurifier_ConfigSchema_Interchange$interchange

Definition at line 50 of file Xml.php.

References $interchange, and buildDirective().

51  {
52  // global access, only use as last resort
53  $this->interchange = $interchange;
54 
55  $this->setIndent(true);
56  $this->startDocument('1.0', 'UTF-8');
57  $this->startElement('configdoc');
58  $this->writeElement('title', $interchange->name);
59 
60  foreach ($interchange->directives as $directive) {
61  $this->buildDirective($directive);
62  }
63 
64  if ($this->namespace) {
65  $this->endElement();
66  } // namespace
67 
68  $this->endElement(); // configdoc
69  $this->flush();
70  }
$interchange
HTMLPurifier_ConfigSchema_Interchange
Definition: Xml.php:13
+ Here is the call graph for this function:

◆ buildDirective()

HTMLPurifier_ConfigSchema_Builder_Xml::buildDirective (   $directive)
Parameters
HTMLPurifier_ConfigSchema_Interchange_Directive$directive

Definition at line 75 of file Xml.php.

References $x, export(), and writeHTMLDiv().

Referenced by build().

76  {
77  // Kludge, although I suppose having a notion of a "root namespace"
78  // certainly makes things look nicer when documentation is built.
79  // Depends on things being sorted.
80  if (!$this->namespace || $this->namespace !== $directive->id->getRootNamespace()) {
81  if ($this->namespace) {
82  $this->endElement();
83  } // namespace
84  $this->namespace = $directive->id->getRootNamespace();
85  $this->startElement('namespace');
86  $this->writeAttribute('id', $this->namespace);
87  $this->writeElement('name', $this->namespace);
88  }
89 
90  $this->startElement('directive');
91  $this->writeAttribute('id', $directive->id->toString());
92 
93  $this->writeElement('name', $directive->id->getDirective());
94 
95  $this->startElement('aliases');
96  foreach ($directive->aliases as $alias) {
97  $this->writeElement('alias', $alias->toString());
98  }
99  $this->endElement(); // aliases
100 
101  $this->startElement('constraints');
102  if ($directive->version) {
103  $this->writeElement('version', $directive->version);
104  }
105  $this->startElement('type');
106  if ($directive->typeAllowsNull) {
107  $this->writeAttribute('allow-null', 'yes');
108  }
109  $this->text($directive->type);
110  $this->endElement(); // type
111  if ($directive->allowed) {
112  $this->startElement('allowed');
113  foreach ($directive->allowed as $value => $x) {
114  $this->writeElement('value', $value);
115  }
116  $this->endElement(); // allowed
117  }
118  $this->writeElement('default', $this->export($directive->default));
119  $this->writeAttribute('xml:space', 'preserve');
120  if ($directive->external) {
121  $this->startElement('external');
122  foreach ($directive->external as $project) {
123  $this->writeElement('project', $project);
124  }
125  $this->endElement();
126  }
127  $this->endElement(); // constraints
128 
129  if ($directive->deprecatedVersion) {
130  $this->startElement('deprecated');
131  $this->writeElement('version', $directive->deprecatedVersion);
132  $this->writeElement('use', $directive->deprecatedUse->toString());
133  $this->endElement(); // deprecated
134  }
135 
136  $this->startElement('description');
137  $this->writeHTMLDiv($directive->description);
138  $this->endElement(); // description
139 
140  $this->endElement(); // directive
141  }
$x
Definition: example_009.php:98
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ export()

HTMLPurifier_ConfigSchema_Builder_Xml::export (   $var)
protected
Parameters
mixed$var
Returns
string

Definition at line 39 of file Xml.php.

Referenced by buildDirective().

40  {
41  if ($var === array()) {
42  return 'array()';
43  }
44  return var_export($var, true);
45  }
+ Here is the caller graph for this function:

◆ writeHTMLDiv()

HTMLPurifier_ConfigSchema_Builder_Xml::writeHTMLDiv (   $html)
protected
Parameters
string$html

Definition at line 23 of file Xml.php.

References $html, and HTMLPurifier\getInstance().

Referenced by buildDirective().

24  {
25  $this->startElement('div');
26 
27  $purifier = HTMLPurifier::getInstance();
28  $html = $purifier->purify($html);
29  $this->writeAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
30  $this->writeRaw($html);
31 
32  $this->endElement(); // div
33  }
static getInstance($prototype=null)
Singleton for enforcing just one HTML Purifier in your system.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $interchange

HTMLPurifier_ConfigSchema_Builder_Xml::$interchange
protected

HTMLPurifier_ConfigSchema_Interchange

Definition at line 13 of file Xml.php.

Referenced by build().

◆ $namespace

HTMLPurifier_ConfigSchema_Builder_Xml::$namespace
private

string

Definition at line 18 of file Xml.php.


The documentation for this class was generated from the following file: