| 1 |
<?php |
<?php |
| 2 |
// $Id: api.module,v 1.88.2.42 2009/10/15 06:42:35 drumm Exp $ |
// $Id: api.module,v 1.88.2.43 2009/10/18 23:07:51 drumm Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 775 |
static $branch; |
static $branch; |
| 776 |
|
|
| 777 |
if (!isset($branch)) { |
if (!isset($branch)) { |
| 778 |
if (arg(0) == 'api') { |
$item = menu_get_item(); |
| 779 |
if (in_array(arg(1), array('function_dump', 'functions', 'constants', 'globals', 'files', 'groups', 'search'))) { |
// todo handle all cases |
| 780 |
$possible_branch = arg(2); |
if (isset($item['page_arguments'][0]->branch_name)) { |
| 781 |
} |
$branch = $item['page_arguments'][0]; |
|
elseif (in_array(arg(1), array('function', 'file', 'constant', 'global', 'group'))) { |
|
|
$possible_branch = arg(3); |
|
|
} |
|
|
else { |
|
|
// Maybe we are on one of the branch home pages. |
|
|
$possible_branch = arg(1); |
|
|
} |
|
|
} |
|
|
|
|
|
$branches = api_get_branches(); |
|
|
if (isset($possible_branch)) { |
|
|
foreach ($branches as $b) { |
|
|
if ($b->branch_name === $possible_branch) { |
|
|
$branch = $b; |
|
|
} |
|
|
} |
|
| 782 |
} |
} |
| 783 |
if (!isset($branch)) { |
else { |
| 784 |
$branch = $branches[variable_get('api_default_branch', NULL)]; |
$branch = $branches[variable_get('api_default_branch', NULL)]; |
| 785 |
} |
} |
| 786 |
} |
} |