Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. $_domain=NULL;
  2. $_port=NULL;
  3.  
  4. function formatDomain($sub='www', $scheme='http')
  5. {
  6.     global $_domain, $_port;
  7.     if (!$_port)
  8.     {
  9.         $_port = ($_SERVER['SERVER_PORT'] == '80')?'':':'.$_SERVER['SERVER_PORT'];
  10.     }
  11.     if (!$_domain)
  12.     {
  13.         $_domain = isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:'over';
  14.         $entry = '#^.*?([\w\-\_]+\.[\w\-\_]+)$#';
  15.         if (preg_match($entry, $_domain, $match))
  16.                     $_domain = $match[1];
  17.     }
  18.     return ($scheme?$scheme.'://':'').$sub.'.'.$_domain.$_port;
  19. }
  20. return array(
  21.     'GAME_SLOT' => formatDomain('igrovye-avtomaty'),
  22.     'GAME_GAMBLE' => formatDomain('azartnye-igry'),
  23.     'REVIEW_POKER' => formatDomain('poker-rooms'),
  24.     'REVIEW_CASINO' => formatDomain('casino-online'),
  25.     'LIVESPORT' => formatDomain('livesport'),
  26.     'MAIN' => formatDomain('www'),
  27. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement