private static function parse_update_notice($content, $new_version)
{
// Output Upgrade Notice.
$matches = null;
$regexp = '~==\\s*Upgrade Notice\\s*==\\s*=\\s*(.*)\\s*=(.*)(=\\s*' . preg_quote(WC_VERSION) . '\\s*=|$)~Uis';
$upgrade_notice = '';
if (preg_match($regexp, $content, $matches)) {
$version = trim($matches[1]);
$notices = (array) preg_split('~[\\r\\n]+~', trim($matches[2]));
// Check the latest stable version and ignore trunk.
if ($version === $new_version && version_compare(WC_VERSION, $version, '<')) {
$upgrade_notice .= '<div class="wc_plugin_upgrade_notice">';
foreach ($notices as $index => $line) {
$upgrade_notice .= wp_kses_post(preg_replace('~\\[([^\\]]*)\\]\\(([^\\)]*)\\)~', '<a href="${2}">${1}</a>', $line));
}
$upgrade_notice .= '</div> ';
}
}
return wp_kses_post($upgrade_notice);
}