Print, PDF, Email by PrintFriendly - Version 1.2

Version Description

Download this release

Release Info

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

Code changes from version 1.1 to 1.2

Files changed (2) hide show
  1. pf.php +41 -8
  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.1
7
  Author: Vamsee Kanakala
8
  Author URI: http://kanakala.net
9
  */
@@ -11,6 +11,8 @@
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)
@@ -21,35 +23,50 @@ function pf_show_link($content)
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
  }
@@ -78,17 +95,25 @@ function pf_menu() {
78
 
79
  function pf_options() {
80
  $option_name = 'pf_button_type';
 
 
81
  if (get_option($option_name)) {
82
- if (isset($_POST['pf_button_type'])) {
83
- update_option($option_name, $_POST['pf_button_type']);
 
 
 
 
84
  ?>
85
  <div class="updated"><p><strong><?php _e('Option saved.'); ?></strong></p></div>
86
  <?php
87
  }
88
  } else {
89
  add_option($option_name, 'pf-button.gif');
 
90
  }
91
  $option_value = get_option($option_name);
 
92
  ?>
93
  <div class="wrap">
94
  <h2>PrintFriendly Options</h2>
@@ -130,6 +155,14 @@ function pf_options() {
130
  </td>
131
  </tr>
132
  </table>
 
 
 
 
 
 
 
 
133
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
134
  </form>
135
  </div>
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.2
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
+ $show_list = get_option('pf_show_list');
15
+
16
  $plink_url = get_permalink();
17
  $separator = "?pfstyle=wp";
18
  if (strpos($plink_url,"?")!=false)
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" style="text-decoration: none;"><span style="color: rgb(85, 117, 12);">Print Friendly</span></a></div>';
25
  } else {
26
+ if ($show_list != 0)
27
+ return $content;
28
+ else
29
+ 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>';
30
  }
31
  break;
32
  case "pf-button-big.gif":
33
  if (is_single() || is_page()) {
34
  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>';
35
  } else {
36
+ if ($show_list != 0)
37
+ return $content;
38
+ else
39
+ 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>';
40
  }
41
  break;
42
  case "pf-icon-small.gif":
43
  if (is_single() || is_page()) {
44
  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>';
45
  } else {
46
+ if ($show_list != 0)
47
+ return $content;
48
+ else
49
+ 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>';
50
  }
51
  break;
52
  case "pf-icon.gif":
53
  if (is_single() || is_page()) {
54
  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>';
55
  } else {
56
+ if ($show_list != 0)
57
+ return $content;
58
+ else
59
+ 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>';
60
  }
61
  break;
62
  default:
63
  if (is_single() || is_page()) {
64
  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>';
65
  } else {
66
+ if ($show_list != 0)
67
+ return $content;
68
+ else
69
+ 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>';
70
  }
71
  }
72
  }
95
 
96
  function pf_options() {
97
  $option_name = 'pf_button_type';
98
+ $option2_name = 'pf_show_list';
99
+
100
  if (get_option($option_name)) {
101
+ if (isset($_POST[$option_name])) {
102
+ update_option($option_name, $_POST[$option_name]);
103
+ if (isset($_POST[$option2_name]))
104
+ update_option($option2_name, 1);
105
+ else
106
+ update_option($option2_name, 0);
107
  ?>
108
  <div class="updated"><p><strong><?php _e('Option saved.'); ?></strong></p></div>
109
  <?php
110
  }
111
  } else {
112
  add_option($option_name, 'pf-button.gif');
113
+ add_option($option2_name, 0);
114
  }
115
  $option_value = get_option($option_name);
116
+ $option2_value = get_option($option2_name);
117
  ?>
118
  <div class="wrap">
119
  <h2>PrintFriendly Options</h2>
155
  </td>
156
  </tr>
157
  </table>
158
+ <h3>Display Choices</h3>
159
+ <table cellspacing="20" cellpadding="20">
160
+ <tr valign="top">
161
+ <td>Show buttons only on individual posts and pages (not on frontpage/listings)</td>
162
+ <td><input name="pf_show_list" type="checkbox" value=<?php echo $option2_value ?>
163
+ <?php if ($option2_value == 1) _e('checked="checked"') ?>/></td>
164
+ </tr>
165
+ </table>
166
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
167
  </form>
168
  </div>
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.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
 
3
  Tags: print, friendly, save, paper, ink
4
  Requires at least: 1.5
5
  Tested up to: 2.7.1
6
+ Stable tag: 1.2
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