id, $idorder); $post->info->sort_order = ($index === FALSE) ? $maxPosts : $index; // error_log("Assigned " . (($index === FALSE) ? $maxPosts : $index) . " to " . $post->title); } $success = uasort($posts, array('SortedPosts', 'cmp_presort')); return $posts; } public static function cmp_presort($a, $b) { return ($a->info->sort_order < $b->info->sort_order) ? -1 : 1; } public static function cmp_views($a, $b) { $aview = ($a->viewcount) ? $a->viewcount : 0; $bview = ($b->viewcount) ? $b->viewcount : 0; // default to descending return ($aview > $bview) ? -1 : 1; } public static function cmp_dummy($a, $b) { return 1; } } ?>