Merge pull request #73 from amio/patch-1

Add an url-encode method to support asian language titles in the url.
This commit is contained in:
Justin Walsh 2013-09-09 10:50:07 -07:00
commit 287ce9dd66

View File

@ -182,6 +182,12 @@ function clean_name($text) {
return $text; return $text;
} }
function RFC3986UrlEncode($string) {
$entities = array('%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
$replacements = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "=", "+", "$", ",", "/", "?", "%", "#", "[", "]");
return str_replace($entities, $replacements, urlencode($string));
}
function build_nav($tree, $url_params = false) { function build_nav($tree, $url_params = false) {
// Remove Index // Remove Index
unset($tree['index']); unset($tree['index']);
@ -197,7 +203,7 @@ function build_nav($tree, $url_params = false) {
array_shift($url_params); array_shift($url_params);
// Final Node // Final Node
if ($url_path == $val['url']) { if ($url_path == RFC3986UrlEncode($val['url'])) {
$html .= '<li class="active">'; $html .= '<li class="active">';
} else { } else {
$html .= '<li class="open">'; $html .= '<li class="open">';