Print, PDF, Email by PrintFriendly - Version 1.0

Version Description

Download this release

Release Info

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

Code changes from version 0.9 to 1.0

Files changed (2) hide show
  1. pf.php +32 -14
  2. readme.txt +1 -1
pf.php CHANGED
@@ -3,35 +3,50 @@
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: 0.9
7
  Author: Vamsee Kanakala
8
  Author URI: http://kanakala.net
9
  */
10
 
11
  function pf_show_link($content)
12
  {
13
- if (is_single() || is_page()) {
14
- $button_type = get_option('pf_button_type');
15
-
16
  switch ($button_type) {
17
  case "text-only":
18
- 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>';
 
 
 
 
19
  break;
20
  case "pf-button-big.gif":
21
- 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>';
 
 
 
 
22
  break;
23
  case "pf-icon-small.gif":
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" 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>';
 
 
 
 
25
  break;
26
  case "pf-icon.gif":
27
- 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>';
 
 
 
 
28
  break;
29
  default:
30
- 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>';
31
- }
32
- } else {
33
- return $content;
34
- }
 
35
  }
36
 
37
  remove_action('the_content', 'pf_show_link');
@@ -42,7 +57,10 @@ add_action('admin_menu', 'pf_menu');
42
  function pf_head() {
43
  if (is_single() || is_page()) {
44
  ?>
45
- <link rel="stylesheet" href="http://cdn.printfriendly.com/printfriendly.css" type="text/css" />
 
 
 
46
  <?php
47
  }
48
  }
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
  */
10
 
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');
57
  function pf_head() {
58
  if (is_single() || is_page()) {
59
  ?>
60
+ <?php if ($_GET["pfstyle"] == "wp") { ?>
61
+ <script type="text/javascript">var pfstyle = 'bk';</script>
62
+ <?php } ?>
63
+ <link rel="stylesheet" href="http://cdn.printfriendly.com/printfriendly.css" type="text/css" />
64
  <?php
65
  }
66
  }
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: 0.9
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.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