Print, PDF, Email by PrintFriendly - Version 4.2

Version Description

  • Fix: jQuery.fn.load() is deprecated
  • Fix: Specific categories do not accept more than one entry
  • Tested against WP 5.8
Download this release

Release Info

Developer printfriendly
Plugin Icon 128x128 Print, PDF, Email by PrintFriendly
Version 4.2
Comparing to
See all releases

Code changes from version 4.1 to 4.2

assets/css/admin.css CHANGED
@@ -45,7 +45,7 @@ input[type="radio"], img {
45
  }
46
  select{
47
  display: block;
48
- margin: .5em .5em 2em 0;
49
  }
50
  select#javascript, select#website_protocol, select#password_protected, select#dynamic_content {
51
  display: inline-block;
@@ -274,8 +274,13 @@ ol {
274
  display: none;
275
  }
276
 
 
 
 
 
277
  /** override bulma styles **/
278
 
279
  .pf-regular-text {
280
  width: 25em !important;
281
  }
 
45
  }
46
  select{
47
  display: block;
48
+ margin: .5em .5em .5em 0;
49
  }
50
  select#javascript, select#website_protocol, select#password_protected, select#dynamic_content {
51
  display: inline-block;
274
  display: none;
275
  }
276
 
277
+ p.description {
278
+ margin: 0 0 2em 0;
279
+ }
280
+
281
  /** override bulma styles **/
282
 
283
  .pf-regular-text {
284
  width: 25em !important;
285
  }
286
+
assets/js/admin.js CHANGED
@@ -4,7 +4,7 @@
4
  initAll();
5
  });
6
 
7
- $(window).load(function() {
8
  // load the tab from where the settings was saved.
9
  $('#pf-tabs .pf-bu-tabs li[data-id="' + $('#current-tab').val() + '"]').trigger('click');
10
  });
4
  initAll();
5
  });
6
 
7
+ $(window).on('load', function() {
8
  // load the tab from where the settings was saved.
9
  $('#pf-tabs .pf-bu-tabs li[data-id="' + $('#current-tab').val() + '"]').trigger('click');
10
  });
languages/printfriendly.pot CHANGED
@@ -2,103 +2,103 @@
2
  # This file is distributed under the same license as the Print, PDF & Email by PrintFriendly package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Print, PDF & Email by PrintFriendly 4.0.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-printfriendly\n"
7
- "POT-Creation-Date: 2021-02-12 06:27:07+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
  "Last-Translator: PrintFriendly Translate Team <support@printfriendly.com>\n"
12
  "Language-Team: PrintFriendly Translate Team <support@printfriendly.com>\n"
13
 
14
- #: pf.php:518
15
  msgid ""
16
  "No valid custom image url received, please enter a valid url to use a "
17
  "custom image."
18
  msgstr ""
19
 
20
- #: pf.php:526
21
  msgid "The text size you entered is invalid, please stay between 9px and 25px"
22
  msgstr ""
23
 
24
- #: pf.php:534
25
  msgid ""
26
  "The color you entered is not valid, it must be a valid hexadecimal RGB font "
27
  "color."
28
  msgstr ""
29
 
30
- #: pf.php:594
31
  msgid ""
32
  "No valid custom logo url received, please enter a valid url to use a custom "
33
  "logo."
34
  msgstr ""
35
 
36
- #: pf.php:665
37
  msgid "PrintFriendly Options"
38
  msgstr ""
39
 
40
- #: pf.php:665
41
  msgid "Print Friendly & PDF"
42
  msgstr ""
43
 
44
- #: pf.php:695 views/tabs.php:270
45
  msgid "Custom Image"
46
  msgstr ""
47
 
48
- #: pf.php:696
49
  msgid "Use Image"
50
  msgstr ""
51
 
52
- #: pf.php:697
53
  msgid "Invalid Image URL"
54
  msgstr ""
55
 
56
- #: pf.php:709
57
  msgid "Activation"
58
  msgstr ""
59
 
60
- #: pf.php:710
61
  msgid "Checking status"
62
  msgstr ""
63
 
64
- #: pf.php:711 views/pro.php:45
65
  msgid "Activate"
66
  msgstr ""
67
 
68
- #: pf.php:712
69
  msgid "Active Trial"
70
  msgstr ""
71
 
72
- #: pf.php:713
73
  msgid "Active"
74
  msgstr ""
75
 
76
- #: pf.php:714
77
  msgid "Expired"
78
  msgstr ""
79
 
80
- #: pf.php:715
81
  msgid "Please check Internet connection."
82
  msgstr ""
83
 
84
- #: pf.php:743
85
  msgid "Settings"
86
  msgstr ""
87
 
88
- #: pf.php:766 views/tabs.php:37 views/tabs.php:234 views/tabs.php:311
89
- #: views/tabs.php:365 views/tabs.php:397
90
  msgid "Documentation"
91
  msgstr ""
92
 
93
- #: pf.php:1112 views/tabs.php:93
94
  msgid "Custom Button"
95
  msgstr ""
96
 
97
- #: pf.php:1293
98
  msgid "Only display when post is in:"
99
  msgstr ""
100
 
101
- #: pf.php:1385
102
  msgid ""
103
  "You are currently using %1$s%2$s%3$s. You can copy copy its contents into "
104
  "the textbox if you want to update the styles."
@@ -108,7 +108,7 @@ msgstr ""
108
  msgid "Learn more"
109
  msgstr ""
110
 
111
- #: views/pro.php:30 views/tabs.php:405
112
  msgid "Email"
113
  msgstr ""
114
 
@@ -348,11 +348,11 @@ msgstr ""
348
  msgid "Specific categories to show on"
349
  msgstr ""
350
 
351
- #: views/tabs.php:241 views/tabs.php:489
352
  msgid "Save Options"
353
  msgstr ""
354
 
355
- #: views/tabs.php:242 views/tabs.php:490
356
  msgid "Cancel"
357
  msgstr ""
358
 
@@ -368,133 +368,155 @@ msgstr ""
368
  msgid "Tagline (optional)"
369
  msgstr ""
370
 
371
- #: views/tabs.php:319
372
- msgid "Password Protected Content"
373
  msgstr ""
374
 
375
- #: views/tabs.php:325 views/tabs.php:345
 
 
 
 
376
  msgid "No"
377
  msgstr ""
378
 
379
- #: views/tabs.php:326 views/tabs.php:344
380
  msgid "Yes"
381
  msgstr ""
382
 
383
- #: views/tabs.php:331
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  msgid "This feature requires a Pro subscription."
385
  msgstr ""
386
 
387
- #: views/tabs.php:331
388
  msgid "Learn More"
389
  msgstr ""
390
 
391
- #: views/tabs.php:338
392
  msgid "Track in Google Analytics"
393
  msgstr ""
394
 
395
- #: views/tabs.php:353
396
  msgid "Click-to-delete"
397
  msgstr ""
398
 
399
- #: views/tabs.php:359 views/tabs.php:411 views/tabs.php:426 views/tabs.php:446
400
  msgid "Allow"
401
  msgstr ""
402
 
403
- #: views/tabs.php:360 views/tabs.php:412 views/tabs.php:427 views/tabs.php:447
404
  msgid "Not Allow"
405
  msgstr ""
406
 
407
- #: views/tabs.php:373
408
  msgid "Images"
409
  msgstr ""
410
 
411
- #: views/tabs.php:378
412
  msgid "Image size"
413
  msgstr ""
414
 
415
- #: views/tabs.php:380
416
  msgid "Full Size"
417
  msgstr ""
418
 
419
- #: views/tabs.php:381
420
  msgid "Large"
421
  msgstr ""
422
 
423
- #: views/tabs.php:382
424
  msgid "Medium"
425
  msgstr ""
426
 
427
- #: views/tabs.php:383
428
  msgid "Small"
429
  msgstr ""
430
 
431
- #: views/tabs.php:384
432
  msgid "Remove Images"
433
  msgstr ""
434
 
435
- #: views/tabs.php:387
436
  msgid "Image style"
437
  msgstr ""
438
 
439
- #: views/tabs.php:389
440
  msgid "Align Right"
441
  msgstr ""
442
 
443
- #: views/tabs.php:390
444
  msgid "Align Left"
445
  msgstr ""
446
 
447
- #: views/tabs.php:391
448
  msgid "Align None"
449
  msgstr ""
450
 
451
- #: views/tabs.php:392
452
  msgid "Center/Block"
453
  msgstr ""
454
 
455
- #: views/tabs.php:420
456
  msgid "PDF"
457
  msgstr ""
458
 
459
- #: views/tabs.php:432
460
  msgid "Developer Note"
461
  msgstr ""
462
 
463
- #: views/tabs.php:432
464
  msgid ""
465
  "On localhost the images can not be included in the PDF. Once the website is "
466
  "live/public images will be included in the PDF."
467
  msgstr ""
468
 
469
- #: views/tabs.php:440
470
  msgid "Print"
471
  msgstr ""
472
 
473
- #: views/tabs.php:455
474
  msgid "Custom CSS"
475
  msgstr ""
476
 
477
- #: views/tabs.php:462
478
  msgid "Custom CSS URL"
479
  msgstr ""
480
 
481
- #: views/tabs.php:477
482
  msgid ""
483
  "Customize the styles of the printed/pdf page using your own CSS. Create "
484
  "your custom CSS, and put the URL to your Custom CSS file in the box above"
485
  msgstr ""
486
 
487
- #: views/tabs.php:479
488
  msgid ""
489
  "Customize the styles of the printed/pdf page using your own CSS. Add your "
490
  "custom CSS (without the %s tags) in the box above"
491
  msgstr ""
492
 
493
- #: views/tabs.php:504
494
  msgid "Debug options"
495
  msgstr ""
496
 
497
- #: views/tabs.php:513
498
  msgid "Currently in Debug Mode. This tab is visible in debug mode only"
499
  msgstr ""
500
 
2
  # This file is distributed under the same license as the Print, PDF & Email by PrintFriendly package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Print, PDF & Email by PrintFriendly 4.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-printfriendly\n"
7
+ "POT-Creation-Date: 2021-04-14 03:55:32+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
  "Last-Translator: PrintFriendly Translate Team <support@printfriendly.com>\n"
12
  "Language-Team: PrintFriendly Translate Team <support@printfriendly.com>\n"
13
 
14
+ #: pf.php:519
15
  msgid ""
16
  "No valid custom image url received, please enter a valid url to use a "
17
  "custom image."
18
  msgstr ""
19
 
20
+ #: pf.php:527
21
  msgid "The text size you entered is invalid, please stay between 9px and 25px"
22
  msgstr ""
23
 
24
+ #: pf.php:535
25
  msgid ""
26
  "The color you entered is not valid, it must be a valid hexadecimal RGB font "
27
  "color."
28
  msgstr ""
29
 
30
+ #: pf.php:595
31
  msgid ""
32
  "No valid custom logo url received, please enter a valid url to use a custom "
33
  "logo."
34
  msgstr ""
35
 
36
+ #: pf.php:669
37
  msgid "PrintFriendly Options"
38
  msgstr ""
39
 
40
+ #: pf.php:669
41
  msgid "Print Friendly & PDF"
42
  msgstr ""
43
 
44
+ #: pf.php:699 views/tabs.php:270
45
  msgid "Custom Image"
46
  msgstr ""
47
 
48
+ #: pf.php:700
49
  msgid "Use Image"
50
  msgstr ""
51
 
52
+ #: pf.php:701
53
  msgid "Invalid Image URL"
54
  msgstr ""
55
 
56
+ #: pf.php:713
57
  msgid "Activation"
58
  msgstr ""
59
 
60
+ #: pf.php:714
61
  msgid "Checking status"
62
  msgstr ""
63
 
64
+ #: pf.php:715 views/pro.php:45
65
  msgid "Activate"
66
  msgstr ""
67
 
68
+ #: pf.php:716
69
  msgid "Active Trial"
70
  msgstr ""
71
 
72
+ #: pf.php:717
73
  msgid "Active"
74
  msgstr ""
75
 
76
+ #: pf.php:718
77
  msgid "Expired"
78
  msgstr ""
79
 
80
+ #: pf.php:719
81
  msgid "Please check Internet connection."
82
  msgstr ""
83
 
84
+ #: pf.php:747
85
  msgid "Settings"
86
  msgstr ""
87
 
88
+ #: pf.php:770 views/tabs.php:37 views/tabs.php:234 views/tabs.php:311
89
+ #: views/tabs.php:374 views/tabs.php:406
90
  msgid "Documentation"
91
  msgstr ""
92
 
93
+ #: pf.php:1117 views/tabs.php:93
94
  msgid "Custom Button"
95
  msgstr ""
96
 
97
+ #: pf.php:1302
98
  msgid "Only display when post is in:"
99
  msgstr ""
100
 
101
+ #: pf.php:1394
102
  msgid ""
103
  "You are currently using %1$s%2$s%3$s. You can copy copy its contents into "
104
  "the textbox if you want to update the styles."
108
  msgid "Learn more"
109
  msgstr ""
110
 
111
+ #: views/pro.php:30 views/tabs.php:414
112
  msgid "Email"
113
  msgstr ""
114
 
348
  msgid "Specific categories to show on"
349
  msgstr ""
350
 
351
+ #: views/tabs.php:241 views/tabs.php:498
352
  msgid "Save Options"
353
  msgstr ""
354
 
355
+ #: views/tabs.php:242 views/tabs.php:499
356
  msgid "Cancel"
357
  msgstr ""
358
 
368
  msgid "Tagline (optional)"
369
  msgstr ""
370
 
371
+ #: views/tabs.php:318
372
+ msgid "Pro Exclusive Features"
373
  msgstr ""
374
 
375
+ #: views/tabs.php:323
376
+ msgid "Encode images"
377
+ msgstr ""
378
+
379
+ #: views/tabs.php:325 views/tabs.php:332 views/tabs.php:354
380
  msgid "No"
381
  msgstr ""
382
 
383
+ #: views/tabs.php:326 views/tabs.php:333 views/tabs.php:353
384
  msgid "Yes"
385
  msgstr ""
386
 
387
+ #: views/tabs.php:328
388
+ msgid ""
389
+ "Select \"Yes\" if your site is not publicly accessible or if your provider "
390
+ "blocks image requests from third parties (Ex. Zendesk) or if images are not "
391
+ "present in PDF"
392
+ msgstr ""
393
+
394
+ #: views/tabs.php:330
395
+ msgid "Show Hidden Content"
396
+ msgstr ""
397
+
398
+ #: views/tabs.php:335
399
+ msgid ""
400
+ "By default PrintFriendly Pro will only show the visible content on the "
401
+ "page. Select \"Yes\", if you want PrintFriendly to show hidden content. "
402
+ "(Ex. Content in hidden tabs)"
403
+ msgstr ""
404
+
405
+ #: views/tabs.php:340
406
  msgid "This feature requires a Pro subscription."
407
  msgstr ""
408
 
409
+ #: views/tabs.php:340
410
  msgid "Learn More"
411
  msgstr ""
412
 
413
+ #: views/tabs.php:347
414
  msgid "Track in Google Analytics"
415
  msgstr ""
416
 
417
+ #: views/tabs.php:362
418
  msgid "Click-to-delete"
419
  msgstr ""
420
 
421
+ #: views/tabs.php:368 views/tabs.php:420 views/tabs.php:435 views/tabs.php:455
422
  msgid "Allow"
423
  msgstr ""
424
 
425
+ #: views/tabs.php:369 views/tabs.php:421 views/tabs.php:436 views/tabs.php:456
426
  msgid "Not Allow"
427
  msgstr ""
428
 
429
+ #: views/tabs.php:382
430
  msgid "Images"
431
  msgstr ""
432
 
433
+ #: views/tabs.php:387
434
  msgid "Image size"
435
  msgstr ""
436
 
437
+ #: views/tabs.php:389
438
  msgid "Full Size"
439
  msgstr ""
440
 
441
+ #: views/tabs.php:390
442
  msgid "Large"
443
  msgstr ""
444
 
445
+ #: views/tabs.php:391
446
  msgid "Medium"
447
  msgstr ""
448
 
449
+ #: views/tabs.php:392
450
  msgid "Small"
451
  msgstr ""
452
 
453
+ #: views/tabs.php:393
454
  msgid "Remove Images"
455
  msgstr ""
456
 
457
+ #: views/tabs.php:396
458
  msgid "Image style"
459
  msgstr ""
460
 
461
+ #: views/tabs.php:398
462
  msgid "Align Right"
463
  msgstr ""
464
 
465
+ #: views/tabs.php:399
466
  msgid "Align Left"
467
  msgstr ""
468
 
469
+ #: views/tabs.php:400
470
  msgid "Align None"
471
  msgstr ""
472
 
473
+ #: views/tabs.php:401
474
  msgid "Center/Block"
475
  msgstr ""
476
 
477
+ #: views/tabs.php:429
478
  msgid "PDF"
479
  msgstr ""
480
 
481
+ #: views/tabs.php:441
482
  msgid "Developer Note"
483
  msgstr ""
484
 
485
+ #: views/tabs.php:441
486
  msgid ""
487
  "On localhost the images can not be included in the PDF. Once the website is "
488
  "live/public images will be included in the PDF."
489
  msgstr ""
490
 
491
+ #: views/tabs.php:449
492
  msgid "Print"
493
  msgstr ""
494
 
495
+ #: views/tabs.php:464
496
  msgid "Custom CSS"
497
  msgstr ""
498
 
499
+ #: views/tabs.php:471
500
  msgid "Custom CSS URL"
501
  msgstr ""
502
 
503
+ #: views/tabs.php:486
504
  msgid ""
505
  "Customize the styles of the printed/pdf page using your own CSS. Create "
506
  "your custom CSS, and put the URL to your Custom CSS file in the box above"
507
  msgstr ""
508
 
509
+ #: views/tabs.php:488
510
  msgid ""
511
  "Customize the styles of the printed/pdf page using your own CSS. Add your "
512
  "custom CSS (without the %s tags) in the box above"
513
  msgstr ""
514
 
515
+ #: views/tabs.php:513
516
  msgid "Debug options"
517
  msgstr ""
518
 
519
+ #: views/tabs.php:522
520
  msgid "Currently in Debug Mode. This tab is visible in debug mode only"
521
  msgstr ""
522
 
pf.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: http://www.printfriendly.com
5
  Description: PrintFriendly & PDF button for your website. Optimizes your pages and brand for print, pdf, and email.
6
  Name and URL are included to ensure repeat visitors and new visitors when printed versions are shared.
7
- Version: 4.1
8
  Author: Print, PDF, & Email by PrintFriendly
9
  Author URI: http://www.printfriendly.com
10
  Domain Path: /languages
@@ -32,7 +32,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
32
  *
33
  * @var string
34
  */
35
- var $plugin_version = '4.1';
36
 
37
  /**
38
  * The hook, used for text domain as well as hooks on pages and in get requests for admin.
@@ -136,6 +136,24 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
136
  // Register a link to the settings page on the plugins overview page
137
  add_filter( 'plugin_action_links', array(&$this, 'filter_plugin_actions'), 10, 2 );
138
  add_filter( 'plugin_row_meta', array(&$this, 'additional_links'), 10, 2 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  }
140
 
141
  /**
@@ -215,7 +233,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
215
  .printfriendly {
216
  position: relative;
217
  z-index: 1000;
218
- margin: <?php echo $this->options['margin_top'] . 'px ' . $this->options['margin_right'] . 'px ' . $this->options['margin_bottom'] . 'px ' . $this->options['margin_left'] . 'px'; ?>;
219
  }
220
  .printfriendly a, .printfriendly a:link, .printfriendly a:visited, .printfriendly a:hover, .printfriendly a:active {
221
  font-weight: 600;
@@ -266,7 +284,8 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
266
  var pfdisableClickToDel = '<?php echo esc_js( $this->options['click_to_delete'] ); ?>';
267
  var pfImagesSize = '<?php echo esc_js( $this->options['images-size'] ); ?>';
268
  var pfImageDisplayStyle = '<?php echo esc_js( $this->options['image-style'] ); ?>';
269
- var pfEncodeImages = '<?php echo esc_js( $this->options['password_protected'] === 'yes' ? 1 : 0 ); ?>';
 
270
  var pfDisableEmail = '<?php echo esc_js( $this->options['email'] ); ?>';
271
  var pfDisablePDF = '<?php echo esc_js( $this->options['pdf'] ); ?>';
272
  var pfDisablePrint = '<?php echo esc_js( $this->options['print'] ); ?>';
@@ -364,7 +383,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
364
  $onclick = '';
365
 
366
  if ( $this->google_analytics_enabled() ) {
367
- $title_var = 'NULL';
368
  $analytics_code = "if(typeof(_gaq) != 'undefined') { _gaq.push(['_trackEvent','PRINTFRIENDLY', 'print', '" . $title_var . "']);
369
  }else if(typeof(ga) != 'undefined') { ga('send', 'event','PRINTFRIENDLY', 'print', '" . $title_var . "'); }";
370
  if ( $js_enabled ) {
@@ -443,7 +462,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
443
  load_plugin_textdomain( 'printfriendly', false, basename( dirname( __FILE__ ) ) . '/languages' );
444
 
445
  // Register our option array
446
- register_setting( $this->option_name, $this->option_name, array(&$this, 'options_validate') );
447
  }
448
 
449
  /**
@@ -595,7 +614,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
595
  }
596
 
597
  if ( ! isset( $input['image-style'] ) || ! in_array( $input['image-style'], array('right', 'left', 'none', 'block'), true ) ) {
598
- $valid_input['image-style'] = 'right';
599
  }
600
 
601
  foreach ( array('click_to_delete', 'email', 'pdf', 'print') as $opt ) {
@@ -635,6 +654,9 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
635
  if ( ! isset( $input['password_protected'] ) || ! in_array( $input['password_protected'], array('no', 'yes'), true ) ) {
636
  $valid_input['password_protected'] = 'no';
637
  }
 
 
 
638
 
639
  /*Analytics Options */
640
  if ( ! isset( $input['enable_google_analytics'] ) || ! in_array( $input['enable_google_analytics'], array('no', 'yes'), true ) ) {
@@ -653,6 +675,11 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
653
  set_transient( 'pf-tab', $_POST['tab'], 5 );
654
  }
655
 
 
 
 
 
 
656
  return $valid_input;
657
  }
658
 
@@ -798,7 +825,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
798
  'tagline' => '',
799
  'click_to_delete' => '0', // 0 - allow, 1 - do not allow
800
  'hide-images' => '0', // 0 - show images, 1 - hide images
801
- 'image-style' => 'right', // 'right', 'left', 'none', 'block'
802
  'email' => '0', // 0 - allow, 1 - do not allow
803
  'pdf' => '0', // 0 - allow, 1 - do not allow
804
  'print' => '0', // 0 - allow, 1 - do not allow
@@ -807,6 +834,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
807
  'enable_error_reporting' => 'yes',
808
  'pf_algo' => 'wp',
809
  'images-size' => 'full-size',
 
810
  );
811
 
812
  // Check whether the old badly named singular options are there, if so, use the data and delete them.
@@ -1156,12 +1184,16 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
1156
  * @since 3.0
1157
  * @param string $val value to check.
1158
  */
1159
- function val( $val, $echo = true ) {
1160
  $value = '';
1161
  if ( isset( $this->options[ $val ] ) ) {
1162
  $value = esc_attr( $this->options[ $val ] );
1163
  }
1164
 
 
 
 
 
1165
  if ( $echo ) {
1166
  echo $value;
1167
  }
4
  Plugin URI: http://www.printfriendly.com
5
  Description: PrintFriendly & PDF button for your website. Optimizes your pages and brand for print, pdf, and email.
6
  Name and URL are included to ensure repeat visitors and new visitors when printed versions are shared.
7
+ Version: 4.2
8
  Author: Print, PDF, & Email by PrintFriendly
9
  Author URI: http://www.printfriendly.com
10
  Domain Path: /languages
32
  *
33
  * @var string
34
  */
35
+ var $plugin_version = '4.2';
36
 
37
  /**
38
  * The hook, used for text domain as well as hooks on pages and in get requests for admin.
136
  // Register a link to the settings page on the plugins overview page
137
  add_filter( 'plugin_action_links', array(&$this, 'filter_plugin_actions'), 10, 2 );
138
  add_filter( 'plugin_row_meta', array(&$this, 'additional_links'), 10, 2 );
139
+
140
+ add_filter( 'wp_dropdown_cats', array( &$this, 'wp_dropdown_cats_multiple' ), 10, 2 );
141
+ }
142
+
143
+ /**
144
+ * Adds multiple select support for category dropdown.
145
+ *
146
+ * @since 4.2
147
+ **/
148
+ function wp_dropdown_cats_multiple( $output, $attributes ) {
149
+ if ( isset( $attributes['multiple'] ) && $attributes['multiple'] ) {
150
+ $output = preg_replace( '/^<select/i', '<select multiple', $output );
151
+ $output = str_replace( "name='{$attributes['name']}'", "name='{$attributes['name']}[]'", $output );
152
+ foreach ( array_map( 'trim', explode( ',', $attributes['selected'] ) ) as $value ) {
153
+ $output = str_replace( "value=\"{$value}\"", "value=\"{$value}\" selected", $output );
154
+ }
155
+ }
156
+ return $output;
157
  }
158
 
159
  /**
233
  .printfriendly {
234
  position: relative;
235
  z-index: 1000;
236
+ margin: <?php echo sprintf( '%dpx %dpx %dpx %dpx', $this->val( 'margin_top', false, 0 ), $this->val( 'margin_right', false, 0 ), $this->val( 'margin_bottom', false, 0 ), $this->val( 'margin_left', false, 0 ) ); ?>;
237
  }
238
  .printfriendly a, .printfriendly a:link, .printfriendly a:visited, .printfriendly a:hover, .printfriendly a:active {
239
  font-weight: 600;
284
  var pfdisableClickToDel = '<?php echo esc_js( $this->options['click_to_delete'] ); ?>';
285
  var pfImagesSize = '<?php echo esc_js( $this->options['images-size'] ); ?>';
286
  var pfImageDisplayStyle = '<?php echo esc_js( $this->options['image-style'] ); ?>';
287
+ var pfEncodeImages = '<?php echo esc_js( $this->val( 'password_protected', false ) === 'yes' ? 1 : 0 ); ?>';
288
+ var pfShowHiddenContent = '<?php echo esc_js( $this->val( 'show_hidden_content', false ) === 'yes' ? 1 : 0 ); ?>';
289
  var pfDisableEmail = '<?php echo esc_js( $this->options['email'] ); ?>';
290
  var pfDisablePDF = '<?php echo esc_js( $this->options['pdf'] ); ?>';
291
  var pfDisablePrint = '<?php echo esc_js( $this->options['print'] ); ?>';
383
  $onclick = '';
384
 
385
  if ( $this->google_analytics_enabled() ) {
386
+ $title_var = is_singular() ? esc_attr( get_the_title() ) : 'NULL';
387
  $analytics_code = "if(typeof(_gaq) != 'undefined') { _gaq.push(['_trackEvent','PRINTFRIENDLY', 'print', '" . $title_var . "']);
388
  }else if(typeof(ga) != 'undefined') { ga('send', 'event','PRINTFRIENDLY', 'print', '" . $title_var . "'); }";
389
  if ( $js_enabled ) {
462
  load_plugin_textdomain( 'printfriendly', false, basename( dirname( __FILE__ ) ) . '/languages' );
463
 
464
  // Register our option array
465
+ register_setting( $this->option_name, $this->option_name, array( 'sanitize_callback' => array(&$this, 'options_validate') ) );
466
  }
467
 
468
  /**
614
  }
615
 
616
  if ( ! isset( $input['image-style'] ) || ! in_array( $input['image-style'], array('right', 'left', 'none', 'block'), true ) ) {
617
+ $valid_input['image-style'] = 'block';
618
  }
619
 
620
  foreach ( array('click_to_delete', 'email', 'pdf', 'print') as $opt ) {
654
  if ( ! isset( $input['password_protected'] ) || ! in_array( $input['password_protected'], array('no', 'yes'), true ) ) {
655
  $valid_input['password_protected'] = 'no';
656
  }
657
+ if ( ! isset( $input['show_hidden_content'] ) || ! in_array( $input['show_hidden_content'], array('no', 'yes'), true ) ) {
658
+ $valid_input['show_hidden_content'] = 'no';
659
+ }
660
 
661
  /*Analytics Options */
662
  if ( ! isset( $input['enable_google_analytics'] ) || ! in_array( $input['enable_google_analytics'], array('no', 'yes'), true ) ) {
675
  set_transient( 'pf-tab', $_POST['tab'], 5 );
676
  }
677
 
678
+ // save the categories as comma-separated
679
+ if ( isset( $valid_input['show_on_cat'] ) && ! empty( $valid_input['show_on_cat'] ) ) {
680
+ $valid_input['show_on_cat'] = implode( ',', $valid_input['show_on_cat'] );
681
+ }
682
+
683
  return $valid_input;
684
  }
685
 
825
  'tagline' => '',
826
  'click_to_delete' => '0', // 0 - allow, 1 - do not allow
827
  'hide-images' => '0', // 0 - show images, 1 - hide images
828
+ 'image-style' => 'block', // 'right', 'left', 'none', 'block'
829
  'email' => '0', // 0 - allow, 1 - do not allow
830
  'pdf' => '0', // 0 - allow, 1 - do not allow
831
  'print' => '0', // 0 - allow, 1 - do not allow
834
  'enable_error_reporting' => 'yes',
835
  'pf_algo' => 'wp',
836
  'images-size' => 'full-size',
837
+ 'show_hidden_content' => 'no',
838
  );
839
 
840
  // Check whether the old badly named singular options are there, if so, use the data and delete them.
1184
  * @since 3.0
1185
  * @param string $val value to check.
1186
  */
1187
+ function val( $val, $echo = true, $default = null ) {
1188
  $value = '';
1189
  if ( isset( $this->options[ $val ] ) ) {
1190
  $value = esc_attr( $this->options[ $val ] );
1191
  }
1192
 
1193
+ if ( empty( $value ) && ! is_null( $default ) ) {
1194
+ $value = $default;
1195
+ }
1196
+
1197
  if ( $echo ) {
1198
  echo $value;
1199
  }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: printfriendly, joostdevalk, jrf, rozroz
3
  Tags: print, pdf, email, woocommerce print, woocommerce pdf, print plugin, print button, pdf plugin, pdf button
4
  Requires at least: 4.9
5
- Tested up to: 5.7
6
- Stable tag: 4.1
7
 
8
 
9
  The #1 Print, PDF, Email button. Stylish, full featured, customizable. Add custom header, footer, and more.
@@ -144,6 +144,11 @@ You can [hide the Print, PDF, and Email button](https://support.printfriendly.co
144
 
145
  == Changelog ==
146
 
 
 
 
 
 
147
  = 4.1 =
148
  * Bugfixes
149
  * Tested against WP 5.7
2
  Contributors: printfriendly, joostdevalk, jrf, rozroz
3
  Tags: print, pdf, email, woocommerce print, woocommerce pdf, print plugin, print button, pdf plugin, pdf button
4
  Requires at least: 4.9
5
+ Tested up to: 5.8
6
+ Stable tag: 4.2
7
 
8
 
9
  The #1 Print, PDF, Email button. Stylish, full featured, customizable. Add custom header, footer, and more.
144
 
145
  == Changelog ==
146
 
147
+ = 4.2 =
148
+ * Fix: jQuery.fn.load() is deprecated
149
+ * Fix: Specific categories do not accept more than one entry
150
+ * Tested against WP 5.8
151
+
152
  = 4.1 =
153
  * Bugfixes
154
  * Tested against WP 5.7
views/tabs.php CHANGED
@@ -211,22 +211,20 @@
211
  <hr/>
212
  <label for="categories" class="pf-bu-label"><?php _e( 'Specific categories to show on', 'printfriendly' ); ?></label>
213
  <?php
214
- $select = wp_dropdown_categories(
215
  apply_filters(
216
  'printfriendly_category_args', array(
217
  'show_count' => 0,
218
  'orderby' => 'name',
219
- 'echo' => 0,
220
  'hide_empty' => false, // show a category even if it has no posts assigned
221
  'class' => 'pf-select2',
222
  'name' => 'printfriendly_option[show_on_cat]',
223
  'id' => 'show_on_cat',
224
  'selected' => isset( $this->options['show_on_cat'] ) ? $this->options['show_on_cat'] : '',
 
225
  )
226
  )
227
  );
228
- $select = str_replace( '<select ', '<select multiple ', $select );
229
- echo $select;
230
  ?>
231
  </div>
232
 
@@ -236,6 +234,35 @@
236
 
237
  </div>
238
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  <div class="pf-bu-container">
240
  <div class="pf-bu-is-flex pf-bu-is-justify-content-center">
241
  <input type="submit" class="button-primary pf-bu-is-medium pf-bu-button" value="<?php esc_attr_e( 'Save Options', 'printfriendly' ); ?>" />
@@ -312,26 +339,6 @@
312
  </div>
313
  </div>
314
 
315
- <!-- TODO: disable for non pro? -->
316
- <div class="pf-bu-block pf-bu-card">
317
- <header class="pf-bu-card-header">
318
- <p class="pf-bu-card-header-title">
319
- <?php _e( 'Password Protected Content', 'printfriendly' ); ?>
320
- </p>
321
- </header>
322
-
323
- <div class="pf-bu-card-content">
324
- <select class="pf-bu-select" id="password_protected" name="<?php echo $this->option_name; ?>[password_protected]">
325
- <option value="no" <?php selected( $this->options['password_protected'], 'no' ); ?>><?php _e( 'No', 'printfriendly' ); ?></option>
326
- <option value="yes" <?php selected( $this->options['password_protected'], 'yes' ); ?>><?php _e( 'Yes', 'printfriendly' ); ?></option>
327
- </select>
328
- </div>
329
-
330
- <div class="pf-bu-card-footer">
331
- <p class="pf-bu-card-footer-item"><?php _e( 'This feature requires a Pro subscription.', 'printfriendly' ); ?>&nbsp;<a href="https://www.printfriendly.com/pro" target="_blank"><?php _e( 'Learn More', 'printfriendly' ); ?></a></p>
332
- </div>
333
- </div>
334
-
335
  <div class="pf-bu-block pf-bu-card">
336
  <header class="pf-bu-card-header">
337
  <p class="pf-bu-card-header-title">
@@ -386,10 +393,10 @@
386
 
387
  <label for="image-style" class="pf-bu-label"><?php _e( 'Image style', 'printfriendly' ); ?></label>
388
  <select class="pf-bu-select" name="<?php echo $this->option_name; ?>[image-style]" id="image-style">
 
389
  <option value="right" <?php selected( $this->options['image-style'], 'right' ); ?>><?php _e( 'Align Right', 'printfriendly' ); ?></option>
390
  <option value="left" <?php selected( $this->options['image-style'], 'left' ); ?>><?php _e( 'Align Left', 'printfriendly' ); ?></option>
391
  <option value="none" <?php selected( $this->options['image-style'], 'none' ); ?>><?php _e( 'Align None', 'printfriendly' ); ?></option>
392
- <option value="block" <?php selected( $this->options['image-style'], 'block' ); ?>><?php _e( 'Center/Block', 'printfriendly' ); ?></option>
393
  </select>
394
  </div>
395
 
211
  <hr/>
212
  <label for="categories" class="pf-bu-label"><?php _e( 'Specific categories to show on', 'printfriendly' ); ?></label>
213
  <?php
214
+ wp_dropdown_categories(
215
  apply_filters(
216
  'printfriendly_category_args', array(
217
  'show_count' => 0,
218
  'orderby' => 'name',
 
219
  'hide_empty' => false, // show a category even if it has no posts assigned
220
  'class' => 'pf-select2',
221
  'name' => 'printfriendly_option[show_on_cat]',
222
  'id' => 'show_on_cat',
223
  'selected' => isset( $this->options['show_on_cat'] ) ? $this->options['show_on_cat'] : '',
224
+ 'multiple' => true,
225
  )
226
  )
227
  );
 
 
228
  ?>
229
  </div>
230
 
234
 
235
  </div>
236
 
237
+ <div class="pf-bu-block pf-bu-card">
238
+ <header class="pf-bu-card-header">
239
+ <p class="pf-bu-card-header-title">
240
+ <?php _e( 'Pro Exclusive Features', 'printfriendly' ); ?>
241
+ </p>
242
+ </header>
243
+
244
+ <div class="pf-bu-card-content">
245
+ <label for="password_protected" class="pf-bu-label"><?php _e( 'Encode images', 'printfriendly' ); ?></label>
246
+ <select class="pf-bu-select" id="password_protected" name="<?php echo $this->option_name; ?>[password_protected]">
247
+ <option value="no" <?php selected( $this->val( 'password_protected', false ), 'no' ); ?>><?php _e( 'No', 'printfriendly' ); ?></option>
248
+ <option value="yes" <?php selected( $this->val( 'password_protected', false ), 'yes' ); ?>><?php _e( 'Yes', 'printfriendly' ); ?></option>
249
+ </select>
250
+ <p class="description"><?php _e( 'Select "Yes" if your site is not publicly accessible or if your provider blocks image requests from third parties (Ex. Zendesk) or if images are not present in PDF', 'printfriendly' ); ?></p>
251
+
252
+ <label for="show_hidden_content" class="pf-bu-label"><?php _e( 'Show Hidden Content', 'printfriendly' ); ?></label>
253
+ <select class="pf-bu-select" id="show_hidden_content" name="<?php echo $this->option_name; ?>[show_hidden_content]">
254
+ <option value="no" <?php selected( $this->val( 'show_hidden_content', false ), 'no' ); ?>><?php _e( 'No', 'printfriendly' ); ?></option>
255
+ <option value="yes" <?php selected( $this->val( 'show_hidden_content', false ), 'yes' ); ?>><?php _e( 'Yes', 'printfriendly' ); ?></option>
256
+ </select>
257
+ <p class="description"><?php _e( 'By default PrintFriendly Pro will only show the visible content on the page. Select "Yes", if you want PrintFriendly to show hidden content. (Ex. Content in hidden tabs)', 'printfriendly' ); ?></p>
258
+
259
+ </div>
260
+
261
+ <div class="pf-bu-card-footer">
262
+ <p class="pf-bu-card-footer-item"><?php _e( 'This feature requires a Pro subscription.', 'printfriendly' ); ?>&nbsp;<a href="https://www.printfriendly.com/pro" target="_blank"><?php _e( 'Learn More', 'printfriendly' ); ?></a></p>
263
+ </div>
264
+ </div>
265
+
266
  <div class="pf-bu-container">
267
  <div class="pf-bu-is-flex pf-bu-is-justify-content-center">
268
  <input type="submit" class="button-primary pf-bu-is-medium pf-bu-button" value="<?php esc_attr_e( 'Save Options', 'printfriendly' ); ?>" />
339
  </div>
340
  </div>
341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  <div class="pf-bu-block pf-bu-card">
343
  <header class="pf-bu-card-header">
344
  <p class="pf-bu-card-header-title">
393
 
394
  <label for="image-style" class="pf-bu-label"><?php _e( 'Image style', 'printfriendly' ); ?></label>
395
  <select class="pf-bu-select" name="<?php echo $this->option_name; ?>[image-style]" id="image-style">
396
+ <option value="block" <?php selected( $this->options['image-style'], 'block' ); ?>><?php _e( 'Center/Block', 'printfriendly' ); ?></option>
397
  <option value="right" <?php selected( $this->options['image-style'], 'right' ); ?>><?php _e( 'Align Right', 'printfriendly' ); ?></option>
398
  <option value="left" <?php selected( $this->options['image-style'], 'left' ); ?>><?php _e( 'Align Left', 'printfriendly' ); ?></option>
399
  <option value="none" <?php selected( $this->options['image-style'], 'none' ); ?>><?php _e( 'Align None', 'printfriendly' ); ?></option>
 
400
  </select>
401
  </div>
402