_oembed_create_xml

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

WordPress Version: 4.4

/**
 * Creates an XML string from a given array.
 *
 * @since 4.4.0
 * @access private
 *
 * @param array            $data The original oEmbed response data.
 * @param SimpleXMLElement $node Optional. XML node to append the result to recursively.
 * @return string|false XML string on success, false on error.
 */
function _oembed_create_xml($data, $node = null)
{
    if (!is_array($data) || empty($data)) {
        return false;
    }
    if (null === $node) {
        $node = new SimpleXMLElement('<oembed></oembed>');
    }
    foreach ($data as $key => $value) {
        if (is_numeric($key)) {
            $key = 'oembed';
        }
        if (is_array($value)) {
            $item = $node->addChild($key);
            _oembed_create_xml($value, $item);
        } else {
            $node->addChild($key, esc_html($value));
        }
    }
    return $node->asXML();
}