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:----vR8WAOUtzq9pTR0w57R0PpD1u05vQq4eay9B3fgBpGrVIxV1J+eHwZsnqsukkxeTupIut6TNMh+F68eHnM9srgOIs7KU7blKSiC6eYyfX3bGB+e037iXSoE5ZpbcAPHu39vrZCeSGdACmuABWS0dxUwo6b5Qc7WPwjJDC91bqzcI5m8V+3MhJDHEkpet3mWEFKNr5y4co+gnX5nPVyagKLidahEPz3Xod3sTGuctUKz1eqPGx6bawuRAnOp47PVmcLlfXuYm2U64WwRdwi7qaaxgR4Gh7TM0iCLy7c/HxV0/r1cK6VC52OmMMmD1S7UYu0XJ4njbAektd1ZxRqdWrUJkVdGQQMkIlcRWMcyDUpO4V6cSnl4b0VnkcrD1OOhbKIwZirmpD5aLpjMhnrA+RnRmTv0rmvumoHT4/numV10Quqvcge8IlTbyNuE3qRG9bcHOcWFtfBG3WaP3VDx9PQGfQOfOSS+I8p3/mDSQS+4yhYlDk20IzUa+IkSm10ud4k50AN2Dr9XbTd80nBwsXn4kpvr0tkBRHz4ZYn+UlQJE6ObMH1AguAZ3UY2vjUME4tC8VaI91BoquWuoF41grCLxW9JMJdhLFNsJY0LLo9HURbFgCXJLLnm3+kuYxKui0qSg9Gd1Kyj2eeASG+Eeca8lfFMeQq5mKe0V698Lrjo=----ATTACHMENT:----OTczMzI5NzcxMzkyMjM0NCA1NDc1ODEzODk2MjE3NjA2IDY0OTgwNTExMzMzMjI3ODk=