Print, PDF, Email by PrintFriendly - Version 0.7

Version Description

Download this release

Release Info

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

Code changes from version 0.6 to 0.7

Files changed (2) hide show
  1. pf.php +50 -27
  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: 0.6
7
  Author: Vamsee Kanakala
8
  Author URI: http://kanakala.net
9
  */
@@ -13,10 +13,22 @@ function pf_show_link($content)
13
  if (is_single() || is_page()) {
14
  $button_type = get_option('pf_button_type');
15
 
16
- if ($button_type != 'text-only')
17
- return $content.'<div id="pfButton"><script src="http://cdn.printnicer.com/printfriendly.js" type="text/javascript"></script><a id="pfLink" href="http://www.printfriendly.com" onclick="window.print(); return false;" title="Print an optimized version of this web page"><img id="printfriendly" style="border:none; padding:0;" src="http://www.printfriendly.com/images/'.$button_type.'" alt="Print" /></a></div>';
18
- else
19
- return $content.'<script src="http://cdn.printnicer.com/printfriendly.js" type="text/javascript"></script><a id="pfLink" href="http://www.printfriendly.com" onclick="window.print(); return false;" title="Print an optimized version of this web page">Print</a>';
 
 
 
 
 
 
 
 
 
 
 
 
20
  } else {
21
  return $content;
22
  }
@@ -28,9 +40,11 @@ add_action('the_content', 'pf_show_link', 98);
28
  add_action('admin_menu', 'pf_menu');
29
 
30
  function pf_head() {
 
31
  ?>
32
  <link rel="stylesheet" href="http://cdn.printnicer.com/printfriendly.css" type="text/css" />
33
  <?php
 
34
  }
35
 
36
  add_action('wp_head', 'pf_head');
@@ -41,14 +55,15 @@ function pf_menu() {
41
 
42
  function pf_options() {
43
  $option_name = 'pf_button_type';
44
- if (isset($_POST['pf_button_type'])) {
45
- if (get_option($option_name))
46
  update_option($option_name, $_POST['pf_button_type']);
47
- else
48
- add_option($option_name, 'printfriendly.gif');
49
- ?>
50
- <div class="updated"><p><strong><?php _e('Option saved.'); ?></strong></p></div>
51
- <?php
 
52
  }
53
  $option_value = get_option($option_name);
54
  ?>
@@ -59,29 +74,37 @@ function pf_options() {
59
  <?php wp_nonce_field('update-options'); ?>
60
  <table cellspacing="20" cellpadding="20">
61
  <tr valign="top">
62
- <td><input name="pf_button_type" type="radio" value="printfriendly.gif"
63
- <?php if ($option_value == 'printfriendly.gif') _e('checked="checked"') ?>/></td>
64
- <td><img src="http://www.printfriendly.com/images/printfriendly.gif" width="75" height="16" alt="Select This Button Style" /></td>
65
  </tr>
66
  <tr valign="top">
67
- <td><input name="pf_button_type" type="radio" value="printfriendly-med-txt.gif"
68
- <?php if ($option_value == 'printfriendly-med-txt.gif') _e('checked="checked"') ?>/></td>
69
- <td><img src="http://www.printfriendly.com/images/printfriendly-med-txt.gif" alt="Select this button style" width="76" height="28" /></td>
70
  </tr>
71
  <tr valign="top">
72
- <td><input name="pf_button_type" type="radio" value="printfriendly-nobg.gif"
73
- <?php if ($option_value == 'printfriendly-nobg.gif') _e('checked="checked"') ?>/></td>
74
- <td><img src="http://www.printfriendly.com/images/printfriendly-nobg.gif" width="75" height="16" alt="Select this button style" /></td>
 
 
 
75
  </tr>
76
  <tr>
77
- <td><input name="pf_button_type" type="radio" value="printfriendly-med.gif"
78
- <?php if ($option_value == 'printfriendly-med.gif') _e('checked="checked"') ?>/></td>
79
- <td><img src="http://www.printfriendly.com/images/printfriendly-med.gif" width="25" height="29" alt="Select this button style" /></td>
 
 
 
80
  </tr>
81
  <tr>
82
- <td><input name="pf_button_type" type="radio" value="text-only"
83
- <?php if ($option_value == 'text-only') _e('checked="checked"') ?>/></td>
84
- <td><a href="#" onclick="return false;" style="text-decoration: none;">Print</a> (text only)</td>
 
 
85
  </tr>
86
  </table>
87
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
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.7
7
  Author: Vamsee Kanakala
8
  Author URI: http://kanakala.net
9
  */
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.'<script src="http://cdn.printnicer.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="printfriendly" 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>';
19
+ break;
20
+ case "pf-button-big.gif":
21
+ return $content.'<script src="http://cdn.printnicer.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="printfriendly" onclick="window.print(); return false;" title="Print an optimized version of this web page"><img style="border:none;" src="http://www.printfriendly.com/images/pf-button-big.gif" alt="Print"/></a>';
22
+ break;
23
+ case "pf-icon-small.gif":
24
+ return $content.'<script src="http://cdn.printnicer.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="printfriendly" onclick="window.print(); return false;" title="Print an optimized version of this web page" style="text-decoration: none;"><img style="border:none;" src="http://www.printfriendly.com/images/pf-icon-small.gif" alt="Print"/><span style="font-size: 12px; color: rgb(85, 117, 12);">Print Friendly</span></a>';
25
+ break;
26
+ case "pf-icon.gif":
27
+ return $content.'<script src="http://cdn.printnicer.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="printfriendly" onclick="window.print(); return false;" title="Print an optimized version of this web page" style="text-decoration: none;"><img style="border:none;" src="http://www.printfriendly.com/images/pf-icon.gif" alt="Print"/><span style="font-size: 15px; color: rgb(85, 117, 12);">Print Friendly</span></a>';
28
+ break;
29
+ default:
30
+ return $content.'<script src="http://cdn.printnicer.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" id="printfriendly" onclick="window.print(); return false;" title="Print an optimized version of this web page"><img style="border:none;" src="http://www.printfriendly.com/images/pf-button.gif" alt="Print"/></a>';
31
+ }
32
  } else {
33
  return $content;
34
  }
40
  add_action('admin_menu', 'pf_menu');
41
 
42
  function pf_head() {
43
+ if (is_single() || is_page()) {
44
  ?>
45
  <link rel="stylesheet" href="http://cdn.printnicer.com/printfriendly.css" type="text/css" />
46
  <?php
47
+ }
48
  }
49
 
50
  add_action('wp_head', 'pf_head');
55
 
56
  function pf_options() {
57
  $option_name = 'pf_button_type';
58
+ if (get_option($option_name)) {
59
+ if (isset($_POST['pf_button_type'])) {
60
  update_option($option_name, $_POST['pf_button_type']);
61
+ ?>
62
+ <div class="updated"><p><strong><?php _e('Option saved.'); ?></strong></p></div>
63
+ <?php
64
+ }
65
+ } else {
66
+ add_option($option_name, 'pf-button.gif');
67
  }
68
  $option_value = get_option($option_name);
69
  ?>
74
  <?php wp_nonce_field('update-options'); ?>
75
  <table cellspacing="20" cellpadding="20">
76
  <tr valign="top">
77
+ <td><input name="pf_button_type" type="radio" value="pf-button.gif"
78
+ <?php if ($option_value == 'pf-button.gif') _e('checked="checked"') ?>/></td>
79
+ <td><img src="http://www.printfriendly.com/images/pf-button.gif" alt="Select This Button Style" /></td>
80
  </tr>
81
  <tr valign="top">
82
+ <td><input name="pf_button_type" type="radio" value="pf-button-big.gif"
83
+ <?php if ($option_value == 'pf-button-big.gif') _e('checked="checked"') ?>/></td>
84
+ <td><img src="http://www.printfriendly.com/images/pf-button-big.gif" alt="Select this button style" /></td>
85
  </tr>
86
  <tr valign="top">
87
+ <td><input name="pf_button_type" type="radio" value="pf-icon-small.gif"
88
+ <?php if ($option_value == 'pf-icon-small.gif') _e('checked="checked"') ?>/></td>
89
+ <td>
90
+ <img src="http://www.printfriendly.com/images/pf-icon-small.gif" alt="Select this button style" />
91
+ <span style="font-size: 12px; color: rgb(85, 117, 12);">Print Friendly</span>
92
+ </td>
93
  </tr>
94
  <tr>
95
+ <td><input name="pf_button_type" type="radio" value="pf-icon.gif"
96
+ <?php if ($option_value == 'pf-icon.gif') _e('checked="checked"') ?>/></td>
97
+ <td>
98
+ <img src="http://www.printfriendly.com/images/pf-icon.gif" alt="Select this button style" />
99
+ <span style="font-size: 15px; color: rgb(85, 117, 12);">Print Friendly</span>
100
+ </td>
101
  </tr>
102
  <tr>
103
+ <td><input name="pf_button_type" type="radio" value="text-only" <?php if ($option_value == 'text-only') _e('checked="checked"') ?>/></td>
104
+ <td>
105
+ <a href="#" onclick="return false;" style="text-decoration: none;">
106
+ <span style="color: rgb(85, 117, 12);">Print Friendly</span></a> (text-only)
107
+ </td>
108
  </tr>
109
  </table>
110
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
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.6
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: 0.7
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