Skip to content

Instantly share code, notes, and snippets.

@xDeda
Created November 5, 2019 00:13
Show Gist options
  • Save xDeda/48f4f160f29a247aa8ecebea52ade1d0 to your computer and use it in GitHub Desktop.
Save xDeda/48f4f160f29a247aa8ecebea52ade1d0 to your computer and use it in GitHub Desktop.
function Colorify($q) {
$q = explode("<br />", $q);
foreach ($q as $qq) {
if (strpos($qq, "just connected.") || strpos($qq, "has disconnected.") || strpos($qq, "No cheese for you! ^_^") !== false) {
echo "<span class=\"connect\">" . $qq . "</span><br />";
} elseif (strpos($qq, "< [") !== false) {
echo "<span class=\"wout\">" . $qq . "</span><br />";
} elseif (strpos($qq, "is now your shaman, follow her!") !== false) {
echo "<span class=\"bluesham\">" . $qq . "</span><br />";
} elseif (strpos($qq, "name is already taken") !== false) {
echo "<span class=\"errors\">" . $qq . "</span><br />";
} elseif (strpos($qq, "You have joined the channel") !== false) {
echo "<span class=\"chat1\" style=\"color: #F0C5FE;\">" . $qq . "</span><br />";
} elseif (strpos($qq, "had just unlocked the") !== false) {
echo "<span class=\"special\">" . $qq . "</span><br />";
} elseif (strpos($qq, "> [") !== false) {
echo "<span class=\"wintext\">";
$qq = str_replace("[", "[<span class=\"winname\">", $qq);
echo str_replace("]", "</span>]", $qq);
echo "</span><br />";
} elseif (strpos($qq, "[Shaman ") !== false) {
$qq = str_replace("[Shaman ", "<span class=\"names\">[Shaman ", $qq);
echo str_replace("]", "]</span><span class=\"bluesham\"> ", $qq) . "</span><br />";
} elseif (strpos($qq, "[") == 0) {
$qq = str_replace("[", "<span class=\"names\">[", $qq);
echo str_replace("]", "]</span>", $qq) . "<br />";
} elseif (strpos($qq, "• [SERVER]") !== false) {
echo "<span class=\"mod\">" . $qq . "</span><br />";
} elseif (strpos($qq, "• [") == 0) {
$qq = str_replace("• [", "<span class=\"tc\">•</span> <span class=\"tn\">[", $qq);
echo str_replace("]", "]</span><span class=\"tc\">", $qq) . "</span><br />";
}
else {
echo $qq . "<br />";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment