diff -r 04e728651a48 -r 0a2c2ad49d75 server/src/app/Libraries/Utils.php --- a/server/src/app/Libraries/Utils.php Thu Oct 13 13:01:12 2016 +0200 +++ b/server/src/app/Libraries/Utils.php Fri Oct 14 01:02:10 2016 +0200 @@ -134,4 +134,26 @@ return new Graph($graph1->getUri(), $merged, 'php'); } + /** + * From http://stackoverflow.com/a/834355 + */ + public static function startsWith($haystack, $needle) + { + $length = strlen($needle); + return (substr($haystack, 0, $length) === $needle); + } + + /** + * From http://stackoverflow.com/a/834355 + */ + public static function endsWith($haystack, $needle) + { + $length = strlen($needle); + if ($length == 0) { + return true; + } + + return (substr($haystack, -$length) === $needle); + } + }