function find($uri = NULL) { $ret = array(); if (!is_null($this->data($uri))) { if ($this->is_feed($uri)) { $href = array($this->uri); } else { // Assume that we have HTML or XHTML (even if we don't, who's it gonna hurt?) // Autodiscovery is the preferred method $href = $this->_link_rel_feeds(); // ... but we'll also take the little orange buttons $href = array_merge($href, $this->_a_href_feeds(TRUE)); // If all that failed, look harder if (count($href) == 0) { $href = $this->_a_href_feeds(FALSE); } // Our search may turn up duplicate URIs. We only need to do any given URI once. // Props to Camilo <http://projects.radgeek.com/2008/12/14/feedwordpress-20081214/#comment-20090122160414> $href = array_unique($href); } /* if */ // Try some clever URL little tricks before we go $href = array_merge($href, $this->_url_manipulation_feeds()); $href = array_unique($href); // Verify feeds and resolve relative URIs foreach ($href as $u) { $the_uri = SimplePie_Misc::absolutize_url($u, $this->uri); if ($this->verify and ($u != $this->uri and $the_uri != $this->uri)) { $feed = new FeedFinder($the_uri); if ($feed->is_feed()) { $ret[] = $the_uri; } unset($feed); } else { $ret[] = $the_uri; } } /* foreach */ } /* if */ return array_values($ret); }
function find($uri = NULL, $params = array()) { $params = wp_parse_args($params, array("authentication" => -1, "username" => NULL, "password" => NULL)); // Equivalents if ($params['authentication'] == '-') { $params['authentication'] = NULL; $params['username'] = NULL; $params['password'] = NULL; } // Set/reset if ($params['authentication'] != -1) { $this->credentials = array("authentication" => $params['authentication'], "username" => $params['username'], "password" => $params['password']); } $ret = array(); if (!is_null($this->data($uri))) { if ($this->is_opml($uri)) { $href = $this->_opml_rss_uris(); } else { if ($this->is_feed($uri)) { $href = array($this->uri); } else { // Assume that we have HTML or XHTML (even if we don't, who's // it gonna hurt?) Autodiscovery is the preferred method. $href = $this->_link_rel_feeds(); // ... but we'll also take the little orange buttons if ($this->fallbacks > 0) { $href = array_merge($href, $this->_a_href_feeds(TRUE)); } // If all that failed, look harder if ($this->fallbacks > 1) { if (count($href) == 0) { $href = $this->_a_href_feeds(FALSE); } } // Our search may turn up duplicate URIs. We only need to do // any given URI once. Props to Camilo <http://projects.radgeek.com/2008/12/14/feedwordpress-20081214/#comment-20090122160414> $href = array_unique($href); } // Try some clever URL little tricks before we go if ($this->fallbacks > 2) { $href = array_merge($href, $this->_url_manipulation_feeds()); } } $href = array_unique($href); // Verify feeds and resolve relative URIs foreach ($href as $u) { $the_uri = SimplePie_Misc::absolutize_url($u, $this->uri); if ($this->verify and ($u != $this->uri and $the_uri != $this->uri)) { $feed = new FeedFinder($the_uri, $this->credentials); if ($feed->is_feed()) { $ret[] = $the_uri; } unset($feed); } else { $ret[] = $the_uri; } } } if ($this->is_401($uri)) { $ret = array_merge(array(new WP_Error('http_request_failed', '401 Not authorized', array("uri" => $this->uri, "status" => 401))), $ret); } return array_values($ret); }