* Return html code for a tag
*/
public static function tag($tag,$content='',$attrs='') {
- #bye('zaza');
static $is_html = null;
- if ($is_html === null) $is_html = preg_match('/ml$/',self::content_type()) ? true : false;
- #bye((int)$is_html);
+ if ($is_html === null) $is_html = self::is('xtml') ? true : false;
# Extract attrs from tag
if (preg_match('/^([\w-]+)\s+(.*?)$/',$tag,$m)) {
static function debug($debug,$level=0) {
if (is_array($debug) or is_object($debug)) $debug = print_r($debug,true);
- if (preg_match('/ml$/',self::$content_type)) {
+ if (self::is('xtml')) {
#echo "<!-- $debug -->";
echo "<pre class=\"ui-state-highlight debug\">".htmlentities($debug)."</pre>".NB_EOL;
$this->headers();
if (preg_match('/html$/',self::$content_type)) {
+ #if (self::is('html')) {
echo $this->doctype();
if ( empty($this->title) and !empty($title) ) $this->title = join($this->sep,$title);
if ( empty($this->h1) and !empty($html) ) $this->h1 = join($this->sep,$html);
if ( empty($this->h1) and !empty($this->title) ) $this->h1 = $this->title;
- if (preg_match('/ml$/',self::$content_type)) {
+ if (self::is('xtml')) {
echo $this->head();
public static function end() {
- if (preg_match('/ml$/',self::$content_type)) {
+ if (self::is('xtml')) {
self::tag_end();
echo '</body>' . NB_EOL;
if (preg_match('/html$/',self::$content_type)) echo '</html>' . NB_EOL;
if ($is == 'xhtml') return preg_match('/xhtml$/',self::$content_type);
if ($is == 'html') return preg_match('/html$/',self::$content_type);
if ($is == 'xml') return preg_match('/xml$/',self::$content_type);
+ if ($is == 'xtml') return preg_match('/(x|ht)ml$/',self::$content_type);
if ($is == 'text') return preg_match('/^text\//',self::$content_type);
die("Db->is(): unknow argument '$is'. Accepted values are xhtml, html, xml");
}
# Pretty h2
$phpinfo = preg_replace_callback ('@(<h2>(?:<[^>]+>)?)([^<]+)@',function($m){return $m[1].prettyText($m[2]);},$phpinfo);
- if ($text) return $phpinfo;
+# NB 21.12.16 if ($text) return $phpinfo;
if (!preg_match_all('@(<h2.*?</table>)@s',$phpinfo,$m)) return '';
+ #bye($m[0]);
+ if ($text) return strip_tags(join("\n",$m[0]));
return join("\n",$m[0]);
}