/** * Compare function that orders features. * @param forumngfeature $a One feature * @param forumngfeature $b Another feature * @return int 1, -1, or 0 as per usual compare functions */ private static function compare($a, $b) { $ordera = $a->get_order(); $orderb = $b->get_order(); if ($ordera > $orderb) { return 1; } if ($ordera < $orderb) { return -1; } $classa = get_class($a); $classb = get_class($b); if ($classa > $classb) { return 1; } if ($classb < $classa) { return -1; } return 0; }
/** * Returns a new object of each available type. * @return array Array of forumngfeature_discussion objects */ public static function get_all() { $all = forumngfeature::get_all(); $results = array(); foreach ($all as $feature) { if (is_a($feature, 'forumngfeature_discussion_list') || is_a($feature, 'forumngfeature_discussion') && $feature->supports_discussion_list()) { $results[] = $feature; } } return $results; }