1
1
Fork 0

do a better job of comparing same URLs.

This commit is contained in:
Friendika 2011-01-19 19:51:34 -08:00
commit 2ffe0d0b1d
4 changed files with 26 additions and 7 deletions

View file

@ -2191,3 +2191,22 @@ function get_birthdays() {
}}
/**
*
* Compare two URLs to see if they are the same, but ignore
* slight but hopefully insignificant differences such as if one
* is https and the other isn't, or if one is www.something and
* the other isn't - and also ignore case differences.
*
* Return true if the URLs match, otherwise false.
*
*/
if(! function_exists('link_compare')) {
function link_compare($a,$b) {
$a1 = str_replace(array('https:','//www.'), array('http:','//'), $a);
$b1 = str_replace(array('https:','//www.'), array('http:','//'), $b);
if(strcasecmp($a1,$b1) === 0)
return true;
return false;
}}