Version Description
- Chanage link in settings page
Download this release
Release Info
Developer | printfriendly |
Plugin | Print, PDF, Email by PrintFriendly |
Version | 3.12.5 |
Comparing to | |
See all releases |
Code changes from version 3.8.7 to 3.12.5
- admin.css +43 -12
- admin.js +26 -7
- pf.php +266 -101
- readme.txt +44 -2
- trunk/admin.css +43 -12
- trunk/admin.js +26 -7
- trunk/pf.php +266 -101
- trunk/readme.txt +44 -2
admin.css
CHANGED
@@ -15,7 +15,7 @@ h3.hndle {
|
|
15 |
padding: 7px 5px;
|
16 |
}
|
17 |
|
18 |
-
#buttongroup1, #buttongroup2, #buttongroup3, #
|
19 |
display: block;
|
20 |
margin-right: 3em;
|
21 |
float: left;
|
@@ -25,20 +25,21 @@ h3.hndle {
|
|
25 |
}
|
26 |
|
27 |
#custom-button-preview {
|
28 |
-
clear:both;
|
29 |
-
padding-top: 20px;
|
30 |
margin-left: 2em;
|
31 |
}
|
32 |
#custom-button-preview img {
|
33 |
margin-right: 6px;
|
34 |
}
|
35 |
-
#
|
36 |
float: left;
|
37 |
}
|
38 |
|
39 |
-
#custom-txt, #custom-img {
|
40 |
-
margin:
|
41 |
-
|
|
|
|
|
|
|
42 |
}
|
43 |
|
44 |
.description {
|
@@ -358,10 +359,40 @@ span.description.pf-help-link {
|
|
358 |
font-style:normal !important
|
359 |
}
|
360 |
|
361 |
-
#custom-txt #txt-enter {
|
362 |
-
margin: 0 0 2em 0;
|
363 |
-
}
|
364 |
-
|
365 |
#margin input[type="number"]{
|
366 |
width: 65px;
|
367 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
padding: 7px 5px;
|
16 |
}
|
17 |
|
18 |
+
#buttongroup1, #buttongroup2, #buttongroup3, #button-positioning div, #button-placement div {
|
19 |
display: block;
|
20 |
margin-right: 3em;
|
21 |
float: left;
|
25 |
}
|
26 |
|
27 |
#custom-button-preview {
|
|
|
|
|
28 |
margin-left: 2em;
|
29 |
}
|
30 |
#custom-button-preview img {
|
31 |
margin-right: 6px;
|
32 |
}
|
33 |
+
#placement-adv-options {
|
34 |
float: left;
|
35 |
}
|
36 |
|
37 |
+
#custom-txt, #custom-img, #custom-button-preview {
|
38 |
+
margin: 0 3em;
|
39 |
+
}
|
40 |
+
|
41 |
+
#custom-txt>div {
|
42 |
+
margin-bottom: 10px;
|
43 |
}
|
44 |
|
45 |
.description {
|
359 |
font-style:normal !important
|
360 |
}
|
361 |
|
|
|
|
|
|
|
|
|
362 |
#margin input[type="number"]{
|
363 |
width: 65px;
|
364 |
+
}
|
365 |
+
|
366 |
+
label.radio-custom-btn {
|
367 |
+
margin-right: 15px;
|
368 |
+
}
|
369 |
+
|
370 |
+
#custom-btn-group {
|
371 |
+
float: left;
|
372 |
+
}
|
373 |
+
|
374 |
+
#custom-btn-group b {
|
375 |
+
font-weight: bold;
|
376 |
+
font-size: 14px;
|
377 |
+
}
|
378 |
+
|
379 |
+
#custom-btn-group, h2 {
|
380 |
+
margin-top: 0;
|
381 |
+
}
|
382 |
+
|
383 |
+
#custom-img h2 {
|
384 |
+
margin-bottom: 0;
|
385 |
+
}
|
386 |
+
|
387 |
+
#custom-img label, #custom-txt label {
|
388 |
+
margin: 0 0 15px 0;
|
389 |
+
}
|
390 |
+
|
391 |
+
#txt-color, #txt-size {
|
392 |
+
float: left;
|
393 |
+
margin-right: 20px;
|
394 |
+
}
|
395 |
+
|
396 |
+
#custom_text {
|
397 |
+
width: 200px;
|
398 |
+
}
|
admin.js
CHANGED
@@ -89,17 +89,18 @@ jQuery(document).ready(function() {
|
|
89 |
}
|
90 |
}).change();
|
91 |
|
92 |
-
jQuery('#custom_text').change
|
93 |
pf_custom_text_change();
|
94 |
-
})
|
95 |
|
96 |
-
jQuery('
|
97 |
pf_custom_text_change();
|
98 |
});
|
99 |
|
100 |
function pf_custom_text_change(){
|
101 |
jQuery('#buttongroup3 span:not(.printandpdf)').text( jQuery('#custom_text').val() );
|
102 |
-
jQuery('
|
|
|
103 |
}
|
104 |
|
105 |
function pf_initialize_preview(urlInputSelector, previewSelector) {
|
@@ -107,11 +108,21 @@ jQuery(document).ready(function() {
|
|
107 |
var imgUrl = jQuery.trim(el.val());
|
108 |
var preview = jQuery(previewSelector + '-preview');
|
109 |
var error = jQuery(previewSelector + '-error');
|
|
|
110 |
el.bind('input paste change keyup', function() {
|
111 |
setTimeout(function() {
|
112 |
// ie shows error if we try to merge the two below into a single statement
|
113 |
var img = jQuery('<img/>');
|
114 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
img.load(function() {
|
116 |
error.html('');
|
117 |
preview.html('').append(img);})
|
@@ -129,6 +140,7 @@ jQuery(document).ready(function() {
|
|
129 |
}
|
130 |
|
131 |
pf_initialize_preview('#custom_image', '#pf-custom-button');
|
|
|
132 |
pf_initialize_preview('#upload-an-image', '#pf-image');
|
133 |
jQuery('#custom_image, #upload-an-image').change();
|
134 |
jQuery('#custom_image').bind('focus', function() {
|
@@ -252,6 +264,13 @@ jQuery(document).ready(function() {
|
|
252 |
jQuery('#category_ids').val(ids.join(','));
|
253 |
});
|
254 |
|
255 |
-
|
|
|
|
|
|
|
256 |
|
257 |
-
|
|
|
|
|
|
|
|
89 |
}
|
90 |
}).change();
|
91 |
|
92 |
+
jQuery('#custom_text').bind('change keyup', function(){
|
93 |
pf_custom_text_change();
|
94 |
+
});
|
95 |
|
96 |
+
jQuery("[name='printfriendly_option[custom_button_text]']").change(function(){
|
97 |
pf_custom_text_change();
|
98 |
});
|
99 |
|
100 |
function pf_custom_text_change(){
|
101 |
jQuery('#buttongroup3 span:not(.printandpdf)').text( jQuery('#custom_text').val() );
|
102 |
+
var newText = (jQuery("[name='printfriendly_option[custom_button_text]']:checked").val() === 'no-text') ? '' : jQuery('#custom_text').val();
|
103 |
+
jQuery('#custom-btn-group span.printfriendly-text2').text( newText );
|
104 |
}
|
105 |
|
106 |
function pf_initialize_preview(urlInputSelector, previewSelector) {
|
108 |
var imgUrl = jQuery.trim(el.val());
|
109 |
var preview = jQuery(previewSelector + '-preview');
|
110 |
var error = jQuery(previewSelector + '-error');
|
111 |
+
|
112 |
el.bind('input paste change keyup', function() {
|
113 |
setTimeout(function() {
|
114 |
// ie shows error if we try to merge the two below into a single statement
|
115 |
var img = jQuery('<img/>');
|
116 |
+
var customButtonIcon = jQuery("[name='printfriendly_option[custom_button_icon]']:checked").val();
|
117 |
+
|
118 |
+
if (customButtonIcon === 'custom-image') {
|
119 |
+
imgUrl = jQuery('#custom_image').val();
|
120 |
+
} else if (customButtonIcon === 'no-image') {
|
121 |
+
imgUrl = '';
|
122 |
+
} else {
|
123 |
+
imgUrl = customButtonIcon;
|
124 |
+
}
|
125 |
+
|
126 |
img.load(function() {
|
127 |
error.html('');
|
128 |
preview.html('').append(img);})
|
140 |
}
|
141 |
|
142 |
pf_initialize_preview('#custom_image', '#pf-custom-button');
|
143 |
+
pf_initialize_preview("[name='printfriendly_option[custom_button_icon]']", '#pf-custom-button');
|
144 |
pf_initialize_preview('#upload-an-image', '#pf-image');
|
145 |
jQuery('#custom_image, #upload-an-image').change();
|
146 |
jQuery('#custom_image').bind('focus', function() {
|
264 |
jQuery('#category_ids').val(ids.join(','));
|
265 |
});
|
266 |
|
267 |
+
jQuery('#custom_image').click(function() {
|
268 |
+
jQuery("#custom-image-rb").prop('checked', true);
|
269 |
+
jQuery("#custom-image-rb").trigger("change");
|
270 |
+
});
|
271 |
|
272 |
+
jQuery('#custom_text').click(function() {
|
273 |
+
jQuery("#custom-text-rb").prop('checked', true);
|
274 |
+
jQuery("#custom-text-rb").trigger("change");
|
275 |
+
});
|
276 |
+
});
|
pf.php
CHANGED
@@ -5,11 +5,24 @@ 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: 3.
|
9 |
Author: Print, PDF, & Email by PrintFriendly
|
10 |
Author URI: http://www.PrintFriendly.com
|
11 |
|
12 |
Changelog :
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
3.8.7 - Bug fix.
|
14 |
3.8.6 - Allow default image setting to be small medium or large.
|
15 |
3.8.5 - Bug fix.
|
@@ -110,7 +123,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
110 |
* Current plugin version.
|
111 |
* @var string
|
112 |
*/
|
113 |
-
var $plugin_version = '3.
|
114 |
|
115 |
/**
|
116 |
* The hook, used for text domain as well as hooks on pages and in get requests for admin.
|
@@ -134,7 +147,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
134 |
* Database version, used to allow for easy upgrades to / additions in plugin options between plugin versions.
|
135 |
* @var int
|
136 |
*/
|
137 |
-
var $db_version =
|
138 |
|
139 |
/**
|
140 |
* Settings page, used within the plugin to reliably load the plugins admin JS and CSS files only on the admin page.
|
@@ -279,8 +292,9 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
279 |
* @since 3.3.0
|
280 |
**/
|
281 |
function print_only_override($content) {
|
282 |
-
$pattern = '/class
|
283 |
-
$pf_pattern = '/class
|
|
|
284 |
return (preg_match($pattern, $content) || preg_match($pf_pattern, $content)) ;
|
285 |
}
|
286 |
|
@@ -403,6 +417,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
403 |
var pfDisablePDF = '<?php echo esc_js($this->options['pdf']); ?>';
|
404 |
var pfDisablePrint = '<?php echo esc_js($this->options['print']); ?>';
|
405 |
var pfCustomCSS = '<?php echo esc_js(esc_url($this->options['custom_css_url'])); ?>';
|
|
|
406 |
(function() {
|
407 |
var e = document.createElement('script'); e.type="text/javascript";
|
408 |
e.src = 'https://cdn.printfriendly.com/printfriendly.js';
|
@@ -509,7 +524,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
509 |
if ( 'none' != $this->options['content_position'] )
|
510 |
$align = ' pf-align'.$this->options['content_position'];
|
511 |
$href = str_replace("&", "&", $href );
|
512 |
-
$button = apply_filters( 'printfriendly_button', '<div class="printfriendly'.$align.'"><a href="'.$href.'" rel="nofollow" '.$onclick.' class="noslimstat">'.$this->button().'</a></div>' );
|
513 |
return $button;
|
514 |
}
|
515 |
|
@@ -570,32 +585,52 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
570 |
|
571 |
$valid_input = $input;
|
572 |
|
573 |
-
|
574 |
if ( !isset( $input['button_type'] ) || !in_array( $input['button_type'], array(
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
|
584 |
// @todo custom image url validation
|
585 |
if ( !isset( $input['custom_image'] ) || empty( $input['custom_image'] ) )
|
586 |
$valid_input['custom_image'] = '';
|
587 |
|
|
|
|
|
|
|
|
|
588 |
// @todo validate optional custom text
|
589 |
if ( !isset( $input['custom_text'] ) ) {
|
590 |
-
|
591 |
}
|
592 |
-
/* else {
|
593 |
-
|
594 |
-
}*/
|
595 |
|
596 |
// Custom button selected, but no url nor text given, reset button type to default
|
597 |
-
if( 'custom-
|
598 |
-
$valid_input['button_type'] = '
|
599 |
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.', $this->hook ) );
|
600 |
}
|
601 |
|
@@ -831,11 +866,13 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
831 |
try {
|
832 |
// Set some defaults
|
833 |
$this->options = array(
|
834 |
-
'button_type' => '
|
835 |
'content_position' => 'left',
|
836 |
'content_placement' => 'after',
|
837 |
-
'
|
838 |
-
'
|
|
|
|
|
839 |
'enable_css' => 'on',
|
840 |
'margin_top' => '12',
|
841 |
'margin_right' => '12',
|
@@ -843,7 +880,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
843 |
'margin_left' => '12',
|
844 |
'show_on_posts' => 'on',
|
845 |
'show_on_pages' => 'on',
|
846 |
-
'text_color' => '#
|
847 |
'text_size' => 14,
|
848 |
'logo' => 'favicon',
|
849 |
'image_url' => '',
|
@@ -1012,6 +1049,81 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1012 |
$this->options['images-size'] = $this->options['hide-images'] == '1' ? 'remove-images' : 'full-size';
|
1013 |
}
|
1014 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1015 |
$this->options['db_version'] = $this->db_version;
|
1016 |
|
1017 |
update_option( $this->option_name, $this->options );
|
@@ -1036,6 +1148,21 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1036 |
echo '<br>';
|
1037 |
}
|
1038 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1039 |
/**
|
1040 |
* Displays button image in the admin area
|
1041 |
*
|
@@ -1045,42 +1172,28 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1045 |
function button( $name = false ){
|
1046 |
if( !$name )
|
1047 |
$name = $this->options['button_type'];
|
1048 |
-
$button_css = $this->generic_button_css();
|
1049 |
-
/* esc_html was removerd to support custom html, CSRF prevents from attack by using this field */
|
1050 |
-
$text = $this->options['custom_text'];
|
1051 |
-
$img_path = 'https://cdn.printfriendly.com/';
|
1052 |
-
|
1053 |
-
switch($name){
|
1054 |
-
case "custom-image":
|
1055 |
-
if( '' == trim($this->options['custom_image']) )
|
1056 |
-
$return = '';
|
1057 |
-
else
|
1058 |
-
$return = '<img src="'.esc_url($this->options['custom_image']).'" alt="Print Friendly" />';
|
1059 |
-
|
1060 |
-
$return .= $text;
|
1061 |
|
1062 |
-
|
1063 |
-
break;
|
1064 |
|
1065 |
-
|
1066 |
-
return '<span class="printfriendly-text2">'.$text.'</span>';
|
1067 |
-
break;
|
1068 |
|
1069 |
-
|
1070 |
-
return '<span class="printfriendly-text2 printandpdf"><img style="border:none;margin-right:6px;display:inline-block" src="'.$img_path.'pf-print-icon.gif" width="16" height="15" alt="Print Friendly Version of this page" />Print <img style="'.$button_css.'margin:0 6px;display:inline-block" src="'.$img_path.'pf-pdf-icon.gif" width="12" height="12" alt="Get a PDF version of this webpage" />PDF</span>';
|
1071 |
-
break;
|
1072 |
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
|
|
|
|
|
|
1076 |
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
|
|
1080 |
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
}
|
1085 |
}
|
1086 |
|
@@ -1100,12 +1213,21 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1100 |
* @since 3.0.9
|
1101 |
*/
|
1102 |
function custom_button_preview() {
|
1103 |
-
if(
|
1104 |
$button_preview = '<span id="pf-custom-button-preview"></span>';
|
1105 |
-
else
|
1106 |
-
$button_preview = '<span id="pf-custom-button-preview"><img src="'.esc_url($this->options['custom_image']).'" alt="Print Friendly" /></span>';
|
|
|
|
|
|
|
1107 |
|
1108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1109 |
|
1110 |
echo $button_preview;
|
1111 |
}
|
@@ -1273,6 +1395,13 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1273 |
echo '<pre>' . __( 'Options:', $this->hook ) . '<br><br>' . print_r( $this->options, 1 ) . '</pre>';
|
1274 |
}
|
1275 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1276 |
<div id="pf_settings" class="wrap">
|
1277 |
|
1278 |
<div class="icon32" id="printfriendly"></div>
|
@@ -1286,53 +1415,88 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1286 |
|
1287 |
<fieldset id="button-style">
|
1288 |
<div id="buttongroup1">
|
1289 |
-
<?php $this->radio('
|
1290 |
-
<?php $this->radio('
|
1291 |
-
<?php $this->radio('
|
1292 |
</div>
|
1293 |
<div id="buttongroup2">
|
1294 |
-
<?php $this->radio('
|
1295 |
-
<?php $this->radio('button-
|
1296 |
-
<?php $this->radio('button-
|
1297 |
</div>
|
1298 |
<div id="buttongroup3">
|
1299 |
-
<?php $this->radio('
|
1300 |
-
<?php $this->radio('
|
1301 |
-
<?php $this->radio('
|
1302 |
-
<?php $this->radio('
|
|
|
|
|
|
|
|
|
|
|
1303 |
</div>
|
1304 |
|
1305 |
-
<div id="custom">
|
1306 |
-
<label
|
1307 |
-
<?php echo '<input id="custom-
|
1308 |
<?php _e( "Custom Button", $this->hook ); ?>
|
1309 |
</label>
|
1310 |
-
|
1311 |
-
|
1312 |
-
<
|
1313 |
-
|
1314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1315 |
</div>
|
1316 |
-
|
1317 |
-
<div id="custom-txt" >
|
|
|
1318 |
<div id="txt-enter">
|
1319 |
-
|
1320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1321 |
</div>
|
1322 |
-
<div
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
1327 |
</div>
|
1328 |
</div>
|
1329 |
-
<div id="txt-size">
|
1330 |
-
<?php _e( "Text Size", $this->hook ); ?><br>
|
1331 |
-
<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' ); ?>"/>
|
1332 |
-
</div>
|
1333 |
</div>
|
1334 |
-
|
1335 |
-
|
|
|
|
|
|
|
1336 |
</div>
|
1337 |
</fieldset>
|
1338 |
<br class="clear">
|
@@ -1340,7 +1504,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1340 |
<!--Section 2 Button Positioning-->
|
1341 |
<div id="button-positioning">
|
1342 |
<h3><?php _e( "Button Positioning", $this->hook ); ?>
|
1343 |
-
<span id="css"><input type="checkbox" name="<?php echo $this->option_name; ?>[enable_css]" value="<?php $this->val('enable_css');?>" <?php $this->checked('enable_css', 'off'); ?>
|
1344 |
</h3>
|
1345 |
<div id="button-positioning-options">
|
1346 |
<div id="alignment">
|
@@ -1421,7 +1585,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1421 |
<label for="upload-an-image"><?php _e( "Enter url", $this->hook ); ?></label><input id="upload-an-image" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[image_url]" value="<?php $this->val( 'image_url' ); ?>" />
|
1422 |
<label for="image-tagline"><?php _e( "Text (optional)", $this->hook ); ?></label><input id="image-tagline" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[tagline]" value="<?php $this->val( 'tagline' ); ?>" />
|
1423 |
</div> */ ?>
|
1424 |
-
<div class="custom-logo"><label for="Enter_URL"
|
1425 |
<div id="pf-image-error"></div>
|
1426 |
<div id="pf-image-preview"></div>
|
1427 |
<label for="click_to_delete">
|
@@ -1438,7 +1602,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1438 |
<option value="large" <?php selected( $this->options['images-size'], 'large' ); ?>><?php _e( "Large", $this->hook ); ?></option>
|
1439 |
<option value="medium" <?php selected( $this->options['images-size'], 'medium' ); ?>><?php _e( "Medium", $this->hook ); ?></option>
|
1440 |
<option value="small" <?php selected( $this->options['images-size'], 'small' ); ?>><?php _e( "Small", $this->hook ); ?></option>
|
1441 |
-
<option value="remove-
|
1442 |
</select>
|
1443 |
</label>
|
1444 |
<label for="image-style">
|
@@ -1521,7 +1685,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1521 |
<?php
|
1522 |
if (class_exists('WooCommerce')) {
|
1523 |
?>
|
1524 |
-
<span><strong
|
1525 |
<?php
|
1526 |
} else {
|
1527 |
?>
|
@@ -1540,14 +1704,15 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1540 |
<input type="reset" class="button-secondary" value="<?php esc_attr_e( "Cancel", $this->hook ); ?>"/>
|
1541 |
</p>
|
1542 |
<div id="after-submit">
|
1543 |
-
<p><?php _e( "Need professional options for your corporate, education, or agency developed website? Check out", $this->hook ); ?> <a href="https://www.printfriendly.com/pro">PrintFriendly Pro</a>.</p>
|
1544 |
<p>
|
1545 |
-
<?php _e(
|
|
|
|
|
|
|
|
|
|
|
1546 |
</div>
|
1547 |
-
|
1548 |
</form>
|
1549 |
-
</div>
|
1550 |
-
|
1551 |
<?php
|
1552 |
}
|
1553 |
}
|
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: 3.12.5
|
9 |
Author: Print, PDF, & Email by PrintFriendly
|
10 |
Author URI: http://www.PrintFriendly.com
|
11 |
|
12 |
Changelog :
|
13 |
+
3.12.5 - Chanage link in settings page
|
14 |
+
3.12.4 - Bug fix, avoid "undefined variable: return"
|
15 |
+
3.12.3 - Bug fix, sometimes custom image didn't display correctly after upgrade
|
16 |
+
3.12.2 - Add title to Printfriendly button and change button image alt
|
17 |
+
3.12.1 - Fix translations
|
18 |
+
3.12.0 - Update custom button UI
|
19 |
+
3.11.2 - Fix button upgrade for pf-icon-both.gif
|
20 |
+
3.11.1 - Bug fix
|
21 |
+
3.11.0 - Update buttons
|
22 |
+
3.10.0 - Change "leave us a rating" message.
|
23 |
+
3.9.2 - Correctly handle spaces in print-only detection
|
24 |
+
3.9.1 - Better print-only detection
|
25 |
+
3.9.0 - Add new button
|
26 |
3.8.7 - Bug fix.
|
27 |
3.8.6 - Allow default image setting to be small medium or large.
|
28 |
3.8.5 - Bug fix.
|
123 |
* Current plugin version.
|
124 |
* @var string
|
125 |
*/
|
126 |
+
var $plugin_version = '3.12.4';
|
127 |
|
128 |
/**
|
129 |
* The hook, used for text domain as well as hooks on pages and in get requests for admin.
|
147 |
* Database version, used to allow for easy upgrades to / additions in plugin options between plugin versions.
|
148 |
* @var int
|
149 |
*/
|
150 |
+
var $db_version = 16;
|
151 |
|
152 |
/**
|
153 |
* Settings page, used within the plugin to reliably load the plugins admin JS and CSS files only on the admin page.
|
292 |
* @since 3.3.0
|
293 |
**/
|
294 |
function print_only_override($content) {
|
295 |
+
$pattern = '/class\s*?=\s*?(["\']|["\']([^"\']*?)\s)print-only(["\']|\s([^"\']*?)["\'])/';
|
296 |
+
$pf_pattern = '/class\s*?=\s*?(["\']|["\']([^"\']*?)\s)pf-content(["\']|\s([^"\']*?)["\'])/';
|
297 |
+
|
298 |
return (preg_match($pattern, $content) || preg_match($pf_pattern, $content)) ;
|
299 |
}
|
300 |
|
417 |
var pfDisablePDF = '<?php echo esc_js($this->options['pdf']); ?>';
|
418 |
var pfDisablePrint = '<?php echo esc_js($this->options['print']); ?>';
|
419 |
var pfCustomCSS = '<?php echo esc_js(esc_url($this->options['custom_css_url'])); ?>';
|
420 |
+
var pfPlatform = 'Wordpress';
|
421 |
(function() {
|
422 |
var e = document.createElement('script'); e.type="text/javascript";
|
423 |
e.src = 'https://cdn.printfriendly.com/printfriendly.js';
|
524 |
if ( 'none' != $this->options['content_position'] )
|
525 |
$align = ' pf-align'.$this->options['content_position'];
|
526 |
$href = str_replace("&", "&", $href );
|
527 |
+
$button = apply_filters( 'printfriendly_button', '<div class="printfriendly'.$align.'"><a href="'.$href.'" rel="nofollow" '.$onclick.' class="noslimstat" title="Printer Friendly, PDF & Email">'.$this->button().'</a></div>' );
|
528 |
return $button;
|
529 |
}
|
530 |
|
585 |
|
586 |
$valid_input = $input;
|
587 |
|
588 |
+
// Section 1 options
|
589 |
if ( !isset( $input['button_type'] ) || !in_array( $input['button_type'], array(
|
590 |
+
'buttons/printfriendly-pdf-email-button.png',
|
591 |
+
'buttons/printfriendly-pdf-email-button-md.png',
|
592 |
+
'buttons/printfriendly-pdf-email-button-notext.png', // buttongroup1
|
593 |
+
'buttons/printfriendly-pdf-button.png',
|
594 |
+
'buttons/printfriendly-pdf-button-nobg.png',
|
595 |
+
'buttons/printfriendly-pdf-button-nobg-md.png', // buttongroup2
|
596 |
+
'buttons/printfriendly-button.png',
|
597 |
+
'buttons/printfriendly-button-nobg.png',
|
598 |
+
'buttons/printfriendly-button-md.png',
|
599 |
+
'buttons/printfriendly-button-lg.png', // buttongroup3
|
600 |
+
'buttons/print-button.png',
|
601 |
+
'buttons/print-button-nobg.png',
|
602 |
+
'buttons/print-button-gray.png', // buttongroup3
|
603 |
+
'custom-button' // custom
|
604 |
+
) ) ) {
|
605 |
+
$valid_input['button_type'] = 'buttons/printfriendly-button.png';
|
606 |
+
}
|
607 |
+
|
608 |
+
if ( !isset( $input['custom_button_icon'] ) || !in_array( $input['custom_button_icon'], array(
|
609 |
+
'https://cdn.printfriendly.com/icons/printfriendly-icon-sm.png',
|
610 |
+
'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png',
|
611 |
+
'https://cdn.printfriendly.com/icons/printfriendly-icon-lg.png',
|
612 |
+
'custom-image',
|
613 |
+
'no-image'
|
614 |
+
) ) ) {
|
615 |
+
$valid_input['custom_button_icon'] = 'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png';
|
616 |
+
}
|
617 |
|
618 |
// @todo custom image url validation
|
619 |
if ( !isset( $input['custom_image'] ) || empty( $input['custom_image'] ) )
|
620 |
$valid_input['custom_image'] = '';
|
621 |
|
622 |
+
if ( !isset( $input['custom_button_text'] ) ) {
|
623 |
+
$valid_input['custom_button_text'] = 'custom-text';
|
624 |
+
}
|
625 |
+
|
626 |
// @todo validate optional custom text
|
627 |
if ( !isset( $input['custom_text'] ) ) {
|
628 |
+
$valid_input['custom_text'] = 'Print Friendly';
|
629 |
}
|
|
|
|
|
|
|
630 |
|
631 |
// Custom button selected, but no url nor text given, reset button type to default
|
632 |
+
if( 'custom-button' === $valid_input['button_type'] && ( '' === $valid_input['custom_image'] && '' === $input['custom_text'] ) ) {
|
633 |
+
$valid_input['button_type'] = 'buttons/printfriendly-button.png';
|
634 |
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.', $this->hook ) );
|
635 |
}
|
636 |
|
866 |
try {
|
867 |
// Set some defaults
|
868 |
$this->options = array(
|
869 |
+
'button_type' => 'buttons/printfriendly-button.png',
|
870 |
'content_position' => 'left',
|
871 |
'content_placement' => 'after',
|
872 |
+
'custom_button_icon' => 'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png',
|
873 |
+
'custom_button_text' => 'custom-text',
|
874 |
+
'custom_image' => '',
|
875 |
+
'custom_text' => 'PrintFriendly',
|
876 |
'enable_css' => 'on',
|
877 |
'margin_top' => '12',
|
878 |
'margin_right' => '12',
|
880 |
'margin_left' => '12',
|
881 |
'show_on_posts' => 'on',
|
882 |
'show_on_pages' => 'on',
|
883 |
+
'text_color' => '#3AAA11',
|
884 |
'text_size' => 14,
|
885 |
'logo' => 'favicon',
|
886 |
'image_url' => '',
|
1049 |
$this->options['images-size'] = $this->options['hide-images'] == '1' ? 'remove-images' : 'full-size';
|
1050 |
}
|
1051 |
|
1052 |
+
if ($this->options['db_version'] < 13) {
|
1053 |
+
switch ($this->options['button_type']) {
|
1054 |
+
case 'pf-button.gif':
|
1055 |
+
$this->options['button_type'] = 'buttons/printfriendly-button.png';
|
1056 |
+
break;
|
1057 |
+
case 'pf-button-both.gif':
|
1058 |
+
$this->options['button_type'] = 'buttons/printfriendly-pdf-button.png';
|
1059 |
+
break;
|
1060 |
+
case 'pf-button-big.gif':
|
1061 |
+
$this->options['button_type'] = 'buttons/printfriendly-button-lg.png';
|
1062 |
+
break;
|
1063 |
+
case 'pf-button-print-pdf-mail.png':
|
1064 |
+
$this->options['button_type'] = 'buttons/printfriendly-pdf-email-button-notext.png';
|
1065 |
+
break;
|
1066 |
+
case 'button-print-grnw20.png':
|
1067 |
+
$this->options['button_type'] = 'buttons/print-button.png';
|
1068 |
+
break;
|
1069 |
+
case 'button-print-blu20.png':
|
1070 |
+
$this->options['button_type'] = 'buttons/print-button-nobg.png';
|
1071 |
+
break;
|
1072 |
+
case 'button-print-gry20.png':
|
1073 |
+
$this->options['button_type'] = 'buttons/print-button-gray.png';
|
1074 |
+
break;
|
1075 |
+
case 'pf-icon-small.gif':
|
1076 |
+
case 'pf-icon.gif':
|
1077 |
+
$this->options['button_type'] = 'custom-button';
|
1078 |
+
$this->options['custom_button_icon'] = 'icons/printfriendly-icon-md.png';
|
1079 |
+
$this->options['custom_button_text'] = 'custom-text';
|
1080 |
+
$this->options['custom_image'] = 'icons/printfriendly-icon-md.png';
|
1081 |
+
break;
|
1082 |
+
case 'text-only':
|
1083 |
+
$this->options['button_type'] = 'custom-button';
|
1084 |
+
$this->options['custom_button_icon'] = 'no-image';
|
1085 |
+
$this->options['custom_button_text'] = 'custom-text';
|
1086 |
+
break;
|
1087 |
+
}
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
if ($this->options['db_version'] < 14) {
|
1091 |
+
if ($this->options['button_type'] == 'pf-icon-both.gif') {
|
1092 |
+
$this->options['button_type'] = 'buttons/printfriendly-pdf-button-nobg.png';
|
1093 |
+
}
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
if ($this->options['db_version'] < 15) {
|
1097 |
+
if ($this->options['button_type'] == 'custom-image') {
|
1098 |
+
$this->options['button_type'] = 'custom-button';
|
1099 |
+
|
1100 |
+
switch ($this->options['custom_image']) {
|
1101 |
+
case 'icons/printfriendly-icon-sm.png':
|
1102 |
+
case 'icons/printfriendly-icon-md.png':
|
1103 |
+
case 'icons/printfriendly-icon-lg.png':
|
1104 |
+
$this->options['custom_button_icon'] = $this->options['custom_image'];
|
1105 |
+
break;
|
1106 |
+
case '':
|
1107 |
+
$this->options['custom_button_icon'] = 'no-image';
|
1108 |
+
break;
|
1109 |
+
default:
|
1110 |
+
$this->options['custom_button_icon'] = 'custom-image';
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
if ($this->options['custom_text'] == '') {
|
1114 |
+
$this->options['custom_button_text'] = 'no-text';
|
1115 |
+
} else {
|
1116 |
+
$this->options['custom_button_text'] = 'custom-text';
|
1117 |
+
}
|
1118 |
+
}
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
if ($this->options['db_version'] < 16) {
|
1122 |
+
if ($this->options['custom_button_icon'] == 'icons/printfriendly-icon-md.png') {
|
1123 |
+
$this->options['custom_button_icon'] = 'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png';
|
1124 |
+
}
|
1125 |
+
}
|
1126 |
+
|
1127 |
$this->options['db_version'] = $this->db_version;
|
1128 |
|
1129 |
update_option( $this->option_name, $this->options );
|
1148 |
echo '<br>';
|
1149 |
}
|
1150 |
|
1151 |
+
/**
|
1152 |
+
* Displays radio button in the admin area
|
1153 |
+
*
|
1154 |
+
* @since 3.12.0
|
1155 |
+
* @param string $name the name of the radio button to generate.
|
1156 |
+
*/
|
1157 |
+
function radio_custom_image($value){
|
1158 |
+
?>
|
1159 |
+
<label class="radio-custom-btn">
|
1160 |
+
<input type="radio" name="<?php echo $this->option_name ?>[custom_button_icon]" value="<?php echo $value ?>" <?php $this->checked( 'custom_button_icon', $value ) ?>>
|
1161 |
+
<img src="<?php echo $value ?>" alt="Print Friendly, PDF & Email" style="display: inline" />
|
1162 |
+
</label>
|
1163 |
+
<?php
|
1164 |
+
}
|
1165 |
+
|
1166 |
/**
|
1167 |
* Displays button image in the admin area
|
1168 |
*
|
1172 |
function button( $name = false ){
|
1173 |
if( !$name )
|
1174 |
$name = $this->options['button_type'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1175 |
|
1176 |
+
$button_css = $this->generic_button_css();
|
|
|
1177 |
|
1178 |
+
$img_path = 'https://cdn.printfriendly.com/';
|
|
|
|
|
1179 |
|
1180 |
+
$return = '';
|
|
|
|
|
1181 |
|
1182 |
+
if ($name == "custom-button") {
|
1183 |
+
if ($this->options['custom_button_icon'] == 'custom-image' && '' != trim($this->options['custom_image'])) {
|
1184 |
+
$return = '<img src="'.esc_url($this->options['custom_image']).'" alt="Print Friendly, PDF & Email" style="display: inline" />';
|
1185 |
+
} else if ( $this->options['custom_button_icon'] != 'no-image' ) {
|
1186 |
+
$return = '<img src="'.esc_url($this->options['custom_button_icon']).'" alt="Print Friendly, PDF & Email" style="display: inline" />';
|
1187 |
+
}
|
1188 |
|
1189 |
+
/* esc_html was removerd to support custom html, CSRF prevents from attack by using this field */
|
1190 |
+
if ($this->options['custom_button_text'] == 'custom-text') {
|
1191 |
+
$return .= $this->options['custom_text'];
|
1192 |
+
}
|
1193 |
|
1194 |
+
return $return;
|
1195 |
+
} else {
|
1196 |
+
return '<img style="'.$button_css.'" src="'.$img_path.$name.'" alt="Print Friendly, PDF & Email" />';
|
1197 |
}
|
1198 |
}
|
1199 |
|
1213 |
* @since 3.0.9
|
1214 |
*/
|
1215 |
function custom_button_preview() {
|
1216 |
+
if( $this->options['custom_button_icon'] == 'no-image' ) {
|
1217 |
$button_preview = '<span id="pf-custom-button-preview"></span>';
|
1218 |
+
} else if ($this->options['custom_button_icon'] == 'custom-image') {
|
1219 |
+
$button_preview = '<span id="pf-custom-button-preview"><img src="'.esc_url($this->options['custom_image']).'" alt="Print Friendly, PDF & Email" /></span>';
|
1220 |
+
} else {
|
1221 |
+
$button_preview = '<span id="pf-custom-button-preview"><img src="'.esc_url($this->options['custom_button_icon']).'" alt="Print Friendly, PDF & Email" /></span>';
|
1222 |
+
}
|
1223 |
|
1224 |
+
if ($this->options['custom_button_text'] != 'no-text') {
|
1225 |
+
$button_text = $this->options['custom_text'];
|
1226 |
+
} else {
|
1227 |
+
$button_text = '';
|
1228 |
+
}
|
1229 |
+
|
1230 |
+
$button_preview .= '<span class="printfriendly-text2">'.esc_html($button_text).'</span>';
|
1231 |
|
1232 |
echo $button_preview;
|
1233 |
}
|
1395 |
echo '<pre>' . __( 'Options:', $this->hook ) . '<br><br>' . print_r( $this->options, 1 ) . '</pre>';
|
1396 |
}
|
1397 |
?>
|
1398 |
+
|
1399 |
+
<style type="text/css">
|
1400 |
+
input[type="radio"], img {
|
1401 |
+
vertical-align: middle;
|
1402 |
+
}
|
1403 |
+
</style>
|
1404 |
+
|
1405 |
<div id="pf_settings" class="wrap">
|
1406 |
|
1407 |
<div class="icon32" id="printfriendly"></div>
|
1415 |
|
1416 |
<fieldset id="button-style">
|
1417 |
<div id="buttongroup1">
|
1418 |
+
<?php $this->radio('buttons/printfriendly-pdf-email-button.png'); ?>
|
1419 |
+
<?php $this->radio('buttons/printfriendly-pdf-email-button-md.png'); ?>
|
1420 |
+
<?php $this->radio('buttons/printfriendly-pdf-email-button-notext.png'); ?>
|
1421 |
</div>
|
1422 |
<div id="buttongroup2">
|
1423 |
+
<?php $this->radio('buttons/printfriendly-pdf-button.png'); ?>
|
1424 |
+
<?php $this->radio('buttons/printfriendly-pdf-button-nobg.png'); ?>
|
1425 |
+
<?php $this->radio('buttons/printfriendly-pdf-button-nobg-md.png'); ?>
|
1426 |
</div>
|
1427 |
<div id="buttongroup3">
|
1428 |
+
<?php $this->radio('buttons/printfriendly-button.png'); ?>
|
1429 |
+
<?php $this->radio('buttons/printfriendly-button-nobg.png'); ?>
|
1430 |
+
<?php $this->radio('buttons/printfriendly-button-md.png'); ?>
|
1431 |
+
<?php $this->radio('buttons/printfriendly-button-lg.png'); ?>
|
1432 |
+
</div>
|
1433 |
+
<div id="buttongroup4">
|
1434 |
+
<?php $this->radio('buttons/print-button.png'); ?>
|
1435 |
+
<?php $this->radio('buttons/print-button-nobg.png'); ?>
|
1436 |
+
<?php $this->radio('buttons/print-button-gray.png'); ?>
|
1437 |
</div>
|
1438 |
|
1439 |
+
<div id="custom-btn-group" class="clear">
|
1440 |
+
<label>
|
1441 |
+
<?php echo '<input id="custom-btn" class="radio" name="'.$this->option_name.'[button_type]" type="radio" value="custom-button" '.$this->checked( 'button_type', 'custom-button', false ).'/>'; ?>
|
1442 |
<?php _e( "Custom Button", $this->hook ); ?>
|
1443 |
</label>
|
1444 |
+
|
1445 |
+
<div id="custom-img" style="float: left;">
|
1446 |
+
<h2><?php _e( 'Image', $this->hook ); ?></h2><br>
|
1447 |
+
<?php $this->radio_custom_image('https://cdn.printfriendly.com/icons/printfriendly-icon-sm.png'); ?>
|
1448 |
+
<?php $this->radio_custom_image('https://cdn.printfriendly.com/icons/printfriendly-icon-md.png'); ?>
|
1449 |
+
<?php $this->radio_custom_image('https://cdn.printfriendly.com/icons/printfriendly-icon-lg.png'); ?>
|
1450 |
+
|
1451 |
+
<label class="radio-custom-btn">
|
1452 |
+
<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'); ?>>
|
1453 |
+
<b><?php _e( 'Use Your Image', $this->hook ); ?></b>
|
1454 |
+
<div id="enter-image-url" style="margin: 10px 0 0 30px">
|
1455 |
+
<?php _e( 'Enter Image URL', $this->hook ); ?><br>
|
1456 |
+
<input id="custom_image" type="text" class="clear regular-text" name="<?php echo $this->option_name; ?>[custom_image]" value="<?php $this->val( 'custom_image' ); ?>" />
|
1457 |
+
<div id="pf-custom-button-error"></div>
|
1458 |
+
<div class="description"><?php _e( "Ex: https://www.example.com/<br>Ex: /wp/wp-content/uploads/example.png", $this->hook ); ?>
|
1459 |
+
</div>
|
1460 |
+
</div>
|
1461 |
+
</label>
|
1462 |
+
|
1463 |
+
<label class="radio-custom-btn">
|
1464 |
+
<input type="radio" name="<?php echo $this->option_name ?>[custom_button_icon]" value="no-image" <?php $this->checked( 'custom_button_icon', 'no-image'); ?>>
|
1465 |
+
<b><?php _e( 'No Image', $this->hook ); ?></b>
|
1466 |
+
</label>
|
1467 |
</div>
|
1468 |
+
|
1469 |
+
<div id="custom-txt" style="float: left;">
|
1470 |
+
<h2><?php _e( 'Text', $this->hook ); ?></h2>
|
1471 |
<div id="txt-enter">
|
1472 |
+
<label>
|
1473 |
+
<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'); ?>>
|
1474 |
+
<input type="text" size="10" class="clear regular-text" name="<?php echo $this->option_name; ?>[custom_text]" id="custom_text" value="<?php $this->val( 'custom_text' ); ?>">
|
1475 |
+
</label>
|
1476 |
+
<label>
|
1477 |
+
<input type="radio" name="<?php echo $this->option_name; ?>[custom_button_text]" value="no-text" <?php $this->checked( 'custom_button_text', 'no-text'); ?>>
|
1478 |
+
<b><?php _e( 'No Text', $this->hook ); ?></b>
|
1479 |
+
</label>
|
1480 |
</div>
|
1481 |
+
<div>
|
1482 |
+
<div id="txt-color">
|
1483 |
+
<?php _e( "Text Color", $this->hook ); ?>
|
1484 |
+
<input type="hidden" name="<?php echo $this->option_name; ?>[text_color]" id="text_color" value="<?php $this->val( 'text_color' ); ?>"/><br>
|
1485 |
+
<div id="colorSelector">
|
1486 |
+
<div style="background-color: <?php echo $this->options['text_color']; ?>;"></div>
|
1487 |
+
</div>
|
1488 |
+
</div>
|
1489 |
+
<div id="txt-size">
|
1490 |
+
<?php _e( "Text Size", $this->hook ); ?><br>
|
1491 |
+
<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' ); ?>"/>
|
1492 |
</div>
|
1493 |
</div>
|
|
|
|
|
|
|
|
|
1494 |
</div>
|
1495 |
+
|
1496 |
+
<div id="custom-button-preview" style="float: left;">
|
1497 |
+
<h2><?php _e( 'Preview', $this->hook ); ?></h2>
|
1498 |
+
<?php $this->custom_button_preview(); ?>
|
1499 |
+
</div>
|
1500 |
</div>
|
1501 |
</fieldset>
|
1502 |
<br class="clear">
|
1504 |
<!--Section 2 Button Positioning-->
|
1505 |
<div id="button-positioning">
|
1506 |
<h3><?php _e( "Button Positioning", $this->hook ); ?>
|
1507 |
+
<span id="css"><input type="checkbox" name="<?php echo $this->option_name; ?>[enable_css]" value="<?php $this->val('enable_css');?>" <?php $this->checked('enable_css', 'off'); ?> /><?php _e('Do not use CSS for button styles'); ?></span>
|
1508 |
</h3>
|
1509 |
<div id="button-positioning-options">
|
1510 |
<div id="alignment">
|
1585 |
<label for="upload-an-image"><?php _e( "Enter url", $this->hook ); ?></label><input id="upload-an-image" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[image_url]" value="<?php $this->val( 'image_url' ); ?>" />
|
1586 |
<label for="image-tagline"><?php _e( "Text (optional)", $this->hook ); ?></label><input id="image-tagline" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[tagline]" value="<?php $this->val( 'tagline' ); ?>" />
|
1587 |
</div> */ ?>
|
1588 |
+
<div class="custom-logo"><label for="Enter_URL"><?php _e( "Enter url", $this->hook ); ?></label><input id="upload-an-image" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[image_url]" value="<?php $this->val( 'image_url' ); ?>" /><label for="Text__optional_"><?php _e( "Text (optional)", $this->hook ); ?></label><input id="image-tagline" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[tagline]" value="<?php $this->val( 'tagline' ); ?>" /></div>
|
1589 |
<div id="pf-image-error"></div>
|
1590 |
<div id="pf-image-preview"></div>
|
1591 |
<label for="click_to_delete">
|
1602 |
<option value="large" <?php selected( $this->options['images-size'], 'large' ); ?>><?php _e( "Large", $this->hook ); ?></option>
|
1603 |
<option value="medium" <?php selected( $this->options['images-size'], 'medium' ); ?>><?php _e( "Medium", $this->hook ); ?></option>
|
1604 |
<option value="small" <?php selected( $this->options['images-size'], 'small' ); ?>><?php _e( "Small", $this->hook ); ?></option>
|
1605 |
+
<option value="remove-images" <?php selected( $this->options['images-size'], 'remove-images' ); ?>><?php _e( "Remove Images", $this->hook ); ?></option>
|
1606 |
</select>
|
1607 |
</label>
|
1608 |
<label for="image-style">
|
1685 |
<?php
|
1686 |
if (class_exists('WooCommerce')) {
|
1687 |
?>
|
1688 |
+
<span><strong><?php _e( "Not available for woocommerce", $this->hook ); ?></strong></span>
|
1689 |
<?php
|
1690 |
} else {
|
1691 |
?>
|
1704 |
<input type="reset" class="button-secondary" value="<?php esc_attr_e( "Cancel", $this->hook ); ?>"/>
|
1705 |
</p>
|
1706 |
<div id="after-submit">
|
|
|
1707 |
<p>
|
1708 |
+
<?php _e( 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>' ), $this->hook ); ?>
|
1709 |
+
</p>
|
1710 |
+
<p><?php _e( "Need professional options for your corporate, education, or agency developed website? Check out", $this->hook ); ?> <a href="https://www.printfriendly.com/button/pro?utm_source=wp&utm_medium=link&utm_campaign=wp-link" target="_blank">PrintFriendly Pro</a>.</p>
|
1711 |
+
<p>
|
1712 |
+
<?php _e( "Need help or have suggestions?", $this->hook ); ?> <a href="mailto:support@printfriendly.com?subject=Support%20for%20PrintFriendly%20WordPress%20plugin">support@PrintFriendly.com</a>
|
1713 |
+
</p>
|
1714 |
</div>
|
|
|
1715 |
</form>
|
|
|
|
|
1716 |
<?php
|
1717 |
}
|
1718 |
}
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: printfriendly,joostdevalk, jrf
|
3 |
Tags: print, pdf, email, print button, wp-print, print recipe, print post, print page, print widget, print plugin, printable, wp-pdf, pdf post, pdf page, pdf button, pdf widget, pdf plugin, woocommerce print, woocommerce pdf
|
4 |
Requires at least: 2.8
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 3.
|
7 |
|
8 |
|
9 |
The #1 Print, PDF, Email button. Stylish, full featured, customizable. Add custom header, footer, and more.
|
@@ -140,6 +140,48 @@ You can [hide the Print, PDF, and Email button](https://support.printfriendly.co
|
|
140 |
|
141 |
== Changelog ==
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
= 3.8.7 =
|
144 |
* Bug fix.
|
145 |
|
2 |
Contributors: printfriendly,joostdevalk, jrf
|
3 |
Tags: print, pdf, email, print button, wp-print, print recipe, print post, print page, print widget, print plugin, printable, wp-pdf, pdf post, pdf page, pdf button, pdf widget, pdf plugin, woocommerce print, woocommerce pdf
|
4 |
Requires at least: 2.8
|
5 |
+
Tested up to: 4.8
|
6 |
+
Stable tag: 3.12.5
|
7 |
|
8 |
|
9 |
The #1 Print, PDF, Email button. Stylish, full featured, customizable. Add custom header, footer, and more.
|
140 |
|
141 |
== Changelog ==
|
142 |
|
143 |
+
= 3.12.5 =
|
144 |
+
* Chanage link in settings page
|
145 |
+
|
146 |
+
= 3.12.4 =
|
147 |
+
* Bug fix, avoid "undefined variable: return"
|
148 |
+
|
149 |
+
= 3.12.3 =
|
150 |
+
* Bug fix, sometimes custom image didn't display correctly after upgrade
|
151 |
+
|
152 |
+
= 3.12.2 =
|
153 |
+
* Add title to Printfriendly button and change button image alt
|
154 |
+
|
155 |
+
= 3.12.1 =
|
156 |
+
* Fix translations
|
157 |
+
|
158 |
+
= 3.12.0 =
|
159 |
+
* Update custom button UI
|
160 |
+
|
161 |
+
= 3.11.2 =
|
162 |
+
* Fix button upgrade for pf-icon-both.gif
|
163 |
+
|
164 |
+
= 3.11.1 =
|
165 |
+
* Bug fix
|
166 |
+
|
167 |
+
= 3.11.0 =
|
168 |
+
* Update buttons
|
169 |
+
|
170 |
+
= 3.10.0 =
|
171 |
+
* Change "leave us a rating" message.
|
172 |
+
|
173 |
+
= 3.9.2 =
|
174 |
+
* Correctly handle spaces in print-only detection
|
175 |
+
|
176 |
+
= 3.9.1 =
|
177 |
+
* Better print-only detection
|
178 |
+
|
179 |
+
= 3.9.0 =
|
180 |
+
* Add new button
|
181 |
+
|
182 |
+
= 3.8.8 =
|
183 |
+
* Bug fix.
|
184 |
+
|
185 |
= 3.8.7 =
|
186 |
* Bug fix.
|
187 |
|
trunk/admin.css
CHANGED
@@ -15,7 +15,7 @@ h3.hndle {
|
|
15 |
padding: 7px 5px;
|
16 |
}
|
17 |
|
18 |
-
#buttongroup1, #buttongroup2, #buttongroup3, #
|
19 |
display: block;
|
20 |
margin-right: 3em;
|
21 |
float: left;
|
@@ -25,20 +25,21 @@ h3.hndle {
|
|
25 |
}
|
26 |
|
27 |
#custom-button-preview {
|
28 |
-
clear:both;
|
29 |
-
padding-top: 20px;
|
30 |
margin-left: 2em;
|
31 |
}
|
32 |
#custom-button-preview img {
|
33 |
margin-right: 6px;
|
34 |
}
|
35 |
-
#
|
36 |
float: left;
|
37 |
}
|
38 |
|
39 |
-
#custom-txt, #custom-img {
|
40 |
-
margin:
|
41 |
-
|
|
|
|
|
|
|
42 |
}
|
43 |
|
44 |
.description {
|
@@ -358,10 +359,40 @@ span.description.pf-help-link {
|
|
358 |
font-style:normal !important
|
359 |
}
|
360 |
|
361 |
-
#custom-txt #txt-enter {
|
362 |
-
margin: 0 0 2em 0;
|
363 |
-
}
|
364 |
-
|
365 |
#margin input[type="number"]{
|
366 |
width: 65px;
|
367 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
padding: 7px 5px;
|
16 |
}
|
17 |
|
18 |
+
#buttongroup1, #buttongroup2, #buttongroup3, #button-positioning div, #button-placement div {
|
19 |
display: block;
|
20 |
margin-right: 3em;
|
21 |
float: left;
|
25 |
}
|
26 |
|
27 |
#custom-button-preview {
|
|
|
|
|
28 |
margin-left: 2em;
|
29 |
}
|
30 |
#custom-button-preview img {
|
31 |
margin-right: 6px;
|
32 |
}
|
33 |
+
#placement-adv-options {
|
34 |
float: left;
|
35 |
}
|
36 |
|
37 |
+
#custom-txt, #custom-img, #custom-button-preview {
|
38 |
+
margin: 0 3em;
|
39 |
+
}
|
40 |
+
|
41 |
+
#custom-txt>div {
|
42 |
+
margin-bottom: 10px;
|
43 |
}
|
44 |
|
45 |
.description {
|
359 |
font-style:normal !important
|
360 |
}
|
361 |
|
|
|
|
|
|
|
|
|
362 |
#margin input[type="number"]{
|
363 |
width: 65px;
|
364 |
+
}
|
365 |
+
|
366 |
+
label.radio-custom-btn {
|
367 |
+
margin-right: 15px;
|
368 |
+
}
|
369 |
+
|
370 |
+
#custom-btn-group {
|
371 |
+
float: left;
|
372 |
+
}
|
373 |
+
|
374 |
+
#custom-btn-group b {
|
375 |
+
font-weight: bold;
|
376 |
+
font-size: 14px;
|
377 |
+
}
|
378 |
+
|
379 |
+
#custom-btn-group, h2 {
|
380 |
+
margin-top: 0;
|
381 |
+
}
|
382 |
+
|
383 |
+
#custom-img h2 {
|
384 |
+
margin-bottom: 0;
|
385 |
+
}
|
386 |
+
|
387 |
+
#custom-img label, #custom-txt label {
|
388 |
+
margin: 0 0 15px 0;
|
389 |
+
}
|
390 |
+
|
391 |
+
#txt-color, #txt-size {
|
392 |
+
float: left;
|
393 |
+
margin-right: 20px;
|
394 |
+
}
|
395 |
+
|
396 |
+
#custom_text {
|
397 |
+
width: 200px;
|
398 |
+
}
|
trunk/admin.js
CHANGED
@@ -89,17 +89,18 @@ jQuery(document).ready(function() {
|
|
89 |
}
|
90 |
}).change();
|
91 |
|
92 |
-
jQuery('#custom_text').change
|
93 |
pf_custom_text_change();
|
94 |
-
})
|
95 |
|
96 |
-
jQuery('
|
97 |
pf_custom_text_change();
|
98 |
});
|
99 |
|
100 |
function pf_custom_text_change(){
|
101 |
jQuery('#buttongroup3 span:not(.printandpdf)').text( jQuery('#custom_text').val() );
|
102 |
-
jQuery('
|
|
|
103 |
}
|
104 |
|
105 |
function pf_initialize_preview(urlInputSelector, previewSelector) {
|
@@ -107,11 +108,21 @@ jQuery(document).ready(function() {
|
|
107 |
var imgUrl = jQuery.trim(el.val());
|
108 |
var preview = jQuery(previewSelector + '-preview');
|
109 |
var error = jQuery(previewSelector + '-error');
|
|
|
110 |
el.bind('input paste change keyup', function() {
|
111 |
setTimeout(function() {
|
112 |
// ie shows error if we try to merge the two below into a single statement
|
113 |
var img = jQuery('<img/>');
|
114 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
img.load(function() {
|
116 |
error.html('');
|
117 |
preview.html('').append(img);})
|
@@ -129,6 +140,7 @@ jQuery(document).ready(function() {
|
|
129 |
}
|
130 |
|
131 |
pf_initialize_preview('#custom_image', '#pf-custom-button');
|
|
|
132 |
pf_initialize_preview('#upload-an-image', '#pf-image');
|
133 |
jQuery('#custom_image, #upload-an-image').change();
|
134 |
jQuery('#custom_image').bind('focus', function() {
|
@@ -252,6 +264,13 @@ jQuery(document).ready(function() {
|
|
252 |
jQuery('#category_ids').val(ids.join(','));
|
253 |
});
|
254 |
|
255 |
-
|
|
|
|
|
|
|
256 |
|
257 |
-
|
|
|
|
|
|
|
|
89 |
}
|
90 |
}).change();
|
91 |
|
92 |
+
jQuery('#custom_text').bind('change keyup', function(){
|
93 |
pf_custom_text_change();
|
94 |
+
});
|
95 |
|
96 |
+
jQuery("[name='printfriendly_option[custom_button_text]']").change(function(){
|
97 |
pf_custom_text_change();
|
98 |
});
|
99 |
|
100 |
function pf_custom_text_change(){
|
101 |
jQuery('#buttongroup3 span:not(.printandpdf)').text( jQuery('#custom_text').val() );
|
102 |
+
var newText = (jQuery("[name='printfriendly_option[custom_button_text]']:checked").val() === 'no-text') ? '' : jQuery('#custom_text').val();
|
103 |
+
jQuery('#custom-btn-group span.printfriendly-text2').text( newText );
|
104 |
}
|
105 |
|
106 |
function pf_initialize_preview(urlInputSelector, previewSelector) {
|
108 |
var imgUrl = jQuery.trim(el.val());
|
109 |
var preview = jQuery(previewSelector + '-preview');
|
110 |
var error = jQuery(previewSelector + '-error');
|
111 |
+
|
112 |
el.bind('input paste change keyup', function() {
|
113 |
setTimeout(function() {
|
114 |
// ie shows error if we try to merge the two below into a single statement
|
115 |
var img = jQuery('<img/>');
|
116 |
+
var customButtonIcon = jQuery("[name='printfriendly_option[custom_button_icon]']:checked").val();
|
117 |
+
|
118 |
+
if (customButtonIcon === 'custom-image') {
|
119 |
+
imgUrl = jQuery('#custom_image').val();
|
120 |
+
} else if (customButtonIcon === 'no-image') {
|
121 |
+
imgUrl = '';
|
122 |
+
} else {
|
123 |
+
imgUrl = customButtonIcon;
|
124 |
+
}
|
125 |
+
|
126 |
img.load(function() {
|
127 |
error.html('');
|
128 |
preview.html('').append(img);})
|
140 |
}
|
141 |
|
142 |
pf_initialize_preview('#custom_image', '#pf-custom-button');
|
143 |
+
pf_initialize_preview("[name='printfriendly_option[custom_button_icon]']", '#pf-custom-button');
|
144 |
pf_initialize_preview('#upload-an-image', '#pf-image');
|
145 |
jQuery('#custom_image, #upload-an-image').change();
|
146 |
jQuery('#custom_image').bind('focus', function() {
|
264 |
jQuery('#category_ids').val(ids.join(','));
|
265 |
});
|
266 |
|
267 |
+
jQuery('#custom_image').click(function() {
|
268 |
+
jQuery("#custom-image-rb").prop('checked', true);
|
269 |
+
jQuery("#custom-image-rb").trigger("change");
|
270 |
+
});
|
271 |
|
272 |
+
jQuery('#custom_text').click(function() {
|
273 |
+
jQuery("#custom-text-rb").prop('checked', true);
|
274 |
+
jQuery("#custom-text-rb").trigger("change");
|
275 |
+
});
|
276 |
+
});
|
trunk/pf.php
CHANGED
@@ -5,11 +5,24 @@ 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: 3.
|
9 |
Author: Print, PDF, & Email by PrintFriendly
|
10 |
Author URI: http://www.PrintFriendly.com
|
11 |
|
12 |
Changelog :
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
3.8.7 - Bug fix.
|
14 |
3.8.6 - Allow default image setting to be small medium or large.
|
15 |
3.8.5 - Bug fix.
|
@@ -110,7 +123,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
110 |
* Current plugin version.
|
111 |
* @var string
|
112 |
*/
|
113 |
-
var $plugin_version = '3.
|
114 |
|
115 |
/**
|
116 |
* The hook, used for text domain as well as hooks on pages and in get requests for admin.
|
@@ -134,7 +147,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
134 |
* Database version, used to allow for easy upgrades to / additions in plugin options between plugin versions.
|
135 |
* @var int
|
136 |
*/
|
137 |
-
var $db_version =
|
138 |
|
139 |
/**
|
140 |
* Settings page, used within the plugin to reliably load the plugins admin JS and CSS files only on the admin page.
|
@@ -279,8 +292,9 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
279 |
* @since 3.3.0
|
280 |
**/
|
281 |
function print_only_override($content) {
|
282 |
-
$pattern = '/class
|
283 |
-
$pf_pattern = '/class
|
|
|
284 |
return (preg_match($pattern, $content) || preg_match($pf_pattern, $content)) ;
|
285 |
}
|
286 |
|
@@ -403,6 +417,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
403 |
var pfDisablePDF = '<?php echo esc_js($this->options['pdf']); ?>';
|
404 |
var pfDisablePrint = '<?php echo esc_js($this->options['print']); ?>';
|
405 |
var pfCustomCSS = '<?php echo esc_js(esc_url($this->options['custom_css_url'])); ?>';
|
|
|
406 |
(function() {
|
407 |
var e = document.createElement('script'); e.type="text/javascript";
|
408 |
e.src = 'https://cdn.printfriendly.com/printfriendly.js';
|
@@ -509,7 +524,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
509 |
if ( 'none' != $this->options['content_position'] )
|
510 |
$align = ' pf-align'.$this->options['content_position'];
|
511 |
$href = str_replace("&", "&", $href );
|
512 |
-
$button = apply_filters( 'printfriendly_button', '<div class="printfriendly'.$align.'"><a href="'.$href.'" rel="nofollow" '.$onclick.' class="noslimstat">'.$this->button().'</a></div>' );
|
513 |
return $button;
|
514 |
}
|
515 |
|
@@ -570,32 +585,52 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
570 |
|
571 |
$valid_input = $input;
|
572 |
|
573 |
-
|
574 |
if ( !isset( $input['button_type'] ) || !in_array( $input['button_type'], array(
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
|
584 |
// @todo custom image url validation
|
585 |
if ( !isset( $input['custom_image'] ) || empty( $input['custom_image'] ) )
|
586 |
$valid_input['custom_image'] = '';
|
587 |
|
|
|
|
|
|
|
|
|
588 |
// @todo validate optional custom text
|
589 |
if ( !isset( $input['custom_text'] ) ) {
|
590 |
-
|
591 |
}
|
592 |
-
/* else {
|
593 |
-
|
594 |
-
}*/
|
595 |
|
596 |
// Custom button selected, but no url nor text given, reset button type to default
|
597 |
-
if( 'custom-
|
598 |
-
$valid_input['button_type'] = '
|
599 |
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.', $this->hook ) );
|
600 |
}
|
601 |
|
@@ -831,11 +866,13 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
831 |
try {
|
832 |
// Set some defaults
|
833 |
$this->options = array(
|
834 |
-
'button_type' => '
|
835 |
'content_position' => 'left',
|
836 |
'content_placement' => 'after',
|
837 |
-
'
|
838 |
-
'
|
|
|
|
|
839 |
'enable_css' => 'on',
|
840 |
'margin_top' => '12',
|
841 |
'margin_right' => '12',
|
@@ -843,7 +880,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
843 |
'margin_left' => '12',
|
844 |
'show_on_posts' => 'on',
|
845 |
'show_on_pages' => 'on',
|
846 |
-
'text_color' => '#
|
847 |
'text_size' => 14,
|
848 |
'logo' => 'favicon',
|
849 |
'image_url' => '',
|
@@ -1012,6 +1049,81 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1012 |
$this->options['images-size'] = $this->options['hide-images'] == '1' ? 'remove-images' : 'full-size';
|
1013 |
}
|
1014 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1015 |
$this->options['db_version'] = $this->db_version;
|
1016 |
|
1017 |
update_option( $this->option_name, $this->options );
|
@@ -1036,6 +1148,21 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1036 |
echo '<br>';
|
1037 |
}
|
1038 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1039 |
/**
|
1040 |
* Displays button image in the admin area
|
1041 |
*
|
@@ -1045,42 +1172,28 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1045 |
function button( $name = false ){
|
1046 |
if( !$name )
|
1047 |
$name = $this->options['button_type'];
|
1048 |
-
$button_css = $this->generic_button_css();
|
1049 |
-
/* esc_html was removerd to support custom html, CSRF prevents from attack by using this field */
|
1050 |
-
$text = $this->options['custom_text'];
|
1051 |
-
$img_path = 'https://cdn.printfriendly.com/';
|
1052 |
-
|
1053 |
-
switch($name){
|
1054 |
-
case "custom-image":
|
1055 |
-
if( '' == trim($this->options['custom_image']) )
|
1056 |
-
$return = '';
|
1057 |
-
else
|
1058 |
-
$return = '<img src="'.esc_url($this->options['custom_image']).'" alt="Print Friendly" />';
|
1059 |
-
|
1060 |
-
$return .= $text;
|
1061 |
|
1062 |
-
|
1063 |
-
break;
|
1064 |
|
1065 |
-
|
1066 |
-
return '<span class="printfriendly-text2">'.$text.'</span>';
|
1067 |
-
break;
|
1068 |
|
1069 |
-
|
1070 |
-
return '<span class="printfriendly-text2 printandpdf"><img style="border:none;margin-right:6px;display:inline-block" src="'.$img_path.'pf-print-icon.gif" width="16" height="15" alt="Print Friendly Version of this page" />Print <img style="'.$button_css.'margin:0 6px;display:inline-block" src="'.$img_path.'pf-pdf-icon.gif" width="12" height="12" alt="Get a PDF version of this webpage" />PDF</span>';
|
1071 |
-
break;
|
1072 |
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
|
|
|
|
|
|
1076 |
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
|
|
1080 |
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
}
|
1085 |
}
|
1086 |
|
@@ -1100,12 +1213,21 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1100 |
* @since 3.0.9
|
1101 |
*/
|
1102 |
function custom_button_preview() {
|
1103 |
-
if(
|
1104 |
$button_preview = '<span id="pf-custom-button-preview"></span>';
|
1105 |
-
else
|
1106 |
-
$button_preview = '<span id="pf-custom-button-preview"><img src="'.esc_url($this->options['custom_image']).'" alt="Print Friendly" /></span>';
|
|
|
|
|
|
|
1107 |
|
1108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1109 |
|
1110 |
echo $button_preview;
|
1111 |
}
|
@@ -1273,6 +1395,13 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1273 |
echo '<pre>' . __( 'Options:', $this->hook ) . '<br><br>' . print_r( $this->options, 1 ) . '</pre>';
|
1274 |
}
|
1275 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1276 |
<div id="pf_settings" class="wrap">
|
1277 |
|
1278 |
<div class="icon32" id="printfriendly"></div>
|
@@ -1286,53 +1415,88 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1286 |
|
1287 |
<fieldset id="button-style">
|
1288 |
<div id="buttongroup1">
|
1289 |
-
<?php $this->radio('
|
1290 |
-
<?php $this->radio('
|
1291 |
-
<?php $this->radio('
|
1292 |
</div>
|
1293 |
<div id="buttongroup2">
|
1294 |
-
<?php $this->radio('
|
1295 |
-
<?php $this->radio('button-
|
1296 |
-
<?php $this->radio('button-
|
1297 |
</div>
|
1298 |
<div id="buttongroup3">
|
1299 |
-
<?php $this->radio('
|
1300 |
-
<?php $this->radio('
|
1301 |
-
<?php $this->radio('
|
1302 |
-
<?php $this->radio('
|
|
|
|
|
|
|
|
|
|
|
1303 |
</div>
|
1304 |
|
1305 |
-
<div id="custom">
|
1306 |
-
<label
|
1307 |
-
<?php echo '<input id="custom-
|
1308 |
<?php _e( "Custom Button", $this->hook ); ?>
|
1309 |
</label>
|
1310 |
-
|
1311 |
-
|
1312 |
-
<
|
1313 |
-
|
1314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1315 |
</div>
|
1316 |
-
|
1317 |
-
<div id="custom-txt" >
|
|
|
1318 |
<div id="txt-enter">
|
1319 |
-
|
1320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1321 |
</div>
|
1322 |
-
<div
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
1327 |
</div>
|
1328 |
</div>
|
1329 |
-
<div id="txt-size">
|
1330 |
-
<?php _e( "Text Size", $this->hook ); ?><br>
|
1331 |
-
<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' ); ?>"/>
|
1332 |
-
</div>
|
1333 |
</div>
|
1334 |
-
|
1335 |
-
|
|
|
|
|
|
|
1336 |
</div>
|
1337 |
</fieldset>
|
1338 |
<br class="clear">
|
@@ -1340,7 +1504,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1340 |
<!--Section 2 Button Positioning-->
|
1341 |
<div id="button-positioning">
|
1342 |
<h3><?php _e( "Button Positioning", $this->hook ); ?>
|
1343 |
-
<span id="css"><input type="checkbox" name="<?php echo $this->option_name; ?>[enable_css]" value="<?php $this->val('enable_css');?>" <?php $this->checked('enable_css', 'off'); ?>
|
1344 |
</h3>
|
1345 |
<div id="button-positioning-options">
|
1346 |
<div id="alignment">
|
@@ -1421,7 +1585,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1421 |
<label for="upload-an-image"><?php _e( "Enter url", $this->hook ); ?></label><input id="upload-an-image" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[image_url]" value="<?php $this->val( 'image_url' ); ?>" />
|
1422 |
<label for="image-tagline"><?php _e( "Text (optional)", $this->hook ); ?></label><input id="image-tagline" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[tagline]" value="<?php $this->val( 'tagline' ); ?>" />
|
1423 |
</div> */ ?>
|
1424 |
-
<div class="custom-logo"><label for="Enter_URL"
|
1425 |
<div id="pf-image-error"></div>
|
1426 |
<div id="pf-image-preview"></div>
|
1427 |
<label for="click_to_delete">
|
@@ -1438,7 +1602,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1438 |
<option value="large" <?php selected( $this->options['images-size'], 'large' ); ?>><?php _e( "Large", $this->hook ); ?></option>
|
1439 |
<option value="medium" <?php selected( $this->options['images-size'], 'medium' ); ?>><?php _e( "Medium", $this->hook ); ?></option>
|
1440 |
<option value="small" <?php selected( $this->options['images-size'], 'small' ); ?>><?php _e( "Small", $this->hook ); ?></option>
|
1441 |
-
<option value="remove-
|
1442 |
</select>
|
1443 |
</label>
|
1444 |
<label for="image-style">
|
@@ -1521,7 +1685,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1521 |
<?php
|
1522 |
if (class_exists('WooCommerce')) {
|
1523 |
?>
|
1524 |
-
<span><strong
|
1525 |
<?php
|
1526 |
} else {
|
1527 |
?>
|
@@ -1540,14 +1704,15 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1540 |
<input type="reset" class="button-secondary" value="<?php esc_attr_e( "Cancel", $this->hook ); ?>"/>
|
1541 |
</p>
|
1542 |
<div id="after-submit">
|
1543 |
-
<p><?php _e( "Need professional options for your corporate, education, or agency developed website? Check out", $this->hook ); ?> <a href="https://www.printfriendly.com/pro">PrintFriendly Pro</a>.</p>
|
1544 |
<p>
|
1545 |
-
<?php _e(
|
|
|
|
|
|
|
|
|
|
|
1546 |
</div>
|
1547 |
-
|
1548 |
</form>
|
1549 |
-
</div>
|
1550 |
-
|
1551 |
<?php
|
1552 |
}
|
1553 |
}
|
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: 3.12.5
|
9 |
Author: Print, PDF, & Email by PrintFriendly
|
10 |
Author URI: http://www.PrintFriendly.com
|
11 |
|
12 |
Changelog :
|
13 |
+
3.12.5 - Chanage link in settings page
|
14 |
+
3.12.4 - Bug fix, avoid "undefined variable: return"
|
15 |
+
3.12.3 - Bug fix, sometimes custom image didn't display correctly after upgrade
|
16 |
+
3.12.2 - Add title to Printfriendly button and change button image alt
|
17 |
+
3.12.1 - Fix translations
|
18 |
+
3.12.0 - Update custom button UI
|
19 |
+
3.11.2 - Fix button upgrade for pf-icon-both.gif
|
20 |
+
3.11.1 - Bug fix
|
21 |
+
3.11.0 - Update buttons
|
22 |
+
3.10.0 - Change "leave us a rating" message.
|
23 |
+
3.9.2 - Correctly handle spaces in print-only detection
|
24 |
+
3.9.1 - Better print-only detection
|
25 |
+
3.9.0 - Add new button
|
26 |
3.8.7 - Bug fix.
|
27 |
3.8.6 - Allow default image setting to be small medium or large.
|
28 |
3.8.5 - Bug fix.
|
123 |
* Current plugin version.
|
124 |
* @var string
|
125 |
*/
|
126 |
+
var $plugin_version = '3.12.4';
|
127 |
|
128 |
/**
|
129 |
* The hook, used for text domain as well as hooks on pages and in get requests for admin.
|
147 |
* Database version, used to allow for easy upgrades to / additions in plugin options between plugin versions.
|
148 |
* @var int
|
149 |
*/
|
150 |
+
var $db_version = 16;
|
151 |
|
152 |
/**
|
153 |
* Settings page, used within the plugin to reliably load the plugins admin JS and CSS files only on the admin page.
|
292 |
* @since 3.3.0
|
293 |
**/
|
294 |
function print_only_override($content) {
|
295 |
+
$pattern = '/class\s*?=\s*?(["\']|["\']([^"\']*?)\s)print-only(["\']|\s([^"\']*?)["\'])/';
|
296 |
+
$pf_pattern = '/class\s*?=\s*?(["\']|["\']([^"\']*?)\s)pf-content(["\']|\s([^"\']*?)["\'])/';
|
297 |
+
|
298 |
return (preg_match($pattern, $content) || preg_match($pf_pattern, $content)) ;
|
299 |
}
|
300 |
|
417 |
var pfDisablePDF = '<?php echo esc_js($this->options['pdf']); ?>';
|
418 |
var pfDisablePrint = '<?php echo esc_js($this->options['print']); ?>';
|
419 |
var pfCustomCSS = '<?php echo esc_js(esc_url($this->options['custom_css_url'])); ?>';
|
420 |
+
var pfPlatform = 'Wordpress';
|
421 |
(function() {
|
422 |
var e = document.createElement('script'); e.type="text/javascript";
|
423 |
e.src = 'https://cdn.printfriendly.com/printfriendly.js';
|
524 |
if ( 'none' != $this->options['content_position'] )
|
525 |
$align = ' pf-align'.$this->options['content_position'];
|
526 |
$href = str_replace("&", "&", $href );
|
527 |
+
$button = apply_filters( 'printfriendly_button', '<div class="printfriendly'.$align.'"><a href="'.$href.'" rel="nofollow" '.$onclick.' class="noslimstat" title="Printer Friendly, PDF & Email">'.$this->button().'</a></div>' );
|
528 |
return $button;
|
529 |
}
|
530 |
|
585 |
|
586 |
$valid_input = $input;
|
587 |
|
588 |
+
// Section 1 options
|
589 |
if ( !isset( $input['button_type'] ) || !in_array( $input['button_type'], array(
|
590 |
+
'buttons/printfriendly-pdf-email-button.png',
|
591 |
+
'buttons/printfriendly-pdf-email-button-md.png',
|
592 |
+
'buttons/printfriendly-pdf-email-button-notext.png', // buttongroup1
|
593 |
+
'buttons/printfriendly-pdf-button.png',
|
594 |
+
'buttons/printfriendly-pdf-button-nobg.png',
|
595 |
+
'buttons/printfriendly-pdf-button-nobg-md.png', // buttongroup2
|
596 |
+
'buttons/printfriendly-button.png',
|
597 |
+
'buttons/printfriendly-button-nobg.png',
|
598 |
+
'buttons/printfriendly-button-md.png',
|
599 |
+
'buttons/printfriendly-button-lg.png', // buttongroup3
|
600 |
+
'buttons/print-button.png',
|
601 |
+
'buttons/print-button-nobg.png',
|
602 |
+
'buttons/print-button-gray.png', // buttongroup3
|
603 |
+
'custom-button' // custom
|
604 |
+
) ) ) {
|
605 |
+
$valid_input['button_type'] = 'buttons/printfriendly-button.png';
|
606 |
+
}
|
607 |
+
|
608 |
+
if ( !isset( $input['custom_button_icon'] ) || !in_array( $input['custom_button_icon'], array(
|
609 |
+
'https://cdn.printfriendly.com/icons/printfriendly-icon-sm.png',
|
610 |
+
'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png',
|
611 |
+
'https://cdn.printfriendly.com/icons/printfriendly-icon-lg.png',
|
612 |
+
'custom-image',
|
613 |
+
'no-image'
|
614 |
+
) ) ) {
|
615 |
+
$valid_input['custom_button_icon'] = 'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png';
|
616 |
+
}
|
617 |
|
618 |
// @todo custom image url validation
|
619 |
if ( !isset( $input['custom_image'] ) || empty( $input['custom_image'] ) )
|
620 |
$valid_input['custom_image'] = '';
|
621 |
|
622 |
+
if ( !isset( $input['custom_button_text'] ) ) {
|
623 |
+
$valid_input['custom_button_text'] = 'custom-text';
|
624 |
+
}
|
625 |
+
|
626 |
// @todo validate optional custom text
|
627 |
if ( !isset( $input['custom_text'] ) ) {
|
628 |
+
$valid_input['custom_text'] = 'Print Friendly';
|
629 |
}
|
|
|
|
|
|
|
630 |
|
631 |
// Custom button selected, but no url nor text given, reset button type to default
|
632 |
+
if( 'custom-button' === $valid_input['button_type'] && ( '' === $valid_input['custom_image'] && '' === $input['custom_text'] ) ) {
|
633 |
+
$valid_input['button_type'] = 'buttons/printfriendly-button.png';
|
634 |
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.', $this->hook ) );
|
635 |
}
|
636 |
|
866 |
try {
|
867 |
// Set some defaults
|
868 |
$this->options = array(
|
869 |
+
'button_type' => 'buttons/printfriendly-button.png',
|
870 |
'content_position' => 'left',
|
871 |
'content_placement' => 'after',
|
872 |
+
'custom_button_icon' => 'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png',
|
873 |
+
'custom_button_text' => 'custom-text',
|
874 |
+
'custom_image' => '',
|
875 |
+
'custom_text' => 'PrintFriendly',
|
876 |
'enable_css' => 'on',
|
877 |
'margin_top' => '12',
|
878 |
'margin_right' => '12',
|
880 |
'margin_left' => '12',
|
881 |
'show_on_posts' => 'on',
|
882 |
'show_on_pages' => 'on',
|
883 |
+
'text_color' => '#3AAA11',
|
884 |
'text_size' => 14,
|
885 |
'logo' => 'favicon',
|
886 |
'image_url' => '',
|
1049 |
$this->options['images-size'] = $this->options['hide-images'] == '1' ? 'remove-images' : 'full-size';
|
1050 |
}
|
1051 |
|
1052 |
+
if ($this->options['db_version'] < 13) {
|
1053 |
+
switch ($this->options['button_type']) {
|
1054 |
+
case 'pf-button.gif':
|
1055 |
+
$this->options['button_type'] = 'buttons/printfriendly-button.png';
|
1056 |
+
break;
|
1057 |
+
case 'pf-button-both.gif':
|
1058 |
+
$this->options['button_type'] = 'buttons/printfriendly-pdf-button.png';
|
1059 |
+
break;
|
1060 |
+
case 'pf-button-big.gif':
|
1061 |
+
$this->options['button_type'] = 'buttons/printfriendly-button-lg.png';
|
1062 |
+
break;
|
1063 |
+
case 'pf-button-print-pdf-mail.png':
|
1064 |
+
$this->options['button_type'] = 'buttons/printfriendly-pdf-email-button-notext.png';
|
1065 |
+
break;
|
1066 |
+
case 'button-print-grnw20.png':
|
1067 |
+
$this->options['button_type'] = 'buttons/print-button.png';
|
1068 |
+
break;
|
1069 |
+
case 'button-print-blu20.png':
|
1070 |
+
$this->options['button_type'] = 'buttons/print-button-nobg.png';
|
1071 |
+
break;
|
1072 |
+
case 'button-print-gry20.png':
|
1073 |
+
$this->options['button_type'] = 'buttons/print-button-gray.png';
|
1074 |
+
break;
|
1075 |
+
case 'pf-icon-small.gif':
|
1076 |
+
case 'pf-icon.gif':
|
1077 |
+
$this->options['button_type'] = 'custom-button';
|
1078 |
+
$this->options['custom_button_icon'] = 'icons/printfriendly-icon-md.png';
|
1079 |
+
$this->options['custom_button_text'] = 'custom-text';
|
1080 |
+
$this->options['custom_image'] = 'icons/printfriendly-icon-md.png';
|
1081 |
+
break;
|
1082 |
+
case 'text-only':
|
1083 |
+
$this->options['button_type'] = 'custom-button';
|
1084 |
+
$this->options['custom_button_icon'] = 'no-image';
|
1085 |
+
$this->options['custom_button_text'] = 'custom-text';
|
1086 |
+
break;
|
1087 |
+
}
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
if ($this->options['db_version'] < 14) {
|
1091 |
+
if ($this->options['button_type'] == 'pf-icon-both.gif') {
|
1092 |
+
$this->options['button_type'] = 'buttons/printfriendly-pdf-button-nobg.png';
|
1093 |
+
}
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
if ($this->options['db_version'] < 15) {
|
1097 |
+
if ($this->options['button_type'] == 'custom-image') {
|
1098 |
+
$this->options['button_type'] = 'custom-button';
|
1099 |
+
|
1100 |
+
switch ($this->options['custom_image']) {
|
1101 |
+
case 'icons/printfriendly-icon-sm.png':
|
1102 |
+
case 'icons/printfriendly-icon-md.png':
|
1103 |
+
case 'icons/printfriendly-icon-lg.png':
|
1104 |
+
$this->options['custom_button_icon'] = $this->options['custom_image'];
|
1105 |
+
break;
|
1106 |
+
case '':
|
1107 |
+
$this->options['custom_button_icon'] = 'no-image';
|
1108 |
+
break;
|
1109 |
+
default:
|
1110 |
+
$this->options['custom_button_icon'] = 'custom-image';
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
if ($this->options['custom_text'] == '') {
|
1114 |
+
$this->options['custom_button_text'] = 'no-text';
|
1115 |
+
} else {
|
1116 |
+
$this->options['custom_button_text'] = 'custom-text';
|
1117 |
+
}
|
1118 |
+
}
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
if ($this->options['db_version'] < 16) {
|
1122 |
+
if ($this->options['custom_button_icon'] == 'icons/printfriendly-icon-md.png') {
|
1123 |
+
$this->options['custom_button_icon'] = 'https://cdn.printfriendly.com/icons/printfriendly-icon-md.png';
|
1124 |
+
}
|
1125 |
+
}
|
1126 |
+
|
1127 |
$this->options['db_version'] = $this->db_version;
|
1128 |
|
1129 |
update_option( $this->option_name, $this->options );
|
1148 |
echo '<br>';
|
1149 |
}
|
1150 |
|
1151 |
+
/**
|
1152 |
+
* Displays radio button in the admin area
|
1153 |
+
*
|
1154 |
+
* @since 3.12.0
|
1155 |
+
* @param string $name the name of the radio button to generate.
|
1156 |
+
*/
|
1157 |
+
function radio_custom_image($value){
|
1158 |
+
?>
|
1159 |
+
<label class="radio-custom-btn">
|
1160 |
+
<input type="radio" name="<?php echo $this->option_name ?>[custom_button_icon]" value="<?php echo $value ?>" <?php $this->checked( 'custom_button_icon', $value ) ?>>
|
1161 |
+
<img src="<?php echo $value ?>" alt="Print Friendly, PDF & Email" style="display: inline" />
|
1162 |
+
</label>
|
1163 |
+
<?php
|
1164 |
+
}
|
1165 |
+
|
1166 |
/**
|
1167 |
* Displays button image in the admin area
|
1168 |
*
|
1172 |
function button( $name = false ){
|
1173 |
if( !$name )
|
1174 |
$name = $this->options['button_type'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1175 |
|
1176 |
+
$button_css = $this->generic_button_css();
|
|
|
1177 |
|
1178 |
+
$img_path = 'https://cdn.printfriendly.com/';
|
|
|
|
|
1179 |
|
1180 |
+
$return = '';
|
|
|
|
|
1181 |
|
1182 |
+
if ($name == "custom-button") {
|
1183 |
+
if ($this->options['custom_button_icon'] == 'custom-image' && '' != trim($this->options['custom_image'])) {
|
1184 |
+
$return = '<img src="'.esc_url($this->options['custom_image']).'" alt="Print Friendly, PDF & Email" style="display: inline" />';
|
1185 |
+
} else if ( $this->options['custom_button_icon'] != 'no-image' ) {
|
1186 |
+
$return = '<img src="'.esc_url($this->options['custom_button_icon']).'" alt="Print Friendly, PDF & Email" style="display: inline" />';
|
1187 |
+
}
|
1188 |
|
1189 |
+
/* esc_html was removerd to support custom html, CSRF prevents from attack by using this field */
|
1190 |
+
if ($this->options['custom_button_text'] == 'custom-text') {
|
1191 |
+
$return .= $this->options['custom_text'];
|
1192 |
+
}
|
1193 |
|
1194 |
+
return $return;
|
1195 |
+
} else {
|
1196 |
+
return '<img style="'.$button_css.'" src="'.$img_path.$name.'" alt="Print Friendly, PDF & Email" />';
|
1197 |
}
|
1198 |
}
|
1199 |
|
1213 |
* @since 3.0.9
|
1214 |
*/
|
1215 |
function custom_button_preview() {
|
1216 |
+
if( $this->options['custom_button_icon'] == 'no-image' ) {
|
1217 |
$button_preview = '<span id="pf-custom-button-preview"></span>';
|
1218 |
+
} else if ($this->options['custom_button_icon'] == 'custom-image') {
|
1219 |
+
$button_preview = '<span id="pf-custom-button-preview"><img src="'.esc_url($this->options['custom_image']).'" alt="Print Friendly, PDF & Email" /></span>';
|
1220 |
+
} else {
|
1221 |
+
$button_preview = '<span id="pf-custom-button-preview"><img src="'.esc_url($this->options['custom_button_icon']).'" alt="Print Friendly, PDF & Email" /></span>';
|
1222 |
+
}
|
1223 |
|
1224 |
+
if ($this->options['custom_button_text'] != 'no-text') {
|
1225 |
+
$button_text = $this->options['custom_text'];
|
1226 |
+
} else {
|
1227 |
+
$button_text = '';
|
1228 |
+
}
|
1229 |
+
|
1230 |
+
$button_preview .= '<span class="printfriendly-text2">'.esc_html($button_text).'</span>';
|
1231 |
|
1232 |
echo $button_preview;
|
1233 |
}
|
1395 |
echo '<pre>' . __( 'Options:', $this->hook ) . '<br><br>' . print_r( $this->options, 1 ) . '</pre>';
|
1396 |
}
|
1397 |
?>
|
1398 |
+
|
1399 |
+
<style type="text/css">
|
1400 |
+
input[type="radio"], img {
|
1401 |
+
vertical-align: middle;
|
1402 |
+
}
|
1403 |
+
</style>
|
1404 |
+
|
1405 |
<div id="pf_settings" class="wrap">
|
1406 |
|
1407 |
<div class="icon32" id="printfriendly"></div>
|
1415 |
|
1416 |
<fieldset id="button-style">
|
1417 |
<div id="buttongroup1">
|
1418 |
+
<?php $this->radio('buttons/printfriendly-pdf-email-button.png'); ?>
|
1419 |
+
<?php $this->radio('buttons/printfriendly-pdf-email-button-md.png'); ?>
|
1420 |
+
<?php $this->radio('buttons/printfriendly-pdf-email-button-notext.png'); ?>
|
1421 |
</div>
|
1422 |
<div id="buttongroup2">
|
1423 |
+
<?php $this->radio('buttons/printfriendly-pdf-button.png'); ?>
|
1424 |
+
<?php $this->radio('buttons/printfriendly-pdf-button-nobg.png'); ?>
|
1425 |
+
<?php $this->radio('buttons/printfriendly-pdf-button-nobg-md.png'); ?>
|
1426 |
</div>
|
1427 |
<div id="buttongroup3">
|
1428 |
+
<?php $this->radio('buttons/printfriendly-button.png'); ?>
|
1429 |
+
<?php $this->radio('buttons/printfriendly-button-nobg.png'); ?>
|
1430 |
+
<?php $this->radio('buttons/printfriendly-button-md.png'); ?>
|
1431 |
+
<?php $this->radio('buttons/printfriendly-button-lg.png'); ?>
|
1432 |
+
</div>
|
1433 |
+
<div id="buttongroup4">
|
1434 |
+
<?php $this->radio('buttons/print-button.png'); ?>
|
1435 |
+
<?php $this->radio('buttons/print-button-nobg.png'); ?>
|
1436 |
+
<?php $this->radio('buttons/print-button-gray.png'); ?>
|
1437 |
</div>
|
1438 |
|
1439 |
+
<div id="custom-btn-group" class="clear">
|
1440 |
+
<label>
|
1441 |
+
<?php echo '<input id="custom-btn" class="radio" name="'.$this->option_name.'[button_type]" type="radio" value="custom-button" '.$this->checked( 'button_type', 'custom-button', false ).'/>'; ?>
|
1442 |
<?php _e( "Custom Button", $this->hook ); ?>
|
1443 |
</label>
|
1444 |
+
|
1445 |
+
<div id="custom-img" style="float: left;">
|
1446 |
+
<h2><?php _e( 'Image', $this->hook ); ?></h2><br>
|
1447 |
+
<?php $this->radio_custom_image('https://cdn.printfriendly.com/icons/printfriendly-icon-sm.png'); ?>
|
1448 |
+
<?php $this->radio_custom_image('https://cdn.printfriendly.com/icons/printfriendly-icon-md.png'); ?>
|
1449 |
+
<?php $this->radio_custom_image('https://cdn.printfriendly.com/icons/printfriendly-icon-lg.png'); ?>
|
1450 |
+
|
1451 |
+
<label class="radio-custom-btn">
|
1452 |
+
<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'); ?>>
|
1453 |
+
<b><?php _e( 'Use Your Image', $this->hook ); ?></b>
|
1454 |
+
<div id="enter-image-url" style="margin: 10px 0 0 30px">
|
1455 |
+
<?php _e( 'Enter Image URL', $this->hook ); ?><br>
|
1456 |
+
<input id="custom_image" type="text" class="clear regular-text" name="<?php echo $this->option_name; ?>[custom_image]" value="<?php $this->val( 'custom_image' ); ?>" />
|
1457 |
+
<div id="pf-custom-button-error"></div>
|
1458 |
+
<div class="description"><?php _e( "Ex: https://www.example.com/<br>Ex: /wp/wp-content/uploads/example.png", $this->hook ); ?>
|
1459 |
+
</div>
|
1460 |
+
</div>
|
1461 |
+
</label>
|
1462 |
+
|
1463 |
+
<label class="radio-custom-btn">
|
1464 |
+
<input type="radio" name="<?php echo $this->option_name ?>[custom_button_icon]" value="no-image" <?php $this->checked( 'custom_button_icon', 'no-image'); ?>>
|
1465 |
+
<b><?php _e( 'No Image', $this->hook ); ?></b>
|
1466 |
+
</label>
|
1467 |
</div>
|
1468 |
+
|
1469 |
+
<div id="custom-txt" style="float: left;">
|
1470 |
+
<h2><?php _e( 'Text', $this->hook ); ?></h2>
|
1471 |
<div id="txt-enter">
|
1472 |
+
<label>
|
1473 |
+
<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'); ?>>
|
1474 |
+
<input type="text" size="10" class="clear regular-text" name="<?php echo $this->option_name; ?>[custom_text]" id="custom_text" value="<?php $this->val( 'custom_text' ); ?>">
|
1475 |
+
</label>
|
1476 |
+
<label>
|
1477 |
+
<input type="radio" name="<?php echo $this->option_name; ?>[custom_button_text]" value="no-text" <?php $this->checked( 'custom_button_text', 'no-text'); ?>>
|
1478 |
+
<b><?php _e( 'No Text', $this->hook ); ?></b>
|
1479 |
+
</label>
|
1480 |
</div>
|
1481 |
+
<div>
|
1482 |
+
<div id="txt-color">
|
1483 |
+
<?php _e( "Text Color", $this->hook ); ?>
|
1484 |
+
<input type="hidden" name="<?php echo $this->option_name; ?>[text_color]" id="text_color" value="<?php $this->val( 'text_color' ); ?>"/><br>
|
1485 |
+
<div id="colorSelector">
|
1486 |
+
<div style="background-color: <?php echo $this->options['text_color']; ?>;"></div>
|
1487 |
+
</div>
|
1488 |
+
</div>
|
1489 |
+
<div id="txt-size">
|
1490 |
+
<?php _e( "Text Size", $this->hook ); ?><br>
|
1491 |
+
<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' ); ?>"/>
|
1492 |
</div>
|
1493 |
</div>
|
|
|
|
|
|
|
|
|
1494 |
</div>
|
1495 |
+
|
1496 |
+
<div id="custom-button-preview" style="float: left;">
|
1497 |
+
<h2><?php _e( 'Preview', $this->hook ); ?></h2>
|
1498 |
+
<?php $this->custom_button_preview(); ?>
|
1499 |
+
</div>
|
1500 |
</div>
|
1501 |
</fieldset>
|
1502 |
<br class="clear">
|
1504 |
<!--Section 2 Button Positioning-->
|
1505 |
<div id="button-positioning">
|
1506 |
<h3><?php _e( "Button Positioning", $this->hook ); ?>
|
1507 |
+
<span id="css"><input type="checkbox" name="<?php echo $this->option_name; ?>[enable_css]" value="<?php $this->val('enable_css');?>" <?php $this->checked('enable_css', 'off'); ?> /><?php _e('Do not use CSS for button styles'); ?></span>
|
1508 |
</h3>
|
1509 |
<div id="button-positioning-options">
|
1510 |
<div id="alignment">
|
1585 |
<label for="upload-an-image"><?php _e( "Enter url", $this->hook ); ?></label><input id="upload-an-image" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[image_url]" value="<?php $this->val( 'image_url' ); ?>" />
|
1586 |
<label for="image-tagline"><?php _e( "Text (optional)", $this->hook ); ?></label><input id="image-tagline" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[tagline]" value="<?php $this->val( 'tagline' ); ?>" />
|
1587 |
</div> */ ?>
|
1588 |
+
<div class="custom-logo"><label for="Enter_URL"><?php _e( "Enter url", $this->hook ); ?></label><input id="upload-an-image" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[image_url]" value="<?php $this->val( 'image_url' ); ?>" /><label for="Text__optional_"><?php _e( "Text (optional)", $this->hook ); ?></label><input id="image-tagline" type="text" class="regular-text" name="<?php echo $this->option_name; ?>[tagline]" value="<?php $this->val( 'tagline' ); ?>" /></div>
|
1589 |
<div id="pf-image-error"></div>
|
1590 |
<div id="pf-image-preview"></div>
|
1591 |
<label for="click_to_delete">
|
1602 |
<option value="large" <?php selected( $this->options['images-size'], 'large' ); ?>><?php _e( "Large", $this->hook ); ?></option>
|
1603 |
<option value="medium" <?php selected( $this->options['images-size'], 'medium' ); ?>><?php _e( "Medium", $this->hook ); ?></option>
|
1604 |
<option value="small" <?php selected( $this->options['images-size'], 'small' ); ?>><?php _e( "Small", $this->hook ); ?></option>
|
1605 |
+
<option value="remove-images" <?php selected( $this->options['images-size'], 'remove-images' ); ?>><?php _e( "Remove Images", $this->hook ); ?></option>
|
1606 |
</select>
|
1607 |
</label>
|
1608 |
<label for="image-style">
|
1685 |
<?php
|
1686 |
if (class_exists('WooCommerce')) {
|
1687 |
?>
|
1688 |
+
<span><strong><?php _e( "Not available for woocommerce", $this->hook ); ?></strong></span>
|
1689 |
<?php
|
1690 |
} else {
|
1691 |
?>
|
1704 |
<input type="reset" class="button-secondary" value="<?php esc_attr_e( "Cancel", $this->hook ); ?>"/>
|
1705 |
</p>
|
1706 |
<div id="after-submit">
|
|
|
1707 |
<p>
|
1708 |
+
<?php _e( 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>' ), $this->hook ); ?>
|
1709 |
+
</p>
|
1710 |
+
<p><?php _e( "Need professional options for your corporate, education, or agency developed website? Check out", $this->hook ); ?> <a href="https://www.printfriendly.com/button/pro?utm_source=wp&utm_medium=link&utm_campaign=wp-link" target="_blank">PrintFriendly Pro</a>.</p>
|
1711 |
+
<p>
|
1712 |
+
<?php _e( "Need help or have suggestions?", $this->hook ); ?> <a href="mailto:support@printfriendly.com?subject=Support%20for%20PrintFriendly%20WordPress%20plugin">support@PrintFriendly.com</a>
|
1713 |
+
</p>
|
1714 |
</div>
|
|
|
1715 |
</form>
|
|
|
|
|
1716 |
<?php
|
1717 |
}
|
1718 |
}
|
trunk/readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: printfriendly,joostdevalk, jrf
|
3 |
Tags: print, pdf, email, print button, wp-print, print recipe, print post, print page, print widget, print plugin, printable, wp-pdf, pdf post, pdf page, pdf button, pdf widget, pdf plugin, woocommerce print, woocommerce pdf
|
4 |
Requires at least: 2.8
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 3.
|
7 |
|
8 |
|
9 |
The #1 Print, PDF, Email button. Stylish, full featured, customizable. Add custom header, footer, and more.
|
@@ -140,6 +140,48 @@ You can [hide the Print, PDF, and Email button](https://support.printfriendly.co
|
|
140 |
|
141 |
== Changelog ==
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
= 3.8.7 =
|
144 |
* Bug fix.
|
145 |
|
2 |
Contributors: printfriendly,joostdevalk, jrf
|
3 |
Tags: print, pdf, email, print button, wp-print, print recipe, print post, print page, print widget, print plugin, printable, wp-pdf, pdf post, pdf page, pdf button, pdf widget, pdf plugin, woocommerce print, woocommerce pdf
|
4 |
Requires at least: 2.8
|
5 |
+
Tested up to: 4.8
|
6 |
+
Stable tag: 3.12.5
|
7 |
|
8 |
|
9 |
The #1 Print, PDF, Email button. Stylish, full featured, customizable. Add custom header, footer, and more.
|
140 |
|
141 |
== Changelog ==
|
142 |
|
143 |
+
= 3.12.5 =
|
144 |
+
* Chanage link in settings page
|
145 |
+
|
146 |
+
= 3.12.4 =
|
147 |
+
* Bug fix, avoid "undefined variable: return"
|
148 |
+
|
149 |
+
= 3.12.3 =
|
150 |
+
* Bug fix, sometimes custom image didn't display correctly after upgrade
|
151 |
+
|
152 |
+
= 3.12.2 =
|
153 |
+
* Add title to Printfriendly button and change button image alt
|
154 |
+
|
155 |
+
= 3.12.1 =
|
156 |
+
* Fix translations
|
157 |
+
|
158 |
+
= 3.12.0 =
|
159 |
+
* Update custom button UI
|
160 |
+
|
161 |
+
= 3.11.2 =
|
162 |
+
* Fix button upgrade for pf-icon-both.gif
|
163 |
+
|
164 |
+
= 3.11.1 =
|
165 |
+
* Bug fix
|
166 |
+
|
167 |
+
= 3.11.0 =
|
168 |
+
* Update buttons
|
169 |
+
|
170 |
+
= 3.10.0 =
|
171 |
+
* Change "leave us a rating" message.
|
172 |
+
|
173 |
+
= 3.9.2 =
|
174 |
+
* Correctly handle spaces in print-only detection
|
175 |
+
|
176 |
+
= 3.9.1 =
|
177 |
+
* Better print-only detection
|
178 |
+
|
179 |
+
= 3.9.0 =
|
180 |
+
* Add new button
|
181 |
+
|
182 |
+
= 3.8.8 =
|
183 |
+
* Bug fix.
|
184 |
+
|
185 |
= 3.8.7 =
|
186 |
* Bug fix.
|
187 |
|