Version Description
- In category pages, the default behaviour of button added by shortcode/template is to link to a printable version of the individual posts. Sometimes, it is desirable to print the category page itself and not the individual posts. Added new template function/shortcode to always print the current page to use in this scenario.
- Add support for newer google analytics versions and google tag manager
Download this release
Release Info
| Developer | printfriendly |
| Plugin | |
| Version | 5.1 |
| Comparing to | |
| See all releases | |
Code changes from version 5.0 to 5.1
- assets/css/admin.css +27 -0
- assets/js/admin.js +71 -103
- languages/printfriendly.pot +117 -104
- pf.php +1663 -1476
- readme.txt +5 -1
- uninstall.php +16 -16
- views/pro.php +67 -67
- views/settings.php +21 -21
- views/tabs.php +635 -585
assets/css/admin.css
CHANGED
|
@@ -339,6 +339,33 @@ code ~ p.description {
|
|
| 339 |
margin-top: 10px;
|
| 340 |
}
|
| 341 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
/* do not show any notices that do not belong to us */
|
| 343 |
.notice:not(.pf-notice) {
|
| 344 |
display: none;
|
| 339 |
margin-top: 10px;
|
| 340 |
}
|
| 341 |
|
| 342 |
+
.pf-button-img {
|
| 343 |
+
border: none;
|
| 344 |
+
-webkit-box-shadow: none;
|
| 345 |
+
-moz-box-shadow: none;
|
| 346 |
+
box-shadow: none;
|
| 347 |
+
padding: 0;
|
| 348 |
+
margin: 0;
|
| 349 |
+
display: inline;
|
| 350 |
+
vertical-align: middle;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
.pf-button-img:not(:empty) ~ .pf-button-text {
|
| 354 |
+
margin-left: 6px;
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
#custom-img-sizes {
|
| 358 |
+
margin-top: 10px;
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
#custom_image_label img {
|
| 362 |
+
max-width: 200px;
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
.small-text {
|
| 366 |
+
font-size: smaller;
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
/* do not show any notices that do not belong to us */
|
| 370 |
.notice:not(.pf-notice) {
|
| 371 |
display: none;
|
assets/js/admin.js
CHANGED
|
@@ -86,62 +86,6 @@
|
|
| 86 |
}
|
| 87 |
|
| 88 |
function initMisc() {
|
| 89 |
-
$('.show_list').change(function() {
|
| 90 |
-
if ($('.show_list:checked').length == 0) {
|
| 91 |
-
$('.content_placement').hide('slow');
|
| 92 |
-
$('.content_placement input').prop('disabled', true);
|
| 93 |
-
$('.show_template').prop('checked', true);
|
| 94 |
-
} else {
|
| 95 |
-
$('.show_template').prop('checked', false);
|
| 96 |
-
$('.content_placement').show('slow');
|
| 97 |
-
$('.content_placement input').prop('disabled', false);
|
| 98 |
-
}
|
| 99 |
-
|
| 100 |
-
var postName = 'printfriendly_option[show_on_posts]';
|
| 101 |
-
var homeName = 'printfriendly_option[show_on_homepage]';
|
| 102 |
-
|
| 103 |
-
var optionName = $(this).attr('name');
|
| 104 |
-
if (optionName == homeName || optionName == postName){
|
| 105 |
-
if($(this).is(':checked')) {
|
| 106 |
-
$('#pf-categories').show('slow');
|
| 107 |
-
} else if(!$('input[name="' + homeName + '"]').is(':checked') && !$('input[name="' + postName + '"]').is(':checked')) {
|
| 108 |
-
$('#pf-categories').hide('slow');
|
| 109 |
-
}
|
| 110 |
-
}
|
| 111 |
-
}).change();
|
| 112 |
-
|
| 113 |
-
$('.show_template').change(function() {
|
| 114 |
-
if($(this).is(':checked')) {
|
| 115 |
-
$('.show_list').prop('checked', false);
|
| 116 |
-
$('.show_list').prop('disabled', true);
|
| 117 |
-
$('.content_placement').hide('slow');
|
| 118 |
-
$('.content_placement input').prop('disabled',true);
|
| 119 |
-
$('#pf-categories-metabox').hide('slow');
|
| 120 |
-
$('#pf-snippet').show('slow');
|
| 121 |
-
} else {
|
| 122 |
-
$('.show_list').prop('disabled', false);
|
| 123 |
-
$('.content_placement').show('slow');
|
| 124 |
-
$('.content_placement input').prop('disabled', false);
|
| 125 |
-
$('#pf-snippet').hide('slow');
|
| 126 |
-
}
|
| 127 |
-
}).change();
|
| 128 |
-
|
| 129 |
-
$('#toggle-categories').click(function() {
|
| 130 |
-
if($('#pf-categories-metabox').is(':visible')) {
|
| 131 |
-
$('#pf-categories-metabox').hide('slow');
|
| 132 |
-
} else {
|
| 133 |
-
$('#pf-categories-metabox').show('slow');
|
| 134 |
-
}
|
| 135 |
-
});
|
| 136 |
-
|
| 137 |
-
$(document).mouseup(function (e) {
|
| 138 |
-
var container = $("#pf-categories");
|
| 139 |
-
|
| 140 |
-
if (container.has(e.target).length === 0) {
|
| 141 |
-
$('#pf-categories-metabox').hide('slow');
|
| 142 |
-
}
|
| 143 |
-
});
|
| 144 |
-
|
| 145 |
$('.pf-color-picker').wpColorPicker({
|
| 146 |
change: function (event, ui) {
|
| 147 |
var hex = ui.color.toString();
|
|
@@ -168,59 +112,17 @@
|
|
| 168 |
}).change();
|
| 169 |
|
| 170 |
$('#custom_text').on('change keyup', function(){
|
| 171 |
-
|
| 172 |
});
|
| 173 |
|
| 174 |
$("[name='printfriendly_option[custom_button_text]']").change(function(){
|
| 175 |
-
|
| 176 |
});
|
| 177 |
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
$('#printfriendly-text2').text( newText );
|
| 182 |
-
$('#printfriendly-text2').css('color','#' + $('#text_color').val());
|
| 183 |
-
}
|
| 184 |
-
|
| 185 |
-
function pf_initialize_preview(urlInputSelector, previewSelector) {
|
| 186 |
-
var el = $(urlInputSelector);
|
| 187 |
-
var imgUrl = $.trim(el.val());
|
| 188 |
-
var preview = $(previewSelector + '-preview');
|
| 189 |
-
var error = $(previewSelector + '-error');
|
| 190 |
-
|
| 191 |
-
el.on('input paste change keyup', function() {
|
| 192 |
-
setTimeout(function() {
|
| 193 |
-
// ie shows error if we try to merge the two below into a single statement
|
| 194 |
-
var img = $('<img/>');
|
| 195 |
-
var customButtonIcon = $("[name='printfriendly_option[custom_button_icon]']:checked").val();
|
| 196 |
-
|
| 197 |
-
if (customButtonIcon === 'custom-image') {
|
| 198 |
-
imgUrl = $('#custom_image').val();
|
| 199 |
-
} else if (customButtonIcon === 'no-image') {
|
| 200 |
-
imgUrl = '';
|
| 201 |
-
} else {
|
| 202 |
-
imgUrl = customButtonIcon;
|
| 203 |
-
}
|
| 204 |
|
| 205 |
-
preview.html('');
|
| 206 |
-
error.html('');
|
| 207 |
-
if(imgUrl != '') {
|
| 208 |
-
img.on('load', function(){
|
| 209 |
-
preview.html('').append(img);
|
| 210 |
-
});
|
| 211 |
-
img.on('error', function(){
|
| 212 |
-
error.html('<div class="error settings-error"><p><strong>' + pf_config.i10n.invalid_image_url + '</strong></p></div>');
|
| 213 |
-
});
|
| 214 |
-
img.attr('src',imgUrl);
|
| 215 |
-
}
|
| 216 |
-
}, 100);
|
| 217 |
-
});
|
| 218 |
-
}
|
| 219 |
-
|
| 220 |
-
pf_initialize_preview('#custom_image', '#pf-custom-button');
|
| 221 |
-
pf_initialize_preview("[name='printfriendly_option[custom_button_icon]']", '#pf-custom-button');
|
| 222 |
-
pf_initialize_preview('#upload-an-image', '#pf-image');
|
| 223 |
-
//$('#custom_image, #upload-an-image').change();
|
| 224 |
$('#custom_image').on('focus', function() {
|
| 225 |
$('#custom-image').prop('checked', true);
|
| 226 |
$('#pf-custom-button-error').show();
|
|
@@ -322,6 +224,72 @@
|
|
| 322 |
$("#custom-text-rb").trigger("change");
|
| 323 |
});
|
| 324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
}
|
| 326 |
|
| 327 |
function initCustomCssSelectors() {
|
| 86 |
}
|
| 87 |
|
| 88 |
function initMisc() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
$('.pf-color-picker').wpColorPicker({
|
| 90 |
change: function (event, ui) {
|
| 91 |
var hex = ui.color.toString();
|
| 112 |
}).change();
|
| 113 |
|
| 114 |
$('#custom_text').on('change keyup', function(){
|
| 115 |
+
custom_text_change();
|
| 116 |
});
|
| 117 |
|
| 118 |
$("[name='printfriendly_option[custom_button_text]']").change(function(){
|
| 119 |
+
custom_text_change();
|
| 120 |
});
|
| 121 |
|
| 122 |
+
initialize_preview('#custom_image', '#pf-custom-button');
|
| 123 |
+
initialize_preview("[name='printfriendly_option[custom_button_icon]']", '#pf-custom-button');
|
| 124 |
+
initialize_preview('#upload-an-image', '#pf-image');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
$('#custom_image').on('focus', function() {
|
| 127 |
$('#custom-image').prop('checked', true);
|
| 128 |
$('#pf-custom-button-error').show();
|
| 224 |
$("#custom-text-rb").trigger("change");
|
| 225 |
});
|
| 226 |
|
| 227 |
+
$('.pf-show-element').on('click', function(e){
|
| 228 |
+
e.preventDefault();
|
| 229 |
+
var that = $(this);
|
| 230 |
+
that.hide('slow');
|
| 231 |
+
$(that.attr('data-element')).show('slow');
|
| 232 |
+
});
|
| 233 |
+
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
function custom_text_change(){
|
| 237 |
+
$('#buttongroup3 span:not(.printandpdf)').text( $('#custom_text').val() );
|
| 238 |
+
var newText = $('#custom-text-no').prop('checked') ? '' : $('#custom_text').val();
|
| 239 |
+
$('#printfriendly-text2').text( newText );
|
| 240 |
+
$('#printfriendly-text2').css('color','#' + $('#text_color').val());
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
function initialize_preview(urlInputSelector, previewSelector) {
|
| 244 |
+
var el = $(urlInputSelector);
|
| 245 |
+
var imgUrl = $.trim(el.val());
|
| 246 |
+
var preview = $(previewSelector + '-preview');
|
| 247 |
+
var error = $(previewSelector + '-error');
|
| 248 |
+
|
| 249 |
+
// set the dimensions of the image
|
| 250 |
+
if(urlInputSelector === '#custom_image'){
|
| 251 |
+
$('#custom-img-width, #custom-img-height').on('change', function(ewh){
|
| 252 |
+
var _width = $('#custom-img-width').val();
|
| 253 |
+
var _height = $('#custom-img-height').val();
|
| 254 |
+
var _img = preview.find('img');
|
| 255 |
+
_img.css('width', '');
|
| 256 |
+
_img.css('height', '');
|
| 257 |
+
if(_img.length > 0 && parseInt(_width) > 0){
|
| 258 |
+
_img.css('width', _width + 'px');
|
| 259 |
+
}
|
| 260 |
+
if(_img.length > 0 && parseInt(_height) > 0){
|
| 261 |
+
_img.css('height', _height + 'px');
|
| 262 |
+
}
|
| 263 |
+
});
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
el.on('input paste change keyup', function() {
|
| 267 |
+
setTimeout(function() {
|
| 268 |
+
// ie shows error if we try to merge the two below into a single statement
|
| 269 |
+
var img = $('<img/>');
|
| 270 |
+
var customButtonIcon = $("[name='printfriendly_option[custom_button_icon]']:checked").val();
|
| 271 |
+
|
| 272 |
+
if (customButtonIcon === 'custom-image') {
|
| 273 |
+
imgUrl = $('#custom_image').val();
|
| 274 |
+
} else if (customButtonIcon === 'no-image') {
|
| 275 |
+
imgUrl = '';
|
| 276 |
+
} else {
|
| 277 |
+
imgUrl = customButtonIcon;
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
preview.html('');
|
| 281 |
+
error.html('');
|
| 282 |
+
if(imgUrl != '') {
|
| 283 |
+
img.on('load', function(){
|
| 284 |
+
preview.html('').append(img);
|
| 285 |
+
});
|
| 286 |
+
img.on('error', function(){
|
| 287 |
+
error.html('<div class="error settings-error"><p><strong>' + pf_config.i10n.invalid_image_url + '</strong></p></div>');
|
| 288 |
+
});
|
| 289 |
+
img.attr('src',imgUrl);
|
| 290 |
+
}
|
| 291 |
+
}, 100);
|
| 292 |
+
});
|
| 293 |
}
|
| 294 |
|
| 295 |
function initCustomCssSelectors() {
|
languages/printfriendly.pot
CHANGED
|
@@ -2,112 +2,124 @@
|
|
| 2 |
# This file is distributed under the same license as the Print, PDF & Email by PrintFriendly package.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
-
"Project-Id-Version: Print, PDF & Email by PrintFriendly
|
| 6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-printfriendly\n"
|
| 7 |
-
"POT-Creation-Date: 2021-
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
| 11 |
"Last-Translator: PrintFriendly Translate Team <support@printfriendly.com>\n"
|
| 12 |
"Language-Team: PrintFriendly Translate Team <support@printfriendly.com>\n"
|
| 13 |
|
| 14 |
-
#: pf.php:
|
| 15 |
msgid ""
|
| 16 |
"No valid custom image url received, please enter a valid url to use a "
|
| 17 |
"custom image."
|
| 18 |
msgstr ""
|
| 19 |
|
| 20 |
-
#: pf.php:
|
| 21 |
msgid "The text size you entered is invalid, please stay between 9px and 25px"
|
| 22 |
msgstr ""
|
| 23 |
|
| 24 |
-
#: pf.php:
|
| 25 |
msgid ""
|
| 26 |
"The color you entered is not valid, it must be a valid hexadecimal RGB font "
|
| 27 |
"color."
|
| 28 |
msgstr ""
|
| 29 |
|
| 30 |
-
#: pf.php:
|
| 31 |
msgid ""
|
| 32 |
"No valid custom logo url received, please enter a valid url to use a custom "
|
| 33 |
"logo."
|
| 34 |
msgstr ""
|
| 35 |
|
| 36 |
-
#: pf.php:
|
| 37 |
msgid "PrintFriendly Options"
|
| 38 |
msgstr ""
|
| 39 |
|
| 40 |
-
#: pf.php:
|
| 41 |
msgid "Print Friendly & PDF"
|
| 42 |
msgstr ""
|
| 43 |
|
| 44 |
-
#: pf.php:
|
| 45 |
msgid "Custom Image"
|
| 46 |
msgstr ""
|
| 47 |
|
| 48 |
-
#: pf.php:
|
| 49 |
msgid "Use Image"
|
| 50 |
msgstr ""
|
| 51 |
|
| 52 |
-
#: pf.php:
|
| 53 |
msgid "Invalid Image URL"
|
| 54 |
msgstr ""
|
| 55 |
|
| 56 |
-
#: pf.php:
|
| 57 |
msgid "Activation"
|
| 58 |
msgstr ""
|
| 59 |
|
| 60 |
-
#: pf.php:
|
| 61 |
msgid "Checking status"
|
| 62 |
msgstr ""
|
| 63 |
|
| 64 |
-
#: pf.php:
|
| 65 |
msgid "Activate"
|
| 66 |
msgstr ""
|
| 67 |
|
| 68 |
-
#: pf.php:
|
| 69 |
msgid "Active Trial"
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
-
#: pf.php:
|
| 73 |
msgid "Active"
|
| 74 |
msgstr ""
|
| 75 |
|
| 76 |
-
#: pf.php:
|
| 77 |
msgid "Expired"
|
| 78 |
msgstr ""
|
| 79 |
|
| 80 |
-
#: pf.php:
|
| 81 |
msgid "Please check Internet connection."
|
| 82 |
msgstr ""
|
| 83 |
|
| 84 |
-
#: pf.php:
|
| 85 |
msgid "Settings"
|
| 86 |
msgstr ""
|
| 87 |
|
| 88 |
-
#: pf.php:
|
| 89 |
msgid "Documentation"
|
| 90 |
msgstr ""
|
| 91 |
|
| 92 |
-
#: pf.php:
|
| 93 |
msgid "Custom Button"
|
| 94 |
msgstr ""
|
| 95 |
|
| 96 |
-
#: pf.php:
|
| 97 |
msgid "Only display when post is in:"
|
| 98 |
msgstr ""
|
| 99 |
|
| 100 |
-
#: pf.php:
|
| 101 |
msgid ""
|
| 102 |
"You are currently using %1$s%2$s%3$s. You can copy copy its contents into "
|
| 103 |
"the textbox if you want to update the styles."
|
| 104 |
msgstr ""
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
#: views/pro.php:18
|
| 107 |
msgid "Learn more"
|
| 108 |
msgstr ""
|
| 109 |
|
| 110 |
-
#: views/pro.php:30 views/tabs.php:
|
| 111 |
msgid "Email"
|
| 112 |
msgstr ""
|
| 113 |
|
|
@@ -275,7 +287,8 @@ msgstr ""
|
|
| 275 |
msgid "Show Options Code"
|
| 276 |
msgstr ""
|
| 277 |
|
| 278 |
-
#: views/tabs.php:96
|
|
|
|
| 279 |
msgid "Copy Code"
|
| 280 |
msgstr ""
|
| 281 |
|
|
@@ -287,294 +300,294 @@ msgstr ""
|
|
| 287 |
msgid "Button Style"
|
| 288 |
msgstr ""
|
| 289 |
|
| 290 |
-
#: views/tabs.php:
|
| 291 |
msgid "Image"
|
| 292 |
msgstr ""
|
| 293 |
|
| 294 |
-
#: views/tabs.php:
|
| 295 |
msgid "Use Your Image"
|
| 296 |
msgstr ""
|
| 297 |
|
| 298 |
-
#: views/tabs.php:
|
| 299 |
msgid "Select Image"
|
| 300 |
msgstr ""
|
| 301 |
|
| 302 |
-
#: views/tabs.php:
|
| 303 |
-
msgid "
|
| 304 |
msgstr ""
|
| 305 |
|
| 306 |
#: views/tabs.php:197
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
msgid "Text"
|
| 308 |
msgstr ""
|
| 309 |
|
| 310 |
-
#: views/tabs.php:
|
| 311 |
msgid "Text Size"
|
| 312 |
msgstr ""
|
| 313 |
|
| 314 |
-
#: views/tabs.php:
|
| 315 |
msgid "No Text"
|
| 316 |
msgstr ""
|
| 317 |
|
| 318 |
-
#: views/tabs.php:
|
| 319 |
msgid "Preview"
|
| 320 |
msgstr ""
|
| 321 |
|
| 322 |
-
#: views/tabs.php:
|
| 323 |
msgid "Button Position"
|
| 324 |
msgstr ""
|
| 325 |
|
| 326 |
-
#: views/tabs.php:
|
| 327 |
msgid "Alignment"
|
| 328 |
msgstr ""
|
| 329 |
|
| 330 |
-
#: views/tabs.php:
|
| 331 |
msgid "Left Align"
|
| 332 |
msgstr ""
|
| 333 |
|
| 334 |
-
#: views/tabs.php:
|
| 335 |
msgid "Right Align"
|
| 336 |
msgstr ""
|
| 337 |
|
| 338 |
-
#: views/tabs.php:
|
| 339 |
msgid "Center"
|
| 340 |
msgstr ""
|
| 341 |
|
| 342 |
-
#: views/tabs.php:
|
| 343 |
msgid "None"
|
| 344 |
msgstr ""
|
| 345 |
|
| 346 |
-
#: views/tabs.php:
|
| 347 |
msgid "Placement"
|
| 348 |
msgstr ""
|
| 349 |
|
| 350 |
-
#: views/tabs.php:
|
| 351 |
msgid "Above Content"
|
| 352 |
msgstr ""
|
| 353 |
|
| 354 |
-
#: views/tabs.php:
|
| 355 |
msgid "Below Content"
|
| 356 |
msgstr ""
|
| 357 |
|
| 358 |
-
#: views/tabs.php:
|
| 359 |
msgid "Button Display"
|
| 360 |
msgstr ""
|
| 361 |
|
| 362 |
-
#: views/tabs.php:
|
| 363 |
msgid "Pages to show on"
|
| 364 |
msgstr ""
|
| 365 |
|
| 366 |
-
#: views/tabs.php:
|
| 367 |
msgid "Posts"
|
| 368 |
msgstr ""
|
| 369 |
|
| 370 |
-
#: views/tabs.php:
|
| 371 |
msgid "Pages"
|
| 372 |
msgstr ""
|
| 373 |
|
| 374 |
-
#: views/tabs.php:
|
| 375 |
msgid "Homepage"
|
| 376 |
msgstr ""
|
| 377 |
|
| 378 |
-
#: views/tabs.php:
|
| 379 |
msgid "Category Pages"
|
| 380 |
msgstr ""
|
| 381 |
|
| 382 |
-
#: views/tabs.php:
|
| 383 |
msgid "Taxonomy Pages"
|
| 384 |
msgstr ""
|
| 385 |
|
| 386 |
-
#: views/tabs.php:
|
| 387 |
-
msgid "
|
| 388 |
-
msgstr ""
|
| 389 |
-
|
| 390 |
-
#: views/tabs.php:283
|
| 391 |
-
msgid "Copy Snippet"
|
| 392 |
-
msgstr ""
|
| 393 |
-
|
| 394 |
-
#: views/tabs.php:286
|
| 395 |
-
msgid "or use the shortcode inside your page/article"
|
| 396 |
msgstr ""
|
| 397 |
|
| 398 |
-
#: views/tabs.php:
|
| 399 |
-
msgid "
|
| 400 |
msgstr ""
|
| 401 |
|
| 402 |
-
#: views/tabs.php:
|
| 403 |
-
msgid "
|
| 404 |
msgstr ""
|
| 405 |
|
| 406 |
-
#: views/tabs.php:
|
| 407 |
msgid "Pro Exclusive Features"
|
| 408 |
msgstr ""
|
| 409 |
|
| 410 |
-
#: views/tabs.php:
|
| 411 |
msgid "Encode images"
|
| 412 |
msgstr ""
|
| 413 |
|
| 414 |
-
#: views/tabs.php:
|
| 415 |
msgid "No"
|
| 416 |
msgstr ""
|
| 417 |
|
| 418 |
-
#: views/tabs.php:
|
| 419 |
msgid "Yes"
|
| 420 |
msgstr ""
|
| 421 |
|
| 422 |
-
#: views/tabs.php:
|
| 423 |
msgid ""
|
| 424 |
"Select \"Yes\" if your site is not publicly accessible or if your provider "
|
| 425 |
"blocks image requests from third parties or if images are not present in PDF"
|
| 426 |
msgstr ""
|
| 427 |
|
| 428 |
-
#: views/tabs.php:
|
| 429 |
msgid "Show Hidden Content"
|
| 430 |
msgstr ""
|
| 431 |
|
| 432 |
-
#: views/tabs.php:
|
| 433 |
msgid ""
|
| 434 |
"By default PrintFriendly Pro will only show the visible content on the "
|
| 435 |
"page. Select \"Yes\", if you want PrintFriendly to show hidden content. "
|
| 436 |
"(Ex. Content in hidden tabs)"
|
| 437 |
msgstr ""
|
| 438 |
|
| 439 |
-
#: views/tabs.php:
|
| 440 |
msgid "These features require a Pro subscription."
|
| 441 |
msgstr ""
|
| 442 |
|
| 443 |
-
#: views/tabs.php:
|
| 444 |
msgid "Learn More"
|
| 445 |
msgstr ""
|
| 446 |
|
| 447 |
-
#: views/tabs.php:
|
| 448 |
msgid "Save Options"
|
| 449 |
msgstr ""
|
| 450 |
|
| 451 |
-
#: views/tabs.php:
|
| 452 |
msgid "Cancel"
|
| 453 |
msgstr ""
|
| 454 |
|
| 455 |
-
#: views/tabs.php:
|
| 456 |
msgid "Page header"
|
| 457 |
msgstr ""
|
| 458 |
|
| 459 |
-
#: views/tabs.php:
|
| 460 |
msgid "My Website Icon"
|
| 461 |
msgstr ""
|
| 462 |
|
| 463 |
-
#: views/tabs.php:
|
| 464 |
msgid "Tagline (optional)"
|
| 465 |
msgstr ""
|
| 466 |
|
| 467 |
-
#: views/tabs.php:
|
| 468 |
msgid "Features"
|
| 469 |
msgstr ""
|
| 470 |
|
| 471 |
-
#: views/tabs.php:
|
| 472 |
msgid "Track in Google Analytics"
|
| 473 |
msgstr ""
|
| 474 |
|
| 475 |
-
#: views/tabs.php:
|
| 476 |
msgid "Click to delete"
|
| 477 |
msgstr ""
|
| 478 |
|
| 479 |
-
#: views/tabs.php:
|
| 480 |
msgid "Allow"
|
| 481 |
msgstr ""
|
| 482 |
|
| 483 |
-
#: views/tabs.php:
|
| 484 |
msgid "Not Allow"
|
| 485 |
msgstr ""
|
| 486 |
|
| 487 |
-
#: views/tabs.php:
|
| 488 |
msgid "Read documentation about this feature %1$shere%2$s"
|
| 489 |
msgstr ""
|
| 490 |
|
| 491 |
-
#: views/tabs.php:
|
| 492 |
msgid "Image size"
|
| 493 |
msgstr ""
|
| 494 |
|
| 495 |
-
#: views/tabs.php:
|
| 496 |
msgid "Full Size"
|
| 497 |
msgstr ""
|
| 498 |
|
| 499 |
-
#: views/tabs.php:
|
| 500 |
msgid "Large"
|
| 501 |
msgstr ""
|
| 502 |
|
| 503 |
-
#: views/tabs.php:
|
| 504 |
msgid "Medium"
|
| 505 |
msgstr ""
|
| 506 |
|
| 507 |
-
#: views/tabs.php:
|
| 508 |
msgid "Small"
|
| 509 |
msgstr ""
|
| 510 |
|
| 511 |
-
#: views/tabs.php:
|
| 512 |
msgid "Remove Images"
|
| 513 |
msgstr ""
|
| 514 |
|
| 515 |
-
#: views/tabs.php:
|
| 516 |
msgid "Image style"
|
| 517 |
msgstr ""
|
| 518 |
|
| 519 |
-
#: views/tabs.php:
|
| 520 |
msgid "Center/Block"
|
| 521 |
msgstr ""
|
| 522 |
|
| 523 |
-
#: views/tabs.php:
|
| 524 |
msgid "Align Right"
|
| 525 |
msgstr ""
|
| 526 |
|
| 527 |
-
#: views/tabs.php:
|
| 528 |
msgid "Align Left"
|
| 529 |
msgstr ""
|
| 530 |
|
| 531 |
-
#: views/tabs.php:
|
| 532 |
msgid "Align None"
|
| 533 |
msgstr ""
|
| 534 |
|
| 535 |
-
#: views/tabs.php:
|
| 536 |
msgid "PDF"
|
| 537 |
msgstr ""
|
| 538 |
|
| 539 |
-
#: views/tabs.php:
|
| 540 |
msgid "Developer Note"
|
| 541 |
msgstr ""
|
| 542 |
|
| 543 |
-
#: views/tabs.php:
|
| 544 |
msgid ""
|
| 545 |
"On localhost the images can not be included in the PDF. Once the website is "
|
| 546 |
"live/public images will be included in the PDF."
|
| 547 |
msgstr ""
|
| 548 |
|
| 549 |
-
#: views/tabs.php:
|
| 550 |
msgid "Print"
|
| 551 |
msgstr ""
|
| 552 |
|
| 553 |
-
#: views/tabs.php:
|
| 554 |
msgid "Custom CSS"
|
| 555 |
msgstr ""
|
| 556 |
|
| 557 |
-
#: views/tabs.php:
|
| 558 |
msgid "Custom CSS URL"
|
| 559 |
msgstr ""
|
| 560 |
|
| 561 |
-
#: views/tabs.php:
|
| 562 |
msgid ""
|
| 563 |
"Customize the styles of the printed/pdf page using your own CSS. Create "
|
| 564 |
"your custom CSS, and put the URL to your Custom CSS file in the box above"
|
| 565 |
msgstr ""
|
| 566 |
|
| 567 |
-
#: views/tabs.php:
|
| 568 |
msgid ""
|
| 569 |
"Customize the styles of the printed/pdf page using your own CSS. Add your "
|
| 570 |
"custom CSS (without the %s tags) in the box above"
|
| 571 |
msgstr ""
|
| 572 |
|
| 573 |
-
#: views/tabs.php:
|
| 574 |
msgid "Debug options"
|
| 575 |
msgstr ""
|
| 576 |
|
| 577 |
-
#: views/tabs.php:
|
| 578 |
msgid "Currently in Debug Mode. This tab is visible in debug mode only"
|
| 579 |
msgstr ""
|
| 580 |
|
| 2 |
# This file is distributed under the same license as the Print, PDF & Email by PrintFriendly package.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
+
"Project-Id-Version: Print, PDF & Email by PrintFriendly 5.0\n"
|
| 6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-printfriendly\n"
|
| 7 |
+
"POT-Creation-Date: 2021-12-29 15:35:50+00:00\n"
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
| 11 |
"Last-Translator: PrintFriendly Translate Team <support@printfriendly.com>\n"
|
| 12 |
"Language-Team: PrintFriendly Translate Team <support@printfriendly.com>\n"
|
| 13 |
|
| 14 |
+
#: pf.php:652
|
| 15 |
msgid ""
|
| 16 |
"No valid custom image url received, please enter a valid url to use a "
|
| 17 |
"custom image."
|
| 18 |
msgstr ""
|
| 19 |
|
| 20 |
+
#: pf.php:660
|
| 21 |
msgid "The text size you entered is invalid, please stay between 9px and 25px"
|
| 22 |
msgstr ""
|
| 23 |
|
| 24 |
+
#: pf.php:668
|
| 25 |
msgid ""
|
| 26 |
"The color you entered is not valid, it must be a valid hexadecimal RGB font "
|
| 27 |
"color."
|
| 28 |
msgstr ""
|
| 29 |
|
| 30 |
+
#: pf.php:723
|
| 31 |
msgid ""
|
| 32 |
"No valid custom logo url received, please enter a valid url to use a custom "
|
| 33 |
"logo."
|
| 34 |
msgstr ""
|
| 35 |
|
| 36 |
+
#: pf.php:820
|
| 37 |
msgid "PrintFriendly Options"
|
| 38 |
msgstr ""
|
| 39 |
|
| 40 |
+
#: pf.php:820
|
| 41 |
msgid "Print Friendly & PDF"
|
| 42 |
msgstr ""
|
| 43 |
|
| 44 |
+
#: pf.php:853 views/tabs.php:433
|
| 45 |
msgid "Custom Image"
|
| 46 |
msgstr ""
|
| 47 |
|
| 48 |
+
#: pf.php:854
|
| 49 |
msgid "Use Image"
|
| 50 |
msgstr ""
|
| 51 |
|
| 52 |
+
#: pf.php:855
|
| 53 |
msgid "Invalid Image URL"
|
| 54 |
msgstr ""
|
| 55 |
|
| 56 |
+
#: pf.php:869
|
| 57 |
msgid "Activation"
|
| 58 |
msgstr ""
|
| 59 |
|
| 60 |
+
#: pf.php:870
|
| 61 |
msgid "Checking status"
|
| 62 |
msgstr ""
|
| 63 |
|
| 64 |
+
#: pf.php:871 views/pro.php:45
|
| 65 |
msgid "Activate"
|
| 66 |
msgstr ""
|
| 67 |
|
| 68 |
+
#: pf.php:872
|
| 69 |
msgid "Active Trial"
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
+
#: pf.php:873
|
| 73 |
msgid "Active"
|
| 74 |
msgstr ""
|
| 75 |
|
| 76 |
+
#: pf.php:874
|
| 77 |
msgid "Expired"
|
| 78 |
msgstr ""
|
| 79 |
|
| 80 |
+
#: pf.php:875
|
| 81 |
msgid "Please check Internet connection."
|
| 82 |
msgstr ""
|
| 83 |
|
| 84 |
+
#: pf.php:904
|
| 85 |
msgid "Settings"
|
| 86 |
msgstr ""
|
| 87 |
|
| 88 |
+
#: pf.php:928 views/tabs.php:108 views/tabs.php:361 views/tabs.php:474
|
| 89 |
msgid "Documentation"
|
| 90 |
msgstr ""
|
| 91 |
|
| 92 |
+
#: pf.php:1299 views/tabs.php:165
|
| 93 |
msgid "Custom Button"
|
| 94 |
msgstr ""
|
| 95 |
|
| 96 |
+
#: pf.php:1497
|
| 97 |
msgid "Only display when post is in:"
|
| 98 |
msgstr ""
|
| 99 |
|
| 100 |
+
#: pf.php:1593
|
| 101 |
msgid ""
|
| 102 |
"You are currently using %1$s%2$s%3$s. You can copy copy its contents into "
|
| 103 |
"the textbox if you want to update the styles."
|
| 104 |
msgstr ""
|
| 105 |
|
| 106 |
+
#: test/wp/category-cat.php:53 test/wp/category-dog.php:52
|
| 107 |
+
msgid "Previous page"
|
| 108 |
+
msgstr ""
|
| 109 |
+
|
| 110 |
+
#: test/wp/category-cat.php:54 test/wp/category-dog.php:53
|
| 111 |
+
msgid "Next page"
|
| 112 |
+
msgstr ""
|
| 113 |
+
|
| 114 |
+
#: test/wp/category-cat.php:55 test/wp/category-dog.php:54
|
| 115 |
+
msgid "Page"
|
| 116 |
+
msgstr ""
|
| 117 |
+
|
| 118 |
#: views/pro.php:18
|
| 119 |
msgid "Learn more"
|
| 120 |
msgstr ""
|
| 121 |
|
| 122 |
+
#: views/pro.php:30 views/tabs.php:534
|
| 123 |
msgid "Email"
|
| 124 |
msgstr ""
|
| 125 |
|
| 287 |
msgid "Show Options Code"
|
| 288 |
msgstr ""
|
| 289 |
|
| 290 |
+
#: views/tabs.php:96 views/tabs.php:323 views/tabs.php:331 views/tabs.php:345
|
| 291 |
+
#: views/tabs.php:353
|
| 292 |
msgid "Copy Code"
|
| 293 |
msgstr ""
|
| 294 |
|
| 300 |
msgid "Button Style"
|
| 301 |
msgstr ""
|
| 302 |
|
| 303 |
+
#: views/tabs.php:170
|
| 304 |
msgid "Image"
|
| 305 |
msgstr ""
|
| 306 |
|
| 307 |
+
#: views/tabs.php:184
|
| 308 |
msgid "Use Your Image"
|
| 309 |
msgstr ""
|
| 310 |
|
| 311 |
+
#: views/tabs.php:187 views/tabs.php:439
|
| 312 |
msgid "Select Image"
|
| 313 |
msgstr ""
|
| 314 |
|
| 315 |
+
#: views/tabs.php:195
|
| 316 |
+
msgid "Width"
|
| 317 |
msgstr ""
|
| 318 |
|
| 319 |
#: views/tabs.php:197
|
| 320 |
+
msgid "Height"
|
| 321 |
+
msgstr ""
|
| 322 |
+
|
| 323 |
+
#: views/tabs.php:206
|
| 324 |
+
msgid "No Image"
|
| 325 |
+
msgstr ""
|
| 326 |
+
|
| 327 |
+
#: views/tabs.php:211
|
| 328 |
msgid "Text"
|
| 329 |
msgstr ""
|
| 330 |
|
| 331 |
+
#: views/tabs.php:219
|
| 332 |
msgid "Text Size"
|
| 333 |
msgstr ""
|
| 334 |
|
| 335 |
+
#: views/tabs.php:229
|
| 336 |
msgid "No Text"
|
| 337 |
msgstr ""
|
| 338 |
|
| 339 |
+
#: views/tabs.php:235
|
| 340 |
msgid "Preview"
|
| 341 |
msgstr ""
|
| 342 |
|
| 343 |
+
#: views/tabs.php:247
|
| 344 |
msgid "Button Position"
|
| 345 |
msgstr ""
|
| 346 |
|
| 347 |
+
#: views/tabs.php:253
|
| 348 |
msgid "Alignment"
|
| 349 |
msgstr ""
|
| 350 |
|
| 351 |
+
#: views/tabs.php:256
|
| 352 |
msgid "Left Align"
|
| 353 |
msgstr ""
|
| 354 |
|
| 355 |
+
#: views/tabs.php:257
|
| 356 |
msgid "Right Align"
|
| 357 |
msgstr ""
|
| 358 |
|
| 359 |
+
#: views/tabs.php:258
|
| 360 |
msgid "Center"
|
| 361 |
msgstr ""
|
| 362 |
|
| 363 |
+
#: views/tabs.php:259
|
| 364 |
msgid "None"
|
| 365 |
msgstr ""
|
| 366 |
|
| 367 |
+
#: views/tabs.php:265
|
| 368 |
msgid "Placement"
|
| 369 |
msgstr ""
|
| 370 |
|
| 371 |
+
#: views/tabs.php:268
|
| 372 |
msgid "Above Content"
|
| 373 |
msgstr ""
|
| 374 |
|
| 375 |
+
#: views/tabs.php:269
|
| 376 |
msgid "Below Content"
|
| 377 |
msgstr ""
|
| 378 |
|
| 379 |
+
#: views/tabs.php:279
|
| 380 |
msgid "Button Display"
|
| 381 |
msgstr ""
|
| 382 |
|
| 383 |
+
#: views/tabs.php:284
|
| 384 |
msgid "Pages to show on"
|
| 385 |
msgstr ""
|
| 386 |
|
| 387 |
+
#: views/tabs.php:286
|
| 388 |
msgid "Posts"
|
| 389 |
msgstr ""
|
| 390 |
|
| 391 |
+
#: views/tabs.php:287
|
| 392 |
msgid "Pages"
|
| 393 |
msgstr ""
|
| 394 |
|
| 395 |
+
#: views/tabs.php:288
|
| 396 |
msgid "Homepage"
|
| 397 |
msgstr ""
|
| 398 |
|
| 399 |
+
#: views/tabs.php:289
|
| 400 |
msgid "Category Pages"
|
| 401 |
msgstr ""
|
| 402 |
|
| 403 |
+
#: views/tabs.php:290
|
| 404 |
msgid "Taxonomy Pages"
|
| 405 |
msgstr ""
|
| 406 |
|
| 407 |
+
#: views/tabs.php:294
|
| 408 |
+
msgid "Specific categories to show on"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 409 |
msgstr ""
|
| 410 |
|
| 411 |
+
#: views/tabs.php:316
|
| 412 |
+
msgid "Add direct to template"
|
| 413 |
msgstr ""
|
| 414 |
|
| 415 |
+
#: views/tabs.php:338
|
| 416 |
+
msgid "Use the shortcode"
|
| 417 |
msgstr ""
|
| 418 |
|
| 419 |
+
#: views/tabs.php:369
|
| 420 |
msgid "Pro Exclusive Features"
|
| 421 |
msgstr ""
|
| 422 |
|
| 423 |
+
#: views/tabs.php:375
|
| 424 |
msgid "Encode images"
|
| 425 |
msgstr ""
|
| 426 |
|
| 427 |
+
#: views/tabs.php:378 views/tabs.php:389 views/tabs.php:491
|
| 428 |
msgid "No"
|
| 429 |
msgstr ""
|
| 430 |
|
| 431 |
+
#: views/tabs.php:379 views/tabs.php:390 views/tabs.php:490
|
| 432 |
msgid "Yes"
|
| 433 |
msgstr ""
|
| 434 |
|
| 435 |
+
#: views/tabs.php:381
|
| 436 |
msgid ""
|
| 437 |
"Select \"Yes\" if your site is not publicly accessible or if your provider "
|
| 438 |
"blocks image requests from third parties or if images are not present in PDF"
|
| 439 |
msgstr ""
|
| 440 |
|
| 441 |
+
#: views/tabs.php:386
|
| 442 |
msgid "Show Hidden Content"
|
| 443 |
msgstr ""
|
| 444 |
|
| 445 |
+
#: views/tabs.php:392
|
| 446 |
msgid ""
|
| 447 |
"By default PrintFriendly Pro will only show the visible content on the "
|
| 448 |
"page. Select \"Yes\", if you want PrintFriendly to show hidden content. "
|
| 449 |
"(Ex. Content in hidden tabs)"
|
| 450 |
msgstr ""
|
| 451 |
|
| 452 |
+
#: views/tabs.php:398
|
| 453 |
msgid "These features require a Pro subscription."
|
| 454 |
msgstr ""
|
| 455 |
|
| 456 |
+
#: views/tabs.php:398
|
| 457 |
msgid "Learn More"
|
| 458 |
msgstr ""
|
| 459 |
|
| 460 |
+
#: views/tabs.php:404 views/tabs.php:604
|
| 461 |
msgid "Save Options"
|
| 462 |
msgstr ""
|
| 463 |
|
| 464 |
+
#: views/tabs.php:405 views/tabs.php:605
|
| 465 |
msgid "Cancel"
|
| 466 |
msgstr ""
|
| 467 |
|
| 468 |
+
#: views/tabs.php:417
|
| 469 |
msgid "Page header"
|
| 470 |
msgstr ""
|
| 471 |
|
| 472 |
+
#: views/tabs.php:426
|
| 473 |
msgid "My Website Icon"
|
| 474 |
msgstr ""
|
| 475 |
|
| 476 |
+
#: views/tabs.php:454
|
| 477 |
msgid "Tagline (optional)"
|
| 478 |
msgstr ""
|
| 479 |
|
| 480 |
+
#: views/tabs.php:481
|
| 481 |
msgid "Features"
|
| 482 |
msgstr ""
|
| 483 |
|
| 484 |
+
#: views/tabs.php:487
|
| 485 |
msgid "Track in Google Analytics"
|
| 486 |
msgstr ""
|
| 487 |
|
| 488 |
+
#: views/tabs.php:497
|
| 489 |
msgid "Click to delete"
|
| 490 |
msgstr ""
|
| 491 |
|
| 492 |
+
#: views/tabs.php:500 views/tabs.php:537 views/tabs.php:547 views/tabs.php:558
|
| 493 |
msgid "Allow"
|
| 494 |
msgstr ""
|
| 495 |
|
| 496 |
+
#: views/tabs.php:501 views/tabs.php:538 views/tabs.php:548 views/tabs.php:559
|
| 497 |
msgid "Not Allow"
|
| 498 |
msgstr ""
|
| 499 |
|
| 500 |
+
#: views/tabs.php:503 views/tabs.php:529
|
| 501 |
msgid "Read documentation about this feature %1$shere%2$s"
|
| 502 |
msgstr ""
|
| 503 |
|
| 504 |
+
#: views/tabs.php:508
|
| 505 |
msgid "Image size"
|
| 506 |
msgstr ""
|
| 507 |
|
| 508 |
+
#: views/tabs.php:511
|
| 509 |
msgid "Full Size"
|
| 510 |
msgstr ""
|
| 511 |
|
| 512 |
+
#: views/tabs.php:512
|
| 513 |
msgid "Large"
|
| 514 |
msgstr ""
|
| 515 |
|
| 516 |
+
#: views/tabs.php:513
|
| 517 |
msgid "Medium"
|
| 518 |
msgstr ""
|
| 519 |
|
| 520 |
+
#: views/tabs.php:514
|
| 521 |
msgid "Small"
|
| 522 |
msgstr ""
|
| 523 |
|
| 524 |
+
#: views/tabs.php:515
|
| 525 |
msgid "Remove Images"
|
| 526 |
msgstr ""
|
| 527 |
|
| 528 |
+
#: views/tabs.php:521
|
| 529 |
msgid "Image style"
|
| 530 |
msgstr ""
|
| 531 |
|
| 532 |
+
#: views/tabs.php:524
|
| 533 |
msgid "Center/Block"
|
| 534 |
msgstr ""
|
| 535 |
|
| 536 |
+
#: views/tabs.php:525
|
| 537 |
msgid "Align Right"
|
| 538 |
msgstr ""
|
| 539 |
|
| 540 |
+
#: views/tabs.php:526
|
| 541 |
msgid "Align Left"
|
| 542 |
msgstr ""
|
| 543 |
|
| 544 |
+
#: views/tabs.php:527
|
| 545 |
msgid "Align None"
|
| 546 |
msgstr ""
|
| 547 |
|
| 548 |
+
#: views/tabs.php:544
|
| 549 |
msgid "PDF"
|
| 550 |
msgstr ""
|
| 551 |
|
| 552 |
+
#: views/tabs.php:550
|
| 553 |
msgid "Developer Note"
|
| 554 |
msgstr ""
|
| 555 |
|
| 556 |
+
#: views/tabs.php:550
|
| 557 |
msgid ""
|
| 558 |
"On localhost the images can not be included in the PDF. Once the website is "
|
| 559 |
"live/public images will be included in the PDF."
|
| 560 |
msgstr ""
|
| 561 |
|
| 562 |
+
#: views/tabs.php:555
|
| 563 |
msgid "Print"
|
| 564 |
msgstr ""
|
| 565 |
|
| 566 |
+
#: views/tabs.php:570
|
| 567 |
msgid "Custom CSS"
|
| 568 |
msgstr ""
|
| 569 |
|
| 570 |
+
#: views/tabs.php:577
|
| 571 |
msgid "Custom CSS URL"
|
| 572 |
msgstr ""
|
| 573 |
|
| 574 |
+
#: views/tabs.php:592
|
| 575 |
msgid ""
|
| 576 |
"Customize the styles of the printed/pdf page using your own CSS. Create "
|
| 577 |
"your custom CSS, and put the URL to your Custom CSS file in the box above"
|
| 578 |
msgstr ""
|
| 579 |
|
| 580 |
+
#: views/tabs.php:594
|
| 581 |
msgid ""
|
| 582 |
"Customize the styles of the printed/pdf page using your own CSS. Add your "
|
| 583 |
"custom CSS (without the %s tags) in the box above"
|
| 584 |
msgstr ""
|
| 585 |
|
| 586 |
+
#: views/tabs.php:619
|
| 587 |
msgid "Debug options"
|
| 588 |
msgstr ""
|
| 589 |
|
| 590 |
+
#: views/tabs.php:628
|
| 591 |
msgid "Currently in Debug Mode. This tab is visible in debug mode only"
|
| 592 |
msgstr ""
|
| 593 |
|
pf.php
CHANGED
|
@@ -1,16 +1,24 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
/*
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
*/
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
/**
|
| 15 |
* PrintFriendly WordPress plugin. Allows easy embedding of printfriendly.com buttons.
|
| 16 |
*
|
|
@@ -18,1485 +26,1664 @@
|
|
| 18 |
* @author PrintFriendly <support@printfriendly.com>
|
| 19 |
* @copyright Copyright (C) 2012, PrintFriendly
|
| 20 |
*/
|
| 21 |
-
if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
| 22 |
-
|
| 23 |
-
/**
|
| 24 |
-
* Class containing all the plugins functionality.
|
| 25 |
-
*
|
| 26 |
-
* @package PrintFriendly_WordPress
|
| 27 |
-
*/
|
| 28 |
-
class PrintFriendly_WordPress {
|
| 29 |
-
|
| 30 |
-
/**
|
| 31 |
-
* Current plugin version.
|
| 32 |
-
*
|
| 33 |
-
* @var string
|
| 34 |
-
*/
|
| 35 |
-
var $plugin_version = '5.0';
|
| 36 |
-
|
| 37 |
-
/**
|
| 38 |
-
* The hook, used for text domain as well as hooks on pages and in get requests for admin.
|
| 39 |
-
*
|
| 40 |
-
* @var string
|
| 41 |
-
*/
|
| 42 |
-
var $hook = 'printfriendly';
|
| 43 |
-
|
| 44 |
-
/**
|
| 45 |
-
* The option name, used throughout to refer to the plugins option and option group.
|
| 46 |
-
*
|
| 47 |
-
* @var string
|
| 48 |
-
*/
|
| 49 |
-
var $option_name = 'printfriendly_option';
|
| 50 |
-
|
| 51 |
-
/**
|
| 52 |
-
* The plugins options, loaded on init containing all the plugins settings.
|
| 53 |
-
*
|
| 54 |
-
* @var array
|
| 55 |
-
*/
|
| 56 |
-
var $options = array();
|
| 57 |
-
|
| 58 |
-
/**
|
| 59 |
-
* Database version, used to allow for easy upgrades to / additions in plugin options between plugin versions.
|
| 60 |
-
*
|
| 61 |
-
* @var int
|
| 62 |
-
*/
|
| 63 |
-
var $db_version = 20;
|
| 64 |
-
|
| 65 |
-
/**
|
| 66 |
-
* Settings page, used within the plugin to reliably load the plugins admin JS and CSS files only on the admin page.
|
| 67 |
-
*
|
| 68 |
-
* @var string
|
| 69 |
-
*/
|
| 70 |
-
var $settings_page = '';
|
| 71 |
-
|
| 72 |
-
/**
|
| 73 |
-
* GetSentry error reporting client
|
| 74 |
-
*
|
| 75 |
-
* @var Raven_Client
|
| 76 |
-
*/
|
| 77 |
-
var $raven_client = null;
|
| 78 |
-
|
| 79 |
-
/**
|
| 80 |
-
* Constructor
|
| 81 |
-
*
|
| 82 |
-
* @since 3.0
|
| 83 |
-
*/
|
| 84 |
-
function __construct() {
|
| 85 |
-
define( 'PRINTFRIENDLY_BASEPATH', dirname( __FILE__ ) );
|
| 86 |
-
define( 'PRINTFRIENDLY_BASEURL', plugins_url( '/', __FILE__ ) );
|
| 87 |
-
|
| 88 |
-
// Retrieve the plugin options
|
| 89 |
-
$this->options = get_option( $this->option_name );
|
| 90 |
-
|
| 91 |
-
// If the options array is empty, set defaults
|
| 92 |
-
if ( ! is_array( $this->options ) ) {
|
| 93 |
-
$this->set_defaults();
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
/**
|
| 97 |
-
* Set page content selection option "WordPress Standard/Strict" to "WP Template"
|
| 98 |
-
*/
|
| 99 |
-
if ( isset( $this->options['pf_algo'] ) && $this->options['pf_algo'] === 'ws' ) {
|
| 100 |
-
$this->options['pf_algo'] = 'wp';
|
| 101 |
-
update_option( $this->option_name, $this->options );
|
| 102 |
-
}
|
| 103 |
-
|
| 104 |
-
// If the version number doesn't match, upgrade
|
| 105 |
-
if ( $this->db_version > $this->options['db_version'] ) {
|
| 106 |
-
$this->upgrade();
|
| 107 |
-
}
|
| 108 |
-
|
| 109 |
-
add_action( 'wp_head', array(&$this, 'front_head') );
|
| 110 |
-
// automaticaly add the link
|
| 111 |
-
if ( ! $this->is_manual() ) {
|
| 112 |
-
add_filter( 'the_content', array(&$this, 'show_link_on_content') );
|
| 113 |
-
add_filter( 'the_excerpt', array(&$this, 'show_link_on_excerpt') );
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
add_action( 'the_content', array(&$this, 'add_pf_content_class_around_content_hook') );
|
| 117 |
-
|
| 118 |
-
if ( is_admin() ) {
|
| 119 |
-
$this->admin_hooks();
|
| 120 |
-
}
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
/**
|
| 124 |
-
* All admin hooks.
|
| 125 |
-
*/
|
| 126 |
-
function admin_hooks() {
|
| 127 |
-
// Hook into init for registration of the option and the language files
|
| 128 |
-
add_action( 'admin_init', array(&$this, 'init') );
|
| 129 |
-
|
| 130 |
-
// Register the settings page
|
| 131 |
-
add_action( 'admin_menu', array(&$this, 'add_config_page') );
|
| 132 |
-
|
| 133 |
-
// Enqueue the needed scripts and styles
|
| 134 |
-
add_action( 'admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts') );
|
| 135 |
-
|
| 136 |
-
// Register a link to the settings page on the plugins overview page
|
| 137 |
-
add_filter( 'plugin_action_links', array(&$this, 'filter_plugin_actions'), 10, 2 );
|
| 138 |
-
add_filter( 'plugin_row_meta', array(&$this, 'additional_links'), 10, 2 );
|
| 139 |
-
|
| 140 |
-
add_filter( 'wp_dropdown_cats', array( &$this, 'wp_dropdown_cats_multiple' ), 10, 2 );
|
| 141 |
-
}
|
| 142 |
-
|
| 143 |
-
/**
|
| 144 |
-
* Adds multiple select support for category dropdown.
|
| 145 |
-
*
|
| 146 |
-
* @since 4.2
|
| 147 |
-
**/
|
| 148 |
-
function wp_dropdown_cats_multiple( $output, $attributes ) {
|
| 149 |
-
if ( isset( $attributes['multiple'] ) && $attributes['multiple'] ) {
|
| 150 |
-
$output = preg_replace( '/^<select/i', '<select multiple', $output );
|
| 151 |
-
$output = str_replace( "name='{$attributes['name']}'", "name='{$attributes['name']}[]'", $output );
|
| 152 |
-
foreach ( array_map( 'trim', explode( ',', $attributes['selected'] ) ) as $value ) {
|
| 153 |
-
$output = str_replace( "value=\"{$value}\"", "value=\"{$value}\" selected", $output );
|
| 154 |
-
}
|
| 155 |
-
}
|
| 156 |
-
return $output;
|
| 157 |
-
}
|
| 158 |
-
|
| 159 |
-
/**
|
| 160 |
-
* Adds wraps content in pf-content class to help Printfriendly algo determine the content
|
| 161 |
-
*
|
| 162 |
-
* @since 3.2.8
|
| 163 |
-
**/
|
| 164 |
-
function add_pf_content_class_around_content_hook( $content = false ) {
|
| 165 |
-
if ( $this->is_enabled() && $this->is_wp_algo_on( $content ) ) {
|
| 166 |
-
add_action( 'wp_footer', array(&$this, 'print_script_footer') );
|
| 167 |
-
return '<div class="pf-content">' . $content . '</div>';
|
| 168 |
-
} else {
|
| 169 |
-
return $content;
|
| 170 |
-
}
|
| 171 |
-
}
|
| 172 |
-
|
| 173 |
-
/**
|
| 174 |
-
* Override to check if print-only command is being used
|
| 175 |
-
*
|
| 176 |
-
* @since 3.3.0
|
| 177 |
-
**/
|
| 178 |
-
function print_only_override( $content ) {
|
| 179 |
-
$pattern = '/class\s*?=\s*?(["\']|["\']([^"\']*?)\s)print-only(["\']|\s([^"\']*?)["\'])/';
|
| 180 |
-
$pf_pattern = '/class\s*?=\s*?(["\']|["\']([^"\']*?)\s)pf-content(["\']|\s([^"\']*?)["\'])/';
|
| 181 |
-
|
| 182 |
-
return ( preg_match( $pattern, $content ) || preg_match( $pf_pattern, $content ) );
|
| 183 |
-
}
|
| 184 |
-
|
| 185 |
-
/**
|
| 186 |
-
* Check if WP Algorithm is selected and content doesn't use print-only
|
| 187 |
-
*
|
| 188 |
-
* @since 3.5.4
|
| 189 |
-
**/
|
| 190 |
-
function is_wp_algo_on( $content ) {
|
| 191 |
-
return ! class_exists( 'WooCommerce' ) && isset( $this->options['pf_algo'] ) && $content && $this->options['pf_algo'] === 'wp' && ! $this->print_only_override( $content );
|
| 192 |
-
}
|
| 193 |
-
|
| 194 |
-
/**
|
| 195 |
-
* PHP 4 Compatible Constructor
|
| 196 |
-
*
|
| 197 |
-
* @since 3.0
|
| 198 |
-
*/
|
| 199 |
-
function PrintFriendly_WordPress() {
|
| 200 |
-
$this->__construct();
|
| 201 |
-
}
|
| 202 |
-
|
| 203 |
-
/**
|
| 204 |
-
* Check if button should be visible on particular page
|
| 205 |
-
*/
|
| 206 |
-
function is_enabled() {
|
| 207 |
-
if ( ( is_page() && ( isset( $this->options['show_on_pages'] ) && 'on' === $this->options['show_on_pages'] ) )
|
| 208 |
-
|| ( is_home() && ( ( isset( $this->options['show_on_homepage'] ) && 'on' === $this->options['show_on_homepage'] ) ) )
|
| 209 |
-
|| ( is_tax() && ( ( isset( $this->options['show_on_taxonomies'] ) && 'on' === $this->options['show_on_taxonomies'] ) && $this->category_included() ) )
|
| 210 |
-
|| ( is_category() && ( ( isset( $this->options['show_on_categories'] ) && 'on' === $this->options['show_on_categories'] ) && $this->category_included() ) )
|
| 211 |
-
|| ( is_single() && ( ( isset( $this->options['show_on_posts'] ) && 'on' === $this->options['show_on_posts'] ) && $this->category_included() ) )
|
| 212 |
-
) {
|
| 213 |
-
return true;
|
| 214 |
-
}
|
| 215 |
-
return false;
|
| 216 |
-
}
|
| 217 |
-
|
| 218 |
-
/**
|
| 219 |
-
* Prints the PrintFriendly button CSS, in the header.
|
| 220 |
-
*
|
| 221 |
-
* @since 3.0
|
| 222 |
-
*/
|
| 223 |
-
function front_head() {
|
| 224 |
-
if ( $this->is_enabled() ) {
|
| 225 |
-
?>
|
| 226 |
-
<?php
|
| 227 |
-
if ( isset( $this->options['enable_css'] ) && $this->options['enable_css'] !== 'on' ) {
|
| 228 |
-
return;
|
| 229 |
-
}
|
| 230 |
-
?>
|
| 231 |
-
<style type="text/css">
|
| 232 |
-
@media screen {
|
| 233 |
-
.printfriendly {
|
| 234 |
-
position: relative;
|
| 235 |
-
z-index: 1000;
|
| 236 |
-
margin: <?php echo sprintf( '%dpx %dpx %dpx %dpx', $this->val( 'margin_top', false, 0 ), $this->val( 'margin_right', false, 0 ), $this->val( 'margin_bottom', false, 0 ), $this->val( 'margin_left', false, 0 ) ); ?>;
|
| 237 |
-
}
|
| 238 |
-
.printfriendly a, .printfriendly a:link, .printfriendly a:visited, .printfriendly a:hover, .printfriendly a:active {
|
| 239 |
-
font-weight: 600;
|
| 240 |
-
cursor: pointer;
|
| 241 |
-
text-decoration: none;
|
| 242 |
-
border: none;
|
| 243 |
-
-webkit-box-shadow: none;
|
| 244 |
-
-moz-box-shadow: none;
|
| 245 |
-
box-shadow: none;
|
| 246 |
-
outline:none;
|
| 247 |
-
font-size: <?php echo $this->options['text_size']; ?>px !important;
|
| 248 |
-
color: <?php echo $this->options['text_color']; ?> !important;
|
| 249 |
-
}
|
| 250 |
-
.printfriendly.pf-alignleft {float: left}.printfriendly.pf-alignright {float: right}.printfriendly.pf-aligncenter {display: flex;align-items: center;justify-content: center;}
|
| 251 |
-
}
|
| 252 |
-
|
| 253 |
-
@media print {
|
| 254 |
-
.printfriendly {display: none}
|
| 255 |
-
}
|
| 256 |
-
|
| 257 |
-
.pf-button.pf-button-excerpt {
|
| 258 |
-
display: none;
|
| 259 |
-
}
|
| 260 |
-
|
| 261 |
-
</style>
|
| 262 |
-
<?php
|
| 263 |
-
}
|
| 264 |
-
}
|
| 265 |
-
|
| 266 |
-
/**
|
| 267 |
-
* Prints the PrintFriendly JavaScript, in the footer, and loads it asynchronously.
|
| 268 |
-
*
|
| 269 |
-
* @since 3.0
|
| 270 |
-
*/
|
| 271 |
-
function print_script_footer() {
|
| 272 |
-
$tagline = $this->options['tagline'];
|
| 273 |
-
$image_url = $this->options['image_url'];
|
| 274 |
-
if ( $this->options['logo'] === 'favicon' ) {
|
| 275 |
-
$tagline = '';
|
| 276 |
-
$image_url = '';
|
| 277 |
-
}
|
| 278 |
-
|
| 279 |
-
echo $this->getSelectorsFromCustomCSS();
|
| 280 |
-
|
| 281 |
-
// Currently we use v3 for both: normal and password protected sites
|
| 282 |
-
?>
|
| 283 |
-
<script type="text/javascript" id="pf_script">
|
| 284 |
-
var pfHeaderImgUrl = '<?php echo esc_js( esc_url( $image_url ) ); ?>';
|
| 285 |
-
var pfHeaderTagline = '<?php echo esc_js( $tagline ); ?>';
|
| 286 |
-
var pfdisableClickToDel = '<?php echo esc_js( $this->options['click_to_delete'] ); ?>';
|
| 287 |
-
var pfImagesSize = '<?php echo esc_js( $this->options['images-size'] ); ?>';
|
| 288 |
-
var pfImageDisplayStyle = '<?php echo esc_js( $this->options['image-style'] ); ?>';
|
| 289 |
-
var pfEncodeImages = '<?php echo esc_js( $this->val( 'password_protected', false ) === 'yes' ? 1 : 0 ); ?>';
|
| 290 |
-
var pfShowHiddenContent = '<?php echo esc_js( $this->val( 'show_hidden_content', false ) === 'yes' ? 1 : 0 ); ?>';
|
| 291 |
-
var pfDisableEmail = '<?php echo esc_js( $this->options['email'] ); ?>';
|
| 292 |
-
var pfDisablePDF = '<?php echo esc_js( $this->options['pdf'] ); ?>';
|
| 293 |
-
var pfDisablePrint = '<?php echo esc_js( $this->options['print'] ); ?>';
|
| 294 |
-
var pfCustomCSS = '<?php echo esc_js( esc_url( $this->get_custom_css() ) ); ?>';
|
| 295 |
-
var pfPlatform = 'WordPress';
|
| 296 |
-
</script>
|
| 297 |
-
<script async src='https://cdn.printfriendly.com/printfriendly.js'></script>
|
| 298 |
-
<?php
|
| 299 |
-
}
|
| 300 |
-
|
| 301 |
-
/**
|
| 302 |
-
* Used as a filter for the_content.
|
| 303 |
-
*
|
| 304 |
-
* @since ?
|
| 305 |
-
*
|
| 306 |
-
* @param string $content The content of the post, when the function is used as a filter.
|
| 307 |
-
*
|
| 308 |
-
* @return string The content with the button added to the content.
|
| 309 |
-
*/
|
| 310 |
-
function show_link_on_content( $content ) {
|
| 311 |
-
$content = $this->show_link( $content, true );
|
| 312 |
-
|
| 313 |
-
return $content;
|
| 314 |
-
}
|
| 315 |
-
|
| 316 |
-
/**
|
| 317 |
-
* Used as a filter for the_excerpt.
|
| 318 |
-
*
|
| 319 |
-
* @since ?
|
| 320 |
-
*
|
| 321 |
-
* @param string $content The content of the post, when the function is used as a filter.
|
| 322 |
-
*
|
| 323 |
-
* @return string The content with the button added to the content.
|
| 324 |
-
*/
|
| 325 |
-
function show_link_on_excerpt( $content ) {
|
| 326 |
-
return $this->show_link( $content, false );
|
| 327 |
-
}
|
| 328 |
-
|
| 329 |
-
/**
|
| 330 |
-
* Used to generate the the final content as per the required placement.
|
| 331 |
-
*
|
| 332 |
-
* @since 3.0
|
| 333 |
-
*
|
| 334 |
-
* @param string $content The content of the post, when the function is used as a filter.
|
| 335 |
-
* @param bool $on_content True if showing on the_content and False if showing on the_excerpt.
|
| 336 |
-
*
|
| 337 |
-
* @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.
|
| 338 |
-
*/
|
| 339 |
-
private function show_link( $content = false, $on_content = true ) {
|
| 340 |
-
$is_manual = $this->is_manual();
|
| 341 |
-
|
| 342 |
-
if ( ! $content && ! $is_manual ) {
|
| 343 |
-
return '';
|
| 344 |
-
}
|
| 345 |
-
|
| 346 |
-
$button = $this->getButton( false, $on_content ? 'pf-button-content' : 'pf-button-excerpt' );
|
| 347 |
-
if ( $is_manual ) {
|
| 348 |
-
// Hook the script call now, so it only get's loaded when needed, and need is determined by the user calling pf_button
|
| 349 |
-
add_action( 'wp_footer', array(&$this, 'print_script_footer') );
|
| 350 |
-
return $button;
|
| 351 |
-
} else {
|
| 352 |
-
if ( $this->is_enabled() ) {
|
| 353 |
-
// Hook the script call now, so it only get's loaded when needed, and need is determined by the user calling pf_button
|
| 354 |
-
add_action( 'wp_footer', array(&$this, 'print_script_footer') );
|
| 355 |
-
|
| 356 |
-
if ( $this->options['content_placement'] === 'before' ) {
|
| 357 |
-
return $button . $content;
|
| 358 |
-
} else {
|
| 359 |
-
return $content . $button;
|
| 360 |
-
}
|
| 361 |
-
} else {
|
| 362 |
-
return $content;
|
| 363 |
-
}
|
| 364 |
-
}
|
| 365 |
-
}
|
| 366 |
-
|
| 367 |
-
/**
|
| 368 |
-
* Returns the HTML of the button.
|
| 369 |
-
*
|
| 370 |
-
* This can be called publicly from `pf_show_link()`.
|
| 371 |
-
*
|
| 372 |
-
* @since 3.3.8
|
| 373 |
-
*
|
| 374 |
-
* @param bool $add_footer_script Whether to add the script in the footer.
|
| 375 |
-
* @param string $add_class Additional class for the HTML button div.
|
| 376 |
-
*
|
| 377 |
-
* @return Printfriendly Button HTML
|
| 378 |
-
*/
|
| 379 |
-
public function getButton( $add_footer_script = false, $add_class = '' ) {
|
| 380 |
-
if ( $add_footer_script ) {
|
| 381 |
-
add_action( 'wp_footer', array(&$this, 'print_script_footer') );
|
| 382 |
-
}
|
| 383 |
-
$js_enabled = $this->js_enabled();
|
| 384 |
-
$analytics_code = '';
|
| 385 |
-
$onclick = '';
|
| 386 |
-
|
| 387 |
-
if ( $this->google_analytics_enabled() ) {
|
| 388 |
-
$title_var = is_singular() ? esc_attr( get_the_title() ) : 'NULL';
|
| 389 |
-
$analytics_code = "if(typeof(_gaq) != 'undefined') { _gaq.push(['_trackEvent','PRINTFRIENDLY', 'print', '" . $title_var . "']);
|
| 390 |
-
}else if(typeof(ga) != 'undefined') { ga('send', 'event','PRINTFRIENDLY', 'print', '" . $title_var . "'); }";
|
| 391 |
-
if ( $js_enabled ) {
|
| 392 |
-
$onclick = 'onclick="window.print();' . $analytics_code . ' return false;"';
|
| 393 |
-
} else {
|
| 394 |
-
$onclick = '';
|
| 395 |
-
}
|
| 396 |
-
} elseif ( $js_enabled ) {
|
| 397 |
-
$onclick = 'onclick="window.print(); return false;"';
|
| 398 |
-
}
|
| 399 |
-
|
| 400 |
-
if ( $js_enabled ) {
|
| 401 |
-
$href = '#';
|
| 402 |
-
} else {
|
| 403 |
-
$href = 'https://www.printfriendly.com/print?url=' . urlencode( get_permalink() );
|
| 404 |
-
}
|
| 405 |
-
|
| 406 |
-
if ( ! $js_enabled ) {
|
| 407 |
-
if ( $this->google_analytics_enabled() ) {
|
| 408 |
-
$onclick = $onclick . ' onclick="' . $analytics_code . '"';
|
| 409 |
-
}
|
| 410 |
-
$href = 'https://www.printfriendly.com/print?headerImageUrl=' . urlencode( $this->options['image_url'] ) . '&headerTagline=' . urlencode( $this->options['tagline'] ) . '&pfCustomCSS=' . urlencode( $this->options['custom_css_url'] ) . '&imageDisplayStyle=' . urlencode( $this->options['image-style'] ) . '&disableClickToDel=' . urlencode( $this->options['click_to_delete'] ) . '.&disablePDF=' . urlencode( $this->options['pdf'] ) . '&disablePrint=' . urlencode( $this->options['print'] ) . '&disableEmail=' . urlencode( $this->options['email'] ) . '&imagesSize=' . urlencode( $this->options['images-size'] ) . '&url=' . urlencode( get_permalink() ) . '&source=wp';
|
| 411 |
-
}
|
| 412 |
-
if ( ! is_singular() && ! empty( $onclick ) && $js_enabled ) {
|
| 413 |
-
$onclick = '';
|
| 414 |
-
$href = add_query_arg( 'pfstyle', 'wp', get_permalink() );
|
| 415 |
-
}
|
| 416 |
-
|
| 417 |
-
$align = '';
|
| 418 |
-
if ( 'none' !== $this->options['content_position'] ) {
|
| 419 |
-
$align = ' pf-align' . $this->options['content_position'];
|
| 420 |
-
}
|
| 421 |
-
$href = str_replace( '&', '&', $href );
|
| 422 |
-
|
| 423 |
-
$button = apply_filters( 'printfriendly_button', '<div class="printfriendly pf-button ' . $add_class . $align . '"><a href="' . $href . '" rel="nofollow" ' . $onclick . ' title="Printer Friendly, PDF & Email">' . $this->button() . '</a></div>' );
|
| 424 |
-
return $button;
|
| 425 |
-
}
|
| 426 |
-
|
| 427 |
-
/**
|
| 428 |
-
* Returns the custom selector CSS to be added.
|
| 429 |
-
*
|
| 430 |
-
* @since 5.0
|
| 431 |
-
* @returns string
|
| 432 |
-
*/
|
| 433 |
-
private function getSelectorsFromCustomCSS() {
|
| 434 |
-
$css = '';
|
| 435 |
-
|
| 436 |
-
if ( $this->options['pf_algo'] === 'css' ) {
|
| 437 |
-
$attributes = array();
|
| 438 |
-
$names = array( 'author', 'date', 'content', 'title', 'primaryImage' );
|
| 439 |
-
$data = '';
|
| 440 |
-
foreach ( $names as $name ) {
|
| 441 |
-
$selector = $this->val( "css-{$name}", false );
|
| 442 |
-
$suffix = $name === 'content' ? 'Selectors' : 'Selector';
|
| 443 |
-
if ( ! empty( $selector ) ) {
|
| 444 |
-
$data .= "{$name}{$suffix}=$selector;";
|
| 445 |
-
}
|
| 446 |
-
}
|
| 447 |
-
$fallback = $this->options['pf_algo_css_content'];
|
| 448 |
-
if ( $data ) {
|
| 449 |
-
$css = sprintf( '<printfriendly-options data-selectors="%s" data-fallback-strategy="%s"></printfriendly-options>', esc_attr( $data ), esc_attr( $fallback ) );
|
| 450 |
-
}
|
| 451 |
-
}
|
| 452 |
-
return $css;
|
| 453 |
-
}
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
/**
|
| 457 |
-
* Checks if GA is enabled.
|
| 458 |
-
*
|
| 459 |
-
* @since 3.2.9
|
| 460 |
-
* @returns if google analytics enabled
|
| 461 |
-
*/
|
| 462 |
-
function google_analytics_enabled() {
|
| 463 |
-
return isset( $this->options['enable_google_analytics'] ) && $this->options['enable_google_analytics'] === 'yes';
|
| 464 |
-
}
|
| 465 |
-
|
| 466 |
-
/**
|
| 467 |
-
* Is JS enabled?
|
| 468 |
-
*
|
| 469 |
-
* @since 3.2.6
|
| 470 |
-
* @return boolean true if JS is enabled for the plugin
|
| 471 |
-
**/
|
| 472 |
-
function js_enabled() {
|
| 473 |
-
return true;
|
| 474 |
-
}
|
| 475 |
-
|
| 476 |
-
/**
|
| 477 |
-
* Filter posts by category.
|
| 478 |
-
*
|
| 479 |
-
* @since 3.2.2
|
| 480 |
-
* @return boolean true if post belongs to category selected for button display
|
| 481 |
-
*/
|
| 482 |
-
function category_included() {
|
| 483 |
-
return isset( $this->options['show_on_cat'] ) ? in_category( $this->options['show_on_cat'] ) : true;
|
| 484 |
-
}
|
| 485 |
-
|
| 486 |
-
/**
|
| 487 |
-
* Register the textdomain and the options array along with the validation function
|
| 488 |
-
*
|
| 489 |
-
* @since 3.0
|
| 490 |
-
*/
|
| 491 |
-
function init() {
|
| 492 |
-
// Allow for localization
|
| 493 |
-
load_plugin_textdomain( 'printfriendly', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
| 494 |
-
|
| 495 |
-
// Register our option array
|
| 496 |
-
register_setting( $this->option_name, $this->option_name, array( 'sanitize_callback' => array(&$this, 'options_validate') ) );
|
| 497 |
-
}
|
| 498 |
-
|
| 499 |
-
/**
|
| 500 |
-
* Validate the saved options.
|
| 501 |
-
*
|
| 502 |
-
* @since 3.0
|
| 503 |
-
* @param array $input with unvalidated options.
|
| 504 |
-
* @return array $valid_input with validated options.
|
| 505 |
-
*/
|
| 506 |
-
function options_validate( $input ) {
|
| 507 |
-
// Prevent CSRF attack
|
| 508 |
-
check_admin_referer( 'pf-options', 'pf-nonce' );
|
| 509 |
-
|
| 510 |
-
$valid_input = $input;
|
| 511 |
-
|
| 512 |
-
// Section 1 options
|
| 513 |
-
if ( ! isset( $input['button_type'] ) || ! in_array(
|
| 514 |
-
$input['button_type'], array(
|
| 515 |
-
'buttons/printfriendly-pdf-email-button.png',
|
| 516 |
-
'buttons/printfriendly-pdf-email-button-md.png',
|
| 517 |
-
'buttons/printfriendly-pdf-email-button-notext.png', // buttongroup1
|
| 518 |
-
'buttons/printfriendly-pdf-button.png',
|
| 519 |
-
'buttons/printfriendly-pdf-button-nobg.png',
|
| 520 |
-
'buttons/printfriendly-pdf-button-nobg-md.png', // buttongroup2
|
| 521 |
-
'buttons/printfriendly-button.png',
|
| 522 |
-
'buttons/printfriendly-button-nobg.png',
|
| 523 |
-
'buttons/printfriendly-button-md.png',
|
| 524 |
-
'buttons/printfriendly-button-lg.png', // buttongroup3
|
| 525 |
-
'buttons/print-button.png',
|
| 526 |
-
'buttons/print-button-nobg.png',
|
| 527 |
-
'buttons/print-button-gray.png', // buttongroup3
|
| 528 |
-
'custom-button', // custom
|
| 529 |
-
), true
|
| 530 |
-
) ) {
|
| 531 |
-
$valid_input['button_type'] = 'printfriendly-pdf-button.png';
|
| 532 |
-
}
|
| 533 |
-
|
| 534 |
-
if ( ! isset( $input['custom_button_icon'] ) || ! in_array(
|
| 535 |
-
$input['custom_button_icon'], array(
|
| 536 |
-
'https://cdn.printfriendly.com/icons/printfriendly-icon-sm.png',
|
| 537 |
-
'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png',
|
| 538 |
-
'https://cdn.printfriendly.com/icons/printfriendly-icon-lg.png',
|
| 539 |
-
'custom-image',
|
| 540 |
-
'no-image',
|
| 541 |
-
), true
|
| 542 |
-
) ) {
|
| 543 |
-
$valid_input['custom_button_icon'] = 'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png';
|
| 544 |
-
}
|
| 545 |
-
|
| 546 |
-
// if a custom image is not being chosen, reset it in case it existed in the past.
|
| 547 |
-
if ( isset( $valid_input['custom_button_icon'] ) && $valid_input['custom_button_icon'] !== 'custom-image' ) {
|
| 548 |
-
$valid_input['custom_image'] = '';
|
| 549 |
-
}
|
| 550 |
-
|
| 551 |
-
// @todo custom image url validation
|
| 552 |
-
if ( ! isset( $input['custom_image'] ) || empty( $input['custom_image'] ) ) {
|
| 553 |
-
$valid_input['custom_image'] = '';
|
| 554 |
-
}
|
| 555 |
-
|
| 556 |
-
if ( ! isset( $input['custom_button_text'] ) ) {
|
| 557 |
-
$valid_input['custom_button_text'] = 'custom-text';
|
| 558 |
-
}
|
| 559 |
-
|
| 560 |
-
// @todo validate optional custom text
|
| 561 |
-
if ( ! isset( $input['custom_text'] ) ) {
|
| 562 |
-
$valid_input['custom_text'] = 'Print Friendly';
|
| 563 |
-
}
|
| 564 |
-
|
| 565 |
-
// Custom button selected, but no url nor text given, reset button type to default
|
| 566 |
-
if ( 'custom-button' === $valid_input['button_type'] && ( '' === $valid_input['custom_image'] && '' === $input['custom_text'] ) ) {
|
| 567 |
-
$valid_input['button_type'] = 'buttons/printfriendly-pdf-button.png';
|
| 568 |
-
add_settings_error( $this->option_name, 'invalid_custom_image', __( 'No valid custom image url received, please enter a valid url to use a custom image.', 'printfriendly' ) );
|
| 569 |
-
}
|
| 570 |
-
|
| 571 |
-
$valid_input['text_size'] = (int) $input['text_size'];
|
| 572 |
-
if ( ! isset( $valid_input['text_size'] ) || 0 === $valid_input['text_size'] ) {
|
| 573 |
-
$valid_input['text_size'] = 14;
|
| 574 |
-
} elseif ( 25 < $valid_input['text_size'] || 9 > $valid_input['text_size'] ) {
|
| 575 |
-
$valid_input['text_size'] = 14;
|
| 576 |
-
add_settings_error( $this->option_name, 'invalid_text_size', __( 'The text size you entered is invalid, please stay between 9px and 25px', 'printfriendly' ) );
|
| 577 |
-
}
|
| 578 |
-
|
| 579 |
-
if ( ! isset( $input['text_color'] ) ) {
|
| 580 |
-
$valid_input['text_color'] = $this->options['text_color'];
|
| 581 |
-
} elseif ( ! preg_match( '/^#[a-f0-9]{3,6}$/i', $input['text_color'] ) ) {
|
| 582 |
-
// Revert to previous setting and throw error.
|
| 583 |
-
$valid_input['text_color'] = $this->options['text_color'];
|
| 584 |
-
add_settings_error( $this->option_name, 'invalid_color', __( 'The color you entered is not valid, it must be a valid hexadecimal RGB font color.', 'printfriendly' ) );
|
| 585 |
-
}
|
| 586 |
-
|
| 587 |
-
/* Section 2 options */
|
| 588 |
-
if ( ! isset( $input['enable_css'] ) || 'off' !== $input['enable_css'] ) {
|
| 589 |
-
$valid_input['enable_css'] = 'on';
|
| 590 |
-
}
|
| 591 |
-
|
| 592 |
-
if ( ! isset( $input['content_position'] ) || ! in_array( $input['content_position'], array('none', 'left', 'center', 'right'), true ) ) {
|
| 593 |
-
$valid_input['content_position'] = 'left';
|
| 594 |
-
}
|
| 595 |
-
|
| 596 |
-
if ( ! isset( $input['content_placement'] ) || ! in_array( $input['content_placement'], array('before', 'after'), true ) ) {
|
| 597 |
-
$valid_input['content_placement'] = 'after';
|
| 598 |
-
}
|
| 599 |
-
|
| 600 |
-
foreach ( array('margin_top', 'margin_right', 'margin_bottom', 'margin_left') as $opt ) {
|
| 601 |
-
// if margin is not defined, don't throw a PHP notice
|
| 602 |
-
if ( isset( $input[ $opt ] ) ) {
|
| 603 |
-
$valid_input[ $opt ] = (int) $input[ $opt ];
|
| 604 |
-
}
|
| 605 |
-
}
|
| 606 |
-
|
| 607 |
-
unset( $opt );
|
| 608 |
-
|
| 609 |
-
/* Section 3 options */
|
| 610 |
-
foreach ( array('show_on_posts', 'show_on_pages', 'show_on_homepage', 'show_on_categories', 'show_on_taxonomies') as $opt ) {
|
| 611 |
-
if ( ! isset( $input[ $opt ] ) || 'on' !== $input[ $opt ] ) {
|
| 612 |
-
unset( $valid_input[ $opt ] );
|
| 613 |
-
}
|
| 614 |
-
}
|
| 615 |
-
unset( $opt );
|
| 616 |
-
|
| 617 |
-
// Just in case
|
| 618 |
-
if ( isset( $input['show_on_template'] ) ) {
|
| 619 |
-
unset( $valid_input['show_on_template'] );
|
| 620 |
-
}
|
| 621 |
-
|
| 622 |
-
if ( isset( $input['category_ids'] ) ) {
|
| 623 |
-
unset( $valid_input['category_ids'] );
|
| 624 |
-
}
|
| 625 |
-
|
| 626 |
-
/* Section 4 options */
|
| 627 |
-
if ( ! isset( $input['logo'] ) || ! in_array( $input['logo'], array('favicon', 'upload-an-image'), true ) ) {
|
| 628 |
-
$valid_input['logo'] = 'favicon';
|
| 629 |
-
}
|
| 630 |
-
|
| 631 |
-
// @todo custom logo url validation
|
| 632 |
-
if ( ! isset( $input['image_url'] ) || empty( $input['image_url'] ) ) {
|
| 633 |
-
$valid_input['image_url'] = '';
|
| 634 |
-
}
|
| 635 |
-
|
| 636 |
-
// @todo validate optional tagline text
|
| 637 |
-
if ( ! isset( $input['tagline'] ) ) {
|
| 638 |
-
$valid_input['tagline'] = '';
|
| 639 |
-
}
|
| 640 |
-
|
| 641 |
-
// Custom logo selected, but no valid url given, reset logo to default
|
| 642 |
-
if ( 'upload-an-image' === $valid_input['logo'] && '' === $valid_input['image_url'] ) {
|
| 643 |
-
$valid_input['logo'] = 'favicon';
|
| 644 |
-
add_settings_error( $this->option_name, 'invalid_custom_logo', __( 'No valid custom logo url received, please enter a valid url to use a custom logo.', 'printfriendly' ) );
|
| 645 |
-
}
|
| 646 |
-
|
| 647 |
-
if ( ! isset( $input['image-style'] ) || ! in_array( $input['image-style'], array('right', 'left', 'none', 'block'), true ) ) {
|
| 648 |
-
$valid_input['image-style'] = 'block';
|
| 649 |
-
}
|
| 650 |
-
|
| 651 |
-
foreach ( array('click_to_delete', 'email', 'pdf', 'print') as $opt ) {
|
| 652 |
-
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
|
| 653 |
-
if ( ! isset( $input[ $opt ] ) || ! in_array( $input[ $opt ], array('0', '1') ) ) {
|
| 654 |
-
$valid_input[ $opt ] = '0';
|
| 655 |
-
}
|
| 656 |
-
}
|
| 657 |
-
unset( $opt );
|
| 658 |
-
|
| 659 |
-
if ( ! isset( $input['images-size'] ) || ! in_array( $input['images-size'], array('full-size', 'remove-images', 'large', 'medium', 'small'), true ) ) {
|
| 660 |
-
$valid_input['images-size'] = 'full-size';
|
| 661 |
-
}
|
| 662 |
-
|
| 663 |
-
if ( $this->is_pro( 'custom-css' ) ) {
|
| 664 |
-
// a file will be generated even if nothing is provided in the css box.
|
| 665 |
-
$css = $input['custom_css'];
|
| 666 |
-
|
| 667 |
-
// remove the <style> </style> tags.
|
| 668 |
-
$css = str_replace( array( '<style>', '</style>' ), '', $css );
|
| 669 |
-
$valid_input['custom_css'] = sanitize_textarea_field( $css );
|
| 670 |
-
$file = $this->maybe_generate_custom_css_file( $valid_input['custom_css'] );
|
| 671 |
-
if ( ! $file ) {
|
| 672 |
-
$file = isset( $this->options['custom_css_url_pro'] ) ? $this->options['custom_css_url_pro'] : '';
|
| 673 |
-
}
|
| 674 |
-
$valid_input['custom_css_url_pro'] = $file;
|
| 675 |
-
|
| 676 |
-
// if no file can be generated
|
| 677 |
-
// check if this version is upgraded from the version that was using url instead of textbox
|
| 678 |
-
// and reuse it
|
| 679 |
-
if ( ! $file && isset( $this->options['custom_css_url'] ) ) {
|
| 680 |
-
$valid_input['custom_css_url'] = $this->options['custom_css_url'];
|
| 681 |
-
}
|
| 682 |
-
}
|
| 683 |
-
|
| 684 |
-
/* Section 5 options */
|
| 685 |
-
if ( ! isset( $input['password_protected'] ) || ! in_array( $input['password_protected'], array('no', 'yes'), true ) ) {
|
| 686 |
-
$valid_input['password_protected'] = 'no';
|
| 687 |
-
}
|
| 688 |
-
if ( ! isset( $input['show_hidden_content'] ) || ! in_array( $input['show_hidden_content'], array('no', 'yes'), true ) ) {
|
| 689 |
-
$valid_input['show_hidden_content'] = 'no';
|
| 690 |
-
}
|
| 691 |
-
|
| 692 |
-
/*Analytics Options */
|
| 693 |
-
if ( ! isset( $input['enable_google_analytics'] ) || ! in_array( $input['enable_google_analytics'], array('no', 'yes'), true ) ) {
|
| 694 |
-
$valid_input['enable_google_analytics'] = 'no';
|
| 695 |
-
}
|
| 696 |
-
|
| 697 |
-
if ( ! isset( $input['pf_algo'] ) || ! in_array( $input['pf_algo'], array('wp', 'pf', 'css'), true ) ) {
|
| 698 |
-
$valid_input['pf_algo'] = 'wp';
|
| 699 |
-
}
|
| 700 |
-
|
| 701 |
-
if ( $valid_input['pf_algo'] === 'css' && empty( $valid_input['pf_algo_css_content'] ) && ! empty( $valid_input['css-content'] ) ) {
|
| 702 |
-
$valid_input['pf_algo_css_content'] = 'original';
|
| 703 |
-
}
|
| 704 |
-
|
| 705 |
-
/* Database version */
|
| 706 |
-
$valid_input['db_version'] = $this->db_version;
|
| 707 |
-
|
| 708 |
-
// set the current tab from where the settings were saved from
|
| 709 |
-
if ( isset( $_POST['tab'] ) ) {
|
| 710 |
-
set_transient( 'pf-tab', $_POST['tab'], 5 );
|
| 711 |
-
}
|
| 712 |
-
|
| 713 |
-
// save the categories as comma-separated
|
| 714 |
-
if ( isset( $valid_input['show_on_cat'] ) && ! empty( $valid_input['show_on_cat'] ) ) {
|
| 715 |
-
$valid_input['show_on_cat'] = implode( ',', $valid_input['show_on_cat'] );
|
| 716 |
-
}
|
| 717 |
-
|
| 718 |
-
return $valid_input;
|
| 719 |
-
}
|
| 720 |
-
|
| 721 |
-
/**
|
| 722 |
-
* Register the config page for all users that have the manage_options capability
|
| 723 |
-
*
|
| 724 |
-
* @since 3.0
|
| 725 |
-
*/
|
| 726 |
-
function add_config_page() {
|
| 727 |
-
$this->settings_page = add_options_page( __( 'PrintFriendly Options', 'printfriendly' ), __( 'Print Friendly & PDF', 'printfriendly' ), 'manage_options', $this->hook, array(&$this, 'config_page') );
|
| 728 |
-
|
| 729 |
-
// register callback gets call prior your own page gets rendered
|
| 730 |
-
add_action( 'load-' . $this->settings_page, array(&$this, 'on_load_printfriendly') );
|
| 731 |
-
}
|
| 732 |
-
|
| 733 |
-
/**
|
| 734 |
-
* Enqueue the scripts for the admin settings page
|
| 735 |
-
*
|
| 736 |
-
* @since 3.0
|
| 737 |
-
* @param string $screen_id check whether the current page is the PrintFriendly settings page.
|
| 738 |
-
*/
|
| 739 |
-
function admin_enqueue_scripts( $screen_id ) {
|
| 740 |
-
if ( $this->settings_page === $screen_id ) {
|
| 741 |
-
if ( ! did_action( 'wp_enqueue_media' ) ) {
|
| 742 |
-
wp_enqueue_media();
|
| 743 |
-
}
|
| 744 |
-
|
| 745 |
-
if ( ! wp_script_is( 'clipboard' ) ) {
|
| 746 |
-
wp_enqueue_script( 'clipboard', plugins_url( 'assets/js/lib/clipboard.min.js', __FILE__ ) );
|
| 747 |
-
}
|
| 748 |
-
|
| 749 |
-
if ( ! wp_script_is( 'select2' ) ) {
|
| 750 |
-
wp_enqueue_script( 'select2', plugins_url( 'assets/js/lib/select2.min.js', __FILE__ ) );
|
| 751 |
-
}
|
| 752 |
-
|
| 753 |
-
wp_register_script( 'pf-admin', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-accordion', 'media-upload', 'wp-color-picker', 'clipboard', 'select2' ), $this->plugin_version );
|
| 754 |
-
wp_localize_script(
|
| 755 |
-
'pf-admin', 'pf_config', array(
|
| 756 |
-
'i10n' => array(
|
| 757 |
-
'upload_window_title' => __( 'Custom Image', 'printfriendly' ),
|
| 758 |
-
'upload_window_button_title' => __( 'Use Image', 'printfriendly' ),
|
| 759 |
-
'invalid_image_url' => __( 'Invalid Image URL', 'printfriendly' ),
|
| 760 |
-
),
|
| 761 |
-
)
|
| 762 |
-
);
|
| 763 |
-
|
| 764 |
-
wp_register_script( 'pf-admin-pro', plugins_url( 'assets/js/admin_pro.js', __FILE__ ), array( 'pf-admin' ), $this->plugin_version );
|
| 765 |
-
|
| 766 |
-
wp_localize_script(
|
| 767 |
-
'pf-admin-pro', 'pf_config', array(
|
| 768 |
-
'nonce' => wp_create_nonce( $this->hook . $this->plugin_version ),
|
| 769 |
-
'action' => $this->hook,
|
| 770 |
-
'i10n' => array(
|
| 771 |
-
'activation' => __( 'Activation', 'printfriendly' ),
|
| 772 |
-
'check_status' => __( 'Checking status', 'printfriendly' ),
|
| 773 |
-
'activate' => __( 'Activate', 'printfriendly' ),
|
| 774 |
-
'active_trial' => __( 'Active Trial', 'printfriendly' ),
|
| 775 |
-
'active' => __( 'Active', 'printfriendly' ),
|
| 776 |
-
'expired' => __( 'Expired', 'printfriendly' ),
|
| 777 |
-
'connection' => __( 'Please check Internet connection.', 'printfriendly' ),
|
| 778 |
-
),
|
| 779 |
-
)
|
| 780 |
-
);
|
| 781 |
-
wp_enqueue_script( 'pf-admin-pro' );
|
| 782 |
-
|
| 783 |
-
wp_enqueue_style( 'pf-bulma', plugins_url( 'assets/css/lib/bulma.prefixed.min.css', __FILE__ ), array( 'wp-color-picker' ), $this->plugin_version );
|
| 784 |
-
wp_enqueue_style( 'pf-select2', plugins_url( 'assets/css/lib/select2.min.css', __FILE__ ), array(), $this->plugin_version );
|
| 785 |
-
wp_enqueue_style( 'pf-admin', plugins_url( 'assets/css/admin.css', __FILE__ ), array( 'pf-select2', 'pf-bulma' ), $this->plugin_version );
|
| 786 |
-
}
|
| 787 |
-
}
|
| 788 |
-
|
| 789 |
-
/**
|
| 790 |
-
* Register the settings link for the plugins page
|
| 791 |
-
*
|
| 792 |
-
* @since 3.0
|
| 793 |
-
* @param array $links the links for the plugins.
|
| 794 |
-
* @param string $file filename to check against plugins filename.
|
| 795 |
-
* @return array $links the links with the settings link added to it if appropriate.
|
| 796 |
-
*/
|
| 797 |
-
function filter_plugin_actions( $links, $file ) {
|
| 798 |
-
// Static so we don't call plugin_basename on every plugin row.
|
| 799 |
-
static $this_plugin;
|
| 800 |
-
if ( ! $this_plugin ) {
|
| 801 |
-
$this_plugin = plugin_basename( __FILE__ );
|
| 802 |
-
}
|
| 803 |
-
|
| 804 |
-
if ( $file === $this_plugin ) {
|
| 805 |
-
$settings_link = '<a href="options-general.php?page=' . $this->hook . '">' . __( 'Settings', 'printfriendly' ) . '</a>';
|
| 806 |
-
array_unshift( $links, $settings_link ); // before other links
|
| 807 |
-
}
|
| 808 |
-
|
| 809 |
-
return $links;
|
| 810 |
-
}
|
| 811 |
-
|
| 812 |
-
/**
|
| 813 |
-
* Register the additional link for the plugins page in the plugin description column.
|
| 814 |
-
*
|
| 815 |
-
* @since ?
|
| 816 |
-
* @param array $links the links for the plugins.
|
| 817 |
-
* @param string $file filename to check against plugins filename.
|
| 818 |
-
* @return array $links the links with the links added to it if appropriate.
|
| 819 |
-
*/
|
| 820 |
-
function additional_links( $links, $file ) {
|
| 821 |
-
// Static so we don't call plugin_basename on every plugin row.
|
| 822 |
-
static $this_plugin;
|
| 823 |
-
if ( ! $this_plugin ) {
|
| 824 |
-
$this_plugin = plugin_basename( __FILE__ );
|
| 825 |
-
}
|
| 826 |
-
|
| 827 |
-
if ( $file === $this_plugin ) {
|
| 828 |
-
$new_links = array( '<a href="https://printfriendly.freshdesk.com/support/solutions/folders/69000070847" target="_new">' . __( 'Documentation', 'printfriendly' ) . '</a>' );
|
| 829 |
-
$links = array_merge( $links, $new_links );
|
| 830 |
-
}
|
| 831 |
-
return $links;
|
| 832 |
-
}
|
| 833 |
-
|
| 834 |
-
/**
|
| 835 |
-
* Set default values for the plugin. If old, as in pre 1.0, settings are there, use them and then delete them.
|
| 836 |
-
*
|
| 837 |
-
* @since 3.0
|
| 838 |
-
*/
|
| 839 |
-
function set_defaults() {
|
| 840 |
-
// Set some defaults
|
| 841 |
-
$this->options = array(
|
| 842 |
-
'button_type' => 'buttons/printfriendly-pdf-button.png',
|
| 843 |
-
'content_position' => 'left',
|
| 844 |
-
'content_placement' => 'after',
|
| 845 |
-
'custom_button_icon' => 'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png',
|
| 846 |
-
'custom_button_text' => 'custom-text',
|
| 847 |
-
'custom_image' => '',
|
| 848 |
-
'custom_text' => 'PrintFriendly',
|
| 849 |
-
'enable_css' => 'on',
|
| 850 |
-
'margin_top' => '12',
|
| 851 |
-
'margin_right' => '12',
|
| 852 |
-
'margin_bottom' => '12',
|
| 853 |
-
'margin_left' => '12',
|
| 854 |
-
'show_on_posts' => 'on',
|
| 855 |
-
'show_on_pages' => 'on',
|
| 856 |
-
'text_color' => '#3AAA11',
|
| 857 |
-
'text_size' => 14,
|
| 858 |
-
'logo' => 'favicon',
|
| 859 |
-
'image_url' => '',
|
| 860 |
-
'tagline' => '',
|
| 861 |
-
'click_to_delete' => '0', // 0 - allow, 1 - do not allow
|
| 862 |
-
'hide-images' => '0', // 0 - show images, 1 - hide images
|
| 863 |
-
'image-style' => 'block', // 'right', 'left', 'none', 'block'
|
| 864 |
-
'email' => '0', // 0 - allow, 1 - do not allow
|
| 865 |
-
'pdf' => '0', // 0 - allow, 1 - do not allow
|
| 866 |
-
'print' => '0', // 0 - allow, 1 - do not allow
|
| 867 |
-
'password_protected' => 'no',
|
| 868 |
-
'enable_google_analytics' => 'no',
|
| 869 |
-
'enable_error_reporting' => 'yes',
|
| 870 |
-
'pf_algo' => 'wp',
|
| 871 |
-
'images-size' => 'full-size',
|
| 872 |
-
'show_hidden_content' => 'no',
|
| 873 |
-
);
|
| 874 |
-
|
| 875 |
-
// Check whether the old badly named singular options are there, if so, use the data and delete them.
|
| 876 |
-
foreach ( array_keys( $this->options ) as $opt ) {
|
| 877 |
-
$old_opt = get_option( 'pf_' . $opt );
|
| 878 |
-
if ( $old_opt !== false ) {
|
| 879 |
-
$this->options[ $opt ] = $old_opt;
|
| 880 |
-
delete_option( 'pf_' . $opt );
|
| 881 |
-
}
|
| 882 |
-
}
|
| 883 |
-
|
| 884 |
-
// This should always be set to the latest immediately when defaults are pushed in.
|
| 885 |
-
$this->options['db_version'] = $this->db_version;
|
| 886 |
-
|
| 887 |
-
update_option( $this->option_name, $this->options );
|
| 888 |
-
}
|
| 889 |
-
|
| 890 |
-
/**
|
| 891 |
-
* Upgrades the stored options, used to add new defaults if needed etc.
|
| 892 |
-
*
|
| 893 |
-
* @since 3.0
|
| 894 |
-
*/
|
| 895 |
-
function upgrade() {
|
| 896 |
-
// update options to version 2
|
| 897 |
-
if ( $this->options['db_version'] < 2 ) {
|
| 898 |
-
|
| 899 |
-
$additional_options = array(
|
| 900 |
-
'enable_css' => 'on',
|
| 901 |
-
'logo' => 'favicon',
|
| 902 |
-
'image_url' => '',
|
| 903 |
-
'tagline' => '',
|
| 904 |
-
'click_to_delete' => '0',
|
| 905 |
-
'password_protected' => 'no',
|
| 906 |
-
);
|
| 907 |
-
|
| 908 |
-
// correcting badly named option
|
| 909 |
-
if ( isset( $this->options['disable_css'] ) ) {
|
| 910 |
-
$additional_options['enable_css'] = $this->options['disable_css'];
|
| 911 |
-
unset( $this->options['disable_css'] );
|
| 912 |
-
}
|
| 913 |
-
|
| 914 |
-
// check whether image we do not list any more was used
|
| 915 |
-
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'), true ) ) {
|
| 916 |
-
// previous version had a bug with button name
|
| 917 |
-
if ( in_array( $this->options['button_type'], array('pf_button_sq_qry_m.png', 'pf_button_sq_qry_l.png'), true ) ) {
|
| 918 |
-
$this->options['button_type'] = str_replace( 'qry', 'gry', $this->options['button_type'] );
|
| 919 |
-
}
|
| 920 |
-
|
| 921 |
-
$image_address = 'https://cdn.printfriendly.com/' . $this->options['button_type'];
|
| 922 |
-
$this->options['button_type'] = 'custom-image';
|
| 923 |
-
$this->options['custom_text'] = '';
|
| 924 |
-
$this->options['custom_image'] = $image_address;
|
| 925 |
-
}
|
| 926 |
-
|
| 927 |
-
$this->options = array_merge( $this->options, $additional_options );
|
| 928 |
-
}
|
| 929 |
-
|
| 930 |
-
// update options to version 3
|
| 931 |
-
if ( $this->options['db_version'] < 3 ) {
|
| 932 |
-
|
| 933 |
-
$old_show_on = $this->options['show_list'];
|
| 934 |
-
// 'manual' setting
|
| 935 |
-
$additional_options = array('custom_css_url' => '');
|
| 936 |
-
|
| 937 |
-
if ( $old_show_on === 'all' ) {
|
| 938 |
-
$additional_options = array(
|
| 939 |
-
'show_on_pages' => 'on',
|
| 940 |
-
'show_on_posts' => 'on',
|
| 941 |
-
'show_on_homepage' => 'on',
|
| 942 |
-
'show_on_categories' => 'on',
|
| 943 |
-
'show_on_taxonomies' => 'on',
|
| 944 |
-
);
|
| 945 |
-
}
|
| 946 |
-
|
| 947 |
-
if ( $old_show_on === 'single' ) {
|
| 948 |
-
$additional_options = array(
|
| 949 |
-
'show_on_pages' => 'on',
|
| 950 |
-
'show_on_posts' => 'on',
|
| 951 |
-
);
|
| 952 |
-
}
|
| 953 |
-
|
| 954 |
-
if ( $old_show_on === 'posts' ) {
|
| 955 |
-
$additional_options = array(
|
| 956 |
-
'show_on_posts' => 'on',
|
| 957 |
-
);
|
| 958 |
-
}
|
| 959 |
-
|
| 960 |
-
unset( $this->options['show_list'] );
|
| 961 |
-
|
| 962 |
-
$this->options = array_merge( $this->options, $additional_options );
|
| 963 |
-
}
|
| 964 |
-
|
| 965 |
-
// update options to version 4
|
| 966 |
-
if ( $this->options['db_version'] < 4 ) {
|
| 967 |
-
|
| 968 |
-
$additional_options = array(
|
| 969 |
-
'email' => '0',
|
| 970 |
-
'pdf' => '0',
|
| 971 |
-
'print' => '0',
|
| 972 |
-
);
|
| 973 |
-
|
| 974 |
-
$this->options = array_merge( $this->options, $additional_options );
|
| 975 |
-
}
|
| 976 |
-
|
| 977 |
-
// update options to version 6
|
| 978 |
-
// Replacement for db version 5 - should also be run for those already upgraded
|
| 979 |
-
if ( $this->options['db_version'] < 6 ) {
|
| 980 |
-
unset( $this->options['category_ids'] );
|
| 981 |
-
}
|
| 982 |
-
|
| 983 |
-
if ( $this->options['db_version'] < 7 ) {
|
| 984 |
-
$additional_options = array(
|
| 985 |
-
'hide-images' => '0',
|
| 986 |
-
'image-style' => 'right',
|
| 987 |
-
);
|
| 988 |
-
|
| 989 |
-
$this->options = array_merge( $this->options, $additional_options );
|
| 990 |
-
}
|
| 991 |
-
|
| 992 |
-
if ( $this->options['db_version'] < 8 ) {
|
| 993 |
-
$this->options['enable_google_analytics'] = 'no';
|
| 994 |
-
}
|
| 995 |
-
|
| 996 |
-
if ( $this->options['db_version'] < 9 ) {
|
| 997 |
-
$this->options['pf_algo'] = 'wp';
|
| 998 |
-
}
|
| 999 |
-
|
| 1000 |
-
if ( $this->options['db_version'] < 10 ) {
|
| 1001 |
-
$this->options['enable_error_reporting'] = 'yes';
|
| 1002 |
-
}
|
| 1003 |
-
|
| 1004 |
-
if ( $this->options['db_version'] < 11 ) {
|
| 1005 |
-
if ( ! isset( $this->options['custom_css_url'] ) ) {
|
| 1006 |
-
$this->options['custom_css_url'] = '';
|
| 1007 |
-
}
|
| 1008 |
-
}
|
| 1009 |
-
|
| 1010 |
-
if ( $this->options['db_version'] < 12 ) {
|
| 1011 |
-
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
| 1012 |
-
$this->options['images-size'] = $this->options['hide-images'] == '1' ? 'remove-images' : 'full-size';
|
| 1013 |
-
}
|
| 1014 |
-
|
| 1015 |
-
if ( $this->options['db_version'] < 13 ) {
|
| 1016 |
-
switch ( $this->options['button_type'] ) {
|
| 1017 |
-
case 'pf-button.gif':
|
| 1018 |
-
$this->options['button_type'] = 'buttons/printfriendly-button.png';
|
| 1019 |
-
break;
|
| 1020 |
-
case 'pf-button-both.gif':
|
| 1021 |
-
$this->options['button_type'] = 'buttons/printfriendly-pdf-button.png';
|
| 1022 |
-
break;
|
| 1023 |
-
case 'pf-button-big.gif':
|
| 1024 |
-
$this->options['button_type'] = 'buttons/printfriendly-button-lg.png';
|
| 1025 |
-
break;
|
| 1026 |
-
case 'pf-button-print-pdf-mail.png':
|
| 1027 |
-
$this->options['button_type'] = 'buttons/printfriendly-pdf-email-button-notext.png';
|
| 1028 |
-
break;
|
| 1029 |
-
case 'button-print-grnw20.png':
|
| 1030 |
-
$this->options['button_type'] = 'buttons/print-button.png';
|
| 1031 |
-
break;
|
| 1032 |
-
case 'button-print-blu20.png':
|
| 1033 |
-
$this->options['button_type'] = 'buttons/print-button-nobg.png';
|
| 1034 |
-
break;
|
| 1035 |
-
case 'button-print-gry20.png':
|
| 1036 |
-
$this->options['button_type'] = 'buttons/print-button-gray.png';
|
| 1037 |
-
break;
|
| 1038 |
-
case 'pf-icon-small.gif':
|
| 1039 |
-
case 'pf-icon.gif':
|
| 1040 |
-
$this->options['button_type'] = 'custom-button';
|
| 1041 |
-
$this->options['custom_button_icon'] = 'icons/printfriendly-icon-md.png';
|
| 1042 |
-
$this->options['custom_button_text'] = 'custom-text';
|
| 1043 |
-
$this->options['custom_image'] = 'icons/printfriendly-icon-md.png';
|
| 1044 |
-
break;
|
| 1045 |
-
case 'text-only':
|
| 1046 |
-
$this->options['button_type'] = 'custom-button';
|
| 1047 |
-
$this->options['custom_button_icon'] = 'no-image';
|
| 1048 |
-
$this->options['custom_button_text'] = 'custom-text';
|
| 1049 |
-
break;
|
| 1050 |
-
}
|
| 1051 |
-
}
|
| 1052 |
-
|
| 1053 |
-
if ( $this->options['db_version'] < 14 ) {
|
| 1054 |
-
if ( $this->options['button_type'] === 'pf-icon-both.gif' ) {
|
| 1055 |
-
$this->options['button_type'] = 'buttons/printfriendly-pdf-button-nobg.png';
|
| 1056 |
-
}
|
| 1057 |
-
}
|
| 1058 |
-
|
| 1059 |
-
if ( $this->options['db_version'] < 15 ) {
|
| 1060 |
-
if ( $this->options['button_type'] === 'custom-image' ) {
|
| 1061 |
-
$this->options['button_type'] = 'custom-button';
|
| 1062 |
-
|
| 1063 |
-
switch ( $this->options['custom_image'] ) {
|
| 1064 |
-
case 'icons/printfriendly-icon-sm.png':
|
| 1065 |
-
case 'icons/printfriendly-icon-md.png':
|
| 1066 |
-
case 'icons/printfriendly-icon-lg.png':
|
| 1067 |
-
$this->options['custom_button_icon'] = $this->options['custom_image'];
|
| 1068 |
-
break;
|
| 1069 |
-
case '':
|
| 1070 |
-
$this->options['custom_button_icon'] = 'no-image';
|
| 1071 |
-
break;
|
| 1072 |
-
default:
|
| 1073 |
-
$this->options['custom_button_icon'] = 'custom-image';
|
| 1074 |
-
}
|
| 1075 |
|
| 1076 |
-
|
| 1077 |
-
|
| 1078 |
-
|
| 1079 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1080 |
}
|
| 1081 |
-
|
| 1082 |
-
|
| 1083 |
-
|
| 1084 |
-
|
| 1085 |
-
|
| 1086 |
-
|
| 1087 |
-
|
| 1088 |
-
|
| 1089 |
-
|
| 1090 |
-
|
| 1091 |
-
|
| 1092 |
-
|
| 1093 |
-
|
| 1094 |
-
|
| 1095 |
-
|
| 1096 |
-
|
| 1097 |
-
|
| 1098 |
-
|
| 1099 |
-
|
| 1100 |
-
|
| 1101 |
-
|
| 1102 |
-
|
| 1103 |
-
|
| 1104 |
-
|
| 1105 |
-
|
| 1106 |
-
|
| 1107 |
-
|
| 1108 |
-
|
| 1109 |
-
|
| 1110 |
-
|
| 1111 |
-
|
| 1112 |
-
|
| 1113 |
-
|
| 1114 |
-
|
| 1115 |
-
|
| 1116 |
-
|
| 1117 |
-
|
| 1118 |
-
|
| 1119 |
-
|
| 1120 |
-
|
| 1121 |
-
|
| 1122 |
-
|
| 1123 |
-
|
| 1124 |
-
|
| 1125 |
-
|
| 1126 |
-
|
| 1127 |
-
|
| 1128 |
-
|
| 1129 |
-
|
| 1130 |
-
|
| 1131 |
-
|
| 1132 |
-
|
| 1133 |
-
|
| 1134 |
-
|
| 1135 |
-
|
| 1136 |
-
|
| 1137 |
-
|
| 1138 |
-
|
| 1139 |
-
|
| 1140 |
-
|
| 1141 |
-
|
| 1142 |
-
|
| 1143 |
-
|
| 1144 |
-
|
| 1145 |
-
|
| 1146 |
-
|
| 1147 |
-
|
| 1148 |
-
|
| 1149 |
-
|
| 1150 |
-
|
| 1151 |
-
|
| 1152 |
-
|
| 1153 |
-
|
| 1154 |
-
|
| 1155 |
-
|
| 1156 |
-
|
| 1157 |
-
|
| 1158 |
-
|
| 1159 |
-
|
| 1160 |
-
|
| 1161 |
-
|
| 1162 |
-
|
| 1163 |
-
|
| 1164 |
-
|
| 1165 |
-
|
| 1166 |
-
|
| 1167 |
-
|
| 1168 |
-
|
| 1169 |
-
|
| 1170 |
-
|
| 1171 |
-
|
| 1172 |
-
|
| 1173 |
-
|
| 1174 |
-
|
| 1175 |
-
|
| 1176 |
-
|
| 1177 |
-
|
| 1178 |
-
|
| 1179 |
-
|
| 1180 |
-
|
| 1181 |
-
|
| 1182 |
-
|
| 1183 |
-
|
| 1184 |
-
|
| 1185 |
-
|
| 1186 |
-
|
| 1187 |
-
|
| 1188 |
-
|
| 1189 |
-
|
| 1190 |
-
|
| 1191 |
-
|
| 1192 |
-
|
| 1193 |
-
|
| 1194 |
-
|
| 1195 |
-
|
| 1196 |
-
|
| 1197 |
-
|
| 1198 |
-
|
| 1199 |
-
|
| 1200 |
-
|
| 1201 |
-
|
| 1202 |
-
|
| 1203 |
-
|
| 1204 |
-
|
| 1205 |
-
|
| 1206 |
-
|
| 1207 |
-
|
| 1208 |
-
|
| 1209 |
-
|
| 1210 |
-
|
| 1211 |
-
|
| 1212 |
-
|
| 1213 |
-
|
| 1214 |
-
|
| 1215 |
-
|
| 1216 |
-
|
| 1217 |
-
|
| 1218 |
-
|
| 1219 |
-
|
| 1220 |
-
|
| 1221 |
-
|
| 1222 |
-
|
| 1223 |
-
|
| 1224 |
-
|
| 1225 |
-
|
| 1226 |
-
|
| 1227 |
-
|
| 1228 |
-
|
| 1229 |
-
|
| 1230 |
-
|
| 1231 |
-
|
| 1232 |
-
|
| 1233 |
-
|
| 1234 |
-
|
| 1235 |
-
|
| 1236 |
-
|
| 1237 |
-
|
| 1238 |
-
|
| 1239 |
-
|
| 1240 |
-
|
| 1241 |
-
|
| 1242 |
-
|
| 1243 |
-
|
| 1244 |
-
|
| 1245 |
-
|
| 1246 |
-
|
| 1247 |
-
|
| 1248 |
-
|
| 1249 |
-
|
| 1250 |
-
|
| 1251 |
-
|
| 1252 |
-
|
| 1253 |
-
|
| 1254 |
-
|
| 1255 |
-
|
| 1256 |
-
|
| 1257 |
-
|
| 1258 |
-
|
| 1259 |
-
|
| 1260 |
-
|
| 1261 |
-
|
| 1262 |
-
|
| 1263 |
-
|
| 1264 |
-
|
| 1265 |
-
|
| 1266 |
-
|
| 1267 |
-
|
| 1268 |
-
|
| 1269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1270 |
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
|
| 1271 |
-
|
| 1272 |
-
|
| 1273 |
-
|
| 1274 |
-
|
| 1275 |
-
|
| 1276 |
-
|
| 1277 |
-
|
| 1278 |
-
|
| 1279 |
-
|
| 1280 |
-
|
| 1281 |
-
|
| 1282 |
-
|
| 1283 |
-
|
| 1284 |
-
|
| 1285 |
-
|
| 1286 |
-
|
| 1287 |
-
|
| 1288 |
-
|
| 1289 |
-
|
| 1290 |
-
|
| 1291 |
-
|
| 1292 |
-
|
| 1293 |
-
|
| 1294 |
-
|
| 1295 |
-
|
| 1296 |
-
|
| 1297 |
-
|
| 1298 |
-
|
| 1299 |
-
|
| 1300 |
-
|
| 1301 |
-
|
| 1302 |
-
|
| 1303 |
-
|
| 1304 |
-
|
| 1305 |
-
|
| 1306 |
-
|
| 1307 |
-
|
| 1308 |
-
|
| 1309 |
-
|
| 1310 |
-
|
| 1311 |
-
|
| 1312 |
-
|
| 1313 |
-
|
| 1314 |
-
|
| 1315 |
-
|
| 1316 |
-
|
| 1317 |
-
|
| 1318 |
-
|
| 1319 |
-
|
| 1320 |
-
|
| 1321 |
-
|
| 1322 |
-
|
| 1323 |
-
|
| 1324 |
-
|
| 1325 |
-
|
| 1326 |
-
|
| 1327 |
-
|
| 1328 |
-
|
| 1329 |
-
|
| 1330 |
-
|
| 1331 |
-
|
| 1332 |
-
|
| 1333 |
-
|
| 1334 |
-
|
| 1335 |
-
|
| 1336 |
-
|
| 1337 |
-
|
| 1338 |
-
|
| 1339 |
-
|
| 1340 |
-
|
| 1341 |
-
|
| 1342 |
-
|
| 1343 |
-
|
| 1344 |
-
|
| 1345 |
-
|
| 1346 |
-
|
| 1347 |
-
|
| 1348 |
-
|
| 1349 |
-
|
| 1350 |
-
|
| 1351 |
-
|
| 1352 |
-
|
| 1353 |
-
|
| 1354 |
-
|
| 1355 |
-
|
| 1356 |
-
|
| 1357 |
-
|
| 1358 |
-
|
| 1359 |
-
|
| 1360 |
-
|
| 1361 |
-
|
| 1362 |
-
|
| 1363 |
-
|
| 1364 |
-
|
| 1365 |
-
|
| 1366 |
-
|
| 1367 |
-
|
| 1368 |
-
|
| 1369 |
-
|
| 1370 |
-
|
| 1371 |
-
|
| 1372 |
-
|
| 1373 |
-
|
| 1374 |
-
|
| 1375 |
-
|
| 1376 |
-
|
| 1377 |
-
|
| 1378 |
-
|
| 1379 |
-
|
| 1380 |
-
|
| 1381 |
-
|
| 1382 |
-
|
| 1383 |
-
|
| 1384 |
-
|
| 1385 |
-
|
| 1386 |
-
|
| 1387 |
-
|
| 1388 |
-
|
| 1389 |
-
|
| 1390 |
-
|
| 1391 |
-
|
| 1392 |
-
|
| 1393 |
-
|
| 1394 |
-
|
| 1395 |
-
|
| 1396 |
-
|
| 1397 |
-
|
| 1398 |
-
|
| 1399 |
-
|
| 1400 |
-
|
| 1401 |
-
|
| 1402 |
-
|
| 1403 |
-
|
| 1404 |
-
|
| 1405 |
-
|
| 1406 |
-
|
| 1407 |
-
|
| 1408 |
-
|
| 1409 |
-
|
| 1410 |
-
|
| 1411 |
-
|
| 1412 |
-
|
| 1413 |
-
|
| 1414 |
-
|
| 1415 |
-
|
| 1416 |
-
|
| 1417 |
-
|
| 1418 |
-
|
| 1419 |
-
|
| 1420 |
-
|
| 1421 |
-
|
| 1422 |
-
|
| 1423 |
-
|
| 1424 |
-
|
| 1425 |
-
|
| 1426 |
-
|
| 1427 |
-
|
| 1428 |
-
|
| 1429 |
-
|
| 1430 |
-
|
| 1431 |
-
|
| 1432 |
-
|
| 1433 |
-
|
| 1434 |
-
|
| 1435 |
-
|
| 1436 |
-
|
| 1437 |
-
|
| 1438 |
-
|
| 1439 |
-
|
| 1440 |
-
|
| 1441 |
-
|
| 1442 |
-
|
| 1443 |
-
|
| 1444 |
-
|
| 1445 |
-
|
| 1446 |
-
|
| 1447 |
-
|
| 1448 |
-
|
| 1449 |
-
|
| 1450 |
-
|
| 1451 |
-
|
| 1452 |
-
|
| 1453 |
-
|
| 1454 |
-
|
| 1455 |
-
|
| 1456 |
-
|
| 1457 |
-
|
| 1458 |
-
|
| 1459 |
-
|
| 1460 |
-
|
| 1461 |
-
|
| 1462 |
-
|
| 1463 |
-
|
| 1464 |
-
|
| 1465 |
-
|
| 1466 |
-
|
| 1467 |
-
|
| 1468 |
-
|
| 1469 |
-
|
| 1470 |
-
|
| 1471 |
-
|
| 1472 |
-
|
| 1473 |
-
|
| 1474 |
-
|
| 1475 |
-
|
| 1476 |
-
|
| 1477 |
-
*
|
| 1478 |
-
* @since 4.0.1
|
| 1479 |
-
*/
|
| 1480 |
-
function is_tab( $tab_id ) {
|
| 1481 |
-
$tab = get_transient( 'pf-tab' );
|
| 1482 |
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
| 1483 |
-
|
| 1484 |
-
|
| 1485 |
-
|
| 1486 |
-
|
| 1487 |
-
$printfriendly = new PrintFriendly_WordPress();
|
| 1488 |
}
|
| 1489 |
|
| 1490 |
// Add shortcode for printfriendly button
|
| 1491 |
-
add_shortcode(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1492 |
|
| 1493 |
/**
|
| 1494 |
* Convenience function for use in templates.
|
| 1495 |
*
|
|
|
|
|
|
|
| 1496 |
* @since 3.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1497 |
* @return string returns a button to be printed.
|
| 1498 |
*/
|
| 1499 |
-
function
|
| 1500 |
-
|
| 1501 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1502 |
}
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
/*
|
| 4 |
+
Plugin Name: Print, PDF & Email by PrintFriendly
|
| 5 |
+
Plugin URI: http://www.printfriendly.com
|
| 6 |
+
Description: PrintFriendly & PDF button for your website. Optimizes your pages and brand for print, pdf, and email.
|
| 7 |
+
Name and URL are included to ensure repeat visitors and new visitors when printed versions are shared.
|
| 8 |
+
Version: 5.1
|
| 9 |
+
Author: Print, PDF, & Email by PrintFriendly
|
| 10 |
+
Author URI: http://www.printfriendly.com
|
| 11 |
+
Domain Path: /languages
|
| 12 |
+
Text Domain: printfriendly
|
| 13 |
*/
|
| 14 |
|
| 15 |
+
// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
|
| 16 |
+
// phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps
|
| 17 |
+
// phpcs:disable PSR2.Classes.PropertyDeclaration.VarUsed
|
| 18 |
+
// phpcs:disable PSR2.Classes.PropertyDeclaration.ScopeMissing
|
| 19 |
+
// phpcs:disable Squiz.Scope.MethodScope.Missing
|
| 20 |
+
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
|
| 21 |
+
|
| 22 |
/**
|
| 23 |
* PrintFriendly WordPress plugin. Allows easy embedding of printfriendly.com buttons.
|
| 24 |
*
|
| 26 |
* @author PrintFriendly <support@printfriendly.com>
|
| 27 |
* @copyright Copyright (C) 2012, PrintFriendly
|
| 28 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
if (! class_exists('PrintFriendly_WordPress')) {
|
| 31 |
+
/**
|
| 32 |
+
* Class containing all the plugins functionality.
|
| 33 |
+
*
|
| 34 |
+
* @package PrintFriendly_WordPress
|
| 35 |
+
*/
|
| 36 |
+
class PrintFriendly_WordPress
|
| 37 |
+
{
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Current plugin version.
|
| 41 |
+
*
|
| 42 |
+
* @var string
|
| 43 |
+
*/
|
| 44 |
+
var $plugin_version = '5.1';
|
| 45 |
+
/**
|
| 46 |
+
* The hook, used for text domain as well as hooks on pages and in get requests for admin.
|
| 47 |
+
*
|
| 48 |
+
* @var string
|
| 49 |
+
*/
|
| 50 |
+
var $hook = 'printfriendly';
|
| 51 |
+
/**
|
| 52 |
+
* The option name, used throughout to refer to the plugins option and option group.
|
| 53 |
+
*
|
| 54 |
+
* @var string
|
| 55 |
+
*/
|
| 56 |
+
var $option_name = 'printfriendly_option';
|
| 57 |
+
/**
|
| 58 |
+
* The plugins options, loaded on init containing all the plugins settings.
|
| 59 |
+
*
|
| 60 |
+
* @var array
|
| 61 |
+
*/
|
| 62 |
+
var $options = array();
|
| 63 |
+
/**
|
| 64 |
+
* Database version, used to allow for easy upgrades to / additions in plugin options between plugin versions.
|
| 65 |
+
*
|
| 66 |
+
* @var int
|
| 67 |
+
*/
|
| 68 |
+
var $db_version = 20;
|
| 69 |
+
/**
|
| 70 |
+
* Settings page, used within the plugin to reliably load the plugins admin JS and CSS files only on the admin page.
|
| 71 |
+
*
|
| 72 |
+
* @var string
|
| 73 |
+
*/
|
| 74 |
+
var $settings_page = '';
|
| 75 |
+
/**
|
| 76 |
+
* GetSentry error reporting client
|
| 77 |
+
*
|
| 78 |
+
* @var Raven_Client
|
| 79 |
+
*/
|
| 80 |
+
var $raven_client = null;
|
| 81 |
+
/**
|
| 82 |
+
* List of all buttons with their attributes.
|
| 83 |
+
*
|
| 84 |
+
* @var array
|
| 85 |
+
*/
|
| 86 |
+
private static $_buttons = array(
|
| 87 |
+
'buttons/printfriendly-pdf-email-button.png' => array( 'width' => 170, 'height' => 24 ),
|
| 88 |
+
'buttons/printfriendly-pdf-email-button-md.png' => array( 'width' => 194, 'height' => 30 ),
|
| 89 |
+
'buttons/printfriendly-pdf-email-button-notext.png' => array( 'width' => 110, 'height' => 30 ),
|
| 90 |
+
'buttons/printfriendly-pdf-button.png' => array( 'width' => 112, 'height' => 24 ),
|
| 91 |
+
'buttons/printfriendly-pdf-button-nobg.png' => array( 'width' => 112, 'height' => 24 ),
|
| 92 |
+
'buttons/printfriendly-pdf-button-nobg-md.png' => array( 'width' => 124, 'height' => 30 ),
|
| 93 |
+
'buttons/printfriendly-button.png' => array( 'width' => 112, 'height' => 24 ),
|
| 94 |
+
'buttons/printfriendly-button-nobg.png' => array( 'width' => 112, 'height' => 24 ),
|
| 95 |
+
'buttons/printfriendly-button-md.png' => array( 'width' => 124, 'height' => 30 ),
|
| 96 |
+
'buttons/printfriendly-button-lg.png' => array( 'width' => 154, 'height' => 28 ),
|
| 97 |
+
'buttons/print-button.png' => array( 'width' => 66, 'height' => 24 ),
|
| 98 |
+
'buttons/print-button-nobg.png' => array( 'width' => 66, 'height' => 24 ),
|
| 99 |
+
'buttons/print-button-gray.png' => array( 'width' => 66, 'height' => 24 ),
|
| 100 |
+
'icons/printfriendly-icon-sm.png' => array( 'width' => 17, 'height' => 17 ),
|
| 101 |
+
'icons/printfriendly-icon-md.png' => array( 'width' => 16, 'height' => 16 ),
|
| 102 |
+
'icons/printfriendly-icon-lg.png' => array( 'width' => 25, 'height' => 25 ),
|
| 103 |
+
);
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* Constructor
|
| 107 |
+
*
|
| 108 |
+
* @since 3.0
|
| 109 |
+
*/
|
| 110 |
+
function __construct()
|
| 111 |
+
{
|
| 112 |
+
define('PRINTFRIENDLY_BASEPATH', dirname(__FILE__));
|
| 113 |
+
define('PRINTFRIENDLY_BASEURL', plugins_url('/', __FILE__));
|
| 114 |
+
// Retrieve the plugin options
|
| 115 |
+
$this->options = get_option($this->option_name);
|
| 116 |
+
// If the options array is empty, set defaults
|
| 117 |
+
if (! is_array($this->options)) {
|
| 118 |
+
$this->set_defaults();
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
/**
|
| 122 |
+
* Set page content selection option "WordPress Standard/Strict" to "WP Template"
|
| 123 |
+
*/
|
| 124 |
+
if (isset($this->options['pf_algo']) && $this->options['pf_algo'] === 'ws') {
|
| 125 |
+
$this->options['pf_algo'] = 'wp';
|
| 126 |
+
update_option($this->option_name, $this->options);
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
// If the version number doesn't match, upgrade
|
| 130 |
+
if ($this->db_version > $this->options['db_version']) {
|
| 131 |
+
$this->upgrade();
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
add_action('wp_head', array(&$this, 'front_head'));
|
| 135 |
+
|
| 136 |
+
// automaticaly add the link
|
| 137 |
+
add_filter('the_content', array(&$this, 'show_link_on_content'));
|
| 138 |
+
add_filter('the_excerpt', array(&$this, 'show_link_on_excerpt'));
|
| 139 |
+
|
| 140 |
+
add_action('the_content', array(&$this, 'add_pf_content_class_around_content_hook'));
|
| 141 |
+
if (is_admin()) {
|
| 142 |
+
$this->admin_hooks();
|
| 143 |
+
}
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
/**
|
| 147 |
+
* All admin hooks.
|
| 148 |
+
*/
|
| 149 |
+
function admin_hooks()
|
| 150 |
+
{
|
| 151 |
+
// Hook into init for registration of the option and the language files
|
| 152 |
+
add_action('admin_init', array(&$this, 'init'));
|
| 153 |
+
// Register the settings page
|
| 154 |
+
add_action('admin_menu', array(&$this, 'add_config_page'));
|
| 155 |
+
// Enqueue the needed scripts and styles
|
| 156 |
+
add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
|
| 157 |
+
// Register a link to the settings page on the plugins overview page
|
| 158 |
+
add_filter('plugin_action_links', array(&$this, 'filter_plugin_actions'), 10, 2);
|
| 159 |
+
add_filter('plugin_row_meta', array(&$this, 'additional_links'), 10, 2);
|
| 160 |
+
add_filter('wp_dropdown_cats', array( &$this, 'wp_dropdown_cats_multiple' ), 10, 2);
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
/**
|
| 164 |
+
* Adds multiple select support for category dropdown.
|
| 165 |
+
*
|
| 166 |
+
* @since 4.2
|
| 167 |
+
**/
|
| 168 |
+
function wp_dropdown_cats_multiple($output, $attributes)
|
| 169 |
+
{
|
| 170 |
+
if (isset($attributes['multiple']) && $attributes['multiple']) {
|
| 171 |
+
$output = preg_replace('/^<select/i', '<select multiple', $output);
|
| 172 |
+
$output = str_replace("name='{$attributes['name']}'", "name='{$attributes['name']}[]'", $output);
|
| 173 |
+
foreach (array_map('trim', explode(',', $attributes['selected'])) as $value) {
|
| 174 |
+
$output = str_replace("value=\"{$value}\"", "value=\"{$value}\" selected", $output);
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
return $output;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
/**
|
| 181 |
+
* Adds wraps content in pf-content class to help Printfriendly algo determine the content
|
| 182 |
+
*
|
| 183 |
+
* @since 3.2.8
|
| 184 |
+
**/
|
| 185 |
+
function add_pf_content_class_around_content_hook($content = false)
|
| 186 |
+
{
|
| 187 |
+
if ($this->is_enabled() && $this->is_wp_algo_on($content)) {
|
| 188 |
+
add_action('wp_footer', array(&$this, 'print_script_footer'));
|
| 189 |
+
return '<div class="pf-content">' . $content . '</div>';
|
| 190 |
+
} else {
|
| 191 |
+
return $content;
|
| 192 |
+
}
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
/**
|
| 196 |
+
* Override to check if print-only command is being used
|
| 197 |
+
*
|
| 198 |
+
* @since 3.3.0
|
| 199 |
+
**/
|
| 200 |
+
function print_only_override($content)
|
| 201 |
+
{
|
| 202 |
+
$pattern = '/class\s*?=\s*?(["\']|["\']([^"\']*?)\s)print-only(["\']|\s([^"\']*?)["\'])/';
|
| 203 |
+
$pf_pattern = '/class\s*?=\s*?(["\']|["\']([^"\']*?)\s)pf-content(["\']|\s([^"\']*?)["\'])/';
|
| 204 |
+
return ( preg_match($pattern, $content) || preg_match($pf_pattern, $content) );
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
/**
|
| 208 |
+
* Check if WP Algorithm is selected and content doesn't use print-only
|
| 209 |
+
*
|
| 210 |
+
* @since 3.5.4
|
| 211 |
+
**/
|
| 212 |
+
function is_wp_algo_on($content)
|
| 213 |
+
{
|
| 214 |
+
return ! class_exists('WooCommerce') && isset($this->options['pf_algo']) && $content && $this->options['pf_algo'] === 'wp' && ! $this->print_only_override($content);
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
/**
|
| 218 |
+
* PHP 4 Compatible Constructor
|
| 219 |
+
*
|
| 220 |
+
* @since 3.0
|
| 221 |
+
*/
|
| 222 |
+
function PrintFriendly_WordPress()
|
| 223 |
+
{
|
| 224 |
+
$this->__construct();
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
/**
|
| 228 |
+
* Check if button should be visible on particular page
|
| 229 |
+
*/
|
| 230 |
+
function is_enabled()
|
| 231 |
+
{
|
| 232 |
+
if (
|
| 233 |
+
( is_page() && ( isset($this->options['show_on_pages']) && 'on' === $this->options['show_on_pages'] ) )
|
| 234 |
+
|| ( is_home() && ( ( isset($this->options['show_on_homepage']) && 'on' === $this->options['show_on_homepage'] ) ) )
|
| 235 |
+
|| ( is_tax() && ( ( isset($this->options['show_on_taxonomies']) && 'on' === $this->options['show_on_taxonomies'] ) && $this->category_included() ) )
|
| 236 |
+
|| ( is_category() && ( ( isset($this->options['show_on_categories']) && 'on' === $this->options['show_on_categories'] ) && $this->category_included() ) )
|
| 237 |
+
|| ( is_single() && ( ( isset($this->options['show_on_posts']) && 'on' === $this->options['show_on_posts'] ) && $this->category_included() ) )
|
| 238 |
+
) {
|
| 239 |
+
return true;
|
| 240 |
+
}
|
| 241 |
+
return false;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
/**
|
| 245 |
+
* Prints the PrintFriendly button CSS, in the header.
|
| 246 |
+
*
|
| 247 |
+
* @since 3.0
|
| 248 |
+
*/
|
| 249 |
+
function front_head()
|
| 250 |
+
{
|
| 251 |
+
if ($this->is_enabled()) {
|
| 252 |
+
?>
|
| 253 |
+
<?php
|
| 254 |
+
if (isset($this->options['enable_css']) && $this->options['enable_css'] !== 'on') {
|
| 255 |
+
return;
|
| 256 |
+
}
|
| 257 |
+
?>
|
| 258 |
+
<style type="text/css">
|
| 259 |
+
@media screen {
|
| 260 |
+
.printfriendly {
|
| 261 |
+
position: relative;
|
| 262 |
+
z-index: 1000;
|
| 263 |
+
margin:
|
| 264 |
+
<?php
|
| 265 |
+
echo sprintf('%dpx %dpx %dpx %dpx', $this->val('margin_top', false, 0), $this->val('margin_right', false, 0), $this->val('margin_bottom', false, 0), $this->val('margin_left', false, 0));
|
| 266 |
+
?>
|
| 267 |
+
;
|
| 268 |
+
}
|
| 269 |
+
.printfriendly a, .printfriendly a:link, .printfriendly a:visited, .printfriendly a:hover, .printfriendly a:active {
|
| 270 |
+
font-weight: 600;
|
| 271 |
+
cursor: pointer;
|
| 272 |
+
text-decoration: none;
|
| 273 |
+
border: none;
|
| 274 |
+
-webkit-box-shadow: none;
|
| 275 |
+
-moz-box-shadow: none;
|
| 276 |
+
box-shadow: none;
|
| 277 |
+
outline:none;
|
| 278 |
+
font-size: <?php echo $this->options['text_size']; ?>px !important;
|
| 279 |
+
color: <?php echo $this->options['text_color']; ?> !important;
|
| 280 |
+
}
|
| 281 |
+
.printfriendly.pf-alignleft {
|
| 282 |
+
float: left
|
| 283 |
+
}
|
| 284 |
+
.printfriendly.pf-alignright {
|
| 285 |
+
float: right;
|
| 286 |
+
}
|
| 287 |
+
.printfriendly.pf-aligncenter {
|
| 288 |
+
display: flex;
|
| 289 |
+
align-items: center;
|
| 290 |
+
justify-content: center;
|
| 291 |
+
}
|
| 292 |
+
}
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
@media print {
|
| 296 |
+
.printfriendly {
|
| 297 |
+
display: none;
|
| 298 |
+
}
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
.pf-button.pf-button-excerpt {
|
| 302 |
+
display: none;
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
.pf-button-img {
|
| 306 |
+
border: none;
|
| 307 |
+
-webkit-box-shadow: none;
|
| 308 |
+
-moz-box-shadow: none;
|
| 309 |
+
box-shadow: none;
|
| 310 |
+
padding: 0;
|
| 311 |
+
margin: 0;
|
| 312 |
+
display: inline;
|
| 313 |
+
vertical-align: middle;
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
img.pf-button-img + .pf-button-text {
|
| 317 |
+
margin-left: 6px;
|
| 318 |
+
}
|
| 319 |
+
</style>
|
| 320 |
+
<?php
|
| 321 |
+
}
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
/**
|
| 325 |
+
* Prints the PrintFriendly JavaScript, in the footer, and loads it asynchronously.
|
| 326 |
+
*
|
| 327 |
+
* @since 3.0
|
| 328 |
+
*/
|
| 329 |
+
function print_script_footer()
|
| 330 |
+
{
|
| 331 |
+
$tagline = $this->options['tagline'];
|
| 332 |
+
$image_url = $this->options['image_url'];
|
| 333 |
+
if ($this->options['logo'] === 'favicon') {
|
| 334 |
+
$tagline = '';
|
| 335 |
+
$image_url = '';
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
echo $this->getSelectorsFromCustomCSS();
|
| 339 |
+
|
| 340 |
+
// Currently we use v3 for both: normal and password protected sites
|
| 341 |
+
?>
|
| 342 |
+
<script type="text/javascript" id="pf_script">
|
| 343 |
+
<?php echo $this->get_analytics_code(); ?>
|
| 344 |
+
var pfHeaderImgUrl = '<?php echo esc_js(esc_url($image_url)); ?>';
|
| 345 |
+
var pfHeaderTagline = '<?php echo esc_js($tagline); ?>';
|
| 346 |
+
var pfdisableClickToDel = '<?php echo esc_js($this->options['click_to_delete']); ?>';
|
| 347 |
+
var pfImagesSize = '<?php echo esc_js($this->options['images-size']); ?>';
|
| 348 |
+
var pfImageDisplayStyle = '<?php echo esc_js($this->options['image-style']); ?>';
|
| 349 |
+
var pfEncodeImages = '<?php echo esc_js($this->val('password_protected', false) === 'yes' ? 1 : 0); ?>';
|
| 350 |
+
var pfShowHiddenContent = '<?php echo esc_js($this->val('show_hidden_content', false) === 'yes' ? 1 : 0); ?>';
|
| 351 |
+
var pfDisableEmail = '<?php echo esc_js($this->options['email']); ?>';
|
| 352 |
+
var pfDisablePDF = '<?php echo esc_js($this->options['pdf']); ?>';
|
| 353 |
+
var pfDisablePrint = '<?php echo esc_js($this->options['print']); ?>';
|
| 354 |
+
var pfCustomCSS = '<?php echo esc_js(esc_url($this->get_custom_css())); ?>';
|
| 355 |
+
var pfPlatform = 'WordPress';
|
| 356 |
+
</script>
|
| 357 |
+
<script async src='https://cdn.printfriendly.com/printfriendly.js'></script>
|
| 358 |
+
<?php
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
/**
|
| 362 |
+
* Used as a filter for the_content.
|
| 363 |
+
*
|
| 364 |
+
* @since ?
|
| 365 |
+
*
|
| 366 |
+
* @param string $content The content of the post, when the function is used as a filter.
|
| 367 |
+
*
|
| 368 |
+
* @return string The content with the button added to the content.
|
| 369 |
+
*/
|
| 370 |
+
function show_link_on_content($content)
|
| 371 |
+
{
|
| 372 |
+
$content = $this->show_link($content, true);
|
| 373 |
+
return $content;
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
/**
|
| 377 |
+
* Used as a filter for the_excerpt.
|
| 378 |
+
*
|
| 379 |
+
* @since ?
|
| 380 |
+
*
|
| 381 |
+
* @param string $content The content of the post, when the function is used as a filter.
|
| 382 |
+
*
|
| 383 |
+
* @return string The content with the button added to the content.
|
| 384 |
+
*/
|
| 385 |
+
function show_link_on_excerpt($content)
|
| 386 |
+
{
|
| 387 |
+
return $this->show_link($content, false);
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
/**
|
| 391 |
+
* Used to generate the the final content as per the required placement.
|
| 392 |
+
*
|
| 393 |
+
* @since 3.0
|
| 394 |
+
*
|
| 395 |
+
* @param string $content The content of the post, when the function is used as a filter.
|
| 396 |
+
* @param bool $on_content True if showing on the_content and False if showing on the_excerpt.
|
| 397 |
+
*
|
| 398 |
+
* @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.
|
| 399 |
+
*/
|
| 400 |
+
private function show_link($content = false, $on_content = true)
|
| 401 |
+
{
|
| 402 |
+
if ($this->is_enabled() && $content) {
|
| 403 |
+
$button = $this->getButton(false, $on_content ? 'pf-button-content' : 'pf-button-excerpt');
|
| 404 |
+
// Hook the script call now, so it only get's loaded when needed, and need is determined by the user calling pf_button
|
| 405 |
+
add_action('wp_footer', array(&$this, 'print_script_footer'));
|
| 406 |
+
if ($this->options['content_placement'] === 'before') {
|
| 407 |
+
return $button . $content;
|
| 408 |
+
} else {
|
| 409 |
+
return $content . $button;
|
| 410 |
+
}
|
| 411 |
+
}
|
| 412 |
+
return $content;
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
/**
|
| 416 |
+
* Returns the analytics function to be included in the front end.
|
| 417 |
+
*
|
| 418 |
+
* @since 5.1
|
| 419 |
+
*
|
| 420 |
+
* @return string
|
| 421 |
+
*/
|
| 422 |
+
private function get_analytics_code()
|
| 423 |
+
{
|
| 424 |
+
$return = null;
|
| 425 |
+
if ($this->google_analytics_enabled()) {
|
| 426 |
+
$code = apply_filters('printfriendly_analytics_code', "
|
| 427 |
+
if(typeof(_gaq) != 'undefined') {
|
| 428 |
+
_gaq.push(['_trackEvent','PRINTFRIENDLY', 'print', title]);
|
| 429 |
+
}else if(typeof(ga) != 'undefined') {
|
| 430 |
+
ga('send', 'event','PRINTFRIENDLY', 'print', title);
|
| 431 |
+
}else if(typeof(gtag) != 'undefined') {
|
| 432 |
+
gtag('event', 'printfriendly_button_click', {'event_category': 'printfriendly', 'event_label': title})
|
| 433 |
+
}else if(typeof(dataLayer) != 'undefined') {
|
| 434 |
+
dataLayer.push({
|
| 435 |
+
'event': 'printfriendly_button_click',
|
| 436 |
+
'pageTitle': title
|
| 437 |
+
})
|
| 438 |
+
}
|
| 439 |
+
");
|
| 440 |
+
$return = "
|
| 441 |
+
function pfTrackEvent(title) {
|
| 442 |
+
$code
|
| 443 |
}
|
| 444 |
+
";
|
| 445 |
+
}
|
| 446 |
+
return $return;
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
/**
|
| 450 |
+
* Returns the HTML of the button.
|
| 451 |
+
*
|
| 452 |
+
* This can be called publicly from `pf_show_link()`.
|
| 453 |
+
*
|
| 454 |
+
* @since 3.3.8
|
| 455 |
+
*
|
| 456 |
+
* @param bool $add_footer_script Whether to add the script in the footer.
|
| 457 |
+
* @param string $add_class Additional class for the HTML button div.
|
| 458 |
+
* @param bool $print_whole_page Whether to print the whole page or follow default behaviour.
|
| 459 |
+
*
|
| 460 |
+
* @return Printfriendly Button HTML
|
| 461 |
+
*/
|
| 462 |
+
public function getButton($add_footer_script = false, $add_class = '', $print_whole_page = false)
|
| 463 |
+
{
|
| 464 |
+
if ($add_footer_script) {
|
| 465 |
+
add_action('wp_footer', array(&$this, 'print_script_footer'));
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
$onclick = array();
|
| 469 |
+
$href = '#';
|
| 470 |
+
|
| 471 |
+
if ($print_whole_page) {
|
| 472 |
+
$onclick[] = 'window.print()';
|
| 473 |
+
} else {
|
| 474 |
+
if (is_singular()) {
|
| 475 |
+
$onclick[] = 'window.print()';
|
| 476 |
+
} else {
|
| 477 |
+
$href = add_query_arg('pfstyle', 'wp', get_permalink());
|
| 478 |
+
}
|
| 479 |
+
}
|
| 480 |
+
|
| 481 |
+
if ($this->google_analytics_enabled()) {
|
| 482 |
+
$onclick[] = "pfTrackEvent('" . esc_attr(get_the_title()) . "')";
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
if (! empty($onclick)) {
|
| 486 |
+
$onclick = 'onClick="' . implode('; ', $onclick) . '; return false;"';
|
| 487 |
+
} else {
|
| 488 |
+
$onclick = '';
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
$align = '';
|
| 492 |
+
if ('none' !== $this->options['content_position']) {
|
| 493 |
+
$align = ' pf-align' . $this->options['content_position'];
|
| 494 |
+
}
|
| 495 |
+
$href = str_replace('&', '&', $href);
|
| 496 |
+
$button = apply_filters('printfriendly_button', '<div class="printfriendly pf-button ' . $add_class . $align . '"><a href="' . $href . '" rel="nofollow" ' . $onclick . ' title="Printer Friendly, PDF & Email">' . $this->button() . '</a></div>');
|
| 497 |
+
return $button;
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
/**
|
| 501 |
+
* Returns the custom selector CSS to be added.
|
| 502 |
+
*
|
| 503 |
+
* @since 5.0
|
| 504 |
+
* @returns string
|
| 505 |
+
*/
|
| 506 |
+
private function getSelectorsFromCustomCSS()
|
| 507 |
+
{
|
| 508 |
+
$css = '';
|
| 509 |
+
if ($this->options['pf_algo'] === 'css') {
|
| 510 |
+
$attributes = array();
|
| 511 |
+
$names = array( 'author', 'date', 'content', 'title', 'primaryImage' );
|
| 512 |
+
$data = '';
|
| 513 |
+
foreach ($names as $name) {
|
| 514 |
+
$selector = $this->val("css-{$name}", false);
|
| 515 |
+
$suffix = $name === 'content' ? 'Selectors' : 'Selector';
|
| 516 |
+
if (! empty($selector)) {
|
| 517 |
+
$data .= "{$name}{$suffix}=$selector;";
|
| 518 |
+
}
|
| 519 |
+
}
|
| 520 |
+
$fallback = $this->options['pf_algo_css_content'];
|
| 521 |
+
if ($data) {
|
| 522 |
+
$css = sprintf('<printfriendly-options data-selectors="%s" data-fallback-strategy="%s"></printfriendly-options>', esc_attr($data), esc_attr($fallback));
|
| 523 |
+
}
|
| 524 |
+
}
|
| 525 |
+
return $css;
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
|
| 529 |
+
/**
|
| 530 |
+
* Checks if GA is enabled.
|
| 531 |
+
*
|
| 532 |
+
* @since 3.2.9
|
| 533 |
+
* @returns if google analytics enabled
|
| 534 |
+
*/
|
| 535 |
+
function google_analytics_enabled()
|
| 536 |
+
{
|
| 537 |
+
return isset($this->options['enable_google_analytics']) && $this->options['enable_google_analytics'] === 'yes';
|
| 538 |
+
}
|
| 539 |
+
|
| 540 |
+
/**
|
| 541 |
+
* Filter posts by category.
|
| 542 |
+
*
|
| 543 |
+
* @since 3.2.2
|
| 544 |
+
* @return boolean true if post belongs to category selected for button display
|
| 545 |
+
*/
|
| 546 |
+
function category_included()
|
| 547 |
+
{
|
| 548 |
+
return isset($this->options['show_on_cat']) ? in_category($this->options['show_on_cat']) : true;
|
| 549 |
+
}
|
| 550 |
+
|
| 551 |
+
/**
|
| 552 |
+
* Register the textdomain and the options array along with the validation function
|
| 553 |
+
*
|
| 554 |
+
* @since 3.0
|
| 555 |
+
*/
|
| 556 |
+
function init()
|
| 557 |
+
{
|
| 558 |
+
// Allow for localization
|
| 559 |
+
load_plugin_textdomain('printfriendly', false, basename(dirname(__FILE__)) . '/languages');
|
| 560 |
+
// Register our option array
|
| 561 |
+
register_setting($this->option_name, $this->option_name, array( 'sanitize_callback' => array(&$this, 'options_validate') ));
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
/**
|
| 565 |
+
* Validate the saved options.
|
| 566 |
+
*
|
| 567 |
+
* @since 3.0
|
| 568 |
+
* @param array $input with unvalidated options.
|
| 569 |
+
* @return array $valid_input with validated options.
|
| 570 |
+
*/
|
| 571 |
+
function options_validate($input)
|
| 572 |
+
{
|
| 573 |
+
// Prevent CSRF attack
|
| 574 |
+
check_admin_referer('pf-options', 'pf-nonce');
|
| 575 |
+
$valid_input = $input;
|
| 576 |
+
|
| 577 |
+
// Section 1 options
|
| 578 |
+
if (
|
| 579 |
+
! isset($input['button_type']) || ! in_array(
|
| 580 |
+
$input['button_type'],
|
| 581 |
+
array(
|
| 582 |
+
'buttons/printfriendly-pdf-email-button.png',
|
| 583 |
+
'buttons/printfriendly-pdf-email-button-md.png',
|
| 584 |
+
'buttons/printfriendly-pdf-email-button-notext.png', // buttongroup1
|
| 585 |
+
'buttons/printfriendly-pdf-button.png',
|
| 586 |
+
'buttons/printfriendly-pdf-button-nobg.png',
|
| 587 |
+
'buttons/printfriendly-pdf-button-nobg-md.png', // buttongroup2
|
| 588 |
+
'buttons/printfriendly-button.png',
|
| 589 |
+
'buttons/printfriendly-button-nobg.png',
|
| 590 |
+
'buttons/printfriendly-button-md.png',
|
| 591 |
+
'buttons/printfriendly-button-lg.png', // buttongroup3
|
| 592 |
+
'buttons/print-button.png',
|
| 593 |
+
'buttons/print-button-nobg.png',
|
| 594 |
+
'buttons/print-button-gray.png', // buttongroup3
|
| 595 |
+
'custom-button', // custom
|
| 596 |
+
),
|
| 597 |
+
true
|
| 598 |
+
)
|
| 599 |
+
) {
|
| 600 |
+
$valid_input['button_type'] = 'printfriendly-pdf-button.png';
|
| 601 |
+
}
|
| 602 |
+
|
| 603 |
+
if (
|
| 604 |
+
! isset($input['custom_button_icon']) || ! in_array(
|
| 605 |
+
$input['custom_button_icon'],
|
| 606 |
+
array(
|
| 607 |
+
'https://cdn.printfriendly.com/icons/printfriendly-icon-sm.png',
|
| 608 |
+
'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png',
|
| 609 |
+
'https://cdn.printfriendly.com/icons/printfriendly-icon-lg.png',
|
| 610 |
+
'custom-image',
|
| 611 |
+
'no-image',
|
| 612 |
+
),
|
| 613 |
+
true
|
| 614 |
+
)
|
| 615 |
+
) {
|
| 616 |
+
$valid_input['custom_button_icon'] = 'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png';
|
| 617 |
+
}
|
| 618 |
+
|
| 619 |
+
// if a custom image is not being chosen, reset it in case it existed in the past.
|
| 620 |
+
if (isset($valid_input['custom_button_icon']) && $valid_input['custom_button_icon'] !== 'custom-image') {
|
| 621 |
+
$valid_input['custom_image'] = '';
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
// @todo custom image url validation
|
| 625 |
+
if (! isset($input['custom_image']) || empty($input['custom_image'])) {
|
| 626 |
+
$valid_input['custom_image'] = '';
|
| 627 |
+
}
|
| 628 |
+
|
| 629 |
+
if (! isset($input['custom_button_text'])) {
|
| 630 |
+
$valid_input['custom_button_text'] = 'custom-text';
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
// @todo validate optional custom text
|
| 634 |
+
if (! isset($input['custom_text'])) {
|
| 635 |
+
$valid_input['custom_text'] = 'Print Friendly';
|
| 636 |
+
}
|
| 637 |
+
|
| 638 |
+
// Custom button selected, but no url nor text given, reset button type to default
|
| 639 |
+
if ('custom-button' === $valid_input['button_type'] && ( '' === $valid_input['custom_image'] && '' === $input['custom_text'] )) {
|
| 640 |
+
$valid_input['button_type'] = 'buttons/printfriendly-pdf-button.png';
|
| 641 |
+
add_settings_error($this->option_name, 'invalid_custom_image', __('No valid custom image url received, please enter a valid url to use a custom image.', 'printfriendly'));
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
$valid_input['text_size'] = (int) $input['text_size'];
|
| 645 |
+
if (! isset($valid_input['text_size']) || 0 === $valid_input['text_size']) {
|
| 646 |
+
$valid_input['text_size'] = 14;
|
| 647 |
+
} elseif (25 < $valid_input['text_size'] || 9 > $valid_input['text_size']) {
|
| 648 |
+
$valid_input['text_size'] = 14;
|
| 649 |
+
add_settings_error($this->option_name, 'invalid_text_size', __('The text size you entered is invalid, please stay between 9px and 25px', 'printfriendly'));
|
| 650 |
+
}
|
| 651 |
+
|
| 652 |
+
if (! isset($input['text_color'])) {
|
| 653 |
+
$valid_input['text_color'] = $this->options['text_color'];
|
| 654 |
+
} elseif (! preg_match('/^#[a-f0-9]{3,6}$/i', $input['text_color'])) {
|
| 655 |
+
// Revert to previous setting and throw error.
|
| 656 |
+
$valid_input['text_color'] = $this->options['text_color'];
|
| 657 |
+
add_settings_error($this->option_name, 'invalid_color', __('The color you entered is not valid, it must be a valid hexadecimal RGB font color.', 'printfriendly'));
|
| 658 |
+
}
|
| 659 |
+
|
| 660 |
+
/* Section 2 options */
|
| 661 |
+
if (! isset($input['enable_css']) || 'off' !== $input['enable_css']) {
|
| 662 |
+
$valid_input['enable_css'] = 'on';
|
| 663 |
+
}
|
| 664 |
+
|
| 665 |
+
if (! isset($input['content_position']) || ! in_array($input['content_position'], array('none', 'left', 'center', 'right'), true)) {
|
| 666 |
+
$valid_input['content_position'] = 'left';
|
| 667 |
+
}
|
| 668 |
+
|
| 669 |
+
if (! isset($input['content_placement']) || ! in_array($input['content_placement'], array('before', 'after'), true)) {
|
| 670 |
+
$valid_input['content_placement'] = 'after';
|
| 671 |
+
}
|
| 672 |
+
|
| 673 |
+
foreach (array('margin_top', 'margin_right', 'margin_bottom', 'margin_left') as $opt) {
|
| 674 |
+
// if margin is not defined, don't throw a PHP notice
|
| 675 |
+
if (isset($input[ $opt ])) {
|
| 676 |
+
$valid_input[ $opt ] = (int) $input[ $opt ];
|
| 677 |
+
}
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
unset($opt);
|
| 681 |
+
|
| 682 |
+
/* Section 3 options */
|
| 683 |
+
foreach (array('show_on_posts', 'show_on_pages', 'show_on_homepage', 'show_on_categories', 'show_on_taxonomies') as $opt) {
|
| 684 |
+
if (! isset($input[ $opt ]) || 'on' !== $input[ $opt ]) {
|
| 685 |
+
unset($valid_input[ $opt ]);
|
| 686 |
+
}
|
| 687 |
+
}
|
| 688 |
+
unset($opt);
|
| 689 |
+
|
| 690 |
+
if (isset($input['category_ids'])) {
|
| 691 |
+
unset($valid_input['category_ids']);
|
| 692 |
+
}
|
| 693 |
+
|
| 694 |
+
/* Section 4 options */
|
| 695 |
+
if (! isset($input['logo']) || ! in_array($input['logo'], array('favicon', 'upload-an-image'), true)) {
|
| 696 |
+
$valid_input['logo'] = 'favicon';
|
| 697 |
+
}
|
| 698 |
+
|
| 699 |
+
// @todo custom logo url validation
|
| 700 |
+
if (! isset($input['image_url']) || empty($input['image_url'])) {
|
| 701 |
+
$valid_input['image_url'] = '';
|
| 702 |
+
}
|
| 703 |
+
|
| 704 |
+
// @todo validate optional tagline text
|
| 705 |
+
if (! isset($input['tagline'])) {
|
| 706 |
+
$valid_input['tagline'] = '';
|
| 707 |
+
}
|
| 708 |
+
|
| 709 |
+
// Custom logo selected, but no valid url given, reset logo to default
|
| 710 |
+
if ('upload-an-image' === $valid_input['logo'] && '' === $valid_input['image_url']) {
|
| 711 |
+
$valid_input['logo'] = 'favicon';
|
| 712 |
+
add_settings_error($this->option_name, 'invalid_custom_logo', __('No valid custom logo url received, please enter a valid url to use a custom logo.', 'printfriendly'));
|
| 713 |
+
}
|
| 714 |
+
|
| 715 |
+
if (! isset($input['image-style']) || ! in_array($input['image-style'], array('right', 'left', 'none', 'block'), true)) {
|
| 716 |
+
$valid_input['image-style'] = 'block';
|
| 717 |
+
}
|
| 718 |
+
|
| 719 |
+
foreach (array('click_to_delete', 'email', 'pdf', 'print') as $opt) {
|
| 720 |
+
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
|
| 721 |
+
if (! isset($input[ $opt ]) || ! in_array($input[ $opt ], array('0', '1'))) {
|
| 722 |
+
$valid_input[ $opt ] = '0';
|
| 723 |
+
}
|
| 724 |
+
}
|
| 725 |
+
unset($opt);
|
| 726 |
+
|
| 727 |
+
if (! isset($input['images-size']) || ! in_array($input['images-size'], array('full-size', 'remove-images', 'large', 'medium', 'small'), true)) {
|
| 728 |
+
$valid_input['images-size'] = 'full-size';
|
| 729 |
+
}
|
| 730 |
+
|
| 731 |
+
if ($this->is_pro('custom-css')) {
|
| 732 |
+
// a file will be generated even if nothing is provided in the css box.
|
| 733 |
+
$css = $input['custom_css'];
|
| 734 |
+
|
| 735 |
+
// remove the <style> </style> tags.
|
| 736 |
+
$css = str_replace(array( '<style>', '</style>' ), '', $css);
|
| 737 |
+
$valid_input['custom_css'] = sanitize_textarea_field($css);
|
| 738 |
+
$file = $this->maybe_generate_custom_css_file($valid_input['custom_css']);
|
| 739 |
+
if (! $file) {
|
| 740 |
+
$file = isset($this->options['custom_css_url_pro']) ? $this->options['custom_css_url_pro'] : '';
|
| 741 |
+
}
|
| 742 |
+
$valid_input['custom_css_url_pro'] = $file;
|
| 743 |
+
|
| 744 |
+
// if no file can be generated
|
| 745 |
+
// check if this version is upgraded from the version that was using url instead of textbox
|
| 746 |
+
// and reuse it
|
| 747 |
+
if (! $file && isset($this->options['custom_css_url'])) {
|
| 748 |
+
$valid_input['custom_css_url'] = $this->options['custom_css_url'];
|
| 749 |
+
}
|
| 750 |
+
}
|
| 751 |
+
|
| 752 |
+
/* Section 5 options */
|
| 753 |
+
if (! isset($input['password_protected']) || ! in_array($input['password_protected'], array('no', 'yes'), true)) {
|
| 754 |
+
$valid_input['password_protected'] = 'no';
|
| 755 |
+
}
|
| 756 |
+
if (! isset($input['show_hidden_content']) || ! in_array($input['show_hidden_content'], array('no', 'yes'), true)) {
|
| 757 |
+
$valid_input['show_hidden_content'] = 'no';
|
| 758 |
+
}
|
| 759 |
+
|
| 760 |
+
/*Analytics Options */
|
| 761 |
+
if (! isset($input['enable_google_analytics']) || ! in_array($input['enable_google_analytics'], array('no', 'yes'), true)) {
|
| 762 |
+
$valid_input['enable_google_analytics'] = 'no';
|
| 763 |
+
}
|
| 764 |
+
|
| 765 |
+
if (! isset($input['pf_algo']) || ! in_array($input['pf_algo'], array('wp', 'pf', 'css'), true)) {
|
| 766 |
+
$valid_input['pf_algo'] = 'wp';
|
| 767 |
+
}
|
| 768 |
+
|
| 769 |
+
if ($valid_input['pf_algo'] === 'css' && empty($valid_input['pf_algo_css_content']) && ! empty($valid_input['css-content'])) {
|
| 770 |
+
$valid_input['pf_algo_css_content'] = 'original';
|
| 771 |
+
}
|
| 772 |
+
|
| 773 |
+
if (! isset($valid_input['custom_image_width'])) {
|
| 774 |
+
$valid_input['custom_image_width'] = 0;
|
| 775 |
+
}
|
| 776 |
+
|
| 777 |
+
if (! isset($valid_input['custom_image_height'])) {
|
| 778 |
+
$valid_input['custom_image_height'] = 0;
|
| 779 |
+
}
|
| 780 |
+
|
| 781 |
+
if (empty($valid_input['custom_image'])) {
|
| 782 |
+
unset($valid_input['custom_image_width']);
|
| 783 |
+
unset($valid_input['custom_image_height']);
|
| 784 |
+
}
|
| 785 |
+
|
| 786 |
+
/* Database version */
|
| 787 |
+
$valid_input['db_version'] = $this->db_version;
|
| 788 |
+
|
| 789 |
+
// set the current tab from where the settings were saved from
|
| 790 |
+
if (isset($_POST['tab'])) {
|
| 791 |
+
set_transient('pf-tab', $_POST['tab'], 5);
|
| 792 |
+
}
|
| 793 |
+
|
| 794 |
+
// save the categories as comma-separated
|
| 795 |
+
if (isset($valid_input['show_on_cat']) && ! empty($valid_input['show_on_cat'])) {
|
| 796 |
+
$valid_input['show_on_cat'] = implode(',', $valid_input['show_on_cat']);
|
| 797 |
+
}
|
| 798 |
+
|
| 799 |
+
return $valid_input;
|
| 800 |
+
}
|
| 801 |
+
|
| 802 |
+
/**
|
| 803 |
+
* Register the config page for all users that have the manage_options capability
|
| 804 |
+
*
|
| 805 |
+
* @since 3.0
|
| 806 |
+
*/
|
| 807 |
+
function add_config_page()
|
| 808 |
+
{
|
| 809 |
+
$this->settings_page = add_options_page(__('PrintFriendly Options', 'printfriendly'), __('Print Friendly & PDF', 'printfriendly'), 'manage_options', $this->hook, array(&$this, 'config_page'));
|
| 810 |
+
|
| 811 |
+
// register callback gets call prior your own page gets rendered
|
| 812 |
+
add_action('load-' . $this->settings_page, array(&$this, 'on_load_printfriendly'));
|
| 813 |
+
}
|
| 814 |
+
|
| 815 |
+
/**
|
| 816 |
+
* Enqueue the scripts for the admin settings page
|
| 817 |
+
*
|
| 818 |
+
* @since 3.0
|
| 819 |
+
* @param string $screen_id check whether the current page is the PrintFriendly settings page.
|
| 820 |
+
*/
|
| 821 |
+
function admin_enqueue_scripts($screen_id)
|
| 822 |
+
{
|
| 823 |
+
if ($this->settings_page === $screen_id) {
|
| 824 |
+
if (! did_action('wp_enqueue_media')) {
|
| 825 |
+
wp_enqueue_media();
|
| 826 |
+
}
|
| 827 |
+
|
| 828 |
+
if (! wp_script_is('clipboard')) {
|
| 829 |
+
wp_enqueue_script('clipboard', plugins_url('assets/js/lib/clipboard.min.js', __FILE__));
|
| 830 |
+
}
|
| 831 |
+
|
| 832 |
+
if (! wp_script_is('select2')) {
|
| 833 |
+
wp_enqueue_script('select2', plugins_url('assets/js/lib/select2.min.js', __FILE__));
|
| 834 |
+
}
|
| 835 |
+
|
| 836 |
+
wp_register_script('pf-admin', plugins_url('assets/js/admin.js', __FILE__), array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-accordion', 'media-upload', 'wp-color-picker', 'clipboard', 'select2' ), $this->plugin_version);
|
| 837 |
+
wp_localize_script(
|
| 838 |
+
'pf-admin',
|
| 839 |
+
'pf_config',
|
| 840 |
+
array(
|
| 841 |
+
'i10n' => array(
|
| 842 |
+
'upload_window_title' => __('Custom Image', 'printfriendly'),
|
| 843 |
+
'upload_window_button_title' => __('Use Image', 'printfriendly'),
|
| 844 |
+
'invalid_image_url' => __('Invalid Image URL', 'printfriendly'),
|
| 845 |
+
),
|
| 846 |
+
)
|
| 847 |
+
);
|
| 848 |
+
|
| 849 |
+
wp_register_script('pf-admin-pro', plugins_url('assets/js/admin_pro.js', __FILE__), array( 'pf-admin' ), $this->plugin_version);
|
| 850 |
+
|
| 851 |
+
wp_localize_script(
|
| 852 |
+
'pf-admin-pro',
|
| 853 |
+
'pf_config',
|
| 854 |
+
array(
|
| 855 |
+
'nonce' => wp_create_nonce($this->hook . $this->plugin_version),
|
| 856 |
+
'action' => $this->hook,
|
| 857 |
+
'i10n' => array(
|
| 858 |
+
'activation' => __('Activation', 'printfriendly'),
|
| 859 |
+
'check_status' => __('Checking status', 'printfriendly'),
|
| 860 |
+
'activate' => __('Activate', 'printfriendly'),
|
| 861 |
+
'active_trial' => __('Active Trial', 'printfriendly'),
|
| 862 |
+
'active' => __('Active', 'printfriendly'),
|
| 863 |
+
'expired' => __('Expired', 'printfriendly'),
|
| 864 |
+
'connection' => __('Please check Internet connection.', 'printfriendly'),
|
| 865 |
+
),
|
| 866 |
+
)
|
| 867 |
+
);
|
| 868 |
+
wp_enqueue_script('pf-admin-pro');
|
| 869 |
+
|
| 870 |
+
wp_enqueue_style('pf-bulma', plugins_url('assets/css/lib/bulma.prefixed.min.css', __FILE__), array( 'wp-color-picker' ), $this->plugin_version);
|
| 871 |
+
wp_enqueue_style('pf-select2', plugins_url('assets/css/lib/select2.min.css', __FILE__), array(), $this->plugin_version);
|
| 872 |
+
wp_enqueue_style('pf-admin', plugins_url('assets/css/admin.css', __FILE__), array( 'pf-select2', 'pf-bulma' ), $this->plugin_version);
|
| 873 |
+
}
|
| 874 |
+
}
|
| 875 |
+
|
| 876 |
+
/**
|
| 877 |
+
* Register the settings link for the plugins page
|
| 878 |
+
*
|
| 879 |
+
* @since 3.0
|
| 880 |
+
* @param array $links the links for the plugins.
|
| 881 |
+
* @param string $file filename to check against plugins filename.
|
| 882 |
+
* @return array $links the links with the settings link added to it if appropriate.
|
| 883 |
+
*/
|
| 884 |
+
function filter_plugin_actions($links, $file)
|
| 885 |
+
{
|
| 886 |
+
// Static so we don't call plugin_basename on every plugin row.
|
| 887 |
+
static $this_plugin;
|
| 888 |
+
if (! $this_plugin) {
|
| 889 |
+
$this_plugin = plugin_basename(__FILE__);
|
| 890 |
+
}
|
| 891 |
+
|
| 892 |
+
if ($file === $this_plugin) {
|
| 893 |
+
$settings_link = '<a href="options-general.php?page=' . $this->hook . '">' . __('Settings', 'printfriendly') . '</a>';
|
| 894 |
+
array_unshift($links, $settings_link); // before other links
|
| 895 |
+
}
|
| 896 |
+
|
| 897 |
+
return $links;
|
| 898 |
+
}
|
| 899 |
+
|
| 900 |
+
/**
|
| 901 |
+
* Register the additional link for the plugins page in the plugin description column.
|
| 902 |
+
*
|
| 903 |
+
* @since ?
|
| 904 |
+
* @param array $links the links for the plugins.
|
| 905 |
+
* @param string $file filename to check against plugins filename.
|
| 906 |
+
* @return array $links the links with the links added to it if appropriate.
|
| 907 |
+
*/
|
| 908 |
+
function additional_links($links, $file)
|
| 909 |
+
{
|
| 910 |
+
// Static so we don't call plugin_basename on every plugin row.
|
| 911 |
+
static $this_plugin;
|
| 912 |
+
if (! $this_plugin) {
|
| 913 |
+
$this_plugin = plugin_basename(__FILE__);
|
| 914 |
+
}
|
| 915 |
+
|
| 916 |
+
if ($file === $this_plugin) {
|
| 917 |
+
$new_links = array( '<a href="https://printfriendly.freshdesk.com/support/solutions/folders/69000070847" target="_new">' . __('Documentation', 'printfriendly') . '</a>' );
|
| 918 |
+
$links = array_merge($links, $new_links);
|
| 919 |
+
}
|
| 920 |
+
return $links;
|
| 921 |
+
}
|
| 922 |
+
|
| 923 |
+
/**
|
| 924 |
+
* Set default values for the plugin. If old, as in pre 1.0, settings are there, use them and then delete them.
|
| 925 |
+
*
|
| 926 |
+
* @since 3.0
|
| 927 |
+
*/
|
| 928 |
+
function set_defaults()
|
| 929 |
+
{
|
| 930 |
+
// Set some defaults
|
| 931 |
+
$this->options = array(
|
| 932 |
+
'button_type' => 'buttons/printfriendly-pdf-button.png',
|
| 933 |
+
'content_position' => 'left',
|
| 934 |
+
'content_placement' => 'after',
|
| 935 |
+
'custom_button_icon' => 'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png',
|
| 936 |
+
'custom_button_text' => 'custom-text',
|
| 937 |
+
'custom_image' => '',
|
| 938 |
+
'custom_text' => 'PrintFriendly',
|
| 939 |
+
'enable_css' => 'on',
|
| 940 |
+
'margin_top' => '12',
|
| 941 |
+
'margin_right' => '12',
|
| 942 |
+
'margin_bottom' => '12',
|
| 943 |
+
'margin_left' => '12',
|
| 944 |
+
'show_on_posts' => 'on',
|
| 945 |
+
'show_on_pages' => 'on',
|
| 946 |
+
'text_color' => '#3AAA11',
|
| 947 |
+
'text_size' => 14,
|
| 948 |
+
'logo' => 'favicon',
|
| 949 |
+
'image_url' => '',
|
| 950 |
+
'tagline' => '',
|
| 951 |
+
'click_to_delete' => '0', // 0 - allow, 1 - do not allow
|
| 952 |
+
'hide-images' => '0', // 0 - show images, 1 - hide images
|
| 953 |
+
'image-style' => 'block', // 'right', 'left', 'none', 'block'
|
| 954 |
+
'email' => '0', // 0 - allow, 1 - do not allow
|
| 955 |
+
'pdf' => '0', // 0 - allow, 1 - do not allow
|
| 956 |
+
'print' => '0', // 0 - allow, 1 - do not allow
|
| 957 |
+
'password_protected' => 'no',
|
| 958 |
+
'enable_google_analytics' => 'no',
|
| 959 |
+
'enable_error_reporting' => 'yes',
|
| 960 |
+
'pf_algo' => 'wp',
|
| 961 |
+
'images-size' => 'full-size',
|
| 962 |
+
'show_hidden_content' => 'no',
|
| 963 |
+
);
|
| 964 |
+
|
| 965 |
+
// Check whether the old badly named singular options are there, if so, use the data and delete them.
|
| 966 |
+
foreach (array_keys($this->options) as $opt) {
|
| 967 |
+
$old_opt = get_option('pf_' . $opt);
|
| 968 |
+
if ($old_opt !== false) {
|
| 969 |
+
$this->options[ $opt ] = $old_opt;
|
| 970 |
+
delete_option('pf_' . $opt);
|
| 971 |
+
}
|
| 972 |
+
}
|
| 973 |
+
|
| 974 |
+
// This should always be set to the latest immediately when defaults are pushed in.
|
| 975 |
+
$this->options['db_version'] = $this->db_version;
|
| 976 |
+
|
| 977 |
+
update_option($this->option_name, $this->options);
|
| 978 |
+
}
|
| 979 |
+
|
| 980 |
+
/**
|
| 981 |
+
* Upgrades the stored options, used to add new defaults if needed etc.
|
| 982 |
+
*
|
| 983 |
+
* @since 3.0
|
| 984 |
+
*/
|
| 985 |
+
function upgrade()
|
| 986 |
+
{
|
| 987 |
+
// update options to version 2
|
| 988 |
+
if ($this->options['db_version'] < 2) {
|
| 989 |
+
$additional_options = array(
|
| 990 |
+
'enable_css' => 'on',
|
| 991 |
+
'logo' => 'favicon',
|
| 992 |
+
'image_url' => '',
|
| 993 |
+
'tagline' => '',
|
| 994 |
+
'click_to_delete' => '0',
|
| 995 |
+
'password_protected' => 'no',
|
| 996 |
+
);
|
| 997 |
+
|
| 998 |
+
// correcting badly named option
|
| 999 |
+
if (isset($this->options['disable_css'])) {
|
| 1000 |
+
$additional_options['enable_css'] = $this->options['disable_css'];
|
| 1001 |
+
unset($this->options['disable_css']);
|
| 1002 |
+
}
|
| 1003 |
+
|
| 1004 |
+
// check whether image we do not list any more was used
|
| 1005 |
+
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'), true)) {
|
| 1006 |
+
// previous version had a bug with button name
|
| 1007 |
+
if (in_array($this->options['button_type'], array('pf_button_sq_qry_m.png', 'pf_button_sq_qry_l.png'), true)) {
|
| 1008 |
+
$this->options['button_type'] = str_replace('qry', 'gry', $this->options['button_type']);
|
| 1009 |
+
}
|
| 1010 |
+
|
| 1011 |
+
$image_address = 'https://cdn.printfriendly.com/' . $this->options['button_type'];
|
| 1012 |
+
$this->options['button_type'] = 'custom-image';
|
| 1013 |
+
$this->options['custom_text'] = '';
|
| 1014 |
+
$this->options['custom_image'] = $image_address;
|
| 1015 |
+
}
|
| 1016 |
+
|
| 1017 |
+
$this->options = array_merge($this->options, $additional_options);
|
| 1018 |
+
}
|
| 1019 |
+
|
| 1020 |
+
// update options to version 3
|
| 1021 |
+
if ($this->options['db_version'] < 3) {
|
| 1022 |
+
$old_show_on = $this->options['show_list'];
|
| 1023 |
+
// 'manual' setting
|
| 1024 |
+
$additional_options = array('custom_css_url' => '');
|
| 1025 |
+
|
| 1026 |
+
if ($old_show_on === 'all') {
|
| 1027 |
+
$additional_options = array(
|
| 1028 |
+
'show_on_pages' => 'on',
|
| 1029 |
+
'show_on_posts' => 'on',
|
| 1030 |
+
'show_on_homepage' => 'on',
|
| 1031 |
+
'show_on_categories' => 'on',
|
| 1032 |
+
'show_on_taxonomies' => 'on',
|
| 1033 |
+
);
|
| 1034 |
+
}
|
| 1035 |
+
|
| 1036 |
+
if ($old_show_on === 'single') {
|
| 1037 |
+
$additional_options = array(
|
| 1038 |
+
'show_on_pages' => 'on',
|
| 1039 |
+
'show_on_posts' => 'on',
|
| 1040 |
+
);
|
| 1041 |
+
}
|
| 1042 |
+
|
| 1043 |
+
if ($old_show_on === 'posts') {
|
| 1044 |
+
$additional_options = array(
|
| 1045 |
+
'show_on_posts' => 'on',
|
| 1046 |
+
);
|
| 1047 |
+
}
|
| 1048 |
+
|
| 1049 |
+
unset($this->options['show_list']);
|
| 1050 |
+
|
| 1051 |
+
$this->options = array_merge($this->options, $additional_options);
|
| 1052 |
+
}
|
| 1053 |
+
|
| 1054 |
+
// update options to version 4
|
| 1055 |
+
if ($this->options['db_version'] < 4) {
|
| 1056 |
+
$additional_options = array(
|
| 1057 |
+
'email' => '0',
|
| 1058 |
+
'pdf' => '0',
|
| 1059 |
+
'print' => '0',
|
| 1060 |
+
);
|
| 1061 |
+
|
| 1062 |
+
$this->options = array_merge($this->options, $additional_options);
|
| 1063 |
+
}
|
| 1064 |
+
|
| 1065 |
+
// update options to version 6
|
| 1066 |
+
// Replacement for db version 5 - should also be run for those already upgraded
|
| 1067 |
+
if ($this->options['db_version'] < 6) {
|
| 1068 |
+
unset($this->options['category_ids']);
|
| 1069 |
+
}
|
| 1070 |
+
|
| 1071 |
+
if ($this->options['db_version'] < 7) {
|
| 1072 |
+
$additional_options = array(
|
| 1073 |
+
'hide-images' => '0',
|
| 1074 |
+
'image-style' => 'right',
|
| 1075 |
+
);
|
| 1076 |
+
|
| 1077 |
+
$this->options = array_merge($this->options, $additional_options);
|
| 1078 |
+
}
|
| 1079 |
+
|
| 1080 |
+
if ($this->options['db_version'] < 8) {
|
| 1081 |
+
$this->options['enable_google_analytics'] = 'no';
|
| 1082 |
+
}
|
| 1083 |
+
|
| 1084 |
+
if ($this->options['db_version'] < 9) {
|
| 1085 |
+
$this->options['pf_algo'] = 'wp';
|
| 1086 |
+
}
|
| 1087 |
+
|
| 1088 |
+
if ($this->options['db_version'] < 10) {
|
| 1089 |
+
$this->options['enable_error_reporting'] = 'yes';
|
| 1090 |
+
}
|
| 1091 |
+
|
| 1092 |
+
if ($this->options['db_version'] < 11) {
|
| 1093 |
+
if (! isset($this->options['custom_css_url'])) {
|
| 1094 |
+
$this->options['custom_css_url'] = '';
|
| 1095 |
+
}
|
| 1096 |
+
}
|
| 1097 |
+
|
| 1098 |
+
if ($this->options['db_version'] < 12) {
|
| 1099 |
+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
| 1100 |
+
$this->options['images-size'] = $this->options['hide-images'] == '1' ? 'remove-images' : 'full-size';
|
| 1101 |
+
}
|
| 1102 |
+
|
| 1103 |
+
if ($this->options['db_version'] < 13) {
|
| 1104 |
+
switch ($this->options['button_type']) {
|
| 1105 |
+
case 'pf-button.gif':
|
| 1106 |
+
$this->options['button_type'] = 'buttons/printfriendly-button.png';
|
| 1107 |
+
break;
|
| 1108 |
+
case 'pf-button-both.gif':
|
| 1109 |
+
$this->options['button_type'] = 'buttons/printfriendly-pdf-button.png';
|
| 1110 |
+
break;
|
| 1111 |
+
case 'pf-button-big.gif':
|
| 1112 |
+
$this->options['button_type'] = 'buttons/printfriendly-button-lg.png';
|
| 1113 |
+
break;
|
| 1114 |
+
case 'pf-button-print-pdf-mail.png':
|
| 1115 |
+
$this->options['button_type'] = 'buttons/printfriendly-pdf-email-button-notext.png';
|
| 1116 |
+
break;
|
| 1117 |
+
case 'button-print-grnw20.png':
|
| 1118 |
+
$this->options['button_type'] = 'buttons/print-button.png';
|
| 1119 |
+
break;
|
| 1120 |
+
case 'button-print-blu20.png':
|
| 1121 |
+
$this->options['button_type'] = 'buttons/print-button-nobg.png';
|
| 1122 |
+
break;
|
| 1123 |
+
case 'button-print-gry20.png':
|
| 1124 |
+
$this->options['button_type'] = 'buttons/print-button-gray.png';
|
| 1125 |
+
break;
|
| 1126 |
+
case 'pf-icon-small.gif':
|
| 1127 |
+
case 'pf-icon.gif':
|
| 1128 |
+
$this->options['button_type'] = 'custom-button';
|
| 1129 |
+
$this->options['custom_button_icon'] = 'icons/printfriendly-icon-md.png';
|
| 1130 |
+
$this->options['custom_button_text'] = 'custom-text';
|
| 1131 |
+
$this->options['custom_image'] = 'icons/printfriendly-icon-md.png';
|
| 1132 |
+
break;
|
| 1133 |
+
case 'text-only':
|
| 1134 |
+
$this->options['button_type'] = 'custom-button';
|
| 1135 |
+
$this->options['custom_button_icon'] = 'no-image';
|
| 1136 |
+
$this->options['custom_button_text'] = 'custom-text';
|
| 1137 |
+
break;
|
| 1138 |
+
}
|
| 1139 |
+
}
|
| 1140 |
+
|
| 1141 |
+
if ($this->options['db_version'] < 14) {
|
| 1142 |
+
if ($this->options['button_type'] === 'pf-icon-both.gif') {
|
| 1143 |
+
$this->options['button_type'] = 'buttons/printfriendly-pdf-button-nobg.png';
|
| 1144 |
+
}
|
| 1145 |
+
}
|
| 1146 |
+
|
| 1147 |
+
if ($this->options['db_version'] < 15) {
|
| 1148 |
+
if ($this->options['button_type'] === 'custom-image') {
|
| 1149 |
+
$this->options['button_type'] = 'custom-button';
|
| 1150 |
+
|
| 1151 |
+
switch ($this->options['custom_image']) {
|
| 1152 |
+
case 'icons/printfriendly-icon-sm.png':
|
| 1153 |
+
case 'icons/printfriendly-icon-md.png':
|
| 1154 |
+
case 'icons/printfriendly-icon-lg.png':
|
| 1155 |
+
$this->options['custom_button_icon'] = $this->options['custom_image'];
|
| 1156 |
+
break;
|
| 1157 |
+
case '':
|
| 1158 |
+
$this->options['custom_button_icon'] = 'no-image';
|
| 1159 |
+
break;
|
| 1160 |
+
default:
|
| 1161 |
+
$this->options['custom_button_icon'] = 'custom-image';
|
| 1162 |
+
}
|
| 1163 |
+
|
| 1164 |
+
if ($this->options['custom_text'] === '') {
|
| 1165 |
+
$this->options['custom_button_text'] = 'no-text';
|
| 1166 |
+
} else {
|
| 1167 |
+
$this->options['custom_button_text'] = 'custom-text';
|
| 1168 |
+
}
|
| 1169 |
+
}
|
| 1170 |
+
}
|
| 1171 |
+
|
| 1172 |
+
if ($this->options['db_version'] < 16) {
|
| 1173 |
+
if ($this->options['custom_button_icon'] === 'icons/printfriendly-icon-md.png') {
|
| 1174 |
+
$this->options['custom_button_icon'] = 'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png';
|
| 1175 |
+
}
|
| 1176 |
+
}
|
| 1177 |
+
|
| 1178 |
+
if ($this->options['db_version'] < 17) {
|
| 1179 |
+
$this->options['pro_email'] = get_bloginfo('admin_email');
|
| 1180 |
+
|
| 1181 |
+
$url = get_bloginfo('url');
|
| 1182 |
+
$parsed_url = parse_url($url);
|
| 1183 |
+
$this->options['pro_domain'] = $parsed_url['host'];
|
| 1184 |
+
}
|
| 1185 |
+
|
| 1186 |
+
$this->options['db_version'] = $this->db_version;
|
| 1187 |
+
|
| 1188 |
+
update_option($this->option_name, $this->options);
|
| 1189 |
+
}
|
| 1190 |
+
|
| 1191 |
+
/**
|
| 1192 |
+
* Displays radio button in the admin area
|
| 1193 |
+
*
|
| 1194 |
+
* @since 3.0
|
| 1195 |
+
* @param string $name the name of the radio button to generate.
|
| 1196 |
+
* @param boolean $br whether or not to add an HTML <br> tag, defaults to true.
|
| 1197 |
+
* @param boolean $value if this is null, will have the same value as $name.
|
| 1198 |
+
*/
|
| 1199 |
+
function radio($name, $br = false, $value = null)
|
| 1200 |
+
{
|
| 1201 |
+
if (is_null($value)) {
|
| 1202 |
+
$value = $name;
|
| 1203 |
+
}
|
| 1204 |
+
|
| 1205 |
+
$var = '<input id="' . $name . '" class="radio" name="' . $this->option_name . '[button_type]" type="radio" value="' . $value . '" ' . $this->checked('button_type', $value, false) . '/>';
|
| 1206 |
+
$button = $this->button($name);
|
| 1207 |
+
if (! empty($button)) {
|
| 1208 |
+
echo '<label for="' . $name . '">' . $var . $button . '</label>';
|
| 1209 |
+
} else {
|
| 1210 |
+
echo $var;
|
| 1211 |
+
}
|
| 1212 |
+
|
| 1213 |
+
if ($br) {
|
| 1214 |
+
echo '<br>';
|
| 1215 |
+
}
|
| 1216 |
+
}
|
| 1217 |
+
|
| 1218 |
+
/**
|
| 1219 |
+
* Displays radio button in the admin area
|
| 1220 |
+
*
|
| 1221 |
+
* @since 3.12.0
|
| 1222 |
+
* @param string $value the value of the radio button to generate.
|
| 1223 |
+
*/
|
| 1224 |
+
function radio_custom_image($value)
|
| 1225 |
+
{
|
| 1226 |
+
$button = $this->button($value);
|
| 1227 |
+
$value = "https://cdn.printfriendly.com/{$value}";
|
| 1228 |
+
?>
|
| 1229 |
+
<label for="<?php echo esc_attr($value); ?>">
|
| 1230 |
+
<input type="radio" id="<?php echo esc_attr($value); ?>" name="<?php echo $this->option_name; ?>[custom_button_icon]" value="<?php echo $value; ?>" <?php $this->checked('custom_button_icon', $value); ?>>
|
| 1231 |
+
<?php echo $button; ?>
|
| 1232 |
+
</label>
|
| 1233 |
+
<?php
|
| 1234 |
+
}
|
| 1235 |
+
|
| 1236 |
+
/**
|
| 1237 |
+
* Displays button image in the admin area
|
| 1238 |
+
*
|
| 1239 |
+
* @since 3.0
|
| 1240 |
+
* @param string $name the name of the button to generate.
|
| 1241 |
+
*/
|
| 1242 |
+
function button($name = false)
|
| 1243 |
+
{
|
| 1244 |
+
if (! $name) {
|
| 1245 |
+
$name = $this->options['button_type'];
|
| 1246 |
+
}
|
| 1247 |
+
|
| 1248 |
+
$img_path = 'https://cdn.printfriendly.com/';
|
| 1249 |
+
|
| 1250 |
+
$return = '';
|
| 1251 |
+
|
| 1252 |
+
if ($name === 'custom-button') {
|
| 1253 |
+
if ($this->options['custom_button_icon'] === 'custom-image' && '' !== trim($this->options['custom_image'])) {
|
| 1254 |
+
$width = $this->options['custom_image_width'];
|
| 1255 |
+
$height = $this->options['custom_image_height'];
|
| 1256 |
+
$imgStyle = '';
|
| 1257 |
+
if (! empty($width)) {
|
| 1258 |
+
$imgStyle .= sprintf('width: %dpx;', $width);
|
| 1259 |
+
}
|
| 1260 |
+
if (! empty($height)) {
|
| 1261 |
+
$imgStyle .= sprintf('height: %dpx;', $height);
|
| 1262 |
+
}
|
| 1263 |
+
|
| 1264 |
+
$return = '<img src="' . esc_url($this->options['custom_image']) . '" alt="Print Friendly, PDF & Email" class="pf-button-img" style="' . $imgStyle . '" />';
|
| 1265 |
+
} elseif ($this->options['custom_button_icon'] !== 'no-image') {
|
| 1266 |
+
$icon = str_replace($img_path, '', $this->options['custom_button_icon']);
|
| 1267 |
+
$attributes = self::$_buttons[ $icon ];
|
| 1268 |
+
$atts = '';
|
| 1269 |
+
$width = $attributes['width'];
|
| 1270 |
+
$height = $attributes['height'];
|
| 1271 |
+
if (! empty($width)) {
|
| 1272 |
+
$imgStyle .= sprintf('width: %dpx;', $width);
|
| 1273 |
+
}
|
| 1274 |
+
if (! empty($height)) {
|
| 1275 |
+
$imgStyle .= sprintf('height: %dpx;', $height);
|
| 1276 |
+
}
|
| 1277 |
+
|
| 1278 |
+
$return = '<img src="' . esc_url($this->options['custom_button_icon']) . '" alt="Print Friendly, PDF & Email" class="pf-button-img" style="' . $imgStyle . '" />';
|
| 1279 |
+
}
|
| 1280 |
+
|
| 1281 |
+
/* esc_html was removerd to support custom html, CSRF prevents from attack by using this field */
|
| 1282 |
+
if ($this->options['custom_button_text'] === 'custom-text') {
|
| 1283 |
+
$return .= sprintf('<span id="printfriendly-text2" class="pf-button-text">%s</span>', esc_html($this->options['custom_text']));
|
| 1284 |
+
}
|
| 1285 |
+
|
| 1286 |
+
return $return;
|
| 1287 |
+
} elseif ($name === 'custom-btn') {
|
| 1288 |
+
return __('Custom Button', 'printfriendly');
|
| 1289 |
+
} else {
|
| 1290 |
+
$attributes = self::$_buttons[ $name ];
|
| 1291 |
+
$atts = '';
|
| 1292 |
+
$width = $attributes['width'];
|
| 1293 |
+
$height = $attributes['height'];
|
| 1294 |
+
if (! empty($width)) {
|
| 1295 |
+
$imgStyle .= sprintf('width: %dpx;', $width);
|
| 1296 |
+
}
|
| 1297 |
+
if (! empty($height)) {
|
| 1298 |
+
$imgStyle .= sprintf('height: %dpx;', $height);
|
| 1299 |
+
}
|
| 1300 |
+
|
| 1301 |
+
return '<img class="pf-button-img" src="' . $img_path . $name . '" alt="Print Friendly, PDF & Email" style="' . $imgStyle . '" />';
|
| 1302 |
+
}
|
| 1303 |
+
}
|
| 1304 |
+
|
| 1305 |
+
/**
|
| 1306 |
+
* Convenience function to output a value custom button preview elements
|
| 1307 |
+
*
|
| 1308 |
+
* @since 3.0.9
|
| 1309 |
+
*/
|
| 1310 |
+
function custom_button_preview()
|
| 1311 |
+
{
|
| 1312 |
+
$img = $url = $button_text = $style = $width = $height = '';
|
| 1313 |
+
switch ($this->options['custom_button_icon']) {
|
| 1314 |
+
case 'no-image':
|
| 1315 |
+
break;
|
| 1316 |
+
case 'custom-image':
|
| 1317 |
+
$url = $this->options['custom_image'];
|
| 1318 |
+
$width = $this->options['custom_image_width'];
|
| 1319 |
+
$height = $this->options['custom_image_height'];
|
| 1320 |
+
break;
|
| 1321 |
+
default:
|
| 1322 |
+
$url = $this->options['custom_button_icon'];
|
| 1323 |
+
break;
|
| 1324 |
+
}
|
| 1325 |
+
|
| 1326 |
+
if (! empty($url)) {
|
| 1327 |
+
$imgStyle = '';
|
| 1328 |
+
if (! empty($width)) {
|
| 1329 |
+
$imgStyle .= sprintf('width: %dpx;', $width);
|
| 1330 |
+
}
|
| 1331 |
+
if (! empty($height)) {
|
| 1332 |
+
$imgStyle .= sprintf('height: %dpx;', $height);
|
| 1333 |
+
}
|
| 1334 |
+
$img = sprintf('<img src="%s" style="%s" alt="Print Friendly, PDF & Email">', esc_url($url), $imgStyle);
|
| 1335 |
+
}
|
| 1336 |
+
|
| 1337 |
+
if ($this->options['custom_button_text'] !== 'no-text') {
|
| 1338 |
+
$button_text = $this->options['custom_text'];
|
| 1339 |
+
}
|
| 1340 |
+
|
| 1341 |
+
if ('' !== $this->options['text_color']) {
|
| 1342 |
+
$style .= 'color: ' . $this->options['text_color'] . ';';
|
| 1343 |
+
}
|
| 1344 |
+
|
| 1345 |
+
$button_preview = sprintf('<span><span id="pf-custom-button-preview" class="pf-button-img">%s</span><span id="printfriendly-text2" class="pf-button-text" style="%s">%s</span></span>', $img, $style, esc_html($button_text));
|
| 1346 |
+
|
| 1347 |
+
echo $button_preview;
|
| 1348 |
+
}
|
| 1349 |
+
|
| 1350 |
+
/**
|
| 1351 |
+
* Convenience function to output a value for an input
|
| 1352 |
+
*
|
| 1353 |
+
* @since 3.0
|
| 1354 |
+
* @param string $val value to check.
|
| 1355 |
+
*/
|
| 1356 |
+
function val($val, $echo = true, $default = null)
|
| 1357 |
+
{
|
| 1358 |
+
$value = '';
|
| 1359 |
+
if (isset($this->options[ $val ])) {
|
| 1360 |
+
$value = esc_attr($this->options[ $val ]);
|
| 1361 |
+
}
|
| 1362 |
+
|
| 1363 |
+
if (empty($value) && ! is_null($default)) {
|
| 1364 |
+
$value = $default;
|
| 1365 |
+
}
|
| 1366 |
+
|
| 1367 |
+
if ($echo) {
|
| 1368 |
+
echo $value;
|
| 1369 |
+
}
|
| 1370 |
+
return $value;
|
| 1371 |
+
}
|
| 1372 |
+
|
| 1373 |
+
|
| 1374 |
+
/**
|
| 1375 |
+
* Like the WordPress checked() function but it doesn't throw notices when the array key isn't set and uses the plugins options array.
|
| 1376 |
+
*
|
| 1377 |
+
* @since 3.0
|
| 1378 |
+
* @param mixed $val value to check.
|
| 1379 |
+
* @param mixed $check_against value to check against.
|
| 1380 |
+
* @param boolean $echo whether or not to echo the output.
|
| 1381 |
+
* @return string checked, when true, empty, when false.
|
| 1382 |
+
*/
|
| 1383 |
+
function checked($val, $check_against = true, $echo = true)
|
| 1384 |
+
{
|
| 1385 |
+
if (! isset($this->options[ $val ])) {
|
| 1386 |
+
return;
|
| 1387 |
+
}
|
| 1388 |
+
|
| 1389 |
+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
| 1390 |
+
if ($this->options[ $val ] == $check_against) {
|
| 1391 |
+
if ($echo) {
|
| 1392 |
+
echo ' checked="checked" ';
|
| 1393 |
+
} else {
|
| 1394 |
+
return ' checked="checked" ';
|
| 1395 |
+
}
|
| 1396 |
+
}
|
| 1397 |
+
}
|
| 1398 |
+
|
| 1399 |
+
/**
|
| 1400 |
+
* Helper for creating checkboxes.
|
| 1401 |
+
*
|
| 1402 |
+
* @since 3.1.5
|
| 1403 |
+
* @param string $name string used for various parts of checkbox.
|
| 1404 |
+
*/
|
| 1405 |
+
function create_checkbox($name, $label = '', $labelid = '')
|
| 1406 |
+
{
|
| 1407 |
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
|
| 1408 |
+
$label = ( ! empty($label) ? $label : __(ucfirst($name), 'printfriendly') );
|
| 1409 |
+
echo '<label' . ( ! empty($labelid) ? ' id=' . $labelid : '' ) . '><input type="checkbox" class="show_list" name="' . $this->option_name . '[show_on_' . $name . ']" value="on" ';
|
| 1410 |
+
$this->checked('show_on_' . $name, 'on');
|
| 1411 |
+
echo ' />' . $label . "</label>\r\n";
|
| 1412 |
+
}
|
| 1413 |
+
|
| 1414 |
+
|
| 1415 |
+
/**
|
| 1416 |
+
* Like the WordPress selected() function but it doesn't throw notices when the array key isn't set and uses the plugins options array.
|
| 1417 |
+
*
|
| 1418 |
+
* @since 3.0.9
|
| 1419 |
+
* @param mixed $val value to check.
|
| 1420 |
+
* @param mixed $check_against value to check against.
|
| 1421 |
+
* @return string checked, when true, empty, when false.
|
| 1422 |
+
*/
|
| 1423 |
+
function selected($val, $check_against = true)
|
| 1424 |
+
{
|
| 1425 |
+
if (! isset($this->options[ $val ])) {
|
| 1426 |
+
return;
|
| 1427 |
+
}
|
| 1428 |
+
|
| 1429 |
+
return selected($this->options[ $val ], $check_against);
|
| 1430 |
+
}
|
| 1431 |
+
|
| 1432 |
+
/**
|
| 1433 |
+
* For use with page metabox.
|
| 1434 |
+
*
|
| 1435 |
+
* @since 3.2.2
|
| 1436 |
+
*/
|
| 1437 |
+
function get_page_post_type()
|
| 1438 |
+
{
|
| 1439 |
+
$post_types = get_post_types(array('name' => 'page'), 'object');
|
| 1440 |
+
// echo '<pre>'.print_r($post_types,1).'</pre>';
|
| 1441 |
+
// die;
|
| 1442 |
+
|
| 1443 |
+
return $post_types['page'];
|
| 1444 |
+
}
|
| 1445 |
+
|
| 1446 |
+
|
| 1447 |
+
/**
|
| 1448 |
+
* Helper that checks if wp versions is above 3.0.
|
| 1449 |
+
*
|
| 1450 |
+
* @since 3.2.2
|
| 1451 |
+
* @return boolean true wp version is above 3.0
|
| 1452 |
+
*/
|
| 1453 |
+
function wp_version_gt30()
|
| 1454 |
+
{
|
| 1455 |
+
global $wp_version;
|
| 1456 |
+
return version_compare($wp_version, '3.0', '>=');
|
| 1457 |
+
}
|
| 1458 |
+
|
| 1459 |
+
|
| 1460 |
+
/**
|
| 1461 |
+
* Create box for picking individual categories.
|
| 1462 |
+
*
|
| 1463 |
+
* @since 3.2.2
|
| 1464 |
+
*/
|
| 1465 |
+
function create_category_metabox()
|
| 1466 |
+
{
|
| 1467 |
+
$obj = new stdClass();
|
| 1468 |
+
$obj->ID = 0;
|
| 1469 |
+
do_meta_boxes('settings_page_' . $this->hook, 'normal', $obj);
|
| 1470 |
+
}
|
| 1471 |
+
|
| 1472 |
+
|
| 1473 |
+
/**
|
| 1474 |
+
* Load metaboxes advanced button display settings.
|
| 1475 |
+
*
|
| 1476 |
+
* @since 3.2.2
|
| 1477 |
+
*/
|
| 1478 |
+
function on_load_printfriendly()
|
| 1479 |
+
{
|
| 1480 |
+
global $wp_version;
|
| 1481 |
+
if ($this->wp_version_gt30()) {
|
| 1482 |
+
// require_once(dirname(__FILE__).'/includes/meta-boxes.php');
|
| 1483 |
+
// require_once(dirname(__FILE__).''includes/nav-menu.php');
|
| 1484 |
+
wp_enqueue_script('post');
|
| 1485 |
+
|
| 1486 |
+
add_meta_box('categorydiv', __('Only display when post is in:', 'printfriendly'), 'post_categories_meta_box', 'settings_page_' . $this->hook, 'normal', 'core');
|
| 1487 |
+
}
|
| 1488 |
+
}
|
| 1489 |
+
|
| 1490 |
+
/**
|
| 1491 |
+
* Returns if the user is a pro user.
|
| 1492 |
+
*/
|
| 1493 |
+
function is_pro($feature = null)
|
| 1494 |
+
{
|
| 1495 |
+
$licensed = $this->val('license_status', false) === 'pro';
|
| 1496 |
+
|
| 1497 |
+
switch ($feature) {
|
| 1498 |
+
case 'custom-css':
|
| 1499 |
+
// custom css needs to be available for all irrespective of the license.
|
| 1500 |
+
return true;
|
| 1501 |
+
}
|
| 1502 |
+
|
| 1503 |
+
return $licensed;
|
| 1504 |
+
}
|
| 1505 |
+
|
| 1506 |
+
/**
|
| 1507 |
+
* Returns the custom css url.
|
| 1508 |
+
*/
|
| 1509 |
+
function get_custom_css()
|
| 1510 |
+
{
|
| 1511 |
+
// don't throw a PHP notice if custom_css_url is not defined.
|
| 1512 |
+
$css_url = isset($this->options['custom_css_url']) ? $this->options['custom_css_url'] : '';
|
| 1513 |
+
if (! $this->is_pro('custom-css')) {
|
| 1514 |
+
return $css_url;
|
| 1515 |
+
}
|
| 1516 |
+
|
| 1517 |
+
// upgrading from a version that was using urls instead of the textarea?
|
| 1518 |
+
if (! empty($css_url)) {
|
| 1519 |
+
return $css_url;
|
| 1520 |
+
}
|
| 1521 |
+
|
| 1522 |
+
// don't throw a PHP notice if custom_css_url_pro is not defined.
|
| 1523 |
+
$css_url = isset($this->options['custom_css_url_pro']) ? $this->options['custom_css_url_pro'] : '';
|
| 1524 |
+
if (empty($css_url)) {
|
| 1525 |
+
return null;
|
| 1526 |
+
}
|
| 1527 |
+
|
| 1528 |
+
$dirs = wp_get_upload_dir();
|
| 1529 |
+
|
| 1530 |
+
return $dirs['baseurl'] . '/' . $this->options['custom_css_url_pro'];
|
| 1531 |
+
}
|
| 1532 |
+
|
| 1533 |
+
/**
|
| 1534 |
+
* Generates the custom css file from the CSS block.
|
| 1535 |
+
*/
|
| 1536 |
+
function maybe_generate_custom_css_file($css)
|
| 1537 |
+
{
|
| 1538 |
+
$custom_css_old = html_entity_decode($this->val('custom_css', false));
|
| 1539 |
+
|
| 1540 |
+
// generate a new file if the CSS has changed.
|
| 1541 |
+
if ($custom_css_old === $css) {
|
| 1542 |
+
return false;
|
| 1543 |
+
}
|
| 1544 |
+
|
| 1545 |
+
$dirs = wp_get_upload_dir();
|
| 1546 |
+
|
| 1547 |
+
// delete old file, if it exists
|
| 1548 |
+
$file = $this->options['custom_css_url_pro'];
|
| 1549 |
+
if (! empty($file)) {
|
| 1550 |
+
wp_delete_file($dirs['basedir'] . '/' . $this->options['custom_css_url_pro']);
|
| 1551 |
+
}
|
| 1552 |
+
|
| 1553 |
+
// add a comment so that users know whence this file came.
|
| 1554 |
+
$date = date_i18n(get_option('date_format') . ' ' . get_option('time_format'));
|
| 1555 |
+
$comment = sprintf('/* DO NOT EDIT - FILE AUTO-GENERATED BY PRINTFRIENDLY v%s ON %s */', $this->plugin_version, $date);
|
| 1556 |
+
$css = $comment . PHP_EOL . PHP_EOL . $css;
|
| 1557 |
+
|
| 1558 |
+
// create new file, suffixed with the current time.
|
| 1559 |
+
$file = sprintf('%s_%s.css', $this->hook, time());
|
| 1560 |
+
require_once(ABSPATH . 'wp-admin/includes/file.php');
|
| 1561 |
+
WP_Filesystem();
|
| 1562 |
+
global $wp_filesystem;
|
| 1563 |
+
$wp_filesystem->put_contents(
|
| 1564 |
+
$dirs['basedir'] . '/' . $file,
|
| 1565 |
+
$css,
|
| 1566 |
+
FS_CHMOD_FILE
|
| 1567 |
+
);
|
| 1568 |
+
|
| 1569 |
+
// return the new file name
|
| 1570 |
+
return $file;
|
| 1571 |
+
}
|
| 1572 |
+
|
| 1573 |
+
/**
|
| 1574 |
+
* If upgrading from a previous version that was using urls instead of the textarea
|
| 1575 |
+
* it will return an appropriate message for the user.
|
| 1576 |
+
*/
|
| 1577 |
+
function get_custom_css_upgrade_message()
|
| 1578 |
+
{
|
| 1579 |
+
// upgrading from a version that was using urls instead of the textarea?
|
| 1580 |
+
if (isset($this->options['custom_css_url']) && ! empty($this->options['custom_css_url'])) {
|
| 1581 |
+
$css_url = $this->options['custom_css_url'];
|
| 1582 |
+
return sprintf(__('You are currently using %1$s%2$s%3$s. You can copy copy its contents into the textbox if you want to update the styles.', 'printfriendly'), '<a href="' . $css_url . '" target="_blank">', $css_url, '</a>');
|
| 1583 |
+
}
|
| 1584 |
+
|
| 1585 |
+
return null;
|
| 1586 |
+
}
|
| 1587 |
+
|
| 1588 |
+
/**
|
| 1589 |
+
* Output the config page
|
| 1590 |
+
*
|
| 1591 |
+
* @since 3.0
|
| 1592 |
+
*/
|
| 1593 |
+
function config_page()
|
| 1594 |
+
{
|
| 1595 |
+
|
| 1596 |
+
// 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.
|
| 1597 |
+
global $wp_version;
|
| 1598 |
+
if (version_compare($wp_version, '3.2', '<') && $this->wp_version_gt30()) {
|
| 1599 |
+
settings_errors();
|
| 1600 |
+
}
|
| 1601 |
+
|
| 1602 |
+
$customCssOptionCode = $this->getSelectorsFromCustomCSS();
|
| 1603 |
+
include_once PRINTFRIENDLY_BASEPATH . '/views/settings.php';
|
| 1604 |
+
}
|
| 1605 |
+
|
| 1606 |
+
/**
|
| 1607 |
+
* Returns the current tab to activate.
|
| 1608 |
+
*
|
| 1609 |
+
* @since 4.0.1
|
| 1610 |
+
*/
|
| 1611 |
+
function is_tab($tab_id)
|
| 1612 |
+
{
|
| 1613 |
+
$tab = get_transient('pf-tab');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1614 |
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
| 1615 |
+
return empty($tab) && $tab_id == 0 ? true : $tab == $tab_id;
|
| 1616 |
+
}
|
| 1617 |
+
}
|
| 1618 |
+
$printfriendly = new PrintFriendly_WordPress();
|
|
|
|
| 1619 |
}
|
| 1620 |
|
| 1621 |
// Add shortcode for printfriendly button
|
| 1622 |
+
add_shortcode(
|
| 1623 |
+
'printfriendly',
|
| 1624 |
+
/**
|
| 1625 |
+
* Show the printfriendly button.
|
| 1626 |
+
*
|
| 1627 |
+
* @param array $atts The attributes of the shortcode.
|
| 1628 |
+
* If current="yes", the whole page will be printed (pf_current_page_button is called).
|
| 1629 |
+
* The default behaviour is to call pf_default_button.
|
| 1630 |
+
*
|
| 1631 |
+
* @since 3.0
|
| 1632 |
+
*
|
| 1633 |
+
* @return string The button.
|
| 1634 |
+
*/
|
| 1635 |
+
function ($atts) {
|
| 1636 |
+
$atts = shortcode_atts(array(
|
| 1637 |
+
'current' => '', // yes => print the whole page
|
| 1638 |
+
), $atts, 'printfriendly');
|
| 1639 |
+
|
| 1640 |
+
if (empty($atts['current'])) {
|
| 1641 |
+
return pf_default_button();
|
| 1642 |
+
} else {
|
| 1643 |
+
return pf_current_page_button();
|
| 1644 |
+
}
|
| 1645 |
+
|
| 1646 |
+
return null;
|
| 1647 |
+
}
|
| 1648 |
+
);
|
| 1649 |
+
|
| 1650 |
|
| 1651 |
/**
|
| 1652 |
* Convenience function for use in templates.
|
| 1653 |
*
|
| 1654 |
+
* @deprecated Use pf_default_button instead.
|
| 1655 |
+
*
|
| 1656 |
* @since 3.0
|
| 1657 |
+
*
|
| 1658 |
+
* @return string returns a button to be printed.
|
| 1659 |
+
*/
|
| 1660 |
+
function pf_show_link()
|
| 1661 |
+
{
|
| 1662 |
+
return pf_default_button();
|
| 1663 |
+
}
|
| 1664 |
+
|
| 1665 |
+
/**
|
| 1666 |
+
* Convenience function for use in templates.
|
| 1667 |
+
*
|
| 1668 |
+
* @since 5.1
|
| 1669 |
+
*
|
| 1670 |
* @return string returns a button to be printed.
|
| 1671 |
*/
|
| 1672 |
+
function pf_default_button()
|
| 1673 |
+
{
|
| 1674 |
+
global $printfriendly;
|
| 1675 |
+
return $printfriendly->getButton(true);
|
| 1676 |
+
}
|
| 1677 |
+
|
| 1678 |
+
/**
|
| 1679 |
+
* Convenience function for use in templates.
|
| 1680 |
+
*
|
| 1681 |
+
* @since 5.1
|
| 1682 |
+
*
|
| 1683 |
+
* @return string returns a button that prints the entire page it is on.
|
| 1684 |
+
*/
|
| 1685 |
+
function pf_current_page_button()
|
| 1686 |
+
{
|
| 1687 |
+
global $printfriendly;
|
| 1688 |
+
return $printfriendly->getButton(true, '', true);
|
| 1689 |
}
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: printfriendly, joostdevalk, jrf, rozroz
|
|
| 3 |
Tags: print, pdf, email, woocommerce print, woocommerce pdf, print plugin, print button, pdf plugin, pdf button
|
| 4 |
Requires at least: 4.9
|
| 5 |
Tested up to: 5.8
|
| 6 |
-
Stable tag: 5.
|
| 7 |
|
| 8 |
|
| 9 |
The #1 Print, PDF, Email button. Stylish, full featured, customizable. Add custom header, footer, and more.
|
|
@@ -144,6 +144,10 @@ You can [hide the Print, PDF, and Email button](https://support.printfriendly.co
|
|
| 144 |
|
| 145 |
== Changelog ==
|
| 146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
= 5.0 =
|
| 148 |
* Add support for custom CSS selectors
|
| 149 |
* Improve the settings UI
|
| 3 |
Tags: print, pdf, email, woocommerce print, woocommerce pdf, print plugin, print button, pdf plugin, pdf button
|
| 4 |
Requires at least: 4.9
|
| 5 |
Tested up to: 5.8
|
| 6 |
+
Stable tag: 5.1
|
| 7 |
|
| 8 |
|
| 9 |
The #1 Print, PDF, Email button. Stylish, full featured, customizable. Add custom header, footer, and more.
|
| 144 |
|
| 145 |
== Changelog ==
|
| 146 |
|
| 147 |
+
= 5.1 =
|
| 148 |
+
* In category pages, the default behaviour of button added by shortcode/template is to link to a printable version of the individual posts. Sometimes, it is desirable to print the category page itself and not the individual posts. Added new template function/shortcode to always print the current page to use in this scenario.
|
| 149 |
+
* Add support for newer google analytics versions and google tag manager
|
| 150 |
+
|
| 151 |
= 5.0 =
|
| 152 |
* Add support for custom CSS selectors
|
| 153 |
* Improve the settings UI
|
uninstall.php
CHANGED
|
@@ -1,22 +1,22 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
if (
|
| 4 |
-
|
| 5 |
}
|
| 6 |
|
| 7 |
-
delete_option(
|
| 8 |
|
| 9 |
// Make sure any old options which may still lurking about get deleted as well
|
| 10 |
-
delete_option(
|
| 11 |
-
delete_option(
|
| 12 |
-
delete_option(
|
| 13 |
-
delete_option(
|
| 14 |
-
delete_option(
|
| 15 |
-
delete_option(
|
| 16 |
-
delete_option(
|
| 17 |
-
delete_option(
|
| 18 |
-
delete_option(
|
| 19 |
-
delete_option(
|
| 20 |
-
delete_option(
|
| 21 |
-
delete_option(
|
| 22 |
-
delete_option(
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
if (! defined('ABSPATH') && ! defined('WP_UNINSTALL_PLUGIN')) {
|
| 4 |
+
exit();
|
| 5 |
}
|
| 6 |
|
| 7 |
+
delete_option('printfriendly_option');
|
| 8 |
|
| 9 |
// Make sure any old options which may still lurking about get deleted as well
|
| 10 |
+
delete_option('pf_button_type');
|
| 11 |
+
delete_option('pf_custom_image');
|
| 12 |
+
delete_option('pf_custom_text');
|
| 13 |
+
delete_option('pf_custom_both');
|
| 14 |
+
delete_option('pf_show_list');
|
| 15 |
+
delete_option('pf_content_placement');
|
| 16 |
+
delete_option('pf_content_position');
|
| 17 |
+
delete_option('pf_margin_top');
|
| 18 |
+
delete_option('pf_margin_right');
|
| 19 |
+
delete_option('pf_margin_bottom');
|
| 20 |
+
delete_option('pf_margin_left');
|
| 21 |
+
delete_option('pf_text_color');
|
| 22 |
+
delete_option('pf_text_size');
|
views/pro.php
CHANGED
|
@@ -1,84 +1,84 @@
|
|
| 1 |
<?php
|
| 2 |
-
$urlInfo = parse_url(
|
| 3 |
-
$domain = ( isset(
|
| 4 |
|
| 5 |
// don't throw a PHP notice if license_date is not defined
|
| 6 |
-
$license_date = isset(
|
| 7 |
|
| 8 |
-
if (
|
| 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 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 1 |
<?php
|
| 2 |
+
$urlInfo = parse_url(get_option('siteurl'));
|
| 3 |
+
$domain = ( isset($urlInfo['host']) ? $urlInfo['host'] : '' );
|
| 4 |
|
| 5 |
// don't throw a PHP notice if license_date is not defined
|
| 6 |
+
$license_date = isset($this->options['license_date']) ? $this->options['license_date'] : '';
|
| 7 |
|
| 8 |
+
if (! empty($license_date)) {
|
| 9 |
+
$license_date = date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $license_date / 1000 + get_option('gmt_offset') * HOUR_IN_SECONDS);
|
| 10 |
}
|
| 11 |
|
| 12 |
?>
|
| 13 |
+
<div class="pf-bu-block pf-bu-card">
|
| 14 |
+
<div class="pf-bu-card-content">
|
| 15 |
|
| 16 |
+
<div id="pf-pro" class="pf-notice pf-pro">
|
| 17 |
+
<h3 style="margin: 1rem 0 0 0">Pro - <span id="pf-pro-status-header"></span></h3>
|
| 18 |
+
<p class="pf-alert-success">PrintFriendly is <strong>GDPR Compliant</strong> <a href="https://www.printfriendly.com/privacy" target="_blank"><?php _e('Learn more', 'printfriendly'); ?></a>.
|
| 19 |
|
| 20 |
+
</p>
|
| 21 |
+
<div class="pf-col-1 ">
|
| 22 |
+
<?php
|
| 23 |
+
if (! ( empty($this->val('pro_email', false)) && in_array($this->val('license_status', false), array( 'pro' ), true) )) {
|
| 24 |
+
$email = $this->val('pro_email', false);
|
| 25 |
+
if (empty($email)) {
|
| 26 |
+
$email = get_option('admin_email');
|
| 27 |
+
}
|
| 28 |
+
?>
|
| 29 |
+
<label class="pf-no-margin">
|
| 30 |
+
<strong><?php _e('Email', 'printfriendly'); ?></strong><span class="description">(<?php _e('To send account details', 'printfriendly'); ?>)</span><br>
|
| 31 |
+
<input id="pf-pro-email" type="email" class="regular-text" maxlength="80" name="<?php echo $this->option_name; ?>[pro_email]" value="<?php echo $email; ?>" placeholder="hello@my-website.com" />
|
| 32 |
+
<br>
|
| 33 |
+
<span id="pf-pro-email-error" class="pf-error"><?php _e('Email is invalid', 'printfriendly'); ?></span>
|
| 34 |
+
</label>
|
| 35 |
+
<?php } ?>
|
| 36 |
|
| 37 |
+
<label>
|
| 38 |
+
<strong><?php _e('Website Domain', 'printfriendly'); ?></strong><br/>
|
| 39 |
+
<input id="pf-pro-domain" type="text" class="regular-text" readonly name="<?php echo $this->option_name; ?>[pro_domain]" value="<?php echo $domain; ?>" />
|
| 40 |
+
<br />
|
| 41 |
+
<span id="pf-pro-domain-error" class="pf-error"><?php _e('Domain is invalid', 'printfriendly'); ?></span>
|
| 42 |
+
</label>
|
| 43 |
|
| 44 |
+
<p id="pf-pro-activate" class="pf-hidden">
|
| 45 |
+
<button id="pf-pro-activate-btn" type="button" class="button-primary"><?php _e('Activate', 'printfriendly'); ?></button>
|
| 46 |
+
<span class="pf-btn-message"><?php _e('Free 30 days trial, no credit card required.', 'printfriendly'); ?></span>
|
| 47 |
+
</p>
|
| 48 |
|
| 49 |
+
<p id="pf-pro-buy" class="pf-hidden">
|
| 50 |
+
<a id="pf-pro-buy-btn" class="button-primary"><?php _e('Buy Now', 'printfriendly'); ?></a>
|
| 51 |
+
<span id="pf-pro-status-message" class="pf-btn-message"></span>
|
| 52 |
+
</p>
|
| 53 |
|
| 54 |
+
<p id="pf-pro-details" class="pf-hidden">
|
| 55 |
+
<span class="pf-btn-message"><?php _e('Last Checked', 'printfriendly'); ?>: <?php echo $license_date; ?></span>
|
| 56 |
+
<input type="hidden" name="<?php echo $this->option_name; ?>[license_status]" id="license_status">
|
| 57 |
+
<input type="hidden" name="<?php echo $this->option_name; ?>[license_date]" id="license_date">
|
| 58 |
+
</p>
|
| 59 |
|
| 60 |
+
<p id="pf-pro-loading" class="pf-hidden">
|
| 61 |
+
<b class="pf-text-success"><span id="pf-pro-loading-message"></span><?php _e('Please wait', 'printfriendly'); ?>...</b>
|
| 62 |
+
</p>
|
| 63 |
|
| 64 |
+
<p id="pf-pro-communication-error" class="pf-hidden">
|
| 65 |
+
<b class="pf-text-error"><span id="pf-pro-communication-error-message"></span></b>
|
| 66 |
+
</p>
|
| 67 |
+
</div>
|
| 68 |
|
| 69 |
+
<div class="pf-col-2 pf-pro-features">
|
| 70 |
+
<strong><?php _e('Pro Features', 'printfriendly'); ?></strong>
|
| 71 |
+
<ol>
|
| 72 |
+
<li><?php _e('Faster, better experience for end-user', 'printfriendly'); ?></li>
|
| 73 |
+
<li><?php _e('Cache-free, so any updates are instantly included', 'printfriendly'); ?></li>
|
| 74 |
+
<li><?php _e('Ad-Free for companies and organizations', 'printfriendly'); ?></li>
|
| 75 |
+
<li><?php _e('Works on all sites (Password protected, Angular/React/Ember)', 'printfriendly'); ?></li>
|
| 76 |
+
<li><?php _e('Email support', 'printfriendly'); ?></li>
|
| 77 |
+
</ol>
|
| 78 |
+
<p><?php _e('Have a development/staging domain?', 'printfriendly'); ?> <a href="https://support.printfriendly.com/button/pro/development-domain/" target="_blank"><?php _e('Add Free Development Domain', 'printfriendly'); ?></a>.</p>
|
| 79 |
+
</div>
|
| 80 |
+
<br />
|
| 81 |
+
</div>
|
| 82 |
|
| 83 |
+
</div>
|
| 84 |
+
</div>
|
views/settings.php
CHANGED
|
@@ -1,26 +1,26 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
|
| 9 |
-
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 1 |
+
<div id="pf_settings" class="wrap">
|
| 2 |
+
|
| 3 |
+
<h2><img src="<?php echo PRINTFRIENDLY_BASEURL . '/assets/images/pf-icon.png'; ?>"><?php _e('Print Friendly & PDF Settings', 'printfriendly'); ?></h2>
|
| 4 |
|
| 5 |
+
<form id="pf-options-form" action="options.php" method="post">
|
| 6 |
+
<?php wp_nonce_field('pf-options', 'pf-nonce'); ?>
|
| 7 |
+
<?php settings_fields($this->option_name); ?>
|
| 8 |
|
| 9 |
+
<?php include_once PRINTFRIENDLY_BASEPATH . '/views/tabs.php'; ?>
|
| 10 |
|
| 11 |
+
<input type="hidden" name="tab" id="current-tab" value="<?php echo get_transient('pf-tab'); ?>">
|
| 12 |
|
| 13 |
+
<footer id="after-submit" class="pf-bu-footer">
|
| 14 |
+
<div class="pf-bu-content pf-bu-has-text-centered">
|
| 15 |
+
<p>
|
| 16 |
+
<?php echo sprintf(__('If you like <strong>PrintFriendly</strong> please leave us a %s rating. A huge thanks in advance!', 'printfriendly'), '<a href="https://wordpress.org/support/plugin/printfriendly/reviews?rate=5#new-post" target="_blank">★★★★★</a>'); ?>
|
| 17 |
+
</p>
|
| 18 |
+
<p><?php _e('Need professional options for your corporate, education, or agency developed website? Check out', 'printfriendly'); ?> <a href="https://www.printfriendly.com/button/pro?utm_source=wp&utm_medium=link&utm_campaign=wp-link" target="_blank">PrintFriendly Pro</a>.</p>
|
| 19 |
+
<p>
|
| 20 |
+
<?php _e('Need help or have suggestions?', 'printfriendly'); ?> <a href="mailto:support@printfriendly.com?subject=Support%20for%20PrintFriendly%20WordPress%20plugin">support@PrintFriendly.com</a>
|
| 21 |
+
</p>
|
| 22 |
+
</div>
|
| 23 |
+
</footer>
|
| 24 |
|
| 25 |
+
</form>
|
| 26 |
+
</div>
|
views/tabs.php
CHANGED
|
@@ -1,585 +1,635 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 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 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div id="pf-tabs">
|
| 2 |
+
<div class="pf-bu-tabs pf-bu-is-centered">
|
| 3 |
+
<ul>
|
| 4 |
+
<li class="<?php echo $this->is_tab(0) ? 'pf-bu-is-active' : ''; ?>" data-id="0"><a href="#tab-standard"><?php _e('Standard', 'printfriendly'); ?></a></li>
|
| 5 |
+
<li class="<?php echo $this->is_tab(1) ? 'pf-bu-is-active' : ''; ?>" data-id="1"><a href="#tab-advanced"><?php _e('Advanced', 'printfriendly'); ?></a></li>
|
| 6 |
+
<?php if (WP_DEBUG) { ?>
|
| 7 |
+
<li><a href="#tab-debug"><?php _e('Debug', 'printfriendly'); ?></a></li>
|
| 8 |
+
<?php } ?>
|
| 9 |
+
</ul>
|
| 10 |
+
</div>
|
| 11 |
+
|
| 12 |
+
<section id="tab-standard">
|
| 13 |
+
<div class="pf-bu-container">
|
| 14 |
+
|
| 15 |
+
<?php include_once PRINTFRIENDLY_BASEPATH . '/views/pro.php'; ?>
|
| 16 |
+
|
| 17 |
+
<div class="pf-bu-block pf-bu-card">
|
| 18 |
+
<header class="pf-bu-card-header">
|
| 19 |
+
<p class="pf-bu-card-header-title">
|
| 20 |
+
<?php _e('Select content using', 'printfriendly'); ?>
|
| 21 |
+
</p>
|
| 22 |
+
</header>
|
| 23 |
+
|
| 24 |
+
<div class="pf-bu-card-content">
|
| 25 |
+
<?php
|
| 26 |
+
$disabled = $message = '';
|
| 27 |
+
if (class_exists('WooCommerce')) {
|
| 28 |
+
$disabled = 'disabled';
|
| 29 |
+
$message = '(' . __('Not available for WooCommerce', 'printfriendly') . ')';
|
| 30 |
+
}
|
| 31 |
+
?>
|
| 32 |
+
|
| 33 |
+
<div>
|
| 34 |
+
<div>
|
| 35 |
+
<label for="pf-algo-wp">
|
| 36 |
+
<input id="pf-algo-wp" type="radio" name="<?php echo $this->option_name; ?>[pf_algo]" value="wp" <?php echo $this->options['pf_algo'] === 'wp' ? 'checked' : ''; ?> <?php echo $disabled; ?>>
|
| 37 |
+
<?php _e('WP Template', 'printfriendly'); ?> <?php echo $message; ?>
|
| 38 |
+
</label>
|
| 39 |
+
</div>
|
| 40 |
+
|
| 41 |
+
<div>
|
| 42 |
+
<label for="pf-algo-pf">
|
| 43 |
+
<input id="pf-algo-pf" type="radio" name="<?php echo $this->option_name; ?>[pf_algo]" value="pf" <?php echo $this->options['pf_algo'] === 'pf' ? 'checked' : ''; ?>>
|
| 44 |
+
<?php _e('Content Algorithm', 'printfriendly'); ?>
|
| 45 |
+
</label>
|
| 46 |
+
</div>
|
| 47 |
+
|
| 48 |
+
<div>
|
| 49 |
+
<label for="pf-algo-css">
|
| 50 |
+
<input id="pf-algo-css" type="radio" name="<?php echo $this->option_name; ?>[pf_algo]" value="css" <?php echo $this->options['pf_algo'] === 'css' ? 'checked' : ''; ?>>
|
| 51 |
+
<?php _e('Custom CSS Selectors', 'printfriendly'); ?>
|
| 52 |
+
</label>
|
| 53 |
+
<div class="pf-algo-usage pf-algo-usage-css" style="display: none" data-tag-template="<?php echo esc_attr('<printfriendly-options data-selectors="#1" data-fallback-strategy="#2"></printfriendly-options>'); ?>">
|
| 54 |
+
<div class="pf-bu-columns">
|
| 55 |
+
<div class="pf-bu-column pf-bu-one-sixth pf-algo-usage-css-fields">
|
| 56 |
+
<div>
|
| 57 |
+
<label for="pf-algo-usage-css-author"><?php _e('Author Selector', 'printfriendly'); ?></label>
|
| 58 |
+
<input type="text" id="pf-algo-usage-css-author" name="<?php echo $this->option_name; ?>[css-author]" value="<?php $this->val('css-author'); ?>" data-selector-name="authorSelector">
|
| 59 |
+
</div>
|
| 60 |
+
<div>
|
| 61 |
+
<label for="pf-algo-usage-css-content"><?php _e('Content Selector', 'printfriendly'); ?></label>
|
| 62 |
+
<input type="text" id="pf-algo-usage-css-content" name="<?php echo $this->option_name; ?>[css-content]" value="<?php $this->val('css-content'); ?>" data-selector-name="contentSelectors">
|
| 63 |
+
</div>
|
| 64 |
+
<div>
|
| 65 |
+
<label for="pf-algo-usage-css-date"><?php _e('Date Selector', 'printfriendly'); ?></label>
|
| 66 |
+
<input type="text" id="pf-algo-usage-css-date" name="<?php echo $this->option_name; ?>[css-date]" value="<?php $this->val('css-date'); ?>" data-selector-name="dateSelector">
|
| 67 |
+
</div>
|
| 68 |
+
<div>
|
| 69 |
+
<label for="pf-algo-usage-css-title"><?php _e('Title Selector', 'printfriendly'); ?></label>
|
| 70 |
+
<input type="text" id="pf-algo-usage-css-title" name="<?php echo $this->option_name; ?>[css-title]" value="<?php $this->val('css-title'); ?>" data-selector-name="titleSelector">
|
| 71 |
+
</div>
|
| 72 |
+
<div>
|
| 73 |
+
<label for="pf-algo-usage-css-image"><?php _e('Image Selector', 'printfriendly'); ?></label>
|
| 74 |
+
<input type="text" id="pf-algo-usage-css-image" name="<?php echo $this->option_name; ?>[css-primaryImage]" value="<?php $this->val('css-primaryImage'); ?>" data-selector-name="primaryImageSelector">
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
<div class="pf-bu-column pf-bu-one-sixth pf-algo-usage-css-strategy">
|
| 78 |
+
<label><?php _e('Content Fallback Strategy', 'printfriendly'); ?></label>
|
| 79 |
+
<label>
|
| 80 |
+
<input type="radio" id="pf_algo_css_fallback_original" name="<?php echo $this->option_name; ?>[pf_algo_css_content]" value="original" <?php echo ( empty($this->options['pf_algo_css_content']) || $this->options['pf_algo_css_content'] === 'original' ) ? 'checked' : ''; ?>>
|
| 81 |
+
<?php _e('Use existing rules to find content', 'printfriendly'); ?>
|
| 82 |
+
</label>
|
| 83 |
+
<label>
|
| 84 |
+
<input type="radio" id="pf_algo_css_fallback_error" name="<?php echo $this->option_name; ?>[pf_algo_css_content]" value="error-message" <?php echo $this->options['pf_algo_css_content'] === 'error-message' ? 'checked' : ''; ?>>
|
| 85 |
+
<?php _e('Show an error message', 'printfriendly'); ?>
|
| 86 |
+
</label>
|
| 87 |
+
<p class="description">
|
| 88 |
+
<?php _e('This setting can be used to configure the behaviour of the plugin, when content CSS selector does not match any content.', 'printfriendly'); ?>
|
| 89 |
+
<br/>
|
| 90 |
+
<?php _e('We recommend setting this to "Use existing rules to find content" in production and to "Show an error message" in development.', 'printfriendly'); ?></p>
|
| 91 |
+
<div class="pf-bu-mt-5"></div>
|
| 92 |
+
<div class="pf-accordion">
|
| 93 |
+
<label><?php _e('Show Options Code', 'printfriendly'); ?></label>
|
| 94 |
+
<div>
|
| 95 |
+
<code class="pf-custom-css-code"><?php echo esc_html($customCssOptionCode); ?></code>
|
| 96 |
+
<a class="pf-clipboard pf-custom-css-code-snippet" href="javascript:;" data-clipboard-text="<?php echo esc_attr($customCssOptionCode); ?>"><span class="pf-bu-tag pf-bu-is-info pf-bu-is-light"><?php _e('Copy Code', 'printfriendly'); ?></span></a>
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
</div>
|
| 100 |
+
</div>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
|
| 106 |
+
<div class="pf-bu-card-footer">
|
| 107 |
+
<p class="pf-bu-card-footer-item"><?php _e('Change this setting if your content is not showing in the preview.', 'printfriendly'); ?></p>
|
| 108 |
+
<p class="pf-bu-card-footer-item"><a href="https://printfriendly.freshdesk.com/support/solutions/articles/69000080285-page-content-not-selected" target="_new"><?php _e('Documentation', 'printfriendly'); ?></a></p>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
|
| 112 |
+
<div class="pf-bu-block pf-bu-card">
|
| 113 |
+
<header class="pf-bu-card-header">
|
| 114 |
+
<p class="pf-bu-card-header-title">
|
| 115 |
+
<?php _e('Button Style', 'printfriendly'); ?>
|
| 116 |
+
</p>
|
| 117 |
+
</header>
|
| 118 |
+
|
| 119 |
+
<div class="pf-bu-card-content">
|
| 120 |
+
|
| 121 |
+
<div class="pf-bu-columns pf-bu-is-multiline" id="button-style">
|
| 122 |
+
<?php
|
| 123 |
+
// if any images are added here, add to $__buttons tooo
|
| 124 |
+
$buttons = array(
|
| 125 |
+
'buttongroup1' => array(
|
| 126 |
+
'printfriendly-pdf-email-button.png',
|
| 127 |
+
'printfriendly-pdf-email-button-md.png',
|
| 128 |
+
'printfriendly-pdf-email-button-notext.png',
|
| 129 |
+
),
|
| 130 |
+
'buttongroup2' => array(
|
| 131 |
+
'printfriendly-pdf-button.png',
|
| 132 |
+
'printfriendly-pdf-button-nobg.png',
|
| 133 |
+
'printfriendly-pdf-button-nobg-md.png',
|
| 134 |
+
),
|
| 135 |
+
'buttongroup3' => array(
|
| 136 |
+
'printfriendly-button.png',
|
| 137 |
+
'printfriendly-button-nobg.png',
|
| 138 |
+
'printfriendly-button-md.png',
|
| 139 |
+
'printfriendly-button-lg.png',
|
| 140 |
+
),
|
| 141 |
+
'buttongroup4' => array(
|
| 142 |
+
'print-button.png',
|
| 143 |
+
'print-button-nobg.png',
|
| 144 |
+
'print-button-gray.png',
|
| 145 |
+
),
|
| 146 |
+
);
|
| 147 |
+
|
| 148 |
+
foreach ($buttons as $class => $array) {
|
| 149 |
+
foreach ($array as $button) {
|
| 150 |
+
?>
|
| 151 |
+
<div class="pf-bu-column pf-bu-is-one-quarter">
|
| 152 |
+
<?php $this->radio('buttons/' . $button); ?>
|
| 153 |
+
</div>
|
| 154 |
+
<?php
|
| 155 |
+
}
|
| 156 |
+
}
|
| 157 |
+
?>
|
| 158 |
+
|
| 159 |
+
</div>
|
| 160 |
+
|
| 161 |
+
<div class="pf-bu-columns">
|
| 162 |
+
<div class="pf-bu-column">
|
| 163 |
+
<label>
|
| 164 |
+
<input id="custom-btn" class="radio" name="<?php echo $this->option_name; ?>[button_type]" type="radio" value="custom-button" <?php echo $this->checked('button_type', 'custom-button', false); ?> >
|
| 165 |
+
<?php _e('Custom Button', 'printfriendly'); ?>
|
| 166 |
+
</label>
|
| 167 |
+
|
| 168 |
+
<div class="pf-bu-tile pf-bu-is-ancestor">
|
| 169 |
+
<div class="custom-btn pf-bu-tile pf-bu-is-4 pf-bu-is-flex-direction-column" id="custom-img">
|
| 170 |
+
<h2><?php _e('Image', 'printfriendly'); ?></h2>
|
| 171 |
+
<?php
|
| 172 |
+
// if any images are added here, add to $__buttons tooo
|
| 173 |
+
$icons = array(
|
| 174 |
+
'icons/printfriendly-icon-sm.png',
|
| 175 |
+
'icons/printfriendly-icon-md.png',
|
| 176 |
+
'icons/printfriendly-icon-lg.png',
|
| 177 |
+
);
|
| 178 |
+
foreach ($icons as $icon) {
|
| 179 |
+
$this->radio_custom_image($icon);
|
| 180 |
+
}
|
| 181 |
+
?>
|
| 182 |
+
<label for="custom-image-rb" class="radio-custom-btn">
|
| 183 |
+
<input id="custom-image-rb" type="radio" name="<?php echo $this->option_name; ?>[custom_button_icon]" value="custom-image" <?php $this->checked('custom_button_icon', 'custom-image'); ?>>
|
| 184 |
+
<?php _e('Use Your Image', 'printfriendly'); ?>
|
| 185 |
+
|
| 186 |
+
<div id="enter-image-url">
|
| 187 |
+
<input type="button" class="pf_upload_image_button button button-secondary" data-pf-element="#custom_image" value="<?php _e('Select Image', 'printfriendly'); ?>">
|
| 188 |
+
<input id="custom_image" type="hidden" name="<?php echo $this->option_name; ?>[custom_image]" value="<?php $this->val('custom_image'); ?>" />
|
| 189 |
+
<span id="custom_image_label">
|
| 190 |
+
<?php if (! empty($this->val('custom_image', false))) { ?>
|
| 191 |
+
<img src="<?php $this->val('custom_image'); ?>">
|
| 192 |
+
<?php } ?>
|
| 193 |
+
</span>
|
| 194 |
+
<div id="custom-img-sizes">
|
| 195 |
+
<?php _e('Width', 'printfriendly'); ?>
|
| 196 |
+
<input type="number" id="custom-img-width" min="0" class="small-text" name="<?php echo $this->option_name; ?>[custom_image_width]" value="<?php $this->val('custom_image_width'); ?>" />px
|
| 197 |
+
<?php _e('Height', 'printfriendly'); ?>
|
| 198 |
+
<input type="number" id="custom-img-height" min="0" class="small-text" name="<?php echo $this->option_name; ?>[custom_image_height]" value="<?php $this->val('custom_image_height'); ?>" />px
|
| 199 |
+
</div>
|
| 200 |
+
<div id="pf-custom-button-error"></div>
|
| 201 |
+
</div>
|
| 202 |
+
</label>
|
| 203 |
+
|
| 204 |
+
<label class="radio-custom-btn">
|
| 205 |
+
<input type="radio" name="<?php echo $this->option_name; ?>[custom_button_icon]" value="no-image" <?php $this->checked('custom_button_icon', 'no-image'); ?>>
|
| 206 |
+
<?php _e('No Image', 'printfriendly'); ?>
|
| 207 |
+
</label>
|
| 208 |
+
</div>
|
| 209 |
+
|
| 210 |
+
<div class="custom-btn pf-bu-tile pf-bu-is-4 pf-bu-is-flex-direction-column" id="custom-txt">
|
| 211 |
+
<h2><?php _e('Text', 'printfriendly'); ?></h2>
|
| 212 |
+
<div id="txt-enter">
|
| 213 |
+
<div class="pf-form-element">
|
| 214 |
+
<input id="custom-text-rb" type="radio" name="<?php echo $this->option_name; ?>[custom_button_text]" value="custom-text" <?php $this->checked('custom_button_text', 'custom-text'); ?>>
|
| 215 |
+
<input id="custom_text" type="text" size="10" class="clear regular-text" name="<?php echo $this->option_name; ?>[custom_text]" value="<?php $this->val('custom_text'); ?>">
|
| 216 |
+
|
| 217 |
+
<div id="pf-txt-attributes">
|
| 218 |
+
<div id="txt-size">
|
| 219 |
+
<?php _e('Text Size', 'printfriendly'); ?>
|
| 220 |
+
<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'); ?>" />
|
| 221 |
+
<input type="text" class="pf-color-picker" name="<?php echo $this->option_name; ?>[text_color]" id="text_color" value="<?php $this->val('text_color'); ?>" />
|
| 222 |
+
</div>
|
| 223 |
+
</div>
|
| 224 |
+
|
| 225 |
+
</div>
|
| 226 |
+
|
| 227 |
+
<label>
|
| 228 |
+
<input type="radio" id="custom-text-no" name="<?php echo $this->option_name; ?>[custom_button_text]" value="no-text" <?php $this->checked('custom_button_text', 'no-text'); ?>>
|
| 229 |
+
<?php _e('No Text', 'printfriendly'); ?>
|
| 230 |
+
</label>
|
| 231 |
+
</div>
|
| 232 |
+
</div>
|
| 233 |
+
|
| 234 |
+
<div class="custom-btn pf-bu-tile pf-bu-is-4 pf-bu-is-flex-direction-column" id="custom-button-preview">
|
| 235 |
+
<h2><?php _e('Preview', 'printfriendly'); ?></h2>
|
| 236 |
+
<?php $this->custom_button_preview(); ?>
|
| 237 |
+
</div>
|
| 238 |
+
</div>
|
| 239 |
+
</div>
|
| 240 |
+
</div>
|
| 241 |
+
</div>
|
| 242 |
+
</div>
|
| 243 |
+
|
| 244 |
+
<div class="pf-bu-block pf-bu-card">
|
| 245 |
+
<header class="pf-bu-card-header">
|
| 246 |
+
<p class="pf-bu-card-header-title">
|
| 247 |
+
<?php _e('Button Position', 'printfriendly'); ?>
|
| 248 |
+
</p>
|
| 249 |
+
</header>
|
| 250 |
+
|
| 251 |
+
<div class="pf-bu-card-content pf-features">
|
| 252 |
+
<div class="pf-label-inline">
|
| 253 |
+
<label for="pf_content_position" class="pf-bu-label"><?php _e('Alignment', 'printfriendly'); ?></label>
|
| 254 |
+
<div>
|
| 255 |
+
<select class="pf-bu-select" id="pf_content_position" name="<?php echo $this->option_name; ?>[content_position]">
|
| 256 |
+
<option value="left" <?php selected($this->options['content_position'], 'left'); ?>><?php _e('Left Align', 'printfriendly'); ?></option>
|
| 257 |
+
<option value="right" <?php selected($this->options['content_position'], 'right'); ?>><?php _e('Right Align', 'printfriendly'); ?></option>
|
| 258 |
+
<option value="center" <?php selected($this->options['content_position'], 'center'); ?>><?php _e('Center', 'printfriendly'); ?></option>
|
| 259 |
+
<option value="none" <?php selected($this->options['content_position'], 'none'); ?>><?php _e('None', 'printfriendly'); ?></option>
|
| 260 |
+
</select>
|
| 261 |
+
</div>
|
| 262 |
+
</div>
|
| 263 |
+
|
| 264 |
+
<div class="pf-label-inline">
|
| 265 |
+
<label for="pf_content_placement" class="pf-bu-label"><?php _e('Placement', 'printfriendly'); ?></label>
|
| 266 |
+
<div>
|
| 267 |
+
<select class="pf-bu-select" id="pf_content_placement" name="<?php echo $this->option_name; ?>[content_placement]">
|
| 268 |
+
<option value="before" <?php selected($this->options['content_placement'], 'before'); ?>><?php _e('Above Content', 'printfriendly'); ?></option>
|
| 269 |
+
<option value="after" <?php selected($this->options['content_placement'], 'after'); ?>><?php _e('Below Content', 'printfriendly'); ?></option>
|
| 270 |
+
</select>
|
| 271 |
+
</div>
|
| 272 |
+
</div>
|
| 273 |
+
</div>
|
| 274 |
+
</div>
|
| 275 |
+
|
| 276 |
+
<div class="pf-bu-block pf-bu-card">
|
| 277 |
+
<header class="pf-bu-card-header">
|
| 278 |
+
<p class="pf-bu-card-header-title">
|
| 279 |
+
<?php _e('Button Display', 'printfriendly'); ?>
|
| 280 |
+
</p>
|
| 281 |
+
</header>
|
| 282 |
+
|
| 283 |
+
<div class="pf-bu-card-content">
|
| 284 |
+
<label for="pages" class="pf-bu-label"><?php _e('Pages to show on', 'printfriendly'); ?></label>
|
| 285 |
+
<div id="pages">
|
| 286 |
+
<?php $this->create_checkbox('posts', __('Posts', 'printfriendly')); ?>
|
| 287 |
+
<?php $this->create_checkbox('pages', __('Pages', 'printfriendly')); ?>
|
| 288 |
+
<?php $this->create_checkbox('homepage', __('Homepage', 'printfriendly')); ?>
|
| 289 |
+
<?php $this->create_checkbox('categories', __('Category Pages', 'printfriendly')); ?>
|
| 290 |
+
<?php $this->create_checkbox('taxonomies', __('Taxonomy Pages', 'printfriendly')); ?>
|
| 291 |
+
</div>
|
| 292 |
+
|
| 293 |
+
<hr/>
|
| 294 |
+
<label for="categories" class="pf-bu-label"><?php _e('Specific categories to show on', 'printfriendly'); ?></label>
|
| 295 |
+
<?php
|
| 296 |
+
wp_dropdown_categories(
|
| 297 |
+
apply_filters(
|
| 298 |
+
'printfriendly_category_args',
|
| 299 |
+
array(
|
| 300 |
+
'show_count' => 0,
|
| 301 |
+
'orderby' => 'name',
|
| 302 |
+
'hide_empty' => false, // show a category even if it has no posts assigned
|
| 303 |
+
'class' => 'pf-select2',
|
| 304 |
+
'name' => 'printfriendly_option[show_on_cat]',
|
| 305 |
+
'id' => 'show_on_cat',
|
| 306 |
+
'selected' => isset($this->options['show_on_cat']) ? $this->options['show_on_cat'] : '',
|
| 307 |
+
'multiple' => true,
|
| 308 |
+
)
|
| 309 |
+
)
|
| 310 |
+
);
|
| 311 |
+
?>
|
| 312 |
+
|
| 313 |
+
<hr/>
|
| 314 |
+
|
| 315 |
+
<div class="pf-accordion">
|
| 316 |
+
<label class="pf-bu-label"><?php echo _e('Add direct to template', 'printfriendly'); ?></label>
|
| 317 |
+
<div>
|
| 318 |
+
<div>
|
| 319 |
+
<span class="small-text">Use the following if you want the buttons in archive/category page to link to individual posts</span>
|
| 320 |
+
<code>
|
| 321 |
+
<?php if( function_exists( 'pf_default_button' ) ){ echo pf_default_button(); } ?>
|
| 322 |
+
|
| 323 |
+
<a class="pf-clipboard" href="javascript:;" data-clipboard-text="<?php echo '<?php if( function_exists( \'pf_default_button\' ) ) { echo pf_default_button(); } ?>'; ?>"><span class="pf-bu-tag pf-bu-is-info pf-bu-is-dark"><?php _e('Copy Code', 'printfriendly'); ?></span></a>
|
| 324 |
+
</code>
|
| 325 |
+
</div>
|
| 326 |
+
<div>
|
| 327 |
+
<span class="small-text">Use the following if you want the button to always print the current page</span>
|
| 328 |
+
<code>
|
| 329 |
+
<?php if( function_exists( 'pf_current_page_button' ) ){ echo pf_current_page_button(); } ?>
|
| 330 |
+
|
| 331 |
+
<a class="pf-clipboard" href="javascript:;" data-clipboard-text="<?php echo '<?php if( function_exists( \'pf_current_page_button\' ) ) { echo pf_current_page_button(); } ?>'; ?>"><span class="pf-bu-tag pf-bu-is-info pf-bu-is-dark"><?php _e('Copy Code', 'printfriendly'); ?></span></a>
|
| 332 |
+
</code>
|
| 333 |
+
</div>
|
| 334 |
+
</div>
|
| 335 |
+
</div>
|
| 336 |
+
|
| 337 |
+
<div class="pf-accordion">
|
| 338 |
+
<label class="pf-bu-label"><?php echo _e('Use the shortcode', 'printfriendly'); ?></label>
|
| 339 |
+
<div>
|
| 340 |
+
<div>
|
| 341 |
+
<span class="small-text">Use the following if you want the buttons in archive/category page to link to individual posts</span>
|
| 342 |
+
<code>
|
| 343 |
+
[printfriendly]
|
| 344 |
+
|
| 345 |
+
<a class="pf-clipboard" href="javascript:;" data-clipboard-text="<?php echo '[printfriendly]'; ?>"><span class="pf-bu-tag pf-bu-is-info pf-bu-is-dark"><?php _e('Copy Code', 'printfriendly'); ?></span></a>
|
| 346 |
+
</code>
|
| 347 |
+
</div>
|
| 348 |
+
<div>
|
| 349 |
+
<span class="small-text">Use the following if you want the button to always print the current page</span>
|
| 350 |
+
<code>
|
| 351 |
+
[printfriendly current="yes"]
|
| 352 |
+
|
| 353 |
+
<a class="pf-clipboard" href="javascript:;" data-clipboard-text="<?php echo '[printfriendly current=\'yes\']'; ?>"><span class="pf-bu-tag pf-bu-is-info pf-bu-is-dark"><?php _e('Copy Code', 'printfriendly'); ?></span></a>
|
| 354 |
+
</code>
|
| 355 |
+
</div>
|
| 356 |
+
</div>
|
| 357 |
+
</div>
|
| 358 |
+
</div>
|
| 359 |
+
|
| 360 |
+
<div class="pf-bu-card-footer">
|
| 361 |
+
<p class="pf-bu-card-footer-item"><a href="https://printfriendly.freshdesk.com/support/solutions/articles/69000080457-manual-button-placement-in-wordpress" target="_new"><?php _e('Documentation', 'printfriendly'); ?></a></p>
|
| 362 |
+
</div>
|
| 363 |
+
|
| 364 |
+
</div>
|
| 365 |
+
|
| 366 |
+
<div class="pf-bu-block pf-bu-card">
|
| 367 |
+
<header class="pf-bu-card-header">
|
| 368 |
+
<p class="pf-bu-card-header-title">
|
| 369 |
+
<?php _e('Pro Exclusive Features', 'printfriendly'); ?>
|
| 370 |
+
</p>
|
| 371 |
+
</header>
|
| 372 |
+
|
| 373 |
+
<div class="pf-bu-card-content pf-features">
|
| 374 |
+
<div class="pf-label-inline">
|
| 375 |
+
<label for="password_protected" class="pf-bu-label"><?php _e('Encode images', 'printfriendly'); ?></label>
|
| 376 |
+
<div>
|
| 377 |
+
<select class="pf-bu-select" id="password_protected" name="<?php echo $this->option_name; ?>[password_protected]">
|
| 378 |
+
<option value="no" <?php selected($this->val('password_protected', false), 'no'); ?>><?php _e('No', 'printfriendly'); ?></option>
|
| 379 |
+
<option value="yes" <?php selected($this->val('password_protected', false), 'yes'); ?>><?php _e('Yes', 'printfriendly'); ?></option>
|
| 380 |
+
</select>
|
| 381 |
+
<p class="description"><?php _e('Select "Yes" if your site is not publicly accessible or if your provider blocks image requests from third parties or if images are not present in PDF', 'printfriendly'); ?></p>
|
| 382 |
+
</div>
|
| 383 |
+
</div>
|
| 384 |
+
|
| 385 |
+
<div class="pf-label-inline">
|
| 386 |
+
<label for="show_hidden_content" class="pf-bu-label"><?php _e('Show Hidden Content', 'printfriendly'); ?></label>
|
| 387 |
+
<div>
|
| 388 |
+
<select class="pf-bu-select" id="show_hidden_content" name="<?php echo $this->option_name; ?>[show_hidden_content]">
|
| 389 |
+
<option value="no" <?php selected($this->val('show_hidden_content', false), 'no'); ?>><?php _e('No', 'printfriendly'); ?></option>
|
| 390 |
+
<option value="yes" <?php selected($this->val('show_hidden_content', false), 'yes'); ?>><?php _e('Yes', 'printfriendly'); ?></option>
|
| 391 |
+
</select>
|
| 392 |
+
<p class="description"><?php _e('By default PrintFriendly Pro will only show the visible content on the page. Select "Yes", if you want PrintFriendly to show hidden content. (Ex. Content in hidden tabs)', 'printfriendly'); ?></p>
|
| 393 |
+
</div>
|
| 394 |
+
</div>
|
| 395 |
+
</div>
|
| 396 |
+
|
| 397 |
+
<div class="pf-bu-card-footer">
|
| 398 |
+
<p class="pf-bu-card-footer-item"><?php _e('These features require a Pro subscription.', 'printfriendly'); ?> <a href="https://www.printfriendly.com/pro" target="_blank"><?php _e('Learn More', 'printfriendly'); ?></a></p>
|
| 399 |
+
</div>
|
| 400 |
+
</div>
|
| 401 |
+
|
| 402 |
+
<div class="pf-bu-container">
|
| 403 |
+
<div class="pf-bu-is-flex pf-bu-is-justify-content-center">
|
| 404 |
+
<input type="submit" class="button-primary pf-bu-is-medium pf-bu-button" value="<?php esc_attr_e('Save Options', 'printfriendly'); ?>" />
|
| 405 |
+
<input type="reset" class="button-secondary pf-bu-is-medium pf-bu-button" value="<?php esc_attr_e('Cancel', 'printfriendly'); ?>" />
|
| 406 |
+
</div>
|
| 407 |
+
</div>
|
| 408 |
+
</div>
|
| 409 |
+
</section>
|
| 410 |
+
|
| 411 |
+
<section id="tab-advanced">
|
| 412 |
+
<div class="pf-bu-container">
|
| 413 |
+
|
| 414 |
+
<div class="pf-bu-block pf-bu-card">
|
| 415 |
+
<header class="pf-bu-card-header">
|
| 416 |
+
<p class="pf-bu-card-header-title">
|
| 417 |
+
<?php _e('Page header', 'printfriendly'); ?>
|
| 418 |
+
</p>
|
| 419 |
+
</header>
|
| 420 |
+
|
| 421 |
+
<div class="pf-bu-card-content">
|
| 422 |
+
<div class="pf-bu-columns">
|
| 423 |
+
<div class="pf-bu-column pf-bu-is-6">
|
| 424 |
+
<label for="icon_favicon">
|
| 425 |
+
<input id="icon_favicon" type="radio" name="<?php echo $this->option_name; ?>[logo]" value="favicon" <?php echo $this->options['logo'] === 'favicon' ? 'checked' : ''; ?>>
|
| 426 |
+
<?php _e('My Website Icon', 'printfriendly'); ?>
|
| 427 |
+
</label>
|
| 428 |
+
</div>
|
| 429 |
+
|
| 430 |
+
<div class="pf-bu-column pf-bu-is-6">
|
| 431 |
+
<label for="icon-upload-an-image">
|
| 432 |
+
<input id="icon-upload-an-image" type="radio" name="<?php echo $this->option_name; ?>[logo]" value="upload-an-image" <?php echo $this->options['logo'] === 'upload-an-image' ? 'checked' : ''; ?>>
|
| 433 |
+
<?php _e('Custom Image', 'printfriendly'); ?>
|
| 434 |
+
|
| 435 |
+
<div id="custom-logo"><div class="pf-bu-tile pf-bu-is-ancestor">
|
| 436 |
+
<div class="pf-bu-tile pf-bu-is-vertical">
|
| 437 |
+
<div class="pf-bu-tile pf-bu-is-4 pf-bu-is-flex-direction-column">
|
| 438 |
+
<div>
|
| 439 |
+
<input type="button" class="pf_upload_image_button button button-secondary" data-pf-element="#custom_logo" value="<?php _e('Select Image', 'printfriendly'); ?>">
|
| 440 |
+
<input id="custom_logo" type="hidden" name="<?php echo $this->option_name; ?>[image_url]" value="<?php $this->val('image_url'); ?>" />
|
| 441 |
+
<span id="custom_logo_label">
|
| 442 |
+
<?php if (! empty($this->val('image_url', false))) { ?>
|
| 443 |
+
<img src="<?php $this->val('image_url'); ?>">
|
| 444 |
+
<?php } ?>
|
| 445 |
+
</span>
|
| 446 |
+
</div>
|
| 447 |
+
</div>
|
| 448 |
+
|
| 449 |
+
<div class="pf-bu-tile pf-bu-is-4 pf-bu-is-flex-direction-column">
|
| 450 |
+
<div>
|
| 451 |
+
<div class="pf-bu-field pf-bu-has-addons">
|
| 452 |
+
<p class="pf-bu-control">
|
| 453 |
+
<a class="pf-bu-button pf-bu-is-static">
|
| 454 |
+
<?php _e('Tagline (optional)', 'printfriendly'); ?>
|
| 455 |
+
</a>
|
| 456 |
+
</p>
|
| 457 |
+
<p class="pf-bu-control">
|
| 458 |
+
<input id="image-tagline" type="text" class="pf-bu-input regular-text pf-regular-text" name="<?php echo $this->option_name; ?>[tagline]" value="<?php $this->val('tagline'); ?>" />
|
| 459 |
+
</p>
|
| 460 |
+
</div>
|
| 461 |
+
</div>
|
| 462 |
+
</div>
|
| 463 |
+
</div>
|
| 464 |
+
</div></div>
|
| 465 |
+
|
| 466 |
+
</label>
|
| 467 |
+
</div>
|
| 468 |
+
</div>
|
| 469 |
+
<div id="pf-image-error"></div>
|
| 470 |
+
<div id="pf-image-preview"></div>
|
| 471 |
+
</div>
|
| 472 |
+
|
| 473 |
+
<div class="pf-bu-card-footer">
|
| 474 |
+
<p class="pf-bu-card-footer-item"><a href="https://printfriendly.freshdesk.com/support/solutions/articles/69000080358-create-a-custom-header-in-wordpress" target="_new"><?php _e('Documentation', 'printfriendly'); ?></a></p>
|
| 475 |
+
</div>
|
| 476 |
+
</div>
|
| 477 |
+
|
| 478 |
+
<div class="pf-bu-block pf-bu-card">
|
| 479 |
+
<header class="pf-bu-card-header">
|
| 480 |
+
<p class="pf-bu-card-header-title">
|
| 481 |
+
<?php _e('Features', 'printfriendly'); ?>
|
| 482 |
+
</p>
|
| 483 |
+
</header>
|
| 484 |
+
|
| 485 |
+
<div class="pf-bu-card-content pf-features">
|
| 486 |
+
<div class="pf-label-inline">
|
| 487 |
+
<label for="pf-analytics-tracking" class="pf-bu-label"><?php _e('Track in Google Analytics', 'printfriendly'); ?></label>
|
| 488 |
+
<div>
|
| 489 |
+
<select class="pf-bu-select" id="pf-analytics-tracking" name="<?php echo $this->option_name; ?>[enable_google_analytics]">
|
| 490 |
+
<option value="yes" <?php $this->selected('enable_google_analytics', 'yes'); ?>> <?php _e('Yes', 'printfriendly'); ?></option>
|
| 491 |
+
<option value="no" <?php $this->selected('enable_google_analytics', 'no'); ?>> <?php _e('No', 'printfriendly'); ?></option>
|
| 492 |
+
</select>
|
| 493 |
+
</div>
|
| 494 |
+
</div>
|
| 495 |
+
|
| 496 |
+
<div class="pf-label-inline">
|
| 497 |
+
<label for="click-to-delete" class="pf-bu-label"><?php _e('Click to delete', 'printfriendly'); ?></label>
|
| 498 |
+
<div>
|
| 499 |
+
<select class="pf-bu-select" name="<?php echo $this->option_name; ?>[click_to_delete]" id="click-to-delete">
|
| 500 |
+
<option value="0" <?php selected($this->options['click_to_delete'], '0'); ?>><?php _e('Allow', 'printfriendly'); ?></option>
|
| 501 |
+
<option value="1" <?php selected($this->options['click_to_delete'], '1'); ?>><?php _e('Not Allow', 'printfriendly'); ?></option>
|
| 502 |
+
</select>
|
| 503 |
+
<p class="description"><?php echo sprintf(__('Read documentation about this feature %1$shere%2$s', 'printfriendly'), '<a href="https://printfriendly.freshdesk.com/support/solutions/articles/69000080475-turn-off-the-click-to-delete-option-in-wordpress" target="_new">', '</a>'); ?></p>
|
| 504 |
+
</div>
|
| 505 |
+
</div>
|
| 506 |
+
|
| 507 |
+
<div class="pf-label-inline">
|
| 508 |
+
<label for="images-size" class="pf-bu-label"><?php _e('Image size', 'printfriendly'); ?></label>
|
| 509 |
+
<div>
|
| 510 |
+
<select class="pf-bu-select" name="<?php echo $this->option_name; ?>[images-size]" id="images-size">
|
| 511 |
+
<option value="full-size" <?php selected($this->options['images-size'], 'full-size'); ?>><?php _e('Full Size', 'printfriendly'); ?></option>
|
| 512 |
+
<option value="large" <?php selected($this->options['images-size'], 'large'); ?>><?php _e('Large', 'printfriendly'); ?></option>
|
| 513 |
+
<option value="medium" <?php selected($this->options['images-size'], 'medium'); ?>><?php _e('Medium', 'printfriendly'); ?></option>
|
| 514 |
+
<option value="small" <?php selected($this->options['images-size'], 'small'); ?>><?php _e('Small', 'printfriendly'); ?></option>
|
| 515 |
+
<option value="remove-images" <?php selected($this->options['images-size'], 'remove-images'); ?>><?php _e('Remove Images', 'printfriendly'); ?></option>
|
| 516 |
+
</select>
|
| 517 |
+
</div>
|
| 518 |
+
</div>
|
| 519 |
+
|
| 520 |
+
<div class="pf-label-inline">
|
| 521 |
+
<label for="image-style" class="pf-bu-label"><?php _e('Image style', 'printfriendly'); ?></label>
|
| 522 |
+
<div>
|
| 523 |
+
<select class="pf-bu-select" name="<?php echo $this->option_name; ?>[image-style]" id="image-style">
|
| 524 |
+
<option value="block" <?php selected($this->options['image-style'], 'block'); ?>><?php _e('Center/Block', 'printfriendly'); ?></option>
|
| 525 |
+
<option value="right" <?php selected($this->options['image-style'], 'right'); ?>><?php _e('Align Right', 'printfriendly'); ?></option>
|
| 526 |
+
<option value="left" <?php selected($this->options['image-style'], 'left'); ?>><?php _e('Align Left', 'printfriendly'); ?></option>
|
| 527 |
+
<option value="none" <?php selected($this->options['image-style'], 'none'); ?>><?php _e('Align None', 'printfriendly'); ?></option>
|
| 528 |
+
</select>
|
| 529 |
+
<p class="description"><?php echo sprintf(__('Read documentation about this feature %1$shere%2$s', 'printfriendly'), '<a href="https://printfriendly.freshdesk.com/support/solutions/articles/69000080507-remove-images-option" target="_new">', '</a>'); ?></p>
|
| 530 |
+
</div>
|
| 531 |
+
</div>
|
| 532 |
+
|
| 533 |
+
<div class="pf-label-inline">
|
| 534 |
+
<label for="email" class="pf-bu-label"><?php _e('Email', 'printfriendly'); ?></label>
|
| 535 |
+
<div>
|
| 536 |
+
<select class="pf-bu-select" name="<?php echo $this->option_name; ?>[email]" id="email">
|
| 537 |
+
<option value="0" <?php selected($this->options['email'], '0'); ?>><?php _e('Allow', 'printfriendly'); ?></option>
|
| 538 |
+
<option value="1" <?php selected($this->options['email'], '1'); ?>><?php _e('Not Allow', 'printfriendly'); ?></option>
|
| 539 |
+
</select>
|
| 540 |
+
</div>
|
| 541 |
+
</div>
|
| 542 |
+
|
| 543 |
+
<div class="pf-label-inline">
|
| 544 |
+
<label for="pdf" class="pf-bu-label"><?php _e('PDF', 'printfriendly'); ?></label>
|
| 545 |
+
<div>
|
| 546 |
+
<select class="pf-bu-select" name="<?php echo $this->option_name; ?>[pdf]" id="pdf">
|
| 547 |
+
<option value="0" <?php selected($this->options['pdf'], '0'); ?>><?php _e('Allow', 'printfriendly'); ?></option>
|
| 548 |
+
<option value="1" <?php selected($this->options['pdf'], '1'); ?>><?php _e('Not Allow', 'printfriendly'); ?></option>
|
| 549 |
+
</select>
|
| 550 |
+
<p class="description"><strong><?php _e('Developer Note', 'printfriendly'); ?></strong>: <?php _e('On localhost the images can not be included in the PDF. Once the website is live/public images will be included in the PDF.', 'printfriendly'); ?></p>
|
| 551 |
+
</div>
|
| 552 |
+
</div>
|
| 553 |
+
|
| 554 |
+
<div class="pf-label-inline">
|
| 555 |
+
<label for="print" class="pf-bu-label"><?php _e('Print', 'printfriendly'); ?></label>
|
| 556 |
+
<div>
|
| 557 |
+
<select class="pf-bu-select" name="<?php echo $this->option_name; ?>[print]" id="print">
|
| 558 |
+
<option value="0" <?php selected($this->options['print'], '0'); ?>><?php _e('Allow', 'printfriendly'); ?></option>
|
| 559 |
+
<option value="1" <?php selected($this->options['print'], '1'); ?>><?php _e('Not Allow', 'printfriendly'); ?></option>
|
| 560 |
+
</select>
|
| 561 |
+
</div>
|
| 562 |
+
</div>
|
| 563 |
+
|
| 564 |
+
</div>
|
| 565 |
+
</div>
|
| 566 |
+
|
| 567 |
+
<div class="pf-bu-block pf-bu-card">
|
| 568 |
+
<header class="pf-bu-card-header">
|
| 569 |
+
<p class="pf-bu-card-header-title">
|
| 570 |
+
<?php _e('Custom CSS', 'printfriendly'); ?>
|
| 571 |
+
</p>
|
| 572 |
+
</header>
|
| 573 |
+
|
| 574 |
+
<div class="pf-bu-card-content">
|
| 575 |
+
<?php if (! $this->is_pro('custom-css')) { ?>
|
| 576 |
+
<label for="custom_css_url">
|
| 577 |
+
<?php _e('Custom CSS URL', 'printfriendly'); ?>
|
| 578 |
+
<input id="custom_css_url" type="url" class="regular-text" name="<?php echo $this->option_name; ?>[custom_css_url]" value="<?php $this->val('custom_css_url'); ?>" />
|
| 579 |
+
</label>
|
| 580 |
+
<?php } else { ?>
|
| 581 |
+
<label for="custom_css">
|
| 582 |
+
<textarea id="custom_css" class="regular-text pf-bu-textarea" rows="5" cols="80" name="<?php echo $this->option_name; ?>[custom_css]"><?php echo html_entity_decode(esc_textarea($this->val('custom_css', false))); ?></textarea>
|
| 583 |
+
<p class="desc"><?php echo $this->get_custom_css_upgrade_message(); ?></p>
|
| 584 |
+
</label>
|
| 585 |
+
<?php } ?>
|
| 586 |
+
</div>
|
| 587 |
+
|
| 588 |
+
<div class="pf-bu-card-footer">
|
| 589 |
+
<p class="pf-bu-card-footer-item">
|
| 590 |
+
<?php
|
| 591 |
+
if (! $this->is_pro('custom-css')) {
|
| 592 |
+
_e('Customize the styles of the printed/pdf page using your own CSS. Create your custom CSS, and put the URL to your Custom CSS file in the box above', 'printfriendly');
|
| 593 |
+
} else {
|
| 594 |
+
echo sprintf(__('Customize the styles of the printed/pdf page using your own CSS. Add your custom CSS (without the %s tags) in the box above', 'printfriendly'), '<code><style></code>');
|
| 595 |
+
}
|
| 596 |
+
?>
|
| 597 |
+
</p>
|
| 598 |
+
</div>
|
| 599 |
+
|
| 600 |
+
</div>
|
| 601 |
+
|
| 602 |
+
<div class="pf-bu-container">
|
| 603 |
+
<div class="pf-bu-is-flex pf-bu-is-justify-content-center">
|
| 604 |
+
<input type="submit" class="button-primary pf-bu-is-medium pf-bu-button" value="<?php esc_attr_e('Save Options', 'printfriendly'); ?>" />
|
| 605 |
+
<input type="reset" class="button-secondary pf-bu-is-medium pf-bu-button" value="<?php esc_attr_e('Cancel', 'printfriendly'); ?>" />
|
| 606 |
+
</div>
|
| 607 |
+
</div>
|
| 608 |
+
|
| 609 |
+
</div>
|
| 610 |
+
</section>
|
| 611 |
+
|
| 612 |
+
|
| 613 |
+
<?php if (WP_DEBUG) { ?>
|
| 614 |
+
<section id="tab-debug">
|
| 615 |
+
<div class="pf-bu-container">
|
| 616 |
+
<div class="pf-bu-block pf-bu-card">
|
| 617 |
+
<header class="pf-bu-card-header">
|
| 618 |
+
<p class="pf-bu-card-header-title">
|
| 619 |
+
<?php _e('Debug options', 'printfriendly'); ?>
|
| 620 |
+
</p>
|
| 621 |
+
</header>
|
| 622 |
+
|
| 623 |
+
<div class="pf-bu-card-content">
|
| 624 |
+
<pre><?php echo print_r($this->options, 1); ?></pre>
|
| 625 |
+
</div>
|
| 626 |
+
|
| 627 |
+
<div class="pf-bu-card-footer">
|
| 628 |
+
<p class="pf-bu-card-footer-item"><?php _e('Currently in Debug Mode. This tab is visible in debug mode only', 'printfriendly'); ?></p>
|
| 629 |
+
</div>
|
| 630 |
+
</div>
|
| 631 |
+
</div>
|
| 632 |
+
</section>
|
| 633 |
+
<?php } ?>
|
| 634 |
+
|
| 635 |
+
</div>
|
