diff --git a/helpers.php b/helpers.php index cd45ef2..f82a064 100644 --- a/helpers.php +++ b/helpers.php @@ -83,10 +83,11 @@ static function trim_url( $url, $path = false ) { $domain = preg_replace( '/^www\./', '', $url_parts['host'] ) . ( ! empty( $url_parts['port'] ) ? ':' . $url_parts['port'] : '' ); /** Add directory path if needed **/ - if ( $path && $url_parts['path'] ) + if ( $path && isset( $url_parts['path'] ) ) $domain .= $url_parts['path']; - return $domain; + return sanitize_url( $url_parts['scheme'] . '://' . $domain ); + } /** Returns and unique hash to identify the environment. */