Skip to content

Instantly share code, notes, and snippets.

@ddavaham
Created April 8, 2018 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddavaham/a470076d5ec7e16dbf076342863865d4 to your computer and use it in GitHub Desktop.
Save ddavaham/a470076d5ec7e16dbf076342863865d4 to your computer and use it in GitHub Desktop.
// remove font size
$formattedMessage = preg_replace('/size="[^"]*[^"]"/', "", $reponse->body);
// remove wrong color
$formattedMessage = preg_replace('/(color="#)[a-f0-9]{2}([a-f0-9]{6}")/', '', $formattedMessage);
// link to kms
$formattedMessage = preg_replace('/<a href="killReport:(\d+):(\w+)">/', '<a href="' . config('base.kmUrl') . 'kill/\1/" target="_blank">', $formattedMessage);
// link fits
$formattedMessage = preg_replace('/<a href="fitting:([\d:;]+)">/', '<a href="' . config('base.osmiumUrl') . 'loadout/dna/\1" target="_blank">', $formattedMessage);
// link system/station
$formattedMessage = preg_replace('/<a href="showinfo:(?:5|3867)\/\/(\d+)">/', '<a href="' . config('base.dotlanUrl') . 'search?q=\1">', $formattedMessage);
// link char
$formattedMessage = preg_replace('/<a href="showinfo:(?:1377|1378)\/\/(\d+)">/', '<a href="' . config('base.kmUrl') . 'character/\1">', $formattedMessage);
// link corp
$formattedMessage = preg_replace('/<a href="showinfo:2\/\/(\d+)">/', '<a href="' . config('base.kmUrl') . 'corporation/\1">', $formattedMessage);
// link alliance
$formattedMessage = preg_replace('/<a href="showinfo:16159\/\/(\d+)">/', '<a href="' . config('base.kmUrl') . 'alliance/\1">', $formattedMessage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment