We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 844cee78 authored by Mike Sheldon's avatar Mike Sheldon

Handle ampersands with new rewrite friendly encoding

parent ce6fe2c2
......@@ -20,15 +20,16 @@
*/
/**
* Encodes an URL component in a mod_rewrite friendly way, handling plus and
* slash signs.
* Encodes an URL component in a mod_rewrite friendly way, handling plus,
* ampersand and slash signs.
*
* @param string The text to encode
* @return string A mod_rewrite compatible encoding of the given text.
*/
function rewrite_encode($url) {
$url = urlencode($url);
$url = preg_replace('/%2B/', '%252B', $url);
$url = preg_replace('/%2F/', '%252F', $url);
$url = preg_replace('/%2B/', '%252B', $url); // +
$url = preg_replace('/%2F/', '%252F', $url); // /
$url = preg_replace('/%26/', '%2526', $url); // &
return $url;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment