$get_repo_strings = function ($locale, $repo) { return array_filter(Utils::getRepoStrings($locale, $repo), 'strlen'); }; $build_select = function ($array_in, $selected_elm) use($repos_nice_names) { $string_out = ''; foreach ($array_in as $elm) { $ch = $elm == $selected_elm ? ' selected' : ''; $elm_nice_name = isset($repos_nice_names[$elm]) ? $repos_nice_names[$elm] : $elm; $string_out .= "<option" . $ch . " value=" . $elm . ">" . $elm_nice_name . "</option>\n"; } return $string_out; }; // Variables // Project::getGaiaRepositories() returns ordered repos from newest to oldest $repo1 = 'gaia'; $repo2 = Project::getLastGaiaBranch(); $locale = $get_or_set($all_locales, 'locale', $locale); $repo1 = $get_or_set($gaia_repos, 'repo1', $repo1); $repo2 = $get_or_set($gaia_repos, 'repo2', $repo2); // Get the locale list $loc_list = Project::getRepositoryLocales('gaia'); // build the target locale & channels switchers $target_locales_list = ''; $channel_selector1 = ''; $channel_selector2 = ''; $target_locales_list = $build_select($loc_list, $locale); $channel_selector1 = $build_select($gaia_repos, $repo1); $channel_selector2 = $build_select($gaia_repos, $repo2); // Check if repo1 is a newer branch than repo2 $reverted_comparison = array_search($repo1, $gaia_repos) < array_search($repo2, $gaia_repos); // Get strings + status for both channel