require_once(realpath(dirname(__FILE__).'/../db.php'));
require_once(realpath(dirname(__FILE__).'/../db/field.php'));
require_once(realpath(dirname(__FILE__).'/../out.php'));
+if (class_exists('WP_List_Table')) require_once(realpath(dirname(__FILE__).'/wp.php'));
#$a = array('a','b','c'); $b = array('c','a'); debug(array_diff($a,$b));
define('TABLE_INDENT',NB_EOL ? "\t" : "");
******************************************************************/
public function rows_sql(&$opt=array()) {
if (isset($this->orderby)) self::pdef('orderby',$this->orderby);
+ if (self::p('order')) self::pset('orderby',self::p('orderby').' '.self::p('order')); # from Wordpress
+
//
// Select
//
# Use the module out when format unknow
$out_conf = null;
if ($this->p('out') or !preg_match('/^('.join('|',
- array( 'table','sql','div','_csv','_xml','_json','_yaml' ) # local
+ array( 'table','sql','div','wp','_csv','_xml','_json','_yaml' ) # local
).')$/',$format))
{
return $count;
}
+ /*-----------------------------------------------------------------
+ Wordpress
+ -----------------------------------------------------------------*/
+ public function rows_begin_wp() {
+ $this->_html_table = new html_table($this);
+
+ return '';
+ }
+ public function rows_rec_wp(&$row) {
+ $this->_html_table->items[] = $row;
+ return '';
+ }
+ public function rows_end_wp() {
+ $this->_html_table->display();
+ unset($this->_html_table);
+ return '';
+ }
+
/*-----------------------------------------------------------------
Sql
-----------------------------------------------------------------*/