Automattic\WooCommerce\Admin

PluginsHelper::maybe_show_connect_notice_in_plugin_list()public staticWC 1.0

Show notices to connect to woocommerce.com for unconnected store in the plugin list.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = PluginsHelper::maybe_show_connect_notice_in_plugin_list();

Код PluginsHelper::maybe_show_connect_notice_in_plugin_list() WC 9.7.1

public static function maybe_show_connect_notice_in_plugin_list() {
	if ( 'woocommerce_page_wc-settings' !== get_current_screen()->id ) {
		return;
	}

	$notice_type = WC_Helper_Updater::get_woo_connect_notice_type();

	if ( 'none' === $notice_type ) {
		return;
	}

	$notice_string = '';

	if ( 'long' === $notice_type ) {
		$notice_string .= __( 'Your store might be at risk as you are running old versions of WooCommerce plugins.', 'woocommerce' );
		$notice_string .= ' ';
	}

	$connect_page_url = add_query_arg(
		array(
			'page'         => 'wc-admin',
			'tab'          => 'my-subscriptions',
			'path'         => rawurlencode( '/extensions' ),
			'utm_source'   => 'pu',
			'utm_campaign' => 'pu_setting_screen_connect',
		),
		admin_url( 'admin.php' )
	);

	$notice_string .= sprintf(
		/* translators: %s: Connect page URL */
		__( '<a id="woo-connect-notice-url" href="%s">Connect your store</a> to WooCommerce.com to get updates and streamlined support for your subscriptions.', 'woocommerce' ),
		esc_url( $connect_page_url )
	);

	echo '<div class="woo-connect-notice notice notice-error is-dismissible">
    		<p class="widefat">' . wp_kses_post( $notice_string ) . '</p>
    	</div>';
}