Version Description
Download this release
Release Info
| Developer | printfriendly |
| Plugin | |
| Version | 0.2 |
| Comparing to | |
| See all releases | |
Version 0.2
- pf.php +84 -0
- readme.txt +24 -0
pf.php
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 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.2
|
| 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 |
+
if ($button_type != 'text-only')
|
| 17 |
+
return $content.'<div><script src="http://www.printfriendly.com/javascripts/printfriendly.js" type="text/javascript"></script><a 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;" src="http://www.printfriendly.com/images/'.$button_type.'" alt="Print"/></a></div>';
|
| 18 |
+
else
|
| 19 |
+
return $content.'<script src="http://www.printfriendly.com/javascripts/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">Print</a>';
|
| 20 |
+
} else {
|
| 21 |
+
return $content;
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
remove_action('the_content', 'pf_show_link');
|
| 26 |
+
add_action('the_content', 'pf_show_link', 98);
|
| 27 |
+
|
| 28 |
+
add_action('admin_menu', 'pf_menu');
|
| 29 |
+
|
| 30 |
+
function pf_menu() {
|
| 31 |
+
add_options_page('PrintFriendly Options', 'PrintFriendly', 8, __FILE__, 'pf_options');
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
function pf_options() {
|
| 35 |
+
$option_name = 'pf_button_type';
|
| 36 |
+
if (isset($_POST['pf_button_type'])) {
|
| 37 |
+
if (get_option($option_name))
|
| 38 |
+
update_option($option_name, $_POST['pf_button_type']);
|
| 39 |
+
else
|
| 40 |
+
add_option($option_name, 'printfriendly.gif');
|
| 41 |
+
?>
|
| 42 |
+
<div class="updated"><p><strong><?php _e('Option saved.'); ?></strong></p></div>
|
| 43 |
+
<?php
|
| 44 |
+
}
|
| 45 |
+
$option_value = get_option($option_name);
|
| 46 |
+
?>
|
| 47 |
+
<div class="wrap">
|
| 48 |
+
<h2>PrintFriendly Options</h2>
|
| 49 |
+
<h3>Choose your button</h3>
|
| 50 |
+
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
| 51 |
+
<?php wp_nonce_field('update-options'); ?>
|
| 52 |
+
<table cellspacing="20" cellpadding="20">
|
| 53 |
+
<tr valign="top">
|
| 54 |
+
<td><input name="pf_button_type" type="radio" value="printfriendly.gif"
|
| 55 |
+
<?php if ($option_value == 'printfriendly.gif') _e('checked="checked"') ?>/></td>
|
| 56 |
+
<td><img src="http://www.printfriendly.com/images/printfriendly.gif" width="75" height="16" alt="Select This Button Style" /></td>
|
| 57 |
+
</tr>
|
| 58 |
+
<tr valign="top">
|
| 59 |
+
<td><input name="pf_button_type" type="radio" value="printfriendly-med-txt.gif"
|
| 60 |
+
<?php if ($option_value == 'printfriendly-med-txt.gif') _e('checked="checked"') ?>/></td>
|
| 61 |
+
<td><img src="http://www.printfriendly.com/images/printfriendly-med-txt.gif" alt="Select this button style" width="76" height="28" /></td>
|
| 62 |
+
</tr>
|
| 63 |
+
<tr valign="top">
|
| 64 |
+
<td><input name="pf_button_type" type="radio" value="printfriendly-nobg.gif"
|
| 65 |
+
<?php if ($option_value == 'printfriendly-nobg.gif') _e('checked="checked"') ?>/></td>
|
| 66 |
+
<td><img src="http://www.printfriendly.com/images/printfriendly-nobg.gif" width="75" height="16" alt="Select this button style" /></td>
|
| 67 |
+
</tr>
|
| 68 |
+
<tr>
|
| 69 |
+
<td><input name="pf_button_type" type="radio" value="printfriendly-med.gif"
|
| 70 |
+
<?php if ($option_value == 'printfriendly-med.gif') _e('checked="checked"') ?>/></td>
|
| 71 |
+
<td><img src="http://www.printfriendly.com/images/printfriendly-med.gif" width="25" height="29" alt="Select this button style" /></td>
|
| 72 |
+
</tr>
|
| 73 |
+
<tr>
|
| 74 |
+
<td><input name="pf_button_type" type="radio" value="text-only"
|
| 75 |
+
<?php if ($option_value == 'text-only') _e('checked="checked"') ?>/></td>
|
| 76 |
+
<td><a href="#" onclick="return false;" style="text-decoration: none;">Print</a> (text only)</td>
|
| 77 |
+
</tr>
|
| 78 |
+
</table>
|
| 79 |
+
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
| 80 |
+
</form>
|
| 81 |
+
</div>
|
| 82 |
+
<?php
|
| 83 |
+
}
|
| 84 |
+
?>
|
readme.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
=== PrintFriendly ===
|
| 2 |
+
Contributors: vamsee, printfriendly
|
| 3 |
+
Tags: print, save, paper, ink
|
| 4 |
+
Requires at least: 1.5
|
| 5 |
+
Tested up to: 2.7
|
| 6 |
+
Stable tag: 0.2
|
| 7 |
+
|
| 8 |
+
Adds the PrintFriendly button to your posts and pages. Calls the widget at PrintFriendly.com to help you save ink and paper.
|
| 9 |
+
|
| 10 |
+
== Description ==
|
| 11 |
+
|
| 12 |
+
This plugin contains a simple button with embedded javascript link to start the PrintFriendly widget, which lets a user print
|
| 13 |
+
only the post or page without other clutter from the page. It also lets the user choose the content he wants to print and the
|
| 14 |
+
user can also genrate a PDF if he likes to save the content.
|
| 15 |
+
|
| 16 |
+
== Installation ==
|
| 17 |
+
|
| 18 |
+
1. Download the printfriendly.zip file and unzip it.
|
| 19 |
+
2. Move the resulting folder into wp-content/plugins folder your wordpress install
|
| 20 |
+
3. Activate the plugin in your Wordpress Admin area.
|
| 21 |
+
|
| 22 |
+
== Support ==
|
| 23 |
+
|
| 24 |
+
If you have any issues with the plugin or the PrintFriendly widget, please write to support@printfriendly.com
|
