Bez popisu

html-admin-page-status-tools.php 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Admin View: Page - Status Tools
  4. *
  5. * @package WooCommerce
  6. */
  7. use Automattic\WooCommerce\Utilities\ArrayUtil;
  8. if ( ! defined( 'ABSPATH' ) ) {
  9. exit;
  10. }
  11. foreach ( $tools as $action_name => $tool ) {
  12. ?>
  13. <form id="<?php echo esc_attr( 'form_' . $action_name ); ?>" method="GET" action="<?php echo esc_attr( esc_url( admin_url( 'admin.php?foo=bar' ) ) ); ?>">
  14. <?php wp_nonce_field( 'debug_action', '_wpnonce', false ); ?>
  15. <input type="hidden" name="page" value="wc-status"/>
  16. <input type="hidden" name="tab" value="tools"/>
  17. <input type="hidden" name="action" value="<?php echo esc_attr( $action_name ); ?>"/>
  18. </form>
  19. <?php
  20. }
  21. ?>
  22. <table class="wc_status_table wc_status_table--tools widefat" cellspacing="0">
  23. <tbody class="tools">
  24. <?php foreach ( $tools as $action_name => $tool ) : ?>
  25. <tr class="<?php echo sanitize_html_class( $action_name ); ?>">
  26. <th>
  27. <strong class="name"><?php echo esc_html( $tool['name'] ); ?></strong>
  28. <p class="description">
  29. <?php
  30. echo wp_kses_post( $tool['desc'] );
  31. if ( ! is_null( ArrayUtil::get_value_or_default( $tool, 'selector' ) ) ) {
  32. $selector = $tool['selector'];
  33. if ( isset( $selector['description'] ) ) {
  34. echo '</p><p class="description">';
  35. echo wp_kses_post( $selector['description'] );
  36. }
  37. // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  38. echo "&nbsp;&nbsp;<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>";
  39. }
  40. ?>
  41. </p>
  42. </th>
  43. <td class="run-tool">
  44. <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
  45. <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'] ); ?>" />
  46. </td>
  47. </tr>
  48. <?php endforeach; ?>
  49. </tbody>
  50. </table>