public function display() { $protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']), 'https') === FALSE ? 'http://' : 'https://'; $host = $_SERVER['HTTP_HOST']; $uri = $_SERVER['REQUEST_URI']; $current_url = $protocol . $host . $uri; if (isset($this->repositories_tabs) && is_array($this->repositories_tabs) && count($this->repositories_tabs) > 0) { if (!isset($_GET['repo-tab'])) { $active_repo = $this->repositories_tabs[0]['id']; } else { $active_repo = (int) $_GET['repo-tab']; } echo '<div class="clear"></div>'; echo '<h2 class="nav-tab-wrapper">'; foreach ($this->repositories_tabs as $repo_data) { $results = (int) $this->results_per_repo[$repo_data['id']]['results']; $class_active = $active_repo == $repo_data['id'] ? 'nav-tab-active' : ''; $repo_tab_url = add_query_arg('repo-tab', $repo_data['id'], $current_url); $repo_tab_url = remove_query_arg('paged', $repo_tab_url); echo '<a href="' . $repo_tab_url . '" class="nav-tab ' . $class_active . '">' . $repo_data['name'] . ' (' . $results . ')</a>'; } echo '</h2>'; } parent::display(); }