From ba563b8ec08e42898a11120ff4414316014554fe Mon Sep 17 00:00:00 2001
From: Rodrigo Primo
' : '' ); + echo apply_filters( 'woocommerce_in_plugin_update_message', $this->upgrade_notice ? '
' . wp_kses_post( $this->upgrade_notice ) . '' : '' ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped } /** * Get the upgrade notice from WordPress.org. * - * @param string $version + * @param string $version WooCommerce new version. * @return string */ protected function get_upgrade_notice( $version ) { $transient_name = 'wc_upgrade_notice_' . $version; + $upgrade_notice = get_transient( $transient_name ); - if ( false === ( $upgrade_notice = get_transient( $transient_name ) ) ) { + if ( false === $upgrade_notice ) { $response = wp_safe_remote_get( 'https://plugins.svn.wordpress.org/woocommerce/trunk/readme.txt' ); if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) { @@ -90,17 +93,17 @@ class WC_Plugins_Screen_Updates extends WC_Plugin_Updates { /** * Parse update notice from readme file. * - * @param string $content - * @param string $new_version + * @param string $content WooCommerce readme file content. + * @param string $new_version WooCommerce new version. * @return string */ private function parse_update_notice( $content, $new_version ) { $version_parts = explode( '.', $new_version ); $check_for_notices = array( - $version_parts[0] . '.0', // Major - $version_parts[0] . '.0.0', // Major - $version_parts[0] . '.' . $version_parts[1], // Minor - $version_parts[0] . '.' . $version_parts[1] . '.' . $version_parts[2], // Patch + $version_parts[0] . '.0', // Major. + $version_parts[0] . '.0.0', // Major. + $version_parts[0] . '.' . $version_parts[1], // Minor. + $version_parts[0] . '.' . $version_parts[1] . '.' . $version_parts[2], // Patch. ); $notice_regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( $new_version ) . '\s*=|$)~Uis'; $upgrade_notice = '';