Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmigf committed Sep 20, 2023
1 parent 2ea7c9e commit 5cd4240
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
9 changes: 9 additions & 0 deletions assets/css/debug-tools.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ form#wpo-wcpdf-settings {
max-width: 25rem;
}

#debug-tools #nuke {
margin-top: 20px;
background-color: #fcf9e8;
}

#debug-tools #nuke .notice {
margin: 0;
}

#document_custom_redirect_page,
#document_custom_redirect_page + .description {
display: none;
Expand Down
30 changes: 30 additions & 0 deletions includes/settings/class-wcpdf-settings-debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public function output( $active_section ) {
case 'tools':
$this->process_debug_tools();
$this->display_tools();
case 'numbers':
$this->display_numbers();
break;
}
}
Expand Down Expand Up @@ -198,11 +200,39 @@ public function display_tools() {
<!-- /reset_settings -->
<?php do_action( 'wpo_wcpdf_after_debug_tools', $this ); ?>
</div>
<!-- nuke (admin access only) -->
<?php if ( current_user_can( 'administrator' ) ) : ?>
<div id="nuke" class="wrapper">
<div class="tool">
<div class="notice notice-warning inline">
<p><?php _e( '<strong>DANGER ZONE:</strong> Create a backup before using this tools, the actions they performs are irreversible!', 'woocommerce-pdf-ips-number-tools' ); ?></p>
</div>
</div>
<div class="tool">
<h4><span><?php _e( 'Renumber existing documents', 'woocommerce-pdf-invoices-packing-slips' ); ?></span></h4>
<p><?php _e( 'This tool will renumber existing documents within the selected order date range, while keeping the assigned document date.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
<p><?php printf(
/* translators: step-by-step instructions */
__( 'Set the <strong>next document number</strong> setting %s to the number you want to use for the first document. ', 'woocommerce-pdf-invoices-packing-slips' ),
'<code>WooCommerce > PDF Invoices > Documents > Select document</code>'
); ?></p>
</div>
<div class="tool">
<h4><span><?php _e( 'Delete existing documents', 'woocommerce-pdf-invoices-packing-slips' ); ?></span></h4>
<p><?php _e( 'This tool will delete existing documents within the selected order date range.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
</div>
</div>
<?php endif; ?>
<!-- /nuke (admin access only) -->
</div>
<br>
<?php
}

public function display_numbers() {
// numbers code here
}

public function process_debug_tools() {
if ( isset( $_REQUEST['wpo_wcpdf_debug_tools_action'] ) && is_callable( array( $this, $_REQUEST['wpo_wcpdf_debug_tools_action'] ) ) ) {
if ( check_admin_referer( 'wpo_wcpdf_debug_tools_action', 'security' ) ) {
Expand Down

0 comments on commit 5cd4240

Please sign in to comment.