From: Nicolas Boisselier Date: Sat, 19 Mar 2016 17:40:26 +0000 (+0000) Subject: function type, is_html X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=cb3b7a977feb58fcc31bbd168d16bb7c3f0af31b;p=nb.git function type, is_html --- diff --git a/lib/php/out.php b/lib/php/out.php index dbabf711..201766ec 100644 --- a/lib/php/out.php +++ b/lib/php/out.php @@ -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("
".NB_EOL,"
".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("
".NB_EOL,"
".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("".NB_EOL,"
".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(''.NB_EOL."".NB_EOL,"".NB_EOL), + 'enclose' => array(''.NB_EOL."".NB_EOL,"".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 /****************************************************************************/