Created
September 28, 2012 10:01
-
-
Save mpmont/3798967 to your computer and use it in GitHub Desktop.
always save the query string at the end of file
This file contains hidden or 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
| /** | |
| * Return the entire current url including querystring | |
| * | |
| * @author Jeroen v.d. Gulik | |
| */ | |
| function full_url() | |
| { | |
| return current_url() . get_querystring(); | |
| } | |
| /** | |
| * Tries to determine if there is a querystring and returns it | |
| * | |
| * @author Jeroen v.d. Gulik | |
| * @return string | |
| */ | |
| function get_querystring() | |
| { | |
| // Do we have access to QUERY_STRING? | |
| if (!empty($_SERVER['QUERY_STRING'])) | |
| { | |
| $qs = $_SERVER['QUERY_STRING']; | |
| } | |
| // Do we have access to REDIRECT_QUERY_STRING? | |
| elseif (!empty($_SERVER['REDIRECT_QUERY_STRING'])) | |
| { | |
| $qs = $_SERVER['REDIRECT_QUERY_STRING']; | |
| } | |
| if (isset($qs)) | |
| { | |
| $qs = '?' . htmlentities(urlencode($qs)); | |
| } | |
| else | |
| // we give up | |
| { | |
| $qs = ''; | |
| } | |
| return $qs; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment