]> git.nbdom.net Git - nb.git/commitdiff
function type, is_html
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 19 Mar 2016 17:40:26 +0000 (17:40 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 19 Mar 2016 17:40:26 +0000 (17:40 +0000)
lib/php/out.php

index dbabf711a2e8cb8ebed0266c8f3c4f9edd89dbda..201766ec2d3a7e44f6e85e5f869d00e891ca9a47 100644 (file)
@@ -10,14 +10,8 @@ class Out extends Nb {
 
   public static $types = null; public static function types() {
     self::$types = array(
-      'csv' => array(
-        'enclose' => array("","\n"),
-        'eol' => "\n",
-        'sep' => (self::p('sep') ? self::p('sep') : "\t"),
-        'head' => 'out_csv_head',
-        'function' => 'out_csv',
-      ),
       'divs' => array(
+        'is_html' => true,
         'enclose' => array("<div class=\"rows\">".NB_EOL,"</div>".NB_EOL),
         'tag_enclose' => 'div class="row"',
         #'tag_head' => 'span',
@@ -27,6 +21,7 @@ class Out extends Nb {
         'head' => 'out_tag_head',
       ),
       'center' => array(
+        'is_html' => true,
         'enclose' => array("<center>".NB_EOL,"</center>".NB_EOL),
         'tag_enclose' => 'div',
         'tag' => 'label',
@@ -34,6 +29,7 @@ class Out extends Nb {
         'head' => 'out_tag_head',
       ),
       'table' => array(
+        'is_html' => true,
         'enclose' => array("<table class=\"rows\">".NB_EOL,"</table>".NB_EOL),
         'tag_enclose' => 'tr class="row"',
         'tag_head' => 'th',
@@ -42,9 +38,16 @@ class Out extends Nb {
         'head' => 'out_tag_head',
       ),
       'xml' => array(
-        'enclose' => array('<?xml version="1.0" encoding="utf-8"?>'.NB_EOL."<rows>".NB_EOL,"</rows>".NB_EOL),
+        'enclose' => array('<?xml version="1.0" encoding="utf-8"?'.'>'.NB_EOL."<rows>".NB_EOL,"</rows>".NB_EOL),
         'function' => 'out_xml',
       ),
+      'csv' => array(
+        'enclose' => array("","\n"),
+        'eol' => "\n",
+        'sep' => (self::p('sep') ? self::p('sep') : "\t"),
+        'head' => 'out_csv_head',
+        'function' => 'out_csv',
+      ),
       'yaml' => array(
         'enclose' => array("---\n",""),
         'function' => 'out_yaml',
@@ -151,6 +154,13 @@ class Out extends Nb {
     if ($count) self::end($conf);
   }
 
+  public static function type($name,$key='') {
+    if (empty(self::$types[$name])) return null;
+    $type = self::$types[$name];
+    if ($key) return( (array_key_exists($key,$type)) ? $type[$key] : null );
+    return $type;
+  }
+
 } Out::types() ; # < Class
 /****************************************************************************/