diff --git a/functions.php b/functions.php index 9ab7a3a..f95e67b 100644 --- a/functions.php +++ b/functions.php @@ -64,9 +64,24 @@ function add_search_box($items, $args) { add_filter('wp_nav_menu_items','add_search_box', 10, 2); function set_title($title) { - $urlargspos = strpos($_SERVER['REQUEST_URI'], '?'); - if ($urlargspos > 0) { - $urlargs = substr($_SERVER['REQUEST_URI'], $urlargspos + 1); + $url = $_SERVER['REQUEST_URI']; + $spliturl = explode('?', $url); + $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); $newtitle = $title; if (array_key_exists('arch', $args)) {