Skip to content

Instantly share code, notes, and snippets.

@quiptime
Created May 8, 2010 15:47
Show Gist options
  • Save quiptime/394619 to your computer and use it in GitHub Desktop.
Save quiptime/394619 to your computer and use it in GitHub Desktop.
/**
* Get URI parameter.
*
* @param string $str
* Example to use $str urldecode(drupal_get_destination()).
* @return array
*/
function _more_node_buttons_get_params($str) {
$chunks = explode("?", $str);
$params = explode("&", $chunks[1]);
$data = array();
foreach ($params as $chunk) {
$parts = explode("=", $chunk, 2);
if (count($parts) == 2) {
list($k, $v) = $parts;
$data[$k] = check_plain(urldecode($v));
}
}
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment