Skip to content

Instantly share code, notes, and snippets.

@mrsinguyen
Forked from quiptime/Drupal get_params
Created May 18, 2010 09:24
Show Gist options
  • Save mrsinguyen/404812 to your computer and use it in GitHub Desktop.
Save mrsinguyen/404812 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