abstract class TemplateLoader

Constants

XMLNS_XSL

XSL namespace

Methods

static Document
load(string $template)

Load a template as an xsl:template node

static string
save(Document $dom)

Serialize a loaded template back into a string

static string
fixEntities(string $template)

Replace HTML entities and unescaped ampersands in given template

static Document
loadAsHTML(string $template)

Load given HTML template in a DOM document

static Document
loadAsXML(string $template)

Load given XSL template in a DOM document

static void
removeInvalidAttributes(Document $dom)

Remove attributes with an invalid name from given DOM document

static string
replaceCDATA(string $template)

Replace CDATA sections in given template

static string
replaceEntities(string $template)

Replace known HTML entities

Details

at line 50
static Document load(string $template)

Load a template as an xsl:template node

Will attempt to load it as XML first, then as HTML as a fallback. Either way, an xsl:template node is returned

Parameters

string $template

Return Value

Document

at line 77
static string save(Document $dom)

Serialize a loaded template back into a string

NOTE: removes the root node created by load()

Parameters

Document $dom

Return Value

string

at line 94
static protected string fixEntities(string $template)

Replace HTML entities and unescaped ampersands in given template

Parameters

string $template

Return Value

string

at line 108
static protected Document loadAsHTML(string $template)

Load given HTML template in a DOM document

Parameters

string $template

Original template

Return Value

Document

at line 137
static protected Document loadAsXML(string $template)

Load given XSL template in a DOM document

Parameters

string $template

Original template

Return Value

Document

Document on success, FALSE otherwise

at line 156
static protected void removeInvalidAttributes(Document $dom)

Remove attributes with an invalid name from given DOM document

Parameters

Document $dom

Return Value

void

at line 174
static protected string replaceCDATA(string $template)

Replace CDATA sections in given template

Parameters

string $template

Original template

Return Value

string

Modified template

at line 192
static protected string replaceEntities(string $template)

Replace known HTML entities

Parameters

string $template

Return Value

string