ruạṛ
<?php /** * Displays the content on the plugin settings page */ if ( ! class_exists( 'Pdfprnt_Settings_Tabs' ) ) { class Pdfprnt_Settings_Tabs extends Bws_Settings_Tabs { public $post_types, $button_positions, $button_image, $margin_positions, $default_css_types, $upload_dir, $page_sizes, $editable_roles; public $need_fonts_reload = false; private $wp_sizes, $buttons; /** * Constructor. * * @access public * * @see Bws_Settings_Tabs::__construct() for more information on default arguments. * * @param string $plugin_basename */ public function __construct( $plugin_basename ) { global $pdfprnt_options, $pdfprnt_plugin_info, $wp_roles; $tabs = array( 'settings' => array( 'label' => esc_html__( 'Settings', 'pdf-print' ) ), 'output' => array( 'label' => esc_html__( 'Output', 'pdf-print' ) ), /*pls */ 'display' => array( 'label' => esc_html__( 'Display', 'pdf-print' ), 'is_pro' => 1 ), /* pls*/ 'misc' => array( 'label' => esc_html__( 'Misc', 'pdf-print' ) ), /*pls */ 'custom_fields' => array( 'label' => esc_html__( 'Custom Fields', 'pdf-print' ) , 'is_pro' => 1 ), /* pls*/ 'custom_code' => array( 'label' => esc_html__( 'Custom Code', 'pdf-print' ) ), /*pls */ 'license' => array( 'label' => esc_html__( 'License Key', 'pdf-print' ) ), /* pls*/ ); parent::__construct( array( 'plugin_basename' => $plugin_basename, 'plugins_info' => $pdfprnt_plugin_info, 'prefix' => 'pdfprnt', 'default_options' => pdfprnt_get_options_default(), 'options' => $pdfprnt_options, 'is_network_options' => is_network_admin(), 'tabs' => $tabs, /*pls */ 'wp_slug' => 'pdf-print', 'link_key' => 'd9da7c9c2046bed8dfa38d005d4bffdb', 'link_pn' => '101', 'doc_link' => 'https://bestwebsoft.com/documentation/pdf-print/pdf-print-user-guide/', 'doc_video_link' => 'https://www.youtube.com/watch?v=Pec-6dDiou0' /* pls*/ ) ); add_action( get_parent_class( $this ) . '_display_custom_messages', array( $this, 'display_custom_messages' ) ); add_action( get_parent_class( $this ) . '_display_metabox', array( $this, 'display_metabox' ) ); add_action( get_parent_class( $this ) . '_additional_misc_options', array( $this, 'upgrade_mpdf' ) ); $this->buttons = array( 'pdf' => esc_html__( 'PDF', 'pdf-print' ), 'print' => esc_html__( 'Print', 'pdf-print' ) ); /* Get post types */ $this->post_types = get_post_types( array( 'public' => 1, 'show_ui' => 1 ), 'objects' ); unset( $this->post_types['attachment'] ); $standard_post_types = array( 'pdfprnt_search' => esc_html__( 'Search results', 'pdf-print' ), 'pdfprnt_archives' => esc_html__( 'Archives', 'pdf-print' ), 'pdfprnt_blog' => esc_html__( 'Posts page', 'pdf-print' ) ); foreach ( $standard_post_types as $key => $value ) { $add_post_type = new stdClass(); $this->post_types[ $key ] = (object) array( 'label' => $value ); } $this->button_positions = array( 'top-left' => esc_html__( 'Top Left', 'pdf-print' ), 'top-right' => esc_html__( 'Top Right', 'pdf-print' ), 'bottom-left' => esc_html__( 'Bottom Left', 'pdf-print' ), 'bottom-right' => esc_html__( 'Bottom Right', 'pdf-print' ), 'top-bottom-left' => esc_html__( 'Top & Bottom Left', 'pdf-print' ), 'top-bottom-right' => esc_html__( 'Top & Bottom Right', 'pdf-print' ) ); $this->button_image = array( 'none' => esc_html__( 'None', 'pdf-print' ), 'default' => esc_html__( 'Default', 'pdf-print' ) ); $this->margin_positions = array( 'top' => esc_html__( 'Top', 'pdf-print' ), 'bottom' => esc_html__( 'Bottom', 'pdf-print' ), 'left' => esc_html__( 'Left', 'pdf-print' ), 'right' => esc_html__( 'Right', 'pdf-print' ) ); $this->page_sizes = pdfprnt_get_pdf_page_sizes(); $this->editable_roles = $wp_roles->roles; if ( $this->is_multisite ) { switch_to_blog( 1 ); $this->upload_dir = wp_upload_dir(); restore_current_blog(); } else { $this->upload_dir = wp_upload_dir(); } $this->wp_sizes = get_intermediate_image_sizes(); } /** * Display custom error\message\notice * @access public * @param $save_results - array with error\message\notice * @return void */ public function display_custom_messages( $save_results ) { global $pdfprnt_is_old_php; $message = $error = ""; ?> <noscript><div class="error below-h2"><p><strong><?php esc_html_e( "Please enable JavaScript in your browser.", 'pdf-print' ); ?></strong></p></div></noscript> <?php if ( $pdfprnt_is_old_php ) { ?> <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> <?php } /* Check fonts folder rights */ $upload_dir = wp_upload_dir(); $plugin_dir = realpath( dirname( __FILE__ ) . '/..' ); $ttfontdata = $upload_dir['basedir'] . '/vendor/mpdf/mpdf/tmp'; $is_installed = file_exists( $ttfontdata ); if ( ! $is_installed ) { $ttfontdata = $plugin_dir . '/mpdf/ttfontdata'; } if ( ! is_writable( $ttfontdata ) ) { if ( ! @chmod( $ttfontdata, 0755 ) ) { ?> <div class="error below-h2"> <p> <strong> <?php esc_html_e( "Warning: Not enough permissions for the folder", 'pdf-print' ); ?> <i><?php echo $ttfontdata; ?></i>.<br /> <?php printf( esc_html__( 'Please check and change permissions for your plugins folder (for folders - 755, for files - 644). For more info, please see %s and %s.', 'pdf-print' ), '<a href="https://codex.wordpress.org/Changing_File_Permissions" target="_blank">' . esc_html__( 'Changing File Permissions', 'pdf-print' ) . '</a>', '<a href="https://support.bestwebsoft.com/hc/en-us/articles/115000108003" target="_blank">' . esc_html__( 'FAQ', 'pdf-print' ) . '</a>' ); ?> </strong> </p> </div> <?php } } $fonts_path = $this->upload_dir['basedir'] .'/pdf-print-fonts'; if ( file_exists( $fonts_path ) ) { $files = scandir( $fonts_path ); } if ( ! is_dir( $fonts_path ) && $this->options['additional_fonts'] != 0 ) { /* if "pdf-print-fonts" folder was removed somehow */ $error = sprintf( esc_html__( 'The folder %s was removed.', 'pdf-print' ), '"uploads/pdf-print-fonts"' ); $this->need_fonts_reload = true; } elseif ( is_dir( $fonts_path ) && $this->options['additional_fonts'] != count( $files ) && 0 < $this->options['additional_fonts'] ) { /* if some fonts was removed somehow from "pdf-print-fonts" folder */ $error = sprintf( esc_html__( 'Some fonts were removed from %s folder.', 'pdf-print' ), '"uploads/pdf-print-fonts"' ); $this->need_fonts_reload = true; } if ( $this->need_fonts_reload ) { $error .= ' ' . sprintf( esc_html__( 'It is necessary to reload fonts. For more info, please see %s.', 'pdf-print' ), '<a href="https://support.bestwebsoft.com/hc/en-us/articles/206693223" target="_blank">' . esc_html__( 'FAQ', 'pdf-print' ) . '</a>' ); pdfprnt_update_option( -1, true ); } if ( isset( $_POST['pdfprnt_load_fonts'] ) ) { /* load additional fonts if javascript is disabled */ $result = pdfprnt_load_fonts(); if ( isset( $result['error'] ) ) { $error .= ' ' . $result['error'] . '. ' . sprintf( esc_html__( 'It is necessary to reload fonts. For more info, please see %s', 'pdf-print' ), '<a href="https://support.bestwebsoft.com/hc/en-us/articles/206693223" target="_blank">' . esc_html__( 'FAQ', 'pdf-print' ) . '</a>' ); $this->need_fonts_reload = true; } if ( isset( $result['done'] ) ) { $message .= ' ' . $result['done']; } } if ( isset( $_POST['pdfprnt_upgrade_library'] ) ) { /* upgrade mPDF library if javascript is disabled */ $result = pdfprnt_upgrade_library(); if ( isset( $result['error'] ) ) { $error .= ' ' . $result['error']; } if ( isset( $result['done'] ) ) { $message .= ' ' . $result['done']; } } $upload_dir = wp_upload_dir(); $new_library_path = $upload_dir['basedir'] . '/vendor/'; if ( ! file_exists( $new_library_path ) ) { $message .= ' ' . esc_html__( 'The new version of the mPDF library which compatible with PHP V7.x.x is available now! Go to the Misc tab and upgrade the mPDF library.', 'pdf-print' ); } ?> <div class="updated below-h2" <?php if ( empty( $message ) || "" != $error ) echo "style=\"display:none\""; ?>><p><strong><?php echo $message; ?></strong></p></div> <div class="error below-h2" <?php if ( "" == $error ) echo "style=\"display:none\""; ?>><p><strong><?php echo $error; ?></strong></p></div> <?php } /** * Save plugin options to the database * @access public * @param void * @return array The action results */ public function save_options() { $message = $notice = $error = ''; if ( isset( $_POST['pdfprnt_load_fonts'] ) || isset( $_POST['pdfprnt_upgrade_library'] ) ) { return; } foreach ( $this->buttons as $button => $button_name ) { /* Add Button to */ $this->options['button_post_types'][ $button ] = array(); if ( isset( $_POST['pdfprnt_button_post_types'][ $button ] ) && is_array( $_POST['pdfprnt_button_post_types'][ $button ] ) ) { foreach ( $_POST['pdfprnt_button_post_types'][ $button ] as $post_type ) { if ( array_key_exists( $post_type, $this->post_types ) ) { $this->options['button_post_types'][ $button ][] = $post_type; } } } /* Button Image */ $this->options['button_image'][ $button ]['image_src']= plugins_url( "images/{$button}.png" , dirname(__FILE__ ) ); if ( isset( $_POST['pdfprnt_button_image'][ $button ] ) ) { $new_button_image = $_POST['pdfprnt_button_image'][ $button ]; $this->options['button_image'][ $button ]['type'] = array_key_exists( $new_button_image, $this->button_image ) ? $new_button_image : $this->options['button_image'][ $button ]['type']; } /* Button Title */ $this->options['button_title'][ $button ] = isset( $_POST['pdfprnt_button_title'][ $button ] ) ? sanitize_text_field( $_POST['pdfprnt_button_title'][ $button ] ) : $this->options['button_title'][ $button ]; } /* Buttons Position */ $this->options['buttons_position'] = isset( $_POST['pdfprnt_buttons_position'] ) && array_key_exists( $_POST['pdfprnt_buttons_position'], $this->button_positions ) ? $_POST['pdfprnt_buttons_position'] : $this->options['buttons_position']; /* Print Preview Window */ $this->options['show_print_window'] = ( isset( $_POST['pdfprnt_show_print_window'] ) ) ? 1 : 0; /* Creating pdf with image of screen */ $this->options['image_to_pdf'] = ( isset( $_POST['pdfprnt_image_to_pdf'] ) ) ? 1 : 0; /* Shortcode Settings */ $this->options['do_shorcodes'] = isset( $_POST['pdfprnt_do_shorcodes'] ) ? 1 : 0; $this->options['disable_links'] = isset( $_POST['pdfprnt_disable_links'] ) ? 1 : 0; $this->options['remove_links'] = isset( $_POST['pdfprnt_remove_links'] ) ? 1 : 0; /* PDF Page Size */ $this->options['pdf_page_size'] = ( isset( $_POST['pdfprnt_pdf_page_size'] ) && in_array( $_POST['pdfprnt_pdf_page_size'], $this->page_sizes ) ) ? $_POST['pdfprnt_pdf_page_size'] : $this->options['pdf_page_size']; /* Margins */ if ( isset( $_POST['pdfprnt_pdf_margins'] ) && is_array( $_POST['pdfprnt_pdf_margins'] ) ) { foreach ( $this->margin_positions as $key => $value ) { if ( isset( $_POST['pdfprnt_pdf_margins'][ $key ] ) ) { $this->options['pdf_margins'][ $key ] = intval( $_POST['pdfprnt_pdf_margins'][ $key ] ); } } } /* Additional Elements */ $this->options['show_title'] = isset( $_POST['pdfprnt_show_title'] ) ? 1 : 0; $this->options['show_author'] = isset( $_POST['pdfprnt_show_author'] ) ? 1 : 0; $this->options['show_date'] = isset( $_POST['pdfprnt_show_date'] ) ? 1 : 0; $this->options['show_featured_image'] = isset( $_POST['pdfprnt_show_featured_image'] ) ? 1 : 0; /* Featured Image Size */ $this->options['featured_image_size'] = isset( $_POST['pdfprnt_featured_image_size'] ) && in_array( $_POST['pdfprnt_featured_image_size'], $this->wp_sizes ) ? $_POST['pdfprnt_featured_image_size'] : $this->options['featured_image_size']; $this->options['use_default_css'] = ( isset( $_POST['pdfprnt_use_default_css'] ) ) ? 1 : 0; $this->options['use_custom_css'] = ( isset( $_POST['pdfprnt_use_custom_css'] ) ) ? 1 : 0; if ( isset( $_POST['pdfprnt_custom_css_code'] ) ) { $custom_css_code = trim( strip_tags( stripslashes( $_POST['pdfprnt_custom_css_code'] ) ) ); if ( 10000 < strlen( $custom_css_code ) ) { $error = esc_html__( 'You have entered too much text in the "edit styles" field.', 'pdf-print' ); } else { $this->options['custom_css_code'] = $custom_css_code; } } /* Buttons open */ $this->options['file_action'] = isset( $_POST['pdfprnt_file_action'] ) && in_array( $_POST['pdfprnt_file_action'], array( 'download', 'open' ) ) ? $_POST['pdfprnt_file_action'] : $this->options['file_action']; /* All select */ $this->options['enabled_roles'] = array(); foreach ( $this->editable_roles as $role => $fields ) { $this->options['enabled_roles'][ $role ] = isset( $_POST['pdfprnt_' . $role ] ) ? 1 : 0; } $this->options['enabled_roles']['unauthorized'] = isset( $_POST['pdfprnt_unauthorized'] ) ? 1 : 0; $this->options = apply_filters( 'pdfprnt_before_save_options', $this->options ); update_option( 'pdfprnt_options', $this->options ); $message .= esc_html__( 'Settings saved.', 'pdf-print' ); return compact( 'message', 'notice', 'error' ); } public function tab_settings() { ?> <h3 class="bws_tab_label"><?php esc_html_e( 'PDF & Print Settings', 'pdf-print' ); ?></h3> <?php $this->help_phrase(); ?> <hr> <table class="form-table pdfprnt-table-settings"> <tr> <th scope="row"><?php esc_html_e( 'Add Button to', 'pdf-print' ); ?></th> <td> <?php foreach ( $this->buttons as $button => $button_name ) { ?> <div class="pdfprnt-col pdfprnt-col-2"> <p><strong><?php echo $button_name; ?></strong></p> <br> <fieldset> <?php foreach ( $this->post_types as $key => $value ) { ?> <label> <input type="checkbox" name="pdfprnt_button_post_types[<?php echo $button; ?>][]" value="<?php echo $key; ?>" <?php checked( in_array( $key, $this->options['button_post_types'][ $button ] ) ); ?> /> <?php echo $value->label; ?> </label><br> <?php } ?> </fieldset> </div> <?php } ?> <div class="clear"></div> <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> </td> </tr> <tr> <th><?php esc_html_e( 'Buttons Position', 'pdf-print' ); ?></th> <td> <fieldset> <?php foreach ( $this->button_positions as $key => $value ) { ?> <label><input type="radio" name="pdfprnt_buttons_position" value="<?php echo $key; ?>"<?php checked( $key, $this->options['buttons_position'] ); ?> /> <?php echo $value; ?></label> <?php if ( $key != 'top-bottom-right' ) echo '<br>'; ?> <?php } ?> </fieldset> <div class="bws_info"><?php esc_html_e( 'Select buttons position in the content (default is Top Right).', 'pdf-print' ); ?></div> </td> </tr> <tr> <th><?php esc_html_e( 'Button Image', 'pdf-print' ); ?></th> <td class="pdfprnt-td-button-image"> <?php foreach ( $this->buttons as $button => $button_name ) { ?> <div class="pdfprnt-col pdfprnt-col-2"> <p><strong><?php echo $button_name; ?></strong></p> <br> <fieldset> <?php foreach ( $this->button_image as $key => $value ) { ?> <div class="pdfprnt-button-image-<?php echo $button; ?>"> <label><input type="radio" name="pdfprnt_button_image[<?php echo $button; ?>]" value="<?php echo $key; ?>" data-button="<?php echo $button; ?>" <?php checked( $key, $this->options['button_image'][ $button ]['type'] ); ?> /><?php echo $value; ?></label> </div> <?php } ?> <img class="pdfprnt-button-image-default-<?php echo $button; ?>" alt="<?php esc_html_e( 'Default Image', 'pdf-print' ); ?>" src="<?php echo $this->options['button_image'][ $button ]['image_src']; ?>" /> </fieldset> </div> <?php } ?> <div class="clear"></div> <!-- pls --> <?php $this->pro_block( 'button_image_block', $this->buttons ); ?> <!-- end pls --> </td> </tr> </table> <table class="form-table pdfprnt-table-settings"> <tr> <th><?php esc_html_e( 'Button Title', 'pdf-print' ); ?></th> <td> <?php foreach ( $this->buttons as $button => $button_name ) { ?> <div class="pdfprnt-col pdfprnt-col-2"> <p><strong><?php echo $button_name; ?></strong></p> <br> <input class="widefat" name="pdfprnt_button_title[<?php echo $button; ?>]" type="text" value="<?php echo $this->options['button_title'][ $button ]; ?>" maxlength="50" /> </div> <?php } ?> <div class="clear"></div> </td> </tr> <tr> <th><?php esc_html_e( 'Print Preview Window', 'pdf-print' ); ?></th> <td> <label> <input type="checkbox" name="pdfprnt_show_print_window" value="1" <?php checked( $this->options['show_print_window'] ); ?> /> <span class="bws_info"><?php esc_html_e( 'Enable to display print preview window with advanced settings.', 'pdf-print' ); ?></span> </label> </td> </tr> <?php do_action('pdfprnt_display_settings_search_engine_visibility', $this->options, $this->change_permission_attr) ?> </table> <!-- pls --> <?php $this->pro_block( 'noindex_block' ); ?> <!-- end pls --> <table class="form-table pdfprnt-table-settings"> <tr> <th><?php esc_html_e( 'Default PDF Button Action', 'pdf-print' ); ?></th> <td> <fieldset> <label> <input type="radio" name="pdfprnt_file_action" value="download" <?php checked( $this->options['file_action'], 'download' ); ?> /><?php esc_html_e( 'Download PDF', 'pdf-print' ); ?> </label><br /> <label> <input type="radio" name="pdfprnt_file_action" value="open" <?php checked( $this->options['file_action'], 'open' ); ?> /><?php esc_html_e( 'Open PDF', 'pdf-print' ); ?> </label><br /> </fieldset> </td> </tr> <tr> <th><?php esc_html_e( 'Enable Buttons for', 'pdf-print' ); ?></th> <td> <fieldset> <label class=hide-if-no-js> <input type="checkbox" class="pdfprnt_select_all" /><strong><?php esc_html_e( 'All', 'pdf-print' ); ?></strong> </label><br /> <?php foreach ( $this->editable_roles as $role => $fields ) { printf( '<label><input type="checkbox" name="%1$s" class="pdfprnt_role" value="%2$s" %3$s /> %4$s</label><br/>', 'pdfprnt_' . $role, $role, checked( ! empty( $this->options['enabled_roles'][ $role ] ), true, false ), translate_user_role( $fields['name'] ) ); } ?> <label> <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' ); ?> </label> </fieldset> </td> </tr> </table> <?php } public function tab_output() { $margin_positions_groups = array_chunk( array_keys( $this->margin_positions ), 2 ); ?> <h3 class="bws_tab_label"><?php esc_html_e( 'Document Output Settings', 'pdf-print' ); ?></h3> <?php $this->help_phrase(); ?> <hr> <!-- pls --> <?php $this->pro_block( 'filename_orientation_block', $this->post_types ); ?> <!-- end pls --> <table class="form-table pdfprnt-table-settings"> <tr> <th><?php esc_html_e( 'Full Page Capture to PDF', 'pdf-print' ); ?></th> <td> <label> <input<?php echo $this->change_permission_attr; ?> type="checkbox" name="pdfprnt_image_to_pdf" value="1" <?php checked( 1, $this->options['image_to_pdf'] ); ?> /> <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> </label> </td> </tr> <tr> <th><?php esc_html_e( 'PDF Page Size', 'pdf-print' ); ?></th> <td> <fieldset> <select name="pdfprnt_pdf_page_size"> <?php for ($i=0; $i < count( $this->page_sizes ); $i++) { $selected = ( $this->options['pdf_page_size'] == $this->page_sizes[$i] ) ? ' selected' : ''; echo '<option value="'.$this->page_sizes[$i].'"'.$selected.'>'.$this->page_sizes[$i].'</option>'; } ?> </select> </fieldset> </td> </tr> <tr> <th><?php esc_html_e( 'Margins', 'pdf-print' ); ?></th> <td> <fieldset> <?php foreach ( $margin_positions_groups as $margin_position_group ) { ?> <?php foreach ( $margin_position_group as $margin_position ) { ?> <div class="pdfprnt-col"> <p><strong><?php echo $this->margin_positions[ $margin_position ]; ?></strong></p> <input type="number" class="pdfprnt_small_text" name="pdfprnt_pdf_margins[<?php echo $margin_position; ?>]" min="0" max="297" step="1" value="<?php echo $this->options['pdf_margins'][ $margin_position ]; ?>" /> <?php esc_html_e( 'px', 'pdf-print' ); ?>  </div> <?php } ?> <div class="clear"></div><br> <?php } ?> </fieldset> </td> </tr> <tr id="pdfprnt_print_shortcodes_wrap"> <th><?php esc_html_e( 'Print Shortcodes', 'pdf-print' ); ?></th> <td> <label> <input type="checkbox" name="pdfprnt_do_shorcodes" value="1" <?php checked( $this->options['do_shorcodes'] ); ?> /> <span class="bws_info"><?php esc_html_e( 'Enable to print shortcodes with data generated by other plugins (recommended).', 'pdf-print' ); ?></span> </label> </td> </tr> <tr id="pdfprnt_remove_links_wrap"> <th><?php esc_html_e( 'Remove Links', 'pdf-print' ); ?></th> <td> <label> <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'] ); ?> /> <span class="bws_info"><?php esc_html_e( 'Enable to remove links from PDF and Print document.', 'pdf-print' ); ?></span> </label> </td> </tr> <tr id="pdfprnt-disable-links"> <th><?php esc_html_e( 'Link Annotations', 'pdf-print' ); ?></th> <td> <label> <input type="checkbox" name="pdfprnt_disable_links" value="1" <?php checked( 1, $this->options['disable_links'] ); ?> /> <span class="bws_info"><?php esc_html_e( 'Enable to remove hover link styles in PDF document.', 'pdf-print' ); ?></span> </label> </td> </tr> <tr> <th><?php esc_html_e( 'Additional Elements', 'pdf-print' ); ?></th> <td> <fieldset> <label><input<?php echo $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> <label><input<?php echo $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' ); ?> <br> <span class="bws_info"><?php esc_html_e( 'for posts only', 'pdf-print' ); ?></span> </label><br> <label><input<?php echo $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' ); ?> <br> <span class="bws_info"><?php esc_html_e( 'for posts only', 'pdf-print' ); ?></span> </label><br> <label><input<?php echo $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> </fieldset> </td> </tr> <?php do_action( 'pdfprnt_display_settings_woocommerce', $this->options, $this->change_permission_attr ) ?> <tr id="pdfprnt_featured_image_size_wrap" valign="top"> <th scope="row"><?php esc_html_e( 'Featured Image Size', 'pdf-print' ); ?></th> <td> <select name="pdfprnt_featured_image_size"> <?php for ( $i=0; $i < count( $this->wp_sizes ); $i++ ) { printf( '<option value="%s" %s>%s</option>', $this->wp_sizes[$i], selected( ( $this->options['featured_image_size'] == $this->wp_sizes[$i] ), true, false ), $this->wp_sizes[$i] ); } ?> </select> </td> </tr> </table> <!-- pls --> <?php $this->pro_block( 'woocommerce_watermark_block' ); ?> <!-- end pls --> <table class="form-table pdfprnt-table-settings"> <tr id="pdfprnt_additional_fonts_wrap"> <th><?php esc_html_e( 'Additional Fonts', 'pdf-print' ); ?></th> <td> <?php if ( class_exists( 'ZipArchive' ) ) { $fonts_button_title = 0 < $this->options['additional_fonts'] || /* loading not called yet */ $this->need_fonts_reload /* loading occurred with errors or neccessary files lacks */ ? esc_html__( 'Reload Fonts', 'pdf-print' ) : esc_html__( 'Load Fonts', 'pdf-print' ); ?> <input type="submit" class="button bws_no_bind_notice" value="<?php echo $fonts_button_title; ?>" name="pdfprnt_load_fonts" /> <span id="pdfprnt_font_loader" class="pdfprnt_loader"><img src="<?php echo plugins_url( '../images/ajax-loader.gif', __FILE__ ); ?>" alt="loader" /></span><br /> <input type="hidden" name="pdfprnt_action" value="pdfprnt_load_fonts" /> <input type="hidden" name="pdfprnt_ajax_nonce" value="<?php echo wp_create_nonce( 'pdfprnt_ajax_nonce' ); ?>" /> <div class="pdfprnt-additional-fonts-info"> <?php if ( 0 < $this->options['additional_fonts'] ) { ?> <div class="bws_info"><?php esc_html_e( 'Additional fonts were loaded successfully', 'pdf-print' ); ?>.</div> <?php } else { if ( -1 == $this->options['additional_fonts'] ) { ?> <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' ); ?> <a href="https://support.bestwebsoft.com/hc/en-us/articles/206693223" target="_blank"><?php esc_html_e( 'FAQ', 'pdf-print' ); ?></a>.</span><br /> <?php } ?> <div class="bws_info"><?php esc_html_e( 'Load additional fonts required for correct PDF file(-s) display.', 'pdf-print' ); ?></div> <?php } ?> </div> <?php } else { ?> <span style="color: red;"><strong><?php esc_html_e( 'WARNING', 'pdf-print' ); ?>: </strong><?php esc_html_e( 'ZipArchive Class is not installed on your server. It is impossible to load additional fonts.', 'pdf-print' ); ?></span> <?php } ?> </td> </tr> <tr id="pdfprnt_default_css_wrap"> <th><?php esc_html_e( 'Default CSS', 'pdf-print' ); ?></th> <td> <fieldset> <label> <input name="pdfprnt_use_default_css" type="checkbox" value="1" <?php checked( 1, $this->options['use_default_css'] ); ?> /> <span class="bws_info"><?php esc_html_e( 'Enable to apply CSS from the current theme. Disable to use default CSS.', 'pdf-print' ); ?></span> </label> </fieldset> </td> </tr> <tr id="pdfprnt_custom_css_wrap"> <th><?php esc_html_e( 'Custom CSS', 'pdf-print' ); ?></th> <td> <fieldset> <label> <input name="pdfprnt_use_custom_css" type="checkbox" value="1" <?php checked( 1, $this->options['use_custom_css'] ); ?> /> <span class="bws_info"><?php esc_html_e( 'Enable to add custom CSS code to documents.', 'pdf-print' ); ?></span> </label> <div id="pdfprnt_custom_css_code_wrap" <?php if ( 0 == $this->options['use_custom_css'] ) echo 'style="display: none;"'; ?>> <textarea id="pdfprnt_custom_css_code" name="pdfprnt_custom_css_code" maxlength="10000" cols="50" rows="5"><?php echo $this->options['custom_css_code']; ?></textarea> </div> </fieldset> </td> </tr> </table> <?php } /*pls */ public function tab_display() { ?> <h3 class="bws_tab_label"><?php esc_html_e( 'Display Settings', 'pdf-print' ); ?></h3> <?php $this->help_phrase(); ?> <hr> <?php $this->pro_block( 'fancytree_block' ); } /* display Custom Fields settings tab */ public function tab_custom_fields() { ?> <h3 class="bws_tab_label"><?php esc_html_e( 'Custom Fields Settings', 'pdf-print' ); ?></h3> <?php $this->help_phrase(); ?> <hr> <?php $this->pro_block( 'custom_fields_block' ); } /* pls*/ /** * Display custom metabox * @access public * @param void * @return array The action results */ public function display_metabox() { ?> <div class="postbox"> <h3 class="hndle"> <?php esc_html_e( 'PDF & Print Shortcode', 'pdf-print' ); ?> </h3> <div class="inside"> <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> </div> <div class="inside"> <?php esc_html_e( "Add PDF button to your posts or pages using the following shortcode:", 'pdf-print' ); ?> <?php bws_shortcode_output( "[bws_pdfprint display='pdf']" ); ?> </div> <div class="inside"> <?php esc_html_e( "Add Print button to your posts or pages using the following shortcode:", 'pdf-print' ); ?> <?php bws_shortcode_output( "[bws_pdfprint display='print']" ); ?> </div> <div class="inside"> <?php esc_html_e( "Add PDF & Print buttons to your posts or pages using the following shortcode:", 'pdf-print' ); ?> <?php bws_shortcode_output( "[bws_pdfprint display='pdf,print']" ); ?> </div> <div class="inside"> <?php esc_html_e( "Create a page break in PDF document:", 'pdf-print' ); ?> <?php bws_shortcode_output( '[bws_pdfprint_pagebreak]' ); ?> </div> </div> <?php } /* Display bws_pro_version block by its name */ public function pro_block( $block_name = '', $args = array(), $force = false ) { $block_name = 'pdfprnt_' . $block_name; if ( ( ! $this->hide_pro_tabs || $force ) && function_exists( $block_name ) ) { ?> <div class="bws_pro_version_bloc pdfprnt-pro-feature"> <div class="bws_pro_version_table_bloc"> <button type="submit" name="bws_hide_premium_options" class="notice-dismiss bws_hide_premium_options" title="<?php esc_html_e( 'Close', 'pdf-print' ); ?>"></button> <div class="bws_table_bg"></div> <div class="bws_pro_version"> <?php $block_name( $args ); ?> </div> </div> <?php $this->bws_pro_block_links(); ?> </div> <?php } } /** * Custom functions for "Upgrade the mPDF" * @access public */ public function upgrade_mpdf() { /* Disable block if mPDF 7 already installed */ $path = dirname( __FILE__ ); $upload_dir = wp_upload_dir(); $path = $upload_dir['basedir'] . '/vendor'; $is_installed = file_exists( $path ); if ( ! $is_installed || ! isset( $this->options['mpdf_library_version'] ) || $this->options['mpdf_library_version'] != $this->default_options['mpdf_library_version'] ) { ?> <table class="form-table"> <tbody> <tr> <th scope="row"><?php esc_html_e( 'Upgrade the mPDF library', 'pdf-print' ) ?></th> <td> <?php $is_class_exists = class_exists( 'ZipArchive' ); if ( $is_class_exists ) { $upgrade = esc_html__( 'Upgrade', 'pdf-print' ); ?> <input name="pdfprnt_upgrade_library" type="submit" class="button" value="<?php echo $upgrade ?>"> <span id="pdfprnt_library_loader" class="pdfprnt_loader"><img src="<?php echo plugins_url( '../images/ajax-loader.gif', __FILE__ ); ?>" alt="loader" /></span><br /> <input type="hidden" name="pdfprnt_action" value="pdfprnt_upgrade_library" /> <input type="hidden" name="pdfprnt_ajax_nonce" value="<?php echo wp_create_nonce( 'pdfprnt_ajax_nonce' ); ?>" /> <div class="bws_info"><?php printf( __( 'This will upgrade the mPDF library to version %s (recommended).', 'pdf-print' ), $this->default_options['mpdf_library_version'] ); ?></div> <?php } else { ?> <span style="color: red;"><strong><?php esc_html_e( 'WARNING', 'pdf-print' ); ?>: </strong><?php esc_html_e( 'ZipArchive сlass is not installed on your server. It is impossible to upgrade the mPDF library.', 'pdf-print' ); ?></span> <?php } ?> </td> </tr> </tbody> </table> <?php } } } }
cải xoăn