Determines the current sort direction.
$headers: An array of column headers in the format described in theme_table().
The current sort direction ("asc" or "desc").
function tablesort_get_sort($headers) {
if (isset($_GET['sort'])) {
return strtolower($_GET['sort']) == 'desc' ? 'desc' : 'asc';
}
else {
// Find out which header is currently being sorted.
$ts = tablesort_get_order($headers);
foreach ($headers as $header) {
if (is_array($header) && isset($header['data']) && $header['data'] == $ts['name'] && isset($header['sort'])) {
return $header['sort'];
}
}
}
return 'asc';
}