/** * Request a list of people associated with the company from the AngelList API, up to limit (default 3) * * @since 1.1 * @param int $limit maximum amount of people * @return string HTML list of people */ private function people($limit = 3) { // check for garbage if (!is_int($limit) || $limit < 1) { $limit = 3; } if (!class_exists('AngelList_API')) { require_once dirname(dirname(__FILE__)) . '/api.php'; } $people = AngelList_API::get_roles_by_company($this->id); if (!is_array($people) || empty($people)) { return ''; } if (!class_exists('AngelList_Person')) { require_once dirname(__FILE__) . '/person.php'; } $founders = array(); $everyone_else = array(); foreach ($people as $person) { // only care about confirmed, active people if (!(isset($person->role) && isset($person->confirmed) && $person->confirmed === true && !isset($person->ended_at))) { continue; } if ($person->role === 'founder') { $founders[] = $person; } else { if (!in_array($person->role, array('referrer', 'attorney'), true)) { $everyone_else[] = $person; } } } unset($people); $top_people = array(); // founders get priority treatment if (!empty($founders)) { $top_people = AngelList_Person::order_by_follower_count($founders, $limit); } $people_count = count($top_people); if ($people_count < $limit && !empty($everyone_else)) { $top_people = array_merge($top_people, AngelList_Person::order_by_follower_count($everyone_else, $limit - $people_count)); } // this should not happen. just in case if (empty($top_people)) { return ''; } $people_html = ''; foreach ($top_people as $person_data) { $person = new AngelList_Person($person_data); if (!(isset($person->name) && isset($person->role))) { continue; } $people_html .= $person->render($this->schema_org, $this->anchor_extra); } if ($people_html) { return '<ol class="angellist-people">' . $people_html . '</ol>'; } else { return ''; } }