Skip to content

Commit

Permalink
updated sample switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
TRPB committed Oct 6, 2017
1 parent 0cecc3c commit af5f9dc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions public/samples/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,28 @@

exec('git branch -a', $branches);

$branchList = [];

foreach ($branches as $branch) {


$branch = trim($branch, " \t*");
$branch = str_replace('origin/', '', $branch);
$branch = str_replace('remotes/', '', $branch);

$branchList[$branch] = $branch;

}

foreach ($branchList as $branch) {
$class =$branch == $branchName ? 'current' : '';

if ($branch == 'master') continue;
echo '<li class="' .$class . '"><a href="' . $_SERVER['PHP_SELF'] . '?branch=' . $branch . '">' . $branch . '</a></li>';
}



?>
</ul>
</body>
Expand Down

0 comments on commit af5f9dc

Please sign in to comment.