Created
October 18, 2016 15:42
-
-
Save brandon-braner/57becdf5ef06604d0230e87a9602130b to your computer and use it in GitHub Desktop.
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
function parse_request() { | |
// get current url | |
$current = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; | |
// calculate the path | |
$part = substr( $current, strlen( site_url() ) ); | |
if ( $part[0] == '/' ) { | |
$part = substr( $part, 1 ); | |
} | |
// strip parameters | |
$real = explode( '?', $part ); | |
foreach($real as $index => $token){ | |
//decode url enteities such as %20 for space | |
$tokens[$index] = urldecode($token); | |
} | |
return $tokens; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment