PluginProbe
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin / trunk
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin vtrunk
trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 All 71 releases
pdf-print / includes / class-pdfprnt-settings.php

class-pdfprnt-settings.php in PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin trunk, at includes/class-pdfprnt-settings.php

981 lines 41.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 if ( ! class_exists( 'Pdfprnt_Settings_Tabs' ) ) {
8 /**
9 * Displays the content on the plugin settings page
10 */
11 class Pdfprnt_Settings_Tabs extends Bws_Settings_Tabs {
12 /**
13 * Button types array
14 *
15 * @var array
16 */
17 public $post_types;
18 /**
19 * Button positions array
20 *
21 * @var array
22 */
23 public $button_positions;
24 /**
25 * Button image
26 *
27 * @var string
28 */
29 public $button_image;
30 /**
31 * Margin positions array
32 *
33 * @var array
34 */
35 public $margin_positions;
36 /**
37 * Default css types array
38 *
39 * @var array
40 */
41 public $default_css_types;
42 /**
43 * Path to upload dir
44 *
45 * @var string
46 */
47 public $upload_dir;
48 /**
49 * Page sizes array
50 *
51 * @var array
52 */
53 public $page_sizes;
54 /**
55 * Roles array
56 *
57 * @var array
58 */
59 public $editable_roles;
60 /**
61 * Flag for font reload
62 *
63 * @var bool
64 */
65 public $need_fonts_reload = false;
66 /**
67 * Sizes array
68 *
69 * @var array
70 */
71 private $wp_sizes;
72 /**
73 * Buttons array
74 *
75 * @var array
76 */
77 private $buttons;
78
79 /**
80 * Constructor.
81 *
82 * @access public
83 *
84 * @see Bws_Settings_Tabs::__construct() for more information on default arguments.
85 *
86 * @param string $plugin_basename Plugin basename.
87 */
88 public function __construct( $plugin_basename ) {
89 global $pdfprnt_options, $pdfprnt_plugin_info, $wp_roles;
90
91 $tabs = array(
92 'settings' => array( 'label' => __( 'Settings', 'pdf-print' ) ),
93 'output' => array( 'label' => __( 'Output', 'pdf-print' ) ),
94 'display' => array(
95 'label' => __( 'Display', 'pdf-print' ),
96 'is_pro' => 1,
97 ),
98 'misc' => array( 'label' => __( 'Misc', 'pdf-print' ) ),
99 'custom_fields' => array(
100 'label' => __( 'Custom Fields', 'pdf-print' ),
101 'is_pro' => 1,
102 ),
103 'custom_code' => array( 'label' => __( 'Custom Code', 'pdf-print' ) ),
104 'license' => array( 'label' => __( 'License Key', 'pdf-print' ) ),
105 );
106
107 parent::__construct(
108 array(
109 'plugin_basename' => $plugin_basename,
110 'plugins_info' => $pdfprnt_plugin_info,
111 'prefix' => 'pdfprnt',
112 'default_options' => pdfprnt_get_options_default(),
113 'options' => $pdfprnt_options,
114 'is_network_options' => is_network_admin(),
115 'tabs' => $tabs,
116 'wp_slug' => 'pdf-print',
117 'link_key' => 'd9da7c9c2046bed8dfa38d005d4bffdb',
118 'link_pn' => '101',
119 'doc_link' => 'https://bestwebsoft.com/documentation/pdf-print/pdf-print-user-guide/',
120 'doc_video_link' => 'https://www.youtube.com/watch?v=Pec-6dDiou0',
121 )
122 );
123
124 add_action( get_parent_class( $this ) . '_display_custom_messages', array( $this, 'display_custom_messages' ) );
125 add_action( get_parent_class( $this ) . '_display_metabox', array( $this, 'display_metabox' ) );
126 add_action( get_parent_class( $this ) . '_additional_misc_options', array( $this, 'upgrade_mpdf' ) );
127
128 $this->buttons = array(
129 'pdf' => __( 'PDF', 'pdf-print' ),
130 'print' => __( 'Print', 'pdf-print' ),
131 );
132
133 /* Get post types */
134 $this->post_types = get_post_types(
135 array(
136 'public' => 1,
137 'show_ui' => 1,
138 ),
139 'objects'
140 );
141 unset( $this->post_types['attachment'] );
142 $standard_post_types = array(
143 'pdfprnt_search' => __( 'Search results', 'pdf-print' ),
144 'pdfprnt_archives' => __( 'Archives', 'pdf-print' ),
145 'pdfprnt_blog' => __( 'Posts page', 'pdf-print' ),
146 );
147 foreach ( $standard_post_types as $key => $value ) {
148 $add_post_type = new stdClass();
149 $this->post_types[ $key ] = (object) array( 'label' => $value );
150 }
151
152 $this->button_positions = array(
153 'top-left' => __( 'Top Left', 'pdf-print' ),
154 'top-right' => __( 'Top Right', 'pdf-print' ),
155 'bottom-left' => __( 'Bottom Left', 'pdf-print' ),
156 'bottom-right' => __( 'Bottom Right', 'pdf-print' ),
157 'top-bottom-left' => __( 'Top & Bottom Left', 'pdf-print' ),
158 'top-bottom-right' => __( 'Top & Bottom Right', 'pdf-print' ),
159 );
160
161 $this->button_image = array(
162 'none' => __( 'None', 'pdf-print' ),
163 'default' => __( 'Default', 'pdf-print' ),
164 );
165
166 $this->margin_positions = array(
167 'top' => __( 'Top', 'pdf-print' ),
168 'bottom' => __( 'Bottom', 'pdf-print' ),
169 'left' => __( 'Left', 'pdf-print' ),
170 'right' => __( 'Right', 'pdf-print' ),
171 );
172
173 $this->page_sizes = pdfprnt_get_pdf_page_sizes();
174
175 $this->editable_roles = $wp_roles->roles;
176
177 if ( $this->is_multisite ) {
178 switch_to_blog( 1 );
179 $this->upload_dir = wp_upload_dir();
180 restore_current_blog();
181 } else {
182 $this->upload_dir = wp_upload_dir();
183 }
184
185 $this->wp_sizes = get_intermediate_image_sizes();
186
187 $this->options['file_action'] = 'send_mail' === $this->options['file_action'] ? 'download' : $this->options['file_action'];
188
189 if ( ! isset( $this->options['print_action'] ) ) {
190 $this->options['print_action'] = 'plugin_function';
191 }
192 }
193
194 /**
195 * Display custom error\message\notice
196 *
197 * @access public
198 * @param array $save_results - array with error\message\notice.
199 * @return void
200 */
201 public function display_custom_messages( $save_results ) {
202 global $pdfprnt_is_old_php;
203 $message = '';
204 $error = '';
205 $warning = ''; ?>
206 <noscript><div class="error below-h2"><p><strong><?php esc_html_e( 'Please enable JavaScript in your browser.', 'pdf-print' ); ?></strong></p></div></noscript>
207 <?php if ( $pdfprnt_is_old_php ) { ?>
208 <div class="error below-h2"><p><strong><?php printf( esc_html__( 'Pdf&Print plugin requires PHP %s or higher. Please contact your hosting provider to upgrade PHP version.', 'pdf-print' ), '5.4.0' ); ?></strong></p></div>
209 <?php
210 }
211
212 /* Check fonts folder rights */
213 if ( is_multisite() ) {
214 switch_to_blog( 1 );
215 $upload_dir = wp_upload_dir();
216 restore_current_blog();
217 } else {
218 $upload_dir = wp_upload_dir();
219 }
220 $plugin_dir = realpath( dirname( __FILE__ ) . '/..' );
221 $ttfontdata = $upload_dir['basedir'] . '/vendor/mpdf/mpdf/tmp';
222 $is_installed = file_exists( $ttfontdata );
223 if ( ! $is_installed ) {
224 $ttfontdata = $plugin_dir . '/mpdf/ttfontdata';
225 }
226 if ( ! is_writable( $ttfontdata ) ) {
227 if ( ! @chmod( $ttfontdata, 0755 ) ) {
228 ?>
229 <div class="error below-h2">
230 <p>
231 <strong>
232 <?php esc_html_e( 'Warning: Not enough permissions for the folder', 'pdf-print' ); ?>&nbsp;<i><?php echo esc_html( $ttfontdata ); ?></i>.<br />
233 <?php
234 printf(
235 esc_html__( 'Please check and change permissions for your plugins folder (for folders - 755, for files - 644). For more info, please see %1$s and %2$s.', 'pdf-print' ),
236 '<a href="https://codex.wordpress.org/Changing_File_Permissions" target="_blank">' . esc_html__( 'Changing File Permissions', 'pdf-print' ) . '</a>',
237 '<a href="https://support.bestwebsoft.com/hc/en-us/articles/115000108003" target="_blank">' . esc_html__( 'FAQ', 'pdf-print' ) . '</a>'
238 );
239 ?>
240 </strong>
241 </p>
242 </div>
243 <?php
244 }
245 }
246
247 $fonts_path = $this->upload_dir['basedir'] . '/pdf-print-fonts';
248 if ( file_exists( $fonts_path ) ) {
249 $files = scandir( $fonts_path );
250 }
251
252 if ( ! is_dir( $fonts_path ) && 0 !== intval( $this->options['additional_fonts'] ) ) { /* if "pdf-print-fonts" folder was removed somehow */
253 $error = sprintf( __( 'The folder %s was removed.', 'pdf-print' ), '"uploads/pdf-print-fonts"' );
254 $this->need_fonts_reload = true;
255 } elseif (
256 is_dir( $fonts_path ) &&
257 intval( $this->options['additional_fonts'] ) !== count( $files ) &&
258 0 < $this->options['additional_fonts'] &&
259 ! $is_installed
260 ) { /* if some fonts was removed somehow from "pdf-print-fonts" folder */
261 $error = sprintf( __( 'Some fonts were removed from %s folder.', 'pdf-print' ), '"uploads/pdf-print-fonts"' );
262 $this->need_fonts_reload = true;
263 }
264
265 if ( $this->need_fonts_reload ) {
266 $error .= '&nbsp;' . sprintf(
267 __( 'It is necessary to reload fonts. For more info, please see %s.', 'pdf-print' ),
268 '<a href="https://support.bestwebsoft.com/hc/en-us/articles/206693223" target="_blank">' . __( 'FAQ', 'pdf-print' ) . '</a>'
269 );
270 pdfprnt_update_option( -1, true );
271 }
272
273 if ( isset( $_POST['pdfprnt_load_fonts'] ) ) {
274 /* load additional fonts if javascript is disabled */
275 $result = pdfprnt_load_fonts();
276 if ( isset( $result['error'] ) ) {
277 $error .= '&nbsp;' . $result['error'] . '.&nbsp;' .
278 sprintf(
279 __( 'It is necessary to reload fonts. For more info, please see %s', 'pdf-print' ),
280 '<a href="https://support.bestwebsoft.com/hc/en-us/articles/206693223" target="_blank">' . __( 'FAQ', 'pdf-print' ) . '</a>'
281 );
282 $this->need_fonts_reload = true;
283 }
284 if ( isset( $result['done'] ) ) {
285 $message .= '&nbsp;' . $result['done'];
286 }
287 }
288 if ( isset( $_POST['pdfprnt_upgrade_library'] ) && isset( $_POST['pdfprnt_ajax_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['pdfprnt_ajax_nonce'] ) ), 'pdfprnt_ajax_nonce' ) ) {
289 /* upgrade mPDF library if javascript is disabled */
290 $result = pdfprnt_upgrade_library();
291 if ( isset( $result['error'] ) ) {
292 $error .= '&nbsp;' . $result['error'];
293 }
294 if ( isset( $result['done'] ) ) {
295 $message .= '&nbsp;' . $result['done'];
296 }
297 }
298 $new_library_path = $upload_dir['basedir'] . '/vendor/';
299 if ( ! file_exists( $new_library_path ) ) {
300 $warning .= __( 'The new version of the mPDF library which compatible with PHP V8.2.x is available now! Go to the Misc tab and upgrade the mPDF library if you run into errors or want to use the latest version.', 'pdf-print' );
301 }
302 ?>
303 <div class="updated below-h2"
304 <?php
305 if ( empty( $message ) || '' !== $error ) {
306 echo 'style="display:none"';}
307 ?>
308 ><p><strong><?php echo esc_html( $message ); ?></strong></p></div>
309 <?php if ( ! empty( $warning ) ) { ?>
310 <div class="notice notice-warning below-h2"><p><strong><?php echo esc_html( $warning ); ?></strong></p></div>
311 <?php } ?>
312 <div class="error below-h2"
313 <?php
314 if ( '' === $error ) {
315 echo 'style="display:none"';}
316 ?>
317 ><p><strong><?php echo esc_html( $error ); ?></strong></p></div>
318 <?php
319 }
320
321 /**
322 * Save plugin options to the database
323 *
324 * @access public
325 * @return array The action results
326 */
327 public function save_options() {
328
329 $message = '';
330 $notice = '';
331 $error = '';
332
333 if ( isset( $_POST['pdfprnt_load_fonts'] ) || isset( $_POST['pdfprnt_upgrade_library'] ) ) {
334 return;
335 }
336
337 if ( ! isset( $_POST['pdfprnt_nonce_field'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['pdfprnt_nonce_field'] ) ), 'pdfprnt_action' ) ) {
338 print esc_html__( 'Sorry, your nonce did not verify.', 'pdf-print' );
339 exit;
340 } else {
341
342 foreach ( $this->buttons as $button => $button_name ) {
343 /* Add Button to */
344 $this->options['button_post_types'][ $button ] = array();
345 if ( isset( $_POST['pdfprnt_button_post_types'][ $button ] ) && is_array( $_POST['pdfprnt_button_post_types'][ $button ] ) ) {
346 foreach ( $_POST['pdfprnt_button_post_types'][ $button ] as $post_type ) {
347 $post_type = sanitize_text_field( wp_unslash( $post_type ) );
348 if ( array_key_exists( $post_type, $this->post_types ) ) {
349 $this->options['button_post_types'][ $button ][] = $post_type;
350 }
351 }
352 }
353
354 /* Button Image */
355 $this->options['button_image'][ $button ]['image_src'] = plugins_url( "images/{$button}.png", dirname( __FILE__ ) );
356
357 if ( isset( $_POST['pdfprnt_button_image'][ $button ] ) ) {
358 $new_button_image = sanitize_text_field( wp_unslash( $_POST['pdfprnt_button_image'][ $button ] ) );
359 $this->options['button_image'][ $button ]['type'] = array_key_exists( $new_button_image, $this->button_image ) ? $new_button_image : $this->options['button_image'][ $button ]['type'];
360 }
361
362 /* Button Title */
363 $this->options['button_title'][ $button ] = isset( $_POST['pdfprnt_button_title'][ $button ] ) ? sanitize_text_field( wp_unslash( $_POST['pdfprnt_button_title'][ $button ] ) ) : $this->options['button_title'][ $button ];
364 }
365
366 /* Buttons Position */
367 $this->options['buttons_position'] = isset( $_POST['pdfprnt_buttons_position'] ) && array_key_exists( sanitize_text_field( wp_unslash( $_POST['pdfprnt_buttons_position'] ) ), $this->button_positions ) ? sanitize_text_field( wp_unslash( $_POST['pdfprnt_buttons_position'] ) ) : $this->options['buttons_position'];
368
369 /* Print Preview Window */
370 $this->options['show_print_window'] = ( isset( $_POST['pdfprnt_show_print_window'] ) ) ? 1 : 0;
371
372 /* Creating pdf with image of screen */
373 $this->options['image_to_pdf'] = ( isset( $_POST['pdfprnt_image_to_pdf'] ) ) ? 1 : 0;
374
375 /* Shortcode Settings */
376 $this->options['do_shorcodes'] = isset( $_POST['pdfprnt_do_shorcodes'] ) ? 1 : 0;
377
378 $this->options['disable_links'] = isset( $_POST['pdfprnt_disable_links'] ) ? 1 : 0;
379 $this->options['remove_links'] = isset( $_POST['pdfprnt_remove_links'] ) ? 1 : 0;
380
381 $this->options['replace_video'] = isset( $_POST['pdfprnt_replace_video'] ) ? 1 : 0;
382 $this->options['qr_code_link'] = isset( $_POST['pdfprnt_qr_code_link'] ) ? 1 : 0;
383 $this->options['count_generation'] = isset( $_POST['pdfprnt_count_generation'] ) ? 1 : 0;
384
385 /* PDF Page Size */
386 $this->options['pdf_page_size'] = ( isset( $_POST['pdfprnt_pdf_page_size'] ) && in_array( sanitize_text_field( wp_unslash( $_POST['pdfprnt_pdf_page_size'] ) ), $this->page_sizes, true ) ) ? sanitize_text_field( wp_unslash( $_POST['pdfprnt_pdf_page_size'] ) ) : $this->options['pdf_page_size'];
387
388 /* Margins */
389 if ( isset( $_POST['pdfprnt_pdf_margins'] ) && is_array( $_POST['pdfprnt_pdf_margins'] ) ) {
390
391 foreach ( $this->margin_positions as $key => $value ) {
392 if ( isset( $_POST['pdfprnt_pdf_margins'][ $key ] ) ) {
393 $this->options['pdf_margins'][ $key ] = intval( $_POST['pdfprnt_pdf_margins'][ $key ] );
394 }
395 }
396 }
397
398 /* Additional Elements */
399 $this->options['show_title'] = isset( $_POST['pdfprnt_show_title'] ) ? 1 : 0;
400 $this->options['show_author'] = isset( $_POST['pdfprnt_show_author'] ) ? 1 : 0;
401 $this->options['show_date'] = isset( $_POST['pdfprnt_show_date'] ) ? 1 : 0;
402 $this->options['show_featured_image'] = isset( $_POST['pdfprnt_show_featured_image'] ) ? 1 : 0;
403 $this->options['show_category'] = isset( $_POST['pdfprnt_show_category'] ) ? 1 : 0;
404
405 /* Hide Classes */
406 $this->options['hide_classes'] = isset( $_POST['pdfprnt_class_hide'] ) ? array_map( 'sanitize_text_field', array_map( 'wp_unslash', $_POST['pdfprnt_class_hide'] ) ) : array();
407 $this->options['hide_classes'] = array_slice( $this->options['hide_classes'], 0, 3 );
408 foreach( $this->options['hide_classes'] as $key => $value ) {
409 $check_array = explode( ',', $value );
410 $this->options['hide_classes'][ $key ] = trim( $check_array[0] );
411 }
412
413 /* Featured Image Size */
414 $this->options['featured_image_size'] = isset( $_POST['pdfprnt_featured_image_size'] ) && in_array( sanitize_text_field( wp_unslash( $_POST['pdfprnt_featured_image_size'] ) ), $this->wp_sizes, true ) ? sanitize_text_field( wp_unslash( $_POST['pdfprnt_featured_image_size'] ) ) : $this->options['featured_image_size'];
415
416 $this->options['use_default_css'] = ( isset( $_POST['pdfprnt_use_default_css'] ) ) ? 1 : 0;
417 $this->options['use_custom_css'] = ( isset( $_POST['pdfprnt_use_custom_css'] ) ) ? 1 : 0;
418
419 if ( isset( $_POST['pdfprnt_custom_css_code'] ) ) {
420 $custom_css_code = wp_kses_post( wp_strip_all_tags( wp_unslash( $_POST['pdfprnt_custom_css_code'] ) ) );
421 if ( 10000 < strlen( $custom_css_code ) ) {
422 $error = __( 'You have entered too much text in the "edit styles" field.', 'pdf-print' );
423 } else {
424 $this->options['custom_css_code'] = $custom_css_code;
425 }
426 }
427
428 /* Buttons open */
429 $this->options['file_action'] = isset( $_POST['pdfprnt_file_action'] ) && in_array( sanitize_text_field( wp_unslash( $_POST['pdfprnt_file_action'] ) ), array( 'download', 'open' ), true ) ? sanitize_text_field( wp_unslash( $_POST['pdfprnt_file_action'] ) ) : $this->options['file_action'];
430
431 /* Buttons open */
432 $this->options['print_action'] = isset( $_POST['pdfprnt_print_action'] ) && in_array( $_POST['pdfprnt_print_action'], array( 'plugin_function', 'ctrl_p' ) ) ? $_POST['pdfprnt_print_action'] : $this->options['print_action'];
433
434 /* All select */
435 $this->options['enabled_roles'] = array();
436 foreach ( $this->editable_roles as $role => $fields ) {
437 $this->options['enabled_roles'][ $role ] = isset( $_POST[ 'pdfprnt_' . $role ] ) ? 1 : 0;
438 }
439 $this->options['enabled_roles']['unauthorized'] = isset( $_POST['pdfprnt_unauthorized'] ) ? 1 : 0;
440
441 $this->options = apply_filters( 'pdfprnt_before_save_options', $this->options );
442 update_option( 'pdfprnt_options', $this->options );
443 $message .= __( 'Settings saved.', 'pdf-print' );
444 }
445
446 return compact( 'message', 'notice', 'error' );
447 }
448 /**
449 * Display PDF & Print Settings tab
450 */
451 public function tab_settings() {
452 ?>
453 <h3 class="bws_tab_label"><?php esc_html_e( 'PDF & Print Settings', 'pdf-print' ); ?></h3>
454 <?php $this->help_phrase(); ?>
455 <hr>
456 <table class="form-table pdfprnt-table-settings">
457 <tr>
458 <th scope="row"><?php esc_html_e( 'Add Button to', 'pdf-print' ); ?></th>
459 <td>
460 <?php foreach ( $this->buttons as $button => $button_name ) { ?>
461 <div class="pdfprnt-col pdfprnt-col-2">
462 <p><strong><?php echo esc_html( $button_name ); ?></strong></p>
463 <br>
464 <fieldset>
465 <?php foreach ( $this->post_types as $key => $value ) { ?>
466 <label>
467 <input type="checkbox" name="pdfprnt_button_post_types[<?php echo esc_attr( $button ); ?>][]" value="<?php echo esc_attr( $key ); ?>" <?php checked( in_array( $key, $this->options['button_post_types'][ $button ], true ) ); ?> /> <?php echo esc_html( $value->label ); ?>
468 </label><br>
469 <?php } ?>
470 </fieldset>
471 </div>
472 <?php } ?>
473 <div class="clear"></div>
474 <div class="bws_info"><?php esc_html_e( 'Follow the instruction in order to add the PDF & Print button to a custom post or page template.', 'pdf-print' ); ?> <a href="https://support.bestwebsoft.com/hc/en-us/articles/205454643" target="_blank"><?php esc_html_e( 'Learn More', 'pdf-print' ); ?></a></div>
475 </td>
476 </tr>
477 <tr>
478 <th><?php esc_html_e( 'Buttons Position', 'pdf-print' ); ?></th>
479 <td>
480 <fieldset>
481 <?php foreach ( $this->button_positions as $key => $value ) { ?>
482 <label><input type="radio" name="pdfprnt_buttons_position" value="<?php echo esc_attr( $key ); ?>"<?php checked( $key, $this->options['buttons_position'] ); ?> />&nbsp;<?php echo esc_html( $value ); ?></label>
483 <?php
484 if ( 'top-bottom-right' !== $key ) {
485 echo '<br>';}
486 ?>
487 <?php } ?>
488 </fieldset>
489 <div class="bws_info"><?php esc_html_e( 'Select buttons position in the content (default is Top Right).', 'pdf-print' ); ?></div>
490 </td>
491 </tr>
492 <tr>
493 <th><?php esc_html_e( 'Button Image', 'pdf-print' ); ?></th>
494 <td class="pdfprnt-td-button-image">
495 <?php foreach ( $this->buttons as $button => $button_name ) { ?>
496 <div class="pdfprnt-col pdfprnt-col-2">
497 <p><strong><?php echo esc_html( $button_name ); ?></strong></p>
498 <br>
499 <fieldset>
500 <?php foreach ( $this->button_image as $key => $value ) { ?>
501 <div class="pdfprnt-button-image-<?php echo esc_attr( $button ); ?>">
502 <label><input type="radio" name="pdfprnt_button_image[<?php echo esc_attr( $button ); ?>]" value="<?php echo esc_attr( $key ); ?>" data-button="<?php echo esc_attr( $button ); ?>" <?php checked( $key, $this->options['button_image'][ $button ]['type'] ); ?> /><?php echo esc_html( $value ); ?></label>
503 </div>
504 <?php } ?>
505 <img class="pdfprnt-button-image-default-<?php echo esc_attr( $button ); ?>" alt="<?php esc_html_e( 'Default Image', 'pdf-print' ); ?>" src="<?php echo esc_url( $this->options['button_image'][ $button ]['image_src'] ); ?>" />
506 </fieldset>
507 </div>
508 <?php } ?>
509 <div class="clear"></div>
510 <!-- pls -->
511 <?php $this->pro_block( 'button_image_block', $this->buttons ); ?>
512 <!-- end pls -->
513 </td>
514 </tr>
515 </table>
516 <table class="form-table pdfprnt-table-settings">
517 <tr>
518 <th><?php esc_html_e( 'Button Title', 'pdf-print' ); ?></th>
519 <td>
520 <?php foreach ( $this->buttons as $button => $button_name ) { ?>
521 <div class="pdfprnt-col pdfprnt-col-2">
522 <p><strong><?php echo esc_html( $button_name ); ?></strong></p>
523 <br>
524 <input class="widefat" name="pdfprnt_button_title[<?php echo esc_attr( $button ); ?>]" type="text" value="<?php echo esc_attr( $this->options['button_title'][ $button ] ); ?>" maxlength="50" />
525 </div>
526 <?php } ?>
527 <div class="clear"></div>
528 </td>
529 </tr>
530 <tr>
531 <th><?php esc_html_e( 'Print Preview Window', 'pdf-print' ); ?></th>
532 <td>
533 <label>
534 <input type="checkbox" name="pdfprnt_show_print_window" value="1" <?php checked( $this->options['show_print_window'] ); ?> />
535 <span class="bws_info"><?php esc_html_e( 'Enable to display print preview window with advanced settings.', 'pdf-print' ); ?></span>
536 </label>
537 </td>
538 </tr>
539 <?php do_action( 'pdfprnt_display_settings_search_engine_visibility', $this->options, $this->change_permission_attr ); ?>
540 </table>
541 <!-- pls -->
542 <?php $this->pro_block( 'noindex_block' ); ?>
543 <!-- end pls -->
544 <table class="form-table pdfprnt-table-settings">
545 <tr>
546 <th><?php esc_html_e( 'Default PDF Button Action', 'pdf-print' ); ?></th>
547 <td>
548 <fieldset>
549 <label>
550 <input type="radio" name="pdfprnt_file_action" value="download" <?php checked( $this->options['file_action'], 'download' ); ?> /><?php esc_html_e( 'Download PDF', 'pdf-print' ); ?>
551 </label><br />
552 <label>
553 <input type="radio" name="pdfprnt_file_action" value="open" <?php checked( $this->options['file_action'], 'open' ); ?> /><?php esc_html_e( 'Open PDF', 'pdf-print' ); ?>
554 </label><br />
555 </fieldset>
556 </td>
557 </tr>
558 <tr>
559 <th><?php esc_html_e( 'Default Print Button Action', 'pdf-print' ); ?></th>
560 <td>
561 <fieldset>
562 <label>
563 <input<?php echo $this->change_permission_attr; ?> type="radio" name="pdfprnt_print_action" value="plugin_function" <?php checked( $this->options['print_action'], 'plugin_function' ); ?> /><?php esc_html_e( 'Plugin functions', 'pdf-print' ); ?>
564 </label><br />
565 <label>
566 <input<?php echo $this->change_permission_attr; ?> type="radio" name="pdfprnt_print_action" value="ctrl_p" <?php checked( $this->options['print_action'], 'ctrl_p' ); ?> /><?php esc_html_e( 'CTRL + P', 'pdf-print' ); ?> <span class="bws_info">(<?php esc_html_e( 'simulate the CTRL + P keyboard shortcut', 'pdf-print' ); ?>)</span>
567 </label><br />
568 </fieldset>
569 </td>
570 </tr>
571 <tr>
572 <th><?php esc_html_e( 'Show count of PDF/Print generation', 'pdf-print' ); ?></th>
573 <td>
574 <label>
575 <input type="checkbox" name="pdfprnt_count_generation" value="1" <?php checked( $this->options['count_generation'] ); ?> />
576 <span class="bws_info"><?php esc_html_e( 'The number of generations will be displayed next to the Pdf/Print button.', 'pdf-print' ); ?></span>
577 </label>
578 </td>
579 </tr>
580 <tr>
581 <th><?php esc_html_e( 'Enable Buttons for', 'pdf-print' ); ?></th>
582 <td>
583 <fieldset>
584 <label class=hide-if-no-js>
585 <input type="checkbox" class="pdfprnt_select_all" /><strong><?php esc_html_e( 'All', 'pdf-print' ); ?></strong>
586 </label><br />
587 <?php
588 foreach ( $this->editable_roles as $role => $fields ) {
589 printf(
590 '<label><input type="checkbox" name="%1$s" class="pdfprnt_role" value="%2$s" %3$s /> %4$s</label><br/>',
591 'pdfprnt_' . esc_attr( $role ),
592 esc_attr( $role ),
593 checked( ! empty( $this->options['enabled_roles'][ $role ] ), true, false ),
594 esc_attr( translate_user_role( $fields['name'] ) )
595 );
596 }
597 ?>
598 <label>
599 <input type="checkbox" name="pdfprnt_unauthorized" class="pdfprnt_role" value="1" <?php checked( ! empty( $this->options['enabled_roles']['unauthorized'] ) ); ?> /><?php esc_html_e( 'Unauthorized', 'pdf-print' ); ?>
600 </label>
601 </fieldset>
602 </td>
603 </tr>
604 </table>
605 <?php wp_nonce_field( 'pdfprnt_action', 'pdfprnt_nonce_field' ); ?>
606 <?php
607 }
608 /**
609 * Display Output Settings tab
610 */
611 public function tab_output() {
612 $margin_positions_groups = array_chunk( array_keys( $this->margin_positions ), 2 );
613 ?>
614 <h3 class="bws_tab_label"><?php esc_html_e( 'Document Output Settings', 'pdf-print' ); ?></h3>
615 <?php $this->help_phrase(); ?>
616 <hr>
617 <!-- pls -->
618 <?php $this->pro_block( 'filename_orientation_block', $this->post_types ); ?>
619 <!-- end pls -->
620 <table class="form-table pdfprnt-table-settings">
621 <tr>
622 <th><?php esc_html_e( 'Full Page Capture to PDF', 'pdf-print' ); ?></th>
623 <td>
624 <label>
625 <input<?php echo wp_kses_post( $this->change_permission_attr ); ?> type="checkbox" name="pdfprnt_image_to_pdf" value="1" <?php checked( 1, $this->options['image_to_pdf'] ); ?> />
626 <span class="bws_info"><?php esc_html_e( 'Enable to take a screenshot of the entire page and generate a PDF file from it.', 'pdf-print' ); ?></span>
627 </label>
628 </td>
629 </tr>
630 <tr>
631 <th><?php esc_html_e( 'PDF Page Size', 'pdf-print' ); ?></th>
632 <td>
633 <fieldset>
634 <select name="pdfprnt_pdf_page_size">
635 <?php
636 $count_page_sizes = count( $this->page_sizes );
637 for ( $i = 0; $i < $count_page_sizes; $i++ ) {
638 $selected = ( $this->options['pdf_page_size'] === $this->page_sizes[ $i ] ) ? ' selected' : '';
639 echo '<option value="' . esc_attr( $this->page_sizes[ $i ] ) . '"' . esc_attr( $selected ) . '>' . esc_attr( $this->page_sizes[ $i ] ) . '</option>';
640 }
641 ?>
642 </select>
643 </fieldset>
644 </td>
645 </tr>
646 <tr>
647 <th><?php esc_html_e( 'Margins', 'pdf-print' ); ?></th>
648 <td>
649 <fieldset>
650 <?php foreach ( $margin_positions_groups as $margin_position_group ) { ?>
651 <?php foreach ( $margin_position_group as $margin_position ) { ?>
652 <div class="pdfprnt-col">
653 <p><strong><?php echo esc_html( $this->margin_positions[ $margin_position ] ); ?></strong></p>
654 <input type="number" class="pdfprnt_small_text" name="pdfprnt_pdf_margins[<?php echo esc_attr( $margin_position ); ?>]" min="0" max="297" step="1" value="<?php echo esc_attr( $this->options['pdf_margins'][ $margin_position ] ); ?>" /> <?php esc_html_e( 'px', 'pdf-print' ); ?>&emsp;
655 </div>
656 <?php } ?>
657 <div class="clear"></div><br>
658 <?php } ?>
659 </fieldset>
660 </td>
661 </tr>
662 <tr id="pdfprnt_print_shortcodes_wrap">
663 <th><?php esc_html_e( 'Print Shortcodes', 'pdf-print' ); ?></th>
664 <td>
665 <label>
666 <input type="checkbox" name="pdfprnt_do_shorcodes" value="1" <?php checked( $this->options['do_shorcodes'] ); ?> />
667 <span class="bws_info"><?php esc_html_e( 'Enable to print shortcodes with data generated by other plugins (recommended).', 'pdf-print' ); ?></span>
668 </label>
669 </td>
670 </tr>
671 <tr id="pdfprnt_remove_links_wrap">
672 <th><?php esc_html_e( 'Remove Links', 'pdf-print' ); ?></th>
673 <td>
674 <label>
675 <input type="checkbox" class="bws_option_affect" data-affect-hide="#pdfprnt-disable-links" name="pdfprnt_remove_links" value="1" <?php checked( $this->options['remove_links'] ); ?> />
676 <span class="bws_info"><?php esc_html_e( 'Enable to remove links from PDF and Print document.', 'pdf-print' ); ?></span>
677 </label>
678 </td>
679 </tr>
680 <tr id="pdfprnt-disable-links">
681 <th><?php esc_html_e( 'Link Annotations', 'pdf-print' ); ?></th>
682 <td>
683 <label>
684 <input type="checkbox" name="pdfprnt_disable_links" value="1" <?php checked( 1, $this->options['disable_links'] ); ?> />
685 <span class="bws_info"><?php esc_html_e( 'Enable to remove hover link styles in PDF document.', 'pdf-print' ); ?></span>
686 </label>
687 </td>
688 </tr>
689 <tr>
690 <th><?php esc_html_e( 'Replace video with QR Code image', 'pdf-print' ); ?></th>
691 <td>
692 <label>
693 <input type="checkbox" name="pdfprnt_replace_video" value="1" <?php checked( $this->options['replace_video'] ); ?> />
694 <span class="bws_info"><?php esc_html_e( 'Enable to replace video from the YouTube, Vimeo, Dailymotion, VideoPress sites with QR Code in PDF document.', 'pdf-print' ); ?></span>
695 </label><br />
696 <label>
697 <input type="checkbox" name="pdfprnt_qr_code_link" value="1" <?php checked( $this->options['qr_code_link'] ); ?> />
698 <span class="bws_info"><?php esc_html_e( 'Enable to make a QR Code a link to a video', 'pdf-print' ); ?></span>
699 </label>
700 </td>
701 </tr>
702 <tr>
703 <th><?php esc_html_e( 'Additional Elements', 'pdf-print' ); ?></th>
704 <td>
705 <fieldset>
706 <label><input<?php echo wp_kses_post( $this->change_permission_attr ); ?> type="checkbox" name="pdfprnt_show_title" value="1" class="bws_option_affect" data-affect-show=".pdfprnt-content-before-title" <?php checked( 1, $this->options['show_title'] ); ?> /> <?php esc_html_e( 'Title', 'pdf-print' ); ?></label><br>
707 <label><input<?php echo wp_kses_post( $this->change_permission_attr ); ?> type="checkbox" name="pdfprnt_show_author" value="1" <?php checked( 1, $this->options['show_author'] ); ?> /> <?php esc_html_e( 'Author', 'pdf-print' ); ?>
708 <br>
709 <span class="bws_info"><?php esc_html_e( 'for posts only', 'pdf-print' ); ?></span>
710 </label><br>
711 <label><input<?php echo wp_kses_post( $this->change_permission_attr ); ?> type="checkbox" name="pdfprnt_show_date" value="1" <?php checked( 1, $this->options['show_date'] ); ?> /> <?php esc_html_e( 'Date', 'pdf-print' ); ?>
712 <br>
713 <span class="bws_info"><?php esc_html_e( 'for posts only', 'pdf-print' ); ?></span>
714 </label><br>
715 <label><input<?php echo wp_kses_post( $this->change_permission_attr ); ?> type="checkbox" name="pdfprnt_show_featured_image" value="1" <?php checked( 1, $this->options['show_featured_image'] ); ?> /> <?php esc_html_e( 'Featured image', 'pdf-print' ); ?></label><br />
716 <label><input<?php echo wp_kses_post( $this->change_permission_attr ); ?> type="checkbox" name="pdfprnt_show_category" value="1" <?php checked( 1, $this->options['show_category'] ); ?> /> <?php esc_html_e( 'Category', 'pdf-print' ); ?>
717 <br>
718 <span class="bws_info"><?php esc_html_e( 'for posts only', 'pdf-print' ); ?></span>
719 </label><br>
720 </fieldset>
721 </td>
722 </tr>
723 <tr id="pdfprnt_full_page_capture_hide">
724 <th><?php esc_html_e( 'Classes/Ids/Elements to Hide', 'pdf-print' ); ?></th>
725 <td>
726 <fieldset>
727 <?php
728 foreach( $this->options['hide_classes'] as $hide_classes ) {
729 ?>
730 <label><input<?php echo wp_kses_post( $this->change_permission_attr ); ?> type="text" class="regular-text" name="pdfprnt_class_hide[]" value="<?php echo esc_html( $hide_classes ); ?>" /></label><span class="pdfprnt-class-delete"></span><br />
731 <?php
732 }
733 if ( 3 > count( $this->options['hide_classes'] ) ) {
734 for( $i = count( $this->options['hide_classes'] ); $i < 3; $i++ ) {
735 ?>
736 <label><input<?php echo wp_kses_post( $this->change_permission_attr ); ?> type="text" class="regular-text" name="pdfprnt_class_hide[]" value="" /></label><span class="pdfprnt-class-delete"></span><br />
737 <?php
738 }
739 }
740 ?>
741 <span class="bws_info"><?php printf( __( 'In the field specify only one value per row marked with . or #. For example, %s or %s or %s', 'pdf-print-pro' ),
742 '<code>.test</code>',
743 '<code>#test .only</code>',
744 '<code>footer</code>'
745 ); ?></span>
746 </fieldset>
747 </td>
748 </tr>
749 <?php do_action( 'pdfprnt_display_settings_woocommerce', $this->options, $this->change_permission_attr ); ?>
750 <tr id="pdfprnt_featured_image_size_wrap" valign="top">
751 <th scope="row"><?php esc_html_e( 'Featured Image Size', 'pdf-print' ); ?></th>
752 <td>
753 <select name="pdfprnt_featured_image_size">
754 <?php
755 $count_wp_sizes = count( $this->wp_sizes );
756 for ( $i = 0; $i < $count_wp_sizes; $i++ ) {
757 printf(
758 '<option value="%s" %s>%s</option>',
759 esc_attr( $this->wp_sizes[ $i ] ),
760 selected( ( $this->options['featured_image_size'] === $this->wp_sizes[ $i ] ), true, false ),
761 esc_attr( $this->wp_sizes[ $i ] )
762 );
763 }
764 ?>
765 </select>
766 </td>
767 </tr>
768 </table>
769 <?php $this->pro_block( 'woocommerce_watermark_block' ); ?>
770 <table class="form-table pdfprnt-table-settings">
771 <?php
772 $upload_dir = wp_upload_dir();
773 $path = $upload_dir['basedir'] . '/vendor';
774 $is_installed = file_exists( $path );
775 if ( ! $is_installed ) {
776 ?>
777 <tr id="pdfprnt_additional_fonts_wrap">
778 <th><?php esc_html_e( 'Additional Fonts', 'pdf-print' ); ?></th>
779 <td>
780 <?php
781 if ( class_exists( 'ZipArchive' ) ) {
782 $fonts_button_title =
783 0 < $this->options['additional_fonts'] || /* loading not called yet */
784 $this->need_fonts_reload /* loading occurred with errors or neccessary files lacks */
785 ?
786 __( 'Reload Fonts', 'pdf-print' )
787 :
788 __( 'Load Fonts', 'pdf-print' );
789 ?>
790 <input type="submit" class="button bws_no_bind_notice" value="<?php echo esc_attr( $fonts_button_title ); ?>" name="pdfprnt_load_fonts" />&nbsp;<span id="pdfprnt_font_loader" class="pdfprnt_loader"><img src="<?php echo esc_url( plugins_url( '../images/ajax-loader.gif', __FILE__ ) ); ?>" alt="loader" /></span><br />
791 <input type="hidden" name="pdfprnt_action" value="pdfprnt_load_fonts" />
792 <input type="hidden" name="pdfprnt_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'pdfprnt_ajax_nonce' ) ); ?>" />
793 <div class="pdfprnt-additional-fonts-info">
794 <?php if ( 0 < $this->options['additional_fonts'] ) { ?>
795 <div class="bws_info"><?php esc_html_e( 'Additional fonts were loaded successfully', 'pdf-print' ); ?>.</div>
796 <?php
797 } else {
798 if ( -1 === intval( $this->options['additional_fonts'] ) ) {
799 ?>
800 <span><?php esc_html_e( 'If you have some problems with your internet connection, please, try to load additional fonts manually. For more info, please see', 'pdf-print' ); ?>&nbsp;<a href="https://support.bestwebsoft.com/hc/en-us/articles/206693223" target="_blank"><?php esc_html_e( 'FAQ', 'pdf-print' ); ?></a>.</span><br />
801 <?php } ?>
802 <div class="bws_info"><?php esc_html_e( 'Load additional fonts required for correct PDF file(-s) display.', 'pdf-print' ); ?></div>
803 <?php } ?>
804 </div>
805 <?php } else { ?>
806 <span style="color: red;"><strong><?php esc_html_e( 'WARNING', 'pdf-print' ); ?>:&nbsp;</strong><?php esc_html_e( 'ZipArchive Class is not installed on your server. It is impossible to load additional fonts.', 'pdf-print' ); ?></span>
807 <?php
808 }
809 ?>
810 </td>
811 </tr>
812 <?php } ?>
813 <tr id="pdfprnt_default_css_wrap">
814 <th><?php esc_html_e( 'Default CSS', 'pdf-print' ); ?></th>
815 <td>
816 <fieldset>
817 <label>
818 <input name="pdfprnt_use_default_css" type="checkbox" value="1" <?php checked( 1, $this->options['use_default_css'] ); ?> />
819 <span class="bws_info"><?php esc_html_e( 'Enable to apply CSS from the current theme. Disable to use default CSS.', 'pdf-print' ); ?></span>
820 </label>
821 </fieldset>
822 </td>
823 </tr>
824 <tr id="pdfprnt_custom_css_wrap">
825 <th><?php esc_html_e( 'Custom CSS', 'pdf-print' ); ?></th>
826 <td>
827 <fieldset>
828 <label>
829 <input name="pdfprnt_use_custom_css" type="checkbox" value="1" <?php checked( 1, $this->options['use_custom_css'] ); ?> />
830 <span class="bws_info"><?php esc_html_e( 'Enable to add custom CSS code to documents.', 'pdf-print' ); ?></span>
831 </label>
832 <div id="pdfprnt_custom_css_code_wrap"
833 <?php
834 if ( 0 === intval( $this->options['use_custom_css'] ) ) {
835 echo 'style="display: none;"';}
836 ?>
837 >
838 <textarea id="pdfprnt_custom_css_code" name="pdfprnt_custom_css_code" maxlength="10000" cols="50" rows="5"><?php echo esc_textarea( $this->options['custom_css_code'] ); ?></textarea>
839 </div>
840 </fieldset>
841 </td>
842 </tr>
843 </table>
844 <?php
845 }
846 /**
847 * Display Settings tab
848 */
849 public function tab_display() {
850 ?>
851 <h3 class="bws_tab_label"><?php esc_html_e( 'Display Settings', 'pdf-print' ); ?></h3>
852 <?php $this->help_phrase(); ?>
853 <hr>
854
855 <?php
856 $this->pro_block( 'fancytree_block' );
857 }
858
859 /**
860 * Display Custom Fields settings tab
861 */
862 public function tab_custom_fields() {
863 ?>
864 <h3 class="bws_tab_label"><?php esc_html_e( 'Custom Fields Settings', 'pdf-print' ); ?></h3>
865 <?php $this->help_phrase(); ?>
866 <hr>
867 <?php
868 $this->pro_block( 'custom_fields_block' );
869 }
870 /**
871 * Display custom metabox
872 *
873 * @access public
874 */
875 public function display_metabox() {
876 ?>
877 <div class="postbox">
878 <h3 class="hndle">
879 <?php esc_html_e( 'PDF & Print Shortcode', 'pdf-print' ); ?>
880 </h3>
881 <div class="inside">
882 <p><?php esc_html_e( 'Add PDF & Print buttons to a widget.', 'pdf-print' ); ?> <a href="widgets.php"><?php esc_html_e( 'Navigate to Widgets', 'pdf-print' ); ?></a></p>
883 </div>
884 <div class="inside">
885 <?php esc_html_e( 'Add PDF button to your posts or pages using the following shortcode:', 'pdf-print' ); ?>
886 <?php bws_shortcode_output( "[bws_pdfprint display='pdf']" ); ?>
887 </div>
888 <div class="inside">
889 <?php esc_html_e( 'Add Print button to your posts or pages using the following shortcode:', 'pdf-print' ); ?>
890 <?php bws_shortcode_output( "[bws_pdfprint display='print']" ); ?>
891 </div>
892 <div class="inside">
893 <?php esc_html_e( 'Add PDF & Print buttons to your posts or pages using the following shortcode:', 'pdf-print' ); ?>
894 <?php bws_shortcode_output( "[bws_pdfprint display='pdf,print']" ); ?>
895 </div>
896 <div class="inside">
897 <?php esc_html_e( 'Create a page break in PDF document:', 'pdf-print' ); ?>
898 <?php bws_shortcode_output( '[bws_pdfprint_pagebreak]' ); ?>
899 </div>
900 </div>
901 <?php
902 }
903
904 /**
905 * Display bws_pro_version block by its name
906 *
907 * @param string $block_name Slug for block.
908 * @param array $args Args for block.
909 * @param bool $force Flag force.
910 */
911 public function pro_block( $block_name = '', $args = array(), $force = false ) {
912 $block_name = 'pdfprnt_' . $block_name;
913 if ( ( ! $this->hide_pro_tabs || $force ) && function_exists( $block_name ) ) {
914 ?>
915 <div class="bws_pro_version_bloc pdfprnt-pro-feature">
916 <div class="bws_pro_version_table_bloc">
917 <button type="submit" name="bws_hide_premium_options" class="notice-dismiss bws_hide_premium_options" title="<?php esc_html_e( 'Close', 'pdf-print' ); ?>"></button>
918 <div class="bws_table_bg"></div>
919 <div class="bws_pro_version">
920 <?php $block_name( $args ); ?>
921 </div>
922 </div>
923 <?php $this->bws_pro_block_links(); ?>
924 </div>
925 <?php
926 }
927 }
928
929 /**
930 * Custom functions for "Upgrade the mPDF"
931 *
932 * @access public
933 */
934 public function upgrade_mpdf() {
935 /* Disable block if mPDF 7 already installed */
936 $path = dirname( __FILE__ );
937 if ( is_multisite() ) {
938 switch_to_blog( 1 );
939 $upload_dir = wp_upload_dir();
940 restore_current_blog();
941 } else {
942 $upload_dir = wp_upload_dir();
943 }
944 $path = $upload_dir['basedir'] . '/vendor';
945 $is_installed = file_exists( $path );
946 if ( ! $is_installed || ! isset( $this->options['mpdf_library_version'] ) || $this->options['mpdf_library_version'] !== $this->default_options['mpdf_library_version'] ) {
947 ?>
948 <table class="form-table">
949 <tbody>
950 <tr>
951 <th scope="row"><?php esc_html_e( 'Upgrade the mPDF library', 'pdf-print' ); ?></th>
952 <td>
953 <?php
954 $is_class_exists = class_exists( 'ZipArchive' );
955 if ( $is_class_exists ) {
956 $upgrade = __( 'Upgrade', 'pdf-print' );
957 ?>
958 <input name="pdfprnt_upgrade_library" type="submit" class="button" value="<?php echo esc_html( $upgrade ); ?>">&nbsp;<span id="pdfprnt_library_loader" class="pdfprnt_loader"><img src="<?php echo esc_url( plugins_url( '../images/ajax-loader.gif', __FILE__ ) ); ?>" alt="loader" /></span><br />
959 <input type="hidden" name="pdfprnt_action" value="pdfprnt_upgrade_library" />
960 <input type="hidden" name="pdfprnt_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'pdfprnt_ajax_nonce' ) ); ?>" />
961 <div class="bws_info">
962 <?php
963 printf(
964 esc_html__( 'This will upgrade the mPDF library to version %s (recommended). The new version of the mPDF library is compatible with PHP V8.2.x and older', 'pdf-print' ),
965 esc_attr( $this->default_options['mpdf_library_version'] )
966 );
967 ?>
968 </div>
969 <?php } else { ?>
970 <span style="color: red;"><strong><?php esc_html_e( 'WARNING', 'pdf-print' ); ?>:&nbsp;</strong><?php esc_html_e( 'ZipArchive сlass is not installed on your server. It is impossible to upgrade the mPDF library.', 'pdf-print' ); ?></span>
971 <?php } ?>
972 </td>
973 </tr>
974 </tbody>
975 </table>
976 <?php
977 }
978 }
979 }
980 }
981