functions.php: set title in distroquery api pages

This commit is contained in:
Silvan Calarco 2024-11-03 13:15:53 +01:00
parent dbec183488
commit 23f0bb6c68

View File

@ -64,9 +64,24 @@ function add_search_box($items, $args) {
add_filter('wp_nav_menu_items','add_search_box', 10, 2); add_filter('wp_nav_menu_items','add_search_box', 10, 2);
function set_title($title) { function set_title($title) {
$urlargspos = strpos($_SERVER['REQUEST_URI'], '?'); $url = $_SERVER['REQUEST_URI'];
if ($urlargspos > 0) { $spliturl = explode('?', $url);
$urlargs = substr($_SERVER['REQUEST_URI'], $urlargspos + 1); $splituri = explode('/', $spliturl[0]);
if (sizeof($splituri) > 2 && $splituri[2] == "rpms") {
// Set title for distroquery-api
if (sizeof($splituri) > 5) {
if ($splituri[5] == "")
return $splituri[4] . " (" . _r("Source RPM") . ") | ";
else
return $splituri[4] . " (" . $splituri[5] . ") | ";
} else if (sizeof($splituri) > 4) {
return _r("Repository") . " " . $splituri[3] . " | ";
}
return _r("Repositories") . " | ";
} else if (sizeof($spliturl) > 1) {
// Set title for obsolete packages pages
$urlargs = $spliturl[1];
parse_str($urlargs, $args); parse_str($urlargs, $args);
$newtitle = $title; $newtitle = $title;
if (array_key_exists('arch', $args)) { if (array_key_exists('arch', $args)) {