" . $yes. "; " ;
$form .= "". $no ;
}else{
$form .= "" . $yes. "; " ;
$form .= "". $no ;
}
return $form;
}
endif;
if(!function_exists("dropdown_cats_options")):
function dropdown_cats_options($sort_column = 'ID', $sort_order = 'asc', $selected=array())
{
$mydirpath = dirname(dirname(__FILE__));
$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
if ($mydirname == 'wordpress'){
$wp_prefix = 'wp_';
} else {
$wp_prefix = $mydirname . '_';
}
$xoopsDB =& Database::getInstance();
$myts =& MyTextSanitizer::getInstance();
$selected = is_array($selected)?$selected:array($selected);
$sort_column = 'cat_'.$sort_column;
include $mydirpath.'/wp-includes/version.php';
if ($wp_db_version < 6124) {
$db_xpress_categories = $xoopsDB->prefix($wp_prefix . 'categories');
$query = "
SELECT cat_ID, cat_name, category_nicename,category_parent
FROM $db_xpress_categories
WHERE cat_ID > 0
";
$query .= " ORDER BY $sort_column $sort_order";
} else {
$db_xpress_terms = $xoopsDB->prefix($wp_prefix . 'terms');
$db_xpress_term_taxonomy = $xoopsDB->prefix($wp_prefix . 'term_taxonomy');
$query = "
SELECT $db_xpress_terms.term_id as cat_ID , $db_xpress_terms.name as cat_name , $db_xpress_term_taxonomy.taxonomy
FROM $db_xpress_terms LEFT JOIN $db_xpress_term_taxonomy ON $db_xpress_terms.term_id = $db_xpress_term_taxonomy.term_id
WHERE $db_xpress_term_taxonomy.taxonomy = 'category'
";
$query .= " ORDER BY $sort_column $sort_order";
}
$res = $xoopsDB->query($query, 0, 0);
if ($res !== false){
while($row = $xoopsDB->fetchArray($res)){
$cat_name = $row['cat_name'];
$cat_ID = $row['cat_ID'];
echo "\t\n";
}
}
return;
}
endif;
?>