gpack == null || GP_ENABLE == false)
? GP_LOCATE
: $session->gpack;
// -------------------------------------------------
// PROFILE SHORTCODES (UNCHANGED LOGIC)
// -------------------------------------------------
$profiel = preg_replace("/\[war]/s",'At war with
'.$database->getAllianceWar($aid), $profiel, 1);
$profiel = preg_replace("/\[ally]/s",'Confederacies
'.$database->getAllianceDipProfile($aid,1), $profiel, 1);
$profiel = preg_replace("/\[nap]/s",'NAPs
'.$database->getAllianceDipProfile($aid,2), $profiel, 1);
$profiel = preg_replace(
"/\[diplomatie]/s",
'Confederacies
'.$database->getAllianceDipProfile($aid,1).
'
NAPs
'.$database->getAllianceDipProfile($aid,2).
'
At war with
'.$database->getAllianceWar($aid),
$profiel,
1
);
// -------------------------------------------------
// HELPER: SAFE TOOLTIP (CRITICAL FIX)
// -------------------------------------------------
function buildTooltip($html) {
// remove line breaks (VERY IMPORTANT)
$html = str_replace(["\r", "\n"], '', $html);
// escape quotes for JS
$html = str_replace("'", "\\'", $html);
return $html;
}
// -------------------------------------------------
// MEDALS LOOP
// -------------------------------------------------
foreach ($varmedal as $medal) {
$titel = '';
$woord = '';
$isBonus = false;
// -------------------------------------------------
// CATEGORY SWITCH (UNCHANGED LOGIC)
// -------------------------------------------------
switch ($medal['categorie']) {
case "1":
$titel="Attackers of the Week";
$woord="Points";
break;
case "2":
$titel="Defenders of the Week";
$woord="Points";
break;
case "3":
$titel="Climbers of the week(Ranks)";
$woord="Ranks";
break;
case "4":
$titel="Robbers of the week";
$woord="Resources";
break;
case "5":
$titel="Receiving this medal shows that your alliance was in the top 3 of both attacckers and defenders of the week.";
$isBonus = true;
break;
case "6":
$titel="Receiving this medal shows that your alliance was in the top 3 of the attackers of the week ".$medal['points']." in a row";
$isBonus = true;
break;
case "7":
$titel="Receiving this medal shows that your alliance was in the top 3 of the deffenders of the week ".$medal['points']." in a row";
$isBonus = true;
break;
case "8":
$titel="Receiving this medal shows that your alliance was in the top 3 of the rank climbers of the week ".$medal['points']." in a row.";
$isBonus = true;
break;
case "9":
$titel="Receiving this medal shows that your alliance was in the top 3 of the robbers of the week ".$medal['points']." in a row.";
$isBonus = true;
break;
case "11":
$titel="Receiving this medal shows that you were in the top 3 of the Rank Climbers of the week ".$medal['points']." in a row.";
$isBonus = true;
break;
case "12":
$titel="Receiving this medal shows that you were in the top 10 Attackers of the week ".$medal['points']." in a row.";
$isBonus = true;
break;
case "13":
$titel="Receiving this medal shows that you were in the top 10 Defenders of the week ".$medal['points']." in a row.";
$isBonus = true;
break;
case "15":
$titel="Receiving this medal shows that you were in the top 10 Robbers of the week ".$medal['points']." in a row.";
$isBonus = true;
break;
case "16":
$titel="Receiving this medal shows that you were in the top 10 Rank Climbers of the week ".$medal['points']." in a row.";
$isBonus = true;
break;
}
// -------------------------------------------------
// TOOLTIP BUILD (SAFE)
// -------------------------------------------------
if ($isBonus) {
$tooltip = "
| "
. $titel
. " Received in week: " . (int)$medal['week'] . " |
| Category: | ".$titel." |
| Week: | ".(int)$medal['week']." |
| Rank: | ".(int)$medal['plaats']." |
| ".$woord.": | ".(int)$medal['points']." |
';
$profiel = preg_replace("/\[#".$medal['id']."]/is", $img, $profiel, 1);
}
?>