| 347 | | // Get the site domain and get rid of www. |
| 348 | | $sitename = strtolower( $_SERVER['SERVER_NAME'] ); |
| 349 | | if ( substr( $sitename, 0, 4 ) == 'www.' ) { |
| 350 | | $sitename = substr( $sitename, 4 ); |
| | 347 | //Get the site domain. |
| | 348 | $sitename = parse_url( get_bloginfo("wpurl"), PHP_URL_HOST ); |
| | 349 | |
| | 350 | //Strip any subdomains to ensure we're using wp@domain.tld. |
| | 351 | $chunks = explode(".", $sitename); |
| | 352 | $chunkscount = count($chunks); |
| | 353 | if ( $chunkscount >= 3 ) { |
| | 354 | //Only use the primary domain and TLD. |
| | 355 | $sitename = $chunks[$chunkscount -2] . "." . $chunks[$chunkscount -1]; |