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:----grXG1gTPCtYm7ZMOAkZMpavz8bAypsIYZB5U6PSfV7bxk0uL2Z295ZL2RvFDIZlIqjcEZqfbKeM/KgM9bzytN8OShfh4J2b+4BP0uzDIUxcIIvNI+iNb3QKSYXFgExSvLngVv/JUDb2PjFT5UpDkgsEbcNfkLKRZSYdgjZxUew4igYpa4CTFkGlaXnfY/dM3HxGM1KrshTxkTNdiaaeeF2o202RfSZhxbvNy3dDLdbxkcNtGfODBS0cQg6/ji+Yh7URn+0Dy1u27nCYILimteoRrhKp9ce6+/6nSpOmZifOczSgk7otNqaW3xdM5lul47zxshHaZ78OFmwWKa4mgMncV3p16iGF8X59rwa7yLXgYJqsY6O3Da4nbcyT52oeqo9IbckBnV+Xkmy3l5/kkU61FKeuk27NBjanvP8XUXHXBnHSpoS9Yw3FFPsKJYo1XEEXs58cmKha0/gSYp62imwNSP1Qz/MENSKhl16RjpPR/3irzSkfj0Gagws2dctwvHtR8UKvNGLUMi/n7MG2452wMuLW51m9+BWrwmb+wC+2xNvFBAvKE4PUf4WgJeAqGPjxw5bzlnm5urzHrmZQhMRfHDWTQ3wV74z/UFbnPfypqKiMf2vyCi12zsubDV2cfldTE2cy2eV0JavUOfOnn0neLJFW4qP8iYxebkyWu/hY=----ATTACHMENT:----MjczMTYyNTU0NTkzODkwNiAzNDYwNDY3NzU1Nzk2NTk5IDg0ODY5Mzg5Njk4Njk5NDE=