/** * Display jobs at the company listed in AngelList * * @since 1.2 * @param int $limit show at most N jobs * @return string HTML list of job listings */ private function jobs($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'; } $jobs = AngelList_API::get_jobs_by_company($this->id); if (!is_array($jobs) || empty($jobs)) { return ''; } if (count($jobs) > $limit) { $jobs = array_slice($jobs, 0, $limit); } if (!class_exists('AngelList_Job')) { require_once dirname(__FILE__) . '/job.php'; } $jobs_html = ''; foreach ($jobs as $job_data) { $job = new AngelList_Job($job_data); if (isset($job->title)) { $jobs_html .= $job->render($this->schema_org, $this->anchor_extra); } } if ($jobs_html) { return '<div class="angellist-jobs"><span>' . esc_html(sprintf(__('%s is hiring:', 'angellist'), $this->name)) . '</span><ol>' . $jobs_html . '</ol>'; } else { return ''; } }