summaryrefslogtreecommitdiff
path: root/it_html.class
diff options
context:
space:
mode:
authorChristian Schneider2014-09-30 14:14:04 +0200
committerChristian Schneider2014-09-30 14:14:04 +0200
commit33e8695833b94fd1c83e37d7c7de9ced4edbb673 (patch)
treefd6b6e83f8a446e8d7bcfd5e30f7f7e391ee7d05 /it_html.class
parent2c5b6fd862894d5fe6118942460fdcdb10605e49 (diff)
downloaditools-33e8695833b94fd1c83e37d7c7de9ced4edbb673.tar.gz
itools-33e8695833b94fd1c83e37d7c7de9ced4edbb673.tar.bz2
itools-33e8695833b94fd1c83e37d7c7de9ced4edbb673.zip
Add $p["class"] support to add class to html tag, document class and manifest parameter
Diffstat (limited to 'it_html.class')
-rw-r--r--it_html.class7
1 files changed, 4 insertions, 3 deletions
diff --git a/it_html.class b/it_html.class
index ec24da6..7ab25a2 100644
--- a/it_html.class
+++ b/it_html.class
@@ -150,17 +150,18 @@ function configure($p)
*
* @param any number of text args or array of key => value pairs
* Defaults for key => value parameters are inherited from the it_html constructor and should be set there.
- * The parameters are $p['lang'], $p['htmltype'] and $p['doctype']
+ * The parameters are $p['lang'], $p['htmltype'], $p['doctype'], $p['class'] and $p['manifest']
*/
function html($args)
{
list($data, $p) = it_parse_args($args);
$p += $this->p;
- $manifest = $p['manifest'] ? ' manifest="' . Q($p['manifest']) . '"' : "";
+ foreach (array('class', 'manifest') as $attr)
+ $attrs .= $p[$attr] ? " $attr=" . '"' . Q($p[$attr]) . '"' : "";
$html = ($p['doctype'] ? $p['doctype'] : $this->doctypes[$p['htmltype']]) . "\n" .
- '<html ' . ($p['htmltype'] == "xhtml" ? 'xmlns="http://www.w3.org/1999/xhtml" ' : '') . ($p['htmltype'] == "xhtml-mobile" ? 'xml:lang' : 'lang') . "=\"{$p['lang']}\"$manifest>\n" . $data . ($p['omit_endhtml'] ? '' : "</html>\n");
+ '<html ' . ($p['htmltype'] == "xhtml" ? 'xmlns="http://www.w3.org/1999/xhtml" ' : '') . ($p['htmltype'] == "xhtml-mobile" ? 'xml:lang' : 'lang') . "=\"{$p['lang']}\"$attrs>\n" . $data . ($p['omit_endhtml'] ? '' : "</html>\n");
return EDC('upd') ? it::replace(array('<!DOCTYPE.*<head>' => ''), $html, array('singleline' => true)) : $html;
}