Use site_url() instead of $_SERVER['SERVER_NAME'].

Use WordPress function site_url() instead $_SERVER['SERVER_NAME'] to get a better result. When WP is running "in cloud" (behind proxy/loadbalancer...) the SERVER_NAME will be misleading here.
Merge pull request #1 from larsschenk/patch-1

Use site_url() instead of $_SERVER['SERVER_NAME'].