2014-07-28 14:50:11 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Admin View: Page - Status Tools
|
2021-04-28 07:36:10 +00:00
|
|
|
*
|
|
|
|
* @package WooCommerce
|
2014-07-28 14:50:11 +00:00
|
|
|
*/
|
|
|
|
|
2021-04-28 07:47:31 +00:00
|
|
|
use Automattic\WooCommerce\Utilities\ArrayUtil;
|
|
|
|
|
2014-07-28 15:16:35 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
2015-03-07 03:16:08 +00:00
|
|
|
exit;
|
2014-07-28 15:16:35 +00:00
|
|
|
}
|
2014-07-28 14:50:11 +00:00
|
|
|
|
2021-07-14 10:01:42 +00:00
|
|
|
foreach ( $tools as $action_name => $tool ) {
|
|
|
|
?>
|
2021-07-16 07:16:20 +00:00
|
|
|
<form id="<?php echo esc_attr( 'form_' . $action_name ); ?>" method="GET" action="<?php echo esc_attr( esc_url( admin_url( 'admin.php?foo=bar' ) ) ); ?>">
|
2021-07-14 10:01:42 +00:00
|
|
|
<?php wp_nonce_field( 'debug_action', '_wpnonce', false ); ?>
|
|
|
|
<input type="hidden" name="page" value="wc-status"/>
|
|
|
|
<input type="hidden" name="tab" value="tools"/>
|
2021-07-16 07:16:20 +00:00
|
|
|
<input type="hidden" name="action" value="<?php echo esc_attr( $action_name ); ?>"/>
|
2021-07-14 10:01:42 +00:00
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
}
|
2014-07-28 14:50:11 +00:00
|
|
|
?>
|
2021-07-14 10:01:42 +00:00
|
|
|
|
|
|
|
<table class="wc_status_table wc_status_table--tools widefat" cellspacing="0">
|
|
|
|
<tbody class="tools">
|
|
|
|
<?php foreach ( $tools as $action_name => $tool ) : ?>
|
|
|
|
<tr class="<?php echo sanitize_html_class( $action_name ); ?>">
|
|
|
|
<th>
|
|
|
|
<strong class="name"><?php echo esc_html( $tool['name'] ); ?></strong>
|
|
|
|
<p class="description">
|
|
|
|
<?php
|
|
|
|
echo wp_kses_post( $tool['desc'] );
|
|
|
|
if ( ! is_null( ArrayUtil::get_value_or_default( $tool, 'selector' ) ) ) {
|
|
|
|
$selector = $tool['selector'];
|
|
|
|
if ( isset( $selector['description'] ) ) {
|
|
|
|
echo '</p><p class="description">';
|
|
|
|
echo wp_kses_post( $selector['description'] );
|
|
|
|
}
|
|
|
|
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
|
|
echo " <select style='width: 300px;' form='form_$action_name' id='selector_$action_name' data-allow_clear='true' class='${selector['class']}' name='${selector['name']}' data-placeholder='${selector['placeholder']}' data-action='${selector['search_action']}'></select>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</p>
|
|
|
|
</th>
|
|
|
|
<td class="run-tool">
|
|
|
|
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
2021-07-16 07:16:20 +00:00
|
|
|
<input <?php echo ArrayUtil::is_truthy( $tool, 'disabled' ) ? 'disabled' : ''; ?> type="submit" form="<?php echo 'form_' . $action_name; ?>" class="button button-large" value="<?php echo esc_attr( $tool['button'] ); ?>" />
|
2021-07-14 10:01:42 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|