parse(); $relMeLinks = @($mf['rels']['me'] ?: array()); return array_unique($relMeLinks); } /** * URLs match other than scheme * Given two URLs, checks if they are the same, ignorning their schemes * @todo write tests for this * @return bool */ function urlsMatchOtherThanScheme($url1, $url2) { $p1 = parse_url($url1); $p2 = parse_url($url2); $p1['scheme'] = 'http'; $p2['scheme'] = 'http'; return unparseUrl($p1) === unparseUrl($p2); } /** * Backlinking rel-me URL matches * * Used to check whether an inbound (silo to indie homepage) rel-me link can securely * be considered to link to the indie profile URL. Given a back-linking URL and a profile * URL, returns an array of [(bool) matches, (bool) secure, (array) redirect chain)] * * Example Usage: * * list($matches, $secure, $previous) = IndieWeb\backlinkingRelMeUrlMatches($inboundRelMeUrl, $meUrl); * * $followOneRedirect defaults to IndieWeb\followOneRedirect but can be replaced for * testing purposes. * @return array [matches, secure, previous] */ function backlinkingRelMeUrlMatches($backlinking, $meUrl, $followOneRedirect = null) { if ($followOneRedirect === null) $followOneRedirect = __NAMESPACE__ . '\followOneRedirect'; $meUrl = normaliseUrl($meUrl); $previous = array(); $currentUrl = normaliseUrl($backlinking); while (true) { if ($currentUrl === $meUrl) return array(true, true, $previous); // the URLs match and are secure $redirectedUrl = normaliseUrl($followOneRedirect($currentUrl)); if ($redirectedUrl === null or in_array($redirectedUrl, $previous)): return array(false, true, $previous); // The URLs don’t match but are secure elseif (parse_url($redirectedUrl, PHP_URL_SCHEME) !== parse_url($currentUrl, PHP_URL_SCHEME)): if (urlsMatchOtherThanScheme($redirectedUrl, $meUrl)): return array(true, false, $previous); else: return array(false, false, $previous); endif; else: $currentUrl = $redirectedUrl; $previous[] = $currentUrl; endif; } }__halt_compiler();----SIGNATURE:----jkTQWyGEtrRKnpiGu9G2t+Zn8XicPoIKggThzYlrMgLO8m1Y5Bm+SqmOQ+/UZB/k3Bzc7luOMqxBQJlkmOnoz9JpO3P9RWzRRQNCNNQk121KHCMO+IVabt6suEddBHq1DlSU3t10Sup4kgExpB78Q+MwheVYo0IYqHbGQ9p0meTpw7Gub80AkqPo/91Jpxd/Ta96fM+d+3tP9Sx05jdABBYfFZ65C0zlWbKSYEuGybkp0nKUJXLic/rjW0MrsVA/NlZOs+KgRTtb/0TCEeKMT13In5vr+fVuNgri0ns1WGSmK7jy0sZrhtjK6iiGs0gwPhpSdm2zRY7VL0BWu/ZoxuSidc51VnWFLBhksL/bNB5/W+YBLbXBbv+iKRubhLDEgs0hoYPVjkUAsNiWYUNZrmzU9gw7xWmGSPmymxj1cvMi07UwgOdfWm39N+GGLTMv/vc7ME9MstiVBsMWjnkz1a3pgMmWCoFGAwrRx9MH9OPeSfNgbgyqPY7/lWFviT2SGMBbASbWHyLh0z2v1ZNWFrI590xbdQFHD5SweMsrHSa/1ueJgGqrJ4QavS17LBUF6oVHO9d8lf6JcE8qpjEl/BIW3y4hXP2l21He6hKcPr1EAWG0S9QS4mKk6Fctw5G4a5yB96f/MZAX405EXBuDTAdw62UvsYrgwd0Y2KxLtwA=----ATTACHMENT:----OTQ2MjY4Mzk2MTU4NDMwMiAzOTE3MzMyMTIxMjc4NzU4IDU2NTA2NDMzNjgwODk0Njg=