]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/Url.php
Wallabag plugin improvement
[github/shaarli/Shaarli.git] / application / Url.php
index af43b457961729f3a5c2abc82a407b4a402531ec..d80c9c582f32e5e8b8053b291d354a112e21b6c0 100644 (file)
@@ -51,6 +51,18 @@ function get_url_scheme($url)
   return $obj_url->getScheme();
 }
 
+/**
+ * Adds a trailing slash at the end of URL if necessary.
+ *
+ * @param string $url URL to check/edit.
+ *
+ * @return string $url URL with a end trailing slash.
+ */
+function add_trailing_slash($url)
+{
+    return $url . (!endsWith($url, '/') ? '/' : '');
+}
+
 /**
  * URL representation and cleanup utilities
  *