<?php
header('Content-Type: text/css');
$fonts = empty($_REQUEST['fonts'])? '':$_REQUEST['fonts'];
if (!$fonts) { exit; }
$fonts = explode(';', $fonts);
$url  = $_SERVER['HTTP_HOST'] . substr($_SERVER['SCRIPT_NAME'], 0, strlen($_SERVER['SCRIPT_NAME']) - 9 ) ;
foreach ($fonts as $font) :
    $family = substr($font, 0, strlen($font)  - 4);
    $family = str_replace('.', '_', $family);
    $eot = substr($font, 0, strlen($font) - 3) . 'eot';
    $format = substr($font, -3)=='ttf'? 'truetype':'opentype';
?>@font-face {
  font-family: '<?php echo $family?>'; font-style: normal; font-weight: normal;
  src: url('http://<?php echo $url  ?>/assets/fonts/<?php echo $eot?>');
  src: local('<?php echo $family?>'), url('http://<?php echo $url  ?>/assets/fonts/<?php echo $font?>') format('<?php echo $format?>');
}
<?php
endforeach;
?>