Print, PDF, Email by PrintFriendly - Version 3.2.9

Version Description

Download this release

Release Info

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

Code changes from version 3.2.8 to 3.2.9

Files changed (2) hide show
  1. pf.php +36 -6
  2. readme.txt +5 -2
pf.php CHANGED
@@ -5,11 +5,12 @@ Plugin Name: Print Friendly and PDF
5
  Plugin URI: http://www.printfriendly.com
6
  Description: PrintFriendly & PDF button for your website. Optimizes your pages and brand for print, pdf, and email.
7
  Name and URL are included to ensure repeat visitors and new visitors when printed versions are shared.
8
- Version: 3.2.8
9
  Author: Print Friendly
10
  Author URI: http://www.PrintFriendly.com
11
 
12
  Changelog :
 
13
  3.2.8 - Algorithm Update
14
  3.2.7 - Removed Break tag from button code.
15
  3.2.6 - Fixed Button behavior when displayed on Homepage for NON-JS version. Fixed CSS issue with Button when placed above content. Fixed box-shadow issue with button. Custom print and pdf options now available for Non-JS version (custom header, custom css, image alignment, etc.). Fixed custom header bug.
@@ -90,7 +91,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
90
  * Database version, used to allow for easy upgrades to / additions in plugin options between plugin versions.
91
  * @var int
92
  */
93
- var $db_version = 7;
94
 
95
  /**
96
  * Settings page, used within the plugin to reliably load the plugins admin JS and CSS files only on the admin page.
@@ -298,13 +299,23 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
298
  $is_manual = $this->is_manual();
299
  if( !$content && !$is_manual )
300
  return "";
301
-
302
  $onclick = 'onclick="window.print(); return false;"';
 
 
 
 
 
 
 
303
  $href = 'http://www.printfriendly.com/print?url='.get_permalink();
304
  $js_enabled = $this->js_enabled();
305
  if (!$js_enabled)
306
  {
307
  $onclick = 'target="_blank"';
 
 
 
308
  $href = "http://www.printfriendly.com/print?headerImageUrl={$this->options['image_url']}&headerTagline={$this->options['tagline']}&pfCustomCSS={$this->options['custom_css_url']}&imageDisplayStyle={$this->options['image-style']}&disableClickToDel={$this->options['click_to_delete']}&disablePDF={$this->options['pdf']}&disablePrint={$this->options['print']}&disableEmail={$this->options['email']}&hideImages={$this->options['hide-images']}&url=".get_permalink();
309
  }
310
 
@@ -351,6 +362,13 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
351
 
352
  }
353
 
 
 
 
 
 
 
 
354
  /**
355
  * @since 3.2.6
356
  * @return boolean true if JS is enabled for the plugin
@@ -547,8 +565,11 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
547
 
548
  if ( !isset( $input['javascript'] ) || !in_array( $input['javascript'], array( 'no', 'yes' ) ) )
549
  $valid_input['javascript'] = 'yes';
550
-
551
-
 
 
 
552
 
553
  /* Database version */
554
  $valid_input['db_version'] = $this->db_version;
@@ -656,6 +677,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
656
  'password_protected' => 'no',
657
  'javascript' => 'yes',
658
  'custom_css_url' => '',
 
659
  // 'category_ids' => array('all'),
660
  );
661
 
@@ -796,6 +818,9 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
796
 
797
  $this->options = array_merge($this->options, $additional_options);
798
  }
 
 
 
799
  $this->options['db_version'] = $this->db_version;
800
  update_option( $this->option_name, $this->options );
801
  }
@@ -1272,7 +1297,12 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
1272
  <?php _e( "Preview opens a new browser tab.", $this->hook ); ?>
1273
  </span>
1274
  </label>
1275
-
 
 
 
 
 
1276
  <p class="submit">
1277
  <input type="submit" class="button-primary" value="<?php esc_attr_e( "Save Options", $this->hook ); ?>"/>
1278
  <input type="reset" class="button-secondary" value="<?php esc_attr_e( "Cancel", $this->hook ); ?>"/>
5
  Plugin URI: http://www.printfriendly.com
6
  Description: PrintFriendly & PDF button for your website. Optimizes your pages and brand for print, pdf, and email.
7
  Name and URL are included to ensure repeat visitors and new visitors when printed versions are shared.
8
+ Version: 3.2.9
9
  Author: Print Friendly
10
  Author URI: http://www.PrintFriendly.com
11
 
12
  Changelog :
13
+ 3.2.9 - Added Support for Google Analytics
14
  3.2.8 - Algorithm Update
15
  3.2.7 - Removed Break tag from button code.
16
  3.2.6 - Fixed Button behavior when displayed on Homepage for NON-JS version. Fixed CSS issue with Button when placed above content. Fixed box-shadow issue with button. Custom print and pdf options now available for Non-JS version (custom header, custom css, image alignment, etc.). Fixed custom header bug.
91
  * Database version, used to allow for easy upgrades to / additions in plugin options between plugin versions.
92
  * @var int
93
  */
94
+ var $db_version = 8;
95
 
96
  /**
97
  * Settings page, used within the plugin to reliably load the plugins admin JS and CSS files only on the admin page.
299
  $is_manual = $this->is_manual();
300
  if( !$content && !$is_manual )
301
  return "";
302
+ $analytics_code = "";
303
  $onclick = 'onclick="window.print(); return false;"';
304
+ $title_var = "NULL";
305
+ $analytics_code = "if(typeof(_gaq) != 'undefined') { _gaq.push(['_trackEvent','PRINTFRIENDLY', 'print', '".$titlevarname."']);}";
306
+
307
+ if($this->google_analytics_enabled()) {
308
+ $onclick = 'onclick="window.print();'.$analytics_code.' return false;"';
309
+ }
310
+
311
  $href = 'http://www.printfriendly.com/print?url='.get_permalink();
312
  $js_enabled = $this->js_enabled();
313
  if (!$js_enabled)
314
  {
315
  $onclick = 'target="_blank"';
316
+ if($this->google_analytics_enabled()) {
317
+ $onclick = $onclick.' onclick="'.$analytics_code.'"';
318
+ }
319
  $href = "http://www.printfriendly.com/print?headerImageUrl={$this->options['image_url']}&headerTagline={$this->options['tagline']}&pfCustomCSS={$this->options['custom_css_url']}&imageDisplayStyle={$this->options['image-style']}&disableClickToDel={$this->options['click_to_delete']}&disablePDF={$this->options['pdf']}&disablePrint={$this->options['print']}&disableEmail={$this->options['email']}&hideImages={$this->options['hide-images']}&url=".get_permalink();
320
  }
321
 
362
 
363
  }
364
 
365
+ /**
366
+ * @since 3.2.9
367
+ * @returns if google analytics enabled
368
+ */
369
+ function google_analytics_enabled() {
370
+ return isset( $this->options['enable_google_analytics'] ) && $this->options['enable_google_analytics'] == 'yes';
371
+ }
372
  /**
373
  * @since 3.2.6
374
  * @return boolean true if JS is enabled for the plugin
565
 
566
  if ( !isset( $input['javascript'] ) || !in_array( $input['javascript'], array( 'no', 'yes' ) ) )
567
  $valid_input['javascript'] = 'yes';
568
+
569
+ /*Analytics Options */
570
+ if ( !isset( $input['enable_google_analytics'] ) || !in_array( $input['enable_google_analytics'], array( 'no', 'yes' ) ) ) {
571
+ $valid_input['enable_google_analytics'] = "no";
572
+ }
573
 
574
  /* Database version */
575
  $valid_input['db_version'] = $this->db_version;
677
  'password_protected' => 'no',
678
  'javascript' => 'yes',
679
  'custom_css_url' => '',
680
+ 'enable_google_analytics' => 'no',
681
  // 'category_ids' => array('all'),
682
  );
683
 
818
 
819
  $this->options = array_merge($this->options, $additional_options);
820
  }
821
+ if($this->options['db_version'] < 8) {
822
+ $this->options['enable_google_analytics'] = 'no';
823
+ }
824
  $this->options['db_version'] = $this->db_version;
825
  update_option( $this->option_name, $this->options );
826
  }
1297
  <?php _e( "Preview opens a new browser tab.", $this->hook ); ?>
1298
  </span>
1299
  </label>
1300
+ <label id="pf-analytics-tracking" <?php /*for="javascript"*/ ?>>Track in Google Analytics<br>
1301
+ <select id="pf-analytics-tracking" name="<?php echo $this->option_name; ?>[enable_google_analytics]">
1302
+ <option value="yes" <?php $this->selected( 'enable_google_analytics', 'yes' ); ?>> <?php _e( "Yes", $this->hook ); ?></option>
1303
+ <option value="no" <?php $this->selected( 'enable_google_analytics', 'no' ); ?>> <?php _e( "No", $this->hook ); ?></option>
1304
+ </select>
1305
+ </label>
1306
  <p class="submit">
1307
  <input type="submit" class="button-primary" value="<?php esc_attr_e( "Save Options", $this->hook ); ?>"/>
1308
  <input type="reset" class="button-secondary" value="<?php esc_attr_e( "Cancel", $this->hook ); ?>"/>
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: printfriendly,joostdevalk, jrf
3
  Tags: print, pdf, printer, printing, printable, widget, plugin
4
  Requires at least: 2.8
5
- Tested up to: 3.5.1
6
- Stable tag: 3.2.8
7
 
8
  The #1 Print and PDF button for your WordPress site. Printer Friendly pages without coding, css, or print.css. Fast, easy, and professional.
9
 
@@ -97,6 +97,9 @@ If you have any other issues with the plugin or the PrintFriendly widget, please
97
  3. Localization example: Spanish
98
 
99
  == Changelog ==
 
 
 
100
  = 3.2.8
101
  * Algorithm Update
102
 
2
  Contributors: printfriendly,joostdevalk, jrf
3
  Tags: print, pdf, printer, printing, printable, widget, plugin
4
  Requires at least: 2.8
5
+ Tested up to: 3.5.2
6
+ Stable tag: 3.2.9
7
 
8
  The #1 Print and PDF button for your WordPress site. Printer Friendly pages without coding, css, or print.css. Fast, easy, and professional.
9
 
97
  3. Localization example: Spanish
98
 
99
  == Changelog ==
100
+ = 3.2.9
101
+ * Enabled support for Google Analytics
102
+
103
  = 3.2.8
104
  * Algorithm Update
105