You are here

function _link_parse_str in Link 7

Replaces the PHP parse_str() function.

Because parse_str replaces the following characters in query parameters name in order to maintain compatibility with deprecated register_globals directive:

  • chr(32) ( ) (space)
  • chr(46) (.) (dot)
  • chr(91) ([) (open square bracket)
  • chr(128) - chr(159) (various)

Parameters

string $query: Query to parse.

Return value

array Array of query parameters.

See also

http://php.net/manual/en/language.variables.external.php#81080

1 call to _link_parse_str()
_link_parse_url in ./link.module
Because parse_url doesn't work with relative urls.

File

./link.module, line 935
Defines simple link field types.

Code

function _link_parse_str($query) {
  $query_array = array();
  $pairs = explode('&', $query);
  foreach ($pairs as $pair) {
    $name_value = explode('=', $pair, 2);
    $name = urldecode($name_value[0]);
    $value = isset($name_value[1]) ? urldecode($name_value[1]) : NULL;
    $query_array[$name] = $value;
  }
  return $query_array;
}