WC_Helper::_get_extensions_update_notice()private staticWC 1.0

Get an update notice if one or more Woo extensions has an update available.

Метод класса: WC_Helper{}

Хуков нет.

Возвращает

Строку|null. The update notice or null if everything is up to date.

Использование

$result = WC_Helper::_get_extensions_update_notice();

Код WC_Helper::_get_extensions_update_notice() WC 8.7.0

private static function _get_extensions_update_notice() {
	$plugins   = self::get_local_woo_plugins();
	$updates   = WC_Helper_Updater::get_update_data();
	$available = 0;

	foreach ( $plugins as $data ) {
		if ( empty( $updates[ $data['_product_id'] ] ) ) {
			continue;
		}

		$product_id = $data['_product_id'];
		if ( version_compare( $updates[ $product_id ]['version'], $data['Version'], '>' ) ) {
			$available++;
		}
	}

	if ( ! $available ) {
		return;
	}

	return sprintf(
		/* translators: %1$s: helper url, %2$d: number of extensions */
		_n( 'Note: You currently have <a href="%1$s">%2$d paid extension</a> which should be updated first before updating WooCommerce.', 'Note: You currently have <a href="%1$s">%2$d paid extensions</a> which should be updated first before updating WooCommerce.', $available, 'woocommerce' ),
		admin_url( 'admin.php?page=wc-addons&section=helper' ),
		$available
	);
}