first commit

This commit is contained in:
2026-03-05 13:07:40 +01:00
commit 64ba0721ee
25709 changed files with 4691006 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
<?php defined( 'ABSPATH' ) or exit; ?>
<div class="wcpdf_document_settings_sections wcpdf_advanced_numbers_choose_table">
<?php
$choose_table_title = isset( $number_store_tables[ $selected_table_name ] ) ? esc_attr( $number_store_tables[ $selected_table_name ] ) : __( 'Choose a number store', 'woocommerce-pdf-invoices-packing-slips' );
echo '<h2>' . esc_html( $choose_table_title ) . '<span class="arrow-down">&#9660;</span></h2>';
?>
<ul>
<?php
foreach ( $number_store_tables as $table_name => $title ) {
if ( isset( $_GET['table_name'] ) && $table_name !== $_GET['table_name'] ) {
if ( empty( trim( $title ) ) ) {
$title = '[' . __( 'untitled', 'woocommerce-pdf-invoices-packing-slips' ) . ']';
}
printf( '<li><a href="%1$s">%2$s</a></li>', esc_url( add_query_arg( 'table_name', esc_attr( $table_name ) ) ), esc_html( $title ) );
}
}
?>
</ul>
<?php if ( ! empty( $document_type ) && 'invoice' !== $document_type && in_array( $document_type, $invoice_number_store_doc_types ) ) : ?>
<div class="notice notice-warning inline">
<p><?php _e( 'This document is currently using the main invoice number sequence.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
</div>
<?php elseif ( ! empty( $selected_table_name ) && ! empty( $number_store_tables[ $selected_table_name ] ) ) : ?>
<p>
<?php
printf(
/* translators: chose table title */
__( 'Below is a list of all the document numbers generated since the last reset (which happens when you set the <strong>next %s number</strong> value in the settings).', 'woocommerce-pdf-invoices-packing-slips' ),
$choose_table_title
);
?>
</p>
<p><?php _e( 'Numbers may have been assigned to orders before this.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
<div class="number-search" style="text-align:right;">
<input type="search" id="number_search_input" name="number_search_input" value="<?php echo isset( $_REQUEST['s'] ) ? esc_attr( $_REQUEST['s'] ) : ''; ?>">
<a href="#" class="button button-primary number-search-button"><?php _e( 'Search number', 'woocommerce-pdf-invoices-packing-slips' ); ?></a>
<?php $disabled = ( isset( $_REQUEST['s'] ) && ! empty( $_REQUEST['s'] ) ) ? '' : 'disabled'; ?>
<a href="<?php echo esc_url( remove_query_arg( 's' ) ); ?>" class="button button-secondary" <?php echo $disabled; ?>><?php _e( 'Reset', 'woocommerce-pdf-invoices-packing-slips' ); ?></a>
</div>
<?php $list_table->display(); ?>
<?php else : ?>
<div class="notice notice-info inline">
<p><?php _e( 'Please select a number store!', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
</div>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,344 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
$memory_limit = function_exists( 'wc_let_to_num' ) ? wc_let_to_num( WP_MEMORY_LIMIT ) : woocommerce_let_to_num( WP_MEMORY_LIMIT );
$php_mem_limit = function_exists( 'memory_get_usage' ) ? @ini_get( 'memory_limit' ) : '-';
$server_configs = apply_filters( 'wpo_wcpdf_server_configs' , array(
'PHP version' => array(
'required' => __( '7.2+ (7.4 or higher recommended)', 'woocommerce-pdf-invoices-packing-slips' ),
'value' => PHP_VERSION,
'result' => version_compare( PHP_VERSION, '7.2', '>' ),
),
'DOMDocument extension' => array(
'required' => true,
'value' => phpversion( 'DOM' ),
'result' => class_exists( 'DOMDocument' ),
),
'MBString extension' => array(
'required' => true,
'value' => phpversion( 'mbstring' ),
'result' => function_exists( 'mb_send_mail' ),
'fallback' => __( 'Recommended, will use fallback functions', 'woocommerce-pdf-invoices-packing-slips' ),
),
'GD' => array(
'required' => true,
'value' => phpversion( 'gd' ),
'result' => function_exists( 'imagecreate' ),
'fallback' => __( 'Required if you have images in your documents', 'woocommerce-pdf-invoices-packing-slips' ),
),
'WebP Support' => array(
'required' => __( 'Required when using .webp images', 'woocommerce-pdf-invoices-packing-slips' ),
'value' => null,
'result' => function_exists( 'imagecreatefromwebp' ),
'fallback' => __( 'Required if you have .webp images in your documents', 'woocommerce-pdf-invoices-packing-slips' ),
),
// "PCRE" => array(
// "required" => true,
// "value" => phpversion("pcre"),
// "result" => function_exists("preg_match") && @preg_match("/./u", "a"),
// "failure" => "PCRE is required with Unicode support (the \"u\" modifier)",
// ),
'Zlib' => array(
'required' => __( 'To compress PDF documents', 'woocommerce-pdf-invoices-packing-slips' ),
'value' => phpversion( 'zlib' ),
'result' => function_exists( 'gzcompress' ),
'fallback' => __( 'Recommended to compress PDF documents', 'woocommerce-pdf-invoices-packing-slips' ),
),
'opcache' => array(
'required' => __( 'For better performances', 'woocommerce-pdf-invoices-packing-slips' ),
'value' => null,
'result' => false,
'fallback' => __( 'Recommended for better performances', 'woocommerce-pdf-invoices-packing-slips' ),
),
'GMagick or IMagick' => array(
'required' => __( 'Better with transparent PNG images', 'woocommerce-pdf-invoices-packing-slips' ),
'value' => null,
'result' => extension_loaded( 'gmagick' ) || extension_loaded( 'imagick' ),
'fallback' => __( 'Recommended for better performances', 'woocommerce-pdf-invoices-packing-slips' ),
),
'glob()' => array(
'required' => __( 'Required to detect custom templates and to clear the temp folder periodically', 'woocommerce-pdf-invoices-packing-slips' ),
'value' => null,
'result' => function_exists( 'glob' ),
'fallback' => __( 'Check PHP disable_functions', 'woocommerce-pdf-invoices-packing-slips' ),
),
'WP Memory Limit' => array(
/* translators: <a> tags */
'required' => sprintf( __( 'Recommended: 128MB (more for plugin-heavy setups<br/>See: %1$sIncreasing the WordPress Memory Limit%2$s', 'woocommerce-pdf-invoices-packing-slips' ), '<a href="https://docs.woocommerce.com/document/increasing-the-wordpress-memory-limit/" target="_blank">', '</a>' ),
'value' => sprintf( 'WordPress: %s, PHP: %s', WP_MEMORY_LIMIT, $php_mem_limit ),
'result' => $memory_limit > 67108864,
),
'allow_url_fopen' => array (
'required' => __( 'Allow remote stylesheets and images', 'woocommerce-pdf-invoices-packing-slips' ),
'value' => null,
'result' => ini_get( 'allow_url_fopen' ),
'fallback' => __( 'allow_url_fopen disabled', 'woocommerce-pdf-invoices-packing-slips' ),
),
'base64_decode' => array (
'required' => __( 'To compress and decompress font data', 'woocommerce-pdf-invoices-packing-slips' ),
'value' => null,
'result' => function_exists( 'base64_decode' ),
'fallback' => __( 'base64_decode disabled', 'woocommerce-pdf-invoices-packing-slips' ),
),
) );
if ( ( $xc = extension_loaded( 'xcache' ) ) || ( $apc = extension_loaded( 'apc' ) ) || ( $zop = extension_loaded( 'Zend OPcache' ) ) || ( $op = extension_loaded( 'opcache' ) ) ) {
$server_configs['opcache']['result'] = true;
$server_configs['opcache']['value'] = (
$xc ? 'XCache '.phpversion( 'xcache' ) : (
$apc ? 'APC '.phpversion( 'apc' ) : (
$zop ? 'Zend OPCache '.phpversion( 'Zend OPcache' ) : 'PHP OPCache '.phpversion( 'opcache' )
)
)
);
}
if ( ( $gm = extension_loaded( 'gmagick' ) ) || ( $im = extension_loaded( 'imagick' ) ) ) {
$server_configs['GMagick or IMagick']['value'] = ( $im ? 'IMagick '.phpversion( 'imagick' ) : 'GMagick '.phpversion( 'gmagick' ) );
}
if ( ! $server_configs['PHP version']['result'] ) {
/* translators: <a> tags */
$server_configs['PHP version']['required'] .= '<br/>' . sprintf( __( 'Download %1$sthis addon%2$s to enable backwards compatibility.', 'woocommerce-pdf-invoices-packing-slips' ), '<a href="https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/backwards-compatibility-with-php-5-6/" target="_blank">', '</a>' );
}
?>
<table class="widefat system-status-table" cellspacing="1px" cellpadding="4px" style="width:100%;">
<thead>
<tr>
<td colspan="3"><strong><?php esc_html_e( 'System Configuration', 'woocommerce-pdf-invoices-packing-slips' ); ?></strong></td>
</tr>
</thead>
<tbody>
<tr>
<th align="left">&nbsp;</th>
<th align="left"><?php esc_html_e( 'Required', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
<th align="left"><?php esc_html_e( 'Present', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
</tr>
<?php
foreach ( $server_configs as $label => $server_config ) :
if ( $server_config['result'] ) {
$background = '#68de7c'; // green
$color = 'black';
} elseif ( isset( $server_config['fallback'] ) ) {
$background = '#f2d675'; // yellow
$color = 'black';
} else {
$background = '#ffabaf'; // red
$color = 'black';
}
?>
<tr>
<td class="title"><?php echo esc_html( $label ); ?></td>
<td><?php echo wp_kses_post( $server_config['required'] === true ? esc_html__( 'Yes', 'woocommerce-pdf-invoices-packing-slips' ) : $server_config['required'] ); ?></td>
<td style="background-color:<?php echo esc_attr( $background ); ?>; color:<?php echo esc_attr( $color ); ?>">
<?php
echo wp_kses_post( $server_config['value'] );
if ( $server_config['result'] && ! $server_config['value'] ) echo esc_html__( 'Yes', 'woocommerce-pdf-invoices-packing-slips' );
if ( ! $server_config['result'] ) {
if ( isset( $server_config['fallback'] ) ) {
printf( '<div>%s. %s</div>', esc_html__( 'No', 'woocommerce-pdf-invoices-packing-slips' ), esc_html( $server_config['fallback'] ) );
}
if ( isset( $server_config['failure'] ) ) {
printf( '<div>%s</div>', wp_kses_post( $server_config['failure'] ) );
}
}
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<table class="widefat system-status-table" cellspacing="1px" cellpadding="4px" style="width:100%;">
<thead>
<tr>
<td colspan="3"><strong><?php esc_html_e( 'Documents status', 'woocommerce-pdf-invoices-packing-slips' ); ?></strong></td>
</tr>
</thead>
<tbody>
<tr>
<th align="left">&nbsp;</th>
<th align="left"><?php esc_html_e( 'Enabled', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
<th align="left"><?php esc_html_e( 'Yearly reset', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
</tr>
<?php
foreach ( WPO_WCPDF()->documents->get_documents( 'all' ) as $document ) :
$is_reset_enabled = isset( $document->settings['reset_number_yearly'] ) ? true : false;
$is_enabled = $document->is_enabled() ? true : false;
?>
<tr>
<td class="title"><?php echo esc_html( $document->get_title() ); ?></td>
<td style="<?= $is_enabled ? 'background-color:#68de7c; color:black;' : 'background-color:#ffabaf; color:black;' ?>"><?php echo wp_kses_post( $is_enabled === true ? esc_html__( 'Yes', 'woocommerce-pdf-invoices-packing-slips' ) : esc_html__( 'No', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></td>
<td style="<?= $is_reset_enabled ? 'background-color:#68de7c; color:black;' : 'background-color:#ffabaf; color:black;' ?>"><?php echo wp_kses_post( $is_reset_enabled === true ? esc_html__( 'Yes', 'woocommerce-pdf-invoices-packing-slips' ) : esc_html__( 'No', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></td>
</tr>
</tbody>
<?php endforeach; ?>
<?php
if ( WPO_WCPDF()->settings->maybe_schedule_yearly_reset_numbers() ) :
if ( function_exists( 'as_get_scheduled_actions' ) ) {
$scheduled_actions = as_get_scheduled_actions( array(
'hook' => 'wpo_wcpdf_schedule_yearly_reset_numbers',
'status' => \ActionScheduler_Store::STATUS_PENDING,
) );
$yearly_reset = array(
'required' => __( 'Required to reset documents numeration', 'woocommerce-pdf-invoices-packing-slips' ),
'fallback' => __( 'Yearly reset action not found', 'woocommerce-pdf-invoices-packing-slips' ),
);
if ( ! empty( $scheduled_actions ) ) {
$total_actions = count( $scheduled_actions );
if ( $total_actions === 1 ) {
$action = reset( $scheduled_actions );
$action_date = is_callable( array( $action->get_schedule(), 'get_date' ) ) ? $action->get_schedule()->get_date() : $action->get_schedule()->get_next( as_get_datetime_object() );
/* translators: action date */
$yearly_reset['value'] = sprintf(
__( 'Scheduled to: %s' ), date( wcpdf_date_format( null, 'yearly_reset_schedule' ),
$action_date->getTimeStamp() )
);
$yearly_reset['result'] = true;
} else {
/* translators: total actions */
$yearly_reset['value'] = sprintf(
/* translators: total scheduled actions */
__( 'Only 1 scheduled action should exist, but %s were found', 'woocommerce-pdf-invoices-packing-slips' ),
$total_actions
);
$yearly_reset['result'] = false;
}
} else {
$yearly_reset['value'] = sprintf(
/* translators: <a></a> tags */
__( 'Scheduled action not found. Please reschedule it %shere%s.', 'woocommerce-pdf-invoices-packing-slips' ),
'<a href="' . esc_url( add_query_arg( 'section', 'tools' ) ) . '" style="color:black; text-decoration:underline;">',
'</a>'
);
$yearly_reset['result'] = false;
}
}
$label = __( 'Yearly reset', 'woocommerce-pdf-invoices-packing-slips' );
if ( $yearly_reset['result'] ) {
$background = '#68de7c'; // green
$color = 'black';
} else {
$background = '#ffabaf'; // red
$color = 'black';
}
?>
<tfoot>
<tr>
<td class="title"><strong><?php echo esc_html( $label ); ?></strong></td>
<td colspan="2" style="background-color:<?php echo esc_attr( $background ); ?>; color:<?php echo esc_attr( $color ); ?>">
<?php
echo wp_kses_post( $yearly_reset['value'] );
if ( $yearly_reset['result'] && ! $yearly_reset['value'] ) {
echo esc_html__( 'Yes', 'woocommerce-pdf-invoices-packing-slips' );
}
?>
</td>
</tr>
</tfoot>
<?php endif; ?>
</table>
<?php
$status = array(
'ok' => __( 'Writable', 'woocommerce-pdf-invoices-packing-slips' ),
'failed' => __( 'Not writable', 'woocommerce-pdf-invoices-packing-slips' ),
);
$permissions = apply_filters( 'wpo_wcpdf_plugin_directories', array(
'WCPDF_TEMP_DIR' => array (
'description' => __( 'Central temporary plugin folder', 'woocommerce-pdf-invoices-packing-slips' ),
'value' => WPO_WCPDF()->main->get_tmp_path(),
'status' => is_writable( WPO_WCPDF()->main->get_tmp_path() ) ? 'ok' : 'failed',
'status_message' => is_writable( WPO_WCPDF()->main->get_tmp_path() ) ? $status['ok'] : $status['failed'],
),
'WCPDF_ATTACHMENT_DIR' => array (
'description' => __( 'Temporary attachments folder', 'woocommerce-pdf-invoices-packing-slips' ),
'value' => trailingslashit( WPO_WCPDF()->main->get_tmp_path( 'attachments' ) ),
'status' => is_writable( WPO_WCPDF()->main->get_tmp_path( 'attachments' ) ) ? 'ok' : 'failed',
'status_message' => is_writable( WPO_WCPDF()->main->get_tmp_path( 'attachments' ) ) ? $status['ok'] : $status['failed'],
),
'DOMPDF_TEMP_DIR' => array (
'description' => __( 'Temporary DOMPDF folder', 'woocommerce-pdf-invoices-packing-slips' ),
'value' => trailingslashit(WPO_WCPDF()->main->get_tmp_path( 'dompdf' )),
'status' => is_writable(WPO_WCPDF()->main->get_tmp_path( 'dompdf' )) ? 'ok' : 'failed',
'status_message' => is_writable(WPO_WCPDF()->main->get_tmp_path( 'dompdf' )) ? $status['ok'] : $status['failed'],
),
'DOMPDF_FONT_DIR' => array (
'description' => __( 'DOMPDF fonts folder (needs to be writable for custom/remote fonts)', 'woocommerce-pdf-invoices-packing-slips' ),
'value' => trailingslashit(WPO_WCPDF()->main->get_tmp_path( 'fonts' )),
'status' => is_writable(WPO_WCPDF()->main->get_tmp_path( 'fonts' )) ? 'ok' : 'failed',
'status_message' => is_writable(WPO_WCPDF()->main->get_tmp_path( 'fonts' )) ? $status['ok'] : $status['failed'],
),
), $status );
$upload_dir = wp_upload_dir();
$upload_base = trailingslashit( $upload_dir['basedir'] );
?>
<table class="widefat system-status-table" cellspacing="1px" cellpadding="4px" style="width:100%;">
<thead>
<tr>
<td colspan="3"><strong><?php esc_html_e( 'Write Permissions', 'woocommerce-pdf-invoices-packing-slips' ); ?></strong></td>
</tr>
</thead>
<tbody>
<tr>
<th align="left">&nbsp;</th>
<th align="left"><?php esc_html_e( 'Path', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
<th align="left"><?php esc_html_e( 'Status', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
</tr>
<?php
foreach ( $permissions as $permission ) {
if ( $permission['status'] == 'ok' ) {
$background = '#68de7c'; // green
$color = 'black';
} else {
$background = '#ffabaf'; // red
$color = 'black';
}
?>
<tr>
<td><?php echo wp_kses_post( $permission['description'] ); ?></td>
<td><?php echo ! empty( $permission['value'] ) ? str_replace( array('/','\\' ), array('/<wbr>','\\<wbr>' ), wp_kses_post( $permission['value'] ) ) : ''; ?></td>
<td style="background-color:<?php echo esc_attr( $background ); ?>; color:<?php echo esc_attr( $color ); ?>"><?php echo wp_kses_post( $permission['status_message'] ); ?></td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<?php
/* translators: 1,2. directory paths, 3. UPLOADS, 4. wpo_wcpdf_tmp_path, 5. attachments, 6. dompdf, 7. fonts */
printf( esc_attr__( 'The central temp folder is %1$s. By default, this folder is created in the WordPress uploads folder (%2$s), which can be defined by setting %3$s in wp-config.php. Alternatively, you can control the specific folder for PDF invoices by using the %4$s filter. Make sure this folder is writable and that the subfolders %5$s, %6$s and %7$s are present (these will be created by the plugin if the central temp folder is writable).', 'woocommerce-pdf-invoices-packing-slips' ),
'<code>'.WPO_WCPDF()->main->get_tmp_path().'</code>',
'<code>'.$upload_base.'</code>',
'<code>UPLOADS</code>',
'<code>wpo_wcpdf_tmp_path</code>',
'<code>attachments</code>',
'<code>dompdf</code>',
'<code>fonts</code>'
);
?>
</td>
</tr>
<tr>
<td colspan="3">
<?php
/* translators: directory path */
printf( esc_attr__('If the temporary folders were not automatically created by the plugin, verify that all the font files (from %s) are copied to the fonts folder. Normally, this is fully automated, but if your server has strict security settings, this automated copying may have been prohibited. In that case, you also need to make sure these folders get synchronized on plugin updates!', 'woocommerce-pdf-invoices-packing-slips' ),
'<code>'.WPO_WCPDF()->plugin_path() . "/vendor/dompdf/dompdf/lib/fonts/".'</code>'
);
?>
</td>
</tr>
</tfoot>
</table>

View File

@@ -0,0 +1,215 @@
<?php defined( 'ABSPATH' ) or exit; ?>
<div id="debug-tools">
<div class="wrapper">
<?php do_action( 'wpo_wcpdf_before_debug_tools', $this ); ?>
<!-- generate_random_string -->
<div class="tool">
<h4><?php _e( 'Generate random temporary directory', 'woocommerce-pdf-invoices-packing-slips' ); ?></h4>
<p><?php _e( 'For security reasons, it is preferable to use a random name for the temporary directory.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
<form method="post">
<?php wp_nonce_field( 'wpo_wcpdf_debug_tools_action', 'security' ); ?>
<input type="hidden" name="wpo_wcpdf_debug_tools_action" value="generate_random_string">
<input type="submit" name="submit" id="submit" class="button" value="<?php esc_attr_e( 'Generate temporary directory', 'woocommerce-pdf-invoices-packing-slips' ); ?>">
</form>
</div>
<!-- /generate_random_string -->
<!-- install_fonts -->
<div class="tool">
<h4><?php _e( 'Reinstall plugin fonts', 'woocommerce-pdf-invoices-packing-slips' ); ?></h4>
<p><?php _e( 'If you are experiencing issues with rendering fonts there might have been an issue during installation or upgrade.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
<form method="post">
<?php wp_nonce_field( 'wpo_wcpdf_debug_tools_action', 'security' ); ?>
<input type="hidden" name="wpo_wcpdf_debug_tools_action" value="install_fonts">
<input type="submit" name="submit" id="submit" class="button" value="<?php esc_attr_e( 'Reinstall fonts', 'woocommerce-pdf-invoices-packing-slips' ); ?>">
</form>
</div>
<!-- /install_fonts -->
<!-- reschedule_yearly_reset -->
<?php if ( ! WPO_WCPDF()->settings->yearly_reset_action_is_scheduled() ) : ?>
<div class="tool">
<h4><?php _e( 'Reschedule the yearly reset of the numbering system', 'woocommerce-pdf-invoices-packing-slips' ); ?></h4>
<p><?php _e( "You seem to have the yearly reset enabled for one of your documents but the action that performs this isn't scheduled yet.", 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
<form method="post">
<?php wp_nonce_field( 'wpo_wcpdf_debug_tools_action', 'security' ); ?>
<input type="hidden" name="wpo_wcpdf_debug_tools_action" value="reschedule_yearly_reset">
<input type="submit" name="submit" id="submit" class="button" value="<?php esc_attr_e( 'Reschedule yearly reset', 'woocommerce-pdf-invoices-packing-slips' ); ?>">
</form>
</div>
<?php endif; ?>
<!-- /reschedule_yearly_reset -->
<!-- clear_tmp -->
<div class="tool">
<h4><?php _e( 'Remove temporary files', 'woocommerce-pdf-invoices-packing-slips' ); ?></h4>
<p><?php _e( 'Clean up the PDF files stored in the temporary folder (used for email attachments).', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
<form method="post">
<?php wp_nonce_field( 'wpo_wcpdf_debug_tools_action', 'security' ); ?>
<input type="hidden" name="wpo_wcpdf_debug_tools_action" value="clear_tmp">
<input type="submit" name="submit" id="submit" class="button" value="<?php esc_attr_e( 'Remove temporary files', 'woocommerce-pdf-invoices-packing-slips' ); ?>">
</form>
</div>
<!-- /clear_tmp -->
<!-- run_wizard -->
<div class="tool">
<h4><?php _e( 'Run the Setup Wizard', 'woocommerce-pdf-invoices-packing-slips' ); ?></h4>
<p><?php _e( 'Set up your basic invoice workflow via our Wizard.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wpo-wcpdf-setup' ) ); ?>" class="button"><?php esc_html_e( 'Run the Setup Wizard', 'woocommerce-pdf-invoices-packing-slips' ); ?></a>
</div>
<!-- /run_wizard -->
<!-- export_settings -->
<div class="tool">
<h4><?php _e( 'Export Settings', 'woocommerce-pdf-invoices-packing-slips' ); ?></h4>
<p><?php _e( 'Download plugin settings in JSON format to easily export your current setup.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
<form class="wpo_wcpdf_debug_tools_form" method="post">
<input type="hidden" name="debug_tool" value="export-settings">
<fieldset>
<select name="type" required>
<?php
foreach ( $this->get_setting_types() as $type => $name ) {
?>
<option value="<?php echo $type; ?>"><?php echo $name; ?></option>
<?php
}
?>
</select>
<a href="" class="button button-secondary submit"><?php _e( 'Export', 'woocommerce-pdf-invoices-packing-slips' ); ?></a>
</fieldset>
<fieldset>
<div class="notice inline" style="display:none;"><p></p></div>
</fieldset>
</form>
</div>
<!-- /export_settings -->
<!-- import_settings -->
<div class="tool">
<h4><?php _e( 'Import Settings', 'woocommerce-pdf-invoices-packing-slips' ); ?></h4>
<p><?php _e( 'Import plugin settings in JSON format.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
<form class="wpo_wcpdf_debug_tools_form" method="post" enctype="multipart/form-data">
<input type="hidden" name="debug_tool" value="import-settings">
<fieldset>
<input type="file" name="file" accept="application/json" required>
<a href="" class="button button-secondary submit"><?php _e( 'Import', 'woocommerce-pdf-invoices-packing-slips' ); ?></a>
</fieldset>
<fieldset>
<div class="notice inline" style="display:none;"><p></p></div>
</fieldset>
</form>
</div>
<!-- /import_settings -->
<!-- reset_settings -->
<div class="tool">
<h4><?php _e( 'Reset Settings', 'woocommerce-pdf-invoices-packing-slips' ); ?></h4>
<p><?php _e( 'This will clear all your selected settings data. Please do a backup first using the export tool above.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
<form class="wpo_wcpdf_debug_tools_form" method="post">
<input type="hidden" name="debug_tool" value="reset-settings">
<fieldset>
<select name="type" required>
<?php
foreach ( $this->get_setting_types() as $type => $name ) {
?>
<option value="<?php echo $type; ?>"><?php echo $name; ?></option>
<?php
}
?>
</select>
<a href="" class="button button-secondary submit"><?php _e( 'Reset', 'woocommerce-pdf-invoices-packing-slips' ); ?></a>
</fieldset>
<fieldset>
<div class="notice inline" style="display:none;"><p></p></div>
</fieldset>
</form>
</div>
<!-- /reset_settings -->
<?php do_action( 'wpo_wcpdf_after_debug_tools', $this ); ?>
</div>
<!-- danger_zone (admin access only) -->
<?php if ( current_user_can( 'administrator' ) && isset( WPO_WCPDF()->settings->debug_settings['enable_danger_zone_tools'] ) ) : ?>
<?php $documents = WPO_WCPDF()->documents->get_documents( 'all' ); ?>
<div id="danger_zone" class="wrapper">
<div class="tool">
<div class="notice notice-warning inline">
<p><?php _e( '<strong>DANGER ZONE:</strong> Create a backup before using these tools, the actions they perform are irreversible!', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
</div>
</div>
<!-- renumber_documents -->
<div class="tool">
<h4><?php _e( 'Renumber existing documents', 'woocommerce-pdf-invoices-packing-slips' ); ?></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>
<table>
<tr>
<td><?php _e( 'Document type:', 'woocommerce-pdf-invoices-packing-slips' ); ?></td>
<td>
<select id="renumber-document-type" name="renumber-document-type">
<option value=""><?php _e( 'Select', 'woocommerce-pdf-invoices-packing-slips' ); ?>...</option>
<?php foreach ( $documents as $document ) : ?>
<option value="<?php echo $document->get_type(); ?>"><?php echo $document->get_title(); ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>
<tr>
<td><?php _e( 'From:', 'woocommerce-pdf-invoices-packing-slips' ); ?></td>
<td><input type="text" id="renumber-date-from" name="renumber-date-from" value="<?php echo date( 'Y-m-d' ); ?>" size="10"><span class="add-info"><?php _e( '(as: yyyy-mm-dd)', 'woocommerce-pdf-invoices-packing-slips' ); ?></span></td>
</tr>
<tr>
<td><?php _e( 'To:', 'woocommerce-pdf-invoices-packing-slips' ); ?></td>
<td><input type="text" id="renumber-date-to" name="renumber-date-to" value="<?php echo date( 'Y-m-d' ); ?>" size="10"><span class="add-info"><?php _e( '(as: yyyy-mm-dd)', 'woocommerce-pdf-invoices-packing-slips' ); ?></span></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<button class="button button-large number-tools-btn" id="renumber-documents-btn"><?php _e( 'Renumber documents', 'woocommerce-pdf-invoices-packing-slips' ); ?></button>
<div class="spinner renumber-spinner"></div>
</td>
</tr>
</table>
</div>
<!-- /renumber_documents -->
<!-- delete_documents -->
<div class="tool">
<h4><?php _e( 'Delete existing documents', 'woocommerce-pdf-invoices-packing-slips' ); ?></h4>
<p><?php _e( 'This tool will delete existing documents within the selected order date range.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
<table>
<tr>
<td><?php _e( 'Document type:', 'woocommerce-pdf-invoices-packing-slips' ); ?></td>
<td>
<select id="delete-document-type" name="delete-document-type">
<option value=""><?php _e( 'Select', 'woocommerce-pdf-invoices-packing-slips' ); ?>...</option>
<?php foreach ( $documents as $document ) : ?>
<option value="<?php echo $document->get_type(); ?>"><?php echo $document->get_title(); ?></option>
<?php endforeach; ?>
<option value="all"><?php _e( 'All', 'woocommerce-pdf-invoices-packing-slips' ); ?></option>
</select>
</td>
</tr>
<tr>
<td><?php _e( 'From:', 'woocommerce-pdf-invoices-packing-slips' ); ?></td>
<td><input type="text" id="delete-date-from" name="delete-date-from" value="<?php echo date( 'Y-m-d' ); ?>" size="10"><span class="add-info"><?php _e( '(as: yyyy-mm-dd)', 'woocommerce-pdf-invoices-packing-slips' ); ?></span></td>
</tr>
<tr>
<td><?php _e( 'To:', 'woocommerce-pdf-invoices-packing-slips' ); ?></td>
<td><input type="text" id="delete-date-to" name="delete-date-to" value="<?php echo date( 'Y-m-d' ); ?>" size="10"><span class="add-info"><?php _e( '(as: yyyy-mm-dd)', 'woocommerce-pdf-invoices-packing-slips' ); ?></span></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<button class="button button-large number-tools-btn" id="delete-documents-btn"><?php _e( 'Delete documents', 'woocommerce-pdf-invoices-packing-slips' ); ?></button>
<div class="spinner delete-spinner"></div>
</td>
</tr>
</table>
</div>
<!-- /delete_documents -->
</div>
<?php endif; ?>
<!-- /danger_zone (admin access only) -->
</div>

View File

@@ -0,0 +1,14 @@
<?php defined( 'ABSPATH' ) or exit; ?>
<?php
$invoice_settings_url = esc_url( add_query_arg( array(
'tab' => 'documents',
'section' => 'invoice',
) ) );
?>
<div class="wcpdf-attachment-settings-hint notice inline">
<p>
<?php /* translators: <a> tags */ ?>
<?php printf( wp_kses_post( __( 'It looks like you haven\'t setup any email attachments yet, check the settings under <b>%1$sDocuments > Invoice%2$s</b>', 'woocommerce-pdf-invoices-packing-slips' ) ), '<a href="'.$invoice_settings_url.'">', '</a>' ); ?>
<?php printf( '<a href="%s" style="display:block; margin-top:10px;">%s</a>', esc_url( wp_nonce_url( add_query_arg( 'wpo_wcpdf_hide_attachments_hint', 'true' ), 'hide_attachments_hint_nonce' ) ), esc_html__( 'Hide this message', 'woocommerce-pdf-invoices-packing-slips' ) ); ?>
</p>
</div>

View File

@@ -0,0 +1,124 @@
<?php defined( 'ABSPATH' ) or exit; ?>
<div class="wcpdf-extensions-ad">
<?php $no_pro = ! class_exists( 'WooCommerce_PDF_IPS_Pro' ) && ! class_exists( 'WPO_WCPDF_Templates' ); ?>
<img src="<?php echo esc_url( WPO_WCPDF()->plugin_url() . '/assets/images/wpo-helper.png' ); ?>" class="wpo-helper">
<h3><?php esc_html_e( 'Check out these premium extensions!', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3>
<i>(<?php esc_html_e( 'click items to read more', 'woocommerce-pdf-invoices-packing-slips' ); ?>)</i>
<ul class="wcpdf-extensions">
<?php if ( $no_pro ): ?>
<!-- No Pro extensions: Ad for PDF bundle -->
<li>
<?php esc_html_e( 'Premium PDF Invoice bundle: Everything you need for a perfect invoicing system', 'woocommerce-pdf-invoices-packing-slips' ); ?>
<div class="more" style="display:none;">
<h4><?php esc_html_e( 'Supercharge PDF Invoices & Packing Slips for WooCommerce with the all our premium extensions:', 'woocommerce-pdf-invoices-packing-slips' ); ?></h4>
<?php esc_html_e( 'Professional features:', 'woocommerce-pdf-invoices-packing-slips' ); ?>
<ul>
<li><?php echo wp_kses_post( __( 'Email/print/download <b>PDF Credit Notes & Proforma invoices</b>', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( 'Send out a separate <b>notification email</b> with (or without) PDF invoices/packing slips, for example to a drop-shipper or a supplier.', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( 'Attach <b>up to 3 static files</b> (for example a terms & conditions document) to the WooCommerce emails of your choice.', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( 'Use <b>separate numbering systems</b> and/or format for proforma invoices and credit notes or utilize the main invoice numbering system', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( '<b>Customize</b> the <b>shipping & billing address</b> format to include additional custom fields, font sizes etc. without the need to create a custom template.', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( 'Use the plugin in multilingual <b>WPML</b> setups', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
</ul>
<?php esc_html_e( 'Advanced, customizable templates', 'woocommerce-pdf-invoices-packing-slips' ); ?>
<ul>
<li><?php echo wp_kses_post( __( 'Completely customize the invoice contents (prices, taxes, thumbnails) to your needs with a drag & drop customizer', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( 'Two extra stylish premade templates (Modern & Business)', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
</ul>
<?php esc_html_e( 'Upload automatically to dropbox', 'woocommerce-pdf-invoices-packing-slips' ); ?>
<ul>
<li><?php echo wp_kses_post( __( 'This extension conveniently uploads all the invoices (and other pdf documents from the professional extension) that are emailed to your customers to Dropbox. The best way to keep your invoice administration up to date!', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
</ul>
<br>
<a href="https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-bundle/" target="_blank"><?php esc_html_e( "Get PDF Invoices & Packing Slips for WooCommerce Bundle", 'woocommerce-pdf-invoices-packing-slips' ); ?></a>
</div>
</li>
<?php endif; ?>
<?php
// NO BUNDLE: separate ads
if ( ! class_exists( 'WooCommerce_PDF_IPS_Pro' ) && ! $no_pro ) {
?>
<li>
<?php esc_html_e( 'Go Pro: Proforma invoices, credit notes (=refunds) & more!', 'woocommerce-pdf-invoices-packing-slips' ); ?>
<div class="more" style="display:none;">
<?php esc_html_e( 'Supercharge PDF Invoices & Packing Slips for WooCommerce with the following features:', 'woocommerce-pdf-invoices-packing-slips' ); ?>
<ul>
<li><?php echo wp_kses_post( __( 'Email/print/download <b>PDF Credit Notes & Proforma invoices</b>', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( 'Send out a separate <b>notification email</b> with (or without) PDF invoices/packing slips, for example to a drop-shipper or a supplier.', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( 'Attach <b>up to 3 static files</b> (for example a terms & conditions document) to the WooCommerce emails of your choice.', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( 'Use <b>separate numbering systems</b> and/or format for proforma invoices and credit notes or utilize the main invoice numbering system', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( '<b>Customize</b> the <b>shipping & billing address</b> format to include additional custom fields, font sizes etc. without the need to create a custom template.', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( 'Use the plugin in multilingual <b>WPML</b> setups', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( 'Upload automatically to dropbox', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
</ul>
<a href="https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-professional/" target="_blank"><?php esc_html_e( "Get PDF Invoices & Packing Slips for WooCommerce Professional!", 'woocommerce-pdf-invoices-packing-slips' ); ?></a>
</li>
<?php } ?>
<?php
if ( ! class_exists( 'WPO_WC_Smart_Reminder_Emails' ) ) {
?>
<li>
<?php esc_html_e( 'Automatically send payment reminders to your customers', 'woocommerce-pdf-invoices-packing-slips' ); ?>
<div class="more" style="display:none;">
<?php esc_html_e( 'WooCommerce Smart Reminder emails', 'woocommerce-pdf-invoices-packing-slips' ); ?>
<ul>
<li><?php echo wp_kses_post( __( '<b>Completely automatic</b> scheduled emails', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( '<b>Rich text editor</b> for the email text, including placeholders for data from the order (name, order total, etc)', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( 'Configure the exact requirements for sending an email (time after order, order status, payment method)', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( 'Fully <b>WPML Compatible</b> emails will be automatically sent in the order language.', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><?php echo wp_kses_post( __( '<b>Super versatile!</b> Can be used for any kind of reminder email (review reminders, repeat purchases)', 'woocommerce-pdf-invoices-packing-slips' ) ); ?></li>
<li><b><?php esc_html_e( 'Integrates seamlessly with the PDF Invoices & Packing Slips plugin', 'woocommerce-pdf-invoices-packing-slips' ); ?></b></li>
</ul>
<a href="https://wpovernight.com/downloads/woocommerce-reminder-emails-payment-reminders/" target="_blank"><?php esc_html_e( "Get WooCommerce Smart Reminder Emails", 'woocommerce-pdf-invoices-packing-slips' ); ?></a>
</div>
</li>
<?php } ?>
<?php
if ( ! class_exists( 'WooCommerce_Ext_PrintOrders' ) ) {
?>
<li>
<?php esc_html_e( 'Automatically send new orders or packing slips to your printer, as soon as the customer orders!', 'woocommerce-pdf-invoices-packing-slips' ); ?>
<div class="more" style="display:none;">
<table>
<tr>
<td><img src="<?php echo esc_url( WPO_WCPDF()->plugin_url() . '/assets/images/cloud-print.png' ); ?>" class="cloud-logo"></td>
<td>
<?php esc_html_e( 'Check out the WooCommerce Automatic Order Printing extension from our partners at Simba Hosting', 'woocommerce-pdf-invoices-packing-slips' ); ?><br/>
<a href="https://www.simbahosting.co.uk/s3/product/woocommerce-printnode-automatic-order-printing/?affiliates=2" target="_blank"><?php esc_html_e( "WooCommerce Automatic Order Printing", 'woocommerce-pdf-invoices-packing-slips' ); ?></a>
</td>
</tr>
</table>
</div>
</li>
<?php } ?>
<?php
if ( ! class_exists( 'WooCommerce_PDF_IPS_Templates' ) && ! class_exists( 'WPO_WCPDF_Templates' ) && ! $no_pro ) {
$template_link = '<a href="https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-premium-templates/" target="_blank">wpovernight.com</a>';
$email_link = '<a href="mailto:support@wpovernight.com">support@wpovernight.com</a>'
?>
<li>
<?php esc_html_e( 'Advanced, customizable templates', 'woocommerce-pdf-invoices-packing-slips' ); ?>
<div class="more" style="display:none;">
<ul>
<li><?php esc_html_e( 'Completely customize the invoice contents (prices, taxes, thumbnails) to your needs with a drag & drop customizer', 'woocommerce-pdf-invoices-packing-slips' ); ?></li>
<li><?php esc_html_e( 'Two extra stylish premade templates (Modern & Business)', 'woocommerce-pdf-invoices-packing-slips' ); ?></li>
<?php /* translators: Premium Templates link */?>
<li><?php printf( esc_html__( "Check out the Premium PDF Invoice & Packing Slips templates at %s.", 'woocommerce-pdf-invoices-packing-slips' ), $template_link ); ?></li>
<?php /* translators: email link */?>
<li><?php printf( esc_html__( "For custom templates, contact us at %s.", 'woocommerce-pdf-invoices-packing-slips' ), $email_link ); ?></li>
</ul>
</div>
</li>
<?php } ?>
</ul>
<?php
// link to hide message when one of the premium extensions is installed
if ( class_exists( 'WooCommerce_PDF_IPS_Pro' ) || class_exists( 'WPO_WCPDF_Templates' ) || class_exists( 'WooCommerce_PDF_IPS_Templates' ) || class_exists( 'WooCommerce_Ext_PrintOrders' ) || class_exists( 'WPO_WC_Smart_Reminder_Emails' ) ) {
printf('<a href="%s" style="display:inline-block; margin-top: 10px;">%s</a>', esc_url( wp_nonce_url( add_query_arg( 'wpo_wcpdf_hide_extensions_ad', 'true' ), 'hide_extensions_ad_nonce' ) ), esc_html__( 'Hide this message', 'woocommerce-pdf-invoices-packing-slips' ) );
}
?>
</div>

View File

@@ -0,0 +1,141 @@
<?php defined( 'ABSPATH' ) or exit; ?>
<?php
$review_url = 'https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/#new-post';
$review_link = sprintf( '<a href="%s">★★★★★</a>', $review_url );
$review_invitation = sprintf(
/* translators: ★★★★★ (5-star) */
__( 'If you like <strong>PDF Invoices & Packing Slips for WooCommerce</strong> please leave us a %s rating. A huge thank you in advance!', 'woocommerce-pdf-invoices-packing-slips' ),
$review_link
);
?>
<script type="text/javascript">
jQuery( function( $ ) {
$("#footer-thankyou").html('<?php echo wp_kses_post( $review_invitation ); ?>');
});
</script>
<div class="wrap">
<div class="icon32" id="icon-options-general"><br /></div>
<h2><?php esc_html_e( 'PDF Invoices & Packing Slips for WooCommerce', 'woocommerce-pdf-invoices-packing-slips' ); ?></h2>
<h2 class="nav-tab-wrapper">
<?php
foreach ( $settings_tabs as $tab_slug => $tab_data ) {
$tab_title = is_array( $tab_data ) ? esc_html( $tab_data['title'] ) : esc_html( $tab_data );
$tab_link = esc_url( "?page=wpo_wcpdf_options_page&tab={$tab_slug}" );
$tab_beta = isset( $tab_data['beta'] ) ? true : false;
if ( $tab_beta ) {
$tab_title .= ' <sup class="wcpdf_beta">beta</sup>';
}
printf( '<a href="%1$s" class="nav-tab nav-tab-%2$s %3$s">%4$s</a>', $tab_link, esc_attr( $tab_slug ), ( ( $active_tab == $tab_slug ) ? 'nav-tab-active' : '' ), $tab_title );
}
?>
</h2>
<?php
do_action( 'wpo_wcpdf_before_settings_page', $active_tab, $active_section );
// save or check option to hide extensions ad
if ( isset( $_REQUEST['wpo_wcpdf_hide_extensions_ad'] ) && isset( $_REQUEST['_wpnonce'] ) ) {
// validate nonce
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'hide_extensions_ad_nonce' ) ) {
wcpdf_log_error( 'You do not have sufficient permissions to perform this action: wpo_wcpdf_hide_extensions_ad' );
$hide_ad = false;
} else {
update_option( 'wpo_wcpdf_hide_extensions_ad', true );
$hide_ad = true;
}
} else {
$hide_ad = get_option( 'wpo_wcpdf_hide_extensions_ad' );
}
if ( ! $hide_ad && ! ( class_exists( 'WooCommerce_PDF_IPS_Pro' ) && class_exists( 'WooCommerce_PDF_IPS_Templates' ) && class_exists( 'WooCommerce_Ext_PrintOrders' ) ) ) {
include( 'extensions.php' );
}
$preview_states = isset( $settings_tabs[$active_tab]['preview_states'] ) ? $settings_tabs[$active_tab]['preview_states'] : 1;
$preview_states_lock = $preview_states == 3 ? false : true;
?>
<div id="wpo-wcpdf-preview-wrapper" data-preview-states="<?php echo esc_attr( $preview_states ); ?>" data-preview-state="closed" data-from-preview-state="" data-preview-states-lock="<?php echo esc_attr( $preview_states_lock ); ?>">
<div class="sidebar">
<form method="post" action="options.php" id="wpo-wcpdf-settings" class="<?php echo esc_attr( "{$active_tab} {$active_section}" ); ?>">
<?php
do_action( 'wpo_wcpdf_before_settings', $active_tab, $active_section );
if ( has_action( "wpo_wcpdf_settings_output_{$active_tab}" ) ) {
do_action( "wpo_wcpdf_settings_output_{$active_tab}", $active_section );
} else {
// legacy settings
settings_fields( "wpo_wcpdf_{$active_tab}_settings" );
do_settings_sections( "wpo_wcpdf_{$active_tab}_settings" );
submit_button();
}
do_action( 'wpo_wcpdf_after_settings', $active_tab, $active_section );
?>
</form>
<?php do_action( 'wpo_wcpdf_after_settings_page', $active_tab, $active_section ); ?>
</div>
<div class="gutter">
<div class="slider slide-left"><span class="gutter-arrow arrow-left"></span></div>
<div class="slider slide-right"><span class="gutter-arrow arrow-right"></span></div>
</div>
<div class="preview-document">
<?php
$documents = WPO_WCPDF()->documents->get_documents( 'enabled', 'any' );
$document_type = 'invoice';
if ( ! empty( $_REQUEST['section'] ) ) {
$document_type = sanitize_text_field( $_REQUEST['section'] );
} elseif ( ! empty( $_REQUEST['preview'] ) ) {
$document_type = sanitize_text_field( $_REQUEST['preview'] );
}
?>
<div class="preview-data-wrapper">
<div class="save-settings"><?php submit_button(); ?></div>
<div class="preview-data preview-order-data">
<div class="preview-order-search-wrapper">
<input type="text" name="preview-order-search" id="preview-order-search" placeholder="<?php esc_html_e( 'ID, email or name', 'woocommerce-pdf-invoices-packing-slips' ); ?>" data-nonce="<?= wp_create_nonce( 'wpo_wcpdf_preview' ); ?>">
<img class="preview-order-search-clear" src="<?php echo WPO_WCPDF()->plugin_url().'/assets/images/reset-input.svg'; ?>" alt="<?php esc_html_e( 'Clear search text', 'woocommerce-pdf-invoices-packing-slips' ); ?>">
</div>
<p class="last-order"><?php esc_html_e( 'Currently showing last order', 'woocommerce-pdf-invoices-packing-slips' ); ?><span class="arrow-down">&#9660;</span></p>
<p class="order-search"><span class="order-search-label"><?php esc_html_e( 'Search for an order', 'woocommerce-pdf-invoices-packing-slips' ); ?></span><span class="arrow-down">&#9660;</span></p>
<ul>
<li class="last-order"><?php esc_html_e( 'Show last order', 'woocommerce-pdf-invoices-packing-slips' ); ?></li>
<li class="order-search"><?php esc_html_e( 'Search for an order', 'woocommerce-pdf-invoices-packing-slips' ); ?></li>
</ul>
<div id="preview-order-search-results"><!-- Results populated with JS --></div>
</div>
<?php if ( $active_tab != 'documents' ) : ?>
<div class="preview-data preview-document-type">
<?php
if ( $document_type ) {
$document = WPO_WCPDF()->documents->get_document( $document_type, null );
if ( ! empty( $document ) ) {
echo '<p class="current"><span class="current-label">'.esc_html( $document->get_title() ).'</span><span class="arrow-down">&#9660;</span></p>';
}
} else {
echo '<p class="current"><span class="current-label">'.__( 'Invoice', 'woocommerce-pdf-invoices-packing-slips' ).'</span><span class="arrow-down">&#9660;</span></p>';
}
?>
<ul class="preview-data-option-list" data-input-name="document_type">
<?php
foreach ( $documents as $document ) {
/* translators: 1. document type, 2. document title */
printf( '<li data-value="%1$s">%2$s</li>', $document->get_type(), $document->get_title() );
}
?>
</ul>
</div>
<?php endif; ?>
</div>
<input type="hidden" name="document_type" data-default="<?php esc_attr_e( $document_type ); ?>" value="<?php esc_attr_e( $document_type ); ?>">
<input type="hidden" name="output_format" value="<?php echo ( isset( $_REQUEST['output_format'] ) && ! empty( $_REQUEST['output_format'] ) ) ? esc_attr( $_REQUEST['output_format'] ) : 'pdf'; ?>">
<input type="hidden" name="order_id" value="">
<input type="hidden" name="nonce" value="<?php echo wp_create_nonce( 'wpo_wcpdf_preview' ); ?>">
<div class="preview"></div>
</div>
</div>
</div>

View File

@@ -0,0 +1,37 @@
<?php defined( 'ABSPATH' ) or exit; ?>
<div class="wpo-step-description">
<h2><?php esc_html_e( 'Attach to...', 'woocommerce-pdf-invoices-packing-slips' ); ?></h2>
<p><?php esc_html_e( 'Select to which emails you would like to attach your invoice.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
</div>
<div class="wpo-setup-input">
<table>
<?php
$current_settings = get_option( 'wpo_wcpdf_documents_settings_invoice', array() );
// load invoice to reuse method to get wc emails
$invoice = wcpdf_get_invoice( null );
$wc_emails = $invoice->get_wc_emails();
foreach ( $wc_emails as $email_id => $name ) {
if ( ! empty( $current_settings['attach_to_email_ids'][$email_id] ) ) {
$checked = 'checked';
} else {
$checked = '';
}
printf(
'<tr>
<th>
<input type="hidden" value="" name="wcpdf_settings[wpo_wcpdf_documents_settings_invoice][attach_to_email_ids][%1$s]">
<input id="%1$s" type="checkbox" %3$s name="wcpdf_settings[wpo_wcpdf_documents_settings_invoice][attach_to_email_ids][%1$s]" value="1">
</th>
<td>
<label for="%1$s" class="checkbox">%2$s</label>
</td>
</tr>',
esc_attr( $email_id ),
esc_html( $name ),
esc_attr( $checked )
);
}
?>
</table>
</div>

View File

@@ -0,0 +1,93 @@
<?php defined( 'ABSPATH' ) or exit; ?>
<div class="wpo-step-description">
<h2><?php esc_html_e( 'Display options', 'woocommerce-pdf-invoices-packing-slips' ); ?></h2>
<p><?php esc_html_e( 'Select some additional display options for your invoice.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
</div>
<div class="wpo-setup-input">
<table>
<?php
$current_settings = get_option( 'wpo_wcpdf_documents_settings_invoice', array() );
?>
<tr>
<th>
<label for="display-shipping-address" class="checkbox"><?php esc_html_e( 'Shipping address', 'woocommerce-pdf-invoices-packing-slips' ); ?></label>
</th>
<td>
<input type="hidden" name="wcpdf_settings[wpo_wcpdf_documents_settings_invoice][display_shipping_address]" value="">
<select id="display-shipping-address" name="wcpdf_settings[wpo_wcpdf_documents_settings_invoice][display_shipping_address]">
<?php
$options = array(
'' => __( 'No' , 'woocommerce-pdf-invoices-packing-slips' ),
'when_different' => __( 'Only when different from billing address' , 'woocommerce-pdf-invoices-packing-slips' ),
'always' => __( 'Always' , 'woocommerce-pdf-invoices-packing-slips' ),
);
foreach ( $options as $slug => $name ) {
$selected = ( ! empty( $current_settings['display_shipping_address'] ) && $current_settings['display_shipping_address'] == $slug ) ? 'selected' : '';
echo '<option value="'.esc_attr( $slug ).'" '.esc_attr( $selected ).'>'.esc_html( $name ).'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<th>
<label for="display-email" class="checkbox"><?php esc_html_e( 'Email address', 'woocommerce-pdf-invoices-packing-slips' ); ?></label>
</th>
<td>
<input type="hidden" name="wcpdf_settings[wpo_wcpdf_documents_settings_invoice][display_email]" value="">
<input id="display-email" type="checkbox" <?php echo ! empty( $current_settings['display_email'] ) ? 'checked' : ''; ?> name="wcpdf_settings[wpo_wcpdf_documents_settings_invoice][display_email]" value="1">
</td>
</tr>
<tr>
<th>
<label for="display-phone" class="checkbox"><?php esc_html_e( 'Phone number', 'woocommerce-pdf-invoices-packing-slips' ); ?></label>
</th>
<td>
<input type="hidden" name="wcpdf_settings[wpo_wcpdf_documents_settings_invoice][display_phone]" value="">
<input id="display-phone" type="checkbox" <?php echo ! empty( $current_settings['display_phone'] ) ? 'checked' : ''; ?> name="wcpdf_settings[wpo_wcpdf_documents_settings_invoice][display_phone]" value="1">
</td>
</tr>
<tr>
<th>
<label for="display-date" class="checkbox"><?php esc_html_e( 'Invoice date', 'woocommerce-pdf-invoices-packing-slips' ); ?></label>
</th>
<td>
<input type="hidden" name="wcpdf_settings[wpo_wcpdf_documents_settings_invoice][display_date]" value="">
<select id="display-date" name="wcpdf_settings[wpo_wcpdf_documents_settings_invoice][display_date]">
<?php
$options = array(
'' => __( 'No' , 'woocommerce-pdf-invoices-packing-slips' ),
'invoice_date' => __( 'Invoice Date' , 'woocommerce-pdf-invoices-packing-slips' ),
'order_date' => __( 'Order Date' , 'woocommerce-pdf-invoices-packing-slips' ),
);
foreach ( $options as $slug => $name ) {
$selected = ( ! empty( $current_settings['display_date'] ) && $current_settings['display_date'] == $slug ) ? 'selected' : '';
echo '<option value="'.esc_attr( $slug ).'" '.esc_attr( $selected ).'>'.esc_html( $name ).'</option>';
}
?>
</select>
</td>
<tr>
</tr>
<th>
<label for="display-number" class="checkbox"><?php esc_html_e( 'Invoice number', 'woocommerce-pdf-invoices-packing-slips' ); ?></label>
</th>
<td>
<input type="hidden" name="wcpdf_settings[wpo_wcpdf_documents_settings_invoice][display_number]" value="">
<select id="display-number" name="wcpdf_settings[wpo_wcpdf_documents_settings_invoice][display_number]">
<?php
$options = array(
'' => __( 'No' , 'woocommerce-pdf-invoices-packing-slips' ),
'invoice_number' => __( 'Invoice Number' , 'woocommerce-pdf-invoices-packing-slips' ),
'order_number' => __( 'Order Number' , 'woocommerce-pdf-invoices-packing-slips' ),
);
foreach ( $options as $slug => $name ) {
$selected = ( ! empty( $current_settings['display_number'] ) && $current_settings['display_number'] == $slug ) ? 'selected' : '';
echo '<option value="'.esc_attr( $slug ).'" '.esc_attr( $selected ).'>'.esc_html( $name ).'</option>';
}
?>
</select>
</td>
</tr>
</table>
</div>

View File

@@ -0,0 +1,7 @@
<?php defined( 'ABSPATH' ) or exit; ?>
<div class="wpo-step-description wpo-final">
<h1><?php esc_html_e( 'You are good to go!' , 'woocommerce-pdf-invoices-packing-slips' ); ?></h1>
<p><?php esc_html_e( 'If you have any questions please have a look at our documentation:', 'woocommerce-pdf-invoices-packing-slips' ); ?><br>
<a href="https://docs.wpovernight.com/topic/woocommerce-pdf-invoices-packing-slips/" target="_blank"><?php esc_html_e( 'Invoices & Packing Slips' , 'woocommerce-pdf-invoices-packing-slips' ); ?></a></p>
<h2><?php esc_html_e( 'Happy selling!' , 'woocommerce-pdf-invoices-packing-slips' ); ?></h2>
</div>

View File

@@ -0,0 +1,18 @@
<?php defined( 'ABSPATH' ) or exit; ?>
<div class="wpo-step-description">
<h2><?php esc_html_e( 'Your logo' , 'woocommerce-pdf-invoices-packing-slips' ); ?></h2>
<p><?php esc_html_e( 'Set the header image that will display on your invoice.' , 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
</div>
<div class="wpo-setup-input">
<script><?php echo "var wpo_wcpdf_admin = " . wp_json_encode( array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ) . ';'; ?></script>
<?php
WPO_WCPDF()->settings->callbacks->media_upload( array(
'option_name' => 'wpo_wcpdf_settings_general',
'setting_name' => 'wcpdf_settings[wpo_wcpdf_settings_general][header_logo]',
'id' => 'header_logo',
'uploader_title' => __( 'Select or upload your invoice header/logo', 'woocommerce-pdf-invoices-packing-slips' ),
'uploader_button_text' => __( 'Set image', 'woocommerce-pdf-invoices-packing-slips' ),
'remove_button_text' => __( 'Remove image', 'woocommerce-pdf-invoices-packing-slips' ),
) );
?>
</div>

View File

@@ -0,0 +1,16 @@
<?php defined( 'ABSPATH' ) or exit; ?>
<div class="wpo-step-description">
<h2><?php esc_html_e( 'Paper format', 'woocommerce-pdf-invoices-packing-slips' ); ?></h2>
<p><?php esc_html_e( 'Select the paper format for your invoice.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
</div>
<div class="wpo-setup-input">
<?php
$current_settings = wp_parse_args( get_option( 'wpo_wcpdf_settings_general', array() ), array(
'paper_size' => 'a4',
) );
?>
<select name="wcpdf_settings[wpo_wcpdf_settings_general][paper_size]">
<option <?php echo $current_settings['paper_size'] == 'a4' ? 'selected' : ''; ?> value="a4"><?php esc_html_e( 'A4', 'woocommerce-pdf-invoices-packing-slips' ); ?></option>
<option <?php echo $current_settings['paper_size'] == 'letter' ? 'selected' : ''; ?> value="letter"><?php esc_html_e( 'Letter', 'woocommerce-pdf-invoices-packing-slips' ); ?></option>
</select>
</div>

View File

@@ -0,0 +1,15 @@
<?php defined( 'ABSPATH' ) or exit; ?>
<div class="wpo-step-description">
<h2><?php esc_html_e( 'Enter your shop name', 'woocommerce-pdf-invoices-packing-slips' ); ?></h2>
<p><?php esc_html_e( 'Lets quickly setup your invoice. Please enter the name and address of your shop in the fields on the right.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
</div>
<div class="wpo-setup-input">
<?php
$current_settings = wp_parse_args( get_option( 'wpo_wcpdf_settings_general', array() ), array(
'shop_name' => array( 'default' => get_bloginfo( 'name' ) ),
'shop_address' => array( 'default' => '' ),
) );
?>
<input type="text" class="shop-name" placeholder="<?php esc_attr_e( 'Shop name', 'woocommerce-pdf-invoices-packing-slips' ); ?>" name="wcpdf_settings[wpo_wcpdf_settings_general][shop_name][default]" value="<?php echo esc_attr( array_pop( $current_settings['shop_name'] ) ); ?>">
<textarea class="shop-address" placeholder="<?php esc_attr_e( 'Shop address', 'woocommerce-pdf-invoices-packing-slips' ); ?>" name="wcpdf_settings[wpo_wcpdf_settings_general][shop_address][default]"><?php echo esc_html( array_pop( $current_settings['shop_address'] ) ); ?></textarea>
</div>

View File

@@ -0,0 +1,19 @@
<?php defined( 'ABSPATH' ) or exit; ?>
<div class="wpo-step-description">
<h2><?php esc_html_e( 'Action buttons', 'woocommerce-pdf-invoices-packing-slips' ); ?></h2>
<p><?php esc_html_e( 'Would you like to display the action buttons in your WooCommerce order list? The action buttons allow you to manually create a PDF.', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
<p><small><?php esc_html_e( '(You can always change this setting later via the Screen Options menu)', 'woocommerce-pdf-invoices-packing-slips' ); ?></small></p>
</div>
<div class="wpo-setup-input">
<?php
$actions = true;
$user_id = get_current_user_id();
$hidden = get_user_meta( $user_id, 'manageedit-shop_ordercolumnshidden', true );
if ( empty( $hidden ) )
$hidden = array( 'shipping_address', 'billing_address', 'wc_actions' );
update_user_option( $user_id, 'manageedit-shop_ordercolumnshidden', $hidden, true );
if ( in_array( 'wc_actions', $hidden ) )
$actions = false
?>
<input id="show-action-buttons" type="checkbox" <?php echo $actions !== false ? 'checked' : ''; ?> name="wc_show_action_buttons" value="1"><label for="show-action-buttons" class="checkbox"><?php esc_html_e( 'Show action buttons', 'woocommerce-pdf-invoices-packing-slips' ); ?></label>
</div>

View File

@@ -0,0 +1,97 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<style>
#wpo-wcpdf-settings { display: none; }
</style>
<div class="upgrade-table-description">
<h1><?php esc_html_e( 'Wait, there is more...', 'woocommerce-pdf-invoices-packing-slips' ); ?></h1>
<p>
<span><?php esc_html_e( 'A quick overview of the features our PDF Invoices & Packing Slips extensions have to offer.', 'woocommerce-pdf-invoices-packing-slips' ); ?><span>
<span><?php printf( '%s: %s', esc_html_e( 'If you have any questions feel free to send us an email at', 'woocommerce-pdf-invoices-packing-slips' ), '<a href="mailto:support@wpovernight.com">support@wpovernight.com</a>' ); ?><span>
</p>
</div>
<table id="upgrade-table">
<tr>
<th class="first" align="left">&nbsp;</th>
<th align="left"><?php esc_html_e( 'Professional', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
<th align="left"><?php esc_html_e( 'Premium Templates', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
<th align="left"><?php esc_html_e( 'Bundle', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
<th align="left" class="last">&nbsp;</td>
</tr>
<?php
foreach ( $features as $feature ) {
echo '<tr><td class="first feature-label">' . $feature['label'];
echo ! empty( $feature['description'] ) ? '<br><span class="description">' . $feature['description'] . '</span></td>' : '</td>';
foreach ( ['pro', 'templates', 'bundle'] as $extension ) {
echo in_array( $extension, $feature['extensions'] ) ? '<td><span class="feature-available"></span></td>' : '<td>-</td>';
}
echo '<td align="left" class="last">&nbsp;</td></tr>';
}
?>
<tr class="upgrade-links">
<td class="first" align="left">&nbsp;</td>
<?php
$extensions_disabled = [];
$extensions_enabled = [];
$extension_columns = [];
// pro, templates & bundle columns
foreach ( $extension_license_infos as $extension => $info ) {
// enabled
if ( WPO_WCPDF()->settings->upgrade->extension_is_enabled( $extension ) ) {
$extensions_enabled[] = $extension;
$title = __( 'Currently installed', 'woocommerce-pdf-invoices-packing-slips' );
if ( empty( $info['status'] ) || $info['status'] != 'valid' ) {
$subtitle = sprintf(
/* translators: learn more link */
__( 'License not yet activated: %s', 'woocommerce-pdf-invoices-packing-slips' ),
'<a href="https://docs.wpovernight.com/general/installing-wp-overnight-plugins/#activating-your-license" target="_blank">'.__( 'Learn more', 'woocommerce-pdf-invoices-packing-slips' ).'</a>'
);
} else {
$subtitle = '';
}
$extension_columns[$extension] = sprintf(
'<td align="left"><h4>%s</h4><p>%s</p></td>',
$title,
$subtitle
);
// disabled (includes bundle)
} else {
$extensions_disabled[] = $extension;
if ( $info['url'] == 'is_bundled' ) { // extension license is bundled, no need to buy
$extension_columns[$extension] = '<td align="left">&nbsp;</td>';
} else {
$extension_columns[$extension] = sprintf(
'<td align="left"><a class="upgrade_button" href="%s" target="_blank">%s</a></td>',
esc_url_raw( $info['url'] ),
__( 'Upgrade now', 'woocommerce-pdf-invoices-packing-slips' )
);
}
}
}
// maybe disable 1 extension or bundle column
foreach ( $extensions_disabled as $extension_disabled ) {
if ( ( count( $extensions_disabled ) < 3 && $extension_disabled != 'bundle' ) || ( count( $extensions_disabled ) == 1 && $extension_disabled == 'bundle' ) ) {
$extension_columns[$extension_disabled] = '<td align="left">&nbsp;</td>';
}
}
foreach ( $extension_columns as $column ) {
echo $column;
}
?>
<td align="left" class="last">&nbsp;</td>
</tr>
</table>