Created
August 25, 2014 02:18
-
-
Save Shelob9/ee98daa978322e3b5771 to your computer and use it in GitHub Desktop.
Check if loading from .dev tld (ie is local environment) adapted from http://stackoverflow.com/a/3211416/1469799
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function slug_check_dev() { | |
$urlParts = parse_url( htmlspecialchars("//$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]", ENT_QUOTES, 'UTF-8' ) ); | |
$hostParts = explode('.', $urlParts[ 'host'] ); | |
$hostParts = array_reverse( $hostParts ); | |
if ( $hostParts[ 0 ] === 'dev' ) { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment