Print, PDF, Email by PrintFriendly - Version 2.1.3

Version Description

Download this release

Release Info

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

Code changes from version 2.1.2 to 2.1.3

Files changed (6) hide show
  1. admin.css +7 -1
  2. pf.php +35 -91
  3. pf_admin.php +33 -18
  4. readme.txt +1 -1
  5. screenshot-2.jpg +0 -0
  6. screenshot-2.png +0 -0
admin.css CHANGED
@@ -1,6 +1,9 @@
1
  #pf_settings ul {
2
  float:left;
3
- margin:1em;
 
 
 
4
  }
5
  #pf_settings li{
6
  margin:1em 0;
@@ -229,3 +232,6 @@ ul#pftxtbuttons{
229
  .colorpicker_slider {
230
  background-position: bottom;
231
  }
 
 
 
1
  #pf_settings ul {
2
  float:left;
3
+ margin:1em ;
4
+ }
5
+ #pf_position ul {
6
+ margin-right:3em;
7
  }
8
  #pf_settings li{
9
  margin:1em 0;
232
  .colorpicker_slider {
233
  background-position: bottom;
234
  }
235
+ .clear{
236
+ clear:both;
237
+ }
pf.php CHANGED
@@ -2,14 +2,15 @@
2
  /*
3
  Plugin Name: Print Friendly and PDF
4
  Plugin URI: http://www.printfriendly.com
5
- Description: Print Friendly &amp; PDF button. Saves paper and ink when you print. [<a href="options-general.php?page=printfriendly/pf.php">Settings</a>]
6
  Developed by <a href="http://printfriendly.com" target="_blank">PrintFriendly</a>
7
- Version: 2.1.2
8
  Author: Print Friendly
9
  Author URI: http://www.PrintFriendly.com
10
 
11
  Changelog :
12
- 2.1.2 - Improvements to Setting page layout and PrintFriendly button launching from post pages.
 
13
  2.1.1 - Fixed admin settings bug.
14
  2.1 - Update for mult-author websites. Improvements to Settings page.
15
  2.0 - Customize the style, placement, and pages your printfriendly button appears.
@@ -25,7 +26,8 @@
25
  // add the settings page
26
  add_action('admin_menu', 'pf_menu');
27
  function pf_menu() {
28
- add_options_page('PrintFriendly Options', 'PrintFriendly', 'publish_posts', 'printfriendly', 'pf_options');
 
29
  }
30
 
31
  // add the settings link to the plugin page
@@ -53,7 +55,8 @@ $pf_pluginbase = plugin_basename(__FILE__);
53
  add_filter('plugin_action_links_'.$pf_pluginbase, 'pf_settings_link');
54
 
55
  // automaticaly add the link
56
- add_action('the_content', 'pf_show_link');
 
57
 
58
  // lets start our mess!
59
  function printfriendly_activation_handler(){
@@ -127,8 +130,6 @@ function pf_admin_styles() {
127
 
128
  ////////////////////////////// Where all the magic happens
129
 
130
-
131
-
132
  function pf_radio($name){
133
  $var = '<input name="pf_button_type" type="radio" value="'.$name.'"'; if( get_option('pf_button_type') == $name || ($name=="pf-button.gif" && get_option('pf_button_type')==null) ){$var .= ' checked="checked"'; } $var .= '/>';
134
  return $var.pf_button($name);
@@ -194,21 +195,15 @@ function pf_margin_down($dir){
194
  return $margin;
195
  }
196
  }
197
- // add css to the head
198
- function pf_head() {
199
- if (is_single() || is_page() || is_front_page() ) {
200
- ?>
201
- <link rel="stylesheet" href="http://cdn.printfriendly.com/printfriendly.css" type="text/css" />
202
- <?php
203
- }
204
- }
205
 
206
  add_action('wp_head', 'pf_head');
207
 
208
- // add button Taylor Version
209
- function pf_show_link($content)
210
  {
211
  $pf_display = get_option('pf_show_list');
 
 
212
  $plink_url = get_permalink();
213
 
214
  $separator = "?pfstyle=wp";
@@ -226,92 +221,41 @@ function pf_show_link($content)
226
 
227
  $button_link = '<div'.$style.'><a href="'.$plink_url.$separator.'" style="text-decoration: none; outline: none; color: '.get_option('pf_text_color').';">'.pf_button().'</a></div>';
228
 
229
- //This goes on article pages
230
- if (is_single() || is_page())
231
- {
232
  if (get_option('pf_content_placement')==null)
233
  return $content.$button;
 
234
  else
235
  return $button.$content;
236
- }
237
-
238
- else
239
  {
240
- if ($pf_display == 'single')
241
- return $content;
242
- elseif (get_option('pf_content_placement')==null)
243
- return $content.$button_link;
244
-
245
- else
246
- return $button_link.$content;
247
  }
248
-
249
- }
250
-
251
-
252
- /*function pf_js(){
253
- return '<script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script>';
254
- }*/
255
-
256
- /*
257
- // add button Jonathan
258
- function pf_show_link($content=false)
259
- {
260
- $pf_display = get_option('pf_show_list');
261
 
262
- if
263
- (
264
- ($pf_display=='all' || $pf_display == null)
265
- || ($pf_display=='single' && (is_single() || is_page()) )
266
- || ($pf_display=='manual' && $content==false) )
267
  {
268
- if($content==false)
269
- {
270
- $content = '';
271
- }
272
-
273
- // now lets get options setup before we start ouputting data
274
- $style=' style="text-align:';
275
- // position
276
- $pos = get_option('pf_content_position');
277
- if($pos==null){$pos='left';}
278
- $style.=$pos.';';
279
- //margin
280
- $style.=' margin: '.pf_margin_down('top').'px '.pf_margin_down('right').'px '.pf_margin_down('bottom').'px '.pf_margin_down('left').'px;';
281
- $style.='" ';
282
-
283
- if(is_single() || is_page())
284
- {
285
- $add = pf_js();
286
- }
287
-
288
- else{
289
- $add = '';
290
- }
291
-
292
- $post_url = get_permalink();
293
- $separator = "?pfstyle=wp";
294
-
295
- if (strpos($post_url,"?")!=false)
296
- {
297
- $separator = "&pfstyle=wp";
298
- }
299
- $plink_url = $post_url . $separator;
300
- $button = '<div'.$style.'class="pfButton">'.$add.'<a href="'.$plink_url.'" style="text-decoration: none; color: '.get_option('pf_text_color').';">'.pf_button().'</a></div>';
301
-
302
- if(get_option('pf_content_placement')==null)
303
- {
304
  return $content.$button;
305
- }
306
  else
307
- {
308
  return $button.$content;
309
- }
310
  }
311
 
312
- else
 
313
  {
314
- return $content;
 
 
 
 
 
 
 
 
315
  }
316
- }
317
- */
2
  /*
3
  Plugin Name: Print Friendly and PDF
4
  Plugin URI: http://www.printfriendly.com
5
+ Description: PrintFriendly & PDF optimizes your pages for print. Help your readers save paper and ink, plus enjoy your content in printed form. Website Name and URL are included to ensure repeat visitors and new visitors when printed versions are shared. [<a href="options-general.php?page=printfriendly/pf.php">Settings</a>]
6
  Developed by <a href="http://printfriendly.com" target="_blank">PrintFriendly</a>
7
+ Version: 2.1.3
8
  Author: Print Friendly
9
  Author URI: http://www.PrintFriendly.com
10
 
11
  Changelog :
12
+ 2.1.3 - Manual option for button placement. Security updates for multi-author sites.
13
+ 2.1.2 - Improvements to Setting page layout and PrintFriendly button launching from post pages.
14
  2.1.1 - Fixed admin settings bug.
15
  2.1 - Update for mult-author websites. Improvements to Settings page.
16
  2.0 - Customize the style, placement, and pages your printfriendly button appears.
26
  // add the settings page
27
  add_action('admin_menu', 'pf_menu');
28
  function pf_menu() {
29
+ if(current_user_can('manage_options'))
30
+ add_options_page('PrintFriendly Options', 'PrintFriendly', 'publish_posts', 'printfriendly', 'pf_options');
31
  }
32
 
33
  // add the settings link to the plugin page
55
  add_filter('plugin_action_links_'.$pf_pluginbase, 'pf_settings_link');
56
 
57
  // automaticaly add the link
58
+ if(get_option('pf_show_list')!= 'manual')
59
+ add_action('the_content', 'pf_show_link');
60
 
61
  // lets start our mess!
62
  function printfriendly_activation_handler(){
130
 
131
  ////////////////////////////// Where all the magic happens
132
 
 
 
133
  function pf_radio($name){
134
  $var = '<input name="pf_button_type" type="radio" value="'.$name.'"'; if( get_option('pf_button_type') == $name || ($name=="pf-button.gif" && get_option('pf_button_type')==null) ){$var .= ' checked="checked"'; } $var .= '/>';
135
  return $var.pf_button($name);
195
  return $margin;
196
  }
197
  }
 
 
 
 
 
 
 
 
198
 
199
  add_action('wp_head', 'pf_head');
200
 
201
+ // add button
202
+ function pf_show_link($content=false)
203
  {
204
  $pf_display = get_option('pf_show_list');
205
+ if(!$content && $pf_display!= 'manual')
206
+ return "";
207
  $plink_url = get_permalink();
208
 
209
  $separator = "?pfstyle=wp";
221
 
222
  $button_link = '<div'.$style.'><a href="'.$plink_url.$separator.'" style="text-decoration: none; outline: none; color: '.get_option('pf_text_color').';">'.pf_button().'</a></div>';
223
 
224
+ //This goes on article pages
225
+ if((is_single() || is_page()) && $pf_display=='single' || (is_single() && $pf_display=='posts'))
226
+ {
227
  if (get_option('pf_content_placement')==null)
228
  return $content.$button;
229
+
230
  else
231
  return $button.$content;
232
+ }
233
+ else if((is_single() || is_page()) && $pf_display=='manual')
 
234
  {
235
+ return $button;
 
 
 
 
 
 
236
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
237
 
238
+ else if((is_single() || is_page()) && $pf_display=='all')
 
 
 
 
239
  {
240
+ if (get_option('pf_content_placement')==null)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  return $content.$button;
242
+
243
  else
 
244
  return $button.$content;
 
245
  }
246
 
247
+ //This goes on homepage
248
+ else
249
  {
250
+ if($pf_display == 'manual')
251
+ return $button_link;
252
+ else if ($pf_display == 'single' || $pf_display == 'posts')
253
+ return $content;
254
+ else if (get_option('pf_content_placement')==null)
255
+ return $content.$button_link;
256
+
257
+ else
258
+ return $button_link.$content;
259
  }
260
+
261
+ }
pf_admin.php CHANGED
@@ -1,10 +1,15 @@
1
  <script type="text/javascript">
2
  function Toggle(hide) {
3
- document.getElementById("manual").style.display = "none";
4
  document.getElementById("imgurl").style.display = "none";
5
  document.getElementById(hide).style.display = "block";
6
 
7
  }
 
 
 
 
 
 
8
  </script>
9
  <?php
10
  if(isset($_POST['pf_save'])){
@@ -46,7 +51,7 @@ if(isset($_POST['pf_save'])){
46
 
47
  // display button
48
  if(isset($_POST['pf_show_list'])){
49
- if($_POST['pf_show_list']=="all" || $_POST['pf_show_list']=="single" || $_POST['pf_show_list']=="manual"){
50
  update_option('pf_show_list',$_POST['pf_show_list']);
51
  }else{
52
  // something isn't right
@@ -136,7 +141,7 @@ if(isset($_POST['pf_save'])){
136
  }
137
  }
138
  }
139
-
140
  ?>
141
  <div id="pf_settings" class="wrap">
142
  <div class="icon32" id="icon-options-general"></div>
@@ -190,9 +195,9 @@ if(isset($_POST['pf_save'])){
190
  <p>Enter an URL or click "Upload Image" to Upload an Image.</p>
191
  </div>
192
  </p>-->
193
- <br style="clear:both;" />
194
  </div>
195
- <br style="clear:both;" />
196
  </div>
197
 
198
 
@@ -218,18 +223,27 @@ if(isset($_POST['pf_save'])){
218
  <li><label><input type="text" name="pf_margin_bottom" value="<?php echo pf_margin_down('bottom'); ?>" maxlength="3"/>Bottom</label></li>
219
  </ul>
220
 
221
-
222
- <ul>
223
- <strong>Add PrintFriendly to These Pages</strong>
224
- <li><label><input type="radio" class="pf_show_list" name="pf_show_list" value="all" onclick="Toggle('hide');"<?php if(get_option('pf_show_list')=='all' || get_option('pf_show_list')==null ){echo ' checked="checked"';} ?>/>Homepage, Posts, and Pages</label></li> <li><label><input type="radio" class="pf_show_list" name="pf_show_list" value="single"<?php if(get_option('pf_show_list')=='single' || get_option('pf_show_list')==1){echo ' checked="checked"';} ?>/>Posts and Pages</label></li>
225
- <li><!-- <label><input type="radio" class="pf_show_list" name="pf_show_list" value="manual" onclick="Toggle('manual');"<?php if(get_option('pf_show_list')=='manual'){echo ' checked="checked"';} ?>/>Manual</label>
226
- <div id="manual">
227
- <p>PrintFriendly, by default, automatically inserts itself into your blog/site. When Manual mode is enabled this allows you to add the button wherever you like. Simply paste the following code into your template file. You need to know how to edit your Theme files or you might cause errors on your page.
228
- <h4>Code</h4>
229
- <code style="display:block;">&lt;?php if(function_exists('pf_show_link')){echo pf_show_link();} ?&gt;</code>
230
- </div>--></li>
231
- </ul>
232
- <br style="clear:both;" />
 
 
 
 
 
 
 
 
 
233
  </div>
234
  <div id="pf_save">
235
  <input type="submit" class="button-primary" value="Save Options" name="pf_save"/>
@@ -237,4 +251,5 @@ if(isset($_POST['pf_save'])){
237
  <div id="contact_pf">Like PrintFriendly? <a href="http://wordpress.org/extend/plugins/printfriendly/">Give us a rating</a>. Need help or have suggestions? <a href="mailto:support@PrintFriendly.com">support@PrintFriendly.com</a>.</div>
238
  </div>
239
  </form>
240
- </div>
 
1
  <script type="text/javascript">
2
  function Toggle(hide) {
 
3
  document.getElementById("imgurl").style.display = "none";
4
  document.getElementById(hide).style.display = "block";
5
 
6
  }
7
+ function hideit(){
8
+ document.getElementById("manual").style.display = "none";
9
+ }
10
+ function showit(){
11
+ document.getElementById("manual").style.display = "";
12
+ }
13
  </script>
14
  <?php
15
  if(isset($_POST['pf_save'])){
51
 
52
  // display button
53
  if(isset($_POST['pf_show_list'])){
54
+ if($_POST['pf_show_list']=="all" || $_POST['pf_show_list']=="single" || $_POST['pf_show_list']=="posts" || $_POST['pf_show_list']=="manual"){
55
  update_option('pf_show_list',$_POST['pf_show_list']);
56
  }else{
57
  // something isn't right
141
  }
142
  }
143
  }
144
+ if( current_user_can('manage_options') ) {
145
  ?>
146
  <div id="pf_settings" class="wrap">
147
  <div class="icon32" id="icon-options-general"></div>
195
  <p>Enter an URL or click "Upload Image" to Upload an Image.</p>
196
  </div>
197
  </p>-->
198
+ <br class='clear' />
199
  </div>
200
+ <br class='clear' />
201
  </div>
202
 
203
 
223
  <li><label><input type="text" name="pf_margin_bottom" value="<?php echo pf_margin_down('bottom'); ?>" maxlength="3"/>Bottom</label></li>
224
  </ul>
225
 
226
+
227
+ <ul>
228
+ <strong>Add PrintFriendly to These Pages</strong>
229
+ <li><label><input type="radio" class="pf_show_list" name="pf_show_list" value="all" onclick="hideit();"<?php if(get_option('pf_show_list')=='all' || get_option('pf_show_list')==null ){echo ' checked="checked"';} ?>/>Homepage, Posts, and Pages</label></li>
230
+ <li><label><input type="radio" class="pf_show_list" name="pf_show_list" value="single" onclick="hideit();"<?php if(get_option('pf_show_list')=='single' || get_option('pf_show_list')==1){echo ' checked="checked"';} ?>/>Posts and Pages</label></li>
231
+ <li>
232
+ <label>
233
+ <input type="radio" class="pf_show_list" name="pf_show_list" value="posts" onclick="hideit();"<?php if(get_option('pf_show_list')=='posts' || get_option('pf_show_list')==2){echo ' checked="checked"';} ?>/>Posts</label></li>
234
+
235
+ <li>
236
+ <label>
237
+ <input type="radio" class="pf_show_list" name="pf_show_list" value="manual" onclick="showit();"<?php if(get_option('pf_show_list')=='manual' || get_option('pf_show_list')==3){echo ' checked="checked"';} ?>/>Manual
238
+ </label>
239
+
240
+ <div id="manual" <?php if(get_option('pf_show_list') != 'manual') echo 'style="display:none"'?>>
241
+ <p>Copy and paste the code below anywhere in your template pages.</p>
242
+ <code style="display:block;">&lt;?php if(function_exists('pf_show_link')){echo pf_show_link();} ?&gt;</code>
243
+ </div>
244
+ </li>
245
+ </ul>
246
+ <br class='clear'/>
247
  </div>
248
  <div id="pf_save">
249
  <input type="submit" class="button-primary" value="Save Options" name="pf_save"/>
251
  <div id="contact_pf">Like PrintFriendly? <a href="http://wordpress.org/extend/plugins/printfriendly/">Give us a rating</a>. Need help or have suggestions? <a href="mailto:support@PrintFriendly.com">support@PrintFriendly.com</a>.</div>
252
  </div>
253
  </form>
254
+ </div>
255
+ <?php }?>
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: Print Friendly
3
  Tags: print, pdf, printer, printing, printable, widget, plugin
4
  Requires at least: 1.5
5
- Stable tag: 2.1.2
6
 
7
  #1 Print and PDF button for your wp site. Printer Friendly pages without coding, css, or print.css. Fast, easy, and professional.
8
 
2
  Contributors: Print Friendly
3
  Tags: print, pdf, printer, printing, printable, widget, plugin
4
  Requires at least: 1.5
5
+ Stable tag: 2.1.3
6
 
7
  #1 Print and PDF button for your wp site. Printer Friendly pages without coding, css, or print.css. Fast, easy, and professional.
8
 
screenshot-2.jpg DELETED
Binary file
screenshot-2.png ADDED
Binary file