diff --git a/assets/css/debug-tools.css b/assets/css/debug-tools.css index 8c2fc30e7..15c0d95e2 100644 --- a/assets/css/debug-tools.css +++ b/assets/css/debug-tools.css @@ -2,7 +2,8 @@ form#wpo-wcpdf-settings { margin-left: 0 !important; } #debug-tools { - width: 50%; + width: 100%; + margin-top: 2em; } #debug-tools .wrapper { diff --git a/assets/css/settings-styles.css b/assets/css/settings-styles.css index 4478e6f3d..546450583 100644 --- a/assets/css/settings-styles.css +++ b/assets/css/settings-styles.css @@ -263,7 +263,7 @@ body.woocommerce_page_wpo_wcpdf_options_page { margin: 15px 0 0; } -.nav-tab-wrapper a.nav-tab { +.nav-tab-wrapper:not( .wcpdf_debug_settings_sections > .nav-tab-wrapper) a.nav-tab { background: transparent; border: none; border-bottom: 3px solid transparent; @@ -272,7 +272,7 @@ body.woocommerce_page_wpo_wcpdf_options_page { font-size: 15px; } -.nav-tab-wrapper a.nav-tab.nav-tab-active { +.nav-tab-wrapper:not( .wcpdf_debug_settings_sections > .nav-tab-wrapper) a.nav-tab.nav-tab-active { border-bottom: 3px solid #51266b; } @@ -435,6 +435,10 @@ body.woocommerce_page_wpo_wcpdf_options_page { font-size: 12px; } +#wpo-wcpdf-settings .system-status-table { + margin-top: 2em; +} + #wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar { flex: 0 0 100%; } diff --git a/includes/class-wcpdf-main.php b/includes/class-wcpdf-main.php index 091f12794..56754df69 100644 --- a/includes/class-wcpdf-main.php +++ b/includes/class-wcpdf-main.php @@ -51,7 +51,7 @@ public function __construct() { add_filter( 'wpo_wcpdf_pdf_filters', array( $this, 'pdf_currency_filters' ) ); add_filter( 'wpo_wcpdf_html_filters', array( $this, 'html_currency_filters' ) ); - // scheduled attachments cleanup (following settings on Status tab) + // scheduled attachments cleanup (following settings on Advanced tab) add_action( 'wp_scheduled_delete', array( $this, 'schedule_temporary_files_cleanup' ) ); // remove private data diff --git a/includes/class-wcpdf-settings.php b/includes/class-wcpdf-settings.php index 66d9ca779..8be950b65 100644 --- a/includes/class-wcpdf-settings.php +++ b/includes/class-wcpdf-settings.php @@ -162,7 +162,7 @@ function check_auto_increment_increment() { $row = $wpdb->get_row( "SHOW VARIABLES LIKE 'auto_increment_increment'" ); if ( ! empty( $row ) && ! empty( $row->Value ) && $row->Value != 1 ) { /* translators: database row value */ - $error = wp_kses_post( sprintf( __( "Warning! Your database has an AUTO_INCREMENT step size of %d, your invoice numbers may not be sequential. Enable the 'Calculate document numbers (slow)' setting in the Status tab to use an alternate method." , 'woocommerce-pdf-invoices-packing-slips' ), intval( $row->Value ) ) ); + $error = wp_kses_post( sprintf( __( "Warning! Your database has an AUTO_INCREMENT step size of %d, your invoice numbers may not be sequential. Enable the 'Calculate document numbers (slow)' setting in the Advanced tab to use an alternate method." , 'woocommerce-pdf-invoices-packing-slips' ), intval( $row->Value ) ) ); printf( '

%s

', $error ); } } @@ -190,7 +190,7 @@ public function settings_page() { // add status and upgrade tabs last in row $settings_tabs['debug'] = array( - 'title' => __( 'Status', 'woocommerce-pdf-invoices-packing-slips' ), + 'title' => __( 'Advanced', 'woocommerce-pdf-invoices-packing-slips' ), 'preview_states' => 1, ); diff --git a/includes/documents/abstract-wcpdf-order-document-methods.php b/includes/documents/abstract-wcpdf-order-document-methods.php index 70a29965b..a3b4f73b6 100644 --- a/includes/documents/abstract-wcpdf-order-document-methods.php +++ b/includes/documents/abstract-wcpdf-order-document-methods.php @@ -852,7 +852,7 @@ public function get_thumbnail ( $product ) { * which turns the function 'imagecreatefromwebp()' inexistent, * leading to display an error in DOMPDF. * - * Check 'System configuration' in the Status tab for 'webp' support. + * Check 'System configuration' in the Advanced tab for 'webp' support. */ if ( 'webp' === wp_check_filetype( $thumbnail_path )['ext'] && ! function_exists( 'imagecreatefromwebp' ) ) { $thumbnail = ''; diff --git a/includes/settings/class-wcpdf-settings-callbacks.php b/includes/settings/class-wcpdf-settings-callbacks.php index b4f52e2e1..07a493604 100644 --- a/includes/settings/class-wcpdf-settings-callbacks.php +++ b/includes/settings/class-wcpdf-settings-callbacks.php @@ -453,7 +453,7 @@ public function media_upload( $args ) { if ( 'webp' === wp_check_filetype( $attachment_src )['ext'] && ! function_exists( 'imagecreatefromwebp' ) ) { printf( '

%s

', - wp_kses_post( 'File type webp is not supported by your server! Please check your System Configurations under the Status tab.', 'woocommerce-pdf-invoices-packing-slips' ) + wp_kses_post( 'File type webp is not supported by your server! Please check your System Configurations under the Advanced tab.', 'woocommerce-pdf-invoices-packing-slips' ) ); } diff --git a/includes/settings/class-wcpdf-settings-debug.php b/includes/settings/class-wcpdf-settings-debug.php index 542b2cace..3137f29f0 100644 --- a/includes/settings/class-wcpdf-settings-debug.php +++ b/includes/settings/class-wcpdf-settings-debug.php @@ -10,6 +10,7 @@ class Settings_Debug { protected static $_instance = null; + public $sections; public static function instance() { if ( is_null( self::$_instance ) ) { @@ -19,28 +20,61 @@ public static function instance() { } public function __construct() { + $this->sections = array( + 'settings' => __( 'Settings', 'woocommerce-pdf-invoices-packing-slips' ), + 'status' => __( 'Status', 'woocommerce-pdf-invoices-packing-slips' ), + 'tools' => __( 'Tools', 'woocommerce-pdf-invoices-packing-slips' ), + 'numbers' => __( 'Numbers', 'woocommerce-pdf-invoices-packing-slips' ), + ); + add_action( 'admin_init', array( $this, 'init_settings' ) ); add_action( 'wpo_wcpdf_settings_output_debug', array( $this, 'output' ), 10, 1 ); - add_action( 'wpo_wcpdf_after_settings_page', array( $this, 'debug_tools' ), 10, 2 ); - - add_action( 'wpo_wcpdf_after_settings_page', array( $this, 'dompdf_status' ), 20, 2 ); add_action( 'wp_ajax_wpo_wcpdf_debug_tools', array( $this, 'ajax_debug_tools' ) ); } - public function output( $section ) { - settings_fields( "wpo_wcpdf_settings_debug" ); - do_settings_sections( "wpo_wcpdf_settings_debug" ); + public function output( $active_section ) { + $active_section = ! empty( $active_section ) ? $active_section : 'settings'; + + ?> +
+ +
+ display_settings(); + break; + case 'status': + $this->display_status(); + break; + case 'tools': + $this->display_tools(); + break; + } + } + + public function display_settings() { + settings_fields( 'wpo_wcpdf_settings_debug' ); + do_settings_sections( 'wpo_wcpdf_settings_debug' ); submit_button(); } + + public function display_status() { + include( WPO_WCPDF()->plugin_path() . '/includes/views/advanced-status.php' ); + } - public function debug_tools( $tab, $section ) { - if ( $tab !== 'debug' ) { - return; - } + public function display_tools() { ?> -

@@ -482,12 +516,6 @@ public function get_setting_types() { return apply_filters( 'wpo_wcpdf_setting_types', $setting_types ); } - public function dompdf_status( $tab, $section ) { - if ( $tab === 'debug' ) { - include( WPO_WCPDF()->plugin_path() . '/includes/views/dompdf-status.php' ); - } - } - public function init_settings() { // Register settings. $page = $option_group = $option_name = 'wpo_wcpdf_settings_debug'; @@ -496,7 +524,7 @@ public function init_settings() { array( 'type' => 'section', 'id' => 'debug_settings', - 'title' => __( 'Debug settings', 'woocommerce-pdf-invoices-packing-slips' ), + 'title' => '', 'callback' => 'section', ), array( diff --git a/includes/views/dompdf-status.php b/includes/views/advanced-status.php similarity index 67% rename from includes/views/dompdf-status.php rename to includes/views/advanced-status.php index 181405d4f..ee1def497 100644 --- a/includes/views/dompdf-status.php +++ b/includes/views/advanced-status.php @@ -106,66 +106,76 @@ ?> -

- - - - - - - - $server_config ) { - if ( $server_config['result'] ) { - $background = '#9e4'; - $color = 'black'; - } elseif ( isset( $server_config['fallback'] ) ) { - $background = '#FCC612'; - $color = 'black'; - } else { - $background = '#f43'; - $color = 'white'; - } - ?> +
 
+ - - - + + + + + + + + - + $server_config ) { + if ( $server_config['result'] ) { + $background = '#9e4'; + $color = 'black'; + } elseif ( isset( $server_config['fallback'] ) ) { + $background = '#FCC612'; + $color = 'black'; + } else { + $background = '#f43'; + $color = 'white'; + } + ?> + + + + + + +
- %s. %s', esc_html__( 'No', 'woocommerce-pdf-invoices-packing-slips' ), esc_html( $server_config['fallback'] ) ); - } - if ( isset( $server_config['failure'] ) ) { - printf( '
%s
', wp_kses_post( $server_config['failure'] ) ); - } - } - ?> -
 
+ %s. %s', esc_html__( 'No', 'woocommerce-pdf-invoices-packing-slips' ), esc_html( $server_config['fallback'] ) ); + } + if ( isset( $server_config['failure'] ) ) { + printf( '
%s
', wp_kses_post( $server_config['failure'] ) ); + } + } + ?> +
-
-

- - - - - - - documents->get_documents( 'all' ) as $document ) : - $is_reset_enabled = isset( $document->settings['reset_number_yearly'] ) ? true : false; - $is_enabled = $document->is_enabled() ? true : false; - ?> +
 
+ + + + + + + + + + + + documents->get_documents( 'all' ) as $document ) : + $is_reset_enabled = isset( $document->settings['reset_number_yearly'] ) ? true : false; + $is_enabled = $document->is_enabled() ? true : false; + ?> + settings->maybe_schedule_yearly_reset_numbers() ) : @@ -266,52 +276,61 @@ $upload_dir = wp_upload_dir(); $upload_base = trailingslashit( $upload_dir['basedir'] ); ?> -
-

-
 
get_title() ); ?>
- - - - - - + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + +
','\\' ), wp_kses_post( $permission['value'] ) ) : ''; ?>
','\\' ), wp_kses_post( $permission['value'] ) ) : ''; ?>
+ '.WPO_WCPDF()->main->get_tmp_path().'', + ''.$upload_base.'', + 'UPLOADS', + 'wpo_wcpdf_tmp_path', + 'attachments', + 'dompdf', + 'fonts' + ); + ?> +
+ '.WPO_WCPDF()->plugin_path() . "/vendor/dompdf/dompdf/lib/fonts/".'' + ); + ?> +
- -

- '.WPO_WCPDF()->main->get_tmp_path().'', - ''.$upload_base.'', - 'UPLOADS', - 'wpo_wcpdf_tmp_path', - 'attachments', - 'dompdf', - 'fonts' - ); - ?> -

- '.WPO_WCPDF()->plugin_path() . "/vendor/dompdf/dompdf/lib/fonts/".'' - ); - ?> -

diff --git a/readme.txt b/readme.txt index 2fef2262d..23606cac8 100644 --- a/readme.txt +++ b/readme.txt @@ -88,7 +88,7 @@ You're more than welcome! This plugin is hosted on github, where you can post is https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips = How can I display the HTML/CSS source for debugging/developing templates? = -There's a setting on the Status tab of the settings page that allows you to toggle HTML output. Don't forget to turn if off after you're done testing! +There's a setting on the Advanced tab of the settings page that allows you to toggle HTML output. Don't forget to turn if off after you're done testing! == Screenshots == @@ -134,7 +134,7 @@ There's a setting on the Status tab of the settings page that allows you to togg = 3.6.0 (2023-08-15) = * New: setting for improved document link access type * New: implemented autoloader for plugin classes -* New: adds a new Status tool to reset plugin settings +* New: adds a new Advanced tool to reset plugin settings * New: invoice number column added to the WooCommerce order analytics * Fix: replaces `utf8_decode()` which is deprecated in PHP 8.2 * Fix: allows the translation for the Shipping Notes strings @@ -151,7 +151,7 @@ There's a setting on the Status tab of the settings page that allows you to togg * New: adds a generic shortcode `[wcpdf_download_pdf]` for PDF download links * New: bump preview PDFJS library to v3.7.107 * Tweak: optimize PDFJS library size -* Tweak: remove WPO hiring banner from the Status tab +* Tweak: remove WPO hiring banner from the Advanced tab * Tweak: composer dependencies update * Fix: font deletion bug after plugin upgrade * Fix: bug on previewing Credit Note if the order has multiple refunds @@ -220,8 +220,8 @@ There's a setting on the Status tab of the settings page that allows you to togg = 3.3.0 (2023-01-16) = * New: WooCommerce HPOS compatibility (beta) -* New: reschedule the yearly reset of the numbering system on a button from the Status page -* New: document status table in the Status page +* New: reschedule the yearly reset of the numbering system on a button from the Advanced page +* New: document status table in the Advanced page * New: adds document object argument to PDF maker class constructor * New: filter to allow user to disable the documents private data removal: `wpo_wcpdf_remove_order_personal_data` * Tweak: optimizes `$wpdb` use on `Sequential_Number_store` class @@ -279,7 +279,7 @@ There's a setting on the Status tab of the settings page that allows you to togg * Fix: fatal error caused by list_files() function missing = 3.1.0 (2022-09-06) = -* New: custom document links feature available from the Status settings page. Changes the document links to a prettier URL scheme +* New: custom document links feature available from the Advanced tab debug settings page. Changes the document links to a prettier URL scheme * New: action hooks before and after the shop logo: `wpo_wcpdf_before_shop_logo` and `wpo_wcpdf_after_shop_logo` * Fix: replaces WP_Filesystem with PHP functions to delete temporary files * Marked tested up to WooCommerce 6.8 @@ -329,7 +329,7 @@ There's a setting on the Status tab of the settings page that allows you to togg * Marked tested up to WooCommerce 6.4 = 2.14.1 = -* New: Relaunch the Setup Wizard manually from the Status tab +* New: Relaunch the Setup Wizard manually from the Advanced tab * Fix: Dynamic `wpo_wcpdf_tmp_path_{$type}` filter hook name parsing * Fix: removing inline preview for media upload * UI: Show sticky save button on settings change @@ -499,7 +499,7 @@ There's a setting on the Status tab of the settings page that allows you to togg * New: Support for line breaks in invoice notes * Fix: Only pass opened edit fields when regenerating document * Fix: Words in table headers could be broken up -* Deprecated: legacy translations (pre-2.0) are no longer read automatically (can be enabled in the Status tab) +* Deprecated: legacy translations (pre-2.0) are no longer read automatically (can be enabled in the Advanced tab) = 2.7.2 = * Fix: Update invoice number and date when regenerating document from edit mode @@ -755,7 +755,7 @@ There's a setting on the Status tab of the settings page that allows you to togg * Fix: Setting for disabling for free invoices should be applied even when other plugins are applying rules = 2.1.9 = -* Feature: Automatic cleanup of temporary attachments folder (settings in Status tab) +* Feature: Automatic cleanup of temporary attachments folder (settings in Advanced tab) * Fix: prevent infinite loop on sites without uploads folder * Fix: tag replacements for externally hosted images (CDN) @@ -827,7 +827,7 @@ There's a setting on the Status tab of the settings page that allows you to togg = 2.0.11 = * Fix: Improved fonts update routine (now preserves custom fonts) * Fix: Enable HTML5 parser by default (fixes issues with libxml) -* Tweak: Show both PHP & WP Memory limit in Status tab +* Tweak: Show both PHP & WP Memory limit in Advanced tab = 2.0.10 = * Fix: Set invoice number backend button @@ -859,7 +859,7 @@ There's a setting on the Status tab of the settings page that allows you to togg * Tweak: Clear fonts folder when manually reinstalling fonts = 2.0.5 = -* Feature: Remove temporary files (Status tab) +* Feature: Remove temporary files (Advanced tab) * Fix: Page number replacement * Tweak: Fallback functions for MB String extension * Tweak: Improved wpo_wcpdf_check_privs usability for my account privileges