Refine Dropin and MU Plugin report functionality a bit. Added option to show if connected to WooCommerce.com.

This commit is contained in:
Gerhard 2019-02-27 15:19:12 +02:00
parent bf57a037c6
commit 497d082b03
2 changed files with 43 additions and 17 deletions

View File

@ -639,12 +639,21 @@ if ( 0 < count( $dropins_mu_plugins['mu_plugins'] ) ) :
</thead>
<tbody>
<?php
foreach ( $dropins_mu_plugins['mu_plugins'] as $dropin ) {
foreach ( $dropins_mu_plugins['mu_plugins'] as $mu_plugin ) {
$plugin_name = esc_html( $mu_plugin['name'] );
if ( ! empty( $mu_plugin['url'] ) ) {
$plugin_name = '<a href="' . esc_url( $mu_plugin['url'] ) . '" aria-label="' . esc_attr__( 'Visit plugin homepage', 'woocommerce' ) . '" target="_blank">' . $plugin_name . '</a>';
}
?>
<tr>
<td><?php echo wp_kses_post( $dropin['plugin'] ); ?></td>
<td><?php echo wp_kses_post( $plugin_name ); ?></td>
<td class="help">&nbsp;</td>
<td><?php echo wp_kses_post( $dropin['name'] ); ?>
<td>
<?php
/* translators: %s: plugin author */
printf( esc_html__( 'by %s', 'woocommerce' ), esc_html( $mu_plugin['author_name'] ) );
echo ' &ndash; ' . esc_html( $mu_plugin['version'] );
?>
</tr>
<?php
}
@ -720,6 +729,11 @@ if ( 0 < count( $dropins_mu_plugins['mu_plugins'] ) ) :
?>
</td>
</tr>
<tr>
<td data-export-label="Connected to WooCommerce.com"><?php esc_html_e( 'Connected to WooCommerce.com', 'woocommerce' ); ?>:</td>
<td class="help"><?php echo wc_help_tip( esc_html__( 'Are your site connected to WooCommerce.com?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
<td><?php echo $settings['woocommerce_com_connected'] ? '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>' : '<mark class="no">&ndash;</mark>'; ?></td>
</tr>
</tbody>
</table>
<table class="wc_status_table widefat" cellspacing="0">

View File

@ -893,10 +893,14 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
}
$mu_plugins = get_mu_plugins();
foreach ( $mu_plugins as $key => $mu_plugin ) {
foreach ( $mu_plugins as $plugin => $mu_plugin ) {
$plugins['mu_plugins'][] = array(
'plugin' => $key,
'name' => $mu_plugin['Name'],
'plugin' => $plugin,
'name' => $mu_plugin['Name'],
'version' => $mu_plugin['Version'],
'url' => $mu_plugin['PluginURI'],
'author_name' => $mu_plugin['AuthorName'],
'author_url' => esc_url_raw( $mu_plugin['AuthorURI'] ),
);
}
return $plugins;
@ -1006,19 +1010,27 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
$product_visibility_terms[ $term->slug ] = strtolower( $term->name );
}
// Check if WooCommerce.com account is connected.
$woo_com_connected = 'no';
$helper_options = get_option( 'woocommerce_helper_data', array() );
if ( array_key_exists( 'auth', $helper_options ) && ! empty( $helper_options['auth'] ) ) {
$woo_com_connected = 'yes';
}
// Return array of useful settings for debugging.
return array(
'api_enabled' => 'yes' === get_option( 'woocommerce_api_enabled' ),
'force_ssl' => 'yes' === get_option( 'woocommerce_force_ssl_checkout' ),
'currency' => get_woocommerce_currency(),
'currency_symbol' => get_woocommerce_currency_symbol(),
'currency_position' => get_option( 'woocommerce_currency_pos' ),
'thousand_separator' => wc_get_price_thousand_separator(),
'decimal_separator' => wc_get_price_decimal_separator(),
'number_of_decimals' => wc_get_price_decimals(),
'geolocation_enabled' => in_array( get_option( 'woocommerce_default_customer_address' ), array( 'geolocation_ajax', 'geolocation' ) ),
'taxonomies' => $term_response,
'product_visibility_terms' => $product_visibility_terms,
'api_enabled' => 'yes' === get_option( 'woocommerce_api_enabled' ),
'force_ssl' => 'yes' === get_option( 'woocommerce_force_ssl_checkout' ),
'currency' => get_woocommerce_currency(),
'currency_symbol' => get_woocommerce_currency_symbol(),
'currency_position' => get_option( 'woocommerce_currency_pos' ),
'thousand_separator' => wc_get_price_thousand_separator(),
'decimal_separator' => wc_get_price_decimal_separator(),
'number_of_decimals' => wc_get_price_decimals(),
'geolocation_enabled' => in_array( get_option( 'woocommerce_default_customer_address' ), array( 'geolocation_ajax', 'geolocation' ) ),
'taxonomies' => $term_response,
'product_visibility_terms' => $product_visibility_terms,
'woocommerce_com_connected' => $woo_com_connected,
);
}