diff options
author | Christian Schneider | 2018-05-09 15:34:35 +0200 |
---|---|---|
committer | Christian Schneider | 2018-05-09 15:34:35 +0200 |
commit | 5689233970dc6476a33b2ce2981d2281758f70ad (patch) | |
tree | bcb9be82ff8f7f2de6c9c675d1ddcf9eb8b731af /it_html.class | |
parent | 4eb159dac24263803291afa12d6ae0c45f6d712f (diff) | |
parent | d1195a5f10cdc4e8cb8a3a5e1c58f46fba9e5f3d (diff) | |
download | itools-5689233970dc6476a33b2ce2981d2281758f70ad.tar.gz itools-5689233970dc6476a33b2ce2981d2281758f70ad.tar.bz2 itools-5689233970dc6476a33b2ce2981d2281758f70ad.zip |
Merge branch 'cs/xmlnamespace'
Diffstat (limited to 'it_html.class')
-rw-r--r-- | it_html.class | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/it_html.class b/it_html.class index 58e0b84..f433e14 100644 --- a/it_html.class +++ b/it_html.class @@ -76,7 +76,7 @@ function __construct($p = array()) 'htmltype' => 'html5', # 'html5', 'html' (=old-style), 'xhtml' or 'xhtml-mobile' for xhtml, or 'xml' for plain xml without magic 'lang' => 'de', # Language code to use in <html lang="..."> tag 'moretags' => '', # Comma-separated list of tag-functions to generate additionally to 'tags' - 'name' => 'it_html', # Name of global variable $this is assigned to (string), XXX Copy and paste in configure() to keep PHP4 compatibility + 'name' => $p['htmltype'] == 'xml' ? 'it_html_xml' : 'it_html', # Name of global variable $this is assigned to (string), XXX Copy and paste in configure() 'nonewlinetags' => 'a,b,em,img,input,label,span,noscript', # tags that do not like newlines after them 'prettyprint' => it::is_devel(), # Should output be prettily indented? 'show_boot_dom' => false, # If true, append invisible <div id="it_boot_dom"> at the end of body @@ -88,6 +88,7 @@ function __construct($p = array()) 'title' => '', # HTML title (default: no title added) 'use_it_state' => false, # If true, generate code needed by state.js (aka 'history iframe') 'srclines' => $GLOBALS['debug_srclines'], # append stackdump to each tag + 'error_on_redefine' => false, # Generate it::error when trying to redefine function for a tag ); $this->p['notexported'] = trim($p['notexported'] . ',configure,sanitize,comment', ','); @@ -100,6 +101,10 @@ function __construct($p = array()) 'xml' => '' ); + # @@@ Hack: Manually copy for new instance without custom value to keep setting from global auto_prepend instance + if (!isset($p['error_on_redefine']) && isset($GLOBALS[$this->p['name']])) + $this->p['error_on_redefine'] = $GLOBALS[$this->p['name']]->p['error_on_redefine']; + # Since name is given as param, it is our duty to store it, not our caller's. $GLOBALS[$this->p['name']] =& $this; @@ -111,6 +116,8 @@ function __construct($p = array()) { if (!function_exists($func) && $func) $code[$func] = "function $func() { \$args = func_get_args(); return \$GLOBALS['{$this->p['name']}']->_tag('$func', \$args); }"; + else if ($this->p['error_on_redefine']) + it::error("Trying to redefine existing function '$func' in it_html"); } # Create global functions for it_html methods @@ -138,7 +145,7 @@ function __construct($p = array()) */ static function configure($p) { - $ithtml = $GLOBALS[$p['name'] ? $p['name'] : "it_html"]; + $ithtml = $GLOBALS[$p['name'] ?: ($p['htmltype'] == 'xml' ? 'it_html_xml' : 'it_html')]; $ithtml->p = $p + (array)$ithtml->p; $ithtml->alltags = array_flip(explode(',', trim($ithtml->p['tags'] . ',' . $ithtml->p['moretags'], ','))); $ithtml->hasnonewline = array_flip(explode(',', $ithtml->p['nonewlinetags'])); |