Version Description
Download this release
Release Info
Developer | printfriendly |
Plugin | Print, PDF, Email by PrintFriendly |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0 to 2.1
- admin.css +311 -304
- admin.js +0 -0
- colorpicker.js +0 -0
- images/blank.gif +0 -0
- images/colorpicker_background.png +0 -0
- images/colorpicker_hex.png +0 -0
- images/colorpicker_hsb_b.png +0 -0
- images/colorpicker_hsb_h.png +0 -0
- images/colorpicker_hsb_s.png +0 -0
- images/colorpicker_indic.gif +0 -0
- images/colorpicker_overlay.png +0 -0
- images/colorpicker_rgb_b.png +0 -0
- images/colorpicker_rgb_g.png +0 -0
- images/colorpicker_rgb_r.png +0 -0
- images/colorpicker_select.gif +0 -0
- images/colorpicker_submit.png +0 -0
- images/custom_background.png +0 -0
- images/custom_hex.png +0 -0
- images/custom_hsb_b.png +0 -0
- images/custom_hsb_h.png +0 -0
- images/custom_hsb_s.png +0 -0
- images/custom_indic.gif +0 -0
- images/custom_rgb_b.png +0 -0
- images/custom_rgb_g.png +0 -0
- images/custom_rgb_r.png +0 -0
- images/custom_submit.png +0 -0
- images/noimage.png +0 -0
- images/select.png +0 -0
- images/select2.png +0 -0
- images/slider.png +0 -0
- pf.php +228 -228
- pf_admin.php +272 -264
- readme.txt +29 -12
admin.css
CHANGED
@@ -1,305 +1,312 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
-
|
77 |
-
border-radius: 4px;
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
font-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
position:
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
-
|
275 |
-
border-radius:
|
276 |
-
border:
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
background-
|
295 |
-
background-image: -
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
}
|
1 |
+
/*v2.1*/
|
2 |
+
#pf_button_options{
|
3 |
+
float:left;
|
4 |
+
width:430px;
|
5 |
+
}
|
6 |
+
|
7 |
+
#pf_buttons{
|
8 |
+
clear:both;
|
9 |
+
overflow:hidden;
|
10 |
+
width:400px;
|
11 |
+
float:left;
|
12 |
+
}
|
13 |
+
|
14 |
+
#pf_buttons .buttongroup{
|
15 |
+
float:left;
|
16 |
+
width:200px;
|
17 |
+
height:125px;
|
18 |
+
}
|
19 |
+
#pf_buttons .buttongroup.larger{
|
20 |
+
width:395px;
|
21 |
+
height:inherit;
|
22 |
+
}
|
23 |
+
|
24 |
+
#pf_buttons .buttongroup p{
|
25 |
+
margin: 15px 0;
|
26 |
+
}
|
27 |
+
#pf_buttons .buttongroup p label input{
|
28 |
+
position:relative;
|
29 |
+
bottom:6px;
|
30 |
+
margin-right:8px;
|
31 |
+
}
|
32 |
+
|
33 |
+
#pf_buttons .buttongroup p label input.bigger{
|
34 |
+
bottom:10px;
|
35 |
+
}
|
36 |
+
|
37 |
+
#pf_left{
|
38 |
+
width:400px;
|
39 |
+
float:left;
|
40 |
+
margin-right:30px;
|
41 |
+
}
|
42 |
+
#pf_designer{
|
43 |
+
float:left;
|
44 |
+
width:430px;
|
45 |
+
}
|
46 |
+
.pf_check{
|
47 |
+
display:block;
|
48 |
+
margin-top:4px;
|
49 |
+
}
|
50 |
+
.pf_check.disabled{
|
51 |
+
color:#ccc:
|
52 |
+
}
|
53 |
+
.pf_check input[type="radio"],.pf_check input[type="checkbox"]{
|
54 |
+
position:relative;
|
55 |
+
bottom:2px;
|
56 |
+
margin-right:4px;
|
57 |
+
}
|
58 |
+
|
59 |
+
.pf_px{
|
60 |
+
width:45px;
|
61 |
+
}
|
62 |
+
.pf_label{
|
63 |
+
display:block;
|
64 |
+
font-weight:bold;
|
65 |
+
}
|
66 |
+
|
67 |
+
.pf_tip{
|
68 |
+
font-size:10px;
|
69 |
+
color:#888;
|
70 |
+
text-shadow:1px 1px 1px #fff;
|
71 |
+
}
|
72 |
+
|
73 |
+
#pf_uploader{
|
74 |
+
background: #e8e8e8;
|
75 |
+
border: 1px solid #ccc;
|
76 |
+
-webkit-border-radius: 4px;
|
77 |
+
-moz-border-radius: 4px;
|
78 |
+
border-radius: 4px;
|
79 |
+
padding:10px 15px;
|
80 |
+
width:400px;
|
81 |
+
}
|
82 |
+
#pf_uploader input[type="text"]{
|
83 |
+
width:275px;
|
84 |
+
}
|
85 |
+
#pf_uploader p{
|
86 |
+
margin-top:4px;
|
87 |
+
line-height:16px;
|
88 |
+
margin:0;
|
89 |
+
color:#888;
|
90 |
+
}
|
91 |
+
|
92 |
+
/* color picker css */
|
93 |
+
#colorSelector {
|
94 |
+
position: relative;
|
95 |
+
width: 36px;
|
96 |
+
height: 36px;
|
97 |
+
background: url(../images/select.png);
|
98 |
+
}
|
99 |
+
#colorSelector div {
|
100 |
+
position: absolute;
|
101 |
+
top: 3px;
|
102 |
+
left: 3px;
|
103 |
+
width: 30px;
|
104 |
+
height: 30px;
|
105 |
+
background: url(../images/select.png) center;
|
106 |
+
}
|
107 |
+
|
108 |
+
.colorpicker {
|
109 |
+
width: 356px;
|
110 |
+
height: 176px;
|
111 |
+
overflow: hidden;
|
112 |
+
position: absolute;
|
113 |
+
background: url(../images/colorpicker_background.png);
|
114 |
+
font-family: Arial, Helvetica, sans-serif;
|
115 |
+
display: none;
|
116 |
+
}
|
117 |
+
.colorpicker_color {
|
118 |
+
width: 150px;
|
119 |
+
height: 150px;
|
120 |
+
left: 14px;
|
121 |
+
top: 13px;
|
122 |
+
position: absolute;
|
123 |
+
background: #f00;
|
124 |
+
overflow: hidden;
|
125 |
+
cursor: crosshair;
|
126 |
+
}
|
127 |
+
.colorpicker_color div {
|
128 |
+
position: absolute;
|
129 |
+
top: 0;
|
130 |
+
left: 0;
|
131 |
+
width: 150px;
|
132 |
+
height: 150px;
|
133 |
+
background: url(../images/colorpicker_overlay.png);
|
134 |
+
}
|
135 |
+
.colorpicker_color div div {
|
136 |
+
position: absolute;
|
137 |
+
top: 0;
|
138 |
+
left: 0;
|
139 |
+
width: 11px;
|
140 |
+
height: 11px;
|
141 |
+
overflow: hidden;
|
142 |
+
background: url(../images/colorpicker_select.gif);
|
143 |
+
margin: -5px 0 0 -5px;
|
144 |
+
}
|
145 |
+
.colorpicker_hue {
|
146 |
+
position: absolute;
|
147 |
+
top: 13px;
|
148 |
+
left: 171px;
|
149 |
+
width: 35px;
|
150 |
+
height: 150px;
|
151 |
+
cursor: n-resize;
|
152 |
+
}
|
153 |
+
.colorpicker_hue div {
|
154 |
+
position: absolute;
|
155 |
+
width: 35px;
|
156 |
+
height: 9px;
|
157 |
+
overflow: hidden;
|
158 |
+
background: url(../images/colorpicker_indic.gif) left top;
|
159 |
+
margin: -4px 0 0 0;
|
160 |
+
left: 0px;
|
161 |
+
}
|
162 |
+
.colorpicker_new_color {
|
163 |
+
position: absolute;
|
164 |
+
width: 60px;
|
165 |
+
height: 30px;
|
166 |
+
left: 213px;
|
167 |
+
top: 13px;
|
168 |
+
background: #f00;
|
169 |
+
}
|
170 |
+
.colorpicker_current_color {
|
171 |
+
position: absolute;
|
172 |
+
width: 60px;
|
173 |
+
height: 30px;
|
174 |
+
left: 283px;
|
175 |
+
top: 13px;
|
176 |
+
background: #f00;
|
177 |
+
}
|
178 |
+
.colorpicker input {
|
179 |
+
background-color: transparent;
|
180 |
+
border: 1px solid transparent;
|
181 |
+
position: absolute;
|
182 |
+
font-size: 10px;
|
183 |
+
font-family: Arial, Helvetica, sans-serif;
|
184 |
+
color: #898989;
|
185 |
+
top: 4px;
|
186 |
+
right: 11px;
|
187 |
+
text-align: right;
|
188 |
+
margin: 0;
|
189 |
+
padding: 0;
|
190 |
+
height: 11px;
|
191 |
+
}
|
192 |
+
.colorpicker_hex {
|
193 |
+
position: absolute;
|
194 |
+
width: 72px;
|
195 |
+
height: 22px;
|
196 |
+
background: url(../images/colorpicker_hex.png) top;
|
197 |
+
left: 212px;
|
198 |
+
top: 142px;
|
199 |
+
}
|
200 |
+
.colorpicker_hex input {
|
201 |
+
right: 6px;
|
202 |
+
}
|
203 |
+
.colorpicker_field {
|
204 |
+
height: 22px;
|
205 |
+
width: 62px;
|
206 |
+
background-position: top;
|
207 |
+
position: absolute;
|
208 |
+
}
|
209 |
+
.colorpicker_field span {
|
210 |
+
position: absolute;
|
211 |
+
width: 12px;
|
212 |
+
height: 22px;
|
213 |
+
overflow: hidden;
|
214 |
+
top: 0;
|
215 |
+
right: 0;
|
216 |
+
cursor: n-resize;
|
217 |
+
}
|
218 |
+
.colorpicker_rgb_r {
|
219 |
+
background-image: url(../images/colorpicker_rgb_r.png);
|
220 |
+
top: 52px;
|
221 |
+
left: 212px;
|
222 |
+
}
|
223 |
+
.colorpicker_rgb_g {
|
224 |
+
background-image: url(../images/colorpicker_rgb_g.png);
|
225 |
+
top: 82px;
|
226 |
+
left: 212px;
|
227 |
+
}
|
228 |
+
.colorpicker_rgb_b {
|
229 |
+
background-image: url(../images/colorpicker_rgb_b.png);
|
230 |
+
top: 112px;
|
231 |
+
left: 212px;
|
232 |
+
}
|
233 |
+
.colorpicker_hsb_h {
|
234 |
+
background-image: url(../images/colorpicker_hsb_h.png);
|
235 |
+
top: 52px;
|
236 |
+
left: 282px;
|
237 |
+
}
|
238 |
+
.colorpicker_hsb_s {
|
239 |
+
background-image: url(../images/colorpicker_hsb_s.png);
|
240 |
+
top: 82px;
|
241 |
+
left: 282px;
|
242 |
+
}
|
243 |
+
.colorpicker_hsb_b {
|
244 |
+
background-image: url(../images/colorpicker_hsb_b.png);
|
245 |
+
top: 112px;
|
246 |
+
left: 282px;
|
247 |
+
}
|
248 |
+
.colorpicker_submit {
|
249 |
+
position: absolute;
|
250 |
+
width: 22px;
|
251 |
+
height: 22px;
|
252 |
+
background: url(../images/colorpicker_submit.png) top;
|
253 |
+
left: 322px;
|
254 |
+
top: 142px;
|
255 |
+
overflow: hidden;
|
256 |
+
}
|
257 |
+
.colorpicker_focus {
|
258 |
+
background-position: center;
|
259 |
+
}
|
260 |
+
.colorpicker_hex.colorpicker_focus {
|
261 |
+
background-position: bottom;
|
262 |
+
}
|
263 |
+
.colorpicker_submit.colorpicker_focus {
|
264 |
+
background-position: bottom;
|
265 |
+
}
|
266 |
+
.colorpicker_slider {
|
267 |
+
background-position: bottom;
|
268 |
+
}
|
269 |
+
|
270 |
+
|
271 |
+
.pf_box{
|
272 |
+
clear:both;
|
273 |
+
/* Borders Radius */
|
274 |
+
-moz-border-radius: 6px ;
|
275 |
+
-webkit-border-radius: 6px ;
|
276 |
+
border-radius: 6px;
|
277 |
+
border:1px solid #DFDFDF;
|
278 |
+
background: #fff;
|
279 |
+
margin-bottom: 24px;
|
280 |
+
}
|
281 |
+
.pf_box .pf_c{
|
282 |
+
padding:0px 10px 10px;
|
283 |
+
overflow:hidden;
|
284 |
+
clear:both;
|
285 |
+
}
|
286 |
+
|
287 |
+
.pf_box h3{
|
288 |
+
font-size:13px;
|
289 |
+
line-height: 1;
|
290 |
+
text-shadow: 0 1px 0 #FFFFFF;
|
291 |
+
padding: 7px 9px;
|
292 |
+
margin:0;
|
293 |
+
/* Background Gradient */
|
294 |
+
background-color: #e1e1e1;
|
295 |
+
background-image: -moz-linear-gradient(top, #ededed, #e1e1e1);
|
296 |
+
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #ededed),color-stop(1, #e1e1e1));
|
297 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#ededed', EndColorStr='#e1e1e1');
|
298 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#ededed', EndColorStr='#e1e1e1')";
|
299 |
+
}
|
300 |
+
.pf_box .pf_c .pf_float{
|
301 |
+
float:left;
|
302 |
+
margin-right:36px;
|
303 |
+
}
|
304 |
+
#manual {
|
305 |
+
display: none;
|
306 |
+
}
|
307 |
+
#imgurl {
|
308 |
+
display: none;
|
309 |
+
}
|
310 |
+
div.pf_content_placement{
|
311 |
+
display:none;
|
312 |
}
|
admin.js
CHANGED
File without changes
|
colorpicker.js
CHANGED
File without changes
|
images/blank.gif
CHANGED
File without changes
|
images/colorpicker_background.png
CHANGED
File without changes
|
images/colorpicker_hex.png
CHANGED
File without changes
|
images/colorpicker_hsb_b.png
CHANGED
File without changes
|
images/colorpicker_hsb_h.png
CHANGED
File without changes
|
images/colorpicker_hsb_s.png
CHANGED
File without changes
|
images/colorpicker_indic.gif
CHANGED
File without changes
|
images/colorpicker_overlay.png
CHANGED
File without changes
|
images/colorpicker_rgb_b.png
CHANGED
File without changes
|
images/colorpicker_rgb_g.png
CHANGED
File without changes
|
images/colorpicker_rgb_r.png
CHANGED
File without changes
|
images/colorpicker_select.gif
CHANGED
File without changes
|
images/colorpicker_submit.png
CHANGED
File without changes
|
images/custom_background.png
CHANGED
File without changes
|
images/custom_hex.png
CHANGED
File without changes
|
images/custom_hsb_b.png
CHANGED
File without changes
|
images/custom_hsb_h.png
CHANGED
File without changes
|
images/custom_hsb_s.png
CHANGED
File without changes
|
images/custom_indic.gif
CHANGED
File without changes
|
images/custom_rgb_b.png
CHANGED
File without changes
|
images/custom_rgb_g.png
CHANGED
File without changes
|
images/custom_rgb_r.png
CHANGED
File without changes
|
images/custom_submit.png
CHANGED
File without changes
|
images/noimage.png
CHANGED
File without changes
|
images/select.png
CHANGED
File without changes
|
images/select2.png
CHANGED
File without changes
|
images/slider.png
CHANGED
File without changes
|
pf.php
CHANGED
@@ -1,229 +1,229 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Print Friendly & PDF
|
4 |
-
Plugin URI: http://www.printfriendly.com/button
|
5 |
-
Description: Adds a Print Friendly & PDF button for your pages. Help your users save paper and ink, and engage with your content. Developed by <a href="http://
|
6 |
-
Version: 2.
|
7 |
-
Author: PrintFriendly
|
8 |
-
Author URI: http://www.PrintFriendly.com
|
9 |
-
|
10 |
-
Changelog :
|
11 |
-
2.
|
12 |
-
1
|
13 |
-
|
14 |
-
1.
|
15 |
-
1.
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
////////////////////////////// Wordpress hooks
|
22 |
-
|
23 |
-
// add the settings page
|
24 |
-
add_action('admin_menu', 'pf_menu');
|
25 |
-
function pf_menu() {
|
26 |
-
add_options_page('PrintFriendly Options', 'PrintFriendly', 'publish_posts', 'printfriendly', 'pf_options');
|
27 |
-
}
|
28 |
-
|
29 |
-
// add the settings link to the plugin page
|
30 |
-
|
31 |
-
function pf_settings_link($links) {
|
32 |
-
$settings_link = '<a href="options-general.php?page=printfriendly">Settings</a>';
|
33 |
-
array_unshift($links, $settings_link);
|
34 |
-
return $links;
|
35 |
-
}
|
36 |
-
|
37 |
-
// add css, js, and check for updates
|
38 |
-
if (isset($_GET['page']) && $_GET['page'] == 'printfriendly') {
|
39 |
-
add_action('admin_print_scripts', 'pf_admin_scripts');
|
40 |
-
add_action('admin_print_styles', 'pf_admin_styles');
|
41 |
-
add_action('admin_head', 'pf_css_in_admin_head');
|
42 |
-
if(get_option('pf_text_color')==null){
|
43 |
-
//old install or something is fishy! lets run the install!
|
44 |
-
printfriendly_activation_handler();
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
$pf_pluginbase = plugin_basename(__FILE__);
|
49 |
-
add_filter('plugin_action_links_'.$pf_pluginbase, 'pf_settings_link');
|
50 |
-
|
51 |
-
// automaticaly add the link
|
52 |
-
add_action('the_content', 'pf_show_link');
|
53 |
-
|
54 |
-
// lets start our mess!
|
55 |
-
function printfriendly_activation_handler(){
|
56 |
-
update_option('pf_margin_top',0);
|
57 |
-
update_option('pf_margin_right',0);
|
58 |
-
update_option('pf_margin_bottom',0);
|
59 |
-
update_option('pf_margin_left',0);
|
60 |
-
|
61 |
-
|
62 |
-
update_option('pf_text_color','#55750C');
|
63 |
-
update_option('pf_text_size','
|
64 |
-
if(get_option('pf_show_list')==0){
|
65 |
-
update_option('pf_show_list','all');
|
66 |
-
}elseif(get_option('pf_show_list')==1){
|
67 |
-
update_option('pf_show_list','single');
|
68 |
-
}
|
69 |
-
if(get_option('pf_disable_prepend')==1){
|
70 |
-
update_option('pf_show_list','manual');
|
71 |
-
}
|
72 |
-
delete_option('pf_disable_prepend');
|
73 |
-
}
|
74 |
-
|
75 |
-
// lets clean our mess when we are done and properly
|
76 |
-
function printfriendly_deactivation_handler(){
|
77 |
-
delete_option('pf_button_type');
|
78 |
-
delete_option('pf_custom_text');
|
79 |
-
|
80 |
-
delete_option('pf_custom_image');
|
81 |
-
|
82 |
-
delete_option('pf_show_list');
|
83 |
-
delete_option('pf_content_placement');
|
84 |
-
delete_option('pf_content_position');
|
85 |
-
|
86 |
-
delete_option('pf_margin_top');
|
87 |
-
delete_option('pf_margin_right');
|
88 |
-
delete_option('pf_margin_bottom');
|
89 |
-
delete_option('pf_margin_left');
|
90 |
-
}
|
91 |
-
register_activation_hook(__FILE__, 'printfriendly_activation_handler');
|
92 |
-
register_uninstall_hook(__FILE__, 'printfriendly_deactivation_handler');
|
93 |
-
|
94 |
-
// add CSS into admin panel
|
95 |
-
function pf_css_in_admin_head() {
|
96 |
-
$url = plugins_url().'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'/admin.css';
|
97 |
-
echo "<link rel='stylesheet' type='text/css' href='$url' />\n";
|
98 |
-
}
|
99 |
-
|
100 |
-
////////////////////////////// Admin Settings
|
101 |
-
|
102 |
-
function pf_options(){
|
103 |
-
include_once('pf_admin.php');
|
104 |
-
}
|
105 |
-
|
106 |
-
// setup for uploads
|
107 |
-
function pf_admin_scripts() {
|
108 |
-
wp_enqueue_script('media-upload');
|
109 |
-
wp_enqueue_script('thickbox');
|
110 |
-
wp_register_script('pf-color-picker', plugins_url().'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'/colorpicker.js', array('jquery','media-upload','thickbox'));
|
111 |
-
wp_register_script('pf-admin-js', plugins_url().'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'/admin.js', array('jquery','media-upload','thickbox'));
|
112 |
-
wp_enqueue_script('pf-color-picker');
|
113 |
-
wp_enqueue_script('pf-admin-js');
|
114 |
-
}
|
115 |
-
function pf_admin_styles() {
|
116 |
-
wp_enqueue_style('thickbox');
|
117 |
-
}
|
118 |
-
|
119 |
-
////////////////////////////// Where all the magic happens
|
120 |
-
|
121 |
-
// add js into the head
|
122 |
-
function pf_js(){
|
123 |
-
return '<script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script>';
|
124 |
-
}
|
125 |
-
|
126 |
-
function pf_radio($name){
|
127 |
-
$var = '<input name="pf_button_type" type="radio" value="'.$name.'"'; if($name=="pf-button-big.gif"){$var .= ' class="bigger"';} if( get_option('pf_button_type') == $name || ($name=="pf-button.gif" && get_option('pf_button_type')==null) ){$var .= ' checked="checked"'; } $var .= '/>';
|
128 |
-
return $var.pf_button($name);
|
129 |
-
}
|
130 |
-
|
131 |
-
function pf_button($name=false){
|
132 |
-
if($name==false){
|
133 |
-
$name = get_option('pf_button_type');
|
134 |
-
//null
|
135 |
-
if($name==null){
|
136 |
-
$name='pf-button.gif';
|
137 |
-
}
|
138 |
-
}
|
139 |
-
$text = get_option('pf_custom_text');
|
140 |
-
if( $text == null){
|
141 |
-
$text = 'Print Friendly';
|
142 |
-
}
|
143 |
-
switch($name){
|
144 |
-
case "custom-image":
|
145 |
-
$custom_image = get_option('pf_custom_image');
|
146 |
-
if($custom_image==null){
|
147 |
-
return '';
|
148 |
-
}
|
149 |
-
$return = '<img class="printfriendly" src="'.$custom_image.'" />';
|
150 |
-
if( get_option('pf_custom_text') != null){
|
151 |
-
$return .='<span class="printfriendly" style="font-size:'.get_option('pf_text_size').'px; margin-left:3px; color: '.get_option('pf_text_color').';">'.$text.'</span>';
|
152 |
-
}
|
153 |
-
return $return;
|
154 |
-
break;
|
155 |
-
|
156 |
-
case "text-only":
|
157 |
-
return '<span class="printfriendly" style="font-size: '.get_option('pf_text_size').'px; margin-left:3px; color: '.get_option('pf_text_color').';">'.$text.'</span>';
|
158 |
-
break;
|
159 |
-
|
160 |
-
case "pf-icon-both.gif":
|
161 |
-
return '<img class="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-print-icon.gif" alt="Print Friendly"/><span class="printandpdf" style="font-size:'.get_option('pf_text_size').'; margin-left:3px; color:'.get_option('pf_text_color').';"> Print <img src="http://cdn.printfriendly.com/pf-pdf-icon.gif" alt="Get a PDF version of this webpage" /> PDF </span>';
|
162 |
-
break;
|
163 |
-
|
164 |
-
case "pf-icon-small.gif":
|
165 |
-
case "pf-icon.gif":
|
166 |
-
$size = get_option('pf_text_size');
|
167 |
-
if($name=="pf-icon.gif" && $size==12){
|
168 |
-
$size= 'font-size:'.($size+3).'px; ';
|
169 |
-
}else{
|
170 |
-
$size ='font-size:'.$size.'px; ';
|
171 |
-
}
|
172 |
-
return '<img class="printfriendly" src="http://cdn.printfriendly.com/'.$name.'" alt="Print Friendly"/><span style="'.$size.'margin-left:3px; color: '.get_option('pf_text_color').';">'.$text.'</span>';
|
173 |
-
break;
|
174 |
-
|
175 |
-
case "pf-button.gif":
|
176 |
-
case "pf-button-big.gif":
|
177 |
-
case "pf-button-both.gif":
|
178 |
-
return '<img class="printfriendly" src="http://cdn.printfriendly.com/'.$name.'" alt="PrintFriendly" />';
|
179 |
-
break;
|
180 |
-
}
|
181 |
-
}
|
182 |
-
|
183 |
-
function pf_margin_down($dir){
|
184 |
-
$margin = get_option('pf_margin_'.$dir);
|
185 |
-
if($margin == null){
|
186 |
-
return '0';
|
187 |
-
}else{
|
188 |
-
return $margin;
|
189 |
-
}
|
190 |
-
}
|
191 |
-
|
192 |
-
// add button
|
193 |
-
function pf_show_link($content=false){
|
194 |
-
$pf_display = get_option('pf_show_list');
|
195 |
-
if( ($pf_display=='all' || $pf_display == null) || ($pf_display=='single' && (is_single() || is_page()) ) || ($pf_display=='manual' && $content==false) ){
|
196 |
-
if($content==false){$content = '';}
|
197 |
-
// now lets get options setup before we start ouputting data
|
198 |
-
$style=' style="text-align:';
|
199 |
-
// position
|
200 |
-
$pos = get_option('pf_content_position');
|
201 |
-
if($pos==null){$pos='left';}
|
202 |
-
$style.=$pos.';';
|
203 |
-
|
204 |
-
//margin
|
205 |
-
$style.=' margin: '.pf_margin_down('top').'px '.pf_margin_down('right').'px '.pf_margin_down('bottom').'px '.pf_margin_down('left').'px;';
|
206 |
-
|
207 |
-
$style.='" ';
|
208 |
-
|
209 |
-
if(is_single() || is_page()){
|
210 |
-
$add = pf_js();
|
211 |
-
}else{
|
212 |
-
$add = '';
|
213 |
-
}
|
214 |
-
$post_url = get_permalink();
|
215 |
-
$separator = "?pfstyle=wp";
|
216 |
-
if (strpos($post_url,"?")!=false){
|
217 |
-
$separator = "&pfstyle=wp";
|
218 |
-
}
|
219 |
-
$plink_url = $post_url . $separator;
|
220 |
-
$button = '<div'.$style.'class="pfButton">'.$add.'<a href="'.$plink_url.'">'.pf_button().'</a></div>';
|
221 |
-
if(get_option('pf_content_placement')==null){
|
222 |
-
return $content.$button;
|
223 |
-
}else{
|
224 |
-
return $button.$content;
|
225 |
-
}
|
226 |
-
}else{
|
227 |
-
return $content;
|
228 |
-
}
|
229 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Print Friendly & PDF
|
4 |
+
Plugin URI: http://www.printfriendly.com/button
|
5 |
+
Description: Adds a Print Friendly & PDF button for your pages. Help your users save paper and ink, and engage with your content. Developed by <a href="http://printfriendly.com" target="_blank">PrintFriendly</a>
|
6 |
+
Version: 2.1
|
7 |
+
Author: PrintFriendly
|
8 |
+
Author URI: http://www.PrintFriendly.com
|
9 |
+
|
10 |
+
Changelog :
|
11 |
+
2.1.1 - Fixed admin settings bug.
|
12 |
+
2.1 - Update for mult-author websites. Improvements to Settings page.
|
13 |
+
2.0 - Customize the style, placement, and pages your printfriendly button appears.
|
14 |
+
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.
|
15 |
+
1.4 - Changed Name
|
16 |
+
1.3 - Added new buttons, removed redundant code.
|
17 |
+
1.2 - User can choose to show or not show buttons on the listing page.
|
18 |
+
|
19 |
+
*/
|
20 |
+
|
21 |
+
////////////////////////////// Wordpress hooks
|
22 |
+
|
23 |
+
// add the settings page
|
24 |
+
add_action('admin_menu', 'pf_menu');
|
25 |
+
function pf_menu() {
|
26 |
+
add_options_page('PrintFriendly Options', 'PrintFriendly', 'publish_posts', 'printfriendly', 'pf_options');
|
27 |
+
}
|
28 |
+
|
29 |
+
// add the settings link to the plugin page
|
30 |
+
|
31 |
+
function pf_settings_link($links) {
|
32 |
+
$settings_link = '<a href="options-general.php?page=printfriendly">Settings</a>';
|
33 |
+
array_unshift($links, $settings_link);
|
34 |
+
return $links;
|
35 |
+
}
|
36 |
+
|
37 |
+
// add css, js, and check for updates
|
38 |
+
if (isset($_GET['page']) && $_GET['page'] == 'printfriendly') {
|
39 |
+
add_action('admin_print_scripts', 'pf_admin_scripts');
|
40 |
+
add_action('admin_print_styles', 'pf_admin_styles');
|
41 |
+
add_action('admin_head', 'pf_css_in_admin_head');
|
42 |
+
if(get_option('pf_text_color')==null){
|
43 |
+
//old install or something is fishy! lets run the install!
|
44 |
+
printfriendly_activation_handler();
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
$pf_pluginbase = plugin_basename(__FILE__);
|
49 |
+
add_filter('plugin_action_links_'.$pf_pluginbase, 'pf_settings_link');
|
50 |
+
|
51 |
+
// automaticaly add the link
|
52 |
+
add_action('the_content', 'pf_show_link');
|
53 |
+
|
54 |
+
// lets start our mess!
|
55 |
+
function printfriendly_activation_handler(){
|
56 |
+
update_option('pf_margin_top',0);
|
57 |
+
update_option('pf_margin_right',0);
|
58 |
+
update_option('pf_margin_bottom',0);
|
59 |
+
update_option('pf_margin_left',0);
|
60 |
+
|
61 |
+
|
62 |
+
update_option('pf_text_color','#55750C');
|
63 |
+
update_option('pf_text_size','14');
|
64 |
+
if(get_option('pf_show_list')==0){
|
65 |
+
update_option('pf_show_list','all');
|
66 |
+
}elseif(get_option('pf_show_list')==1){
|
67 |
+
update_option('pf_show_list','single');
|
68 |
+
}
|
69 |
+
if(get_option('pf_disable_prepend')==1){
|
70 |
+
update_option('pf_show_list','manual');
|
71 |
+
}
|
72 |
+
delete_option('pf_disable_prepend');
|
73 |
+
}
|
74 |
+
|
75 |
+
// lets clean our mess when we are done and properly
|
76 |
+
function printfriendly_deactivation_handler(){
|
77 |
+
delete_option('pf_button_type');
|
78 |
+
delete_option('pf_custom_text');
|
79 |
+
|
80 |
+
delete_option('pf_custom_image');
|
81 |
+
|
82 |
+
delete_option('pf_show_list');
|
83 |
+
delete_option('pf_content_placement');
|
84 |
+
delete_option('pf_content_position');
|
85 |
+
|
86 |
+
delete_option('pf_margin_top');
|
87 |
+
delete_option('pf_margin_right');
|
88 |
+
delete_option('pf_margin_bottom');
|
89 |
+
delete_option('pf_margin_left');
|
90 |
+
}
|
91 |
+
register_activation_hook(__FILE__, 'printfriendly_activation_handler');
|
92 |
+
register_uninstall_hook(__FILE__, 'printfriendly_deactivation_handler');
|
93 |
+
|
94 |
+
// add CSS into admin panel
|
95 |
+
function pf_css_in_admin_head() {
|
96 |
+
$url = plugins_url().'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'/admin.css';
|
97 |
+
echo "<link rel='stylesheet' type='text/css' href='$url' />\n";
|
98 |
+
}
|
99 |
+
|
100 |
+
////////////////////////////// Admin Settings
|
101 |
+
|
102 |
+
function pf_options(){
|
103 |
+
include_once('pf_admin.php');
|
104 |
+
}
|
105 |
+
|
106 |
+
// setup for uploads
|
107 |
+
function pf_admin_scripts() {
|
108 |
+
wp_enqueue_script('media-upload');
|
109 |
+
wp_enqueue_script('thickbox');
|
110 |
+
wp_register_script('pf-color-picker', plugins_url().'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'/colorpicker.js', array('jquery','media-upload','thickbox'));
|
111 |
+
wp_register_script('pf-admin-js', plugins_url().'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'/admin.js', array('jquery','media-upload','thickbox'));
|
112 |
+
wp_enqueue_script('pf-color-picker');
|
113 |
+
wp_enqueue_script('pf-admin-js');
|
114 |
+
}
|
115 |
+
function pf_admin_styles() {
|
116 |
+
wp_enqueue_style('thickbox');
|
117 |
+
}
|
118 |
+
|
119 |
+
////////////////////////////// Where all the magic happens
|
120 |
+
|
121 |
+
// add js into the head
|
122 |
+
function pf_js(){
|
123 |
+
return '<script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script>';
|
124 |
+
}
|
125 |
+
|
126 |
+
function pf_radio($name){
|
127 |
+
$var = '<input name="pf_button_type" type="radio" value="'.$name.'"'; if($name=="custom-image"){$var .= ' onclick="Toggle(\'imgurl\');" ';} else{$var .= ' onclick="Toggle(\'hide\');" ';} if($name=="pf-button-big.gif"){$var .= ' class="bigger"';} if( get_option('pf_button_type') == $name || ($name=="pf-button.gif" && get_option('pf_button_type')==null) ){$var .= ' checked="checked"'; } $var .= '/>';
|
128 |
+
return $var.pf_button($name);
|
129 |
+
}
|
130 |
+
|
131 |
+
function pf_button($name=false){
|
132 |
+
if($name==false){
|
133 |
+
$name = get_option('pf_button_type');
|
134 |
+
//null
|
135 |
+
if($name==null){
|
136 |
+
$name='pf-button.gif';
|
137 |
+
}
|
138 |
+
}
|
139 |
+
$text = get_option('pf_custom_text');
|
140 |
+
if( $text == null){
|
141 |
+
$text = 'Print Friendly';
|
142 |
+
}
|
143 |
+
switch($name){
|
144 |
+
case "custom-image":
|
145 |
+
$custom_image = get_option('pf_custom_image');
|
146 |
+
if($custom_image==null){
|
147 |
+
return '';
|
148 |
+
}
|
149 |
+
$return = '<img class="printfriendly" src="'.$custom_image.'" />';
|
150 |
+
if( get_option('pf_custom_text') != null){
|
151 |
+
$return .='<span class="printfriendly" style="font-size:'.get_option('pf_text_size').'px; margin-left:3px; color: '.get_option('pf_text_color').';">'.$text.'</span>';
|
152 |
+
}
|
153 |
+
return $return;
|
154 |
+
break;
|
155 |
+
|
156 |
+
case "text-only":
|
157 |
+
return '<span class="printfriendly" style="font-size: '.get_option('pf_text_size').'px; margin-left:3px; color: '.get_option('pf_text_color').';">'.$text.'</span>';
|
158 |
+
break;
|
159 |
+
|
160 |
+
case "pf-icon-both.gif":
|
161 |
+
return '<img class="printfriendly" style="border:none; padding:0;" src="http://cdn.printfriendly.com/pf-print-icon.gif" alt="Print Friendly"/><span class="printandpdf" style="font-size:'.get_option('pf_text_size').'; margin-left:3px; color:'.get_option('pf_text_color').';"> Print <img src="http://cdn.printfriendly.com/pf-pdf-icon.gif" alt="Get a PDF version of this webpage" /> PDF </span>';
|
162 |
+
break;
|
163 |
+
|
164 |
+
case "pf-icon-small.gif":
|
165 |
+
case "pf-icon.gif":
|
166 |
+
$size = get_option('pf_text_size');
|
167 |
+
if($name=="pf-icon.gif" && $size==12){
|
168 |
+
$size= 'font-size:'.($size+3).'px; ';
|
169 |
+
}else{
|
170 |
+
$size ='font-size:'.$size.'px; ';
|
171 |
+
}
|
172 |
+
return '<img class="printfriendly" src="http://cdn.printfriendly.com/'.$name.'" alt="Print Friendly"/><span style="'.$size.'margin-left:3px; color: '.get_option('pf_text_color').';">'.$text.'</span>';
|
173 |
+
break;
|
174 |
+
|
175 |
+
case "pf-button.gif":
|
176 |
+
case "pf-button-big.gif":
|
177 |
+
case "pf-button-both.gif":
|
178 |
+
return '<img class="printfriendly" src="http://cdn.printfriendly.com/'.$name.'" alt="PrintFriendly" />';
|
179 |
+
break;
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
function pf_margin_down($dir){
|
184 |
+
$margin = get_option('pf_margin_'.$dir);
|
185 |
+
if($margin == null){
|
186 |
+
return '0';
|
187 |
+
}else{
|
188 |
+
return $margin;
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
// add button
|
193 |
+
function pf_show_link($content=false){
|
194 |
+
$pf_display = get_option('pf_show_list');
|
195 |
+
if( ($pf_display=='all' || $pf_display == null) || ($pf_display=='single' && (is_single() || is_page()) ) || ($pf_display=='manual' && $content==false) ){
|
196 |
+
if($content==false){$content = '';}
|
197 |
+
// now lets get options setup before we start ouputting data
|
198 |
+
$style=' style="text-align:';
|
199 |
+
// position
|
200 |
+
$pos = get_option('pf_content_position');
|
201 |
+
if($pos==null){$pos='left';}
|
202 |
+
$style.=$pos.';';
|
203 |
+
|
204 |
+
//margin
|
205 |
+
$style.=' margin: '.pf_margin_down('top').'px '.pf_margin_down('right').'px '.pf_margin_down('bottom').'px '.pf_margin_down('left').'px;';
|
206 |
+
|
207 |
+
$style.='" ';
|
208 |
+
|
209 |
+
if(is_single() || is_page()){
|
210 |
+
$add = pf_js();
|
211 |
+
}else{
|
212 |
+
$add = '';
|
213 |
+
}
|
214 |
+
$post_url = get_permalink();
|
215 |
+
$separator = "?pfstyle=wp";
|
216 |
+
if (strpos($post_url,"?")!=false){
|
217 |
+
$separator = "&pfstyle=wp";
|
218 |
+
}
|
219 |
+
$plink_url = $post_url . $separator;
|
220 |
+
$button = '<div'.$style.'class="pfButton">'.$add.'<a href="'.$plink_url.'" style="text-decoration: none; color: '.get_option('pf_text_color').';">'.pf_button().'</a></div>';
|
221 |
+
if(get_option('pf_content_placement')==null){
|
222 |
+
return $content.$button;
|
223 |
+
}else{
|
224 |
+
return $button.$content;
|
225 |
+
}
|
226 |
+
}else{
|
227 |
+
return $content;
|
228 |
+
}
|
229 |
}
|
pf_admin.php
CHANGED
@@ -1,264 +1,272 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
//margin-
|
89 |
-
if(isset($_POST['
|
90 |
-
if(is_numeric($_POST['
|
91 |
-
update_option('
|
92 |
-
}else{
|
93 |
-
$error[] ='The value for "Margin
|
94 |
-
}
|
95 |
-
}
|
96 |
-
//margin-
|
97 |
-
if(isset($_POST['
|
98 |
-
if(is_numeric($_POST['
|
99 |
-
update_option('
|
100 |
-
}else{
|
101 |
-
$error[] ='The value for "Margin
|
102 |
-
}
|
103 |
-
}
|
104 |
-
//margin-
|
105 |
-
if(isset($_POST['
|
106 |
-
if(is_numeric($_POST['
|
107 |
-
update_option('
|
108 |
-
}else{
|
109 |
-
$error[] ='The value for "Margin
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
<
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
<label class="pf_check"><input type="radio" name="
|
229 |
-
<label class="pf_check"><input type="radio" name="
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
<label class="
|
234 |
-
<label class="pf_check"><input type="
|
235 |
-
|
236 |
-
|
237 |
-
<label class="pf_check"><input type="text" class="pf_px" name="
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
<label class="
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
</p>
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
</
|
264 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript">
|
2 |
+
function Toggle(hide) {
|
3 |
+
document.getElementById("manual").style.display = "none";
|
4 |
+
document.getElementById("imgurl").style.display = "none";
|
5 |
+
document.getElementById(hide).style.display = "block";
|
6 |
+
|
7 |
+
}
|
8 |
+
</script>
|
9 |
+
<?php
|
10 |
+
if(isset($_POST['pf_save'])){
|
11 |
+
$error = false;
|
12 |
+
// we should always have a response, but lets still validate it for security
|
13 |
+
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'){
|
14 |
+
update_option('pf_button_type',$_POST['pf_button_type']);
|
15 |
+
}else{
|
16 |
+
$error[] = 'Invalid entry for the "Pick Your Button" field. That isn\'t an option to select from! Quit messing with the DOM.';
|
17 |
+
}
|
18 |
+
|
19 |
+
// custom image
|
20 |
+
if(isset($_POST['upload_image'])){
|
21 |
+
if(trim($_POST['upload_image']) == ''){
|
22 |
+
update_option('pf_custom_image',null);
|
23 |
+
}else{
|
24 |
+
$imagedata = @getimagesize($_POST['upload_image']);
|
25 |
+
if(is_array($imagedata)){
|
26 |
+
// well by golly we have an image
|
27 |
+
update_option('pf_custom_image',$_POST['upload_image']);
|
28 |
+
}else{
|
29 |
+
// we need to trigger an error
|
30 |
+
$error[] = 'Please provide a valid image link for the "Custom Image URL" field.';
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
// Custom Text
|
36 |
+
if(isset($_POST['custom_text'])){
|
37 |
+
update_option('pf_custom_text',htmlspecialchars($_POST['custom_text']) );
|
38 |
+
}
|
39 |
+
|
40 |
+
// Display custom image with custom text
|
41 |
+
if(isset($_POST['custom_both'])){
|
42 |
+
update_option('pf_custom_both',true);
|
43 |
+
}else{
|
44 |
+
update_option('pf_custom_both',null);
|
45 |
+
}
|
46 |
+
|
47 |
+
// display button
|
48 |
+
if(isset($_POST['pf_show_list'])){
|
49 |
+
if($_POST['pf_show_list']=="all" || $_POST['pf_show_list']=="single" || $_POST['pf_show_list']=="manual"){
|
50 |
+
update_option('pf_show_list',$_POST['pf_show_list']);
|
51 |
+
}else{
|
52 |
+
// something isn't right
|
53 |
+
$error[] = 'Invalid entry for the "Display Button" field. That isn\'t an option to select from! Quit messing with the DOM.';
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
// now on to the right side
|
58 |
+
|
59 |
+
// placement
|
60 |
+
if(isset($_POST['pf_content_placement'])){
|
61 |
+
if($_POST['pf_content_placement']=="before" || $_POST['pf_content_placement']=="after"){
|
62 |
+
if($_POST['pf_content_placement']=='before'){
|
63 |
+
update_option('pf_content_placement','before');
|
64 |
+
}else{
|
65 |
+
update_option('pf_content_placement',null);
|
66 |
+
}
|
67 |
+
}else{
|
68 |
+
// something isn't right
|
69 |
+
$error[] = 'Invalid entry for the "Placement" field. That isn\'t an option to select from! Quit messing with the DOM.';
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
// position
|
74 |
+
if(isset($_POST['pf_content_position'])){
|
75 |
+
|
76 |
+
if($_POST['pf_content_position']=="left" || $_POST['pf_content_position']=="right" || $_POST['pf_content_position']=="center"){
|
77 |
+
if($_POST['pf_content_position']=='left'){
|
78 |
+
update_option('pf_content_position',null);
|
79 |
+
}else{
|
80 |
+
update_option('pf_content_position',$_POST['pf_content_position']);
|
81 |
+
}
|
82 |
+
}else{
|
83 |
+
// something isn't right
|
84 |
+
$error[] = 'Invalid entry for the "Position" field. That isn\'t an option to select from! Quit messing with the DOM.';
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
//margin-top
|
89 |
+
if(isset($_POST['pf_margin_top'])){
|
90 |
+
if(is_numeric($_POST['pf_margin_top'])){
|
91 |
+
update_option('pf_margin_top',$_POST['pf_margin_top']);
|
92 |
+
}else{
|
93 |
+
$error[] ='The value for "Margin Top" must be a number!';
|
94 |
+
}
|
95 |
+
}
|
96 |
+
//margin-right
|
97 |
+
if(isset($_POST['pf_margin_right'])){
|
98 |
+
if(is_numeric($_POST['pf_margin_right'])){
|
99 |
+
update_option('pf_margin_right',$_POST['pf_margin_right']);
|
100 |
+
}else{
|
101 |
+
$error[] ='The value for "Margin Right" must be a number!';
|
102 |
+
}
|
103 |
+
}
|
104 |
+
//margin-bottom
|
105 |
+
if(isset($_POST['pf_margin_bottom'])){
|
106 |
+
if(is_numeric($_POST['pf_margin_bottom'])){
|
107 |
+
update_option('pf_margin_bottom',$_POST['pf_margin_bottom']);
|
108 |
+
}else{
|
109 |
+
$error[] ='The value for "Margin Bottom" must be a number!';
|
110 |
+
}
|
111 |
+
}
|
112 |
+
//margin-left
|
113 |
+
if(isset($_POST['pf_margin_left'])){
|
114 |
+
if(is_numeric($_POST['pf_margin_left'])){
|
115 |
+
update_option('pf_margin_left',$_POST['pf_margin_left']);
|
116 |
+
}else{
|
117 |
+
$error[] ='The value for "Margin Left" must be a number!';
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
//font color
|
122 |
+
if(isset($_POST['pf_text_color'])){
|
123 |
+
if(preg_match('/^#[a-f0-9]{6}$/i', $_POST['pf_text_color'])){
|
124 |
+
update_option('pf_text_color',$_POST['pf_text_color']);
|
125 |
+
}else{
|
126 |
+
$error[] ='The value for "Font Color" must be a valid hex code!';
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
//font size
|
131 |
+
if(isset($_POST['pf_text_size'])){
|
132 |
+
if(is_numeric($_POST['pf_text_size'])){
|
133 |
+
update_option('pf_text_size',$_POST['pf_text_size']);
|
134 |
+
}else{
|
135 |
+
$error[] ='The value for "Font Size" must be a number!';
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
?>
|
141 |
+
<div class="wrap">
|
142 |
+
<h2>PrintFriendly: Settings</h2>
|
143 |
+
<?php
|
144 |
+
if(isset($error)){
|
145 |
+
if(is_array($error)){
|
146 |
+
echo '<div class="error"><strong>Settings were not saved, The following problems exist:</strong>';
|
147 |
+
foreach($error as $e){
|
148 |
+
echo '<p>'.$e.'</p>';
|
149 |
+
}
|
150 |
+
echo '</div>';
|
151 |
+
}else{
|
152 |
+
echo '<div class="updated"><p><strong>Settings saved.</strong></p></div>';
|
153 |
+
}
|
154 |
+
}
|
155 |
+
?>
|
156 |
+
<form action="" method="post" id="pf_admin">
|
157 |
+
<div class="pf_box">
|
158 |
+
<h3>Button Style</h3>
|
159 |
+
<div class="pf_c">
|
160 |
+
<div id="pf_buttons">
|
161 |
+
<div class="buttongroup">
|
162 |
+
<p><label class="preview_button">
|
163 |
+
<?php echo pf_radio('pf-button.gif'); ?>
|
164 |
+
</label></p>
|
165 |
+
<p><label class="preview_button">
|
166 |
+
<?php echo pf_radio('pf-button-big.gif'); ?>
|
167 |
+
</label></p>
|
168 |
+
<p><label class="preview_button">
|
169 |
+
<?php echo pf_radio('pf-icon-small.gif'); ?>
|
170 |
+
</label></p>
|
171 |
+
</div>
|
172 |
+
<div class="buttongroup">
|
173 |
+
<p><label class="preview_button">
|
174 |
+
<?php echo pf_radio('pf-icon.gif'); ?>
|
175 |
+
</label></p>
|
176 |
+
<p><label class="preview_button">
|
177 |
+
<?php echo pf_radio('pf-button-both.gif'); ?>
|
178 |
+
</label></p>
|
179 |
+
<p><label class="preview_button">
|
180 |
+
<?php echo pf_radio('pf-icon-both.gif'); ?>
|
181 |
+
</label></p>
|
182 |
+
</div>
|
183 |
+
<div class="buttongroup larger">
|
184 |
+
<p><label class="preview_button">
|
185 |
+
<?php echo pf_radio('text-only'); ?> <span class="pf_tip">(text only)</span>
|
186 |
+
</label></p>
|
187 |
+
<p>
|
188 |
+
<?php echo pf_radio('custom-image'); ?> <label class="preview_button" id="pf_custom_image_label">Custom Image</label>
|
189 |
+
<div id="imgurl">Enter image URL
|
190 |
+
<input id="upload_image" type="text" size="50" name="upload_image" value="<?php echo get_option('pf_custom_image'); ?>" /></div>
|
191 |
+
</p>
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
<div id="pf_button_options">
|
195 |
+
<p>
|
196 |
+
<label class="pf_label">Text Options</label>
|
197 |
+
<div style="clear: both; overflow: hidden;">
|
198 |
+
<div style="float:left; margin-right:5px;">
|
199 |
+
<div id="colorSelector"><div style="background-color: <?php echo get_option('pf_text_color'); ?>;"></div></div>
|
200 |
+
</div>
|
201 |
+
<div style="float:left;">
|
202 |
+
<input type="hidden" name="pf_text_color" id="pf_text_color" value="<?php echo get_option('pf_text_color'); ?>"/>
|
203 |
+
<label class="pf_check"><input type="text" class="pf_px" id="pf_text_size" name="pf_text_size" value="<?php echo get_option('pf_text_size'); ?>"/><span>px <span class="pf_tip">(font size)</span></span></label>
|
204 |
+
</div>
|
205 |
+
</div>
|
206 |
+
</p>
|
207 |
+
<p>
|
208 |
+
<label class="pf_label">Custom Text</label>
|
209 |
+
<input type="text" name="custom_text" id="pf_custom_text" value="<?php echo get_option('pf_custom_text'); ?>"> <span class="pf_tip"> (optional, leave blank for default text)</span>
|
210 |
+
</p>
|
211 |
+
<!-- <p>
|
212 |
+
<div id="pf_uploader">
|
213 |
+
<label for="upload_image" class="pf_label">Custom Image URL: </label>
|
214 |
+
|
215 |
+
<input id="upload_image_button" type="button" value="Upload Image" class="button-primary"/>
|
216 |
+
<p>Enter an URL or click "Upload Image" to Upload an Image.</p>
|
217 |
+
</div>
|
218 |
+
</p>-->
|
219 |
+
</div>
|
220 |
+
|
221 |
+
</div> <!-- end box c -->
|
222 |
+
</div> <!-- end box -->
|
223 |
+
|
224 |
+
<div class="pf_box">
|
225 |
+
<h3>Button Position</h3>
|
226 |
+
<div class="pf_c">
|
227 |
+
<p class="pf_float">
|
228 |
+
<label class="pf_check"><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"';} ?>/><span>Bottom of Page</span></label>
|
229 |
+
<label class="pf_check"><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"';} ?>/><span>Top of Page</span></label>
|
230 |
+
</p>
|
231 |
+
<p class="pf_float">
|
232 |
+
<label class="pf_check"><input type="radio" name="pf_content_position" value="left"<?php if(get_option('pf_content_position')==null){echo ' checked="checked"';} ?>/>Left</label>
|
233 |
+
<label class="pf_check"><input type="radio" name="pf_content_position" value="center"<?php if(get_option('pf_content_position')=='center'){echo ' checked="checked"';} ?>/>Center</label>
|
234 |
+
<label class="pf_check"><input type="radio" name="pf_content_position" value="right"<?php if(get_option('pf_content_position')=='right'){echo ' checked="checked"';} ?>/>Right</label>
|
235 |
+
</p>
|
236 |
+
<p class="pf_float">
|
237 |
+
<label class="pf_check"><input type="text" class="pf_px" name="pf_margin_top" value="<?php echo pf_margin_down('top'); ?>"/>px Top Margin</label>
|
238 |
+
<label class="pf_check"><input type="text" class="pf_px" name="pf_margin_right" value="<?php echo pf_margin_down('right'); ?>"/>px Right Margin</label>
|
239 |
+
<label class="pf_check"><input type="text" class="pf_px" name="pf_margin_bottom" value="<?php echo pf_margin_down('bottom'); ?>"/>px Bottom Margin</label>
|
240 |
+
<label class="pf_check"><input type="text" class="pf_px" name="pf_margin_left" value="<?php echo pf_margin_down('left'); ?>"/>px Left Margin</label>
|
241 |
+
</p>
|
242 |
+
</div> <!-- end box c -->
|
243 |
+
</div> <!-- end box -->
|
244 |
+
|
245 |
+
<div class="pf_box">
|
246 |
+
<h3>Pages</h3>
|
247 |
+
<div class="pf_c">
|
248 |
+
<p>
|
249 |
+
<label class="pf_label">Select the pages you would like to add PrintFriendly button.</label>
|
250 |
+
<label class="pf_check">
|
251 |
+
<input type="radio" class="pf_show_list" name="pf_show_list" value="all" onclick="Toggle('hide');"<?php if(get_option('pf_show_list')=='all' || get_option('pf_show_list')==null ){echo ' checked="checked"';} ?>/> <span>All Posts and Pages</span></label>
|
252 |
+
<label class="pf_check">
|
253 |
+
<input type="radio" class="pf_show_list" name="pf_show_list" value="single" onclick="Toggle('hide');"<?php if(get_option('pf_show_list')=='single' || get_option('pf_show_list')==1){echo ' checked="checked"';} ?>/> <span>Individual Posts and Pages <span class="pf_tip">(Not on frontpage / latest posts) </span></span></label>
|
254 |
+
<label class="pf_check"><input type="radio" class="pf_show_list" name="pf_show_list" value="manual" onclick="Toggle('manual');"<?php if(get_option('pf_show_list')=='manual'){echo ' checked="checked"';} ?>/> <span>Manual <span class="pf_tip">(for WordPress Pros) </span></span></label>
|
255 |
+
</p>
|
256 |
+
|
257 |
+
|
258 |
+
|
259 |
+
<div id="manual">
|
260 |
+
<p>PrintFriendly, by default, automatically inserts itself into your blog/site. When Manual mode is enabled this allows you to add the button wherever you like. Simply paste the following code into your template file. You need to know how to edit your Theme files or you might cause errors on your page.
|
261 |
+
<h4>Code</h4>
|
262 |
+
<code style="display:block;"><?php if(function_exists('pf_show_link')){echo pf_show_link();} ?></code>
|
263 |
+
</div>
|
264 |
+
</div> <!-- end box c -->
|
265 |
+
</div> <!-- end Box -->
|
266 |
+
<div style="clear:both;">
|
267 |
+
<input type="submit" class="button-primary" value="Save Options" name="pf_save"/>
|
268 |
+
<input type="reset" class="button-secondary" value="Cancel"/>
|
269 |
+
</div>
|
270 |
+
<br/><br/>
|
271 |
+
</form>
|
272 |
+
</div>
|
readme.txt
CHANGED
@@ -1,29 +1,46 @@
|
|
1 |
=== Print Friendly & PDF Button===
|
2 |
Contributors: printfriendly
|
3 |
-
Tags: print,
|
4 |
Requires at least: 1.5
|
5 |
-
Stable tag:
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
Print Friendly cleans and optimizes your pages and lets readers get PDF versions too.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
Features:
|
16 |
-
- Automatically creates a print.css for your site
|
17 |
-
- Customize the button
|
18 |
-
- Users can remove images, content, and save as PDF.
|
19 |
|
20 |
|
21 |
== Installation ==
|
22 |
|
23 |
1. Download the printfriendly.zip file and unzip it.
|
24 |
-
2. Move the
|
25 |
3. Activate the plugin in your Wordpress Admin area.
|
26 |
-
4.
|
27 |
|
28 |
== Support ==
|
29 |
|
1 |
=== Print Friendly & PDF Button===
|
2 |
Contributors: printfriendly
|
3 |
+
Tags: print, pdf, printer, printing, printable
|
4 |
Requires at least: 1.5
|
5 |
+
Stable tag: trunk
|
6 |
|
7 |
+
#1 Print and PDF button for your wp site. Printer Friendly pages without coding, css, or print.css. Fast, easy, and professional.
|
|
|
|
|
8 |
|
9 |
== Description ==
|
10 |
|
11 |
+
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 you're users will see the difference.
|
12 |
+
|
13 |
+
##How Pint Friendly & PDF Works
|
14 |
+
|
15 |
+
The Print Friendly & PDF button automatically creates printer friendly and PDF versions of your pages without the hassle of CSS or Print.CSS. No coding, hacking or programming required. Simply install the Print Friendly & PDF plugin, activate, and choose settings for full customization.
|
16 |
+
|
17 |
+
##Cool Features For You:
|
18 |
+
* Get a Printer Friendly and PDF button for your users.
|
19 |
+
* Fully Customizable! Choose your favorite print and PDF button, use a text link, or use your own graphic.
|
20 |
+
* Get precision placement with easy to change margins, alignment, and pages for your Print and PDF button.
|
21 |
+
* On-Page-Lightbox. Have you noticed that most 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.
|
22 |
+
* Professional looking print and PDF buttons and user experience.
|
23 |
+
* More repeats and new users. Your brand/URL are printed on the page or saved in the PDF so users remember your site, or new users can find you.
|
24 |
+
|
25 |
+
##Cool Print Features for Users:
|
26 |
+
* Optimizes pages for printing and PDF so you save money and the environment.
|
27 |
+
* You can Print or get a PDF
|
28 |
+
* Edit the page before printing or getting a PDF
|
29 |
+
|
30 |
+
##[Get PrintFriendly & PDF Now](http://downloads.wordpress.org/plugin/printfriendly.zip "Download PrintFriendly & PDF")
|
31 |
+
|
32 |
+
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"), [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 |
|
37 |
|
38 |
== Installation ==
|
39 |
|
40 |
1. Download the printfriendly.zip file and unzip it.
|
41 |
+
2. Move the printfriendly folder into wp-content/plugins folder
|
42 |
3. Activate the plugin in your Wordpress Admin area.
|
43 |
+
4. Select "Settings" to customize button style and placement.
|
44 |
|
45 |
== Support ==
|
46 |
|