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:----vuDn6Dw6BYGHpasyhTPL0VEC+cfFy00NDKGdkimrVZ/oyxr7+FKDRdPfZ2zjLrHmvgrT0RH4EbeXu1jHw3GWXe7RwyJk283+77wRjR3TXjD1E3bwFqkKsGo/lrGxf8P9Wa92UCyyPrsU2LfBBQozGXogTQsDFz6Y4FeW6I/jfAuKZgA9kZuN7tVpCWPFXa8A0tyGnJu5tGAzOgf9EqAVx823mwnStejXVAAATsSmawgHEJWGOczj/Xs8wW+71lV1EK/jf7uVoznNXIEO5jAuRDECu1sXwctvl9wAgCUd/9J+5lZ/xwWxkl6hA+UW7JO/sCcNe+/SOPNbaoHq6PAwe0Cdoaouuhxj8Xo97dSvGGTBYNq2aTLHYAPEMN5y9DY6IGC17MIMnrdZmds0VimRjOHlbn48n9fO5qULwzwasl16tAeUc9GAo26wGMR3JMMqVt7cGBBPbZJBuARZX6lzC5uaD+1ZNqiKUiGLEfCjN/5Nvo7/1wJ0ggfb2hvNUTLrLoaT+V6PTAxO1y+UfAFwKoLnmMM5p7/8y1qxGvJbRYhdqXsk/q6T+Ncyofey6jcligCgOYJqiHvlqJK59v87siPUmiJB+0b1BmUQvbZRPeUt03o3fFQ51qXoR9idwmfHFXqAns+rHZNqcTVfJVEkuXqiqPOKxrInzh1P+LGw7c4=----ATTACHMENT:----OTQzNDE2NzQ0NTcyMjM0MyAyMTc3ODE5OTY1OTM2Njg2IDUzMTIwNzMwNjM0MjE3MjQ=