Plugin Directory

Changeset 3445804


Ignore:
Timestamp:
01/23/2026 08:13:40 PM (2 months ago)
Author:
bestwebsoft
Message:

"V2.4.6 - * New features added. "

Location:
pdf-print
Files:
760 added
5 edited

Legend:

Unmodified
Added
Removed
  • pdf-print/trunk/bws_menu/class-bws-settings.php

    r3391841 r3445804  
    388388                }
    389389                /* check demo data */
     390            } elseif ( isset( $_POST['bws_pro_reset_custom_code'] ) && check_admin_referer( $this->plugin_basename, 'bws_nonce_name' ) ) {
     391                $this->get_custom_code( true );
    390392            } else {
    391393                $demo_result = ! empty( $this->demo_data ) ? $this->demo_data->bws_handle_demo_data() : false;
     
    478480         * @access private
    479481         */
    480         private function get_custom_code() {
     482        private function get_custom_code( $flag_remove = false ) {
    481483            global $bstwbsftwppdtplgns_options, $wp_filesystem;
    482484
     
    508510                $file      = 'bws-custom-code.' . $extension;
    509511                $real_file = $folder . '/' . $file;
     512
     513                if ( true === $flag_remove && $wp_filesystem->exists( $real_file ) ) {
     514                    $wp_filesystem->delete( $real_file, false, 'f' );
     515                }
    510516
    511517                if ( $wp_filesystem->exists( $real_file ) ) {
     
    616622                        <div class="clear"></div>
    617623                    </div>
     624                </div>
     625                <div class="inline" style="margin-top: 15px;">
     626                    <input type="submit" class="button button-primary" name="bws_pro_reset_custom_code" value="<?php esc_html_e( 'Erase all custom code', 'bestwebsoft' ); ?>" />
    618627                </div>
    619628                <?php
  • pdf-print/trunk/includes/class-pdfprnt-settings.php

    r3391841 r3445804  
    381381                $this->options['replace_video'] = isset( $_POST['pdfprnt_replace_video'] ) ? 1 : 0;
    382382                $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;
    383384
    384385                /* PDF Page Size */
     
    566567                            </label><br />                             
    567568                        </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>                           
    568578                    </td>
    569579                </tr>
  • pdf-print/trunk/js/front-script.js

    r3391841 r3445804  
    22
    33/* Image of page to PDF */
    4 function imageToPdf() {
     4function imageToPdf( id = 0 ) {
    55    ( function( $ ) {
    66
    77        window.scrollTo( 0, 0 );
     8
     9        if ( '1' == pdfprnt_file_settings.count_generation ) {
     10            $.ajax( {
     11                url: pdfprnt_file_settings.ajaxurl,
     12                type: "POST",
     13                data: { action: 'pdfprnt_pdf_count', pdfprnt_ajax_nonce: pdfprnt_file_settings.ajax_nonce, id: id },
     14                success: function() {
     15                }
     16            } );
     17        }
    818
    919        var deferreds = [];
  • pdf-print/trunk/pdf-print.php

    r3391841 r3445804  
    77Text Domain: pdf-print
    88Domain Path: /languages
    9 Version: 2.4.5
     9Version: 2.4.6
    1010Author URI: https://bestwebsoft.com/
    1111License: GPLv2 or later
     
    297297            'mpdf_library_version'   => '8.2.6',
    298298            'hide_classes'           => array(),
     299            'count_generation'       => 0,
    299300        );
    300301
     
    433434            }
    434435        }
     436        if ( 1 === $pdfprnt_options['count_generation'] ) {
     437            $post_type = get_post_type();
     438            if ( in_array( $post_type, $pdfprnt_options['button_post_types']['pdf'] ) || in_array( $post_type, $pdfprnt_options['button_post_types']['print'] ) ) {
     439                $count = get_post_meta( get_the_ID(), 'pdfprnt_count_generation', true );
     440                $buttons .= ' <span class="pdfprnt-count-generation">' . $count . '</span>';
     441            }
     442        }
    435443        if ( ! empty( $buttons ) ) {
    436444            $buttons = sprintf(
     
    611619            '';
    612620        if ( $pdfprnt_options['image_to_pdf'] && 'pdf' === $custom_query_arg ) {
    613             $url    = 'javascript: imageToPdf()';
     621            $url    = 'javascript: imageToPdf(' . get_the_ID() . ')';
    614622            $target = '_self';
    615623        }
     
    621629       
    622630        $link = sprintf(
    623             '<a href="%s" class="pdfprnt-button pdfprnt-button-%s" target="%s">%s%s</a>',
     631            '<a href="%s" class="pdfprnt-button pdfprnt-button-%s" target="%s" >%s%s</a>',
    624632            $url,
    625633            $button,
     
    684692            if ( $show_button_print ) {
    685693                $str .= pdfprnt_get_button( 'print', $permalink );
     694            }
     695            if ( 1 === $pdfprnt_options['count_generation'] ) {
     696                $post_type = get_post_type();
     697                if ( in_array( $post_type, $pdfprnt_options['button_post_types']['pdf'] ) || in_array( $post_type, $pdfprnt_options['button_post_types']['print'] ) ) {
     698                    $count = get_post_meta( get_the_ID(), 'pdfprnt_count_generation', true );
     699                    $str .= ' <span class="pdfprnt-count-generation">' . $count . '</span>';
     700                }
    686701            }
    687702            $str .= '</div>';
     
    10291044        if ( $show_button_print ) {
    10301045            $str .= pdfprnt_get_button( 'print', $current_url, $print_query_parameter );
     1046        }
     1047        if ( 1 === $pdfprnt_options['count_generation'] && ( $show_button_pdf || $show_button_print ) ) {
     1048            $count = get_post_meta( get_the_ID(), 'pdfprnt_count_generation', true );
     1049            $str .= ' <span class="pdfprnt-count-generation">' . $count . '</span>';
    10311050        }
    10321051        $str .= '</div>';
     
    11241143            wp_enqueue_script( 'html2canvas.js', plugins_url( 'js/html2canvas.js', __FILE__ ), array(), $pdfprnt_plugin_info['Version'], false );
    11251144            wp_enqueue_script( 'jspdf.js', plugins_url( 'js/jspdf.js', __FILE__ ), array(), $pdfprnt_plugin_info['Version'], false );
    1126             wp_enqueue_script( 'pdfprnt_front_script', plugins_url( 'js/front-script.js', __FILE__ ), array( 'jquery', 'html2canvas.js', 'jspdf.js' ), $pdfprnt_plugin_info['Version'], false );
     1145            wp_enqueue_script( 'pdfprnt_front_script', plugins_url( 'js/front-script.js', __FILE__ ), array( 'jquery', 'html2canvas.js', 'jspdf.js' ), $pdfprnt_plugin_info['Version'] . '.7', false );
    11271146            wp_localize_script(
    11281147                'pdfprnt_front_script',
    11291148                'pdfprnt_file_settings',
    11301149                array(
    1131                     'margin_left'   => $pdfprnt_options['pdf_margins']['left'],
    1132                     'margin_right'  => $pdfprnt_options['pdf_margins']['right'],
    1133                     'margin_top'    => $pdfprnt_options['pdf_margins']['top'],
    1134                     'margin_bottom' => $pdfprnt_options['pdf_margins']['bottom'],
    1135                     'page_size'     => $pdfprnt_options['pdf_page_size'],
    1136                     'file_action'   => $pdfprnt_options['file_action'],
    1137                     'file_name'     => $file_name,
    1138                     'hide_classes'  => implode( ', ', $pdfprnt_options['hide_classes'] ),
     1150                    'margin_left'      => $pdfprnt_options['pdf_margins']['left'],
     1151                    'margin_right'     => $pdfprnt_options['pdf_margins']['right'],
     1152                    'margin_top'       => $pdfprnt_options['pdf_margins']['top'],
     1153                    'margin_bottom'    => $pdfprnt_options['pdf_margins']['bottom'],
     1154                    'page_size'        => $pdfprnt_options['pdf_page_size'],
     1155                    'file_action'      => $pdfprnt_options['file_action'],
     1156                    'file_name'        => $file_name,
     1157                    'hide_classes'     => implode( ', ', $pdfprnt_options['hide_classes'] ),
     1158                    'ajax_nonce'       => wp_create_nonce( 'pdfprnt_ajax_nonce' ),
     1159                    'ajaxurl'          => admin_url( 'admin-ajax.php' ),
     1160                    'count_generation' => $pdfprnt_options['count_generation']
    11391161                )
    11401162            );
     
    13451367            if ( ! is_home() ) {
    13461368                $posts = array( $post );
     1369                $count_generation = get_post_meta( $post->ID, 'pdfprnt_count_generation', true );
     1370                update_post_meta( $post->ID, 'pdfprnt_count_generation', (int) ++$count_generation );
    13471371            }
    13481372        }
     
    19121936            return $result;
    19131937        }
     1938    }
     1939}
     1940
     1941if ( ! function_exists( 'pdfprnt_pdf_count' ) ) {
     1942    /**
     1943     * Function to update pdf count generation
     1944     */
     1945    function pdfprnt_pdf_count() {
     1946        global $pdfprnt_options;
     1947        if ( empty( $pdfprnt_options ) ) {
     1948            $pdfprnt_options = get_option( 'pdfprnt_options' );
     1949        }
     1950        if ( 1 === $pdfprnt_options['count_generation'] ) {
     1951            $verified    = isset( $_REQUEST['pdfprnt_ajax_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['pdfprnt_ajax_nonce'] ) ), 'pdfprnt_ajax_nonce' ) ? true : false;
     1952            if ( true === $verified && isset( $_REQUEST['id'] ) ) {
     1953                $count_generation = get_post_meta( intval( $_REQUEST['id'] ), 'pdfprnt_count_generation', true );
     1954                update_post_meta( intval( $_REQUEST['id'] ), 'pdfprnt_count_generation', (int) ++$count_generation );
     1955            }
     1956        }
     1957        wp_die();
    19141958    }
    19151959}
     
    21272171/* load mPDF library */
    21282172add_action( 'wp_ajax_pdfprnt_upgrade_library', 'pdfprnt_upgrade_library' );
     2173add_action( 'wp_ajax_pdfprnt_pdf_count', 'pdfprnt_pdf_count' );
     2174add_action( 'wp_ajax_nopriv_pdfprnt_pdf_count', 'pdfprnt_pdf_count' );
    21292175/* Adding banner */
    21302176add_action( 'admin_notices', 'pdfprnt_plugin_banner' );
  • pdf-print/trunk/readme.txt

    r3391841 r3445804  
    44Tags: generate pdf, add pdf button, add print button, pdf plugin, pdf pages, print pages, generate pdf content, generate post pdf, pdf print, pdf print plugin, pdf custom post type, pdf content
    55Requires at least: 6.2
    6 Tested up to: 6.8.3
    7 Stable tag: 2.4.5
     6Tested up to: 6.9
     7Stable tag: 2.4.6
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3838* Add buttons to widget area
    3939* Add buttons via shortcode
     40* Display count of PDF/Print generation
    4041* Set button type:
    4142    * Image
     
    9596>   * Portrait
    9697>   * Landscape
     98> * Display featured image with shortcode
     99> * Display count of PDF/Print generation in admin posts table
    97100> * Set custom images for buttons
    98101> * Disable PDF & Print buttons for certain pages and/or post types
     
    102105> * Change default PDF file name
    103106> * Send PDF as email
     107> * Add custom code via plugin settings page
    104108> * Prevent search engines from indexing links in documents
    105 > * Add custom code via plugin settings page
    106109> * Configure all subsites on the network
    107110> * Get answer to your support question within one business day ([Support Policy](https://bestwebsoft.com/support-policy/))
     
    360363
    361364== Changelog ==
     365
     366= V2.4.6 - 23.01.2026 =
     367* Update : All functionality was updated for WordPress 6.9.
     368* NEW : Count of PDF/Print generation.
     369* Pro : Featured image shortcode has been added.
     370* Update : BWS Panel section update.
    362371
    363372= V2.4.5 - 07.11.2025 =
     
    704713== Upgrade Notice ==
    705714
     715= V2.4.6 =
     716* New features added.
     717* The compatibility with new WordPress version updated.
     718
    706719= V2.4.5 =
    707720* New features added.
Note: See TracChangeset for help on using the changeset viewer.