Plugin Directory

Changeset 3356768


Ignore:
Timestamp:
09/05/2025 02:57:13 PM (6 months ago)
Author:
littlepackage
Message:

update to versioni 4.0.4

Location:
waterwoo-pdf/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • waterwoo-pdf/trunk/classes/wwpdf-file-handler.php

    r3334629 r3356768  
    1010     * @var string
    1111     */
    12     private $watermarked_file;
     12    private $watermarked_file = '';
    1313
    1414    /**
    1515     * @var string
    1616     */
    17     protected $email;
     17    protected $email = '';
    1818
    1919    /**
     
    2121     */
    2222    public function __construct() {
    23 
    24         $this->watermarked_file = '';
    2523
    2624        // Filter the file download path - WooCommerce
     
    168166        $file_array = apply_filters( 'wwpdf_filter_file_list', array_filter( array_map( 'trim', explode( PHP_EOL, $file_list ) ) ), $args );
    169167        $file_listed = in_array( $requested_filename, $file_array );
     168        $this->email = $args['email'] ?? '';
    170169
    171170        if ( ( $global_on == true && $file_listed ) || ( $global_on == false && ! $file_listed ) ) {
     
    585584
    586585        } elseif ( ( ! isset( $parsed_file_path['scheme'] ) || ! in_array( $parsed_file_path['scheme'], [ 'http', 'https', 'ftp' ], true ) )
    587                    && isset( $parsed_file_path['path'] )
     586            && isset( $parsed_file_path['path'] )
    588587        ) { // We have an absolute path
    589588            $remote_file = false;
  • waterwoo-pdf/trunk/classes/wwpdf-settings-edd.php

    r3334629 r3356768  
    363363                    'id'        => 'eddimark_pw',
    364364                    'name'      => __( 'User Password (optional)', 'waterwoo-pdf' ),
    365                     'desc'      => '<br>' . __( 'This is a password your end user will need to enter before viewing the PDF file.', 'waterwoo-pdf' )
    366                                    . '<br>' . __( 'Enter <code>email</code> to set the password automagically as the user\'s checkout email address.', 'waterwoo-pdf' ),
    367                     'type'      => 'text',
     365                    'desc'      => '<br>' . __( 'This is a password your end user will need to enter before viewing the PDF file.', 'waterwoo-pdf' ),
     366                    'type'      => 'text',
    368367                    'std'       => '',
    369368                ],
  • waterwoo-pdf/trunk/classes/wwpdf-settings-woo.php

    r3334629 r3356768  
    485485                        'type'     => 'text',
    486486                        'title'    => __( 'User Password (optional)', 'waterwoo-pdf' ),
    487                         'desc'     => __( 'This is a password your end user will need to enter before viewing the PDF file.', 'waterwoo-pdf' )
    488                                       . '<br>' . __( 'Enter <code>email</code> to set the password automagically as the user\'s checkout email address.', 'waterwoo-pdf' ),
    489                         'autoload' => false,
     487                        'desc'     => __( 'This is a password your end user will need to enter before viewing the PDF file.', 'waterwoo-pdf' ),
     488                        'autoload' => false,
    490489                    ],
    491490                [
  • waterwoo-pdf/trunk/classes/wwpdf-watermark.php

    r3334629 r3356768  
    5252        // for more styling, and marking chosen pages)
    5353        // please support the work of WordPress developers
    54         // and buy the full version of this plugin at www.pdfink.com!
     54        // and buy the full version of this plugin at ** www.pdfink.com! **
    5555        $pagecount = $this->pdf->setSourceFile( $this->origfile );
    5656
    5757        if ( ! $pagecount ) {
    58             throw new Exception( 'Unable to parse PDF into memory, possibly due to a PDF version >= 2.0' );
     58            throw new Exception( 'Unable to parse PDF into memory, possibly due to a PDF version >= 2.0, or incrementation, or a syntax issue.' );
    5959        }
    6060
     
    178178
    179179        // Passwording
    180         $pwd_enabled = false;
    181180        $user_pwd = $this->settings['password'] ?? '';
    182         if ( ! empty( $user_pwd ) ) {
    183             if ( 'email' === $user_pwd ) {
    184                 $user_pwd = sanitize_email( $this->email );
    185             }
    186             if ( ! empty( $user_pwd ) ) { // if still valid after sanitization
    187                 $pwd_enabled = true;
    188             }
    189         }
    190181
    191182        // Adding file protections in this list removes them
     
    207198        // Higher encryption allows selective blocking blocking of 'extract', 'fill-forms', 'assemble', and 'print-high'
    208199        // Get these protections with higher encryption by using PDF Ink (pdfink.com)
    209         if ( $pwd_enabled || array_filter( $permissions ) ) {
     200        if ( ! empty( $user_pwd ) || array_filter( $permissions ) ) {
    210201            $this->pdf->SetProtection(
    211202                $permissions,
  • waterwoo-pdf/trunk/lib/tcpdi/tcpdi.php

    r3315732 r3356768  
    123123        }
    124124
    125         $currentFilename = $this->current_filename;
    126         $currentParser = $this->current_parser;
     125        $currentFilename = $this->current_filename ?? '';
     126        $currentParser = $this->current_parser ?? '';
    127127
    128128        try {
  • waterwoo-pdf/trunk/lib/tcpdi/tcpdi_parser.php

    r3334629 r3356768  
    44// Version      : 1.2
    55// Begin        : 2024-10-18
    6 // Last Update  : 2025-02-28
     6// Last Update  : 2025-07-11
    77// Author       : Little Package - https://github.com/littlepackage
    88// License      : GNU-LGPL v3 (https://www.gnu.org/licenses/lgpl-3.0.en.html)
     
    249249            $this->pdfdata = $data;
    250250        }
    251         // error_log( '$pdf_data: ' . print_r( str_replace("\x00", "[NULL]", $data ), true ) );
    252251
    253252        // initialize class for decoding filters
     
    469468        $obj_num = 0;
    470469        $offset  = $xoffset;
    471         // @todo the [.|\W?] syntax seems wrong. (Originally it was [.?|\W?] which is more wrong.)
    472         while (preg_match('/^[.|\W?]([0-9]+)[\s]([0-9]+)[\s]?([nf]?)/im', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) {
     470        while (preg_match('/^[.\W?]([0-9]+)[\s]([0-9]+)[\s]?([nf]?)/im', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) {
    473471        // while ( preg_match('/^([0-9]+)[\s]([0-9]+)[\s]?([nf]?)/im', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0 ) {
    474472            $offset = ( strlen( $matches[0][0] ) + $matches[0][1] );
     
    588586        foreach ( $keys as $key ) {
    589587            $v = $sarr[ $key ];
    590             if ( ( $key == '/Type' ) && ( $v[0] == PDF_TYPE_TOKEN && ( $v[1] == 'XRef' ) ) ) {
     588            if ( $key === '/Type' && ( $v[0] == PDF_TYPE_TOKEN && ( $v[1] == 'XRef' ) ) ) {
    591589                $valid_crs = true;
    592                 // } elseif ( ( $key == '/Index' ) && ( $v[0] == PDF_TYPE_ARRAY && count( $v[1] >= 2 ) ) ) {
    593             } elseif ( ( $key == '/Index' ) && ( $v[0] == PDF_TYPE_ARRAY && count( $v[1] ) >= 2 ) ) {
     590            } elseif ( $key === '/Index' && ( $v[0] == PDF_TYPE_ARRAY && count( $v[1] ) >= 2 ) ) {
    594591                // first object number in the subsection
    595592                $index_first = intval( $v[1][0][1] );
    596593                // number of entries in the subsection
    597594                // $index_entries = intval( $v[1][1][1] );
    598             } elseif ( ( $key == '/Prev' ) && ( $v[0] == PDF_TYPE_NUMERIC ) ) {
     595            } elseif ( $key === '/Prev' && $v[0] == PDF_TYPE_NUMERIC ) {
    599596                // get previous xref offset
    600597                $prevxref = intval( $v[1] );
    601             } elseif ( ( $key == '/W' ) && ( $v[0] == PDF_TYPE_ARRAY ) ) {
     598            } elseif ( $key === '/W' && $v[0] == PDF_TYPE_ARRAY ) {
    602599                // number of bytes (in the decoded stream) of the corresponding field
    603600                $wb = [];
     
    605602                $wb[1] = intval( $v[1][1][1] );
    606603                $wb[2] = intval( $v[1][2][1] );
    607             } elseif ( ( $key == '/DecodeParms' ) && ( $v[0] == PDF_TYPE_DICTIONARY ) ) {
     604            } elseif ( $key === '/DecodeParms' && $v[0] == PDF_TYPE_DICTIONARY ) {
    608605                $decpar = $v[1];
    609606                foreach ( $decpar as $kdc => $vdc ) {
    610                     if ( ( $kdc == '/Columns' ) && ( $vdc[0] == PDF_TYPE_NUMERIC ) ) {
     607                    if ( $kdc === '/Columns' && $vdc[0] == PDF_TYPE_NUMERIC ) {
    611608                        $columns = intval( $vdc[1] );
    612                     } elseif ( ( $kdc == '/Predictor' ) && ( $vdc[0] == PDF_TYPE_NUMERIC ) ) {
     609                    } elseif ( $kdc === '/Predictor' && $vdc[0] == PDF_TYPE_NUMERIC ) {
    613610                        $predictor = intval( $vdc[1] );
    614611                    }
     
    817814        // skip initial white space (control) chars: \x00 null (NUL), \x09 horizontal tab (HT), \x0A line feed (LF), \x0C form feed (FF), \x0D carriage return (CR), \x20 space (SP)
    818815        $offset += strspn($data, "\x00\x09\x0a\x0c\x0d\x20", $offset);
    819 
    820         // tcpdi_parser can really get stuck here if char is null or otherwise; bail
    821816        if ( ! isset( $data[ $offset ] ) ) {
    822817            return;
     
    14781473            return false;
    14791474        }
    1480         $obj = $this->getObjectVal( $obj ); // @todo is this redundant?
    14811475
    14821476        /**
     
    16601654        $boxes = [];
    16611655
    1662         // @todo if all boxes are the same, should we give them all or just stick to CropBox or BleedBox only?
    16631656        foreach ( $this->availableBoxes as $box ) {
    16641657            if ( $_box = $this->getPageBox( $page, $box, $k ) ) {
  • waterwoo-pdf/trunk/readme.txt

    r3334629 r3356768  
    66Tested up to: 6.8
    77Requires PHP: 7.2
    8 Stable tag: 4.0.3
     8Stable tag: 4.0.4
    99License: GPLv3 or later
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    201201== Changelog ==
    202202
     203= 4.0.4 - 4 September 2025 =
     204* Fix for new email as password feature
     205* Bump minimum WC version to 6.5 (to match plugin PHP 7.2 requirement)
     206
    203207= 4.0.3 - 26 July 2025 =
    204208* Tweak for TCPDI parser to reach more PDFs
  • waterwoo-pdf/trunk/waterwoo-pdf.php

    r3334629 r3356768  
    44 * Plugin URI: https://wordpress.org/plugins/waterwoo-pdf/
    55 * Description: Custom watermark your PDF files upon WooCommerce, Download Monitor, and Easy Digital Download customer download. Since 2014. FKA "WaterWoo"
    6  * Version: 4.0.3
     6 * Version: 4.0.4
    77 * Author: Little Package
    88 * Author URI: https://pdfink.com/
    99 * Donate link: https://paypal.me/littlepackage
    10  * WC requires at least: 4.0
    11  * WC tested up to: 10.0
     10 * WC requires at least: 6.5
     11 * WC tested up to: 10.1
    1212 *
    1313 * License: GPLv3 or later
     
    5050
    5151if ( ! defined( 'WWPDF_FREE_VERSION' ) ) {
    52     define( 'WWPDF_FREE_VERSION', '4.0.3' );
     52    define( 'WWPDF_FREE_VERSION', '4.0.4' );
    5353}
    5454
    5555if ( ! defined( 'WWPDF_FREE_MIN_PHP' ) ) {
    56     define( 'WWPDF_FREE_MIN_PHP', '7.0' );
     56    define( 'WWPDF_FREE_MIN_PHP', '7.4' );
    5757}
    5858
Note: See TracChangeset for help on using the changeset viewer.