Permalink
Browse files

Update the gp_url_project urlencode implementation to avoid encoding …

…the glossary locale URLs that contain the preceeding double slash '//'. This fixes #415 again without compromising Glossaries
  • Loading branch information...
Garrett Hyder
Garrett Hyder committed Oct 30, 2018
1 parent 65d83f4 commit fa43d309e94c2484c8f24aa01bf7e7e853646c4b
Showing with 3 additions and 3 deletions.
  1. +3 −3 gp-includes/url.php
@@ -146,14 +146,14 @@ function gp_url_current() {
* @return string
*/
function gp_url_project( $project_or_path = '', $path = '', $query = null ) {
$project_path = urlencode( is_object( $project_or_path ) ? $project_or_path->path : $project_or_path );
$project_path = is_object( $project_or_path ) ? $project_or_path->path : $project_or_path;
// A leading double-slash will avoid prepending /projects/ to the path.
// This was introduced to enable linking to the locale glossary.
if ( '//' === substr( $project_path, 0, 2 ) ) {
$project_path = ltrim( $project_path, '/' );
$project_path = urlencode( ltrim( $project_path, '/' ) );
} else {
$project_path = array( 'projects', $project_path );
$project_path = array( 'projects', urlencode( $project_path ) );
}
return gp_url( array( $project_path, $path ), $query );

0 comments on commit fa43d30

Please sign in to comment.