Version Description
- A complete overhaul of the plugin by renowned WordPress plugin developer Joost de Valk.
- Code Changes:
- Redone the admin page.
- Plugin is now fully i18n ready.
- Plugin now uses the settings API.
- CSS loading is now optional.
- JavaScript loading is now optional.
- Plugin now uses WordPress default align classes for outlining.
- Documentation changes:
- Added an FAQ.
- Added Screenshots.
Download this release
Release Info
Developer | joostdevalk |
Plugin | Print, PDF, Email by PrintFriendly |
Version | 3.0 |
Comparing to | |
See all releases |
Code changes from version 2.1.8 to 3.0
- admin.css +83 -94
- admin.js +40 -43
- languages/printfriendly.pot +229 -0
- pf.php +656 -238
- pf_admin.php +0 -255
- readme.txt +55 -30
- screenshot-2.png +0 -0
- uninstall.php +6 -0
admin.css
CHANGED
@@ -1,91 +1,69 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
margin:1em ;
|
4 |
}
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
#
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
border:
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
ul#pftxtbuttons, ul#custom_options{
|
21 |
-
margin-top:0;
|
22 |
-
}
|
23 |
-
#custom_options{
|
24 |
-
position:absolute;
|
25 |
-
right:0px;
|
26 |
-
}
|
27 |
-
#custom_url {
|
28 |
-
display:inline-block;
|
29 |
-
}
|
30 |
-
#pf_margin input, input#pf_text_size {
|
31 |
-
width:2em;
|
32 |
-
}
|
33 |
-
#pf_position, #buttonStyle{
|
34 |
-
clear:both;
|
35 |
-
/* Borders Radius */
|
36 |
-
-moz-border-radius: 6px ;
|
37 |
-
-webkit-border-radius: 6px ;
|
38 |
-
border-radius: 6px;
|
39 |
-
border:1px solid #DFDFDF;
|
40 |
-
background: #fff;
|
41 |
-
margin:1em 1em 2em 0;
|
42 |
}
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
margin:0;
|
49 |
-
/* Background Gradient */
|
50 |
-
background-color: #e1e1e1;
|
51 |
-
background-image: -moz-linear-gradient(top, #ededed, #e1e1e1);
|
52 |
-
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #ededed),color-stop(1, #e1e1e1));
|
53 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#ededed', EndColorStr='#e1e1e1');
|
54 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#ededed', EndColorStr='#e1e1e1')";
|
55 |
}
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
}
|
60 |
|
61 |
-
|
62 |
-
|
63 |
}
|
64 |
|
|
|
|
|
|
|
65 |
|
66 |
#colorSelector {
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
71 |
}
|
|
|
72 |
#colorSelector div {
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
-
|
79 |
-
|
80 |
.colorpicker {
|
81 |
width: 356px;
|
82 |
height: 176px;
|
83 |
overflow: hidden;
|
84 |
position: absolute;
|
85 |
-
background: url(
|
86 |
font-family: Arial, Helvetica, sans-serif;
|
87 |
display: none;
|
88 |
}
|
|
|
89 |
.colorpicker_color {
|
90 |
width: 150px;
|
91 |
height: 150px;
|
@@ -96,14 +74,16 @@ ul#pftxtbuttons, ul#custom_options{
|
|
96 |
overflow: hidden;
|
97 |
cursor: crosshair;
|
98 |
}
|
|
|
99 |
.colorpicker_color div {
|
100 |
position: absolute;
|
101 |
top: 0;
|
102 |
left: 0;
|
103 |
width: 150px;
|
104 |
height: 150px;
|
105 |
-
background: url(
|
106 |
}
|
|
|
107 |
.colorpicker_color div div {
|
108 |
position: absolute;
|
109 |
top: 0;
|
@@ -111,9 +91,10 @@ ul#pftxtbuttons, ul#custom_options{
|
|
111 |
width: 11px;
|
112 |
height: 11px;
|
113 |
overflow: hidden;
|
114 |
-
background: url(
|
115 |
margin: -5px 0 0 -5px;
|
116 |
}
|
|
|
117 |
.colorpicker_hue {
|
118 |
position: absolute;
|
119 |
top: 13px;
|
@@ -122,15 +103,17 @@ ul#pftxtbuttons, ul#custom_options{
|
|
122 |
height: 150px;
|
123 |
cursor: n-resize;
|
124 |
}
|
|
|
125 |
.colorpicker_hue div {
|
126 |
position: absolute;
|
127 |
width: 35px;
|
128 |
height: 9px;
|
129 |
overflow: hidden;
|
130 |
-
background: url(
|
131 |
margin: -4px 0 0 0;
|
132 |
left: 0px;
|
133 |
}
|
|
|
134 |
.colorpicker_new_color {
|
135 |
position: absolute;
|
136 |
width: 60px;
|
@@ -139,6 +122,7 @@ ul#pftxtbuttons, ul#custom_options{
|
|
139 |
top: 13px;
|
140 |
background: #f00;
|
141 |
}
|
|
|
142 |
.colorpicker_current_color {
|
143 |
position: absolute;
|
144 |
width: 60px;
|
@@ -147,37 +131,44 @@ ul#pftxtbuttons, ul#custom_options{
|
|
147 |
top: 13px;
|
148 |
background: #f00;
|
149 |
}
|
|
|
150 |
.colorpicker input {
|
151 |
background-color: transparent;
|
152 |
-
border: 1px solid transparent;
|
153 |
position: absolute;
|
154 |
font-size: 10px;
|
155 |
font-family: Arial, Helvetica, sans-serif;
|
156 |
-
color: #
|
157 |
top: 4px;
|
158 |
right: 11px;
|
159 |
text-align: right;
|
160 |
margin: 0;
|
161 |
-
padding: 0;
|
162 |
height: 11px;
|
|
|
|
|
163 |
}
|
|
|
164 |
.colorpicker_hex {
|
165 |
position: absolute;
|
166 |
width: 72px;
|
167 |
height: 22px;
|
168 |
-
background: url(
|
169 |
left: 212px;
|
170 |
top: 142px;
|
171 |
}
|
|
|
172 |
.colorpicker_hex input {
|
173 |
right: 6px;
|
174 |
}
|
|
|
175 |
.colorpicker_field {
|
176 |
height: 22px;
|
177 |
width: 62px;
|
178 |
background-position: top;
|
179 |
position: absolute;
|
180 |
}
|
|
|
181 |
.colorpicker_field span {
|
182 |
position: absolute;
|
183 |
width: 12px;
|
@@ -187,57 +178,55 @@ ul#pftxtbuttons, ul#custom_options{
|
|
187 |
right: 0;
|
188 |
cursor: n-resize;
|
189 |
}
|
|
|
190 |
.colorpicker_rgb_r {
|
191 |
-
background-image: url(
|
192 |
top: 52px;
|
193 |
left: 212px;
|
194 |
}
|
|
|
195 |
.colorpicker_rgb_g {
|
196 |
-
background-image: url(
|
197 |
top: 82px;
|
198 |
left: 212px;
|
199 |
}
|
|
|
200 |
.colorpicker_rgb_b {
|
201 |
-
background-image: url(
|
202 |
top: 112px;
|
203 |
left: 212px;
|
204 |
}
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
left: 282px;
|
209 |
-
}
|
210 |
-
.colorpicker_hsb_s {
|
211 |
-
background-image: url(../images/colorpicker_hsb_s.png);
|
212 |
-
top: 82px;
|
213 |
-
left: 282px;
|
214 |
-
}
|
215 |
-
.colorpicker_hsb_b {
|
216 |
-
background-image: url(../images/colorpicker_hsb_b.png);
|
217 |
-
top: 112px;
|
218 |
-
left: 282px;
|
219 |
}
|
|
|
220 |
.colorpicker_submit {
|
221 |
position: absolute;
|
222 |
width: 22px;
|
223 |
height: 22px;
|
224 |
-
background: url(
|
225 |
left: 322px;
|
226 |
top: 142px;
|
227 |
overflow: hidden;
|
228 |
}
|
|
|
229 |
.colorpicker_focus {
|
230 |
background-position: center;
|
231 |
}
|
|
|
232 |
.colorpicker_hex.colorpicker_focus {
|
233 |
background-position: bottom;
|
234 |
}
|
|
|
235 |
.colorpicker_submit.colorpicker_focus {
|
236 |
background-position: bottom;
|
237 |
}
|
|
|
238 |
.colorpicker_slider {
|
239 |
background-position: bottom;
|
240 |
}
|
241 |
-
|
242 |
-
|
243 |
-
|
|
1 |
+
input[type="radio"] {
|
2 |
+
cursor: pointer;
|
|
|
3 |
}
|
4 |
+
|
5 |
+
/* WP lacks styling for type="number", so in here for now */
|
6 |
+
input[type="number"] {
|
7 |
+
border-color: #DFDFDF;
|
8 |
+
background-color: white;
|
9 |
+
border-width: 1px;
|
10 |
+
border-style: solid;
|
11 |
+
-moz-border-radius: 3px;
|
12 |
+
-khtml-border-radius: 3px;
|
13 |
+
-webkit-border-radius: 3px;
|
14 |
+
border-radius: 3px;
|
15 |
+
-moz-box-sizing: border-box;
|
16 |
+
-webkit-box-sizing: border-box;
|
17 |
+
-ms-box-sizing: border-box;
|
18 |
+
box-sizing: border-box;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
+
.radio {
|
22 |
+
margin: 0 5px 0 0;
|
23 |
+
vertical-align: text-top;
|
24 |
+
height: 25px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
+
|
27 |
+
.icon32 {
|
28 |
+
background: url(images/pf-icon.png) center center no-repeat;
|
29 |
}
|
30 |
|
31 |
+
.printfriendly-text {
|
32 |
+
margin-left: 3px;
|
33 |
}
|
34 |
|
35 |
+
#addmanual-help {
|
36 |
+
display: none;
|
37 |
+
}
|
38 |
|
39 |
#colorSelector {
|
40 |
+
position: relative;
|
41 |
+
width: 36px;
|
42 |
+
height: 36px;
|
43 |
+
background: url(images/select2.png);
|
44 |
+
display: inline-block;
|
45 |
+
cursor: pointer;
|
46 |
}
|
47 |
+
|
48 |
#colorSelector div {
|
49 |
+
position: absolute;
|
50 |
+
top: 4px;
|
51 |
+
left: 4px;
|
52 |
+
width: 28px;
|
53 |
+
height: 28px;
|
54 |
+
background: url(images/select2.png) center;
|
55 |
}
|
56 |
|
|
|
|
|
57 |
.colorpicker {
|
58 |
width: 356px;
|
59 |
height: 176px;
|
60 |
overflow: hidden;
|
61 |
position: absolute;
|
62 |
+
background: url(images/custom_background.png);
|
63 |
font-family: Arial, Helvetica, sans-serif;
|
64 |
display: none;
|
65 |
}
|
66 |
+
|
67 |
.colorpicker_color {
|
68 |
width: 150px;
|
69 |
height: 150px;
|
74 |
overflow: hidden;
|
75 |
cursor: crosshair;
|
76 |
}
|
77 |
+
|
78 |
.colorpicker_color div {
|
79 |
position: absolute;
|
80 |
top: 0;
|
81 |
left: 0;
|
82 |
width: 150px;
|
83 |
height: 150px;
|
84 |
+
background: url(images/colorpicker_overlay.png);
|
85 |
}
|
86 |
+
|
87 |
.colorpicker_color div div {
|
88 |
position: absolute;
|
89 |
top: 0;
|
91 |
width: 11px;
|
92 |
height: 11px;
|
93 |
overflow: hidden;
|
94 |
+
background: url(images/colorpicker_select.gif);
|
95 |
margin: -5px 0 0 -5px;
|
96 |
}
|
97 |
+
|
98 |
.colorpicker_hue {
|
99 |
position: absolute;
|
100 |
top: 13px;
|
103 |
height: 150px;
|
104 |
cursor: n-resize;
|
105 |
}
|
106 |
+
|
107 |
.colorpicker_hue div {
|
108 |
position: absolute;
|
109 |
width: 35px;
|
110 |
height: 9px;
|
111 |
overflow: hidden;
|
112 |
+
background: url(images/custom_indic.gif) left top;
|
113 |
margin: -4px 0 0 0;
|
114 |
left: 0px;
|
115 |
}
|
116 |
+
|
117 |
.colorpicker_new_color {
|
118 |
position: absolute;
|
119 |
width: 60px;
|
122 |
top: 13px;
|
123 |
background: #f00;
|
124 |
}
|
125 |
+
|
126 |
.colorpicker_current_color {
|
127 |
position: absolute;
|
128 |
width: 60px;
|
131 |
top: 13px;
|
132 |
background: #f00;
|
133 |
}
|
134 |
+
|
135 |
.colorpicker input {
|
136 |
background-color: transparent;
|
137 |
+
border: 1px solid transparent !important;
|
138 |
position: absolute;
|
139 |
font-size: 10px;
|
140 |
font-family: Arial, Helvetica, sans-serif;
|
141 |
+
color: #778398;
|
142 |
top: 4px;
|
143 |
right: 11px;
|
144 |
text-align: right;
|
145 |
margin: 0;
|
146 |
+
padding: 0 !important;
|
147 |
height: 11px;
|
148 |
+
line-height: 11px;
|
149 |
+
outline: none;
|
150 |
}
|
151 |
+
|
152 |
.colorpicker_hex {
|
153 |
position: absolute;
|
154 |
width: 72px;
|
155 |
height: 22px;
|
156 |
+
background: url(images/custom_hex.png) top;
|
157 |
left: 212px;
|
158 |
top: 142px;
|
159 |
}
|
160 |
+
|
161 |
.colorpicker_hex input {
|
162 |
right: 6px;
|
163 |
}
|
164 |
+
|
165 |
.colorpicker_field {
|
166 |
height: 22px;
|
167 |
width: 62px;
|
168 |
background-position: top;
|
169 |
position: absolute;
|
170 |
}
|
171 |
+
|
172 |
.colorpicker_field span {
|
173 |
position: absolute;
|
174 |
width: 12px;
|
178 |
right: 0;
|
179 |
cursor: n-resize;
|
180 |
}
|
181 |
+
|
182 |
.colorpicker_rgb_r {
|
183 |
+
background-image: url(images/custom_rgb_r.png);
|
184 |
top: 52px;
|
185 |
left: 212px;
|
186 |
}
|
187 |
+
|
188 |
.colorpicker_rgb_g {
|
189 |
+
background-image: url(images/custom_rgb_g.png);
|
190 |
top: 82px;
|
191 |
left: 212px;
|
192 |
}
|
193 |
+
|
194 |
.colorpicker_rgb_b {
|
195 |
+
background-image: url(images/custom_rgb_b.png);
|
196 |
top: 112px;
|
197 |
left: 212px;
|
198 |
}
|
199 |
+
|
200 |
+
.colorpicker_hsb_h, .colorpicker_hsb_s, .colorpicker_hsb_b {
|
201 |
+
display: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
}
|
203 |
+
|
204 |
.colorpicker_submit {
|
205 |
position: absolute;
|
206 |
width: 22px;
|
207 |
height: 22px;
|
208 |
+
background: url(images/custom_submit.png) top;
|
209 |
left: 322px;
|
210 |
top: 142px;
|
211 |
overflow: hidden;
|
212 |
}
|
213 |
+
|
214 |
.colorpicker_focus {
|
215 |
background-position: center;
|
216 |
}
|
217 |
+
|
218 |
.colorpicker_hex.colorpicker_focus {
|
219 |
background-position: bottom;
|
220 |
}
|
221 |
+
|
222 |
.colorpicker_submit.colorpicker_focus {
|
223 |
background-position: bottom;
|
224 |
}
|
225 |
+
|
226 |
.colorpicker_slider {
|
227 |
background-position: bottom;
|
228 |
}
|
229 |
+
|
230 |
+
.clear {
|
231 |
+
clear: both;
|
232 |
+
}
|
admin.js
CHANGED
@@ -1,26 +1,24 @@
|
|
|
|
1 |
jQuery(document).ready(function() {
|
2 |
-
jQuery('
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
tb_remove();
|
12 |
-
}
|
13 |
-
|
14 |
-
jQuery('.pf_show_list').change(function(){
|
15 |
-
if(jQuery(this).val()=='manual'){
|
16 |
-
jQuery('.pf_content_placement').attr('disabled','disabled');
|
17 |
-
}else{
|
18 |
-
jQuery('.pf_content_placement').removeAttr('disabled');
|
19 |
}
|
20 |
});
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
jQuery('#colorSelector').ColorPicker({
|
23 |
-
color: jQuery('#
|
24 |
onShow: function (colpkr) {
|
25 |
jQuery(colpkr).fadeIn(500);
|
26 |
return false;
|
@@ -31,42 +29,41 @@ jQuery(document).ready(function() {
|
|
31 |
},
|
32 |
onChange: function (hsb, hex, rgb) {
|
33 |
jQuery('#colorSelector div').css('backgroundColor', '#' + hex);
|
34 |
-
jQuery('#
|
35 |
-
jQuery('.
|
36 |
}
|
37 |
});
|
38 |
-
jQuery('#pf_text_size').change(function(){
|
39 |
-
pf_size_preview();
|
40 |
-
});
|
41 |
|
42 |
-
jQuery('#
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
});
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
jQuery('.preview_button span:not(.pf_tip)').css('font-size',parseInt(size));
|
49 |
}
|
50 |
|
51 |
-
jQuery('#
|
|
|
|
|
|
|
|
|
|
|
52 |
pf_custom_text_change();
|
53 |
-
});
|
54 |
|
55 |
-
jQuery('#
|
56 |
pf_custom_text_change();
|
57 |
});
|
58 |
|
59 |
function pf_custom_text_change(){
|
60 |
-
|
61 |
-
text ='Print Friendly';
|
62 |
-
}else{
|
63 |
-
if(jQuery('#pf_custom_image_label').find('span:not(.pf_tip)').length == 0){
|
64 |
-
color = jQuery('#pf_text_color').val();
|
65 |
-
size = jQuery('#pf_text_size').val();
|
66 |
-
jQuery('#pf_custom_image_label').find('img').after('<span style="marigin-left:3px; color: '+color+'; font-size:'+size+';"></span>');
|
67 |
-
}
|
68 |
-
}
|
69 |
-
text = jQuery('#pf_custom_text').val();
|
70 |
-
jQuery('.preview_button span:not(.pf_tip):not(.printandpdf)').text(text);
|
71 |
}
|
|
|
|
|
72 |
});
|
1 |
+
// Throughout the admin I chose to use slow animations to make it clear that stuff is being hidden or shown depending on settings.
|
2 |
jQuery(document).ready(function() {
|
3 |
+
jQuery('.show_list').change(function() {
|
4 |
+
if (jQuery('.show_list:checked').val()=='manual') {
|
5 |
+
jQuery('#addmanual-help').show('slow');
|
6 |
+
jQuery('.content_placement').hide('slow');
|
7 |
+
jQuery('.content_placement input').attr('disabled','disabled');
|
8 |
+
} else {
|
9 |
+
jQuery('#addmanual-help').hide('slow');
|
10 |
+
jQuery('.content_placement').show('slow');
|
11 |
+
jQuery('.content_placement input').removeAttr('disabled');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
});
|
14 |
+
if (jQuery('.show_list:checked').val()=='manual') {
|
15 |
+
jQuery('#addmanual-help').show('slow');
|
16 |
+
jQuery('.content_placement').hide();
|
17 |
+
jQuery('.content_placement input').attr('disabled','disabled');
|
18 |
+
}
|
19 |
|
20 |
jQuery('#colorSelector').ColorPicker({
|
21 |
+
color: jQuery('#text_color').val(),
|
22 |
onShow: function (colpkr) {
|
23 |
jQuery(colpkr).fadeIn(500);
|
24 |
return false;
|
29 |
},
|
30 |
onChange: function (hsb, hex, rgb) {
|
31 |
jQuery('#colorSelector div').css('backgroundColor', '#' + hex);
|
32 |
+
jQuery('#text_color').val('#' + hex);
|
33 |
+
jQuery('.printfriendly-text').css('color','#' + hex)
|
34 |
}
|
35 |
});
|
|
|
|
|
|
|
36 |
|
37 |
+
jQuery('#disable_css').change(function(){
|
38 |
+
if ( jQuery('#disable_css').is(':checked') ) {
|
39 |
+
jQuery('.css').show('slow');
|
40 |
+
jQuery('.css input').removeAttr('disabled');
|
41 |
+
} else {
|
42 |
+
jQuery('.css').hide('slow');
|
43 |
+
jQuery('.css input').attr('disabled','disabled');
|
44 |
+
}
|
45 |
});
|
46 |
+
if ( jQuery('#disable_css').not(':checked') ) {
|
47 |
+
jQuery('.css').hide();
|
48 |
+
jQuery('.css input').attr('disabled','disabled');
|
|
|
49 |
}
|
50 |
|
51 |
+
jQuery('#text_size').change(function(){
|
52 |
+
size = jQuery('#text_size').val();
|
53 |
+
jQuery('.printfriendly-text').css('font-size',parseInt(size));
|
54 |
+
}).change();
|
55 |
+
|
56 |
+
jQuery('#custom_text').change(function(){
|
57 |
pf_custom_text_change();
|
58 |
+
}).change();
|
59 |
|
60 |
+
jQuery('#custom_text').keyup(function(){
|
61 |
pf_custom_text_change();
|
62 |
});
|
63 |
|
64 |
function pf_custom_text_change(){
|
65 |
+
jQuery('.button_preview span:not(.printandpdf)').text( jQuery('#custom_text').val() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
+
|
68 |
+
jQuery('.printfriendly-text').css('color', jQuery('#text_color').val() );
|
69 |
});
|
languages/printfriendly.pot
ADDED
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2010
|
2 |
+
# This file is distributed under the same license as the package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: \n"
|
6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/printfriendly\n"
|
7 |
+
"POT-Creation-Date: 2011-07-21 12:31:20+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 |
+
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
+
|
15 |
+
#: pf.php:290
|
16 |
+
msgid "The text size you entered is too high, please stay below 25px."
|
17 |
+
msgstr ""
|
18 |
+
|
19 |
+
#: pf.php:296
|
20 |
+
msgid ""
|
21 |
+
"The color you entered is not valid, it must be a valid hexadecimal RGB font "
|
22 |
+
"color."
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
#: pf.php:310
|
26 |
+
msgid "PrintFriendly Options"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: pf.php:310
|
30 |
+
msgid "PrintFriendly"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: pf.php:320
|
34 |
+
msgid "Need Help?"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: pf.php:321
|
38 |
+
msgid "Be sure to check out the %s!"
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#: pf.php:321
|
42 |
+
msgid "Frequently Asked Questions"
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: pf.php:358
|
46 |
+
msgid "Settings"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: pf.php:529
|
50 |
+
msgid "PrintFriendly Settings"
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: pf.php:537
|
54 |
+
msgid "Pick a Button and/or Text"
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
#: pf.php:541
|
58 |
+
msgid "Pick Your Button Style"
|
59 |
+
msgstr ""
|
60 |
+
|
61 |
+
#: pf.php:554
|
62 |
+
msgid "Custom Image URL"
|
63 |
+
msgstr ""
|
64 |
+
|
65 |
+
#: pf.php:556
|
66 |
+
msgid ""
|
67 |
+
".JPG .GIF or .PNG Absolute (http://www.example.com/...), or Relative (/wp/wp-"
|
68 |
+
"content/uploads/example.png)"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: pf.php:562
|
72 |
+
msgid "Button Text"
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
+
#: pf.php:567
|
76 |
+
msgid "Style the Button and Text"
|
77 |
+
msgstr ""
|
78 |
+
|
79 |
+
#: pf.php:571
|
80 |
+
msgid "Text Color"
|
81 |
+
msgstr ""
|
82 |
+
|
83 |
+
#: pf.php:575
|
84 |
+
msgid ""
|
85 |
+
"Use the color picker, or enter a valid hex color in the color picker input "
|
86 |
+
"box."
|
87 |
+
msgstr ""
|
88 |
+
|
89 |
+
#: pf.php:579
|
90 |
+
msgid "Text Size"
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#: pf.php:582 pf.php:588
|
94 |
+
msgid "In pixels (px)"
|
95 |
+
msgstr ""
|
96 |
+
|
97 |
+
#: pf.php:586
|
98 |
+
msgid "Margin"
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: pf.php:588 pf.php:603
|
102 |
+
msgid "Left"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: pf.php:589 pf.php:604
|
106 |
+
msgid "Right"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: pf.php:590
|
110 |
+
msgid "Top"
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#: pf.php:591
|
114 |
+
msgid "Bottom"
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: pf.php:596
|
118 |
+
msgid "Button Placement"
|
119 |
+
msgstr ""
|
120 |
+
|
121 |
+
#: pf.php:600
|
122 |
+
msgid "Horizontal Alignment"
|
123 |
+
msgstr ""
|
124 |
+
|
125 |
+
#: pf.php:602
|
126 |
+
msgid "None"
|
127 |
+
msgstr ""
|
128 |
+
|
129 |
+
#: pf.php:605
|
130 |
+
msgid "Center"
|
131 |
+
msgstr ""
|
132 |
+
|
133 |
+
#: pf.php:609
|
134 |
+
msgid "Vertical Position"
|
135 |
+
msgstr ""
|
136 |
+
|
137 |
+
#: pf.php:611
|
138 |
+
msgid "Before Content"
|
139 |
+
msgstr ""
|
140 |
+
|
141 |
+
#: pf.php:612
|
142 |
+
msgid "After Content"
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: pf.php:616
|
146 |
+
msgid "Add PrintFriendly To"
|
147 |
+
msgstr ""
|
148 |
+
|
149 |
+
#: pf.php:618
|
150 |
+
msgid "Homepage, Archives, Posts, and Pages"
|
151 |
+
msgstr ""
|
152 |
+
|
153 |
+
#: pf.php:619
|
154 |
+
msgid "Posts and Pages"
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#: pf.php:620
|
158 |
+
msgid "Posts"
|
159 |
+
msgstr ""
|
160 |
+
|
161 |
+
#: pf.php:621
|
162 |
+
msgid "Manual"
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: pf.php:623
|
166 |
+
msgid "Copy and paste the code below anywhere in your template pages."
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
#: pf.php:630
|
170 |
+
msgid "Other Settings"
|
171 |
+
msgstr ""
|
172 |
+
|
173 |
+
#: pf.php:634
|
174 |
+
msgid "CSS Stylesheet"
|
175 |
+
msgstr ""
|
176 |
+
|
177 |
+
#: pf.php:636
|
178 |
+
msgid "Add CSS to pages"
|
179 |
+
msgstr ""
|
180 |
+
|
181 |
+
#: pf.php:638
|
182 |
+
msgid ""
|
183 |
+
"If you uncheck this box you have to add the styling for the PrintFriendly "
|
184 |
+
"button to your theme's stylesheet."
|
185 |
+
msgstr ""
|
186 |
+
|
187 |
+
#: pf.php:643
|
188 |
+
msgid "JavaScript"
|
189 |
+
msgstr ""
|
190 |
+
|
191 |
+
#: pf.php:645
|
192 |
+
msgid "JavaScript Fallback"
|
193 |
+
msgstr ""
|
194 |
+
|
195 |
+
#: pf.php:647
|
196 |
+
msgid ""
|
197 |
+
"If you uncheck this box users without JavaScript will be unable to use the "
|
198 |
+
"PrintFriendly service."
|
199 |
+
msgstr ""
|
200 |
+
|
201 |
+
#: pf.php:649
|
202 |
+
msgid "Include JavaScript"
|
203 |
+
msgstr ""
|
204 |
+
|
205 |
+
#: pf.php:651
|
206 |
+
msgid ""
|
207 |
+
"If you uncheck this box, all buttons will become links to the PrintFriendly "
|
208 |
+
"webservice and the PrintFriendly JavaScript will not be loaded on your site."
|
209 |
+
msgstr ""
|
210 |
+
|
211 |
+
#: pf.php:658
|
212 |
+
msgid "Save Options"
|
213 |
+
msgstr ""
|
214 |
+
|
215 |
+
#: pf.php:659
|
216 |
+
msgid "Cancel"
|
217 |
+
msgstr ""
|
218 |
+
|
219 |
+
#: pf.php:662
|
220 |
+
msgid "Like PrintFriendly?"
|
221 |
+
msgstr ""
|
222 |
+
|
223 |
+
#: pf.php:662
|
224 |
+
msgid "Give us a rating"
|
225 |
+
msgstr ""
|
226 |
+
|
227 |
+
#: pf.php:662
|
228 |
+
msgid "Need help or have suggestions?"
|
229 |
+
msgstr ""
|
pf.php
CHANGED
@@ -1,263 +1,681 @@
|
|
1 |
<?php
|
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 |
-
// add
|
48 |
-
if
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
printfriendly_activation_handler();
|
57 |
-
}
|
58 |
-
}
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
// automaticaly add the link
|
64 |
-
if(get_option('pf_show_list')!= 'manual')
|
65 |
-
add_action('the_content', 'pf_show_link');
|
66 |
-
|
67 |
-
// lets start our mess!
|
68 |
-
function printfriendly_activation_handler(){
|
69 |
-
update_option('pf_margin_top',0);
|
70 |
-
update_option('pf_margin_right',0);
|
71 |
-
update_option('pf_margin_bottom',0);
|
72 |
-
update_option('pf_margin_left',0);
|
73 |
-
update_option('pf_text_color','#55750C');
|
74 |
-
update_option('pf_text_size','14');
|
75 |
-
|
76 |
-
if(get_option('pf_show_list')==0)
|
77 |
-
{
|
78 |
-
update_option('pf_show_list','all');
|
79 |
-
}
|
80 |
-
elseif(get_option('pf_show_list')==1)
|
81 |
-
{
|
82 |
-
update_option('pf_show_list','single');
|
83 |
-
}
|
84 |
-
elseif(get_option('pf_disable_prepend')==1)
|
85 |
-
{
|
86 |
-
update_option('pf_show_list','manual');
|
87 |
-
}
|
88 |
-
delete_option('pf_disable_prepend');
|
89 |
-
}
|
90 |
|
91 |
-
//
|
92 |
-
|
93 |
-
delete_option('pf_button_type');
|
94 |
-
delete_option('pf_custom_text');
|
95 |
-
|
96 |
-
delete_option('pf_custom_image');
|
97 |
-
|
98 |
-
delete_option('pf_show_list');
|
99 |
-
delete_option('pf_content_placement');
|
100 |
-
delete_option('pf_content_position');
|
101 |
-
|
102 |
-
delete_option('pf_margin_top');
|
103 |
-
delete_option('pf_margin_right');
|
104 |
-
delete_option('pf_margin_bottom');
|
105 |
-
delete_option('pf_margin_left');
|
106 |
-
}
|
107 |
-
register_activation_hook(__FILE__, 'printfriendly_activation_handler');
|
108 |
-
register_uninstall_hook(__FILE__, 'printfriendly_deactivation_handler');
|
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 |
-
case "pf-icon.gif":
|
177 |
-
$size = get_option('pf_text_size');
|
178 |
-
if($name=="pf-icon.gif" && $size==12){
|
179 |
-
$size= 'font-size:'.($size+3).'px; ';
|
180 |
-
}else{
|
181 |
-
$size ='font-size:'.$size.'px; ';
|
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 |
-
return "";
|
209 |
-
$plink_url = get_permalink();
|
210 |
-
|
211 |
-
$separator = "?pfstyle=wp";
|
212 |
-
if (strpos($plink_url,"?")!=false)
|
213 |
-
$separator = "&pfstyle=wp";
|
214 |
-
|
215 |
-
$style=' text-align:';
|
216 |
-
$pos = get_option('pf_content_position');
|
217 |
-
if($pos==null){$pos='left';}
|
218 |
-
$style.=$pos.';';
|
219 |
-
$style.=' margin: '.pf_margin_down('top').'px '.pf_margin_down('right').'px '.pf_margin_down('bottom').'px '.pf_margin_down('left').'px;';
|
220 |
-
|
221 |
-
|
222 |
-
$button = '<script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><div onclick="window.print(); return false;" style="'.$style.' text-decoration: none; outline: none; color: '.get_option('pf_text_color').'; cursor:pointer;" class="printfriendly">'.pf_button().'</div>';
|
223 |
-
|
224 |
-
$button_link = '<div style="'.$style.'" class="printfriendly"><a href="'.$plink_url.$separator.'" rel="nofollow" style="text-decoration: none; outline: none; color: '.get_option('pf_text_color').';">'.pf_button().'</a></div>';
|
225 |
-
|
226 |
-
//This goes on article pages
|
227 |
-
if((is_single() || is_page()) && $pf_display=='single' || (is_single() && $pf_display=='posts'))
|
228 |
-
{
|
229 |
-
if (get_option('pf_content_placement')==null)
|
230 |
-
return $content.$button;
|
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 |
}
|
1 |
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Print Friendly and PDF
|
4 |
+
Plugin URI: http://www.printfriendly.com
|
5 |
+
Description: PrintFriendly & PDF optimizes your pages for print. Help your readers save paper and ink, plus enjoy your content in printed form. Website
|
6 |
+
Name and URL are included to ensure repeat visitors and new visitors when printed versions are shared.
|
7 |
+
Version: 3.0
|
8 |
+
Author: Print Friendly
|
9 |
+
Author URI: http://www.PrintFriendly.com
|
10 |
+
|
11 |
+
Changelog :
|
12 |
+
3.0 - Complete overhaul of the plugin by Joost de Valk.
|
13 |
+
2.1.8 - The Print Button was showing up on printed, or PDF, pages. Junk! Print or PDF button no longer displayed on printed out page or PDF.
|
14 |
+
2.1.7 - Changed button from span to div to support floating.
|
15 |
+
2.1.6 - Added rel="nofollow" to links. Changed button from <a> to <span> to fix target_new or target_blank issues.
|
16 |
+
2.1.5 - Fix conflict with link tracking plugins. Custom image support for hosted wordpress sites.
|
17 |
+
2.1.4 - wp head fix.
|
18 |
+
2.1.3 - Manual option for button placement. Security updates for multi-author sites.
|
19 |
+
2.1.2 - Improvements to Setting page layout and PrintFriendly button launching from post pages.
|
20 |
+
2.1.1 - Fixed admin settings bug.
|
21 |
+
2.1 - Update for mult-author websites. Improvements to Settings page.
|
22 |
+
2.0 - Customize the style, placement, and pages your printfriendly button appears.
|
23 |
+
1.5 - Added developer ability to disable hook and use the pf_show_link() function to better be used in a custom theme & Uninstall cleanup.
|
24 |
+
1.4 - Changed Name.
|
25 |
+
1.3 - Added new buttons, removed redundant code.
|
26 |
+
1.2 - User can choose to show or not show buttons on the listing page.
|
27 |
+
*/
|
|
|
28 |
|
29 |
+
/**
|
30 |
+
* PrintFriendly WordPress plugin. Allows easy embedding of printfriendly.com buttons.
|
31 |
+
* @package PrintFriendly_WordPress
|
32 |
+
* @author Joost de Valk <joost@yoast.com>
|
33 |
+
* @copyright Copyright (C) 2011, Joost de Valk
|
34 |
+
*/
|
35 |
+
if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
36 |
|
37 |
+
/**
|
38 |
+
* Class containing all the plugins functionality.
|
39 |
+
* @package PrintFriendly_WordPress
|
40 |
+
*/
|
41 |
+
class PrintFriendly_WordPress {
|
42 |
+
/**
|
43 |
+
* The hook, used for text domain as well as hooks on pages and in get requests for admin.
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
var $hook = 'printfriendly';
|
47 |
|
48 |
+
/**
|
49 |
+
* The option name, used throughout to refer to the plugins option and option group.
|
50 |
+
* @var string
|
51 |
+
*/
|
52 |
+
var $option_name = 'printfriendly_option';
|
53 |
+
|
54 |
+
/**
|
55 |
+
* The plugins options, loaded on init containing all the plugins settings.
|
56 |
+
* @var array
|
57 |
+
*/
|
58 |
+
var $options = array();
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Database version, used to allow for easy upgrades to / additions in plugin options between plugin versions.
|
62 |
+
* @var int
|
63 |
+
*/
|
64 |
+
var $db_version = 1;
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Settings page, used within the plugin to reliably load the plugins admin JS and CSS files only on the admin page.
|
68 |
+
* @var string
|
69 |
+
*/
|
70 |
+
var $settings_page = '';
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Constructor
|
74 |
+
*
|
75 |
+
* @since 3.0
|
76 |
+
*/
|
77 |
+
function __construct() {
|
78 |
+
// delete_option( $this->option_name );
|
79 |
|
80 |
+
// Retrieve the plugin options
|
81 |
+
$this->options = get_option( $this->option_name );
|
82 |
+
|
83 |
+
// If the options array is empty, set defaults
|
84 |
+
if ( ! is_array( $this->options ) )
|
85 |
+
$this->set_defaults();
|
86 |
+
|
87 |
+
// If the version number doesn't match, upgrade
|
88 |
+
if ( $this->db_version > $this->options['db_version'] )
|
89 |
+
$this->upgrade();
|
90 |
|
91 |
+
// automaticaly add the link
|
92 |
+
if( 'manual' != $this->options['show_list'] ) {
|
93 |
+
add_action( 'wp_head', array( &$this, 'front_head' ) );
|
94 |
+
add_filter( 'the_content', array( &$this, 'show_link' ) );
|
95 |
+
add_filter( 'the_excerpt', array( &$this, 'show_link' ) );
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( !is_admin() )
|
99 |
+
return;
|
|
|
|
|
|
|
100 |
|
101 |
+
// Hook into init for registration of the option and the language files
|
102 |
+
add_action( 'admin_init', array( &$this, 'init' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
+
// Register the settings page
|
105 |
+
add_action( 'admin_menu', array( &$this, 'add_config_page' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
// Register the contextual help
|
108 |
+
add_filter( 'contextual_help', array( &$this, 'contextual_help' ), 10, 2 );
|
109 |
+
|
110 |
+
// Enqueue the needed scripts and styles
|
111 |
+
add_action( 'admin_enqueue_scripts',array( &$this, 'admin_enqueue_scripts' ) );
|
112 |
+
|
113 |
+
// Register a link to the settings page on the plugins overview page
|
114 |
+
add_filter( 'plugin_action_links', array( &$this, 'filter_plugin_actions' ), 10, 2 );
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* PHP 4 Compatible Constructor
|
119 |
+
*
|
120 |
+
* @since 3.0
|
121 |
+
*/
|
122 |
+
function PrintFriendly_WordPress() {
|
123 |
+
$this->__construct();
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Prints the PrintFriendly button CSS, in the header. Possible to disable this in the plugin settings.
|
128 |
+
*
|
129 |
+
* @since 3.0
|
130 |
+
*/
|
131 |
+
function front_head() {
|
132 |
+
|
133 |
+
if ( !isset( $this->options['disable_css'] ) || $this->options['disable_css'] != 'on' )
|
134 |
+
return;
|
135 |
+
|
136 |
+
?>
|
137 |
+
<style type="text/css" media="screen">
|
138 |
+
.printfriendly {
|
139 |
+
margin: <?php echo $this->options['margin_top'].'px '.$this->options['margin_right'].'px '.$this->options['margin_bottom'].'px '.$this->options['margin_left'].'px'; ?>;
|
140 |
+
}
|
141 |
+
.printfriendly a {
|
142 |
+
text-decoration: none;
|
143 |
+
}
|
144 |
+
.printfriendly a:hover {
|
145 |
+
cursor: pointer;
|
146 |
+
}
|
147 |
+
.printfriendly .printfriendly-text {
|
148 |
+
margin-left: 3px;
|
149 |
+
color: <?php echo $this->options['text_color']; ?>;
|
150 |
+
}
|
151 |
+
.printfriendly a img {
|
152 |
+
border:none;
|
153 |
+
padding:0;
|
154 |
+
}
|
155 |
+
</style>
|
156 |
+
<style type="text/css" media="print">
|
157 |
+
.printfriendly {
|
158 |
+
display: none;
|
159 |
+
}
|
160 |
+
</style>
|
161 |
+
<?php
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Prints the PrintFriendly JavaScript, in the footer, and loads it asynchronously.
|
166 |
+
*
|
167 |
+
* @since 3.0
|
168 |
+
*/
|
169 |
+
function print_script_footer() {
|
170 |
+
if ( !isset( $this->options['javascript_include'] ) || $this->options['javascript_include'] != 'on' )
|
171 |
+
return;
|
172 |
+
|
173 |
+
if ( 'manual' == $this->options['show_list'] || 'all' == $this->options['show_list'] ||
|
174 |
+
( 'single' == $this->options['show_list'] && is_singular() ) ||
|
175 |
+
( 'posts' == $this->options['show_list'] && is_single() )
|
176 |
+
) {
|
177 |
+
?>
|
178 |
+
<script type="text/javascript">
|
179 |
+
// PrintFriendly
|
180 |
+
var e = document.createElement('script'); e.type="text/javascript"; e.async = true;
|
181 |
+
e.src = '//cdn.printfriendly.com/printfriendly.js';
|
182 |
+
document.getElementsByTagName('head')[0].appendChild(e);
|
183 |
+
</script>
|
184 |
+
<?php
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Primary frontend function, used either as a filter for the_content, or directly using pf_show_link
|
190 |
+
*
|
191 |
+
* @since 3.0
|
192 |
+
* @param string $content the content of the post, when the function is used as a filter
|
193 |
+
* @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.
|
194 |
+
*/
|
195 |
+
function show_link( $content = false ) {
|
196 |
+
if( !$content && 'manual' != $this->options['show_list'] )
|
197 |
+
return "";
|
198 |
|
199 |
+
$href = '#';
|
200 |
+
$onclick = 'onclick="window.print(); return false;"';
|
201 |
+
|
202 |
+
if ( !isset( $this->options['javascript_include'] ) || $this->options['javascript_include'] != 'on' || !isset( $this->options['javascript_fallback'] ) || $this->options['javascript_fallback'] )
|
203 |
+
$href = 'http://www.printfriendly.com/print/v2?url='.get_permalink();
|
204 |
|
205 |
+
if ( !isset( $this->options['javascript_include'] ) || $this->options['javascript_include'] != 'on' )
|
206 |
+
$onclick = '';
|
|
|
207 |
|
208 |
+
if ( !is_singular() && '' != $onclick ) {
|
209 |
+
$onclick = '';
|
210 |
+
$href = get_permalink().'?pfstyle=wp';
|
211 |
+
}
|
212 |
+
|
213 |
+
$align = '';
|
214 |
+
if ( 'none' != $this->options['content_position'] )
|
215 |
+
$align = ' align'.$this->options['content_position'];
|
216 |
+
|
217 |
+
$button = apply_filters( 'printfriendly_button', '<div class="printfriendly'.$align.'"><a href="'.$href.'" rel="nofollow" '.$onclick.'>'.$this->button().'</a></div>' );
|
218 |
+
|
219 |
+
if ( 'manual' == $this->options['show_list'] ) {
|
220 |
+
// Hook the script call now, so it only get's loaded when needed, and need is determined by the user calling pf_button
|
221 |
+
add_action( 'wp_footer', array( &$this, 'print_script_footer' ) );
|
222 |
+
return $button;
|
223 |
+
} else {
|
224 |
+
if (
|
225 |
+
is_single() ||
|
226 |
+
( is_page() && 'posts' != $this->options['show_list'] ) ||
|
227 |
+
( is_home() && 'all' == $this->options['show_list'] )
|
228 |
+
) {
|
229 |
+
// Hook the script call now, so it only get's loaded when needed
|
230 |
+
add_action( 'wp_footer', array( &$this, 'print_script_footer' ) );
|
231 |
+
|
232 |
+
if ( $this->options['content_placement'] == 'before' )
|
233 |
+
return $button.$content;
|
234 |
+
else
|
235 |
+
return $content.$button;
|
236 |
+
} else {
|
237 |
+
return $content;
|
238 |
+
}
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Register the textdomain and the options array along with the validation function
|
244 |
+
*
|
245 |
+
* @since 3.0
|
246 |
+
*/
|
247 |
+
function init() {
|
248 |
+
// Allow for localization
|
249 |
+
load_plugin_textdomain( $this->hook, false, basename( dirname( __FILE__ ) ) . '/languages' );
|
250 |
|
251 |
+
// Register our option array
|
252 |
+
register_setting( $this->option_name, $this->option_name, array( &$this, 'options_validate' ) );
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Validate the saved options.
|
257 |
+
*
|
258 |
+
* @since 3.0
|
259 |
+
* @param array $input with unvalidated options.
|
260 |
+
* @return array $valid_input with validated options.
|
261 |
+
*/
|
262 |
+
function options_validate( $input ) {
|
263 |
+
$valid_input = $input;
|
264 |
|
265 |
+
// echo '<pre>'.print_r($input,1).'</pre>';
|
266 |
+
// die;
|
267 |
+
|
268 |
+
if ( !in_array( $input['button_type'], array( 'pf-button.gif', 'pf-button-big.gif', 'pf-icon-small.gif', 'pf-icon.gif', 'pf-button-both.gif', 'pf-icon-both.gif', 'text-only', 'custom-image') ) )
|
269 |
+
$valid_input['button_type'] = 'pf-button.gif';
|
270 |
|
271 |
+
if ( !isset( $input['custom_image'] ) )
|
272 |
+
$valid_input['custom_image'] = '';
|
273 |
+
|
274 |
+
if ( !in_array( $input['show_list'], array( 'all', 'single', 'posts', 'manual') ) )
|
275 |
+
$valid_input['show_list'] = 'all';
|
276 |
+
|
277 |
+
if ( !in_array( $input['content_position'], array( 'none', 'left', 'center', 'right' ) ) )
|
278 |
+
$valid_input['content_position'] = 'left';
|
279 |
+
|
280 |
+
if ( !in_array( $input['content_placement'], array( 'before', 'after' ) ) )
|
281 |
+
$valid_input['content_placement'] = 'after';
|
282 |
+
|
283 |
+
foreach ( array( 'margin_top', 'margin_right', 'margin_bottom', 'margin_left' ) as $opt )
|
284 |
+
$valid_input[$opt] = (int) $input[$opt];
|
285 |
+
|
286 |
+
$valid_input['text_size'] = (int) $input['text_size'];
|
287 |
+
|
288 |
+
if ( 25 < $valid_input['text_size'] ) {
|
289 |
+
$valid_input['text_size'] = 14;
|
290 |
+
add_settings_error( $this->option_name, 'invalid_color', __( 'The text size you entered is too high, please stay below 25px.', $this->hook ) );
|
291 |
+
}
|
292 |
+
|
293 |
+
if ( ! preg_match('/^#[a-f0-9]{3,6}$/i', $input['text_color'] ) ) {
|
294 |
+
// Revert to previous setting and throw error.
|
295 |
+
$valid_input['text_color'] = $this->options['text_color'];
|
296 |
+
add_settings_error( $this->option_name, 'invalid_color', __( 'The color you entered is not valid, it must be a valid hexadecimal RGB font color.', $this->hook ) );
|
297 |
+
}
|
298 |
+
|
299 |
+
$valid_input['db_version'] = $this->db_version;
|
300 |
+
|
301 |
+
return $valid_input;
|
302 |
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Register the config page for all users that have the manage_options capability
|
306 |
+
*
|
307 |
+
* @since 3.0
|
308 |
+
*/
|
309 |
+
function add_config_page() {
|
310 |
+
$this->settings_page = add_options_page( __( 'PrintFriendly Options', $this->hook ), __( 'PrintFriendly', $this->hook ), 'manage_options', $this->hook, array( &$this, 'config_page' ) );
|
311 |
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Shows help on the plugin page when clicking on the Help button, top right.
|
315 |
+
*
|
316 |
+
* @since 3.0
|
317 |
+
*/
|
318 |
+
function contextual_help( $contextual_help, $screen_id ) {
|
319 |
+
if ( $this->settings_page == $screen_id ) {
|
320 |
+
$contextual_help = '<strong>'.__( "Need Help?", $this->hook ).'</strong><br/>'
|
321 |
+
.sprintf( __( "Be sure to check out the %s!"), '<a href="http://wordpress.org/extend/plugins/printfriendly/faq/">'.__( "Frequently Asked Questions", $this->hook ).'</a>' );
|
322 |
+
}
|
323 |
+
return $contextual_help;
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Enqueue the scripts for the admin settings page
|
328 |
+
*
|
329 |
+
* @since 3.0
|
330 |
+
* @param string $hook_suffix hook to check against whether the current page is the PrintFriendly settings page.
|
331 |
+
*/
|
332 |
+
function admin_enqueue_scripts( $screen_id ) {
|
333 |
+
if ( $this->settings_page == $screen_id ) {
|
334 |
+
wp_register_script( 'pf-color-picker', plugins_url( 'colorpicker.js', __FILE__ ), array( 'jquery', 'media-upload' ) );
|
335 |
+
wp_register_script( 'pf-admin-js', plugins_url( 'admin.js', __FILE__ ), array( 'jquery', 'media-upload' ) );
|
336 |
|
337 |
+
wp_enqueue_script( 'pf-color-picker' );
|
338 |
+
wp_enqueue_script( 'pf-admin-js' );
|
339 |
+
|
340 |
+
wp_enqueue_style( 'printfriendly-admin-css', plugins_url( 'admin.css', __FILE__ ) );
|
341 |
+
}
|
342 |
+
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* Register the settings link for the plugins page
|
346 |
+
*
|
347 |
+
* @since 3.0
|
348 |
+
* @param array $links the links for the plugins.
|
349 |
+
* @param string $file filename to check against plugins filename.
|
350 |
+
* @return array $links the links with the settings link added to it if appropriate.
|
351 |
+
*/
|
352 |
+
function filter_plugin_actions( $links, $file ){
|
353 |
+
// Static so we don't call plugin_basename on every plugin row.
|
354 |
+
static $this_plugin;
|
355 |
+
if ( ! $this_plugin ) $this_plugin = plugin_basename( __FILE__ );
|
356 |
+
|
357 |
+
if ( $file == $this_plugin ){
|
358 |
+
$settings_link = '<a href="options-general.php?page='.$this->hook.'">' . __( 'Settings', $this->hook ) . '</a>';
|
359 |
+
array_unshift( $links, $settings_link ); // before other links
|
360 |
+
}
|
361 |
+
return $links;
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* Set default values for the plugin. If old, as in pre 1.0, settings are there, use them and then delete them.
|
366 |
+
*
|
367 |
+
* @since 3.0
|
368 |
+
*/
|
369 |
+
function set_defaults() {
|
370 |
+
// Set some defaults
|
371 |
+
$this->options = array(
|
372 |
+
'button_type' => 'pf-button.gif',
|
373 |
+
'content_position' => 'left',
|
374 |
+
'content_placement' => 'after',
|
375 |
+
'custom_image' => '',
|
376 |
+
'custom_text' => 'Print Friendly',
|
377 |
+
'disable_css' => false,
|
378 |
+
'javascript_include' => 'on',
|
379 |
+
'javascript_fallback' => 'on',
|
380 |
+
'margin_top' => 0,
|
381 |
+
'margin_right' => 0,
|
382 |
+
'margin_bottom' => 0,
|
383 |
+
'margin_left' => 0,
|
384 |
+
'show_list' => 'all',
|
385 |
+
'text_color' => '#55750C',
|
386 |
+
'text_size' => 14,
|
387 |
+
);
|
388 |
+
|
389 |
+
// Check whether the old badly named singular options are there, if so, use the data and delete them.
|
390 |
+
foreach ( array_keys( $this->options ) as $opt ) {
|
391 |
+
$old_opt = get_option( 'pf_'.$opt );
|
392 |
+
if ( $old_opt !== false ) {
|
393 |
+
$this->options[$opt] = $old_opt;
|
394 |
+
delete_option( 'pf_'.$opt );
|
395 |
+
}
|
396 |
+
}
|
397 |
|
398 |
+
// This should always be set to the latest immediately when defaults are pushed in.
|
399 |
+
$this->options['db_version'] = $this->db_version;
|
400 |
+
|
401 |
+
update_option( $this->option_name, $this->options );
|
402 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
|
404 |
+
/**
|
405 |
+
* Upgrades the stored options, used to add new defaults if needed etc.
|
406 |
+
*
|
407 |
+
* @since 3.0
|
408 |
+
*/
|
409 |
+
function upgrade() {
|
410 |
+
// Do stuff
|
411 |
+
|
412 |
+
$this->options['db_version'] = $this->db_version;
|
413 |
+
update_option( $this->option_name, $this->options );
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Displays radio button in the admin area
|
418 |
+
*
|
419 |
+
* @since 3.0
|
420 |
+
* @param string $name the name of the radio button to generate.
|
421 |
+
* @param boolean $br whether or not to add an HTML <br> tag, defaults to true.
|
422 |
+
*/
|
423 |
+
function radio($name, $br = true){
|
424 |
+
$var = '<input id="'.$name.'" class="radio" name="'.$this->option_name.'[button_type]" type="radio" value="'.$name.'" '.$this->checked( 'button_type', $name, false ).'/>';
|
425 |
+
$button = $this->button( $name );
|
426 |
+
if ( '' != $button )
|
427 |
+
echo '<label for="'.$name.'">' . $var . $button . '</label>';
|
428 |
+
else
|
429 |
+
echo $var;
|
430 |
+
|
431 |
+
if ( $br )
|
432 |
+
echo '<br>';
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Displays button image in the admin area
|
437 |
+
*
|
438 |
+
* @since 3.0
|
439 |
+
* @param string $name the name of the button to generate.
|
440 |
+
*/
|
441 |
+
function button( $name = false ){
|
442 |
+
if( !$name )
|
443 |
+
$name = $this->options['button_type'];
|
444 |
+
|
445 |
+
$text = $this->options['custom_text'];
|
446 |
+
|
447 |
+
switch($name){
|
448 |
+
case "custom-image":
|
449 |
+
if( '' == $this->options['custom_image'] )
|
450 |
+
return '';
|
451 |
+
|
452 |
+
$return = '<img src="'.$this->options['custom_image'].'" alt="Print Friendly" />';
|
453 |
+
|
454 |
+
if( $this->options['custom_text'] != '' )
|
455 |
+
$return .= '<span class="printfriendly-text">'.$this->options['custom_text'].'</span>';
|
456 |
+
|
457 |
+
return $return;
|
458 |
+
break;
|
459 |
+
|
460 |
+
case "text-only":
|
461 |
+
return '<span class="printfriendly-text">'.$text.'</span>';
|
462 |
+
break;
|
463 |
+
|
464 |
+
case "pf-icon-both.gif":
|
465 |
+
return '<img src="//cdn.printfriendly.com/pf-print-icon.gif" alt="Print Friendly"/><span class="printandpdf printfriendly-text"> Print <img src="//cdn.printfriendly.com/pf-pdf-icon.gif" alt="Get a PDF version of this webpage" /> PDF </span>';
|
466 |
+
break;
|
467 |
+
|
468 |
+
case "pf-icon-small.gif":
|
469 |
+
case "pf-icon.gif":
|
470 |
+
return '<img src="//cdn.printfriendly.com/'.$name.'" alt="Print Friendly"/><span class="printfriendly-text">'.$text.'</span>';
|
471 |
+
break;
|
472 |
+
|
473 |
+
default:
|
474 |
+
return '<img src="//cdn.printfriendly.com/'.$name.'" alt="Print Friendly" />';
|
475 |
+
break;
|
476 |
+
}
|
477 |
+
}
|
478 |
+
|
479 |
+
/**
|
480 |
+
* Convenience function to output a value for an input
|
481 |
+
*
|
482 |
+
* @since 3.0
|
483 |
+
* @param string $val value to check.
|
484 |
+
*/
|
485 |
+
function val( $val ) {
|
486 |
+
if ( isset( $this->options[$val] ) )
|
487 |
+
echo esc_attr( $this->options[$val] );
|
488 |
+
}
|
489 |
|
490 |
+
/**
|
491 |
+
* Like the WordPress checked() function but it doesn't throw notices when the array key isn't set and uses the plugins options array.
|
492 |
+
*
|
493 |
+
* @since 3.0
|
494 |
+
* @param mixed $val value to check.
|
495 |
+
* @param mixed $check_against value to check against.
|
496 |
+
* @param boolean $echo whether or not to echo the output.
|
497 |
+
* @return string checked, when true, empty, when false.
|
498 |
+
*/
|
499 |
+
function checked( $val, $check_against = true, $echo = true ) {
|
500 |
+
if ( !isset( $this->options[$val] ) )
|
501 |
+
return;
|
502 |
+
|
503 |
+
if ( $this->options[$val] == $check_against ) {
|
504 |
+
if ( $echo )
|
505 |
+
echo ' checked="checked" ';
|
506 |
+
else
|
507 |
+
return ' checked="checked" ';
|
508 |
+
}
|
509 |
+
}
|
510 |
|
511 |
+
/**
|
512 |
+
* Output the config page
|
513 |
+
*
|
514 |
+
* @since 3.0
|
515 |
+
*/
|
516 |
+
function config_page() {
|
517 |
+
|
518 |
+
// 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.
|
519 |
+
global $wp_version;
|
520 |
+
if ( version_compare( $wp_version, '3.2', '<' ) )
|
521 |
+
settings_errors();
|
522 |
+
|
523 |
+
// Show the content of the options array when debug is enabled
|
524 |
+
if ( WP_DEBUG )
|
525 |
+
echo '<pre>Options:<br><br>' . print_r( $this->options, 1 ) . '</pre>';
|
526 |
+
?>
|
527 |
+
<div id="pf_settings" class="wrap">
|
528 |
+
<div class="icon32" id="printfriendly"></div>
|
529 |
+
<h2><?php _e( 'PrintFriendly Settings', $this->hook ); ?></h2>
|
530 |
+
|
531 |
+
<form action="options.php" method="post">
|
532 |
+
<?php settings_fields( $this->option_name ); ?>
|
533 |
+
|
534 |
+
<table class="form-table">
|
535 |
+
<tr>
|
536 |
+
<th colspan="2">
|
537 |
+
<h3><?php _e( "Pick a Button and/or Text", $this->hook ); ?></h3>
|
538 |
+
</th>
|
539 |
+
</tr>
|
540 |
+
<tr>
|
541 |
+
<th scope="row"><?php _e( "Pick Your Button Style", $this->hook ); ?></th>
|
542 |
+
<td class="defaultavatarpicker">
|
543 |
+
<fieldset>
|
544 |
+
<?php $this->radio('pf-button.gif'); ?>
|
545 |
+
<?php $this->radio('pf-button-both.gif'); ?>
|
546 |
+
<?php $this->radio('pf-button-big.gif'); ?>
|
547 |
+
<span class="button_preview">
|
548 |
+
<?php $this->radio('pf-icon-small.gif'); ?>
|
549 |
+
<?php $this->radio('pf-icon-both.gif'); ?>
|
550 |
+
<?php $this->radio('pf-icon.gif'); ?>
|
551 |
+
<?php $this->radio('text-only'); ?>
|
552 |
+
<?php $this->radio('custom-image', false); ?>
|
553 |
+
</span>
|
554 |
+
<label for="custom-image"><?php _e( "Custom Image URL", $this->hook ); ?></label>
|
555 |
+
<input id="custom_image" type="text" class="regular-text" size="40" name="<?php echo $this->option_name; ?>[custom_image]" value="<?php $this->val( 'custom_image' ); ?>" /><br>
|
556 |
+
<span class="description"><?php _e( ".JPG .GIF or .PNG Absolute (http://www.example.com/...), or Relative (/wp/wp-content/uploads/example.png)", $this->hook ); ?></span>
|
557 |
+
<br>
|
558 |
+
</fieldset>
|
559 |
+
</td>
|
560 |
+
</tr>
|
561 |
+
<tr>
|
562 |
+
<th scope="row"><label for="custom_text"><?php _e( "Button Text", $this->hook ); ?></label></th>
|
563 |
+
<td><input type="text" class="text" name="<?php echo $this->option_name; ?>[custom_text]" id="custom_text" value="<?php $this->val( 'custom_text' ); ?>"></td>
|
564 |
+
</tr>
|
565 |
+
<tr class="css">
|
566 |
+
<th colspan="2">
|
567 |
+
<h3><?php _e( "Style the Button and Text", $this->hook ); ?></h3>
|
568 |
+
</th>
|
569 |
+
</tr>
|
570 |
+
<tr class="css">
|
571 |
+
<th scope="row"><?php _e( "Text Color", $this->hook ); ?></th>
|
572 |
+
<td>
|
573 |
+
<div id="colorSelector"><div style="background-color: <?php echo $this->options['text_color']; ?>;"></div></div>
|
574 |
+
<input type="hidden" name="<?php echo $this->option_name; ?>[text_color]" id="text_color" value="<?php $this->val( 'text_color' ); ?>"/><br>
|
575 |
+
<span class="description"><?php _e( "Use the color picker, or enter a valid hex color in the color picker input box.", $this->hook ); ?></span>
|
576 |
+
</td>
|
577 |
+
</tr>
|
578 |
+
<tr class="css">
|
579 |
+
<th scope="row"<label for="text_size"><?php _e( "Text Size", $this->hook ); ?></label></th>
|
580 |
+
<td>
|
581 |
+
<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' ); ?>"/>
|
582 |
+
<span class="description"><?php _e( "In pixels (px)", $this->hook ); ?></span>
|
583 |
+
</td>
|
584 |
+
</tr>
|
585 |
+
<tr class="css">
|
586 |
+
<th scope="row"><?php _e( "Margin", $this->hook ); ?></th>
|
587 |
+
<td>
|
588 |
+
<label><input class="small-text" type="number" name="<?php echo $this->option_name; ?>[margin_left]" value="<?php $this->val( 'margin_left' ); ?>" maxlength="3"/> <?php _e( "Left", $this->hook ); ?></label> <span class="description"><?php _e( "In pixels (px)", $this->hook ); ?></span><br>
|
589 |
+
<label><input class="small-text" type="number" name="<?php echo $this->option_name; ?>[margin_right]" value="<?php $this->val( 'margin_right' ); ?>"/> <?php _e( "Right", $this->hook ); ?></label><br>
|
590 |
+
<label><input class="small-text" type="number" name="<?php echo $this->option_name; ?>[margin_top]" value="<?php $this->val( 'margin_top' ); ?>" maxlength="3"/> <?php _e( "Top", $this->hook ); ?></label><br>
|
591 |
+
<label><input class="small-text" type="number" name="<?php echo $this->option_name; ?>[margin_bottom]" value="<?php $this->val( 'margin_bottom' ); ?>" maxlength="3"/> <?php _e( "Bottom", $this->hook ); ?></label><br>
|
592 |
+
</td>
|
593 |
+
</tr>
|
594 |
+
<tr>
|
595 |
+
<th colspan="2">
|
596 |
+
<h3><?php _e( "Button Placement", $this->hook ); ?></h3>
|
597 |
+
</th>
|
598 |
+
</tr>
|
599 |
+
<tr>
|
600 |
+
<th scope="row"><?php _e( "Horizontal Alignment", $this->hook ); ?></th>
|
601 |
+
<td>
|
602 |
+
<label><input type="radio" name="<?php echo $this->option_name; ?>[content_position]" value="none" <?php $this->checked( 'content_position', 'none'); ?>/> <?php _e( "None", $this->hook ); ?></label><br>
|
603 |
+
<label><input type="radio" name="<?php echo $this->option_name; ?>[content_position]" value="left" <?php $this->checked( 'content_position', 'left'); ?>/> <?php _e( "Left", $this->hook ); ?></label><br>
|
604 |
+
<label><input type="radio" name="<?php echo $this->option_name; ?>[content_position]" value="right" <?php $this->checked( 'content_position', 'right') ?>/> <?php _e( "Right", $this->hook ); ?></label><br>
|
605 |
+
<label><input type="radio" name="<?php echo $this->option_name; ?>[content_position]" value="center" <?php $this->checked( 'content_position', 'center') ?>/> <?php _e( "Center", $this->hook ); ?></label><br>
|
606 |
+
</td>
|
607 |
+
</tr>
|
608 |
+
<tr class="content_placement">
|
609 |
+
<th scope="row"><?php _e( "Vertical Position", $this->hook ); ?></th>
|
610 |
+
<td>
|
611 |
+
<label><input type="radio" name="<?php echo $this->option_name; ?>[content_placement]" value="before" <?php $this->checked( 'content_placement', 'before'); ?> <?php if( $this->options['show_list']=='manual'){ echo 'disabled="disabled"'; } ?>/> <?php _e( "Before Content", $this->hook ); ?></label><br>
|
612 |
+
<label><input type="radio" name="<?php echo $this->option_name; ?>[content_placement]" value="after" <?php $this->checked( 'content_placement', 'after'); ?> <?php if( $this->options['show_list']=='manual'){ echo 'disabled="disabled"'; } ?>/> <?php _e( "After Content", $this->hook ); ?></label><br>
|
613 |
+
</td>
|
614 |
+
</tr>
|
615 |
+
<tr>
|
616 |
+
<th scope="row"><?php _e( "Add PrintFriendly To", $this->hook ); ?></th>
|
617 |
+
<td>
|
618 |
+
<label><input type="radio" class="show_list" name="<?php echo $this->option_name; ?>[show_list]" value="all" <?php $this->checked( 'show_list', 'all'); ?>/> <?php _e( "Homepage, Archives, Posts, and Pages", $this->hook ); ?></label><br>
|
619 |
+
<label><input type="radio" class="show_list" name="<?php echo $this->option_name; ?>[show_list]" value="single" <?php $this->checked( 'show_list', 'single'); ?>/> <?php _e( "Posts and Pages", $this->hook ); ?></label><br>
|
620 |
+
<label><input type="radio" class="show_list" name="<?php echo $this->option_name; ?>[show_list]" value="posts" <?php $this->checked( 'show_list', 'posts'); ?>/> <?php _e( "Posts", $this->hook ); ?></label><br>
|
621 |
+
<label><input type="radio" class="show_list" name="<?php echo $this->option_name; ?>[show_list]" value="manual" <?php $this->checked( 'show_list', 'manual'); ?> /> <?php _e( "Manual", $this->hook ); ?></label><br>
|
622 |
+
<div id="addmanual-help">
|
623 |
+
<p><?php _e( "Copy and paste the code below anywhere in your template pages.", $this->hook ); ?></p>
|
624 |
+
<code style="display:block;"><?php if(function_exists('pf_show_link')){echo pf_show_link();} ?></code>
|
625 |
+
</div>
|
626 |
+
</td>
|
627 |
+
</tr>
|
628 |
+
<tr>
|
629 |
+
<th colspan="2">
|
630 |
+
<h3><?php _e( "Other Settings", $this->hook ); ?></h3>
|
631 |
+
</th>
|
632 |
+
</tr>
|
633 |
+
<tr>
|
634 |
+
<th scope="row"><?php _e( "CSS Stylesheet", $this->hook ); ?></th>
|
635 |
+
<td>
|
636 |
+
<label><input type="checkbox" id="disable_css" name="<?php echo $this->option_name; ?>[disable_css]" <?php $this->checked( 'disable_css', 'on' ); ?>/> <?php _e( "Add CSS to pages", $this->hook ); ?></label><br/>
|
637 |
+
<p class="description">
|
638 |
+
<?php _e( "If you uncheck this box you have to add the styling for the PrintFriendly button to your theme's stylesheet.", $this->hook ); ?>
|
639 |
+
</p>
|
640 |
+
</td>
|
641 |
+
</tr>
|
642 |
+
<tr>
|
643 |
+
<th scope="row"><?php _e( "JavaScript", $this->hook ); ?></th>
|
644 |
+
<td>
|
645 |
+
<label><input type="checkbox" name="<?php echo $this->option_name; ?>[javascript_fallback]" <?php $this->checked( 'javascript_fallback', 'on' ); ?>/> <?php _e( "JavaScript Fallback", $this->hook ); ?></label><br/>
|
646 |
+
<p class="description">
|
647 |
+
<?php _e( "If you uncheck this box users without JavaScript will be unable to use the PrintFriendly service.", $this->hook ); ?>
|
648 |
+
</p>
|
649 |
+
<label><input type="checkbox" name="<?php echo $this->option_name; ?>[javascript_include]" <?php $this->checked( 'javascript_include', 'on' ); ?>/> <?php _e( "Include JavaScript", $this->hook ); ?></label><br/>
|
650 |
+
<p class="description">
|
651 |
+
<?php _e( "If you uncheck this box, all buttons will become links to the PrintFriendly webservice and the PrintFriendly JavaScript will not be loaded on your site.", $this->hook ); ?>
|
652 |
+
</p>
|
653 |
+
</td>
|
654 |
+
</tr>
|
655 |
+
</table>
|
656 |
+
|
657 |
+
<p class="submit">
|
658 |
+
<input type="submit" class="button-primary" value="<?php esc_attr_e( "Save Options", $this->hook ); ?>"/>
|
659 |
+
<input type="reset" class="button-secondary" value="<?php esc_attr_e( "Cancel", $this->hook ); ?>"/>
|
660 |
+
</p>
|
661 |
+
<p>
|
662 |
+
<?php _e( "Like PrintFriendly?", $this->hook ); ?> <a href="http://wordpress.org/extend/plugins/printfriendly/"><?php _e( "Give us a rating", $this->hook ); ?></a>. <?php _e( "Need help or have suggestions?", $this->hook ); ?> <a href="mailto:support@printfriendly.com?subject=Support%20for%20PrintFriendly%20WordPress%20plugin">support@PrintFriendly.com</a>.
|
663 |
+
</p>
|
664 |
+
</form>
|
665 |
+
</div>
|
666 |
+
<?php
|
667 |
+
}
|
668 |
+
}
|
669 |
+
$printfriendly = new PrintFriendly_WordPress();
|
670 |
+
}
|
671 |
|
672 |
+
/**
|
673 |
+
* Convenience function for use in templates.
|
674 |
+
*
|
675 |
+
* @since 3.0
|
676 |
+
* @return string returns a button to be printed.
|
677 |
+
*/
|
678 |
+
function pf_show_link() {
|
679 |
+
global $printfriendly;
|
680 |
+
return $printfriendly->show_link();
|
681 |
}
|
pf_admin.php
DELETED
@@ -1,255 +0,0 @@
|
|
1 |
-
<script type="text/javascript">
|
2 |
-
function Toggle(hide) {
|
3 |
-
document.getElementById("imgurl").style.display = "none";
|
4 |
-
document.getElementById(hide).style.display = "block";
|
5 |
-
|
6 |
-
}
|
7 |
-
function hideit(){
|
8 |
-
document.getElementById("manual").style.display = "none";
|
9 |
-
}
|
10 |
-
function showit(){
|
11 |
-
document.getElementById("manual").style.display = "";
|
12 |
-
}
|
13 |
-
</script>
|
14 |
-
<?php
|
15 |
-
if(isset($_POST['pf_save'])){
|
16 |
-
$error = false;
|
17 |
-
// we should always have a response, but lets still validate it for security
|
18 |
-
if($_POST['pf_button_type'] == 'pf-button.gif' || $_POST['pf_button_type'] == 'pf-button-big.gif' || $_POST['pf_button_type'] == 'pf-icon-small.gif' || $_POST['pf_button_type'] == 'pf-icon.gif' || $_POST['pf_button_type'] == 'pf-button-both.gif' || $_POST['pf_button_type'] == 'pf-icon-both.gif' || $_POST['pf_button_type'] == 'text-only' || $_POST['pf_button_type'] == 'custom-image'){
|
19 |
-
update_option('pf_button_type',$_POST['pf_button_type']);
|
20 |
-
}else{
|
21 |
-
$error[] = 'Invalid entry for the "Pick Your Button" field. That isn\'t an option to select from! Quit messing with the DOM.';
|
22 |
-
}
|
23 |
-
|
24 |
-
// Custom Image
|
25 |
-
if(isset($_POST['upload_image'])){
|
26 |
-
update_option('pf_custom_image',$_POST['upload_image']);
|
27 |
-
|
28 |
-
}
|
29 |
-
|
30 |
-
/*// custom image
|
31 |
-
if(isset($_POST['upload_image'])){
|
32 |
-
if(trim($_POST['upload_image']) == ''){
|
33 |
-
update_option('pf_custom_image',null);
|
34 |
-
}else{
|
35 |
-
$imagedata = @getimagesize($_POST['upload_image']);
|
36 |
-
if(is_array($imagedata)){
|
37 |
-
// well by golly we have an image
|
38 |
-
update_option('pf_custom_image',$_POST['upload_image']);
|
39 |
-
}else{
|
40 |
-
// we need to trigger an error
|
41 |
-
$error[] = 'Please provide a valid image link for the "Custom Image URL" field.';
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}*/
|
45 |
-
|
46 |
-
// Custom Text
|
47 |
-
if(isset($_POST['custom_text'])){
|
48 |
-
update_option('pf_custom_text',htmlspecialchars($_POST['custom_text']) );
|
49 |
-
}
|
50 |
-
|
51 |
-
// Display custom image with custom text
|
52 |
-
if(isset($_POST['custom_both'])){
|
53 |
-
update_option('pf_custom_both',true);
|
54 |
-
}else{
|
55 |
-
update_option('pf_custom_both',null);
|
56 |
-
}
|
57 |
-
|
58 |
-
// display button
|
59 |
-
if(isset($_POST['pf_show_list'])){
|
60 |
-
if($_POST['pf_show_list']=="all" || $_POST['pf_show_list']=="single" || $_POST['pf_show_list']=="posts" || $_POST['pf_show_list']=="manual"){
|
61 |
-
update_option('pf_show_list',$_POST['pf_show_list']);
|
62 |
-
}else{
|
63 |
-
// something isn't right
|
64 |
-
$error[] = 'Invalid entry for the "Display Button" field. That isn\'t an option to select from! Quit messing with the DOM.';
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
// now on to the right side
|
69 |
-
|
70 |
-
// placement
|
71 |
-
if(isset($_POST['pf_content_placement'])){
|
72 |
-
if($_POST['pf_content_placement']=="before" || $_POST['pf_content_placement']=="after"){
|
73 |
-
if($_POST['pf_content_placement']=='before'){
|
74 |
-
update_option('pf_content_placement','before');
|
75 |
-
}else{
|
76 |
-
update_option('pf_content_placement',null);
|
77 |
-
}
|
78 |
-
}else{
|
79 |
-
// something isn't right
|
80 |
-
$error[] = 'Invalid entry for the "Placement" field. That isn\'t an option to select from! Quit messing with the DOM.';
|
81 |
-
}
|
82 |
-
}
|
83 |
-
|
84 |
-
// position
|
85 |
-
if(isset($_POST['pf_content_position'])){
|
86 |
-
|
87 |
-
if($_POST['pf_content_position']=="left" || $_POST['pf_content_position']=="right" || $_POST['pf_content_position']=="center"){
|
88 |
-
if($_POST['pf_content_position']=='left'){
|
89 |
-
update_option('pf_content_position',null);
|
90 |
-
}else{
|
91 |
-
update_option('pf_content_position',$_POST['pf_content_position']);
|
92 |
-
}
|
93 |
-
}else{
|
94 |
-
// something isn't right
|
95 |
-
$error[] = 'Invalid entry for the "Position" field. That isn\'t an option to select from! Quit messing with the DOM.';
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
//margin-top
|
100 |
-
if(isset($_POST['pf_margin_top'])){
|
101 |
-
if(is_numeric($_POST['pf_margin_top'])){
|
102 |
-
update_option('pf_margin_top',$_POST['pf_margin_top']);
|
103 |
-
}else{
|
104 |
-
$error[] ='The value for "Margin Top" must be a number!';
|
105 |
-
}
|
106 |
-
}
|
107 |
-
//margin-right
|
108 |
-
if(isset($_POST['pf_margin_right'])){
|
109 |
-
if(is_numeric($_POST['pf_margin_right'])){
|
110 |
-
update_option('pf_margin_right',$_POST['pf_margin_right']);
|
111 |
-
}else{
|
112 |
-
$error[] ='The value for "Margin Right" must be a number!';
|
113 |
-
}
|
114 |
-
}
|
115 |
-
//margin-bottom
|
116 |
-
if(isset($_POST['pf_margin_bottom'])){
|
117 |
-
if(is_numeric($_POST['pf_margin_bottom'])){
|
118 |
-
update_option('pf_margin_bottom',$_POST['pf_margin_bottom']);
|
119 |
-
}else{
|
120 |
-
$error[] ='The value for "Margin Bottom" must be a number!';
|
121 |
-
}
|
122 |
-
}
|
123 |
-
//margin-left
|
124 |
-
if(isset($_POST['pf_margin_left'])){
|
125 |
-
if(is_numeric($_POST['pf_margin_left'])){
|
126 |
-
update_option('pf_margin_left',$_POST['pf_margin_left']);
|
127 |
-
}else{
|
128 |
-
$error[] ='The value for "Margin Left" must be a number!';
|
129 |
-
}
|
130 |
-
}
|
131 |
-
|
132 |
-
//font color
|
133 |
-
if(isset($_POST['pf_text_color'])){
|
134 |
-
if(preg_match('/^#[a-f0-9]{6}$/i', $_POST['pf_text_color'])){
|
135 |
-
update_option('pf_text_color',$_POST['pf_text_color']);
|
136 |
-
}else{
|
137 |
-
$error[] ='The value for "Font Color" must be a valid hex code!';
|
138 |
-
}
|
139 |
-
}
|
140 |
-
|
141 |
-
//font size
|
142 |
-
if(isset($_POST['pf_text_size'])){
|
143 |
-
if(is_numeric($_POST['pf_text_size'])){
|
144 |
-
update_option('pf_text_size',$_POST['pf_text_size']);
|
145 |
-
}else{
|
146 |
-
$error[] ='The value for "Font Size" must be a number!';
|
147 |
-
}
|
148 |
-
}
|
149 |
-
}
|
150 |
-
if( current_user_can('manage_options') ) {
|
151 |
-
?>
|
152 |
-
<div id="pf_settings" class="wrap">
|
153 |
-
<div class="icon32" id="icon-options-general"></div>
|
154 |
-
<h2>PrintFriendly: Settings</h2>
|
155 |
-
<?php
|
156 |
-
if(isset($error)){
|
157 |
-
if(is_array($error)){
|
158 |
-
echo '<div class="error"><strong>Settings were not saved, The following problems exist:</strong>';
|
159 |
-
foreach($error as $e){
|
160 |
-
echo '<p>'.$e.'</p>';
|
161 |
-
}
|
162 |
-
echo '</div>';
|
163 |
-
}else{
|
164 |
-
echo '<div class="updated"><p><strong>Settings saved.</strong></p></div>';
|
165 |
-
}
|
166 |
-
}
|
167 |
-
?>
|
168 |
-
<form action="" method="post" id="pf_admin">
|
169 |
-
<div id="buttonStyle">
|
170 |
-
<h3>Button Style</h3>
|
171 |
-
<ul id="pfbuttons">
|
172 |
-
<li><?php echo pf_radio('pf-button.gif'); ?></li>
|
173 |
-
<li><?php echo pf_radio('pf-button-both.gif'); ?></li>
|
174 |
-
<li><?php echo pf_radio('pf-button-big.gif'); ?></li>
|
175 |
-
|
176 |
-
</ul>
|
177 |
-
<div id="custom_buttons">
|
178 |
-
<ul id="pftxtbuttons">
|
179 |
-
<li class="preview_button"><?php echo pf_radio('pf-icon-small.gif'); ?></li>
|
180 |
-
<li class="preview_button"><?php echo pf_radio('pf-icon-both.gif'); ?></li>
|
181 |
-
<li class="preview_button"><?php echo pf_radio('pf-icon.gif'); ?></li>
|
182 |
-
<li class="preview_button"><?php echo pf_radio('text-only'); ?></li>
|
183 |
-
<li class="preview_button"><?php echo pf_radio('custom-image'); ?>
|
184 |
-
<label id="custom_url">Custom Image URL
|
185 |
-
<input id="upload_image" type="text" size="40" name="upload_image" value="<?php echo get_option('pf_custom_image'); ?>" />
|
186 |
-
<div class="help">.JPG .GIF or .PNG Absolute (http://www.example.com/...), or Relative (/wp/wp-content/uploads/example.png)</div></label></li>
|
187 |
-
</ul>
|
188 |
-
|
189 |
-
<ul id="custom_options">
|
190 |
-
<li><label>Button Says <input type="text" name="custom_text" id="pf_custom_text" value="<?php echo get_option('pf_custom_text'); ?>"></label></li>
|
191 |
-
<li>
|
192 |
-
<label>Text Color <div id="colorSelector"><div style="background-color: <?php echo get_option('pf_text_color'); ?>;"></div></div>
|
193 |
-
</label><input type="hidden" name="pf_text_color" id="pf_text_color" value="<?php echo get_option('pf_text_color'); ?>"/></li>
|
194 |
-
<li><label>Text Size<input type="text" id="pf_text_size" name="pf_text_size" value="<?php echo get_option('pf_text_size'); ?>"/></label></li>
|
195 |
-
</ul>
|
196 |
-
|
197 |
-
|
198 |
-
<br class='clear' />
|
199 |
-
</div>
|
200 |
-
<br class='clear' />
|
201 |
-
</div>
|
202 |
-
|
203 |
-
|
204 |
-
<div id="pf_position">
|
205 |
-
<h3>Button Placement</h3>
|
206 |
-
|
207 |
-
<ul id="pf_alignment">
|
208 |
-
<strong>Align</strong>
|
209 |
-
<li><label><input type="radio" name="pf_content_position" value="left"<?php if(get_option('pf_content_position')==null){echo ' checked="checked"';} ?>/>Left</label></li>
|
210 |
-
<li><label><input type="radio" name="pf_content_position" value="center"<?php if(get_option('pf_content_position')=='center'){echo ' checked="checked"';} ?>/>Center</label></li>
|
211 |
-
<li><label><input type="radio" name="pf_content_position" value="right"<?php if(get_option('pf_content_position')=='right'){echo ' checked="checked"';} ?>/>Right</label></li>
|
212 |
-
<li><hr/></li>
|
213 |
-
<li><label><input type="radio" class="pf_content_placement" name="pf_content_placement" value="before"<?php if(get_option('pf_content_placement')=='before'){echo ' checked="checked"';} if(get_option('pf_show_list')=='manual'){echo ' disabled="disabled"';} ?>/>Top </label></li>
|
214 |
-
|
215 |
-
<li><label><input type="radio" class="pf_content_placement" name="pf_content_placement" value="after"<?php if(get_option('pf_content_placement')==null){echo ' checked="checked"';} if(get_option('pf_show_list')=='manual'){echo ' disabled="disabled"';} ?>/>Bottom</label></li>
|
216 |
-
</ul>
|
217 |
-
|
218 |
-
<ul id="pf_margin">
|
219 |
-
<strong>Margin</strong> (in pixels)
|
220 |
-
<li><label><input type="text" name="pf_margin_left" value="<?php echo pf_margin_down('left'); ?>" maxlength="3"/>Left</label></li>
|
221 |
-
<li><label><input type="text" name="pf_margin_right" value="<?php echo pf_margin_down('right'); ?>"/>Right</label></li>
|
222 |
-
<li><label><input name="pf_margin_top" type="text" value="<?php echo pf_margin_down('top'); ?>" maxlength="3"/>Top </label></li>
|
223 |
-
<li><label><input type="text" name="pf_margin_bottom" value="<?php echo pf_margin_down('bottom'); ?>" maxlength="3"/>Bottom</label></li>
|
224 |
-
</ul>
|
225 |
-
|
226 |
-
|
227 |
-
<ul>
|
228 |
-
<strong>Add PrintFriendly to These Pages</strong>
|
229 |
-
<li><label><input type="radio" class="pf_show_list" name="pf_show_list" value="all" onclick="hideit();"<?php if(get_option('pf_show_list')=='all' || get_option('pf_show_list')==null ){echo ' checked="checked"';} ?>/>Homepage, Posts, and Pages</label></li>
|
230 |
-
<li><label><input type="radio" class="pf_show_list" name="pf_show_list" value="single" onclick="hideit();"<?php if(get_option('pf_show_list')=='single' || get_option('pf_show_list')==1){echo ' checked="checked"';} ?>/>Posts and Pages</label></li>
|
231 |
-
<li>
|
232 |
-
<label>
|
233 |
-
<input type="radio" class="pf_show_list" name="pf_show_list" value="posts" onclick="hideit();"<?php if(get_option('pf_show_list')=='posts' || get_option('pf_show_list')==2){echo ' checked="checked"';} ?>/>Posts</label></li>
|
234 |
-
|
235 |
-
<li>
|
236 |
-
<label>
|
237 |
-
<input type="radio" class="pf_show_list" name="pf_show_list" value="manual" onclick="showit();"<?php if(get_option('pf_show_list')=='manual' || get_option('pf_show_list')==3){echo ' checked="checked"';} ?>/>Manual
|
238 |
-
</label>
|
239 |
-
|
240 |
-
<div id="manual" <?php if(get_option('pf_show_list') != 'manual') echo 'style="display:none"'?>>
|
241 |
-
<p>Copy and paste the code below anywhere in your template pages.</p>
|
242 |
-
<code style="display:block;"><?php if(function_exists('pf_show_link')){echo pf_show_link();} ?></code>
|
243 |
-
</div>
|
244 |
-
</li>
|
245 |
-
</ul>
|
246 |
-
<br class='clear'/>
|
247 |
-
</div>
|
248 |
-
<div id="pf_save">
|
249 |
-
<input type="submit" class="button-primary" value="Save Options" name="pf_save"/>
|
250 |
-
<input type="reset" class="button-secondary" value="Cancel"/>
|
251 |
-
<div id="contact_pf">Like PrintFriendly? <a href="http://wordpress.org/extend/plugins/printfriendly/">Give us a rating</a>. Need help or have suggestions? <a href="mailto:support@PrintFriendly.com">support@PrintFriendly.com</a>.</div>
|
252 |
-
</div>
|
253 |
-
</form>
|
254 |
-
</div>
|
255 |
-
<?php }?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,72 +1,97 @@
|
|
1 |
=== Print Friendly and PDF Button===
|
2 |
-
Contributors:
|
3 |
Tags: print, pdf, printer, printing, printable, widget, plugin
|
4 |
-
Requires at least:
|
5 |
-
Tested up to: 3.1
|
6 |
-
Stable tag:
|
7 |
|
8 |
-
#1 Print and PDF button for your
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
-
The Print Friendly & PDF button saves paper and ink when printing or creating a PDF. It's fast, easy, and looks great when printed. Add the button now, and
|
13 |
|
14 |
-
|
15 |
|
16 |
-
The Print Friendly & PDF button automatically creates printer friendly and PDF versions of your pages without the hassle of
|
|
|
|
|
17 |
|
18 |
-
##Cool Features For You:
|
19 |
* Get a Printer Friendly and PDF button for your users.
|
20 |
* Fully Customizable! Choose your favorite print and PDF button, use a text link, or use your own graphic.
|
21 |
* Get precision placement with easy to change margins, alignment, and pages for your Print and PDF button.
|
22 |
-
* On-Page-Lightbox. Have you noticed that
|
23 |
* Professional looking print and PDF buttons and user experience.
|
24 |
-
* More repeats and new users. Your brand/URL are printed on the page or saved in the PDF so users remember your site
|
25 |
|
26 |
-
|
27 |
* Optimizes pages for printing and PDF so you save money and the environment.
|
28 |
-
* You can Print or get a PDF
|
29 |
-
* Edit the page before printing or getting a PDF
|
30 |
-
|
31 |
-
##[Get PrintFriendly & PDF Now](http://downloads.wordpress.org/plugin/printfriendly.zip "Download PrintFriendly & PDF")
|
32 |
|
33 |
-
PrintFriendly and PDF is the #1 print optimization technology, **featured in [Lifehacker](http://lifehacker.com/5272212/print-friendly-optimizes-web-pages-for-printing "PrintFriendly & PDF in Lifehacker"), [Mashable](http://mashable.com/2009/05/18/print-friendly/ "PrintFriendly & PDF in Mashable")
|
34 |
|
35 |
**Give PrintFriendly & PDF a test drive at [PrintFriendly.com](http://www.printfriendly.com "PrintFriendly & PDF")**
|
36 |
|
37 |
-
|
38 |
-
|
39 |
== Installation ==
|
40 |
|
41 |
-
1.
|
42 |
-
2.
|
43 |
-
3. Activate the plugin in your
|
44 |
4. Select "Settings" to customize button style and placement.
|
45 |
|
46 |
-
==
|
|
|
|
|
|
|
47 |
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
== Screenshots ==
|
51 |
|
52 |
1. The Print Friendly widget optimizes and formats your pages for print. Users can remove images and text before printing plus get a PDF
|
53 |
-
2.
|
54 |
-
|
55 |
|
56 |
== Changelog ==
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
= 2.1.8 =
|
59 |
-
* The Print Button was showing up on printed, or PDF, pages. Junk! Print or PDF button no longer displayed on printed out page or PDF.
|
60 |
|
|
|
61 |
|
62 |
= 2.1.7 =
|
|
|
63 |
* Changed print button from <span> to <div> to support floating the print and PDF button to right.
|
64 |
|
65 |
= 2.1.6 =
|
66 |
-
* Added rel="no follow" to the print links to avoid search engines indexing the print pages.
|
67 |
-
* Changed print button from link <a> to <span>. Some tracking plugins added target_new/blank to link, therefore breaking print friendly.
|
68 |
|
|
|
|
|
69 |
|
70 |
= 2.1.5 =
|
71 |
-
|
|
|
72 |
* Custom image support for hosted solutions
|
1 |
=== Print Friendly and PDF Button===
|
2 |
+
Contributors: printfriendly,joostdevalk
|
3 |
Tags: print, pdf, printer, printing, printable, widget, plugin
|
4 |
+
Requires at least: 2.8
|
5 |
+
Tested up to: 3.2.1
|
6 |
+
Stable tag: 3.0
|
7 |
|
8 |
+
The #1 Print and PDF button for your WordPress site. Printer Friendly pages without coding, css, or print.css. Fast, easy, and professional.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
+
The Print Friendly & PDF button saves paper and ink when printing or creating a PDF. It's fast, easy, and looks great when printed. Add the button now, and your users will see the difference.
|
13 |
|
14 |
+
**How Print Friendly & PDF Works**
|
15 |
|
16 |
+
The Print Friendly & PDF button automatically creates printer friendly and PDF versions of your pages without the hassle of having to create a print CSS file. No coding, hacking or programming required. Simply install the Print Friendly & PDF plugin, activate, and choose settings for full customization. It also gives your user the ability to remove images and paragraphs of text, so they really only have to print exactly what they want.
|
17 |
+
|
18 |
+
**Cool Features For You:**
|
19 |
|
|
|
20 |
* Get a Printer Friendly and PDF button for your users.
|
21 |
* Fully Customizable! Choose your favorite print and PDF button, use a text link, or use your own graphic.
|
22 |
* Get precision placement with easy to change margins, alignment, and pages for your Print and PDF button.
|
23 |
+
* On-Page-Lightbox. Have you noticed that other printer friendly buttons open new windows, or tabs? Not with Print Friendly & PDF button. It opens in a Lightbox so you your users stay on the page, and your wp website.
|
24 |
* Professional looking print and PDF buttons and user experience.
|
25 |
+
* More repeats and new users. Your brand/URL are printed on the page or saved in the PDF so users remember your site and new users can find you.
|
26 |
|
27 |
+
**Cool Print Features for Users:**
|
28 |
* Optimizes pages for printing and PDF so you save money and the environment.
|
29 |
+
* You can Print or get a PDF.
|
30 |
+
* Edit the page before printing or getting a PDF: remove the images and paragraphs you don't need to save ink!
|
|
|
|
|
31 |
|
32 |
+
PrintFriendly and PDF is the #1 print optimization technology, **as featured in [Lifehacker](http://lifehacker.com/5272212/print-friendly-optimizes-web-pages-for-printing "PrintFriendly & PDF in Lifehacker"), [Mashable](http://mashable.com/2009/05/18/print-friendly/ "PrintFriendly & PDF in Mashable") & [makeuseof](http://www.makeuseof.com/dir/printfriendly-save-on-paper-and-ink/#comment-95052)**.
|
33 |
|
34 |
**Give PrintFriendly & PDF a test drive at [PrintFriendly.com](http://www.printfriendly.com "PrintFriendly & PDF")**
|
35 |
|
|
|
|
|
36 |
== Installation ==
|
37 |
|
38 |
+
1. Search for PrintFriendly in your WordPress backend and click install, or download the printfriendly.zip file and unzip it.
|
39 |
+
2. If you downloaded the zip, upload the printfriendly folder into wp-content/plugins folder
|
40 |
+
3. Activate the plugin in your WordPress Admin area.
|
41 |
4. Select "Settings" to customize button style and placement.
|
42 |
|
43 |
+
== Frequently Asked Questions ==
|
44 |
+
|
45 |
+
= I set the button to align left / right and it doesn't align right! =
|
46 |
+
Check whether your theme includes the [required CSS class](http://codex.wordpress.org/CSS#WordPress_Generated_Classes), PrintFriendly uses these to align your button. If that doesn't work for you, uncheck the "Add CSS to Pages" checkbox and style the button yourself.
|
47 |
|
48 |
+
= The Print Friendly button is loading but it's not doing anything, what's wrong? =
|
49 |
+
Check the "JavaScript fallback" checkbox in the settings and check again. If the button starts working now, the JavaScript isn't loading correctly. Check your source for a mention of `cdn.printfriendly.com/printfriendly.js`. If it's not there, make sure your theme has the required [wp_footer](http://codex.wordpress.org/Function_Reference/wp_footer) call.
|
50 |
+
|
51 |
+
= Some of the input fields in the admin are disabled! =
|
52 |
+
If you've disabled the loading of CSS and / or set "Add PrintFriendly To" to Manual, some of the input boxes will be disabled as you've basically disabled that functionality.
|
53 |
+
|
54 |
+
= I'm manually adding the button but it's aligning wrong! =
|
55 |
+
If you're getting unexpected results, you might want to set Horizontal Alignment to "None".
|
56 |
+
|
57 |
+
= I still need help! =
|
58 |
+
If you have any other issues with the plugin or the PrintFriendly widget, please write to support@printfriendly.com.
|
59 |
|
60 |
== Screenshots ==
|
61 |
|
62 |
1. The Print Friendly widget optimizes and formats your pages for print. Users can remove images and text before printing plus get a PDF
|
63 |
+
2. The Settings Page: choose your print button, text link, or use your own text or graphic.
|
|
|
64 |
|
65 |
== Changelog ==
|
66 |
|
67 |
+
= 3.0 =
|
68 |
+
|
69 |
+
* A complete overhaul of the plugin by renowned WordPress plugin developer <a href="http://yoast.com/">Joost de Valk</a>.
|
70 |
+
* Code Changes:
|
71 |
+
* Redone the admin page.
|
72 |
+
* Plugin is now fully i18n ready.
|
73 |
+
* Plugin now uses the settings API.
|
74 |
+
* CSS loading is now optional.
|
75 |
+
* JavaScript loading is now optional.
|
76 |
+
* Plugin now uses WordPress default align classes for outlining.
|
77 |
+
* Documentation changes:
|
78 |
+
* Added an FAQ.
|
79 |
+
* Added Screenshots.
|
80 |
+
|
81 |
= 2.1.8 =
|
|
|
82 |
|
83 |
+
* The Print Button was showing up on printed, or PDF, pages. Junk! Print or PDF button no longer displayed on printed out page or PDF.
|
84 |
|
85 |
= 2.1.7 =
|
86 |
+
|
87 |
* Changed print button from <span> to <div> to support floating the print and PDF button to right.
|
88 |
|
89 |
= 2.1.6 =
|
|
|
|
|
90 |
|
91 |
+
* Added rel="nofollow" to the print links to avoid search engines indexing the print pages.
|
92 |
+
* Changed print button from link <a> to <span>. Some tracking plugins added target_new/blank to link, therefore breaking print friendly.
|
93 |
|
94 |
= 2.1.5 =
|
95 |
+
|
96 |
+
* To avoid conflicts with Google Analytics widgets, changed link structure. No longer uses onclick to call PrintFriendly Javascript. Now the javascript is called in the href.
|
97 |
* Custom image support for hosted solutions
|
screenshot-2.png
CHANGED
Binary file
|
uninstall.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if( !defined( 'ABSPATH' ) && !defined( 'WP_UNINSTALL_PLUGIN' ) )
|
4 |
+
exit();
|
5 |
+
|
6 |
+
delete_option( 'printfriendly_option' );
|