_response_to_rss

The timeline below displays how wordpress function _response_to_rss has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 4.1

/**
 * Retrieve
 *
 * @since 1.5.0
 * @package External
 * @subpackage MagpieRSS
 *
 * @param array $resp
 * @return MagpieRSS|bool
 */
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 {
        $errormsg = "Failed to parse RSS file.";
        if ($rss) {
            $errormsg .= " (" . $rss->ERROR . ")";
        }
        // error($errormsg);
        return false;
    }
    // end if ($rss and !$rss->error)
}

WordPress Version: 3.7

/**
 * Retrieve
 *
 * @since 1.5.0
 * @package External
 * @subpackage MagpieRSS
 *
 * @param unknown_type $resp
 * @return unknown
 */
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 {
        $errormsg = "Failed to parse RSS file.";
        if ($rss) {
            $errormsg .= " (" . $rss->ERROR . ")";
        }
        // error($errormsg);
        return false;
    }
    // end if ($rss and !$rss->error)
}