do a better job of comparing same URLs.
This commit is contained in:
parent
d59585d89d
commit
2ffe0d0b1d
4 changed files with 26 additions and 7 deletions
19
boot.php
19
boot.php
|
@ -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;
|
||||
}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue