diff options
author | Christian Weber | 2007-08-31 18:04:03 +0000 |
---|---|---|
committer | Christian Weber | 2007-08-31 18:04:03 +0000 |
commit | eaeb6b586db5a06c7d2f91d7f8b8e259be5bea22 (patch) | |
tree | 584de2f6ca05e7b1d08204e3ae1460ee5337e5ef | |
parent | 6487a8beebb126105c3fd1efa748a936bd8a67af (diff) | |
download | itools-eaeb6b586db5a06c7d2f91d7f8b8e259be5bea22.tar.gz itools-eaeb6b586db5a06c7d2f91d7f8b8e259be5bea22.tar.bz2 itools-eaeb6b586db5a06c7d2f91d7f8b8e259be5bea22.zip |
Fix title, simplified u()
-rw-r--r-- | it_html.class | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/it_html.class b/it_html.class index af31ee5..79ba540 100644 --- a/it_html.class +++ b/it_html.class @@ -54,6 +54,7 @@ function it_html($p = array()) 'staticallycallable' => 'q,u,select', # Those methods are statically callable (have same arguments as global stubs) but are a bit slower 'use_it_state' => false, # If true, generate code needed by state.js (aka 'history iframe') 'tags' => 'a,b,br,button,div,em,form,h1,h2,h3,h4,h5,h6,hr,input,label,li,meta,p,span,table,td,textarea,th,tr,ul', + 'title' => '', # HTML title (default: empty title) ); # We know these doctypes. If you need something else, supply 'doctype' in p @@ -122,7 +123,6 @@ function html($args) * 'keywords' optional data for <meta name="keywords"> tag * 'lang' optional language (defaults to 'de') * 'stylesheets' optional array mediatype => url of styleshests - * 'title' optional HTML title tag (default: empty title) */ function head($args = array()) { @@ -131,10 +131,7 @@ function head($args = array()) list($data, $p) = $this->_parse_args($args); $p += $this->p; - $this->p = $p += array( - 'content-type' => "text/html; charset={$p['charset']}", - 'title' => tag('title', Q($p['title'])) - ); + $this->p = ($p += array('content-type' => "text/html; charset={$p['charset']}")); $header = $p['show_content_type'] ? meta(array('http-equiv' => "Content-Type", 'content' => $p['content-type'])) : ""; @@ -152,6 +149,8 @@ function head($args = array()) if (!empty($p['cssinline'])) $header .= tag('style', array('type' => "text/css", "\n" . preg_replace(array('/\s*\/\*[^\*]+\*\//Um', '/\s*\{\s*/', '/;\s+/'), array('', '{', ';'), $p['cssinline']))); + $header .= tag('title', Q($p['title'])); + if($this->p['htmltype'] == "xhtml-mobile" && strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) header("Content-Type: application/xhtml+xml; charset={$this->p['charset']}"); # for validation else if (!headers_sent()) # prevent warnings when ED() in use @@ -437,24 +436,7 @@ function q($string) function u(/* ... */) { $args = func_get_args(); - $base = null; - $params = array(); - - foreach($args as $arg) - { - if (is_array($arg)) - { - foreach ($arg as $key => $value) - { - if (is_int($key)) - $base .= $value; - else - $params[$key] = $value; - } - } - else - $base .= $arg; - } + list($base, $params) = it_html::_parse_args($args); if (!isset($base)) $base = $_SERVER['PHP_SELF']; |