Print, PDF, Email by PrintFriendly - Version 1.1

Version Description

Download this release

Release Info

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

Code changes from version 1.0 to 1.1

Files changed (2) hide show
  1. pf.php +42 -37
  2. readme.txt +1 -1
pf.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: PrintFriendly
4
  Plugin URI: http://www.printfriendly.com/button
5
  Description: Creates PrintFriendly.com button for easy printing. [<a href="options-general.php?page=printfriendly/pf.php">Settings</a>].
6
- Version: 1.0
7
  Author: Vamsee Kanakala
8
  Author URI: http://kanakala.net
9
  */
@@ -11,42 +11,47 @@
11
  function pf_show_link($content)
12
  {
13
  $button_type = get_option('pf_button_type');
14
- switch ($button_type) {
15
- case "text-only":
16
- if (is_single() || is_page()) {
17
- return $content.'<div id="pfButton"><script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="pfLink" onclick="window.print(); return false;" title="Print an optimized version of this web page" style="text-decoration: none;"><span style="color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
18
- } else {
19
- return $content.'<div id="pfButton"><a href="'.get_permalink().'&pfstyle=wp" title="Print an optimized version of this web page" style="text-decoration: none;"><span style="color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
20
- }
21
- break;
22
- case "pf-button-big.gif":
23
- if (is_single() || is_page()) {
24
- return $content.'<div id="pfButton"><script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="pfLink" onclick="window.print(); return false;" title="Print an optimized version of this web page"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-button-big.gif" alt="Print"/></a></div>';
25
- } else {
26
- return $content.'<div id="pfButton"><a href="'.get_permalink().'&pfstyle=wp" title="Print an optimized version of this web page"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-button-big.gif" alt="Print"/></a></div>';
27
- }
28
- break;
29
- case "pf-icon-small.gif":
30
- if (is_single() || is_page()) {
31
- return $content.'<div id="pfButton"><script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="pfLink" onclick="window.print(); return false;" title="Print an optimized version of this web page" style="text-decoration: none;"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-icon-small.gif" alt="Print"/><span style="font-size: 12px; color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
32
- } else {
33
- return $content.'<div id="pfButton"><a href="'.get_permalink().'&pfstyle=wp" title="Print an optimized version of this web page" style="text-decoration: none;"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-icon-small.gif" alt="Print"/><span style="font-size: 12px; color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
34
- }
35
- break;
36
- case "pf-icon.gif":
37
- if (is_single() || is_page()) {
38
- return $content.'<div id="pfButton"><script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="pfLink" onclick="window.print(); return false;" title="Print an optimized version of this web page" style="text-decoration: none;"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-icon.gif" alt="Print"/><span style="font-size: 15px; color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
39
- } else {
40
- return $content.'<div id="pfButton"><a href="'.get_permalink().'&pfstyle=wp" title="Print an optimized version of this web page" style="text-decoration: none;"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-icon.gif" alt="Print"/><span style="font-size: 15px; color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
41
- }
42
- break;
43
- default:
44
- if (is_single() || is_page()) {
45
- return $content.'<div id="pfButton"><script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="pfLink" onclick="window.print(); return false;" title="Print an optimized version of this web page"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-button.gif" alt="Print"/></a></div>';
46
- } else {
47
- return $content.'<div id="pfButton"><a href="'.get_permalink().'&pfstyle=wp" title="Print an optimized version of this web page"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-button.gif" alt="Print"/></a></div>';
48
- }
49
- }
 
 
 
 
 
50
  }
51
 
52
  remove_action('the_content', 'pf_show_link');
3
  Plugin Name: PrintFriendly
4
  Plugin URI: http://www.printfriendly.com/button
5
  Description: Creates PrintFriendly.com button for easy printing. [<a href="options-general.php?page=printfriendly/pf.php">Settings</a>].
6
+ Version: 1.1
7
  Author: Vamsee Kanakala
8
  Author URI: http://kanakala.net
9
  */
11
  function pf_show_link($content)
12
  {
13
  $button_type = get_option('pf_button_type');
14
+ $plink_url = get_permalink();
15
+ $separator = "?pfstyle=wp";
16
+ if (strpos($plink_url,"?")!=false)
17
+ $separator = "&pfstyle=wp";
18
+
19
+ switch ($button_type) {
20
+ case "text-only":
21
+ if (is_single() || is_page()) {
22
+ return $content.'<div id="pfButton"><script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="pfLink" onclick="window.print(); return false;" title="Print an optimized version of this web page" style="text-decoration: none;"><span style="color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
23
+ } else {
24
+ return $content.'<div id="pfButton"><a href="'.$plink_url.$separator.'" title="Print an optimized version of this web page" style="text-decoration: none;"><span style="color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
25
+ }
26
+ break;
27
+ case "pf-button-big.gif":
28
+ if (is_single() || is_page()) {
29
+ return $content.'<div id="pfButton"><script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="pfLink" onclick="window.print(); return false;" title="Print an optimized version of this web page"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-button-big.gif" alt="Print"/></a></div>';
30
+ } else {
31
+ return $content.'<div id="pfButton"><a href="'.$plink_url.$separator.'" title="Print an optimized version of this web page"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-button-big.gif" alt="Print"/></a></div>';
32
+ }
33
+ break;
34
+ case "pf-icon-small.gif":
35
+ if (is_single() || is_page()) {
36
+ return $content.'<div id="pfButton"><script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="pfLink" onclick="window.print(); return false;" title="Print an optimized version of this web page" style="text-decoration: none;"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-icon-small.gif" alt="Print"/><span style="font-size: 12px; color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
37
+ } else {
38
+ return $content.'<div id="pfButton"><a href="'.$plink_url.$separator.'" title="Print an optimized version of this web page" style="text-decoration: none;"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-icon-small.gif" alt="Print"/><span style="font-size: 12px; color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
39
+ }
40
+ break;
41
+ case "pf-icon.gif":
42
+ if (is_single() || is_page()) {
43
+ return $content.'<div id="pfButton"><script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="pfLink" onclick="window.print(); return false;" title="Print an optimized version of this web page" style="text-decoration: none;"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-icon.gif" alt="Print"/><span style="font-size: 15px; color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
44
+ } else {
45
+ return $content.'<div id="pfButton"><a href="'.$plink_url.$separator.'" title="Print an optimized version of this web page" style="text-decoration: none;"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-icon.gif" alt="Print"/><span style="font-size: 15px; color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
46
+ }
47
+ break;
48
+ default:
49
+ if (is_single() || is_page()) {
50
+ return $content.'<div id="pfButton"><script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="pfLink" onclick="window.print(); return false;" title="Print an optimized version of this web page"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-button.gif" alt="Print"/></a></div>';
51
+ } else {
52
+ return $content.'<div id="pfButton"><a href="'.$plink_url.$separator.'" title="Print an optimized version of this web page"><img id="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-button.gif" alt="Print"/></a></div>';
53
+ }
54
+ }
55
  }
56
 
57
  remove_action('the_content', 'pf_show_link');
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: printfriendly, vamsee
3
  Tags: print, friendly, save, paper, ink
4
  Requires at least: 1.5
5
  Tested up to: 2.7.1
6
- Stable tag: 1.0
7
 
8
  Adds the PrintFriendly button to your posts and pages. On clicking, it opens a lightbox-like modal window with cleaned up, print friendly content of your blog post or page. It will help your readers save ink, paper and thereby helps the environment too!
9
 
3
  Tags: print, friendly, save, paper, ink
4
  Requires at least: 1.5
5
  Tested up to: 2.7.1
6
+ Stable tag: 1.1
7
 
8
  Adds the PrintFriendly button to your posts and pages. On clicking, it opens a lightbox-like modal window with cleaned up, print friendly content of your blog post or page. It will help your readers save ink, paper and thereby helps the environment too!
9