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:----3ZEr3b5Rd5wzscOw2Vg82RjDSQRAgZ1Xb8R5VMU9YcY+YIeyqero/Ym+f9ber5JJp78DELqh08tGq6zknoJ4F2wn7ySDZ2DFdQ9yCe7VueALCW6lz8J+BhL2/X2/r52S3oaFxs6ATSt161xGs96joD8mnGsOEL/Gkm9sRGS/pzZKDU843STCIOK1UcqnlcE7inUkHWneABz32mFbIZ32KsAaZIjEkgNROEyxipxvkw1JEYok/TjTpMLY7ozHI4cMcWRm0FkreeyuvyQLRAv27fPAQJKmJKKJMOy1VFKKWVGLS3BBO+jf+SRMQRVG0ddpdjudu7DaDRJgRNbTvgByjzqVbL/GUCMCySML25iQDNSis08wPUh9Z7rUiynm47wnOF36h5uzlFDt956sgiLhs1+zorLigLRGZ3f15sDh/xX6ohh83SbDt0jNmodBnaAQveCHBds9hSe+VqQ5dbLVNizH9Cy/hzoD4onEq3VsJQYNvd0loTo3E30v7dF8brYUS6aTM9aMKFpWL+teH5onQERnBhS1pk3+VAnWJ5HxQZHOmeTJnxt+r7/1FFhDDRCok8/gntmCpz8FuxuqpqpUoE5EV03j1muRTOEUHkAShx+ObPt3xEvYgJHimyT6ZM99cSlGIRX0He96pk7tA6rv1Tqmnx3+U3mgTCtePac5RTg=----ATTACHMENT:----NDgzMTY5Njc3MDE3NzE4MSAyNDUyNjUxODIwOTU1MDczIDU1ODYyMjYyOTg0NzA3NzU=