_response_to_rss()
Retrieve
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
MagpieRSS|true|false.
Usage
_response_to_rss ( $resp );
- $resp(array) (required)
- .
Notes
- Package: External
- Subpackage: MagpieRSS
Changelog
| Since 1.5.0 | Introduced. |
_response_to_rss() response to rss code WP 7.0.2
function _response_to_rss ($resp) {
$rss = new MagpieRSS( $resp->results );
// if RSS parsed successfully
if ( $rss && (!isset($rss->ERROR) || !$rss->ERROR) ) {
// find Etag, and Last-Modified
foreach ( (array) $resp->headers as $h) {
// 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
if (strpos($h, ": ")) {
list($field, $val) = explode(": ", $h, 2);
}
else {
$field = $h;
$val = "";
}
if ( $field == 'etag' ) {
$rss->etag = $val;
}
if ( $field == 'last-modified' ) {
$rss->last_modified = $val;
}
}
return $rss;
} // else construct error message
else {
$errormsg = "Failed to parse RSS file.";
if ($rss) {
$errormsg .= " (" . $rss->ERROR . ")";
}
// error($errormsg);
return false;
} // end if ($rss and !$rss->error)
}