FeedFinder::_tags PHP Метод

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

* FeedFinder::_url_manipulation_feeds ()
public _tags ( $tag )
    function _tags($tag)
    {
        $html = $this->data();
        // search through the HTML, save all <link> tags
        // and store each link's attributes in an associative array
        preg_match_all('/<' . $tag . '\\s+(.*?)\\s*\\/?>/si', $html, $matches);
        $links = $matches[1];
        $ret = array();
        $link_count = count($links);
        for ($n = 0; $n < $link_count; $n++) {
            $attributes = preg_split('/\\s+/s', $links[$n]);
            foreach ($attributes as $attribute) {
                $att = preg_split('/\\s*=\\s*/s', $attribute, 2);
                if (isset($att[1])) {
                    $att[1] = preg_replace('/([\'"]?)(.*)\\1/', '$2', $att[1]);
                    $final_link[strtolower($att[0])] = $att[1];
                }
                /* if */
            }
            /* foreach */
            $ret[$n] = $final_link;
        }
        /* for */
        return $ret;
    }