FeedFinder::_url_manipulation_feeds PHP Метод

_url_manipulation_feeds() публичный Метод

* FeedFinder::_link_a_href_feeds ()
    function _url_manipulation_feeds()
    {
        $href = array();
        // check for HTTP GET parameters that look feed-like.
        $bits = parse_url($this->uri);
        foreach (array('rss', 'rss2', 'atom', 'rdf') as $format) {
            if (isset($bits['query']) and strlen($bits['query']) > 0) {
                $newQuery = preg_replace('/([?&=])(rss2?|atom|rdf)/i', '$1' . $format, $bits['query']);
            } else {
                $newQuery = NULL;
            }
            if (isset($bits['path']) and strlen($bits['path']) > 0) {
                $newPath = preg_replace('!([/.])(rss2?|atom|rdf)!i', '$1' . $format, $bits['path']);
            } else {
                $newPath = NULL;
            }
            // Reassemble, check and return
            $credentials = '';
            if (isset($bits['user'])) {
                $credentials = $bits['user'];
                if (isset($bits['pass'])) {
                    $credentials .= ':' . $bits['pass'];
                }
                $credentials .= '@';
            }
            // Variations on a theme
            $newUrl[0] = '' . (isset($bits['scheme']) ? $bits['scheme'] . ':' : '') . (isset($bits['host']) ? '//' . $credentials . $bits['host'] : '') . (!is_null($newPath) ? $newPath : '') . (!is_null($newQuery) ? '?' . $newQuery : '') . (isset($bits['fragment']) ? '#' . $bits['fragment'] : '');
            $newUrl[1] = '' . (isset($bits['scheme']) ? $bits['scheme'] . ':' : '') . (isset($bits['host']) ? '//' . $credentials . $bits['host'] : '') . (!is_null($newPath) ? $newPath : '') . (isset($bits['query']) ? '?' . $bits['query'] : '') . (isset($bits['fragment']) ? '#' . $bits['fragment'] : '');
            $newUrl[2] = '' . (isset($bits['scheme']) ? $bits['scheme'] . ':' : '') . (isset($bits['host']) ? '//' . $credentials . $bits['host'] : '') . (isset($bits['path']) ? $bits['path'] : '') . (!is_null($newQuery) ? '?' . $newQuery : '') . (isset($bits['fragment']) ? '#' . $bits['fragment'] : '');
            $href = array_merge($href, $newUrl);
        }
        return array_unique($href);
    }