Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Class implementing one (more or less complete) UTF-8 XML writer. More...
Protected Member Functions | |
get_default_prologue () | |
Get default prologue contents for this writer if there isn't a custom one. | |
text_content ($content) | |
Returns text contents processed by the corresponding @xml_contenttransformer. | |
write ($output) | |
Send some XML formatted chunk to output. | |
xml_safe_attr_content ($content) | |
Clean attribute content and encode needed chars (&, <, >, ") - single quotes not needed in this class
as far as we are enclosing with ". | |
xml_safe_text_content ($content) | |
Clean text content and encode needed chars (&, <, >) | |
xml_safe_utf8 ($content) | |
Perform some UTF-8 cleaning, stripping the control chars (x0-x1f) but tabs (x9), newlines (\xa) and returns (\xd). | |
Protected Attributes | |
$casefolding | |
$contenttransformer | |
$lastwastext | |
$level | |
$nullcontent | |
$opentags | |
$output | |
$prologue | |
$running | |
$xmlschema | |
Class implementing one (more or less complete) UTF-8 XML writer.
General purpose class used to output UTF-8 XML contents easily. Can be customized using implementations of @xml_output (to define where to send the xml) and and @xml_contenttransformer (to perform any transformation in contents before outputting the XML).
Has support for attributes, basic w3c xml schemas declaration, and performs some content cleaning to avoid potential incorret UTF-8 mess and has complete exception support.
TODO: Provide UTF-8 safe strtoupper() function if using casefolding and non-ascii tags/attrs names TODO: Finish phpdocs
|
protected |
Perform some UTF-8 cleaning, stripping the control chars (x0-x1f) but tabs (x9), newlines (\xa) and returns (\xd).
The delete control char (x7f) is also included. All them are forbiden in XML 1.0 specs. The expression below seems to be UTF-8 safe too because it simply ignores the rest of characters. Also normalize linefeeds and return chars.