Print, PDF, Email by PrintFriendly - Version 4.0.1

Version Description

  • Bugfixes
Download this release

Release Info

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

Code changes from version 4.0.0 to 4.0.1

Files changed (3) hide show
  1. pf.php +18 -6
  2. readme.txt +5 -2
  3. views/pro.php +9 -1
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.0.0
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.0.0';
36
 
37
  /**
38
  * The hook, used for text domain as well as hooks on pages and in get requests for admin.
@@ -346,6 +346,8 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
346
  /**
347
  * Returns the HTML of the button.
348
  *
 
 
349
  * @since 3.3.8
350
  *
351
  * @param bool $add_footer_script Whether to add the script in the footer.
@@ -353,7 +355,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
353
  *
354
  * @return Printfriendly Button HTML
355
  */
356
- private function getButton( $add_footer_script = false, $add_class = '' ) {
357
  if ( $add_footer_script ) {
358
  add_action( 'wp_footer', array(&$this, 'print_script_footer') );
359
  }
@@ -546,7 +548,10 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
546
  }
547
 
548
  foreach ( array('margin_top', 'margin_right', 'margin_bottom', 'margin_left') as $opt ) {
549
- $valid_input[ $opt ] = (int) $input[ $opt ];
 
 
 
550
  }
551
 
552
  unset( $opt );
@@ -614,7 +619,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
614
  $valid_input['custom_css'] = sanitize_textarea_field( $css );
615
  $file = $this->maybe_generate_custom_css_file( $valid_input['custom_css'] );
616
  if ( ! $file ) {
617
- $file = $this->options['custom_css_url_pro'];
618
  }
619
  $valid_input['custom_css_url_pro'] = $file;
620
 
@@ -1303,7 +1308,8 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
1303
  * Returns the custom css url.
1304
  */
1305
  function get_custom_css() {
1306
- $css_url = $this->options['custom_css_url'];
 
1307
  if ( ! $this->is_pro( 'custom-css' ) ) {
1308
  return $css_url;
1309
  }
@@ -1313,6 +1319,12 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
1313
  return $css_url;
1314
  }
1315
 
 
 
 
 
 
 
1316
  $dirs = wp_get_upload_dir();
1317
 
1318
  return $dirs['baseurl'] . '/' . $this->options['custom_css_url_pro'];
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.0.1
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.0.1';
36
 
37
  /**
38
  * The hook, used for text domain as well as hooks on pages and in get requests for admin.
346
  /**
347
  * Returns the HTML of the button.
348
  *
349
+ * This can be called publicly from `pf_show_link()`.
350
+ *
351
  * @since 3.3.8
352
  *
353
  * @param bool $add_footer_script Whether to add the script in the footer.
355
  *
356
  * @return Printfriendly Button HTML
357
  */
358
+ public function getButton( $add_footer_script = false, $add_class = '' ) {
359
  if ( $add_footer_script ) {
360
  add_action( 'wp_footer', array(&$this, 'print_script_footer') );
361
  }
548
  }
549
 
550
  foreach ( array('margin_top', 'margin_right', 'margin_bottom', 'margin_left') as $opt ) {
551
+ // if margin is not defined, don't throw a PHP notice
552
+ if ( isset( $input[ $opt ] ) ) {
553
+ $valid_input[ $opt ] = (int) $input[ $opt ];
554
+ }
555
  }
556
 
557
  unset( $opt );
619
  $valid_input['custom_css'] = sanitize_textarea_field( $css );
620
  $file = $this->maybe_generate_custom_css_file( $valid_input['custom_css'] );
621
  if ( ! $file ) {
622
+ $file = isset( $this->options['custom_css_url_pro'] ) ? $this->options['custom_css_url_pro'] : '';
623
  }
624
  $valid_input['custom_css_url_pro'] = $file;
625
 
1308
  * Returns the custom css url.
1309
  */
1310
  function get_custom_css() {
1311
+ // don't throw a PHP notice if custom_css_url is not defined.
1312
+ $css_url = isset( $this->options['custom_css_url'] ) ? $this->options['custom_css_url'] : '';
1313
  if ( ! $this->is_pro( 'custom-css' ) ) {
1314
  return $css_url;
1315
  }
1319
  return $css_url;
1320
  }
1321
 
1322
+ // don't throw a PHP notice if custom_css_url_pro is not defined.
1323
+ $css_url = isset( $this->options['custom_css_url_pro'] ) ? $this->options['custom_css_url_pro'] : '';
1324
+ if ( empty( $css_url ) ) {
1325
+ return null;
1326
+ }
1327
+
1328
  $dirs = wp_get_upload_dir();
1329
 
1330
  return $dirs['baseurl'] . '/' . $this->options['custom_css_url_pro'];
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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.6
6
- Stable tag: 4.0.0
7
 
8
 
9
  The #1 Print, PDF, Email button. Stylish, full featured, customizable. Add custom header, footer, and more.
@@ -144,6 +144,9 @@ You can [hide the Print, PDF, and Email button](https://support.printfriendly.co
144
 
145
  == Changelog ==
146
 
 
 
 
147
  = 4.0.0 =
148
  * An easier and intuitive settings screen
149
  * Use custom CSS directly without the hassle of uploading files
@@ -151,7 +154,7 @@ You can [hide the Print, PDF, and Email button](https://support.printfriendly.co
151
  * Added option to show button only for select categories
152
  * Update translations
153
  * Fix: Two buttons are shown when excerpt is used
154
- * Fix: The custom CSS was included in the page erroneously
155
 
156
  = 3.16.0 =
157
  * Update deprecated jQuery to prevent deprecation log noitice.
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.6
6
+ Stable tag: 4.0.1
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.0.1 =
148
+ * Bugfixes
149
+
150
  = 4.0.0 =
151
  * An easier and intuitive settings screen
152
  * Use custom CSS directly without the hassle of uploading files
154
  * Added option to show button only for select categories
155
  * Update translations
156
  * Fix: Two buttons are shown when excerpt is used
157
+ * Fix: The custom CSS was included in the page erroneously
158
 
159
  = 3.16.0 =
160
  * Update deprecated jQuery to prevent deprecation log noitice.
views/pro.php CHANGED
@@ -1,6 +1,14 @@
1
  <?php
2
  $urlInfo = parse_url( get_option( 'siteurl' ) );
3
  $domain = ( isset( $urlInfo['host'] ) ? $urlInfo['host'] : '' );
 
 
 
 
 
 
 
 
4
  ?>
5
  <div class="pf-bu-block pf-bu-card">
6
  <div class="pf-bu-card-content">
@@ -44,7 +52,7 @@ $domain = ( isset( $urlInfo['host'] ) ? $urlInfo['host'] : '' );
44
  </p>
45
 
46
  <p id="pf-pro-details" class="pf-hidden">
47
- <span class="pf-btn-message"><?php _e( 'Last Checked', 'printfriendly' ); ?>: <?php echo date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $this->options['license_date'] / 1000 + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ); ?></span>
48
  <input type="hidden" name="<?php echo $this->option_name; ?>[license_status]" id="license_status">
49
  <input type="hidden" name="<?php echo $this->option_name; ?>[license_date]" id="license_date">
50
  </p>
1
  <?php
2
  $urlInfo = parse_url( get_option( 'siteurl' ) );
3
  $domain = ( isset( $urlInfo['host'] ) ? $urlInfo['host'] : '' );
4
+
5
+ // don't throw a PHP notice if license_date is not defined
6
+ $license_date = isset( $this->options['license_date'] ) ? $this->options['license_date'] : '';
7
+
8
+ if ( ! empty( $license_date ) ) {
9
+ $license_date = date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $license_date / 1000 + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
10
+ }
11
+
12
  ?>
13
  <div class="pf-bu-block pf-bu-card">
14
  <div class="pf-bu-card-content">
52
  </p>
53
 
54
  <p id="pf-pro-details" class="pf-hidden">
55
+ <span class="pf-btn-message"><?php _e( 'Last Checked', 'printfriendly' ); ?>: <?php echo $license_date; ?></span>
56
  <input type="hidden" name="<?php echo $this->option_name; ?>[license_status]" id="license_status">
57
  <input type="hidden" name="<?php echo $this->option_name; ?>[license_date]" id="license_date">
58
  </p>