wp_add_id3_tag_data

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

WordPress Version: 6.3

/**
 * Parses ID3v2, ID3v1, and getID3 comments to extract usable data.
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data.
 * @param array $data Data supplied by ID3 tags.
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && str_starts_with($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 6.1

/**
 * Parses ID3v2, ID3v1, and getID3 comments to extract usable data.
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data.
 * @param array $data Data supplied by ID3 tags.
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 4.8

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 4.7

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 6.5

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 6.3

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .20

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 6.2

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .10

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 4.6

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 5.8

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 5.4

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .30

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 5.3

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .20

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 5.2

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .10

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 4.5

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 4.9

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 4.4

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .30

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 4.3

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .20

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 4.2

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .10

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 3.4

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .30

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 3.3

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .20

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 3.2

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .10

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 2.4

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .30

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 2.3

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .20

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 2.2

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .14

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 1.5

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .40

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 1.4

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .30

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 1.3

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .20

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 1.2

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .17

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 4.1

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if ('length' !== $key && !empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 0.4

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .30

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 0.3

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .20

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 0.2

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .17

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 4.0

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = reset($list);
                    // Fix bug in byte stream analysis.
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 8.4

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = reset($list);
                    // fix bug in byte stream analysis
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .30

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // fix bug in byte stream analysis
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 8.3

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = reset($list);
                    // fix bug in byte stream analysis
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .20

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // fix bug in byte stream analysis
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 7.5

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = reset($list);
                    // fix bug in byte stream analysis
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .40

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // fix bug in byte stream analysis
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 7.4

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = reset($list);
                    // fix bug in byte stream analysis
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .30

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // fix bug in byte stream analysis
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 7.3

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = reset($list);
                    // fix bug in byte stream analysis
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: .20

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = wp_kses_post(reset($list));
                    // fix bug in byte stream analysis
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}

WordPress Version: 3.7

/**
 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
 *
 * @since 3.6.0
 *
 * @param array $metadata An existing array with data
 * @param array $data Data supplied by ID3 tags
 */
function wp_add_id3_tag_data(&$metadata, $data)
{
    foreach (array('id3v2', 'id3v1') as $version) {
        if (!empty($data[$version]['comments'])) {
            foreach ($data[$version]['comments'] as $key => $list) {
                if (!empty($list)) {
                    $metadata[$key] = reset($list);
                    // fix bug in byte stream analysis
                    if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.')) {
                        $metadata[$key] = 'Cop' . $metadata[$key];
                    }
                }
            }
            break;
        }
    }
    if (!empty($data['id3v2']['APIC'])) {
        $image = reset($data['id3v2']['APIC']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height']);
        }
    } elseif (!empty($data['comments']['picture'])) {
        $image = reset($data['comments']['picture']);
        if (!empty($image['data'])) {
            $metadata['image'] = array('data' => $image['data'], 'mime' => $image['image_mime']);
        }
    }
}