class FrxSVGDoc in Forena Reports 7.3
Same name and namespace in other branches
- 7.4 docformats/FrxSVGDoc.inc \FrxSVGDoc
@file FrxSVGDoc Embedded SVG Graph as it's own document. @author davidmetzler
Hierarchy
- class \FrxDocument
- class \FrxSVGDoc
Expanded class hierarchy of FrxSVGDoc
1 string reference to 'FrxSVGDoc'
- forena_forena_document_types in ./
forena.module - Self register document formats with Forena
File
- docformats/
FrxSVGDoc.inc, line 8 - FrxSVGDoc Embedded SVG Graph as it's own document. @author davidmetzler
View source
class FrxSVGDoc extends FrxDocument {
public function __construct() {
$this->content_type = 'image/svg+xml';
}
public function render($r, $format, $options = array()) {
$output = '';
$doc = new DomDocument();
$xml_body = '<html><body>' . $this
->check_markup($r->html) . '</body></html>';
$doc->formatOutput = FALSE;
$doc->strictErrorChecking = FALSE;
$doc
->loadXML($xml_body);
//print($xml_body);
$xml = simplexml_import_dom($doc);
$xml
->registerXPathNamespace('__empty_ns', 'http://www.w3.org/2000/svg');
if ($xml) {
$svg = $xml
->xpath('//__empty_ns:svg');
}
if ($svg) {
$output .= $svg[0]
->asXML();
}
else {
$output = '<svg/>';
}
return $output;
}
/**
* Output SVG content type headers.
*/
public function output($output) {
if ($this->content_type) {
header('Content-Type: ' . $this->content_type);
header('Cache-Control:');
header('Pragma:');
header('Cache-Control: must-revalidate');
print $output;
return TRUE;
}
else {
return FALSE;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FrxDocument:: |
public | property | ||
FrxDocument:: |
public | property | ||
FrxDocument:: |
public | property | ||
FrxDocument:: |
public | function | Wrapper function for check output to default the right type. | |
FrxDocument:: |
public | function | ||
FrxDocument:: |
public | function | ||
FrxSVGDoc:: |
public | function |
Output SVG content type headers. Overrides FrxDocument:: |
|
FrxSVGDoc:: |
public | function |
Overrides FrxDocument:: |
|
FrxSVGDoc:: |
public | function |