public function HTML5::save in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/masterminds/html5/src/HTML5.php \Masterminds\HTML5::save()
Save a DOM into a given file as HTML5.
Parameters
mixed $dom: The DOM to be serialized.
string $file: The filename to be written.
array $options: Configuration options when serializing the DOM. These include:
- encode_entities: Text written to the output is escaped by default and not all
entities are encoded. If this is set to true all entities will be encoded. Defaults to false.
1 call to HTML5::save()
- HTML5::saveHTML in vendor/
masterminds/ html5/ src/ HTML5.php - Convert a DOM into an HTML5 string.
File
- vendor/
masterminds/ html5/ src/ HTML5.php, line 210
Class
- HTML5
- This class offers convenience methods for parsing and serializing HTML5. It is roughly designed to mirror the \DOMDocument class that is provided with most versions of PHP.
Namespace
MastermindsCode
public function save($dom, $file, $options = array()) {
$close = true;
if (is_resource($file)) {
$stream = $file;
$close = false;
}
else {
$stream = fopen($file, 'w');
}
$options = array_merge($this
->getOptions(), $options);
$rules = new OutputRules($stream, $options);
$trav = new Traverser($dom, $stream, $rules, $options);
$trav
->walk();
if ($close) {
fclose($stream);
}
}