Version Description
- New features: Custom header, disable click-to-delete, https support (beta), PrintFriendly Pro (ad-free).
Download this release
Release Info
| Developer | printfriendly |
| Plugin | |
| Version | 3.0.9 |
| Comparing to | |
| See all releases | |
Code changes from version 3.0.8 to 3.0.9
admin.css
CHANGED
|
@@ -1,7 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
input[type="radio"] {
|
| 2 |
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
| 3 |
}
|
| 4 |
|
|
|
|
| 5 |
/* WP lacks styling for type="number", so in here for now */
|
| 6 |
input[type="number"] {
|
| 7 |
border-color: #DFDFDF;
|
|
@@ -16,22 +71,49 @@ input[type="number"] {
|
|
| 16 |
-webkit-box-sizing: border-box;
|
| 17 |
-ms-box-sizing: border-box;
|
| 18 |
box-sizing: border-box;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
}
|
| 26 |
|
| 27 |
.icon32 {
|
| 28 |
background: url(images/pf-icon.png) center center no-repeat;
|
| 29 |
}
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
}
|
| 34 |
-
|
| 35 |
#addmanual-help {
|
| 36 |
display: none;
|
| 37 |
}
|
|
@@ -226,7 +308,3 @@ input[type="number"] {
|
|
| 226 |
.colorpicker_slider {
|
| 227 |
background-position: bottom;
|
| 228 |
}
|
| 229 |
-
|
| 230 |
-
.clear {
|
| 231 |
-
clear: both;
|
| 232 |
-
}
|
| 1 |
+
label{
|
| 2 |
+
display: block;
|
| 3 |
+
margin: 1.5em 0;
|
| 4 |
+
}
|
| 5 |
+
h3{
|
| 6 |
+
margin: 3em 0 2em;
|
| 7 |
+
border-bottom: 1px solid #ccc;
|
| 8 |
+
padding-bottom:.75em;
|
| 9 |
+
clear: both;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
#buttongroup1, #buttongroup2, #buttongroup3, #custom-txt div, #button-placement div{
|
| 13 |
+
display: block;
|
| 14 |
+
margin-right: 3em;
|
| 15 |
+
float: left;
|
| 16 |
+
}
|
| 17 |
+
#custom-txt div#txt-size, div#button-placement-options{
|
| 18 |
+
margin-right: 0;
|
| 19 |
+
}
|
| 20 |
+
#custom-button-preview {
|
| 21 |
+
clear:both;
|
| 22 |
+
padding-top: 20px;
|
| 23 |
+
margin-left: 2em;
|
| 24 |
+
}
|
| 25 |
+
#custom-button-preview img{
|
| 26 |
+
margin-right: 6px;
|
| 27 |
+
}
|
| 28 |
+
#custom, #placement-adv-options{
|
| 29 |
+
float: left;
|
| 30 |
+
}
|
| 31 |
+
#custom-txt, #custom-img {
|
| 32 |
+
margin: 2em 0 2em 2em;
|
| 33 |
+
clear: both;
|
| 34 |
+
|
| 35 |
+
}
|
| 36 |
+
.description{
|
| 37 |
+
color: #cacaca;
|
| 38 |
+
}
|
| 39 |
+
.printfriendly-text2{
|
| 40 |
+
font-family: verdana;
|
| 41 |
+
font-size: 14px;
|
| 42 |
+
color: #6D9F00;
|
| 43 |
+
}
|
| 44 |
+
select{
|
| 45 |
+
display: block;
|
| 46 |
+
margin: .5em .5em 2em 0;
|
| 47 |
+
}
|
| 48 |
+
select#javascript, select#website_protocol{
|
| 49 |
+
display: inline-block;
|
| 50 |
+
margin-bottom: 0;
|
| 51 |
+
}
|
| 52 |
input[type="radio"] {
|
| 53 |
cursor: pointer;
|
| 54 |
+
|
| 55 |
+
margin-right: 10px;
|
| 56 |
+
vertical-align: middle;
|
| 57 |
}
|
| 58 |
|
| 59 |
+
|
| 60 |
/* WP lacks styling for type="number", so in here for now */
|
| 61 |
input[type="number"] {
|
| 62 |
border-color: #DFDFDF;
|
| 71 |
-webkit-box-sizing: border-box;
|
| 72 |
-ms-box-sizing: border-box;
|
| 73 |
box-sizing: border-box;
|
| 74 |
+
width: 36px;
|
| 75 |
+
margin-right: .5em;
|
| 76 |
+
}
|
| 77 |
+
#pf-shortcode{
|
| 78 |
+
|
| 79 |
+
margin-left: 2em;
|
| 80 |
+
}
|
| 81 |
+
.custom-logo label, .custom-logo input, #pf-favicon {
|
| 82 |
+
display: inline-block;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
.custom-logo input {
|
| 86 |
+
width: 20em;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
.custom-logo label {
|
| 90 |
+
margin-left: 5px;
|
| 91 |
+
margin-right: 2px;
|
| 92 |
}
|
| 93 |
|
| 94 |
+
label#pf-favicon {
|
| 95 |
+
vertical-align: baseline;
|
| 96 |
+
margin: 0;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
.printfriendly-details input {
|
| 100 |
+
width: 20em;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
.printfriendly-details label {
|
| 104 |
+
margin-left: 5px;
|
| 105 |
+
margin-right: 2px;
|
| 106 |
}
|
| 107 |
|
| 108 |
.icon32 {
|
| 109 |
background: url(images/pf-icon.png) center center no-repeat;
|
| 110 |
}
|
| 111 |
|
| 112 |
+
#after-submit{
|
| 113 |
+
border-top: 2px dashed #dfdfdf;
|
| 114 |
+
margin:4em 0;
|
| 115 |
+
padding-top:1em;
|
| 116 |
}
|
|
|
|
| 117 |
#addmanual-help {
|
| 118 |
display: none;
|
| 119 |
}
|
| 308 |
.colorpicker_slider {
|
| 309 |
background-position: bottom;
|
| 310 |
}
|
|
|
|
|
|
|
|
|
|
|
|
admin.js
CHANGED
|
@@ -1,69 +1,139 @@
|
|
| 1 |
// Throughout the admin I chose to use slow animations to make it clear that stuff is being hidden or shown depending on settings.
|
| 2 |
jQuery(document).ready(function() {
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
// Throughout the admin I chose to use slow animations to make it clear that stuff is being hidden or shown depending on settings.
|
| 2 |
jQuery(document).ready(function() {
|
| 3 |
+
jQuery('.show_list').change(function() {
|
| 4 |
+
if (jQuery('.show_list:checked').val()=='manual') {
|
| 5 |
+
jQuery('#addmanual-help').show('slow');
|
| 6 |
+
jQuery('.content_placement').hide('slow');
|
| 7 |
+
jQuery('.content_placement input').attr('disabled','disabled');
|
| 8 |
+
} else {
|
| 9 |
+
jQuery('#addmanual-help').hide('slow');
|
| 10 |
+
jQuery('.content_placement').show('slow');
|
| 11 |
+
jQuery('.content_placement input').removeAttr('disabled');
|
| 12 |
+
}
|
| 13 |
+
});
|
| 14 |
+
if (jQuery('.show_list:checked').val()=='manual') {
|
| 15 |
+
jQuery('#addmanual-help').show('slow');
|
| 16 |
+
jQuery('.content_placement').hide();
|
| 17 |
+
jQuery('.content_placement input').attr('disabled','disabled');
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
jQuery('#colorSelector').ColorPicker({
|
| 21 |
+
color: jQuery('#text_color').val(),
|
| 22 |
+
onShow: function (colpkr) {
|
| 23 |
+
jQuery(colpkr).fadeIn(500);
|
| 24 |
+
return false;
|
| 25 |
+
},
|
| 26 |
+
onHide: function (colpkr) {
|
| 27 |
+
jQuery(colpkr).fadeOut(500);
|
| 28 |
+
return false;
|
| 29 |
+
},
|
| 30 |
+
onChange: function (hsb, hex, rgb) {
|
| 31 |
+
jQuery('#colorSelector div').css('backgroundColor', '#' + hex);
|
| 32 |
+
jQuery('#text_color').val('#' + hex);
|
| 33 |
+
jQuery('.printfriendly-text2').css('color','#' + hex);
|
| 34 |
+
}
|
| 35 |
+
});
|
| 36 |
+
|
| 37 |
+
jQuery('#text_size').change(function(){
|
| 38 |
+
size = jQuery('#text_size').val();
|
| 39 |
+
jQuery('.printfriendly-text2').css('font-size',parseInt(size));
|
| 40 |
+
}).change();
|
| 41 |
+
|
| 42 |
+
jQuery('#custom_text').change(function(){
|
| 43 |
+
pf_custom_text_change();
|
| 44 |
+
}).change();
|
| 45 |
+
|
| 46 |
+
jQuery('#custom_text').keyup(function(){
|
| 47 |
+
pf_custom_text_change();
|
| 48 |
+
});
|
| 49 |
+
|
| 50 |
+
function pf_custom_text_change(){
|
| 51 |
+
jQuery('#buttongroup3 span:not(.printandpdf)').text( jQuery('#custom_text').val() );
|
| 52 |
+
jQuery('#custom span.printfriendly-text2').text( jQuery('#custom_text').val() );
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
jQuery('.printfriendly-text2').css('color', jQuery('#text_color').val() );
|
| 56 |
+
|
| 57 |
+
function pf_initialize_preview(urlInputSelector, previewSelector) {
|
| 58 |
+
var el = jQuery(urlInputSelector);
|
| 59 |
+
var preview = jQuery(previewSelector + '-preview');
|
| 60 |
+
var error = jQuery(previewSelector + '-error');
|
| 61 |
+
el.bind('input paste change keyup', function() {
|
| 62 |
+
setTimeout(function() {
|
| 63 |
+
var img = jQuery('<img />').on('error', function() {
|
| 64 |
+
preview.html('');
|
| 65 |
+
if(img.attr('src') != '') {
|
| 66 |
+
error.html('<div class="error settings-error"><p><strong>Invalid Image URL</strong></p></div>');
|
| 67 |
+
}
|
| 68 |
+
}).attr('src', jQuery.trim(el.val()));
|
| 69 |
+
error.html('');
|
| 70 |
+
preview.html('').append(img);
|
| 71 |
+
}, 100);
|
| 72 |
+
});
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
pf_initialize_preview('#custom_image', '#pf-custom-button');
|
| 76 |
+
pf_initialize_preview('#upload-an-image', '#pf-image');
|
| 77 |
+
jQuery('#custom_image, #upload-an-image').change();
|
| 78 |
+
jQuery('#custom_image').bind('focus', function() {
|
| 79 |
+
jQuery('#custom-image').attr('checked', 'checked');
|
| 80 |
+
jQuery('#pf-custom-button-error').show();
|
| 81 |
+
});
|
| 82 |
+
jQuery('#button-style input.radio').bind('change', function() {
|
| 83 |
+
if(jQuery('#custom-image').attr('checked')) {
|
| 84 |
+
jQuery('#pf-custom-button-error').show();
|
| 85 |
+
} else {
|
| 86 |
+
jQuery('#pf-custom-button-error').hide();
|
| 87 |
+
}
|
| 88 |
+
}).change();
|
| 89 |
+
|
| 90 |
+
jQuery('#pf-logo').bind('change', function() {
|
| 91 |
+
if(jQuery(this).val() == 'favicon') {
|
| 92 |
+
jQuery('.custom-logo, #image-preview').hide();
|
| 93 |
+
} else {
|
| 94 |
+
jQuery('.custom-logo').css('display', 'inline-block');
|
| 95 |
+
jQuery('#image-preview').show();
|
| 96 |
+
}
|
| 97 |
+
}).change();
|
| 98 |
+
|
| 99 |
+
jQuery('#website_protocol').bind('change', function() {
|
| 100 |
+
if(jQuery(this).val() == 'https') {
|
| 101 |
+
jQuery('#https-beta-registration').show('slow');
|
| 102 |
+
} else {
|
| 103 |
+
jQuery('#https-beta-registration').hide('slow');
|
| 104 |
+
}
|
| 105 |
+
}).change();
|
| 106 |
+
|
| 107 |
+
jQuery('#password_protected').bind('change', function() {
|
| 108 |
+
if(jQuery(this).val() == 'yes') {
|
| 109 |
+
jQuery('#javascript').val('yes').change();
|
| 110 |
+
pf_on_javascript();
|
| 111 |
+
jQuery('#javascript').attr('disabled', 'disabled');
|
| 112 |
+
jQuery('#pf-javascript-container').hide('slow');
|
| 113 |
+
} else {
|
| 114 |
+
jQuery('#javascript').removeAttr('disabled');
|
| 115 |
+
jQuery('#pf-javascript-container').show('slow');
|
| 116 |
+
}
|
| 117 |
+
}).change();
|
| 118 |
+
|
| 119 |
+
jQuery('#javascript').bind('change', function() {
|
| 120 |
+
if(jQuery(this).val() == 'yes') {
|
| 121 |
+
pf_on_javascript();
|
| 122 |
+
} else {
|
| 123 |
+
pf_on_no_javascript();
|
| 124 |
+
}
|
| 125 |
+
}).change();
|
| 126 |
+
|
| 127 |
+
function pf_on_javascript() {
|
| 128 |
+
jQuery('.javascript').show();
|
| 129 |
+
jQuery('.no-javascript').hide();
|
| 130 |
+
jQuery('#print-options').show('slow');
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
function pf_on_no_javascript() {
|
| 134 |
+
jQuery('.javascript').hide();
|
| 135 |
+
jQuery('.no-javascript').show();
|
| 136 |
+
jQuery('#print-options').hide('slow');
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
});
|
pf.php
CHANGED
|
@@ -2,13 +2,14 @@
|
|
| 2 |
/*
|
| 3 |
Plugin Name: Print Friendly and PDF
|
| 4 |
Plugin URI: http://www.printfriendly.com
|
| 5 |
-
Description: PrintFriendly & PDF
|
| 6 |
-
Name and URL are included to ensure repeat visitors and new visitors when printed versions are shared.
|
| 7 |
-
Version: 3.0.
|
| 8 |
Author: Print Friendly
|
| 9 |
Author URI: http://www.PrintFriendly.com
|
| 10 |
|
| 11 |
Changelog :
|
|
|
|
| 12 |
3.0.8 - Reordered PrintFriendly & PDF buttons. CSS stylesheet option is now checked by default.
|
| 13 |
3.0.7 - Added additional images for print button.
|
| 14 |
3.0.6 - Fix bug that would display button on category pages when not wanted.
|
|
@@ -18,7 +19,7 @@ Changelog :
|
|
| 18 |
3.0.2 - Fixed JS bug with Google Chrome not submitting and fixed input validation issues.
|
| 19 |
3.0.1 - Fixed minor JS bug.
|
| 20 |
3.0 - Complete overhaul of the plugin by Joost de Valk.
|
| 21 |
-
2.1.8 - The Print Button was showing up on printed, or PDF, pages. Junk! Print or PDF button no longer displayed on printed out page or PDF.
|
| 22 |
2.1.7 - Changed button from span to div to support floating.
|
| 23 |
2.1.6 - Added rel="nofollow" to links. Changed button from <a> to <span> to fix target_new or target_blank issues.
|
| 24 |
2.1.5 - Fix conflict with link tracking plugins. Custom image support for hosted wordpress sites.
|
|
@@ -32,678 +33,807 @@ Changelog :
|
|
| 32 |
1.4 - Changed Name.
|
| 33 |
1.3 - Added new buttons, removed redundant code.
|
| 34 |
1.2 - User can choose to show or not show buttons on the listing page.
|
| 35 |
-
*/
|
| 36 |
-
|
| 37 |
/**
|
| 38 |
* PrintFriendly WordPress plugin. Allows easy embedding of printfriendly.com buttons.
|
| 39 |
* @package PrintFriendly_WordPress
|
| 40 |
-
* @author
|
| 41 |
-
* @copyright Copyright (C)
|
| 42 |
*/
|
| 43 |
if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
|
| 599 |
-
|
| 600 |
-
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
| 658 |
-
|
| 659 |
-
|
| 660 |
-
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
|
| 672 |
-
|
| 673 |
-
|
| 674 |
-
|
| 675 |
-
|
| 676 |
-
|
| 677 |
-
|
| 678 |
-
|
| 679 |
-
|
| 680 |
-
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
|
| 690 |
-
|
| 691 |
-
|
| 692 |
-
|
| 693 |
-
|
| 694 |
-
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
|
| 702 |
-
|
| 703 |
-
|
| 704 |
-
|
| 705 |
-
|
| 706 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 707 |
}
|
| 708 |
|
| 709 |
/**
|
|
@@ -713,6 +843,6 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
| 713 |
* @return string returns a button to be printed.
|
| 714 |
*/
|
| 715 |
function pf_show_link() {
|
| 716 |
-
|
| 717 |
-
|
| 718 |
}
|
| 2 |
/*
|
| 3 |
Plugin Name: Print Friendly and PDF
|
| 4 |
Plugin URI: http://www.printfriendly.com
|
| 5 |
+
Description: PrintFriendly & PDF button for your website. Optimizes your pages and brand for print, pdf, and email.
|
| 6 |
+
Name and URL are included to ensure repeat visitors and new visitors when printed versions are shared.
|
| 7 |
+
Version: 3.0.9
|
| 8 |
Author: Print Friendly
|
| 9 |
Author URI: http://www.PrintFriendly.com
|
| 10 |
|
| 11 |
Changelog :
|
| 12 |
+
3.0.9 - New features: Custom header, disable click-to-delete, https support (beta), PrintFriendly Pro (ad-free).
|
| 13 |
3.0.8 - Reordered PrintFriendly & PDF buttons. CSS stylesheet option is now checked by default.
|
| 14 |
3.0.7 - Added additional images for print button.
|
| 15 |
3.0.6 - Fix bug that would display button on category pages when not wanted.
|
| 19 |
3.0.2 - Fixed JS bug with Google Chrome not submitting and fixed input validation issues.
|
| 20 |
3.0.1 - Fixed minor JS bug.
|
| 21 |
3.0 - Complete overhaul of the plugin by Joost de Valk.
|
| 22 |
+
2.1.8 - The Print Button was showing up on printed, or PDF, pages. Junk! Print or PDF button no longer displayed on printed out page or PDF.
|
| 23 |
2.1.7 - Changed button from span to div to support floating.
|
| 24 |
2.1.6 - Added rel="nofollow" to links. Changed button from <a> to <span> to fix target_new or target_blank issues.
|
| 25 |
2.1.5 - Fix conflict with link tracking plugins. Custom image support for hosted wordpress sites.
|
| 33 |
1.4 - Changed Name.
|
| 34 |
1.3 - Added new buttons, removed redundant code.
|
| 35 |
1.2 - User can choose to show or not show buttons on the listing page.
|
| 36 |
+
*/
|
| 37 |
+
|
| 38 |
/**
|
| 39 |
* PrintFriendly WordPress plugin. Allows easy embedding of printfriendly.com buttons.
|
| 40 |
* @package PrintFriendly_WordPress
|
| 41 |
+
* @author PrintFriendly <support@printfriendly.com>
|
| 42 |
+
* @copyright Copyright (C) 2012, PrintFriendly
|
| 43 |
*/
|
| 44 |
if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
| 45 |
|
| 46 |
+
/**
|
| 47 |
+
* Class containing all the plugins functionality.
|
| 48 |
+
* @package PrintFriendly_WordPress
|
| 49 |
+
*/
|
| 50 |
+
class PrintFriendly_WordPress {
|
| 51 |
+
/**
|
| 52 |
+
* The hook, used for text domain as well as hooks on pages and in get requests for admin.
|
| 53 |
+
* @var string
|
| 54 |
+
*/
|
| 55 |
+
var $hook = 'printfriendly';
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* The option name, used throughout to refer to the plugins option and option group.
|
| 59 |
+
* @var string
|
| 60 |
+
*/
|
| 61 |
+
var $option_name = 'printfriendly_option';
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* The plugins options, loaded on init containing all the plugins settings.
|
| 65 |
+
* @var array
|
| 66 |
+
*/
|
| 67 |
+
var $options = array();
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Database version, used to allow for easy upgrades to / additions in plugin options between plugin versions.
|
| 71 |
+
* @var int
|
| 72 |
+
*/
|
| 73 |
+
var $db_version = 2;
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* Settings page, used within the plugin to reliably load the plugins admin JS and CSS files only on the admin page.
|
| 77 |
+
* @var string
|
| 78 |
+
*/
|
| 79 |
+
var $settings_page = '';
|
| 80 |
+
|
| 81 |
+
/**
|
| 82 |
+
* Constructor
|
| 83 |
+
*
|
| 84 |
+
* @since 3.0
|
| 85 |
+
*/
|
| 86 |
+
function __construct() {
|
| 87 |
+
// delete_option( $this->option_name );
|
| 88 |
+
|
| 89 |
+
// Retrieve the plugin options
|
| 90 |
+
$this->options = get_option( $this->option_name );
|
| 91 |
+
|
| 92 |
+
// If the options array is empty, set defaults
|
| 93 |
+
if ( ! is_array( $this->options ) )
|
| 94 |
+
$this->set_defaults();
|
| 95 |
+
|
| 96 |
+
// If the version number doesn't match, upgrade
|
| 97 |
+
if ( $this->db_version > $this->options['db_version'] )
|
| 98 |
+
$this->upgrade();
|
| 99 |
+
|
| 100 |
+
add_action( 'wp_head', array( &$this, 'front_head' ) );
|
| 101 |
+
// automaticaly add the link
|
| 102 |
+
if( 'manual' != $this->options['show_list'] ) {
|
| 103 |
+
add_filter( 'the_content', array( &$this, 'show_link' ) );
|
| 104 |
+
add_filter( 'the_excerpt', array( &$this, 'show_link' ) );
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
if ( !is_admin() )
|
| 108 |
+
return;
|
| 109 |
+
|
| 110 |
+
// Hook into init for registration of the option and the language files
|
| 111 |
+
add_action( 'admin_init', array( &$this, 'init' ) );
|
| 112 |
+
|
| 113 |
+
// Register the settings page
|
| 114 |
+
add_action( 'admin_menu', array( &$this, 'add_config_page' ) );
|
| 115 |
+
|
| 116 |
+
// Register the contextual help
|
| 117 |
+
add_filter( 'contextual_help', array( &$this, 'contextual_help' ), 10, 2 );
|
| 118 |
+
|
| 119 |
+
// Enqueue the needed scripts and styles
|
| 120 |
+
add_action( 'admin_enqueue_scripts',array( &$this, 'admin_enqueue_scripts' ) );
|
| 121 |
+
|
| 122 |
+
// Register a link to the settings page on the plugins overview page
|
| 123 |
+
add_filter( 'plugin_action_links', array( &$this, 'filter_plugin_actions' ), 10, 2 );
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
/**
|
| 127 |
+
* PHP 4 Compatible Constructor
|
| 128 |
+
*
|
| 129 |
+
* @since 3.0
|
| 130 |
+
*/
|
| 131 |
+
function PrintFriendly_WordPress() {
|
| 132 |
+
$this->__construct();
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
/**
|
| 136 |
+
* Prints the PrintFriendly button CSS, in the header.
|
| 137 |
+
*
|
| 138 |
+
* @since 3.0
|
| 139 |
+
*/
|
| 140 |
+
function front_head() {
|
| 141 |
+
|
| 142 |
+
if ( !isset( $this->options['enable_css'] ) || $this->options['enable_css'] != 'on' )
|
| 143 |
+
return;
|
| 144 |
+
|
| 145 |
+
?>
|
| 146 |
+
<style type="text/css" media="screen">
|
| 147 |
+
div.printfriendly {
|
| 148 |
+
margin: <?php echo $this->options['margin_top'].'px '.$this->options['margin_right'].'px '.$this->options['margin_bottom'].'px '.$this->options['margin_left'].'px'; ?>;
|
| 149 |
+
}
|
| 150 |
+
.printfriendly a {
|
| 151 |
+
text-decoration: none;
|
| 152 |
+
font-size: <?php echo $this->options['text_size']; ?>px;
|
| 153 |
+
color: <?php echo $this->options['text_color']; ?>;
|
| 154 |
+
vertical-align: bottom;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
.printfriendly a:hover {
|
| 158 |
+
cursor: pointer;
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
.printfriendly a img {
|
| 162 |
+
border: none;
|
| 163 |
+
padding:0;
|
| 164 |
+
margin-right: 6px;
|
| 165 |
+
}
|
| 166 |
+
.printfriendly a span{
|
| 167 |
+
vertical-align: bottom;
|
| 168 |
+
}
|
| 169 |
+
.alignleft {
|
| 170 |
+
float:left;
|
| 171 |
+
margin: 5px 20px 20px 0;
|
| 172 |
+
}
|
| 173 |
+
.alignright {
|
| 174 |
+
float:right;
|
| 175 |
+
margin: 5px 0 20px 20px;
|
| 176 |
+
}
|
| 177 |
+
.aligncenter {
|
| 178 |
+
text-align: center;
|
| 179 |
+
margin: 5px auto 5px auto;
|
| 180 |
+
}
|
| 181 |
+
</style>
|
| 182 |
+
<style type="text/css" media="print">
|
| 183 |
+
.printfriendly {
|
| 184 |
+
display: none;
|
| 185 |
+
}
|
| 186 |
+
</style>
|
| 187 |
+
<?php
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
/**
|
| 191 |
+
* Prints the PrintFriendly JavaScript, in the footer, and loads it asynchronously.
|
| 192 |
+
*
|
| 193 |
+
* @since 3.0
|
| 194 |
+
*/
|
| 195 |
+
function print_script_footer() {
|
| 196 |
+
if (isset($this->options['javascript']) && $this->options['javascript'] == 'no')
|
| 197 |
+
return;
|
| 198 |
+
|
| 199 |
+
else {
|
| 200 |
+
$tagline = $this->options['tagline'];
|
| 201 |
+
$image_url = $this->options['image_url'];
|
| 202 |
+
if( $this->options['logo'] == 'favicon' ) {
|
| 203 |
+
$tagline = '';
|
| 204 |
+
$image_url = '';
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
// Currently we use v3 for both: normal and password protected sites
|
| 208 |
+
$pf_src = '//cdn.printfriendly.com/printfriendly.js';
|
| 209 |
+
if($this->options['website_protocol'] == 'https')
|
| 210 |
+
$pf_src = 'https://pf-cdn.printfriendly.com/ssl/main.js';
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
?>
|
| 214 |
+
<script type="text/javascript">
|
| 215 |
+
var pfHeaderImgUrl = "<?php echo $image_url ?>";
|
| 216 |
+
var pfHeaderTagline = "<?php echo $tagline ?>";
|
| 217 |
+
var pfdisableClickToDel = "<?php echo $this->options['click_to_delete'] ?>";
|
| 218 |
+
|
| 219 |
+
// PrintFriendly
|
| 220 |
+
var e = document.createElement('script'); e.type="text/javascript";
|
| 221 |
+
e.async = true;
|
| 222 |
+
e.src = '<?php echo $pf_src ?>';
|
| 223 |
+
document.getElementsByTagName('head')[0].appendChild(e);
|
| 224 |
+
</script>
|
| 225 |
+
<?php
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
/**
|
| 230 |
+
* Primary frontend function, used either as a filter for the_content, or directly using pf_show_link
|
| 231 |
+
*
|
| 232 |
+
* @since 3.0
|
| 233 |
+
* @param string $content the content of the post, when the function is used as a filter
|
| 234 |
+
* @return string $button or $content with the button added to the content when appropriate, just the content when button shouldn't be added or just button when called manually.
|
| 235 |
+
*/
|
| 236 |
+
function show_link( $content = false ) {
|
| 237 |
+
if( !$content && 'manual' != $this->options['show_list'] )
|
| 238 |
+
return "";
|
| 239 |
+
|
| 240 |
+
$onclick = 'onclick="window.print(); return false;"';
|
| 241 |
+
$href = 'http://www.printfriendly.com/print/v2?url='.get_permalink();
|
| 242 |
+
|
| 243 |
+
if ( isset( $this->options['javascript'] ) && $this->options['javascript'] == 'no' )
|
| 244 |
+
$onclick = 'target="_blank"';
|
| 245 |
+
|
| 246 |
+
if ( !is_singular() && '' != $onclick ) {
|
| 247 |
+
$onclick = '';
|
| 248 |
+
$href = get_permalink().'?pfstyle=wp';
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
$align = '';
|
| 252 |
+
if ( 'none' != $this->options['content_position'] )
|
| 253 |
+
$align = ' align'.$this->options['content_position'];
|
| 254 |
+
|
| 255 |
+
$button = apply_filters( 'printfriendly_button', '<div class="printfriendly'.$align.'"><a href="'.$href.'" rel="nofollow" '.$onclick.'>'.$this->button().'</a></div>' );
|
| 256 |
+
|
| 257 |
+
if (is_singular())
|
| 258 |
+
{
|
| 259 |
+
// Hook the script call now, so it only get's loaded when needed, and need is determined by the user calling pf_button
|
| 260 |
+
add_action( 'wp_footer', array( &$this, 'print_script_footer' ) );
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
if ( 'manual' == $this->options['show_list'] )
|
| 264 |
+
{
|
| 265 |
+
return $button;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
else
|
| 269 |
+
{
|
| 270 |
+
if (is_single() || ( is_page() && 'posts' != $this->options['show_list'] ) || ((is_home() || is_category()) && 'all' == $this->options['show_list'] ))
|
| 271 |
+
{
|
| 272 |
+
|
| 273 |
+
if ( $this->options['content_placement'] == 'before' )
|
| 274 |
+
return $button.$content;
|
| 275 |
+
else
|
| 276 |
+
return $content.$button;
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
else
|
| 280 |
+
{
|
| 281 |
+
return $content;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
/**
|
| 289 |
+
* Register the textdomain and the options array along with the validation function
|
| 290 |
+
*
|
| 291 |
+
* @since 3.0
|
| 292 |
+
*/
|
| 293 |
+
function init() {
|
| 294 |
+
// Allow for localization
|
| 295 |
+
load_plugin_textdomain( $this->hook, false, basename( dirname( __FILE__ ) ) . '/languages' );
|
| 296 |
+
|
| 297 |
+
// Register our option array
|
| 298 |
+
register_setting( $this->option_name, $this->option_name, array( &$this, 'options_validate' ) );
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
/**
|
| 302 |
+
* Validate the saved options.
|
| 303 |
+
*
|
| 304 |
+
* @since 3.0
|
| 305 |
+
* @param array $input with unvalidated options.
|
| 306 |
+
* @return array $valid_input with validated options.
|
| 307 |
+
*/
|
| 308 |
+
function options_validate( $input ) {
|
| 309 |
+
$valid_input = $input;
|
| 310 |
+
|
| 311 |
+
// echo '<pre>'.print_r($input,1).'</pre>';
|
| 312 |
+
// die;
|
| 313 |
+
|
| 314 |
+
if ( !in_array( $input['button_type'], array( 'pf-button.gif', 'button-print-grnw20.png', 'button-print-blu20.png', 'button-print-gry20.png', 'button-print-whgn20.png', 'pf_button_sq_gry_m.png', 'pf_button_sq_gry_l.png', 'pf_button_sq_grn_m.png', 'pf_button_sq_grn_l.png', 'pf-button-big.gif', 'pf-icon-small.gif', 'pf-icon.gif', 'pf-button-both.gif', 'pf-icon-both.gif', 'text-only', 'custom-image') ) )
|
| 315 |
+
$valid_input['button_type'] = 'pf-button.gif';
|
| 316 |
+
|
| 317 |
+
if ( !isset( $input['custom_image'] ) )
|
| 318 |
+
$valid_input['custom_image'] = '';
|
| 319 |
+
|
| 320 |
+
if ( !in_array( $input['show_list'], array( 'all', 'single', 'posts', 'manual') ) )
|
| 321 |
+
$valid_input['show_list'] = 'all';
|
| 322 |
+
|
| 323 |
+
if ( !in_array( $input['content_position'], array( 'none', 'left', 'center', 'right' ) ) )
|
| 324 |
+
$valid_input['content_position'] = 'left';
|
| 325 |
+
|
| 326 |
+
if ( !in_array( $input['content_placement'], array( 'before', 'after' ) ) )
|
| 327 |
+
$valid_input['content_placement'] = 'after';
|
| 328 |
+
|
| 329 |
+
foreach ( array( 'margin_top', 'margin_right', 'margin_bottom', 'margin_left' ) as $opt )
|
| 330 |
+
$valid_input[$opt] = (int) $input[$opt];
|
| 331 |
+
|
| 332 |
+
$valid_input['text_size'] = (int) $input['text_size'];
|
| 333 |
+
|
| 334 |
+
if ( !isset($valid_input['text_size']) || 0 == $valid_input['text_size'] ) {
|
| 335 |
+
$valid_input['text_size'] = 14;
|
| 336 |
+
} else if ( 25 < $valid_input['text_size'] || 9 > $valid_input['text_size'] ) {
|
| 337 |
+
$valid_input['text_size'] = 14;
|
| 338 |
+
add_settings_error( $this->option_name, 'invalid_color', __( 'The text size you entered is invalid, please stay between 9px and 25px', $this->hook ) );
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
if ( !isset( $input['text_color'] )) {
|
| 342 |
+
$valid_input['text_color'] = $this->options['text_color'];
|
| 343 |
+
} else if ( ! preg_match('/^#[a-f0-9]{3,6}$/i', $input['text_color'] ) ) {
|
| 344 |
+
// Revert to previous setting and throw error.
|
| 345 |
+
$valid_input['text_color'] = $this->options['text_color'];
|
| 346 |
+
add_settings_error( $this->option_name, 'invalid_color', __( 'The color you entered is not valid, it must be a valid hexadecimal RGB font color.', $this->hook ) );
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
$valid_input['db_version'] = $this->db_version;
|
| 350 |
+
|
| 351 |
+
return $valid_input;
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
/**
|
| 355 |
+
* Register the config page for all users that have the manage_options capability
|
| 356 |
+
*
|
| 357 |
+
* @since 3.0
|
| 358 |
+
*/
|
| 359 |
+
function add_config_page() {
|
| 360 |
+
$this->settings_page = add_options_page( __( 'PrintFriendly Options', $this->hook ), __( 'Print Friendly & PDF', $this->hook ), 'manage_options', $this->hook, array( &$this, 'config_page' ) );
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
/**
|
| 364 |
+
* Shows help on the plugin page when clicking on the Help button, top right.
|
| 365 |
+
*
|
| 366 |
+
* @since 3.0
|
| 367 |
+
*/
|
| 368 |
+
function contextual_help( $contextual_help, $screen_id ) {
|
| 369 |
+
if ( $this->settings_page == $screen_id ) {
|
| 370 |
+
$contextual_help = '<strong>'.__( "Need Help?", $this->hook ).'</strong><br/>'
|
| 371 |
+
.sprintf( __( "Be sure to check out the %s!"), '<a href="http://wordpress.org/extend/plugins/printfriendly/faq/">'.__( "Frequently Asked Questions", $this->hook ).'</a>' );
|
| 372 |
+
}
|
| 373 |
+
return $contextual_help;
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
/**
|
| 377 |
+
* Enqueue the scripts for the admin settings page
|
| 378 |
+
*
|
| 379 |
+
* @since 3.0
|
| 380 |
+
* @param string $hook_suffix hook to check against whether the current page is the PrintFriendly settings page.
|
| 381 |
+
*/
|
| 382 |
+
function admin_enqueue_scripts( $screen_id ) {
|
| 383 |
+
if ( $this->settings_page == $screen_id ) {
|
| 384 |
+
wp_register_script( 'pf-color-picker', plugins_url( 'colorpicker.js', __FILE__ ), array( 'jquery', 'media-upload' ) );
|
| 385 |
+
wp_register_script( 'pf-admin-js', plugins_url( 'admin.js', __FILE__ ), array( 'jquery', 'media-upload' ) );
|
| 386 |
+
|
| 387 |
+
wp_enqueue_script( 'pf-color-picker' );
|
| 388 |
+
wp_enqueue_script( 'pf-admin-js' );
|
| 389 |
+
|
| 390 |
+
wp_enqueue_style( 'printfriendly-admin-css', plugins_url( 'admin.css', __FILE__ ) );
|
| 391 |
+
}
|
| 392 |
+
}
|
| 393 |
+
|
| 394 |
+
/**
|
| 395 |
+
* Register the settings link for the plugins page
|
| 396 |
+
*
|
| 397 |
+
* @since 3.0
|
| 398 |
+
* @param array $links the links for the plugins.
|
| 399 |
+
* @param string $file filename to check against plugins filename.
|
| 400 |
+
* @return array $links the links with the settings link added to it if appropriate.
|
| 401 |
+
*/
|
| 402 |
+
function filter_plugin_actions( $links, $file ){
|
| 403 |
+
// Static so we don't call plugin_basename on every plugin row.
|
| 404 |
+
static $this_plugin;
|
| 405 |
+
if ( ! $this_plugin ) $this_plugin = plugin_basename( __FILE__ );
|
| 406 |
+
|
| 407 |
+
if ( $file == $this_plugin ){
|
| 408 |
+
$settings_link = '<a href="options-general.php?page='.$this->hook.'">' . __( 'Settings', $this->hook ) . '</a>';
|
| 409 |
+
array_unshift( $links, $settings_link ); // before other links
|
| 410 |
+
}
|
| 411 |
+
return $links;
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
/**
|
| 415 |
+
* Set default values for the plugin. If old, as in pre 1.0, settings are there, use them and then delete them.
|
| 416 |
+
*
|
| 417 |
+
* @since 3.0
|
| 418 |
+
*/
|
| 419 |
+
function set_defaults() {
|
| 420 |
+
// Set some defaults
|
| 421 |
+
$this->options = array(
|
| 422 |
+
'button_type' => 'pf-button.gif',
|
| 423 |
+
'content_position' => 'left',
|
| 424 |
+
'content_placement' => 'after',
|
| 425 |
+
'custom_image' => 'http://cdn.printfriendly.com/pf-icon.gif',
|
| 426 |
+
'custom_text' => 'Print Friendly',
|
| 427 |
+
'enable_css' => 'on',
|
| 428 |
+
'margin_top' => '12',
|
| 429 |
+
'margin_right' => '12',
|
| 430 |
+
'margin_bottom' => '12',
|
| 431 |
+
'margin_left' => '12',
|
| 432 |
+
'show_list' => 'single',
|
| 433 |
+
'text_color' => '#6D9F00',
|
| 434 |
+
'text_size' => 14,
|
| 435 |
+
'logo' => 'favicon',
|
| 436 |
+
'image_url' => '',
|
| 437 |
+
'tagline' => '',
|
| 438 |
+
'click_to_delete' => '0', // 0 - allow, 1 - do not allow
|
| 439 |
+
'website_protocol' => 'http',
|
| 440 |
+
'password_protected' => 'no',
|
| 441 |
+
'javascript' => 'yes'
|
| 442 |
+
);
|
| 443 |
+
|
| 444 |
+
// Check whether the old badly named singular options are there, if so, use the data and delete them.
|
| 445 |
+
foreach ( array_keys( $this->options ) as $opt ) {
|
| 446 |
+
$old_opt = get_option( 'pf_'.$opt );
|
| 447 |
+
if ( $old_opt !== false ) {
|
| 448 |
+
$this->options[$opt] = $old_opt;
|
| 449 |
+
delete_option( 'pf_'.$opt );
|
| 450 |
+
}
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
// This should always be set to the latest immediately when defaults are pushed in.
|
| 454 |
+
$this->options['db_version'] = $this->db_version;
|
| 455 |
+
|
| 456 |
+
update_option( $this->option_name, $this->options );
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
/**
|
| 460 |
+
* Upgrades the stored options, used to add new defaults if needed etc.
|
| 461 |
+
*
|
| 462 |
+
* @since 3.0
|
| 463 |
+
*/
|
| 464 |
+
function upgrade() {
|
| 465 |
+
// Do stuff
|
| 466 |
+
|
| 467 |
+
// update options to version 2
|
| 468 |
+
if($this->options['db_version'] < 2) {
|
| 469 |
+
|
| 470 |
+
$additional_options = array(
|
| 471 |
+
'enable_css' => 'on',
|
| 472 |
+
'logo' => 'favicon',
|
| 473 |
+
'image_url' => '',
|
| 474 |
+
'tagline' => '',
|
| 475 |
+
'click_to_delete' => '0',
|
| 476 |
+
'website_protocol' => 'http',
|
| 477 |
+
'password_protected' => 'no',
|
| 478 |
+
'javascript' => 'yes'
|
| 479 |
+
);
|
| 480 |
+
|
| 481 |
+
// use old javascript_include value to initialize javascript
|
| 482 |
+
if(!isset($this->options['javascript_include']))
|
| 483 |
+
$additional_options['javascript'] = 'no';
|
| 484 |
+
|
| 485 |
+
unset($this->options['javascript_include']);
|
| 486 |
+
unset($this->options['javascript_fallback']);
|
| 487 |
+
|
| 488 |
+
// correcting badly named option
|
| 489 |
+
if(isset($this->options['disable_css'])) {
|
| 490 |
+
$additional_options['enable_css'] = $this->options['disable_css'];
|
| 491 |
+
unset($this->options['disable_css']);
|
| 492 |
+
}
|
| 493 |
+
|
| 494 |
+
// check whether image we do not list any more was used
|
| 495 |
+
if(in_array($this->options['button_type'], array('button-print-whgn20.png', 'pf_button_sq_qry_m.png', 'pf_button_sq_qry_l.png', 'pf_button_sq_grn_m.png', 'pf_button_sq_grn_l.png'))) {
|
| 496 |
+
// previous version had a bug with button name
|
| 497 |
+
if(in_array($this->options['button_type'], array('pf_button_sq_qry_m.png', 'pf_button_sq_qry_l.png')))
|
| 498 |
+
$this->options['button_type'] = str_replace('qry', 'gry', $this->options['button_type']);
|
| 499 |
+
|
| 500 |
+
$image_address = '//cdn.printfriendly.com/'.$this->options['button_type'];
|
| 501 |
+
$this->options['button_type'] = 'custom-image';
|
| 502 |
+
$this->options['custom_text'] = '';
|
| 503 |
+
$this->options['custom_image'] = $image_address;
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
$this->options = array_merge($this->options, $additional_options);
|
| 507 |
+
}
|
| 508 |
+
|
| 509 |
+
$this->options['db_version'] = $this->db_version;
|
| 510 |
+
update_option( $this->option_name, $this->options );
|
| 511 |
+
}
|
| 512 |
+
|
| 513 |
+
/**
|
| 514 |
+
* Displays radio button in the admin area
|
| 515 |
+
*
|
| 516 |
+
* @since 3.0
|
| 517 |
+
* @param string $name the name of the radio button to generate.
|
| 518 |
+
* @param boolean $br whether or not to add an HTML <br> tag, defaults to true.
|
| 519 |
+
*/
|
| 520 |
+
function radio($name, $br = false){
|
| 521 |
+
$var = '<input id="'.$name.'" class="radio" name="'.$this->option_name.'[button_type]" type="radio" value="'.$name.'" '.$this->checked( 'button_type', $name, false ).'/>';
|
| 522 |
+
$button = $this->button( $name );
|
| 523 |
+
if ( '' != $button )
|
| 524 |
+
echo '<label for="'.$name.'">' . $var . $button . '</label>';
|
| 525 |
+
else
|
| 526 |
+
echo $var;
|
| 527 |
+
|
| 528 |
+
if ( $br )
|
| 529 |
+
echo '<br>';
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
/**
|
| 533 |
+
* Displays button image in the admin area
|
| 534 |
+
*
|
| 535 |
+
* @since 3.0
|
| 536 |
+
* @param string $name the name of the button to generate.
|
| 537 |
+
*/
|
| 538 |
+
function button( $name = false ){
|
| 539 |
+
if( !$name )
|
| 540 |
+
$name = $this->options['button_type'];
|
| 541 |
+
|
| 542 |
+
$text = $this->options['custom_text'];
|
| 543 |
+
|
| 544 |
+
switch($name){
|
| 545 |
+
case "custom-image":
|
| 546 |
+
if( '' == $this->options['custom_image'] )
|
| 547 |
+
$return = '';
|
| 548 |
+
else
|
| 549 |
+
$return = '<img src="'.$this->options['custom_image'].'" alt="Print Friendly" />';
|
| 550 |
+
|
| 551 |
+
$return .= $this->options['custom_text'];
|
| 552 |
+
|
| 553 |
+
return $return;
|
| 554 |
+
break;
|
| 555 |
+
case "text-only":
|
| 556 |
+
return '<span class="printfriendly-text2">'.$text.'</span>';
|
| 557 |
+
break;
|
| 558 |
+
|
| 559 |
+
case "pf-icon-both.gif":
|
| 560 |
+
return '<span class="printfriendly-text2 printandpdf"><img style="border:none;margin-right:6px;" src="http://cdn.printfriendly.com/pf-print-icon.gif" width="16" height="15" alt="Print Friendly Version of this page" />Print <img style="border:none;margin:0 6px" src="http://cdn.printfriendly.com/pf-pdf-icon.gif" width="12" height="12" alt="Get a PDF version of this webpage" />PDF</span>';
|
| 561 |
+
break;
|
| 562 |
+
|
| 563 |
+
case "pf-icon-small.gif":
|
| 564 |
+
return '<img style="border:none;margin-right:4px;" src="http://cdn.printfriendly.com/pf-icon-small.gif" alt="PrintFriendly and PDF" width="18" height="18"><span class="printfriendly-text2">'.$text.'</span>';
|
| 565 |
+
break;
|
| 566 |
+
case "pf-icon.gif":
|
| 567 |
+
return '<img style="border:none;margin-right:6px;" src="http://cdn.printfriendly.com/pf-icon.gif" width="23" height="25" alt="PrintFriendly and PDF"><span class="printfriendly-text2">'.$text.'</span>';
|
| 568 |
+
break;
|
| 569 |
+
|
| 570 |
+
default:
|
| 571 |
+
return '<img src="//cdn.printfriendly.com/'.$name.'" alt="Print Friendly" />';
|
| 572 |
+
break;
|
| 573 |
+
}
|
| 574 |
+
}
|
| 575 |
+
|
| 576 |
+
|
| 577 |
+
/**
|
| 578 |
+
* Convenience function to output a value custom button preview elements
|
| 579 |
+
*
|
| 580 |
+
* @since 3.0.9
|
| 581 |
+
*/
|
| 582 |
+
function custom_button_preview() {
|
| 583 |
+
if( '' == trim($this->options['custom_image']) )
|
| 584 |
+
$button_preview = '<span id="pf-custom-button-preview"></span>';
|
| 585 |
+
else
|
| 586 |
+
$button_preview = '<span id="pf-custom-button-preview"><img src="'.$this->options['custom_image'].'" alt="Print Friendly" /></span>';
|
| 587 |
+
|
| 588 |
+
$button_preview .= '<span class="printfriendly-text2">'.$this->options['custom_text'].'</span>';
|
| 589 |
+
|
| 590 |
+
echo $button_preview;
|
| 591 |
+
}
|
| 592 |
+
|
| 593 |
+
/**
|
| 594 |
+
* Convenience function to output a value for an input
|
| 595 |
+
*
|
| 596 |
+
* @since 3.0
|
| 597 |
+
* @param string $val value to check.
|
| 598 |
+
*/
|
| 599 |
+
function val( $val ) {
|
| 600 |
+
if ( isset( $this->options[$val] ) )
|
| 601 |
+
echo esc_attr( $this->options[$val] );
|
| 602 |
+
}
|
| 603 |
+
|
| 604 |
+
/**
|
| 605 |
+
* Like the WordPress checked() function but it doesn't throw notices when the array key isn't set and uses the plugins options array.
|
| 606 |
+
*
|
| 607 |
+
* @since 3.0
|
| 608 |
+
* @param mixed $val value to check.
|
| 609 |
+
* @param mixed $check_against value to check against.
|
| 610 |
+
* @param boolean $echo whether or not to echo the output.
|
| 611 |
+
* @return string checked, when true, empty, when false.
|
| 612 |
+
*/
|
| 613 |
+
function checked( $val, $check_against = true, $echo = true ) {
|
| 614 |
+
if ( !isset( $this->options[$val] ) )
|
| 615 |
+
return;
|
| 616 |
+
|
| 617 |
+
if ( $this->options[$val] == $check_against ) {
|
| 618 |
+
if ( $echo )
|
| 619 |
+
echo ' checked="checked" ';
|
| 620 |
+
else
|
| 621 |
+
return ' checked="checked" ';
|
| 622 |
+
}
|
| 623 |
+
}
|
| 624 |
+
|
| 625 |
+
|
| 626 |
+
/**
|
| 627 |
+
* Like the WordPress selected() function but it doesn't throw notices when the array key isn't set and uses the plugins options array.
|
| 628 |
+
*
|
| 629 |
+
* @since 3.0.9
|
| 630 |
+
* @param mixed $val value to check.
|
| 631 |
+
* @param mixed $check_against value to check against.
|
| 632 |
+
* @return string checked, when true, empty, when false.
|
| 633 |
+
*/
|
| 634 |
+
function selected( $val, $check_against = true) {
|
| 635 |
+
if ( !isset( $this->options[$val] ) )
|
| 636 |
+
return;
|
| 637 |
+
|
| 638 |
+
return selected ($this->options[$val], $check_against);
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
/**
|
| 642 |
+
* Output the config page
|
| 643 |
+
*
|
| 644 |
+
* @since 3.0
|
| 645 |
+
*/
|
| 646 |
+
function config_page() {
|
| 647 |
+
|
| 648 |
+
// Since WP 3.2 outputs these errors by default, only display them when we're on versions older than 3.2 that do support the settings errors.
|
| 649 |
+
global $wp_version;
|
| 650 |
+
if ( version_compare( $wp_version, '3.2', '<' ) )
|
| 651 |
+
settings_errors();
|
| 652 |
+
|
| 653 |
+
// Show the content of the options array when debug is enabled
|
| 654 |
+
if ( WP_DEBUG )
|
| 655 |
+
echo '<pre>Options:<br><br>' . print_r( $this->options, 1 ) . '</pre>';
|
| 656 |
+
?>
|
| 657 |
+
<div id="pf_settings" class="wrap">
|
| 658 |
+
|
| 659 |
+
<div class="icon32" id="printfriendly"></div>
|
| 660 |
+
<h2><?php _e( 'Print Friendly & PDF Settings', $this->hook ); ?></h2>
|
| 661 |
+
|
| 662 |
+
<form action="options.php" method="post">
|
| 663 |
+
<?php settings_fields( $this->option_name ); ?>
|
| 664 |
+
|
| 665 |
+
<h3><?php _e( "Pick Your Button Style", $this->hook ); ?></h3>
|
| 666 |
+
|
| 667 |
+
<fieldset id="button-style">
|
| 668 |
+
<div id="buttongroup1">
|
| 669 |
+
<?php $this->radio('pf-button.gif'); ?>
|
| 670 |
+
<?php $this->radio('pf-button-both.gif'); ?>
|
| 671 |
+
<?php $this->radio('pf-button-big.gif'); ?>
|
| 672 |
+
</div>
|
| 673 |
+
<div id="buttongroup2">
|
| 674 |
+
<?php $this->radio('button-print-grnw20.png'); ?>
|
| 675 |
+
<?php $this->radio('button-print-blu20.png'); ?>
|
| 676 |
+
<?php $this->radio('button-print-gry20.png'); ?>
|
| 677 |
+
</div>
|
| 678 |
+
<div id="buttongroup3">
|
| 679 |
+
<?php $this->radio('pf-icon-small.gif'); ?>
|
| 680 |
+
<?php $this->radio('pf-icon-both.gif'); ?>
|
| 681 |
+
<?php $this->radio('pf-icon.gif'); ?>
|
| 682 |
+
<?php $this->radio('text-only'); ?>
|
| 683 |
+
</div>
|
| 684 |
+
|
| 685 |
+
<div id="custom">
|
| 686 |
+
<label for="custom-image">
|
| 687 |
+
<?php echo '<input id="custom-image" class="radio" name="'.$this->option_name.'[button_type]" type="radio" value="custom-image" '.$this->checked( 'button_type', 'custom-image', false ).'/>'; ?>
|
| 688 |
+
<?php _e( "Custom Button", $this->hook ); ?>
|
| 689 |
+
</label>
|
| 690 |
+
<div id="custom-img">
|
| 691 |
+
<?php _e( "Enter Image URL", $this->hook ); ?><br>
|
| 692 |
+
<input id="custom_image" type="text" class="clear regular-text" size="30" name="<?php echo $this->option_name; ?>[custom_image]" value="<?php $this->val( 'custom_image' ); ?>" />
|
| 693 |
+
<div class="description"><?php _e( "Ex: http://www.example.com/<br>Ex: /wp/wp-content/uploads/example.png)", $this->hook ); ?>
|
| 694 |
+
</div>
|
| 695 |
+
</div>
|
| 696 |
+
<div id="pf-custom-button-error"></div>
|
| 697 |
+
<div id="custom-txt" >
|
| 698 |
+
<div id="txt-enter">
|
| 699 |
+
<?php _e( "Text", $this->hook ); ?><br>
|
| 700 |
+
<input type="text" size="10" name="<?php echo $this->option_name; ?>[custom_text]" id="custom_text" value="<?php $this->val( 'custom_text' ); ?>">
|
| 701 |
+
</div>
|
| 702 |
+
<div id="txt-color">
|
| 703 |
+
<?php _e( "Text Color", $this->hook ); ?>
|
| 704 |
+
<input type="hidden" name="<?php echo $this->option_name; ?>[text_color]" id="text_color" value="<?php $this->val( 'text_color' ); ?>"/><br>
|
| 705 |
+
<div id="colorSelector">
|
| 706 |
+
<div style="background-color: <?php echo $this->options['text_color']; ?>;"></div>
|
| 707 |
+
</div>
|
| 708 |
+
</div>
|
| 709 |
+
<div id="txt-size">
|
| 710 |
+
<?php _e( "Text Size", $this->hook ); ?><br>
|
| 711 |
+
<input type="number" id="text_size" min="9" max="25" class="small-text" name="<?php echo $this->option_name; ?>[text_size]" value="<?php $this->val( 'text_size' ); ?>"/>
|
| 712 |
+
</div>
|
| 713 |
+
</div>
|
| 714 |
+
<div id="custom-button-preview">
|
| 715 |
+
<?php $this->custom_button_preview(); ?>
|
| 716 |
+
</div>
|
| 717 |
+
</fieldset>
|
| 718 |
+
<br class="clear">
|
| 719 |
+
|
| 720 |
+
<!--Section 2 Button Placement-->
|
| 721 |
+
<div id="button-placement">
|
| 722 |
+
<h3><?php _e( "Button Placement", $this->hook ); ?></h3>
|
| 723 |
+
<input type="hidden" name="<?php echo $this->option_name; ?>[enable_css]" value="<?php $this->val('enable_css');?>"/>
|
| 724 |
+
<div id="button-placement-options">
|
| 725 |
+
<div id="alignment">
|
| 726 |
+
<label>
|
| 727 |
+
<select id="pf_content_position" name="<?php echo $this->option_name; ?>[content_position]" >
|
| 728 |
+
<option value="left" <?php selected( $this->options['content_position'], 'left' ); ?>><?php _e( "Left Align", $this->hook ); ?></option>
|
| 729 |
+
<option value="right" <?php selected( $this->options['content_position'], 'right' ); ?>><?php _e( "Right Align", $this->hook ); ?></option>
|
| 730 |
+
<option value="center" <?php selected( $this->options['content_position'], 'center' ); ?>><?php _e( "Center", $this->hook ); ?></option>
|
| 731 |
+
<option value="none" <?php selected( $this->options['content_position'], 'none' ); ?>><?php _e( "None", $this->hook ); ?></option>
|
| 732 |
+
</select>
|
| 733 |
+
</label>
|
| 734 |
+
</div>
|
| 735 |
+
<div class="content_placement">
|
| 736 |
+
<label>
|
| 737 |
+
<select id="pf_content_placement" name="<?php echo $this->option_name; ?>[content_placement]" >
|
| 738 |
+
<option value="before" <?php selected( $this->options['content_placement'], 'before' ); ?>><?php _e( "Above Content", $this->hook ); ?></option>
|
| 739 |
+
<option value="after" <?php selected( $this->options['content_placement'], 'after' ); ?>><?php _e( "Below Content", $this->hook ); ?></option>
|
| 740 |
+
</select>
|
| 741 |
+
</label>
|
| 742 |
+
</div>
|
| 743 |
+
<div id="margin">
|
| 744 |
+
<label>
|
| 745 |
+
<input type="number" name="<?php echo $this->option_name; ?>[margin_left]" value="<?php $this->val( 'margin_left' ); ?>" maxlength="3"/>
|
| 746 |
+
<?php _e( "Margin Left", $this->hook ); ?>
|
| 747 |
+
</label>
|
| 748 |
+
<label>
|
| 749 |
+
<input type="number" name="<?php echo $this->option_name; ?>[margin_right]" value="<?php $this->val( 'margin_right' ); ?>"/> <?php _e( "Margin Right", $this->hook ); ?>
|
| 750 |
+
</label>
|
| 751 |
+
<label>
|
| 752 |
+
<input type="number" name="<?php echo $this->option_name; ?>[margin_top]" value="<?php $this->val( 'margin_top' ); ?>" maxlength="3"/> <?php _e( "Margin Top", $this->hook ); ?>
|
| 753 |
+
</label>
|
| 754 |
+
<label>
|
| 755 |
+
<input type="number" name="<?php echo $this->option_name; ?>[margin_bottom]" value="<?php $this->val( 'margin_bottom' ); ?>" maxlength="3"/> <?php _e( "Margin Bottom", $this->hook ); ?>
|
| 756 |
+
</label>
|
| 757 |
+
</div>
|
| 758 |
+
</div>
|
| 759 |
+
<div id="pages">
|
| 760 |
+
<label><input type="radio" class="show_list" name="<?php echo $this->option_name; ?>[show_list]" value="all" <?php $this->checked( 'show_list', 'all'); ?>/> <?php _e( "Homepage, Posts, and Pages", $this->hook ); ?></label>
|
| 761 |
+
<label><input type="radio" class="show_list" name="<?php echo $this->option_name; ?>[show_list]" value="single" <?php $this->checked( 'show_list', 'single'); ?>/> <?php _e( "Posts and Pages", $this->hook ); ?></label>
|
| 762 |
+
<label><input type="radio" class="show_list" name="<?php echo $this->option_name; ?>[show_list]" value="posts" <?php $this->checked( 'show_list', 'posts'); ?>/> <?php _e( "Posts", $this->hook ); ?></label>
|
| 763 |
+
<label><input type="radio" class="show_list" name="<?php echo $this->option_name; ?>[show_list]" value="manual" <?php $this->checked( 'show_list', 'manual'); ?> /> <?php _e( "Use shortcode in your template", $this->hook ); ?>
|
| 764 |
+
</label>
|
| 765 |
+
<textarea id="pf-shortcode" class="code" rows="2" cols="40"><?php if(function_exists('pf_show_link')){echo pf_show_link();} ?></textarea>
|
| 766 |
+
</div>
|
| 767 |
+
</div>
|
| 768 |
+
|
| 769 |
+
<!--Section 3 Button Print Options-->
|
| 770 |
+
<div id="print-options">
|
| 771 |
+
<h3><?php _e( "Print PDF Options", $this->hook ); ?></h3>
|
| 772 |
+
<label id="pf-favicon" for="favicon">
|
| 773 |
+
<?php _e( "Page header", $this->hook ); ?>
|
| 774 |
+
<select id="pf-logo" name="<?php echo $this->option_name; ?>[logo]" >
|
| 775 |
+
<option value="favicon" <?php selected( $this->options['logo'], 'favicon' ); ?>><?php _e( "My Website Icon", $this->hook ); ?></option>
|
| 776 |
+
<option value="upload-an-image" <?php selected( $this->options['logo'], 'upload-an-image' ); ?>><?php _e( "Upload an Image", $this->hook ); ?></option>
|
| 777 |
+
</select>
|
| 778 |
+
</label>
|
| 779 |
+
<div class="custom-logo"><label for="Enter_URL">Enter url</label><input id="upload-an-image" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[image_url]" value="<?php $this->val( 'image_url' ); ?>" /><label for="Text__optional_">Text (optional)</label><input id="image-tagline" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[tagline]" value="<?php $this->val( 'tagline' ); ?>" /></div>
|
| 780 |
+
<div id="pf-image-error"></div>
|
| 781 |
+
<div id="pf-image-preview"></div>
|
| 782 |
+
<label for="click_to_delete">
|
| 783 |
+
<?php _e( "Click-to-delete", $this->hook ); ?>
|
| 784 |
+
<select name="<?php echo $this->option_name; ?>[click_to_delete]" id="click-to-delete">
|
| 785 |
+
<option value="0" <?php selected( $this->options['click_to_delete'], '0' ); ?>><?php _e( "Allow", $this->hook ); ?></option>
|
| 786 |
+
<option value="1" <?php selected( $this->options['click_to_delete'], '1' ); ?>><?php _e( "Not Allow", $this->hook ); ?></option>
|
| 787 |
+
</select>
|
| 788 |
+
</label>
|
| 789 |
+
</div>
|
| 790 |
+
|
| 791 |
+
<!--Section 4 WebMaster-->
|
| 792 |
+
<h3><?php _e( "Webmaster Settings", $this->hook ); ?></h3>
|
| 793 |
+
|
| 794 |
+
<label for="protocol">Website Protocol<br>
|
| 795 |
+
<select id="website_protocol" name="<?php echo $this->option_name; ?>[website_protocol]" >
|
| 796 |
+
<option value="http" <?php selected( $this->options['website_protocol'], 'http' ); ?>><?php _e( "http (common)", $this->hook ); ?></option>
|
| 797 |
+
<option value="https" <?php selected( $this->options['website_protocol'], 'https' ); ?>><?php _e( "https (secure)", $this->hook ); ?></option>
|
| 798 |
+
</select>
|
| 799 |
+
<span id="https-beta-registration" class="description">HTTPS is in Beta. Please <a href="#" onclick="window.open('http://www.printfriendly.com/https-registration.html', 'newwindow', 'width=600, height=550'; return false;">Register for updates</a>.
|
| 800 |
+
</span>
|
| 801 |
+
</label>
|
| 802 |
+
<label for="password-site">Password Protected Content
|
| 803 |
+
<select id="password_protected" name="<?php echo $this->option_name; ?>[password_protected]">
|
| 804 |
+
<option value="no" <?php selected( $this->options['password_protected'], 'no' ); ?>><?php _e( "No", $this->hook ); ?></option>
|
| 805 |
+
<option value="yes" <?php selected( $this->options['password_protected'], 'yes' ); ?>><?php _e( "Yes", $this->hook ); ?></option>
|
| 806 |
+
</select>
|
| 807 |
+
</label>
|
| 808 |
+
<label id="pf-javascript-container">Use JavaScript<br>
|
| 809 |
+
<select id="javascript" name="<?php echo $this->option_name; ?>[javascript]>">
|
| 810 |
+
<option value="yes" <?php $this->selected( 'javascript', 'yes' ); ?>> <?php _e( "Yes", $this->hook ); ?></option>
|
| 811 |
+
<option value="no" <?php $this->selected( 'javascript', 'no' ); ?>> <?php _e( "No", $this->hook ); ?></option>
|
| 812 |
+
</select>
|
| 813 |
+
<span class="description javascript">
|
| 814 |
+
<?php _e( "Display print preview on-page using a JavaScript Lightbox (user never leaves the site/page).", $this->hook ); ?>
|
| 815 |
+
</span>
|
| 816 |
+
<span class="description no-javascript">
|
| 817 |
+
<?php _e( "Display print preview on PrintFriendly.com (No JavaScript)", $this->hook ); ?>
|
| 818 |
+
</span>
|
| 819 |
+
</label>
|
| 820 |
+
|
| 821 |
+
<p class="submit">
|
| 822 |
+
<input type="submit" class="button-primary" value="<?php esc_attr_e( "Save Options", $this->hook ); ?>"/>
|
| 823 |
+
<input type="reset" class="button-secondary" value="<?php esc_attr_e( "Cancel", $this->hook ); ?>"/>
|
| 824 |
+
</p>
|
| 825 |
+
<div id="after-submit">
|
| 826 |
+
<p>Need professional options for your corporate, education, or agency developed website? Check out <a href="http://www.printfriendly.com/pro">PrintFriendly Pro</a>.</p>
|
| 827 |
+
<p>
|
| 828 |
+
<?php _e( "Like PrintFriendly?", $this->hook ); ?> <a href="http://wordpress.org/extend/plugins/printfriendly/"><?php _e( "Give us a rating", $this->hook ); ?></a>. <?php _e( "Need help or have suggestions?", $this->hook ); ?> <a href="mailto:support@printfriendly.com?subject=Support%20for%20PrintFriendly%20WordPress%20plugin">support@PrintFriendly.com</a>.</p>
|
| 829 |
+
</div>
|
| 830 |
+
|
| 831 |
+
</form>
|
| 832 |
+
</div>
|
| 833 |
+
<?php
|
| 834 |
+
}
|
| 835 |
+
}
|
| 836 |
+
$printfriendly = new PrintFriendly_WordPress();
|
| 837 |
}
|
| 838 |
|
| 839 |
/**
|
| 843 |
* @return string returns a button to be printed.
|
| 844 |
*/
|
| 845 |
function pf_show_link() {
|
| 846 |
+
global $printfriendly;
|
| 847 |
+
return $printfriendly->show_link();
|
| 848 |
}
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: printfriendly,joostdevalk
|
|
| 3 |
Tags: print, pdf, printer, printing, printable, widget, plugin
|
| 4 |
Requires at least: 2.8
|
| 5 |
Tested up to: 3.2.1
|
| 6 |
-
Stable tag: 3.0.
|
| 7 |
|
| 8 |
The #1 Print and PDF button for your WordPress site. Printer Friendly pages without coding, css, or print.css. Fast, easy, and professional.
|
| 9 |
|
|
@@ -64,6 +64,10 @@ If you have any other issues with the plugin or the PrintFriendly widget, please
|
|
| 64 |
|
| 65 |
== Changelog ==
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
= 3.0.8 =
|
| 68 |
|
| 69 |
* Reordered PrintFriendly & PDF buttons. CSS stylesheet option is now checked by default.
|
| 3 |
Tags: print, pdf, printer, printing, printable, widget, plugin
|
| 4 |
Requires at least: 2.8
|
| 5 |
Tested up to: 3.2.1
|
| 6 |
+
Stable tag: 3.0.9
|
| 7 |
|
| 8 |
The #1 Print and PDF button for your WordPress site. Printer Friendly pages without coding, css, or print.css. Fast, easy, and professional.
|
| 9 |
|
| 64 |
|
| 65 |
== Changelog ==
|
| 66 |
|
| 67 |
+
= 3.0.9 =
|
| 68 |
+
|
| 69 |
+
* New features: Custom header, disable click-to-delete, https support (beta), PrintFriendly Pro (ad-free).
|
| 70 |
+
|
| 71 |
= 3.0.8 =
|
| 72 |
|
| 73 |
* Reordered PrintFriendly & PDF buttons. CSS stylesheet option is now checked by default.
|
