Version Description
- On page SEO analysis
- Social sharing custom content
Download this release
Release Info
Developer | JoomUnited |
Plugin | WP Meta SEO |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.1.0
- css/jquery.qtip.css +557 -0
- css/metabox-tabs.css +457 -0
- img/metaseo_sms.png +0 -0
- img/question-mark.png +0 -0
- img/warnig-red.png +0 -0
- inc/class-metaseo-mutils.php +205 -0
- inc/class.image-helper.php +0 -2
- inc/class.metaseo-admin.php +225 -2
- inc/class.metaseo-meta.php +577 -0
- inc/class.metaseo-metabox.php +653 -0
- inc/class.metaseo-snippet-preview.php +104 -0
- inc/pages/settings.php +8 -0
- js/cliffpyles.js +96 -0
- js/jquery.qtip.min.js +4 -0
- js/wp-metaseo-admin-media.js +26 -0
- js/wp-metaseo-metabox.js +379 -0
- readme.txt +71 -22
- wp-meta-seo.php +137 -47
css/jquery.qtip.css
ADDED
@@ -0,0 +1,557 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* qTip2 - Pretty powerful tooltips - v2.2.1
|
3 |
+
* http://qtip2.com
|
4 |
+
*
|
5 |
+
* Copyright (c) 2014
|
6 |
+
* Released under the MIT licenses
|
7 |
+
* http://jquery.org/license
|
8 |
+
*
|
9 |
+
* Date: Sat Sep 6 2014 11:12 GMT+0100+0100
|
10 |
+
* Plugins: tips modal viewport svg imagemap ie6
|
11 |
+
* Styles: core basic css3
|
12 |
+
*/
|
13 |
+
.qtip {
|
14 |
+
display: none;
|
15 |
+
position: absolute;
|
16 |
+
top: -28000px;
|
17 |
+
left: -28000px;
|
18 |
+
min-width: 50px;
|
19 |
+
max-width: 280px;
|
20 |
+
padding: 0;
|
21 |
+
box-shadow: none;
|
22 |
+
font-size: 10.5px;
|
23 |
+
line-height: 12px;
|
24 |
+
|
25 |
+
direction: ltr;
|
26 |
+
}
|
27 |
+
|
28 |
+
.qtip-content {
|
29 |
+
overflow: hidden;
|
30 |
+
position: relative;
|
31 |
+
padding: 5px 9px;
|
32 |
+
text-align: left;
|
33 |
+
word-wrap: break-word;
|
34 |
+
}
|
35 |
+
|
36 |
+
.qtip-titlebar {
|
37 |
+
overflow: hidden;
|
38 |
+
position: relative;
|
39 |
+
padding: 5px 35px 5px 10px;
|
40 |
+
border-width: 0 0 1px;
|
41 |
+
font-weight: bold;
|
42 |
+
}
|
43 |
+
|
44 |
+
.qtip-titlebar + .qtip-content {
|
45 |
+
border-top-width: 0 !important;
|
46 |
+
}
|
47 |
+
|
48 |
+
/* Default close button class */
|
49 |
+
.qtip-close {
|
50 |
+
position: absolute;
|
51 |
+
z-index: 11;
|
52 |
+
top: -9px;
|
53 |
+
right: -9px;
|
54 |
+
border: 1px solid transparent;
|
55 |
+
outline: medium none;
|
56 |
+
/* Overlap .qtip-tip */
|
57 |
+
cursor: pointer;
|
58 |
+
}
|
59 |
+
|
60 |
+
.qtip-titlebar .qtip-close {
|
61 |
+
top: 50%;
|
62 |
+
right: 4px;
|
63 |
+
margin-top: -9px;
|
64 |
+
}
|
65 |
+
|
66 |
+
* html .qtip-titlebar .qtip-close {
|
67 |
+
top: 16px;
|
68 |
+
}
|
69 |
+
|
70 |
+
/* IE fix */
|
71 |
+
|
72 |
+
.qtip-titlebar .ui-icon,
|
73 |
+
.qtip-icon .ui-icon {
|
74 |
+
display: block;
|
75 |
+
text-indent: -1000em;
|
76 |
+
|
77 |
+
direction: ltr;
|
78 |
+
}
|
79 |
+
|
80 |
+
.qtip-icon,
|
81 |
+
.qtip-icon .ui-icon {
|
82 |
+
border-radius: 3px;
|
83 |
+
text-decoration: none;
|
84 |
+
}
|
85 |
+
|
86 |
+
.qtip-icon .ui-icon {
|
87 |
+
width: 18px;
|
88 |
+
height: 14px;
|
89 |
+
color: inherit;
|
90 |
+
background: transparent none no-repeat -100em -100em;
|
91 |
+
font: normal bold 10px/13px Tahoma,sans-serif;
|
92 |
+
line-height: 14px;
|
93 |
+
text-align: center;
|
94 |
+
text-indent: 0;
|
95 |
+
}
|
96 |
+
|
97 |
+
/* Applied to 'focused' tooltips e.g. most recently displayed/interacted with */
|
98 |
+
|
99 |
+
/* Applied on hover of tooltips i.e. added/removed on mouseenter/mouseleave respectively */
|
100 |
+
|
101 |
+
/* Default tooltip style */
|
102 |
+
.qtip-default {
|
103 |
+
border: 1px solid #f1d031;
|
104 |
+
color: #555;
|
105 |
+
background-color: #ffffa3;
|
106 |
+
}
|
107 |
+
|
108 |
+
.qtip-default .qtip-titlebar {
|
109 |
+
background-color: #ffef93;
|
110 |
+
}
|
111 |
+
|
112 |
+
.qtip-default .qtip-icon {
|
113 |
+
border-color: #ccc;
|
114 |
+
color: #777;
|
115 |
+
background: #f1f1f1;
|
116 |
+
}
|
117 |
+
|
118 |
+
.qtip-default .qtip-titlebar .qtip-close {
|
119 |
+
border-color: #aaa;
|
120 |
+
color: #111;
|
121 |
+
}
|
122 |
+
|
123 |
+
/*! Light tooltip style */
|
124 |
+
.qtip-light {
|
125 |
+
border-color: #e2e2e2;
|
126 |
+
color: #454545;
|
127 |
+
background-color: white;
|
128 |
+
}
|
129 |
+
|
130 |
+
.qtip-light .qtip-titlebar {
|
131 |
+
background-color: #f1f1f1;
|
132 |
+
}
|
133 |
+
|
134 |
+
/*! Dark tooltip style */
|
135 |
+
.qtip-dark {
|
136 |
+
border-color: #303030;
|
137 |
+
color: #f3f3f3;
|
138 |
+
background-color: #505050;
|
139 |
+
}
|
140 |
+
|
141 |
+
.qtip-dark .qtip-titlebar {
|
142 |
+
background-color: #404040;
|
143 |
+
}
|
144 |
+
|
145 |
+
.qtip-dark .qtip-icon {
|
146 |
+
border-color: #444;
|
147 |
+
}
|
148 |
+
|
149 |
+
.qtip-dark .qtip-titlebar .ui-state-hover {
|
150 |
+
border-color: #303030;
|
151 |
+
}
|
152 |
+
|
153 |
+
/*! Cream tooltip style */
|
154 |
+
.qtip-cream {
|
155 |
+
border-color: #f9e98e;
|
156 |
+
color: #a27d35;
|
157 |
+
background-color: #fbf7aa;
|
158 |
+
}
|
159 |
+
|
160 |
+
.qtip-cream .qtip-titlebar {
|
161 |
+
background-color: #f0de7d;
|
162 |
+
}
|
163 |
+
|
164 |
+
.qtip-cream .qtip-close .qtip-icon {
|
165 |
+
background-position: -82px 0;
|
166 |
+
}
|
167 |
+
|
168 |
+
/*! Red tooltip style */
|
169 |
+
.qtip-red {
|
170 |
+
border-color: #d95252;
|
171 |
+
color: #912323;
|
172 |
+
background-color: #f78b83;
|
173 |
+
}
|
174 |
+
|
175 |
+
.qtip-red .qtip-titlebar {
|
176 |
+
background-color: #f06d65;
|
177 |
+
}
|
178 |
+
|
179 |
+
.qtip-red .qtip-close .qtip-icon {
|
180 |
+
background-position: -102px 0;
|
181 |
+
}
|
182 |
+
|
183 |
+
.qtip-red .qtip-icon {
|
184 |
+
border-color: #d95252;
|
185 |
+
}
|
186 |
+
|
187 |
+
.qtip-red .qtip-titlebar .ui-state-hover {
|
188 |
+
border-color: #d95252;
|
189 |
+
}
|
190 |
+
|
191 |
+
/*! Green tooltip style */
|
192 |
+
.qtip-green {
|
193 |
+
border-color: #90d93f;
|
194 |
+
color: #3f6219;
|
195 |
+
background-color: #caed9e;
|
196 |
+
}
|
197 |
+
|
198 |
+
.qtip-green .qtip-titlebar {
|
199 |
+
background-color: #b0de78;
|
200 |
+
}
|
201 |
+
|
202 |
+
.qtip-green .qtip-close .qtip-icon {
|
203 |
+
background-position: -42px 0;
|
204 |
+
}
|
205 |
+
|
206 |
+
/*! Blue tooltip style */
|
207 |
+
.qtip-blue {
|
208 |
+
border: none;
|
209 |
+
color: #fafafa;
|
210 |
+
border-color: #23282D;
|
211 |
+
background-color: #23282D;
|
212 |
+
}
|
213 |
+
|
214 |
+
.qtip-blue .qtip-titlebar {
|
215 |
+
background-color: #d0e9f5;
|
216 |
+
}
|
217 |
+
|
218 |
+
.qtip-blue .qtip-close .qtip-icon {
|
219 |
+
background-position: -2px 0;
|
220 |
+
}
|
221 |
+
|
222 |
+
.qtip-shadow {
|
223 |
+
box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
|
224 |
+
}
|
225 |
+
|
226 |
+
/* Add rounded corners to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE9+, Safari 2+ */
|
227 |
+
.qtip-rounded,
|
228 |
+
.qtip-tipsy,
|
229 |
+
.qtip-bootstrap {
|
230 |
+
border-radius: 0;
|
231 |
+
}
|
232 |
+
|
233 |
+
.qtip-rounded .qtip-titlebar {
|
234 |
+
border-radius: 4px 4px 0 0;
|
235 |
+
}
|
236 |
+
|
237 |
+
/* Youtube tooltip style */
|
238 |
+
.qtip-youtube {
|
239 |
+
border: 0 solid transparent;
|
240 |
+
border-radius: 2px;
|
241 |
+
color: white;
|
242 |
+
background: #4a4a4a;
|
243 |
+
box-shadow: 0 0 3px #333;
|
244 |
+
}
|
245 |
+
|
246 |
+
.qtip-youtube .qtip-titlebar {
|
247 |
+
background-color: #4a4a4a;
|
248 |
+
background-color: rgba(0,0,0,0);
|
249 |
+
}
|
250 |
+
|
251 |
+
.qtip-youtube .qtip-content {
|
252 |
+
padding: 0.75em;
|
253 |
+
font: 12px arial,sans-serif;
|
254 |
+
|
255 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000);";
|
256 |
+
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000);
|
257 |
+
}
|
258 |
+
|
259 |
+
.qtip-youtube .qtip-icon {
|
260 |
+
border-color: #222;
|
261 |
+
}
|
262 |
+
|
263 |
+
.qtip-youtube .qtip-titlebar .ui-state-hover {
|
264 |
+
border-color: #303030;
|
265 |
+
}
|
266 |
+
|
267 |
+
/* jQuery TOOLS Tooltip style */
|
268 |
+
.qtip-jtools {
|
269 |
+
border: 2px solid #ddd;
|
270 |
+
border: 2px solid rgba(241,241,241,1);
|
271 |
+
border-radius: 2px;
|
272 |
+
background: #232323;
|
273 |
+
background: rgba(0, 0, 0, 0.7);
|
274 |
+
box-shadow: 0 0 12px #333;
|
275 |
+
}
|
276 |
+
|
277 |
+
/* IE Specific */
|
278 |
+
.qtip-jtools .qtip-titlebar {
|
279 |
+
background-color: transparent;
|
280 |
+
|
281 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)";
|
282 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A);
|
283 |
+
}
|
284 |
+
|
285 |
+
.qtip-jtools .qtip-content {
|
286 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)";
|
287 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323);
|
288 |
+
}
|
289 |
+
|
290 |
+
.qtip-jtools .qtip-titlebar,
|
291 |
+
.qtip-jtools .qtip-content {
|
292 |
+
border: 0 dashed transparent;
|
293 |
+
color: white;
|
294 |
+
background: transparent;
|
295 |
+
}
|
296 |
+
|
297 |
+
.qtip-jtools .qtip-icon {
|
298 |
+
border-color: #555;
|
299 |
+
}
|
300 |
+
|
301 |
+
.qtip-jtools .qtip-titlebar .ui-state-hover {
|
302 |
+
border-color: #333;
|
303 |
+
}
|
304 |
+
|
305 |
+
/* Cluetip style */
|
306 |
+
.qtip-cluetip {
|
307 |
+
border: 0 dashed transparent;
|
308 |
+
color: #111;
|
309 |
+
background-color: #d9d9c2;
|
310 |
+
box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
|
311 |
+
}
|
312 |
+
|
313 |
+
.qtip-cluetip .qtip-titlebar {
|
314 |
+
border: 0 dashed transparent;
|
315 |
+
color: white;
|
316 |
+
background-color: #87876a;
|
317 |
+
}
|
318 |
+
|
319 |
+
.qtip-cluetip .qtip-icon {
|
320 |
+
border-color: #808064;
|
321 |
+
}
|
322 |
+
|
323 |
+
.qtip-cluetip .qtip-titlebar .ui-state-hover {
|
324 |
+
border-color: #696952;
|
325 |
+
color: #696952;
|
326 |
+
}
|
327 |
+
|
328 |
+
/* Tipsy style */
|
329 |
+
.qtip-tipsy {
|
330 |
+
border: 0 solid transparent;
|
331 |
+
color: white;
|
332 |
+
background: black;
|
333 |
+
background: rgba(0, 0, 0, 0.87);
|
334 |
+
text-shadow: 0 1px black;
|
335 |
+
font-family: "Lucida Grande", sans-serif;
|
336 |
+
font-size: 11px;
|
337 |
+
font-weight: bold;
|
338 |
+
line-height: 16px;
|
339 |
+
}
|
340 |
+
|
341 |
+
.qtip-tipsy .qtip-titlebar {
|
342 |
+
padding: 6px 35px 0 10px;
|
343 |
+
background-color: transparent;
|
344 |
+
}
|
345 |
+
|
346 |
+
.qtip-tipsy .qtip-content {
|
347 |
+
padding: 6px 10px;
|
348 |
+
}
|
349 |
+
|
350 |
+
.qtip-tipsy .qtip-icon {
|
351 |
+
border-color: #222;
|
352 |
+
text-shadow: none;
|
353 |
+
}
|
354 |
+
|
355 |
+
.qtip-tipsy .qtip-titlebar .ui-state-hover {
|
356 |
+
border-color: #303030;
|
357 |
+
}
|
358 |
+
|
359 |
+
/* Tipped style */
|
360 |
+
.qtip-tipped {
|
361 |
+
border: 3px solid #959fa9;
|
362 |
+
border-radius: 3px;
|
363 |
+
color: #454545;
|
364 |
+
background-color: #f9f9f9;
|
365 |
+
font-family: serif;
|
366 |
+
font-weight: normal;
|
367 |
+
}
|
368 |
+
|
369 |
+
.qtip-tipped .qtip-titlebar {
|
370 |
+
border-bottom-width: 0;
|
371 |
+
color: white;
|
372 |
+
background: #3a79b8;
|
373 |
+
|
374 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)";
|
375 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D);
|
376 |
+
}
|
377 |
+
|
378 |
+
.qtip-tipped .qtip-icon {
|
379 |
+
border: 2px solid #285589;
|
380 |
+
background: #285589;
|
381 |
+
}
|
382 |
+
|
383 |
+
.qtip-tipped .qtip-icon .ui-icon {
|
384 |
+
color: #555;
|
385 |
+
background-color: #fbfbfb;
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* Twitter Bootstrap style.
|
390 |
+
*
|
391 |
+
* Tested with IE 8, IE 9, Chrome 18, Firefox 9, Opera 11.
|
392 |
+
* Does not work with IE 7.
|
393 |
+
*/
|
394 |
+
.qtip-bootstrap {
|
395 |
+
/** Taken from Bootstrap .popover */
|
396 |
+
padding: 1px;
|
397 |
+
border: 1px solid #ccc;
|
398 |
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
399 |
+
border-radius: 6px;
|
400 |
+
color: #333;
|
401 |
+
background-color: #fff;
|
402 |
+
background-clip: padding-box;
|
403 |
+
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
404 |
+
/** Taken from Bootstrap body */
|
405 |
+
font-size: 14px;
|
406 |
+
line-height: 20px;
|
407 |
+
}
|
408 |
+
|
409 |
+
.qtip-bootstrap .qtip-titlebar {
|
410 |
+
margin: 0;
|
411 |
+
/** Taken from Bootstrap .popover-title */
|
412 |
+
padding: 8px 14px;
|
413 |
+
border-bottom: 1px solid #ebebeb;
|
414 |
+
border-radius: 5px 5px 0 0;
|
415 |
+
background-color: #f7f7f7;
|
416 |
+
font-size: 14px;
|
417 |
+
font-weight: normal;
|
418 |
+
line-height: 18px;
|
419 |
+
}
|
420 |
+
|
421 |
+
.qtip-bootstrap .qtip-titlebar .qtip-close {
|
422 |
+
top: 45%;
|
423 |
+
/**
|
424 |
+
* Overrides qTip2:
|
425 |
+
* .qtip-titlebar .qtip-close{
|
426 |
+
* [...]
|
427 |
+
* right: 4px;
|
428 |
+
* top: 50%;
|
429 |
+
* [...]
|
430 |
+
* border-style: solid;
|
431 |
+
* }
|
432 |
+
*/
|
433 |
+
right: 11px;
|
434 |
+
border-style: none;
|
435 |
+
}
|
436 |
+
|
437 |
+
.qtip-bootstrap .qtip-content {
|
438 |
+
/** Taken from Bootstrap .popover-content */
|
439 |
+
padding: 9px 14px;
|
440 |
+
}
|
441 |
+
|
442 |
+
.qtip-bootstrap .qtip-icon {
|
443 |
+
/**
|
444 |
+
* Overrides qTip2:
|
445 |
+
* .qtip-default .qtip-icon {
|
446 |
+
* border-color: #CCC;
|
447 |
+
* background: #F1F1F1;
|
448 |
+
* color: #777;
|
449 |
+
* }
|
450 |
+
*/
|
451 |
+
background: transparent;
|
452 |
+
}
|
453 |
+
|
454 |
+
.qtip-bootstrap .qtip-icon .ui-icon {
|
455 |
+
/* Taken from Bootstrap .close */
|
456 |
+
float: right;
|
457 |
+
/**
|
458 |
+
* Overrides qTip2:
|
459 |
+
* .qtip-icon .ui-icon{
|
460 |
+
* width: 18px;
|
461 |
+
* height: 14px;
|
462 |
+
* }
|
463 |
+
*/
|
464 |
+
width: auto;
|
465 |
+
height: auto;
|
466 |
+
opacity: 0.2;
|
467 |
+
color: #000;
|
468 |
+
text-shadow: 0 1px 0 #fff;
|
469 |
+
font-size: 20px;
|
470 |
+
font-weight: bold;
|
471 |
+
line-height: 18px;
|
472 |
+
|
473 |
+
filter: alpha(opacity=20);
|
474 |
+
}
|
475 |
+
|
476 |
+
.qtip-bootstrap .qtip-icon .ui-icon:hover {
|
477 |
+
opacity: 0.4;
|
478 |
+
/* Taken from Bootstrap .close:hover */
|
479 |
+
color: #000;
|
480 |
+
text-decoration: none;
|
481 |
+
cursor: pointer;
|
482 |
+
|
483 |
+
filter: alpha(opacity=40);
|
484 |
+
}
|
485 |
+
|
486 |
+
/* IE9 fix - removes all filters */
|
487 |
+
.qtip:not(.ie9haxors) div.qtip-content,
|
488 |
+
.qtip:not(.ie9haxors) div.qtip-titlebar {
|
489 |
+
-webkit-filter: none;
|
490 |
+
-ms-filter: none;
|
491 |
+
filter: none;
|
492 |
+
}
|
493 |
+
|
494 |
+
.qtip .qtip-tip {
|
495 |
+
overflow: hidden;
|
496 |
+
z-index: 10;
|
497 |
+
margin: 0 auto;
|
498 |
+
}
|
499 |
+
|
500 |
+
/* Opera bug #357 - Incorrect tip position
|
501 |
+
https://github.com/Craga89/qTip2/issues/367 */
|
502 |
+
x:-o-prefocus,
|
503 |
+
.qtip .qtip-tip {
|
504 |
+
visibility: hidden;
|
505 |
+
}
|
506 |
+
|
507 |
+
.qtip .qtip-tip,
|
508 |
+
.qtip .qtip-tip .qtip-vml,
|
509 |
+
.qtip .qtip-tip canvas {
|
510 |
+
position: absolute;
|
511 |
+
border: 0 dashed transparent;
|
512 |
+
color: #123456;
|
513 |
+
background: transparent;
|
514 |
+
}
|
515 |
+
|
516 |
+
.qtip .qtip-tip canvas {
|
517 |
+
top: 0;
|
518 |
+
left: 0;
|
519 |
+
}
|
520 |
+
|
521 |
+
.qtip .qtip-tip .qtip-vml {
|
522 |
+
display: inline-block;
|
523 |
+
visibility: visible;
|
524 |
+
|
525 |
+
behavior: url(#default#VML);
|
526 |
+
}
|
527 |
+
|
528 |
+
#qtip-overlay {
|
529 |
+
position: fixed;
|
530 |
+
top: 0;
|
531 |
+
left: 0;
|
532 |
+
width: 100%;
|
533 |
+
height: 100%;
|
534 |
+
}
|
535 |
+
|
536 |
+
/* Applied to modals with show.modal.blur set to true */
|
537 |
+
#qtip-overlay.blurs {
|
538 |
+
cursor: pointer;
|
539 |
+
}
|
540 |
+
|
541 |
+
/* Change opacity of overlay here */
|
542 |
+
#qtip-overlay div {
|
543 |
+
position: absolute;
|
544 |
+
top: 0;
|
545 |
+
left: 0;
|
546 |
+
width: 100%;
|
547 |
+
height: 100%;
|
548 |
+
opacity: 0.7;
|
549 |
+
background-color: black;
|
550 |
+
|
551 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
|
552 |
+
filter: alpha(opacity=70);
|
553 |
+
}
|
554 |
+
|
555 |
+
.qtipmodal-ie6fix {
|
556 |
+
position: absolute !important;
|
557 |
+
}
|
css/metabox-tabs.css
ADDED
@@ -0,0 +1,457 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ul.wpmseo-metabox-tabs {
|
2 |
+
/* display: none;*/
|
3 |
+
margin-top: 12px;
|
4 |
+
margin-bottom: 3px;
|
5 |
+
}
|
6 |
+
|
7 |
+
.wpmseo-metabox-tabs-div ul {
|
8 |
+
list-style: none;
|
9 |
+
}
|
10 |
+
|
11 |
+
.wpmseo-metabox-tabs li {
|
12 |
+
display: inline;
|
13 |
+
}
|
14 |
+
|
15 |
+
ul.wpmseo-metabox-tabs li.active {
|
16 |
+
border-width: 1px 1px 0;
|
17 |
+
border-style: solid solid none;
|
18 |
+
background-color: #fdfdfd;
|
19 |
+
}
|
20 |
+
|
21 |
+
ul.wpmseo-metabox-tabs li {
|
22 |
+
padding: 5px;
|
23 |
+
}
|
24 |
+
|
25 |
+
.wpmseo-metabox-tabs a {
|
26 |
+
text-decoration: none;
|
27 |
+
cursor: pointer;
|
28 |
+
}
|
29 |
+
|
30 |
+
.wpmseo-metabox-tabs-div div.wpmseo-tabs-panel {
|
31 |
+
overflow: auto;
|
32 |
+
padding: 0.5em 0.9em;
|
33 |
+
border: 1px solid;
|
34 |
+
}
|
35 |
+
|
36 |
+
.wpmseo-heading {
|
37 |
+
padding-left: 10px;
|
38 |
+
}
|
39 |
+
|
40 |
+
.wpmseotab {
|
41 |
+
display: none;
|
42 |
+
}
|
43 |
+
|
44 |
+
.wpmseotab.active {
|
45 |
+
display: block;
|
46 |
+
overflow: hidden;
|
47 |
+
padding: 0.5em 0.9em;
|
48 |
+
border: 1px solid #ddd;
|
49 |
+
background-color: #fdfdfd;
|
50 |
+
}
|
51 |
+
|
52 |
+
#wpmseo_meta .postbox .inside .wpmseotab {
|
53 |
+
font-size: 13px !important;
|
54 |
+
}
|
55 |
+
|
56 |
+
.inside .wpmseotab .form-table th {
|
57 |
+
width: 140px !important;
|
58 |
+
font-size: 13px;
|
59 |
+
}
|
60 |
+
|
61 |
+
.good,
|
62 |
+
.warn,
|
63 |
+
.wrong {
|
64 |
+
font-weight: bold;
|
65 |
+
}
|
66 |
+
|
67 |
+
.wpmseotab .good{
|
68 |
+
color: #fff !important;
|
69 |
+
}
|
70 |
+
|
71 |
+
.wpmseotab .warn {
|
72 |
+
color: #fff !important;
|
73 |
+
}
|
74 |
+
|
75 |
+
.wpmseotab .wrong {
|
76 |
+
color: #fff !important;
|
77 |
+
}
|
78 |
+
|
79 |
+
#current_seo_title span {
|
80 |
+
padding: 2px 5px;
|
81 |
+
background-color: lightyellow;
|
82 |
+
}
|
83 |
+
|
84 |
+
#wpmseosnippet {
|
85 |
+
width: auto;
|
86 |
+
max-width: 520px;
|
87 |
+
margin: 0 0 10px;
|
88 |
+
padding: 0 5px;
|
89 |
+
font-family: Arial, Helvetica, sans-serif;
|
90 |
+
font-style: normal;
|
91 |
+
}
|
92 |
+
|
93 |
+
#wpmseosnippet td {
|
94 |
+
margin: 0;
|
95 |
+
padding: 0;
|
96 |
+
}
|
97 |
+
|
98 |
+
#wpmseosnippet cite.url {
|
99 |
+
font-weight: normal;
|
100 |
+
font-style: normal;
|
101 |
+
}
|
102 |
+
|
103 |
+
#wpmseosnippet a {
|
104 |
+
text-decoration: none;
|
105 |
+
}
|
106 |
+
|
107 |
+
#wpmseosnippet .title {
|
108 |
+
display: block;
|
109 |
+
overflow: hidden;
|
110 |
+
width: 512px;
|
111 |
+
color: #1e0fbe;
|
112 |
+
font-size: 18px !important;
|
113 |
+
line-height: 1.2;
|
114 |
+
white-space: nowrap;
|
115 |
+
text-overflow: ellipsis;
|
116 |
+
}
|
117 |
+
|
118 |
+
#wpmseosnippet .desc {
|
119 |
+
font-size: small;
|
120 |
+
line-height: 1.4;
|
121 |
+
word-wrap: break-word;
|
122 |
+
}
|
123 |
+
|
124 |
+
#wpmseosnippet .desc .autogen {
|
125 |
+
color: #777;
|
126 |
+
}
|
127 |
+
|
128 |
+
#wpmseosnippet .date {
|
129 |
+
color: #808080;
|
130 |
+
}
|
131 |
+
|
132 |
+
#wpmseosnippet .desc p {
|
133 |
+
color: #545454;
|
134 |
+
font-size: small;
|
135 |
+
line-height: 1.4;
|
136 |
+
word-wrap: break-word;
|
137 |
+
}
|
138 |
+
|
139 |
+
#wpmseosnippet .url {
|
140 |
+
color: #006621;
|
141 |
+
font-size: 13px;
|
142 |
+
line-height: 16px;
|
143 |
+
}
|
144 |
+
|
145 |
+
#wpmseosnippet .meta {
|
146 |
+
color: #767676;
|
147 |
+
}
|
148 |
+
|
149 |
+
#wpmseosnippet .util {
|
150 |
+
color: #4272db;
|
151 |
+
}
|
152 |
+
|
153 |
+
#wpmseosnippet p {
|
154 |
+
margin: 0 !important;
|
155 |
+
}
|
156 |
+
|
157 |
+
#wpmseosnippet a:hover {
|
158 |
+
text-decoration: underline;
|
159 |
+
}
|
160 |
+
|
161 |
+
#mfocuskwresults ul {
|
162 |
+
margin: 0;
|
163 |
+
}
|
164 |
+
|
165 |
+
#mfocuskwresults p,
|
166 |
+
#mfocuskwresults li {
|
167 |
+
font-size: 13px;
|
168 |
+
}
|
169 |
+
|
170 |
+
#mfocuskwresults li {
|
171 |
+
margin: 0 0 0 20px;
|
172 |
+
list-style-type: disc;
|
173 |
+
}
|
174 |
+
|
175 |
+
.wpmseo_hidden {
|
176 |
+
display: none;
|
177 |
+
}
|
178 |
+
|
179 |
+
/* Linkdex analysis block */
|
180 |
+
|
181 |
+
table.wpmseoanalysis th {
|
182 |
+
padding: 15px 0 5px 0;
|
183 |
+
font-size: 14px;
|
184 |
+
text-align: left;
|
185 |
+
}
|
186 |
+
|
187 |
+
table.wpmseoanalysis th.first {
|
188 |
+
padding-top: 0;
|
189 |
+
}
|
190 |
+
|
191 |
+
table.wpmseoanalysis td {
|
192 |
+
margin: 5px 0;
|
193 |
+
font-size: 13px;
|
194 |
+
line-height: 16px;
|
195 |
+
}
|
196 |
+
|
197 |
+
table.wpmseoanalysis td.score {
|
198 |
+
width: 20px;
|
199 |
+
height: 18px;
|
200 |
+
padding-left: 10px;
|
201 |
+
}
|
202 |
+
|
203 |
+
.wpmseo_msg {
|
204 |
+
margin: 5px 0 10px 0;
|
205 |
+
padding: 0 5px;
|
206 |
+
border: 1px solid #e6db55;
|
207 |
+
background-color: lightYellow;
|
208 |
+
}
|
209 |
+
|
210 |
+
/*
|
211 |
+
* jQuery UI CSS Framework 1.8.12
|
212 |
+
*
|
213 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
214 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
215 |
+
* http://jquery.org/license
|
216 |
+
*
|
217 |
+
* http://docs.jquery.com/UI/Theming/API
|
218 |
+
*/
|
219 |
+
|
220 |
+
|
221 |
+
/* Component containers
|
222 |
+
----------------------------------*/
|
223 |
+
|
224 |
+
#wpmseotab .ui-widget-content {
|
225 |
+
border: 1px solid #ddd;
|
226 |
+
color: #333;
|
227 |
+
background: #f1f1f1;
|
228 |
+
}
|
229 |
+
|
230 |
+
#wpmseotab .ui-widget-content a {
|
231 |
+
color: #333;
|
232 |
+
}
|
233 |
+
|
234 |
+
/*
|
235 |
+
* jQuery UI Autocomplete 1.8.12
|
236 |
+
* http://docs.jquery.com/UI/Autocomplete#theming
|
237 |
+
*/
|
238 |
+
#wpmseotab .ui-autocomplete {
|
239 |
+
position: absolute;
|
240 |
+
cursor: default;
|
241 |
+
}
|
242 |
+
|
243 |
+
/* workarounds */
|
244 |
+
* html #wpmseotab .ui-autocomplete {
|
245 |
+
width: 1px;
|
246 |
+
}
|
247 |
+
|
248 |
+
/* without this, the menu expands to 100% in IE6 */
|
249 |
+
|
250 |
+
/*
|
251 |
+
* jQuery UI Menu 1.8.12
|
252 |
+
*
|
253 |
+
* http://docs.jquery.com/UI/Menu#theming
|
254 |
+
*/
|
255 |
+
.ui-menu {
|
256 |
+
display: block;
|
257 |
+
float: left;
|
258 |
+
margin: 0;
|
259 |
+
padding: 2px;
|
260 |
+
list-style: none;
|
261 |
+
}
|
262 |
+
|
263 |
+
.ui-menu .ui-menu {
|
264 |
+
margin-top: -3px;
|
265 |
+
}
|
266 |
+
|
267 |
+
.ui-menu .ui-menu-item {
|
268 |
+
float: left;
|
269 |
+
clear: left;
|
270 |
+
zoom: 1;
|
271 |
+
width: 100%;
|
272 |
+
margin: 0;
|
273 |
+
padding: 0;
|
274 |
+
}
|
275 |
+
|
276 |
+
.ui-menu .ui-menu-item a {
|
277 |
+
display: block;
|
278 |
+
zoom: 1;
|
279 |
+
padding: 0.2em 0.4em;
|
280 |
+
line-height: 1.5;
|
281 |
+
text-decoration: none;
|
282 |
+
}
|
283 |
+
|
284 |
+
.ui-menu .ui-menu-item a.ui-state-hover,
|
285 |
+
.ui-menu .ui-menu-item a.ui-state-active {
|
286 |
+
margin: -1px;
|
287 |
+
color: #000;
|
288 |
+
}
|
289 |
+
|
290 |
+
.wpmseo-score-icon {
|
291 |
+
display: inline-block;
|
292 |
+
width: 12px;
|
293 |
+
height: 12px;
|
294 |
+
margin: 3px 10px 0 3px;
|
295 |
+
border-radius: 50%;
|
296 |
+
background: #888;
|
297 |
+
vertical-align: top;
|
298 |
+
}
|
299 |
+
|
300 |
+
.wpmseo-score-icon.good {
|
301 |
+
background-color: #7ad03a;
|
302 |
+
}
|
303 |
+
|
304 |
+
.wpmseo-score-icon.ok {
|
305 |
+
background-color: #ffba00;
|
306 |
+
}
|
307 |
+
|
308 |
+
.wpmseo-score-icon.poor {
|
309 |
+
background-color: #ee7c1b;
|
310 |
+
}
|
311 |
+
|
312 |
+
.wpmseo-score-icon.bad {
|
313 |
+
background-color: #dd3d36;
|
314 |
+
}
|
315 |
+
|
316 |
+
.wpmseo-score-icon.na {
|
317 |
+
background-color: #888;
|
318 |
+
}
|
319 |
+
|
320 |
+
.wpmseo-score-icon.noindex {
|
321 |
+
background-color: #1e8cbe;
|
322 |
+
}
|
323 |
+
|
324 |
+
.wpmseo-score-title {
|
325 |
+
font-weight: 600;
|
326 |
+
}
|
327 |
+
|
328 |
+
img.metaseo_help {
|
329 |
+
cursor: pointer;
|
330 |
+
width: 20px;
|
331 |
+
}
|
332 |
+
|
333 |
+
.metaseo-qtip {
|
334 |
+
font-size: 14px !important;
|
335 |
+
line-height: 18px !important;
|
336 |
+
}
|
337 |
+
|
338 |
+
.wpmseo_content_wrapper p.search-box {
|
339 |
+
margin: 10px 0 5px 0;
|
340 |
+
}
|
341 |
+
|
342 |
+
|
343 |
+
ul.wpmseo-metabox-tabs li.active {
|
344 |
+
background-color: #f1f1f1;
|
345 |
+
}
|
346 |
+
|
347 |
+
ul.wpmseo-metabox-tabs li.active,
|
348 |
+
div.wpmseo-tab-content {
|
349 |
+
border-color: #dfdfdf;
|
350 |
+
background-color: #fff;
|
351 |
+
}
|
352 |
+
|
353 |
+
.wpmseo-metabox-tabs .active a {
|
354 |
+
color: #333;
|
355 |
+
}
|
356 |
+
|
357 |
+
#wpmseotab .ui-widget-content .ui-state-hover {
|
358 |
+
border: 1px solid #dfdfdf;
|
359 |
+
color: #333;
|
360 |
+
background: #f1f1f1;
|
361 |
+
}
|
362 |
+
|
363 |
+
|
364 |
+
.metaseo-dashicons{
|
365 |
+
float: left;
|
366 |
+
width: 30px;
|
367 |
+
}
|
368 |
+
|
369 |
+
.metaseo-dashicons:before{
|
370 |
+
width: 30px;
|
371 |
+
}
|
372 |
+
|
373 |
+
.metaseo-dashicons.dashicons-yes {
|
374 |
+
color: #1d9757;
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
+
.metaseo-dashicons.dashicons-yes:before{
|
379 |
+
font-size: 25px;
|
380 |
+
}
|
381 |
+
|
382 |
+
.metaseo-dashicons.icons-mwarning {
|
383 |
+
/* color: #f00;*/
|
384 |
+
width: 20px;
|
385 |
+
height: 20px;
|
386 |
+
margin: 0px 5px;
|
387 |
+
background-image: url(../img/warnig-red.png);
|
388 |
+
background-size: 100% 100%;
|
389 |
+
}
|
390 |
+
|
391 |
+
.metaseo_analysis{
|
392 |
+
width: 100%;
|
393 |
+
padding: 8px 10px 8px 0px;
|
394 |
+
line-height: 20px;
|
395 |
+
float: left;
|
396 |
+
}
|
397 |
+
|
398 |
+
.metaseo_left{
|
399 |
+
margin: 0px auto;
|
400 |
+
float: left;
|
401 |
+
}
|
402 |
+
.metaseo-progress-bar{
|
403 |
+
display: block;
|
404 |
+
width: 275px;
|
405 |
+
height: 275px;
|
406 |
+
/* margin: 7px;*/
|
407 |
+
padding: 0;
|
408 |
+
float: left;
|
409 |
+
}
|
410 |
+
.metaseo-progress-bar .metaseo-progress-active{
|
411 |
+
position: relative;
|
412 |
+
top: -279px;
|
413 |
+
}
|
414 |
+
.metaseo-progress-bar p{
|
415 |
+
position: relative;
|
416 |
+
margin: 0;
|
417 |
+
padding: 0;
|
418 |
+
width: 275px;
|
419 |
+
top: -460px;
|
420 |
+
font-size: 50px;
|
421 |
+
font-weight: 900;
|
422 |
+
text-align: center;
|
423 |
+
}
|
424 |
+
|
425 |
+
.metaseo_right{
|
426 |
+
float: left;
|
427 |
+
padding: 10px;
|
428 |
+
width: 60%;
|
429 |
+
}
|
430 |
+
.wpmseotab.general.active .form-table th{
|
431 |
+
width: 275px !important;
|
432 |
+
}
|
433 |
+
|
434 |
+
.wpmseotab.general.active .form-table td{
|
435 |
+
position: relative;
|
436 |
+
}
|
437 |
+
|
438 |
+
#metaseo_wpmseo_desc-length,#metaseo_wpmseo_title-length{
|
439 |
+
position: absolute;
|
440 |
+
left: 20px;
|
441 |
+
bottom: 12px;
|
442 |
+
background: none repeat scroll 0% 0% #7ad03a;
|
443 |
+
color: #fff;
|
444 |
+
border-radius: 2px;
|
445 |
+
min-width: 15px;
|
446 |
+
text-align: center;
|
447 |
+
float: left;
|
448 |
+
padding: 0px 10px;
|
449 |
+
}
|
450 |
+
|
451 |
+
#metaseo_wpmseo_desc-length.length-wrong,#metaseo_wpmseo_title-length.length-wrong{
|
452 |
+
background: none repeat scroll 0% 0% #FFCC00;
|
453 |
+
}
|
454 |
+
|
455 |
+
.reload_analysis{
|
456 |
+
float: right;
|
457 |
+
}
|
img/metaseo_sms.png
ADDED
Binary file
|
img/question-mark.png
ADDED
Binary file
|
img/warnig-red.png
ADDED
Binary file
|
inc/class-metaseo-mutils.php
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPMSEO_Utils {
|
4 |
+
|
5 |
+
public static $has_filters;
|
6 |
+
private static $cache_clear = array();
|
7 |
+
|
8 |
+
public static function is_url_relative($url) {
|
9 |
+
return ( strpos($url, 'http') !== 0 && strpos($url, '//') !== 0 );
|
10 |
+
}
|
11 |
+
|
12 |
+
public static function standardize_whitespace($string) {
|
13 |
+
return trim(str_replace(' ', ' ', str_replace(array("\t", "\n", "\r", "\f"), ' ', $string)));
|
14 |
+
}
|
15 |
+
|
16 |
+
public static function strip_shortcode($text) {
|
17 |
+
return preg_replace('`\[[^\]]+\]`s', '', $text);
|
18 |
+
}
|
19 |
+
|
20 |
+
public static function translate_score($val, $css_value = true) {
|
21 |
+
if ($val > 10) {
|
22 |
+
$val = round($val / 10);
|
23 |
+
}
|
24 |
+
switch ($val) {
|
25 |
+
case 0:
|
26 |
+
$score = __('N/A', 'wordpress-seo');
|
27 |
+
$css = 'na';
|
28 |
+
break;
|
29 |
+
case 4:
|
30 |
+
case 5:
|
31 |
+
$score = __('Poor', 'wordpress-seo');
|
32 |
+
$css = 'poor';
|
33 |
+
break;
|
34 |
+
case 6:
|
35 |
+
case 7:
|
36 |
+
$score = __('OK', 'wordpress-seo');
|
37 |
+
$css = 'ok';
|
38 |
+
break;
|
39 |
+
case 8:
|
40 |
+
case 9:
|
41 |
+
case 10:
|
42 |
+
$score = __('Good', 'wordpress-seo');
|
43 |
+
$css = 'good';
|
44 |
+
break;
|
45 |
+
default:
|
46 |
+
$score = __('Bad', 'wordpress-seo');
|
47 |
+
$css = 'bad';
|
48 |
+
break;
|
49 |
+
}
|
50 |
+
|
51 |
+
if ($css_value) {
|
52 |
+
return $css;
|
53 |
+
} else {
|
54 |
+
return $score;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
public static function sanitize_text_field($value) {
|
59 |
+
$filtered = wp_check_invalid_utf8($value);
|
60 |
+
|
61 |
+
if (strpos($filtered, '<') !== false) {
|
62 |
+
$filtered = wp_pre_kses_less_than($filtered);
|
63 |
+
// This will strip extra whitespace for us.
|
64 |
+
$filtered = wp_strip_all_tags($filtered, true);
|
65 |
+
} else {
|
66 |
+
$filtered = trim(preg_replace('`[\r\n\t ]+`', ' ', $filtered));
|
67 |
+
}
|
68 |
+
|
69 |
+
$found = false;
|
70 |
+
while (preg_match('`[^%](%[a-f0-9]{2})`i', $filtered, $match)) {
|
71 |
+
$filtered = str_replace($match[1], '', $filtered);
|
72 |
+
$found = true;
|
73 |
+
}
|
74 |
+
unset($match);
|
75 |
+
|
76 |
+
if ($found) {
|
77 |
+
// Strip out the whitespace that may now exist after removing the octets.
|
78 |
+
$filtered = trim(preg_replace('` +`', ' ', $filtered));
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
return apply_filters('sanitize_text_field', $filtered, $value);
|
83 |
+
}
|
84 |
+
|
85 |
+
public static function sanitize_url($value, $allowed_protocols = array('http', 'https')) {
|
86 |
+
return esc_url_raw(sanitize_text_field(rawurldecode($value)), $allowed_protocols);
|
87 |
+
}
|
88 |
+
|
89 |
+
public static function validate_int($value) {
|
90 |
+
if (!isset(self::$has_filters)) {
|
91 |
+
self::$has_filters = extension_loaded('filter');
|
92 |
+
}
|
93 |
+
|
94 |
+
if (self::$has_filters) {
|
95 |
+
return filter_var($value, FILTER_VALIDATE_INT);
|
96 |
+
} else {
|
97 |
+
return self::emulate_filter_int($value);
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
public static function calc($number1, $action, $number2, $round = false, $decimals = 0, $precision = 10) {
|
102 |
+
static $bc;
|
103 |
+
|
104 |
+
if (!is_scalar($number1) || !is_scalar($number2)) {
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
|
108 |
+
if (!isset($bc)) {
|
109 |
+
$bc = extension_loaded('bcmath');
|
110 |
+
}
|
111 |
+
|
112 |
+
if ($bc) {
|
113 |
+
$number1 = number_format($number1, 10, '.', '');
|
114 |
+
$number2 = number_format($number2, 10, '.', '');
|
115 |
+
}
|
116 |
+
|
117 |
+
$result = null;
|
118 |
+
$compare = false;
|
119 |
+
|
120 |
+
switch ($action) {
|
121 |
+
case '+':
|
122 |
+
case 'add':
|
123 |
+
case 'addition':
|
124 |
+
$result = ( $bc ) ? bcadd($number1, $number2, $precision) /* string */ : ( $number1 + $number2 );
|
125 |
+
break;
|
126 |
+
|
127 |
+
case '-':
|
128 |
+
case 'sub':
|
129 |
+
case 'subtract':
|
130 |
+
$result = ( $bc ) ? bcsub($number1, $number2, $precision) /* string */ : ( $number1 - $number2 );
|
131 |
+
break;
|
132 |
+
|
133 |
+
case '*':
|
134 |
+
case 'mul':
|
135 |
+
case 'multiply':
|
136 |
+
$result = ( $bc ) ? bcmul($number1, $number2, $precision) /* string */ : ( $number1 * $number2 );
|
137 |
+
break;
|
138 |
+
|
139 |
+
case '/':
|
140 |
+
case 'div':
|
141 |
+
case 'divide':
|
142 |
+
if ($bc) {
|
143 |
+
$result = bcdiv($number1, $number2, $precision); // String, or NULL if right_operand is 0.
|
144 |
+
} elseif ($number2 != 0) {
|
145 |
+
$result = ( $number1 / $number2 );
|
146 |
+
}
|
147 |
+
|
148 |
+
if (!isset($result)) {
|
149 |
+
$result = 0;
|
150 |
+
}
|
151 |
+
break;
|
152 |
+
|
153 |
+
case '%':
|
154 |
+
case 'mod':
|
155 |
+
case 'modulus':
|
156 |
+
if ($bc) {
|
157 |
+
$result = bcmod($number1, $number2, $precision); // String, or NULL if modulus is 0.
|
158 |
+
} elseif ($number2 != 0) {
|
159 |
+
$result = ( $number1 % $number2 );
|
160 |
+
}
|
161 |
+
|
162 |
+
if (!isset($result)) {
|
163 |
+
$result = 0;
|
164 |
+
}
|
165 |
+
break;
|
166 |
+
|
167 |
+
case '=':
|
168 |
+
case 'comp':
|
169 |
+
case 'compare':
|
170 |
+
$compare = true;
|
171 |
+
if ($bc) {
|
172 |
+
$result = bccomp($number1, $number2, $precision); // Returns int 0, 1 or -1.
|
173 |
+
} else {
|
174 |
+
$result = ( $number1 == $number2 ) ? 0 : ( ( $number1 > $number2 ) ? 1 : - 1 );
|
175 |
+
}
|
176 |
+
break;
|
177 |
+
}
|
178 |
+
|
179 |
+
if (isset($result)) {
|
180 |
+
if ($compare === false) {
|
181 |
+
if ($round === true) {
|
182 |
+
$result = round(floatval($result), $decimals);
|
183 |
+
if ($decimals === 0) {
|
184 |
+
$result = (int) $result;
|
185 |
+
}
|
186 |
+
} else {
|
187 |
+
$result = ( intval($result) == $result ) ? intval($result) : floatval($result);
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
return $result;
|
192 |
+
}
|
193 |
+
|
194 |
+
return false;
|
195 |
+
}
|
196 |
+
|
197 |
+
public static function trim_nbsp_from_string($string) {
|
198 |
+
$find = array(' ', chr(0xC2) . chr(0xA0));
|
199 |
+
$string = str_replace($find, ' ', $string);
|
200 |
+
$string = trim($string);
|
201 |
+
|
202 |
+
return $string;
|
203 |
+
}
|
204 |
+
|
205 |
+
}
|
inc/class.image-helper.php
CHANGED
@@ -132,7 +132,6 @@ class ImageHelper{
|
|
132 |
$iname = preg_replace('/(\s{1,})/', '-', $iname);
|
133 |
$_imgs[$iname] = $iid;
|
134 |
}
|
135 |
-
|
136 |
if($tags->length > 0){
|
137 |
foreach($tags as $order => $tag){
|
138 |
if(($obj = $tag->getAttribute('src')) == '') { continue; }
|
@@ -333,7 +332,6 @@ class ImageHelper{
|
|
333 |
|
334 |
$posts = $wpdb->get_results($query);
|
335 |
$results = self::IPrepare($imgs, $posts, $meta_keys, $forceScan);
|
336 |
-
|
337 |
//Update some value into fields in wp_postmeta
|
338 |
if(count($results['iNotGood']) > 0){
|
339 |
foreach($results['iNotGood'] as $iID => $post_group){
|
132 |
$iname = preg_replace('/(\s{1,})/', '-', $iname);
|
133 |
$_imgs[$iname] = $iid;
|
134 |
}
|
|
|
135 |
if($tags->length > 0){
|
136 |
foreach($tags as $order => $tag){
|
137 |
if(($obj = $tag->getAttribute('src')) == '') { continue; }
|
332 |
|
333 |
$posts = $wpdb->get_results($query);
|
334 |
$results = self::IPrepare($imgs, $posts, $meta_keys, $forceScan);
|
|
|
335 |
//Update some value into fields in wp_postmeta
|
336 |
if(count($results['iNotGood']) > 0){
|
337 |
foreach($results['iNotGood'] as $iID => $post_group){
|
inc/class.metaseo-admin.php
CHANGED
@@ -2,8 +2,27 @@
|
|
2 |
|
3 |
//Main plugin functions here
|
4 |
class MetaSeo_Admin {
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
6 |
function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
add_action('admin_menu', array($this, 'register_menu_page'));
|
9 |
|
@@ -13,13 +32,204 @@ class MetaSeo_Admin {
|
|
13 |
/** Load admin css * */
|
14 |
add_action('admin_init', array($this, 'addAdminStylesheets'));
|
15 |
|
16 |
-
|
17 |
|
18 |
//register ajax update meta handler...
|
19 |
add_action( 'wp_ajax_updateContentMeta', array($this, 'updateContentMeta_callback') );
|
20 |
add_action( 'admin_init', array($this, 'stop_heartbeat') , 1 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
|
25 |
function stop_heartbeat() {
|
@@ -142,6 +352,15 @@ class MetaSeo_Admin {
|
|
142 |
array($this, 'load_page'),
|
143 |
null,
|
144 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
);
|
146 |
|
147 |
|
@@ -177,6 +396,10 @@ class MetaSeo_Admin {
|
|
177 |
function load_page() {
|
178 |
if (isset($_GET['page'])) {
|
179 |
switch ($_GET['page']) {
|
|
|
|
|
|
|
|
|
180 |
case 'metaseo_content_meta':
|
181 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/content-meta.php' );
|
182 |
break;
|
2 |
|
3 |
//Main plugin functions here
|
4 |
class MetaSeo_Admin {
|
5 |
+
|
6 |
+
private $options;
|
7 |
+
private $pagenow;
|
8 |
+
public static $desc_length = 156;
|
9 |
+
public static $title_length = 69;
|
10 |
+
|
11 |
function __construct() {
|
12 |
+
$this->settings = array(
|
13 |
+
"metaseo_showfacebook"=>"",
|
14 |
+
"metaseo_showtwitter"=>"",
|
15 |
+
"metaseo_showtmetablock"=>0
|
16 |
+
);
|
17 |
+
$settings = get_option( '_metaseo_settings' );
|
18 |
+
if(is_array($settings)){
|
19 |
+
$this->settings = array_merge($this->settings, $settings);
|
20 |
+
}
|
21 |
+
|
22 |
+
$this->pagenow = $GLOBALS['pagenow'];
|
23 |
+
if($this->settings['metaseo_showtmetablock'] == 1 || empty($this->settings['metaseo_installnew'])){
|
24 |
+
$this->load_meta_boxes();
|
25 |
+
}
|
26 |
|
27 |
add_action('admin_menu', array($this, 'register_menu_page'));
|
28 |
|
32 |
/** Load admin css * */
|
33 |
add_action('admin_init', array($this, 'addAdminStylesheets'));
|
34 |
|
35 |
+
$this->ajaxHandle();
|
36 |
|
37 |
//register ajax update meta handler...
|
38 |
add_action( 'wp_ajax_updateContentMeta', array($this, 'updateContentMeta_callback') );
|
39 |
add_action( 'admin_init', array($this, 'stop_heartbeat') , 1 );
|
40 |
+
add_action('admin_init', array($this,'metaseo_field_settings'));
|
41 |
+
add_action('wp_ajax_metaseo_reload_analysis',array($this,'metaseo_reload_analysis'));
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
function metaseo_reload_analysis() {
|
46 |
+
if(empty($_POST['datas'])){
|
47 |
+
wp_send_json(false);
|
48 |
+
}
|
49 |
+
$check = 0;
|
50 |
+
$output = '';
|
51 |
+
// title heading
|
52 |
+
if($_POST['datas']['meta_title'] != ''){
|
53 |
+
$words_meta_title = preg_split('~[^\p{L}\p{N}\']+~u',strtolower($_POST['datas']['meta_title']));//explode(' ' , strtolower($meta_title));
|
54 |
+
$words_post_title = preg_split('~[^\p{L}\p{N}\']+~u',strtolower($_POST['datas']['title'])); //explode(' ' , strtolower($post->post_title));
|
55 |
+
|
56 |
+
$test = false;
|
57 |
+
if(is_array($words_meta_title) && is_array($words_post_title)){
|
58 |
+
foreach ($words_meta_title as $mtitle){
|
59 |
+
if(in_array($mtitle, $words_post_title)){
|
60 |
+
$test = true;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}else{
|
64 |
+
$test = false;
|
65 |
+
}
|
66 |
+
|
67 |
+
if($test){
|
68 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Page title word in content heading','wp-meta-seo').'</div>';
|
69 |
+
$check ++;
|
70 |
+
}else{
|
71 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Page title word in content heading','wp-meta-seo').'</div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
}else{
|
75 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Page title word in content heading','wp-meta-seo').'</div>';
|
76 |
+
$check ++;
|
77 |
+
}
|
78 |
+
|
79 |
+
// title content
|
80 |
+
$words_title = preg_split('~[^\p{L}\p{N}\']+~u',strtolower($_POST['datas']['title']));
|
81 |
+
$words_post_content = preg_split('~[^\p{L}\p{N}\']+~u',strtolower($_POST['datas']['content']));
|
82 |
+
|
83 |
+
$test1 = false;
|
84 |
+
if(is_array($words_title) && is_array($words_post_content)){
|
85 |
+
foreach ($words_title as $mtitle){
|
86 |
+
if(in_array($mtitle, $words_post_content)){
|
87 |
+
$test1 = true;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}else{
|
91 |
+
$test1 = false;
|
92 |
+
}
|
93 |
+
|
94 |
+
if($test1){
|
95 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Page title word in content','wp-meta-seo').'</div>';
|
96 |
+
$check ++;
|
97 |
+
}else{
|
98 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Page title word in content','wp-meta-seo').'</div>';
|
99 |
+
}
|
100 |
+
|
101 |
+
// page url matches page title
|
102 |
+
$mtitle = $_POST['datas']['title'];
|
103 |
+
if($_POST['datas']['mpageurl'] == sanitize_title($mtitle)){
|
104 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Page url matches with page title','wp-meta-seo').'</div>';
|
105 |
+
$check ++;
|
106 |
+
}else{
|
107 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Page url matches with page title','wp-meta-seo').'</div>';
|
108 |
+
}
|
109 |
+
|
110 |
+
// meta title filled
|
111 |
+
if($_POST['datas']['meta_title'] != '' && strlen($_POST['datas']['meta_title']) <= self::$title_length){
|
112 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Meta title filled','wp-meta-seo').'</div>';
|
113 |
+
$check++;
|
114 |
+
}else{
|
115 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Meta title filled','wp-meta-seo').'</div>';
|
116 |
+
}
|
117 |
+
|
118 |
+
// desc filled
|
119 |
+
if($_POST['datas']['meta_desc'] != '' && strlen($_POST['datas']['meta_desc']) <= self::$desc_length){
|
120 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Meta description filled','wp-meta-seo').'</div>';
|
121 |
+
$check++;
|
122 |
+
}else{
|
123 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Meta description filled','wp-meta-seo').'</div>';
|
124 |
+
}
|
125 |
+
|
126 |
+
// image resize
|
127 |
+
if($_POST['datas']['content'] == '') {
|
128 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Wrong image resize','wp-meta-seo').'</div>';
|
129 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Image have meta title or alt','wp-meta-seo').'</div>';
|
130 |
+
$check += 2;
|
131 |
+
}else{
|
132 |
+
$dom = new DOMDocument;
|
133 |
+
|
134 |
+
if ($dom->loadHTML('<div>'.html_entity_decode(stripcslashes($_POST['datas']['content'])).'</div>')) {
|
135 |
+
// Extracting the specified elements from the web page
|
136 |
+
$tags = $dom->getElementsByTagName('img');
|
137 |
+
$img_wrong = false;
|
138 |
+
$img_wrong_alt = false;
|
139 |
+
foreach($tags as $order => $tag){
|
140 |
+
$src = $tag->getAttribute('src');
|
141 |
+
$b = strrpos($src, '-');
|
142 |
+
$e = strrpos($src, '.');
|
143 |
+
$string_wh = substr($src, $b+1 , $e-$b-1);
|
144 |
+
$array_wh = explode('x', $string_wh);
|
145 |
+
if(!empty($array_wh[0]) && !empty($array_wh[1])){
|
146 |
+
if(((int)$array_wh[0] != (int)$tag->getAttribute('width')) || ((int)$array_wh[1] != (int)$tag->getAttribute('height'))){
|
147 |
+
$img_wrong = true;
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
$image_title = $tag->getAttribute('title');
|
152 |
+
$image_alt = $tag->getAttribute('alt');
|
153 |
+
if($image_title == '' || $image_alt == ''){
|
154 |
+
$img_wrong_alt = true;
|
155 |
+
}
|
156 |
+
}
|
157 |
|
158 |
+
if($img_wrong){
|
159 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Wrong image resize','wp-meta-seo').'</div>';
|
160 |
+
}else{
|
161 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Wrong image resize','wp-meta-seo').'</div>';
|
162 |
+
$check++;
|
163 |
+
}
|
164 |
+
|
165 |
+
if($img_wrong_alt){
|
166 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Image have meta title or alt','wp-meta-seo').'</div>';
|
167 |
+
}else{
|
168 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Image have meta title or alt','wp-meta-seo').'</div>';
|
169 |
+
$check++;
|
170 |
+
}
|
171 |
|
172 |
+
}else{
|
173 |
+
$output .= '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Wrong image resize','wp-meta-seo').'</div>';
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
$circliful = ceil(100*($check)/7);
|
178 |
+
wp_send_json(array('circliful' => $circliful,'output' => $output));
|
179 |
+
|
180 |
+
}
|
181 |
+
|
182 |
+
function metaseo_field_settings(){
|
183 |
+
register_setting('Wp Meta SEO','_metaseo_settings');
|
184 |
+
add_settings_section('metaseo_dashboard','',array( $this, 'showSettings' ),'metaseo_settings');
|
185 |
+
add_settings_field('metaseo_showfacebook', __('Facebook profile URL ', 'wp-meta-seo'), array( $this, 'showfacebook' ), 'metaseo_settings', 'metaseo_dashboard');
|
186 |
+
add_settings_field('metaseo_showtwitter', __('Twitter Username ', 'wp-meta-seo'), array( $this, 'showtwitter' ), 'metaseo_settings', 'metaseo_dashboard');
|
187 |
+
add_settings_field('metaseo_showtmetablock', __('Meta block edition ', 'wp-meta-seo'), array( $this, 'showtmetablock' ), 'metaseo_settings', 'metaseo_dashboard');
|
188 |
+
}
|
189 |
+
|
190 |
+
public function showSettings(){
|
191 |
+
|
192 |
+
}
|
193 |
+
|
194 |
+
|
195 |
+
public function showtmetablock(){
|
196 |
+
echo '<input id="metaseo_installnew" name="_metaseo_settings[metaseo_installnew]" type="hidden" value="old"/>';
|
197 |
+
if(!empty($this->settings['metaseo_showtmetablock'])){
|
198 |
+
$show = $this->settings['metaseo_showtmetablock'];
|
199 |
+
}else{
|
200 |
+
$show = 0;
|
201 |
+
}
|
202 |
+
|
203 |
+
if(empty($this->settings['metaseo_installnew'])){
|
204 |
+
$show = 1;
|
205 |
+
}
|
206 |
+
?>
|
207 |
+
<label><input name="_metaseo_settings[metaseo_showtmetablock]" type="checkbox" id="metaseo_showtmetablock" value="1" <?php checked( 1, ($show == 0)?0:1); ?> />
|
208 |
+
<?php _e( 'Show/hide meta block edition below content' ); ?></label>
|
209 |
+
<?php
|
210 |
+
}
|
211 |
+
|
212 |
+
public function showfacebook(){
|
213 |
+
$face = isset( $this->settings['metaseo_showfacebook'] ) ? $this->settings['metaseo_showfacebook'] : '';
|
214 |
+
echo '<input id="metaseo_showfacebook" name="_metaseo_settings[metaseo_showfacebook]" type="text" value="'.esc_attr( $face ).'" size="50"/>';
|
215 |
+
}
|
216 |
+
|
217 |
+
public function showtwitter(){
|
218 |
+
$twitter = isset( $this->settings['metaseo_showtwitter'] ) ? $this->settings['metaseo_showtwitter'] : '';
|
219 |
+
echo '<input id="metaseo_showtwitter" name="_metaseo_settings[metaseo_showtwitter]" type="text" value="'.esc_attr( $twitter ).'" size="50"/>';
|
220 |
+
}
|
221 |
+
|
222 |
+
|
223 |
+
private function load_meta_boxes() {
|
224 |
+
if ( in_array( $this->pagenow, array(
|
225 |
+
'edit.php',
|
226 |
+
'post.php',
|
227 |
+
'post-new.php',
|
228 |
+
) ) || apply_filters( 'wpmseo_always_register_metaboxes_on_admin', false )
|
229 |
+
) {
|
230 |
+
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-metabox.php' );
|
231 |
+
$GLOBALS['wpmseo_metabox'] = new WPMSEO_Metabox;
|
232 |
+
}
|
233 |
}
|
234 |
|
235 |
function stop_heartbeat() {
|
352 |
array($this, 'load_page'),
|
353 |
null,
|
354 |
),
|
355 |
+
array(
|
356 |
+
'metaseo_dashboard',
|
357 |
+
'',
|
358 |
+
__('Settings', 'wp-meta-seo'),
|
359 |
+
$manage_options_cap,
|
360 |
+
'metaseo_settings',
|
361 |
+
array($this, 'load_page'),
|
362 |
+
null,
|
363 |
+
),
|
364 |
);
|
365 |
|
366 |
|
396 |
function load_page() {
|
397 |
if (isset($_GET['page'])) {
|
398 |
switch ($_GET['page']) {
|
399 |
+
case 'metaseo_settings':
|
400 |
+
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/settings.php' );
|
401 |
+
break;
|
402 |
+
|
403 |
case 'metaseo_content_meta':
|
404 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/content-meta.php' );
|
405 |
break;
|
inc/class.metaseo-meta.php
ADDED
@@ -0,0 +1,577 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPMSEO_Meta {
|
4 |
+
|
5 |
+
public static $meta_prefix = '_metaseo_meta';
|
6 |
+
public static $form_prefix = 'metaseo_wpmseo_';
|
7 |
+
public static $meta_length = 156;
|
8 |
+
public static $meta_title_length = 69;
|
9 |
+
public static $meta_length_reason = '';
|
10 |
+
public static $meta_fields = array(
|
11 |
+
'general' => array(
|
12 |
+
'snippetpreview' => array(
|
13 |
+
'type' => 'snippetpreview',
|
14 |
+
'title' => '', // Translation added later.
|
15 |
+
'help' => '', // Translation added later.
|
16 |
+
),
|
17 |
+
'title' => array(
|
18 |
+
'type' => 'textarea',
|
19 |
+
'title' => '', // Translation added later.
|
20 |
+
'default_value' => '',
|
21 |
+
'description' => '', // Translation added later.
|
22 |
+
'help' => '', // Translation added later.
|
23 |
+
'rows' => 2
|
24 |
+
),
|
25 |
+
'desc' => array(
|
26 |
+
'type' => 'textarea',
|
27 |
+
'title' => '', // Translation added later.
|
28 |
+
'default_value' => '',
|
29 |
+
'class' => 'desc',
|
30 |
+
'rows' => 3,
|
31 |
+
'description' => '', // Translation added later.
|
32 |
+
'help' => '', // Translation added later.
|
33 |
+
),
|
34 |
+
'metaseo_chart' => array(
|
35 |
+
'type' => 'metaseo_chart',
|
36 |
+
'title' => '', // Translation added later.
|
37 |
+
'default_value' => '',
|
38 |
+
'class' => 'metaseo_chart',
|
39 |
+
'rows' => 2,
|
40 |
+
'description' => '', // Translation added later.
|
41 |
+
'help' => '', // Translation added later.
|
42 |
+
),
|
43 |
+
),
|
44 |
+
'social' => array(
|
45 |
+
'opengraph-title' => array(
|
46 |
+
'type' => 'text',
|
47 |
+
'title' => '', // Translation added later.
|
48 |
+
'default_value' => '',
|
49 |
+
'description' => '', // Translation added later.
|
50 |
+
'help' => '', // Translation added later.
|
51 |
+
),
|
52 |
+
'opengraph-desc' => array(
|
53 |
+
'type' => 'textarea',
|
54 |
+
'title' => '', // Translation added later.
|
55 |
+
'default_value' => '',
|
56 |
+
'class' => 'desc',
|
57 |
+
'rows' => 3,
|
58 |
+
'description' => '', // Translation added later.
|
59 |
+
'help' => '', // Translation added later.
|
60 |
+
),
|
61 |
+
'opengraph-image' => array(
|
62 |
+
'type' => 'upload',
|
63 |
+
'title' => '', // Translation added later.
|
64 |
+
'default_value' => '',
|
65 |
+
'class' => 'desc',
|
66 |
+
'description' => '', // Translation added later.
|
67 |
+
'help' => '', // Translation added later.
|
68 |
+
),
|
69 |
+
|
70 |
+
'twitter-title' => array(
|
71 |
+
'type' => 'text',
|
72 |
+
'title' => '', // Translation added later.
|
73 |
+
'default_value' => '',
|
74 |
+
'description' => '', // Translation added later.
|
75 |
+
'help' => '', // Translation added later.
|
76 |
+
),
|
77 |
+
'twitter-desc' => array(
|
78 |
+
'type' => 'textarea',
|
79 |
+
'title' => '', // Translation added later.
|
80 |
+
'default_value' => '',
|
81 |
+
'class' => 'desc',
|
82 |
+
'rows' => 3,
|
83 |
+
'description' => '', // Translation added later.
|
84 |
+
'help' => '', // Translation added later.
|
85 |
+
),
|
86 |
+
'twitter-image' => array(
|
87 |
+
'type' => 'upload',
|
88 |
+
'title' => '', // Translation added later.
|
89 |
+
'default_value' => '',
|
90 |
+
'class' => 'desc',
|
91 |
+
'description' => '', // Translation added later.
|
92 |
+
'help' => '', // Translation added later.
|
93 |
+
),
|
94 |
+
|
95 |
+
),
|
96 |
+
/* Fields we should validate & save, but not show on any form */
|
97 |
+
'non_form' => array(
|
98 |
+
'linkdex' => array(
|
99 |
+
'type' => null,
|
100 |
+
'default_value' => '0',
|
101 |
+
),
|
102 |
+
),
|
103 |
+
);
|
104 |
+
public static $fields_index = array();
|
105 |
+
public static $defaults = array();
|
106 |
+
private static $social_networks = array(
|
107 |
+
'opengraph' => 'opengraph',
|
108 |
+
'twitter' => 'twitter',
|
109 |
+
'googleplus' => 'google-plus',
|
110 |
+
);
|
111 |
+
private static $social_fields = array(
|
112 |
+
'title' => 'text',
|
113 |
+
'description' => 'textarea',
|
114 |
+
'image' => 'upload',
|
115 |
+
);
|
116 |
+
|
117 |
+
public static function init() {
|
118 |
+
add_filter('update_post_metadata', array(__CLASS__, 'remove_meta_if_default'), 10, 5);
|
119 |
+
add_filter('add_post_metadata', array(__CLASS__, 'dont_save_meta_if_default'), 10, 4);
|
120 |
+
}
|
121 |
+
|
122 |
+
public static function get_meta_field_defs($tab, $post_type = 'post') {
|
123 |
+
if (!isset(self::$meta_fields[$tab])) {
|
124 |
+
return array();
|
125 |
+
}
|
126 |
+
|
127 |
+
$field_defs = self::$meta_fields[$tab];
|
128 |
+
|
129 |
+
switch ($tab) {
|
130 |
+
case 'non-form':
|
131 |
+
// Prevent non-form fields from being passed to forms.
|
132 |
+
$field_defs = array();
|
133 |
+
break;
|
134 |
+
|
135 |
+
|
136 |
+
case 'general':
|
137 |
+
$options = get_option('wpmseo_titles');
|
138 |
+
if ($options['usemetakeywords'] === true) {
|
139 |
+
/* Adjust the link in the keywords description text string based on the post type */
|
140 |
+
$field_defs['metakeywords']['description'] = sprintf($field_defs['metakeywords']['description'], '<a target="_blank" href="' . esc_url(admin_url('admin.php?page=wpmseo_titles#top#post_types')) . '">', '</a>');
|
141 |
+
} else {
|
142 |
+
/* Don't show the keywords field if keywords aren't enabled */
|
143 |
+
unset($field_defs['metakeywords']);
|
144 |
+
}
|
145 |
+
/**
|
146 |
+
* Filter the WPSEO metabox form field definitions for the general tab, backward compatibility
|
147 |
+
*
|
148 |
+
* @deprecated 1.5.0
|
149 |
+
* @deprecated use the 'wpmseo_metabox_entries_general' filter instead
|
150 |
+
* @see WPMSEO_Meta::get_meta_field_defs()
|
151 |
+
*
|
152 |
+
* @param array $field_defs Metabox orm definitions.
|
153 |
+
*
|
154 |
+
* @return array
|
155 |
+
*/
|
156 |
+
$field_defs = apply_filters('wpmseo_metabox_entries', $field_defs);
|
157 |
+
break;
|
158 |
+
|
159 |
+
|
160 |
+
case 'advanced':
|
161 |
+
// global $post;
|
162 |
+
//
|
163 |
+
// $options = WPSEO_Options::get_all();
|
164 |
+
//
|
165 |
+
// if ( ! current_user_can( 'manage_options' ) && $options['disableadvanced_meta'] ) {
|
166 |
+
// return array();
|
167 |
+
// }
|
168 |
+
//
|
169 |
+
// $post_type = '';
|
170 |
+
// if ( isset( $post->post_type ) ) {
|
171 |
+
// $post_type = $post->post_type;
|
172 |
+
// }
|
173 |
+
// elseif ( ! isset( $post->post_type ) && isset( $_GET['post_type'] ) ) {
|
174 |
+
// $post_type = sanitize_text_field( $_GET['post_type'] );
|
175 |
+
// }
|
176 |
+
//
|
177 |
+
// /* Adjust the no-index 'default for post type' text string based on the post type */
|
178 |
+
// $field_defs['meta-robots-noindex']['options']['0'] = sprintf( $field_defs['meta-robots-noindex']['options']['0'], ( ( isset( $options[ 'noindex-' . $post_type ] ) && $options[ 'noindex-' . $post_type ] === true ) ? 'noindex' : 'index' ) );
|
179 |
+
//
|
180 |
+
// /* Adjust the robots advanced 'site-wide default' text string based on those settings */
|
181 |
+
// if ( $options['noodp'] !== false || $options['noydir'] !== false ) {
|
182 |
+
// $robots_adv = array();
|
183 |
+
// foreach ( array( 'noodp', 'noydir' ) as $robot ) {
|
184 |
+
// if ( $options[ $robot ] === true ) {
|
185 |
+
// // Use translation from field def options - mind that $options and $field_def['options'] keys should be the same!
|
186 |
+
// $robots_adv[] = $field_defs['meta-robots-adv']['options'][ $robot ];
|
187 |
+
// }
|
188 |
+
// }
|
189 |
+
// unset( $robot );
|
190 |
+
// $robots_adv = implode( ', ', $robots_adv );
|
191 |
+
// }
|
192 |
+
// else {
|
193 |
+
// $robots_adv = __( 'None', 'wordpress-seo' );
|
194 |
+
// }
|
195 |
+
// $field_defs['meta-robots-adv']['options']['-'] = sprintf( $field_defs['meta-robots-adv']['options']['-'], $robots_adv );
|
196 |
+
// unset( $robots_adv );
|
197 |
+
//
|
198 |
+
//
|
199 |
+
// /* Don't show the breadcrumb title field if breadcrumbs aren't enabled */
|
200 |
+
// if ( $options['breadcrumbs-enable'] !== true ) {
|
201 |
+
// unset( $field_defs['bctitle'] );
|
202 |
+
// }
|
203 |
+
//
|
204 |
+
// global $post;
|
205 |
+
//
|
206 |
+
// if ( empty( $post->ID ) || ( ! empty( $post->ID ) && self::get_value( 'redirect', $post->ID ) === '' ) ) {
|
207 |
+
// unset( $field_defs['redirect'] );
|
208 |
+
// }
|
209 |
+
break;
|
210 |
+
}
|
211 |
+
|
212 |
+
return apply_filters('wpmseo_metabox_entries_' . $tab, $field_defs, $post_type);
|
213 |
+
}
|
214 |
+
|
215 |
+
public static function sanitize_post_meta($meta_value, $meta_key) {
|
216 |
+
$field_def = self::$meta_fields[self::$fields_index[$meta_key]['subset']][self::$fields_index[$meta_key]['key']];
|
217 |
+
$clean = self::$defaults[$meta_key];
|
218 |
+
|
219 |
+
switch (true) {
|
220 |
+
case ( $meta_key === self::$meta_prefix . 'linkdex' ):
|
221 |
+
$int = WPMSEO_Utils::validate_int($meta_value);
|
222 |
+
if ($int !== false && $int >= 0) {
|
223 |
+
$clean = strval($int); // Convert to string to make sure default check works.
|
224 |
+
}
|
225 |
+
break;
|
226 |
+
|
227 |
+
|
228 |
+
case ( $field_def['type'] === 'checkbox' ):
|
229 |
+
// Only allow value if it's one of the predefined options.
|
230 |
+
if (in_array($meta_value, array('on', 'off'), true)) {
|
231 |
+
$clean = $meta_value;
|
232 |
+
}
|
233 |
+
break;
|
234 |
+
|
235 |
+
|
236 |
+
case ( $field_def['type'] === 'select' || $field_def['type'] === 'radio' ):
|
237 |
+
// Only allow value if it's one of the predefined options.
|
238 |
+
if (isset($field_def['options'][$meta_value])) {
|
239 |
+
$clean = $meta_value;
|
240 |
+
}
|
241 |
+
break;
|
242 |
+
|
243 |
+
|
244 |
+
case ( $field_def['type'] === 'multiselect' && $meta_key === self::$meta_prefix . 'meta-robots-adv' ):
|
245 |
+
$clean = self::validate_meta_robots_adv($meta_value);
|
246 |
+
break;
|
247 |
+
|
248 |
+
|
249 |
+
case ( $field_def['type'] === 'text' && $meta_key === self::$meta_prefix . 'canonical' ):
|
250 |
+
case ( $field_def['type'] === 'text' && $meta_key === self::$meta_prefix . 'redirect' ):
|
251 |
+
// Validate as url(-part).
|
252 |
+
$url = WPMSEO_Utils::sanitize_url($meta_value);
|
253 |
+
if ($url !== '') {
|
254 |
+
$clean = $url;
|
255 |
+
}
|
256 |
+
break;
|
257 |
+
|
258 |
+
|
259 |
+
case ( $field_def['type'] === 'upload' && $meta_key === self::$meta_prefix . 'opengraph-image' ):
|
260 |
+
// Validate as url.
|
261 |
+
$url = WPMSEO_Utils::sanitize_url($meta_value, array('http', 'https', 'ftp', 'ftps'));
|
262 |
+
if ($url !== '') {
|
263 |
+
$clean = $url;
|
264 |
+
}
|
265 |
+
break;
|
266 |
+
|
267 |
+
|
268 |
+
case ( $field_def['type'] === 'textarea' ):
|
269 |
+
if (is_string($meta_value)) {
|
270 |
+
// Remove line breaks and tabs.
|
271 |
+
// @todo [JRF => Yoast] verify that line breaks and the likes aren't allowed/recommended in meta header fields.
|
272 |
+
$meta_value = str_replace(array("\n", "\r", "\t", ' '), ' ', $meta_value);
|
273 |
+
$clean = WPMSEO_Utils::sanitize_text_field(trim($meta_value));
|
274 |
+
}
|
275 |
+
break;
|
276 |
+
|
277 |
+
case ( 'multiselect' === $field_def['type'] ):
|
278 |
+
$clean = $meta_value;
|
279 |
+
break;
|
280 |
+
|
281 |
+
|
282 |
+
case ( $field_def['type'] === 'text' ):
|
283 |
+
default:
|
284 |
+
if (is_string($meta_value)) {
|
285 |
+
$clean = WPMSEO_Utils::sanitize_text_field(trim($meta_value));
|
286 |
+
}
|
287 |
+
break;
|
288 |
+
}
|
289 |
+
|
290 |
+
$clean = apply_filters('wpmseo_sanitize_post_meta_' . $meta_key, $clean, $meta_value, $field_def, $meta_key);
|
291 |
+
|
292 |
+
return $clean;
|
293 |
+
}
|
294 |
+
|
295 |
+
public static function validate_meta_robots_adv($meta_value) {
|
296 |
+
$clean = self::$meta_fields['advanced']['meta-robots-adv']['default_value'];
|
297 |
+
$options = self::$meta_fields['advanced']['meta-robots-adv']['options'];
|
298 |
+
|
299 |
+
if (is_string($meta_value)) {
|
300 |
+
$meta_value = explode(',', $meta_value);
|
301 |
+
}
|
302 |
+
|
303 |
+
if (is_array($meta_value) && $meta_value !== array()) {
|
304 |
+
$meta_value = array_map('trim', $meta_value);
|
305 |
+
|
306 |
+
if (in_array('none', $meta_value, true)) {
|
307 |
+
// None is one of the selected values, takes priority over everything else.
|
308 |
+
$clean = 'none';
|
309 |
+
} elseif (in_array('-', $meta_value, true)) {
|
310 |
+
// Site-wide defaults is one of the selected values, takes priority over individual selected entries.
|
311 |
+
$clean = '-';
|
312 |
+
} else {
|
313 |
+
// Individual selected entries.
|
314 |
+
$cleaning = array();
|
315 |
+
foreach ($meta_value as $value) {
|
316 |
+
if (isset($options[$value])) {
|
317 |
+
$cleaning[] = $value;
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
if ($cleaning !== array()) {
|
322 |
+
$clean = implode(',', $cleaning);
|
323 |
+
}
|
324 |
+
unset($cleaning, $value);
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
return $clean;
|
329 |
+
}
|
330 |
+
|
331 |
+
public static function remove_meta_if_default($null, $object_id, $meta_key, $meta_value, $prev_value = '') {
|
332 |
+
/* If it's one of our meta fields, check against default */
|
333 |
+
if (isset(self::$fields_index[$meta_key]) && self::meta_value_is_default($meta_key, $meta_value) === true) {
|
334 |
+
if ($prev_value !== '') {
|
335 |
+
delete_post_meta($object_id, $meta_key, $prev_value);
|
336 |
+
} else {
|
337 |
+
delete_post_meta($object_id, $meta_key);
|
338 |
+
}
|
339 |
+
|
340 |
+
return true; // Stop saving the value.
|
341 |
+
}
|
342 |
+
|
343 |
+
return null; // Go on with the normal execution (update) in meta.php.
|
344 |
+
}
|
345 |
+
|
346 |
+
public static function dont_save_meta_if_default($null, $object_id, $meta_key, $meta_value) {
|
347 |
+
/* If it's one of our meta fields, check against default */
|
348 |
+
if (isset(self::$fields_index[$meta_key]) && self::meta_value_is_default($meta_key, $meta_value) === true) {
|
349 |
+
return true; // Stop saving the value.
|
350 |
+
}
|
351 |
+
|
352 |
+
return null; // Go on with the normal execution (add) in meta.php.
|
353 |
+
}
|
354 |
+
|
355 |
+
public static function meta_value_is_default($meta_key, $meta_value) {
|
356 |
+
return ( isset(self::$defaults[$meta_key]) && $meta_value === self::$defaults[$meta_key] );
|
357 |
+
}
|
358 |
+
|
359 |
+
public static function get_value($key, $postid = 0) {
|
360 |
+
global $post;
|
361 |
+
|
362 |
+
$postid = absint($postid);
|
363 |
+
if ($postid === 0) {
|
364 |
+
if (( isset($post) && is_object($post) ) && ( isset($post->post_status) && $post->post_status !== 'auto-draft' )) {
|
365 |
+
$postid = $post->ID;
|
366 |
+
} else {
|
367 |
+
return '';
|
368 |
+
}
|
369 |
+
}
|
370 |
+
|
371 |
+
$custom = get_post_custom($postid); // Array of strings or empty array.
|
372 |
+
|
373 |
+
if (isset($custom[self::$meta_prefix . $key][0])) {
|
374 |
+
$unserialized = maybe_unserialize($custom[self::$meta_prefix . $key][0]);
|
375 |
+
if ($custom[self::$meta_prefix . $key][0] === $unserialized) {
|
376 |
+
return $custom[self::$meta_prefix . $key][0];
|
377 |
+
} else {
|
378 |
+
$field_def = self::$meta_fields[self::$fields_index[self::$meta_prefix . $key]['subset']][self::$fields_index[self::$meta_prefix . $key]['key']];
|
379 |
+
if (isset($field_def['serialized']) && $field_def['serialized'] === true) {
|
380 |
+
// Ok, serialize value expected/allowed.
|
381 |
+
return $unserialized;
|
382 |
+
}
|
383 |
+
}
|
384 |
+
}
|
385 |
+
|
386 |
+
// Meta was either not found or found, but object/array while not allowed to be.
|
387 |
+
if (isset(self::$defaults[self::$meta_prefix . $key])) {
|
388 |
+
return self::$defaults[self::$meta_prefix . $key];
|
389 |
+
} else {
|
390 |
+
return '';
|
391 |
+
}
|
392 |
+
}
|
393 |
+
|
394 |
+
public static function set_value($key, $meta_value, $post_id) {
|
395 |
+
return update_post_meta($post_id, self::$meta_prefix . $key, $meta_value);
|
396 |
+
}
|
397 |
+
|
398 |
+
public static function replace_meta($old_metakey, $new_metakey, $delete_old = false) {
|
399 |
+
global $wpdb;
|
400 |
+
$query = $wpdb->prepare(
|
401 |
+
"
|
402 |
+
SELECT `a`.*
|
403 |
+
FROM {$wpdb->postmeta} AS a
|
404 |
+
WHERE `a`.`meta_key` = %s
|
405 |
+
AND NOT EXISTS (
|
406 |
+
SELECT DISTINCT `post_id` , count( `meta_id` ) AS count
|
407 |
+
FROM {$wpdb->postmeta} AS b
|
408 |
+
WHERE `a`.`post_id` = `b`.`post_id`
|
409 |
+
AND `meta_key` LIKE %s
|
410 |
+
AND `meta_key` <> %s
|
411 |
+
GROUP BY `post_id`
|
412 |
+
)
|
413 |
+
;", $old_metakey, $wpdb->esc_like(self::$meta_prefix . '%'), self::$meta_prefix . 'linkdex'
|
414 |
+
);
|
415 |
+
$oldies = $wpdb->get_results($query);
|
416 |
+
|
417 |
+
if (is_array($oldies) && $oldies !== array()) {
|
418 |
+
foreach ($oldies as $old) {
|
419 |
+
update_post_meta($old->post_id, $new_metakey, $old->meta_value);
|
420 |
+
}
|
421 |
+
}
|
422 |
+
|
423 |
+
// Delete old keys.
|
424 |
+
if ($delete_old === true) {
|
425 |
+
delete_post_meta_by_key($old_metakey);
|
426 |
+
}
|
427 |
+
}
|
428 |
+
|
429 |
+
public static function clean_up() {
|
430 |
+
global $wpdb;
|
431 |
+
$query = $wpdb->prepare(
|
432 |
+
"
|
433 |
+
SELECT `a`.*
|
434 |
+
FROM {$wpdb->postmeta} AS a
|
435 |
+
WHERE `a`.`meta_key` = %s
|
436 |
+
AND NOT EXISTS (
|
437 |
+
SELECT DISTINCT `post_id` , count( `meta_id` ) AS count
|
438 |
+
FROM {$wpdb->postmeta} AS b
|
439 |
+
WHERE `a`.`post_id` = `b`.`post_id`
|
440 |
+
AND ( `meta_key` = %s
|
441 |
+
OR `meta_key` = %s )
|
442 |
+
GROUP BY `post_id`
|
443 |
+
)
|
444 |
+
;", self::$meta_prefix . 'meta-robots', self::$meta_prefix . 'meta-robots-noindex', self::$meta_prefix . 'meta-robots-nofollow'
|
445 |
+
);
|
446 |
+
$oldies = $wpdb->get_results($query);
|
447 |
+
|
448 |
+
if (is_array($oldies) && $oldies !== array()) {
|
449 |
+
foreach ($oldies as $old) {
|
450 |
+
$old_values = explode(',', $old->meta_value);
|
451 |
+
foreach ($old_values as $value) {
|
452 |
+
if ($value === 'noindex') {
|
453 |
+
update_post_meta($old->post_id, self::$meta_prefix . 'meta-robots-noindex', 1);
|
454 |
+
} elseif ($value === 'nofollow') {
|
455 |
+
update_post_meta($old->post_id, self::$meta_prefix . 'meta-robots-nofollow', 1);
|
456 |
+
}
|
457 |
+
}
|
458 |
+
}
|
459 |
+
}
|
460 |
+
unset($query, $oldies, $old, $old_values, $value);
|
461 |
+
|
462 |
+
// Delete old keys.
|
463 |
+
delete_post_meta_by_key(self::$meta_prefix . 'meta-robots');
|
464 |
+
|
465 |
+
$query = array();
|
466 |
+
|
467 |
+
foreach (self::$meta_fields as $subset => $field_group) {
|
468 |
+
foreach ($field_group as $key => $field_def) {
|
469 |
+
if ($field_def['type'] === 'snippetpreview' || !isset($field_def['default_value'])) {
|
470 |
+
continue;
|
471 |
+
}
|
472 |
+
|
473 |
+
if ($key === 'meta-robots-adv') {
|
474 |
+
$query[] = $wpdb->prepare(
|
475 |
+
"( meta_key = %s AND ( meta_value = 'none' OR meta_value = '-' ) )", self::$meta_prefix . $key
|
476 |
+
);
|
477 |
+
} elseif (isset($field_def['options']) && is_array($field_def['options']) && $field_def['options'] !== array()) {
|
478 |
+
$valid = $field_def['options'];
|
479 |
+
// Remove the default value from the valid options.
|
480 |
+
unset($valid[$field_def['default_value']]);
|
481 |
+
$valid = array_keys($valid);
|
482 |
+
|
483 |
+
$query[] = $wpdb->prepare(
|
484 |
+
"( meta_key = %s AND meta_value NOT IN ( '" . implode("','", esc_sql($valid)) . "' ) )", self::$meta_prefix . $key
|
485 |
+
);
|
486 |
+
unset($valid);
|
487 |
+
} elseif (is_string($field_def['default_value']) && $field_def['default_value'] !== '') {
|
488 |
+
$query[] = $wpdb->prepare(
|
489 |
+
'( meta_key = %s AND meta_value = %s )', self::$meta_prefix . $key, $field_def['default_value']
|
490 |
+
);
|
491 |
+
} else {
|
492 |
+
$query[] = $wpdb->prepare(
|
493 |
+
"( meta_key = %s AND meta_value = '' )", self::$meta_prefix . $key
|
494 |
+
);
|
495 |
+
}
|
496 |
+
}
|
497 |
+
}
|
498 |
+
unset($subset, $field_group, $key, $field_def);
|
499 |
+
|
500 |
+
$query = "SELECT meta_id FROM {$wpdb->postmeta} WHERE " . implode(' OR ', $query) . ';';
|
501 |
+
$meta_ids = $wpdb->get_col($query);
|
502 |
+
|
503 |
+
if (is_array($meta_ids) && $meta_ids !== array()) {
|
504 |
+
// WP native action.
|
505 |
+
do_action('delete_post_meta', $meta_ids, null, null, null);
|
506 |
+
|
507 |
+
$query = "DELETE FROM {$wpdb->postmeta} WHERE meta_id IN( " . implode(',', $meta_ids) . ' )';
|
508 |
+
$count = $wpdb->query($query);
|
509 |
+
|
510 |
+
if ($count) {
|
511 |
+
foreach ($meta_ids as $object_id) {
|
512 |
+
wp_cache_delete($object_id, 'post_meta');
|
513 |
+
}
|
514 |
+
|
515 |
+
// WP native action.
|
516 |
+
do_action('deleted_post_meta', $meta_ids, null, null, null);
|
517 |
+
}
|
518 |
+
}
|
519 |
+
unset($query, $meta_ids, $count, $object_id);
|
520 |
+
|
521 |
+
$query = $wpdb->prepare(
|
522 |
+
"SELECT meta_id, meta_value FROM {$wpdb->postmeta} WHERE meta_key = %s", self::$meta_prefix . 'meta-robots-adv'
|
523 |
+
);
|
524 |
+
$oldies = $wpdb->get_results($query);
|
525 |
+
|
526 |
+
if (is_array($oldies) && $oldies !== array()) {
|
527 |
+
foreach ($oldies as $old) {
|
528 |
+
$clean = self::validate_meta_robots_adv($old->meta_value);
|
529 |
+
|
530 |
+
if ($clean !== $old->meta_value) {
|
531 |
+
if ($clean !== self::$meta_fields['advanced']['meta-robots-adv']['default_value']) {
|
532 |
+
update_metadata_by_mid('post', $old->meta_id, $clean);
|
533 |
+
} else {
|
534 |
+
delete_metadata_by_mid('post', $old->meta_id);
|
535 |
+
}
|
536 |
+
}
|
537 |
+
}
|
538 |
+
}
|
539 |
+
unset($query, $oldies, $old, $clean);
|
540 |
+
|
541 |
+
do_action('wpmseo_meta_clean_up');
|
542 |
+
}
|
543 |
+
|
544 |
+
public static function array_merge_recursive_distinct() {
|
545 |
+
|
546 |
+
$arrays = func_get_args();
|
547 |
+
if (count($arrays) < 2) {
|
548 |
+
if ($arrays === array()) {
|
549 |
+
return array();
|
550 |
+
} else {
|
551 |
+
return $arrays[0];
|
552 |
+
}
|
553 |
+
}
|
554 |
+
|
555 |
+
$merged = array_shift($arrays);
|
556 |
+
|
557 |
+
foreach ($arrays as $array) {
|
558 |
+
foreach ($array as $key => $value) {
|
559 |
+
if (is_array($value) && ( isset($merged[$key]) && is_array($merged[$key]) )) {
|
560 |
+
$merged[$key] = self::array_merge_recursive_distinct($merged[$key], $value);
|
561 |
+
} else {
|
562 |
+
$merged[$key] = $value;
|
563 |
+
}
|
564 |
+
}
|
565 |
+
unset($key, $value);
|
566 |
+
}
|
567 |
+
|
568 |
+
return $merged;
|
569 |
+
}
|
570 |
+
|
571 |
+
public static function get_post_value($key) {
|
572 |
+
return ( array_key_exists($key, $_POST) ) ? $_POST[$key] : '';
|
573 |
+
}
|
574 |
+
|
575 |
+
}
|
576 |
+
|
577 |
+
/* End of class */
|
inc/class.metaseo-metabox.php
ADDED
@@ -0,0 +1,653 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-meta.php' );
|
3 |
+
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-snippet-preview.php' );
|
4 |
+
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class-metaseo-mutils.php' );
|
5 |
+
|
6 |
+
class WPMSEO_Metabox extends WPMSEO_Meta {
|
7 |
+
|
8 |
+
public $perc_score = 0;
|
9 |
+
public function __construct() {
|
10 |
+
add_action('add_meta_boxes', array($this, 'add_meta_box'));
|
11 |
+
add_action('admin_enqueue_scripts', array($this, 'metaseo_enqueue'));
|
12 |
+
add_action('wp_insert_post', array($this, 'metaseo_save_postdata'));
|
13 |
+
add_action('edit_attachment', array($this, 'metaseo_save_postdata'));
|
14 |
+
add_action('add_attachment', array($this, 'metaseo_save_postdata'));
|
15 |
+
add_action('admin_init', array($this, 'translate_meta_boxes'));
|
16 |
+
}
|
17 |
+
|
18 |
+
function metaseo_save_postdata($post_id) {
|
19 |
+
if ($post_id === null) {
|
20 |
+
return false;
|
21 |
+
}
|
22 |
+
|
23 |
+
if (wp_is_post_revision($post_id)) {
|
24 |
+
$post_id = wp_is_post_revision($post_id);
|
25 |
+
}
|
26 |
+
|
27 |
+
clean_post_cache($post_id);
|
28 |
+
$post = get_post($post_id);
|
29 |
+
|
30 |
+
if (!is_object($post)) {
|
31 |
+
// Non-existent post.
|
32 |
+
return false;
|
33 |
+
}
|
34 |
+
|
35 |
+
do_action('wpmseo_save_compare_data', $post);
|
36 |
+
|
37 |
+
$meta_boxes = apply_filters('wpmseo_save_metaboxes', array());
|
38 |
+
$meta_boxes = array_merge($meta_boxes, $this->get_meta_field_defs('general', $post->post_type), $this->get_meta_field_defs('advanced'),$this->get_meta_field_defs('social'));
|
39 |
+
|
40 |
+
foreach ($meta_boxes as $key => $meta_box) {
|
41 |
+
$data = null;
|
42 |
+
if ('checkbox' === $meta_box['type']) {
|
43 |
+
$data = isset($_POST[self::$form_prefix . $key]) ? 'on' : 'off';
|
44 |
+
} else {
|
45 |
+
if (isset($_POST[self::$form_prefix . $key])) {
|
46 |
+
$data = $_POST[self::$form_prefix . $key];
|
47 |
+
}
|
48 |
+
}
|
49 |
+
if (isset($data)) {
|
50 |
+
self::set_value($key, $data, $post_id);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
do_action('wpmseo_saved_postdata');
|
54 |
+
}
|
55 |
+
|
56 |
+
public static function translate_meta_boxes() {
|
57 |
+
self::$meta_fields['general']['snippetpreview']['title'] = __('Results preview', 'wp-meta-seo');
|
58 |
+
self::$meta_fields['general']['snippetpreview']['help'] = sprintf(__('This is a preview of what your content will looks like in search engine results: title, description and URL', 'wp-meta-seo'), '<a target="_blank" href="https://www.joomunited.com/wordpress-products/wp-meta-seo">', '</a>');
|
59 |
+
|
60 |
+
self::$meta_fields['general']['title']['title'] = __('Search engine title', 'wp-meta-seo');
|
61 |
+
self::$meta_fields['general']['title']['description'] = sprintf(__('<span id="metaseo_wpmseo_title-length">%s</span>'),self::$meta_length_reason);
|
62 |
+
self::$meta_fields['general']['title']['help'] = __('This is the title of your content that may be displayed in search engine results (meta title). By default it’s the content title (page title, post title…). 69 characters max allowed.', 'wp-meta-seo');
|
63 |
+
|
64 |
+
self::$meta_fields['general']['desc']['title'] = __('Search engine description', 'wp-meta-seo');
|
65 |
+
self::$meta_fields['general']['desc']['description'] = sprintf(__('<span id="metaseo_wpmseo_desc-length">%s</span>'),self::$meta_length_reason);
|
66 |
+
self::$meta_fields['general']['desc']['help'] = sprintf(__('The description of your content that may be displayed in search engine results aka meta description. By default search engine take an excerpt from your content (depending on the search query). 156 characters max allowed.', 'wp-meta-seo'), '<a target="_blank" href="https://www.joomunited.com/wordpress-products/wp-meta-seo">', '</a>');
|
67 |
+
|
68 |
+
self::$meta_fields['social']['opengraph-title']['title'] = __('Facebook Title','wp-meta-seo');
|
69 |
+
self::$meta_fields['social']['opengraph-title']['description'] = __('Custom title to display when sharing this content on facebook, content title override','wp-meta-seo');
|
70 |
+
|
71 |
+
self::$meta_fields['social']['opengraph-desc']['title'] = __('Facebook Description','wp-meta-seo');
|
72 |
+
self::$meta_fields['social']['opengraph-desc']['description'] = __('Custom description to display when sharing this content on facebook, content description override','wp-meta-seo');
|
73 |
+
|
74 |
+
self::$meta_fields['social']['opengraph-image']['title'] = __('Facebook Image','wp-meta-seo');
|
75 |
+
self::$meta_fields['social']['opengraph-image']['description'] = __('Custom image to display when sharing this content on facebook, content description override, recommended size is 1200px x 630px','wp-meta-seo');
|
76 |
+
|
77 |
+
self::$meta_fields['social']['twitter-title']['title'] = __('Twitter Title','wp-meta-seo');
|
78 |
+
self::$meta_fields['social']['twitter-title']['description'] = __('Custom title to display when sharing this content on twitter, content title override','wp-meta-seo');
|
79 |
+
|
80 |
+
self::$meta_fields['social']['twitter-desc']['title'] = __('Twitter Description','wp-meta-seo');
|
81 |
+
self::$meta_fields['social']['twitter-desc']['description'] = __('Custom description to display when sharing this content on twitter, content description override','wp-meta-seo');
|
82 |
+
|
83 |
+
self::$meta_fields['social']['twitter-image']['title'] = __('Twitter Image','wp-meta-seo');
|
84 |
+
self::$meta_fields['social']['twitter-image']['description'] = __('Custom image to display when sharing this content on facebook, content description override, recommended min size 440px X 220px','wp-meta-seo');
|
85 |
+
|
86 |
+
do_action('wpmseo_tab_translate');
|
87 |
+
}
|
88 |
+
|
89 |
+
public function metaseo_enqueue() {
|
90 |
+
global $pagenow;
|
91 |
+
if ((!in_array($pagenow, array(
|
92 |
+
'post-new.php',
|
93 |
+
'post.php',
|
94 |
+
'edit.php',
|
95 |
+
), true) && apply_filters('wpmseo_always_register_metaboxes_on_admin', false) === false ) || $this->is_metabox_hidden() === true
|
96 |
+
) {
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
|
100 |
+
|
101 |
+
$color = get_user_meta(get_current_user_id(), 'admin_color', true);
|
102 |
+
if ('' == $color || in_array($color, array('classic', 'fresh'), true) === false) {
|
103 |
+
$color = 'fresh';
|
104 |
+
}
|
105 |
+
|
106 |
+
if ($pagenow != 'edit.php') {
|
107 |
+
if (0 != get_queried_object_id()) {
|
108 |
+
wp_enqueue_media(array('post' => get_queried_object_id())); // Enqueue files needed for upload functionality.
|
109 |
+
}
|
110 |
+
wp_enqueue_style('m-metabox-tabs', plugins_url('css/metabox-tabs.css', WPMSEO_FILE), array(), WPMSEO_VERSION);
|
111 |
+
wp_enqueue_style('m-style-qtip', plugins_url('css/jquery.qtip.css', WPMSEO_FILE), array(), WPMSEO_VERSION);
|
112 |
+
wp_enqueue_script('jquery-qtip', plugins_url('js/jquery.qtip.min.js', WPMSEO_FILE), array('jquery'), '2.2.1', true);
|
113 |
+
wp_enqueue_script('m-wp-seo-metabox', plugins_url('js/wp-metaseo-metabox.js', WPMSEO_FILE), array('jquery','jquery-ui-core',), WPMSEO_VERSION, true);
|
114 |
+
wp_enqueue_script( 'mwpseo-admin-media', plugins_url( 'js/wp-metaseo-admin-media.js', WPMSEO_FILE ), array('jquery','jquery-ui-core',), WPMSEO_VERSION, true );
|
115 |
+
wp_enqueue_script('metaseo-cliffpyles', plugins_url('js/cliffpyles.js', WPMSEO_FILE), array('jquery'),WPMSEO_VERSION, true);
|
116 |
+
wp_localize_script('m-wp-seo-metabox', 'wpmseoMetaboxL10n', $this->meta_seo_localize_script());
|
117 |
+
wp_localize_script( 'mwpseo-admin-media', 'wpmseoMediaL10n', $this->metaseo_localize_media_script() );
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
public function metaseo_localize_media_script() {
|
122 |
+
return array(
|
123 |
+
'choose_image' => __( 'Use Image', 'wp-meta-seo' ),
|
124 |
+
);
|
125 |
+
}
|
126 |
+
|
127 |
+
public function meta_seo_localize_script() {
|
128 |
+
$post = $this->get_metabox_post();
|
129 |
+
|
130 |
+
if ((!is_object($post) || !isset($post->post_type) ) || $this->is_metabox_hidden($post->post_type) === true) {
|
131 |
+
return array();
|
132 |
+
}
|
133 |
+
|
134 |
+
$options = get_option('wpmseo_titles');
|
135 |
+
|
136 |
+
$date = '';
|
137 |
+
if (isset($options['showdate-' . $post->post_type]) && $options['showdate-' . $post->post_type] === true) {
|
138 |
+
$date = $this->get_post_date($post);
|
139 |
+
|
140 |
+
self::$meta_length = ( self::$meta_length - ( strlen($date) + 5 ) );
|
141 |
+
self::$meta_length_reason = __(' (because of date display)', 'wp-meta-seo');
|
142 |
+
}
|
143 |
+
|
144 |
+
self::$meta_length_reason = apply_filters('wpmseo_desc_length_reason', self::$meta_length_reason, $post);
|
145 |
+
self::$meta_length = apply_filters('wpmseo_desc_length', self::$meta_length, $post);
|
146 |
+
|
147 |
+
unset($date);
|
148 |
+
|
149 |
+
$title_template = '';
|
150 |
+
if (isset($options['title-' . $post->post_type]) && $options['title-' . $post->post_type] !== '') {
|
151 |
+
$title_template = $options['title-' . $post->post_type];
|
152 |
+
}
|
153 |
+
|
154 |
+
// If there's no title template set, use the default, otherwise title preview won't work.
|
155 |
+
if ($title_template == '') {
|
156 |
+
$title_template = '%%title%% - %%sitename%%';
|
157 |
+
}
|
158 |
+
|
159 |
+
$desc_template = '';
|
160 |
+
if (isset($options['desc-' . $post->post_type]) && $options['desc-' . $post->post_type] !== '') {
|
161 |
+
$desc_template = $options['desc-' . $post->post_type];
|
162 |
+
}
|
163 |
+
|
164 |
+
$sample_permalink = get_sample_permalink($post->ID);
|
165 |
+
$sample_permalink = str_replace('%page', '%post', $sample_permalink[0]);
|
166 |
+
|
167 |
+
$cached_replacement_vars = array();
|
168 |
+
|
169 |
+
$vars_to_cache = array(
|
170 |
+
'date',
|
171 |
+
'id',
|
172 |
+
'sitename',
|
173 |
+
'sitedesc',
|
174 |
+
'sep',
|
175 |
+
'page',
|
176 |
+
'currenttime',
|
177 |
+
'currentdate',
|
178 |
+
'currentday',
|
179 |
+
'currentmonth',
|
180 |
+
'currentyear',
|
181 |
+
);
|
182 |
+
|
183 |
+
foreach ($vars_to_cache as $var) {
|
184 |
+
$cached_replacement_vars[$var] = $var;
|
185 |
+
}
|
186 |
+
|
187 |
+
return array_merge($cached_replacement_vars, array(
|
188 |
+
'field_prefix' => self::$form_prefix,
|
189 |
+
'choose_image' => __('Use Image', 'wp-meta-seo'),
|
190 |
+
'wpmseo_meta_desc_length' => self::$meta_length,
|
191 |
+
'wpmseo_meta_title_length' => self::$meta_title_length,
|
192 |
+
'wpmseo_title_template' => $title_template,
|
193 |
+
'wpmseo_desc_template' => $desc_template,
|
194 |
+
'wpmseo_permalink_template' => $sample_permalink,
|
195 |
+
'wpmseo_keyword_suggest_nonce' => wp_create_nonce('wpmseo-get-suggest'),
|
196 |
+
'wpmseo_replace_vars_nonce' => wp_create_nonce('wpmseo-replace-vars'),
|
197 |
+
'no_parent_text' => __('(no parent)', 'wp-meta-seo'),
|
198 |
+
));
|
199 |
+
}
|
200 |
+
|
201 |
+
function is_metabox_hidden($post_type = null) {
|
202 |
+
if (!isset($post_type)) {
|
203 |
+
if (isset($GLOBALS['post']) && ( is_object($GLOBALS['post']) && isset($GLOBALS['post']->post_type) )) {
|
204 |
+
$post_type = $GLOBALS['post']->post_type;
|
205 |
+
} elseif (isset($_GET['post_type']) && $_GET['post_type'] !== '') {
|
206 |
+
$post_type = sanitize_text_field($_GET['post_type']);
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
if (isset($post_type)) {
|
211 |
+
// Don't make static as post_types may still be added during the run.
|
212 |
+
$cpts = get_post_types(array('public' => true), 'names');
|
213 |
+
$options = get_option('wpmseo_titles');
|
214 |
+
|
215 |
+
return ( ( isset($options['hideeditbox-' . $post_type]) && $options['hideeditbox-' . $post_type] === true ) || in_array($post_type, $cpts) === false );
|
216 |
+
}
|
217 |
+
return false;
|
218 |
+
}
|
219 |
+
|
220 |
+
public function add_meta_box() {
|
221 |
+
$post_types = get_post_types(array('public' => true));
|
222 |
+
|
223 |
+
if (is_array($post_types) && $post_types !== array()) {
|
224 |
+
foreach ($post_types as $post_type) {
|
225 |
+
if ($this->is_metabox_hidden($post_type) === false) {
|
226 |
+
add_meta_box('wpmseo_meta', 'WP Meta SEO - Page optimization', array(
|
227 |
+
$this,
|
228 |
+
'meta_box',
|
229 |
+
), $post_type, 'normal', apply_filters('wpmseo_metabox_prio', 'high'));
|
230 |
+
}
|
231 |
+
}
|
232 |
+
}
|
233 |
+
}
|
234 |
+
|
235 |
+
function meta_box() {
|
236 |
+
$post = $this->get_metabox_post();
|
237 |
+
?>
|
238 |
+
<div class="wpmseo-metabox-tabs-div">
|
239 |
+
<ul class="wpmseo-metabox-tabs" id="wpmseo-metabox-tabs">
|
240 |
+
<li class="general">
|
241 |
+
<a class="wpmseo_tablink" data-link="wpmseo_general"><?php _e('SEO Page optimization', 'wp-meta-seo'); ?></a>
|
242 |
+
</li>
|
243 |
+
<li class="social">
|
244 |
+
<a class="wpmseo_tablink" data-link="wpmseo_social"><?php _e( 'Social for search engine', 'wordpress-seo' ) ?></a>
|
245 |
+
</li>
|
246 |
+
<?php do_action('wpmseo_tab_header'); ?>
|
247 |
+
</ul>
|
248 |
+
<?php
|
249 |
+
$content = '';
|
250 |
+
if (is_object($post) && isset($post->post_type)) {
|
251 |
+
foreach ($this->get_meta_field_defs('general', $post->post_type) as $key => $meta_field) {
|
252 |
+
$content .= $this->do_meta_box($meta_field, $key);
|
253 |
+
}
|
254 |
+
unset($key, $meta_field);
|
255 |
+
}
|
256 |
+
$this->do_tab('general', __('General', 'wp-meta-seo'), $content);
|
257 |
+
|
258 |
+
$content = '';
|
259 |
+
foreach ( $this->get_meta_field_defs( 'social' ) as $meta_key => $meta_field ) {
|
260 |
+
$content .= $this->do_meta_box( $meta_field, $meta_key );
|
261 |
+
}
|
262 |
+
|
263 |
+
$this->do_tab( 'social', __( 'Social', 'wordpress-seo' ), $content );
|
264 |
+
do_action('wpmseo_tab_content');
|
265 |
+
|
266 |
+
echo '</div>';
|
267 |
+
}
|
268 |
+
|
269 |
+
function metaseo_check_headingtitle($post,$meta_title){
|
270 |
+
if($meta_title != ''){
|
271 |
+
$words_meta_title = preg_split('~[^\p{L}\p{N}\']+~u',strtolower($meta_title));//explode(' ' , strtolower($meta_title));
|
272 |
+
$words_post_title = preg_split('~[^\p{L}\p{N}\']+~u',strtolower($post->post_title)); //explode(' ' , strtolower($post->post_title));
|
273 |
+
|
274 |
+
|
275 |
+
$test = false;
|
276 |
+
if(is_array($words_meta_title) && is_array($words_post_title)){
|
277 |
+
foreach ($words_meta_title as $mtitle){
|
278 |
+
if(in_array($mtitle, $words_post_title)){
|
279 |
+
$test = true;
|
280 |
+
}
|
281 |
+
}
|
282 |
+
}else{
|
283 |
+
$test = false;
|
284 |
+
}
|
285 |
+
|
286 |
+
if($test){
|
287 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Page title word in content heading','wp-meta-seo').'</div>';
|
288 |
+
$this->perc_score++;
|
289 |
+
}else{
|
290 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Page title word in content heading','wp-meta-seo').'</div>';
|
291 |
+
}
|
292 |
+
|
293 |
+
}else{
|
294 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Page title word in content heading','wp-meta-seo').'</div>';
|
295 |
+
$this->perc_score++;
|
296 |
+
}
|
297 |
+
return $output;
|
298 |
+
}
|
299 |
+
|
300 |
+
function metaseo_check_content($post){
|
301 |
+
$words_meta_title = preg_split('~[^\p{L}\p{N}\']+~u',strtolower($post->post_title));
|
302 |
+
$words_post_content = preg_split('~[^\p{L}\p{N}\']+~u',strtolower($post->post_content));
|
303 |
+
|
304 |
+
$test1 = false;
|
305 |
+
if(is_array($words_meta_title) && is_array($words_post_content)){
|
306 |
+
foreach ($words_meta_title as $mtitle){
|
307 |
+
if(in_array($mtitle, $words_post_content)){
|
308 |
+
$test1 = true;
|
309 |
+
}
|
310 |
+
}
|
311 |
+
}else{
|
312 |
+
$test1 = false;
|
313 |
+
}
|
314 |
+
|
315 |
+
if($test1){
|
316 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Page title word in content','wp-meta-seo').'</div>';
|
317 |
+
$this->perc_score++;
|
318 |
+
}else{
|
319 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Page title word in content','wp-meta-seo').'</div>';
|
320 |
+
}
|
321 |
+
|
322 |
+
return $output;
|
323 |
+
}
|
324 |
+
|
325 |
+
function metaseo_check_pageurl($post){
|
326 |
+
$pageurl = get_permalink($post->ID);
|
327 |
+
$info = pathinfo($pageurl);
|
328 |
+
|
329 |
+
if($info['filename'] == sanitize_title($post->post_title)){
|
330 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Page url matches with page title','wp-meta-seo').'</div>';
|
331 |
+
$this->perc_score++;
|
332 |
+
}else{
|
333 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Page url matches with page title','wp-meta-seo').'</div>';
|
334 |
+
}
|
335 |
+
|
336 |
+
return $output;
|
337 |
+
}
|
338 |
+
|
339 |
+
function metaseo_check_metatitle($meta_title){
|
340 |
+
if($meta_title != '' && strlen($meta_title) <= self::$meta_title_length){
|
341 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Meta title filled','wp-meta-seo').'</div>';
|
342 |
+
$this->perc_score++;
|
343 |
+
}else{
|
344 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Meta title filled','wp-meta-seo').'</div>';
|
345 |
+
}
|
346 |
+
return $output;
|
347 |
+
}
|
348 |
+
|
349 |
+
function metaseo_check_metadesc($meta_desc){
|
350 |
+
if($meta_desc != '' && strlen($meta_desc) <= self::$meta_length){
|
351 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Meta description filled','wp-meta-seo').'</div>';
|
352 |
+
$this->perc_score++;
|
353 |
+
}else{
|
354 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Meta description filled','wp-meta-seo').'</div>';
|
355 |
+
}
|
356 |
+
return $output;
|
357 |
+
}
|
358 |
+
|
359 |
+
function metaseo_check_imageresize($content){
|
360 |
+
if($content == '') {
|
361 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Wrong image resize','wp-meta-seo').'</div>';
|
362 |
+
$this->perc_score++;
|
363 |
+
return $output;
|
364 |
+
}
|
365 |
+
$dom = new DOMDocument;
|
366 |
+
if ($dom->loadHTML($content)) {
|
367 |
+
// Extracting the specified elements from the web page
|
368 |
+
$tags = $dom->getElementsByTagName('img');
|
369 |
+
$img_wrong = false;
|
370 |
+
foreach($tags as $order => $tag){
|
371 |
+
$src = $tag->getAttribute('src');
|
372 |
+
$b = strrpos($src, '-');
|
373 |
+
$e = strrpos($src, '.');
|
374 |
+
$string_wh = substr($src, $b+1 , $e-$b-1);
|
375 |
+
$array_wh = explode('x', $string_wh);
|
376 |
+
if(!empty($array_wh[0]) && !empty($array_wh[1])){
|
377 |
+
if(((int)$array_wh[0] != (int)$tag->getAttribute('width')) || ((int)$array_wh[1] != (int)$tag->getAttribute('height'))){
|
378 |
+
$img_wrong = true;
|
379 |
+
}
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
if($img_wrong){
|
384 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Wrong image resize','wp-meta-seo').'</div>';
|
385 |
+
}else{
|
386 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Wrong image resize','wp-meta-seo').'</div>';
|
387 |
+
$this->perc_score++;
|
388 |
+
}
|
389 |
+
|
390 |
+
}else{
|
391 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Wrong image resize','wp-meta-seo').'</div>';
|
392 |
+
}
|
393 |
+
return $output;
|
394 |
+
}
|
395 |
+
|
396 |
+
function metaseo_check_imagealt($content){
|
397 |
+
if($content == '') {
|
398 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Image have meta title or alt','wp-meta-seo').'</div>';
|
399 |
+
$this->perc_score++;
|
400 |
+
return $output;
|
401 |
+
}
|
402 |
+
$dom = new DOMDocument;
|
403 |
+
if ($dom->loadHTML($content)) {
|
404 |
+
// Extracting the specified elements from the web page
|
405 |
+
$tags = $dom->getElementsByTagName('img');
|
406 |
+
$img_wrong = false;
|
407 |
+
foreach($tags as $order => $tag){
|
408 |
+
$image_title = $tag->getAttribute('title');
|
409 |
+
$image_alt = $tag->getAttribute('alt');
|
410 |
+
if($image_title == '' || $image_alt == ''){
|
411 |
+
$img_wrong = true;
|
412 |
+
}
|
413 |
+
}
|
414 |
+
|
415 |
+
if($img_wrong){
|
416 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Image have meta title or alt','wp-meta-seo').'</div>';
|
417 |
+
}else{
|
418 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before dashicons-yes"></div>'.__('Image have meta title or alt','wp-meta-seo').'</div>';
|
419 |
+
$this->perc_score++;
|
420 |
+
}
|
421 |
+
|
422 |
+
}else{
|
423 |
+
$output = '<div class="metaseo_analysis"><div class="metaseo-dashicons dashicons-before icons-mwarning"></div>'.__('Image have meta title or alt','wp-meta-seo').'</div>';
|
424 |
+
}
|
425 |
+
return $output;
|
426 |
+
}
|
427 |
+
|
428 |
+
function metaseo_page_analysis($post) {
|
429 |
+
$meta_title = get_post_meta($post->ID, '_metaseo_metatitle', true);
|
430 |
+
$meta_desc = get_post_meta($post->ID, '_metaseo_metadesc', true);
|
431 |
+
$headingtitle = $this->metaseo_check_headingtitle($post,$meta_title);
|
432 |
+
$contenttitle = $this->metaseo_check_content($post);
|
433 |
+
$output_pageurl = $this->metaseo_check_pageurl($post);
|
434 |
+
$output_metatitle = $this->metaseo_check_metatitle($meta_title);
|
435 |
+
$output_metadesc = $this->metaseo_check_metadesc($meta_desc);
|
436 |
+
$output_imagewrong = $this->metaseo_check_imageresize($post->post_content);
|
437 |
+
$output_imagealt = $this->metaseo_check_imagealt($post->post_content);
|
438 |
+
|
439 |
+
$output = '';
|
440 |
+
$circliful = ceil(100*($this->perc_score)/7);
|
441 |
+
//$output .= '<div class="metaseo_right"><div id="metaseo_circliful"data-dimension="250" data-text="'.$circliful.'%" data-info="" data-width="20" data-fontsize="38" data-percent="'.$circliful.'" data-fgcolor="#7bd095" data-bgcolor="#e5e5e5" style="color:#7bd095" ></div><div>';
|
442 |
+
$output .= '<div class="metaseo_left">
|
443 |
+
<div class="metaseo-progress-bar">
|
444 |
+
<canvas id="inactiveProgress" class="metaseo-progress-inactive" height="275px" width="275px"></canvas>
|
445 |
+
<canvas id="activeProgress" class="metaseo-progress-active" height="275px" width="275px"></canvas>
|
446 |
+
<p>0%</p>
|
447 |
+
</div>
|
448 |
+
<input type="hidden" id="progressController" value="'.$circliful.'" />
|
449 |
+
</div>';
|
450 |
+
|
451 |
+
$output .= '<div class="metaseo_right">';
|
452 |
+
$output .= $headingtitle . $contenttitle . $output_pageurl . $output_metatitle . $output_metadesc . $output_imagewrong . $output_imagealt;
|
453 |
+
$output .= '</div>';
|
454 |
+
|
455 |
+
return $output;
|
456 |
+
}
|
457 |
+
|
458 |
+
function get_sample_permalink( $post ) {
|
459 |
+
if ( ! function_exists( 'get_sample_permalink' ) ) {
|
460 |
+
include_once( ABSPATH . 'wp-admin/includes/post.php' );
|
461 |
+
}
|
462 |
+
|
463 |
+
return get_sample_permalink( $post );
|
464 |
+
}
|
465 |
+
|
466 |
+
public function do_tab($id, $heading, $content) {
|
467 |
+
global $post;
|
468 |
+
?>
|
469 |
+
<div class="wpmseotab <?php echo esc_attr($id) ?>">
|
470 |
+
<p class="reload_analysis"><span class="spinner" style="float: left;"></span><input type="button" name="reload_analysis" id="reload_analysis" class="button button-primary" value="<?php _e('Reload analysis','wp-meta-seo'); ?>"></p>
|
471 |
+
<table class="form-table">
|
472 |
+
<?php echo $content ?>
|
473 |
+
</table>
|
474 |
+
<?php
|
475 |
+
if($id == 'general'){
|
476 |
+
echo $this->metaseo_page_analysis($post);
|
477 |
+
}
|
478 |
+
?>
|
479 |
+
</div>
|
480 |
+
<?php
|
481 |
+
}
|
482 |
+
|
483 |
+
function do_meta_box($meta_field_def, $key = '') {
|
484 |
+
$content = '';
|
485 |
+
$esc_form_key = esc_attr(self::$form_prefix . $key);
|
486 |
+
$post = $this->get_metabox_post();
|
487 |
+
$meta_value = self::get_value($key, $post->ID);
|
488 |
+
|
489 |
+
$class = '';
|
490 |
+
if (isset($meta_field_def['class']) && $meta_field_def['class'] !== '') {
|
491 |
+
$class = ' ' . $meta_field_def['class'];
|
492 |
+
}
|
493 |
+
|
494 |
+
$placeholder = '';
|
495 |
+
if (isset($meta_field_def['placeholder']) && $meta_field_def['placeholder'] !== '') {
|
496 |
+
$placeholder = $meta_field_def['placeholder'];
|
497 |
+
}
|
498 |
+
|
499 |
+
switch ($meta_field_def['type']) {
|
500 |
+
case 'snippetpreview':
|
501 |
+
$content .= $this->snippet();
|
502 |
+
break;
|
503 |
+
|
504 |
+
case 'text':
|
505 |
+
$ac = '';
|
506 |
+
if (isset($meta_field_def['autocomplete']) && $meta_field_def['autocomplete'] === false) {
|
507 |
+
$ac = 'autocomplete="off" ';
|
508 |
+
}
|
509 |
+
if ($placeholder !== '') {
|
510 |
+
$placeholder = ' placeholder="' . esc_attr($placeholder) . '"';
|
511 |
+
}
|
512 |
+
$content .= '<input type="text"' . $placeholder . ' id="' . $esc_form_key . '" ' . $ac . 'name="' . $esc_form_key . '" value="' . esc_attr($meta_value) . '" class="large-text' . $class . '"/><br />';
|
513 |
+
break;
|
514 |
+
|
515 |
+
case 'textarea':
|
516 |
+
$rows = 3;
|
517 |
+
if (isset($meta_field_def['rows']) && $meta_field_def['rows'] > 0) {
|
518 |
+
$rows = $meta_field_def['rows'];
|
519 |
+
}
|
520 |
+
$content .= '<textarea class="large-text' . $class . '" rows="' . esc_attr($rows) . '" id="' . $esc_form_key . '" name="' . $esc_form_key . '">' . esc_textarea($meta_value) . '</textarea>';
|
521 |
+
break;
|
522 |
+
|
523 |
+
case 'select':
|
524 |
+
if (isset($meta_field_def['options']) && is_array($meta_field_def['options']) && $meta_field_def['options'] !== array()) {
|
525 |
+
$content .= '<select name="' . $esc_form_key . '" id="' . $esc_form_key . '" class="metaseo' . $class . '">';
|
526 |
+
foreach ($meta_field_def['options'] as $val => $option) {
|
527 |
+
$selected = selected($meta_value, $val, false);
|
528 |
+
$content .= '<option ' . $selected . ' value="' . esc_attr($val) . '">' . esc_html($option) . '</option>';
|
529 |
+
}
|
530 |
+
unset($val, $option, $selected);
|
531 |
+
$content .= '</select>';
|
532 |
+
}
|
533 |
+
break;
|
534 |
+
|
535 |
+
case 'multiselect':
|
536 |
+
if (isset($meta_field_def['options']) && is_array($meta_field_def['options']) && $meta_field_def['options'] !== array()) {
|
537 |
+
|
538 |
+
// Set $meta_value as $selected_arr.
|
539 |
+
$selected_arr = $meta_value;
|
540 |
+
|
541 |
+
// If the multiselect field is 'meta-robots-adv' we should explode on ,.
|
542 |
+
if ('meta-robots-adv' === $key) {
|
543 |
+
$selected_arr = explode(',', $meta_value);
|
544 |
+
}
|
545 |
+
|
546 |
+
if (!is_array($selected_arr)) {
|
547 |
+
$selected_arr = (array) $selected_arr;
|
548 |
+
}
|
549 |
+
|
550 |
+
$options_count = count($meta_field_def['options']);
|
551 |
+
|
552 |
+
// @todo [JRF => whomever] verify height calculation for older WP versions, was 16x, for WP3.8 20x is more appropriate.
|
553 |
+
$content .= '<select multiple="multiple" size="' . esc_attr($options_count) . '" style="height: ' . esc_attr(( $options_count * 20 ) + 4) . 'px;" name="' . $esc_form_key . '[]" id="' . $esc_form_key . '" class="metaseo' . $class . '">';
|
554 |
+
foreach ($meta_field_def['options'] as $val => $option) {
|
555 |
+
$selected = '';
|
556 |
+
if (in_array($val, $selected_arr)) {
|
557 |
+
$selected = ' selected="selected"';
|
558 |
+
}
|
559 |
+
$content .= '<option ' . $selected . ' value="' . esc_attr($val) . '">' . esc_html($option) . '</option>';
|
560 |
+
}
|
561 |
+
$content .= '</select>';
|
562 |
+
unset($val, $option, $selected, $selected_arr, $options_count);
|
563 |
+
}
|
564 |
+
break;
|
565 |
+
|
566 |
+
case 'checkbox':
|
567 |
+
$checked = checked($meta_value, 'on', false);
|
568 |
+
$expl = ( isset($meta_field_def['expl']) ) ? esc_html($meta_field_def['expl']) : '';
|
569 |
+
$content .= '<label for="' . $esc_form_key . '"><input type="checkbox" id="' . $esc_form_key . '" name="' . $esc_form_key . '" ' . $checked . ' value="on" class="metaseo' . $class . '"/> ' . $expl . '</label><br />';
|
570 |
+
unset($checked, $expl);
|
571 |
+
break;
|
572 |
+
|
573 |
+
case 'radio':
|
574 |
+
if (isset($meta_field_def['options']) && is_array($meta_field_def['options']) && $meta_field_def['options'] !== array()) {
|
575 |
+
foreach ($meta_field_def['options'] as $val => $option) {
|
576 |
+
$checked = checked($meta_value, $val, false);
|
577 |
+
$content .= '<input type="radio" ' . $checked . ' id="' . $esc_form_key . '_' . esc_attr($val) . '" name="' . $esc_form_key . '" value="' . esc_attr($val) . '"/> <label for="' . $esc_form_key . '_' . esc_attr($val) . '">' . esc_html($option) . '</label> ';
|
578 |
+
}
|
579 |
+
unset($val, $option, $checked);
|
580 |
+
}
|
581 |
+
break;
|
582 |
+
|
583 |
+
case 'upload':
|
584 |
+
$content .= '<input id="' . $esc_form_key . '" type="text" size="36" class="' . $class . '" name="' . $esc_form_key . '" value="' . esc_attr($meta_value) . '" />';
|
585 |
+
$content .= '<input id="' . $esc_form_key . '_button" class="wpmseo_image_upload_button button" type="button" value="Upload Image" />';
|
586 |
+
break;
|
587 |
+
}
|
588 |
+
|
589 |
+
|
590 |
+
$html = '';
|
591 |
+
if ($content === '') {
|
592 |
+
$content = apply_filters('wpmseo_do_meta_box_field_' . $key, $content, $meta_value, $esc_form_key, $meta_field_def, $key);
|
593 |
+
}
|
594 |
+
|
595 |
+
if ($content !== '') {
|
596 |
+
|
597 |
+
$label = esc_html($meta_field_def['title']);
|
598 |
+
if (in_array($meta_field_def['type'], array(
|
599 |
+
'snippetpreview',
|
600 |
+
'radio',
|
601 |
+
'checkbox',
|
602 |
+
), true) === false
|
603 |
+
) {
|
604 |
+
$label = '<label for="' . $esc_form_key . '">' . $label . ':</label>';
|
605 |
+
}
|
606 |
+
|
607 |
+
$help = '';
|
608 |
+
if (isset($meta_field_def['help']) && $meta_field_def['help'] !== '') {
|
609 |
+
$help = '<img src="' . plugins_url('img/metaseo_sms.png', WPMSEO_FILE) . '" class="alignright metaseo_help" id="' . esc_attr($key . 'help') . '" alt="' . esc_attr($meta_field_def['help']) . '" />';
|
610 |
+
}
|
611 |
+
|
612 |
+
$html = '
|
613 |
+
<tr>
|
614 |
+
<th scope="row">' . $label . $help . '</th>
|
615 |
+
<td>';
|
616 |
+
|
617 |
+
$html .= $content;
|
618 |
+
|
619 |
+
if (isset($meta_field_def['description'])) {
|
620 |
+
$html .= '<div>' . $meta_field_def['description'] . '</div>';
|
621 |
+
}
|
622 |
+
|
623 |
+
$html .= '
|
624 |
+
</td>
|
625 |
+
</tr>';
|
626 |
+
}
|
627 |
+
return $html;
|
628 |
+
}
|
629 |
+
|
630 |
+
private function get_metabox_post() {
|
631 |
+
if (isset($_GET['post'])) {
|
632 |
+
$post_id = (int) $_GET['post'];
|
633 |
+
$post = get_post($post_id);
|
634 |
+
} else {
|
635 |
+
$post = $GLOBALS['post'];
|
636 |
+
}
|
637 |
+
|
638 |
+
return $post;
|
639 |
+
}
|
640 |
+
|
641 |
+
function snippet() {
|
642 |
+
$post = $this->get_metabox_post();
|
643 |
+
$title = self::get_value('title', $post->ID);
|
644 |
+
$description = self::get_value('desc', $post->ID);
|
645 |
+
|
646 |
+
$snippet_preview = new WPMSEO_Snippet_Preview($post, $title, $description);
|
647 |
+
|
648 |
+
return $snippet_preview->get_content();
|
649 |
+
}
|
650 |
+
|
651 |
+
}
|
652 |
+
|
653 |
+
/* End of class */
|
inc/class.metaseo-snippet-preview.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPMSEO_Snippet_Preview {
|
4 |
+
|
5 |
+
protected $content;
|
6 |
+
protected $options;
|
7 |
+
protected $post;
|
8 |
+
protected $title;
|
9 |
+
protected $description;
|
10 |
+
protected $date = '';
|
11 |
+
protected $url;
|
12 |
+
protected $slug = '';
|
13 |
+
|
14 |
+
public function __construct($post, $title, $description) {
|
15 |
+
$this->post = $post;
|
16 |
+
$this->title = esc_html($title);
|
17 |
+
$this->description = esc_html($description);
|
18 |
+
|
19 |
+
$this->set_date();
|
20 |
+
$this->set_url();
|
21 |
+
$this->set_content();
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Getter for $this->content
|
26 |
+
* @return string html for snippet preview
|
27 |
+
*/
|
28 |
+
public function get_content() {
|
29 |
+
return $this->content;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Sets date if available
|
34 |
+
*/
|
35 |
+
protected function set_date() {
|
36 |
+
if (is_object($this->post) && isset($this->options['showdate-' . $this->post->post_type]) && $this->options['showdate-' . $this->post->post_type] === true) {
|
37 |
+
$date = $this->get_post_date();
|
38 |
+
$this->date = '<span class="date">' . $date . ' - </span>';
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Retrieves a post date when post is published, or return current date when it's not.
|
44 |
+
*
|
45 |
+
* @return string
|
46 |
+
*/
|
47 |
+
protected function get_post_date() {
|
48 |
+
if (isset($this->post->post_date) && $this->post->post_status == 'publish') {
|
49 |
+
$date = date_i18n('j M Y', strtotime($this->post->post_date));
|
50 |
+
} else {
|
51 |
+
$date = date_i18n('j M Y');
|
52 |
+
}
|
53 |
+
|
54 |
+
return (string) $date;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Generates the url that is displayed in the snippet preview.
|
59 |
+
*/
|
60 |
+
protected function set_url() {
|
61 |
+
$this->url = str_replace(array('http://', 'https://'), '', get_bloginfo('url')) . '/';
|
62 |
+
$this->set_slug();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Sets the slug and adds it to the url if the post has been published and the post name exists.
|
67 |
+
*
|
68 |
+
* If the post is set to be the homepage the slug is also not included.
|
69 |
+
*/
|
70 |
+
protected function set_slug() {
|
71 |
+
$frontpage_post_id = (int) ( get_option('page_on_front') );
|
72 |
+
|
73 |
+
if (is_object($this->post) && isset($this->post->post_name) && $this->post->post_name !== '' && $this->post->ID !== $frontpage_post_id) {
|
74 |
+
$this->slug = sanitize_title($this->title);
|
75 |
+
$this->url .= esc_html($this->slug);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Generates the html for the snippet preview and assign it to $this->content.
|
81 |
+
*/
|
82 |
+
protected function set_content() {
|
83 |
+
$content = <<<HTML
|
84 |
+
<div id="wpmseosnippet">
|
85 |
+
<a class="title" id="wpmseosnippet_title" href="#">$this->title</a>
|
86 |
+
<span class="url">$this->url</span>
|
87 |
+
<p class="desc">$this->date<span class="autogen"></span><span class="content">$this->description</span></p>
|
88 |
+
</div>
|
89 |
+
HTML;
|
90 |
+
$this->set_content_through_filter($content);
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Sets the html for the snippet preview through a filter
|
95 |
+
*
|
96 |
+
* @param string $content
|
97 |
+
*/
|
98 |
+
protected function set_content_through_filter($content) {
|
99 |
+
$properties = get_object_vars($this);
|
100 |
+
$properties['desc'] = $properties['description'];
|
101 |
+
$this->content = apply_filters('wpmseo_snippet', $content, $this->post, $properties);
|
102 |
+
}
|
103 |
+
|
104 |
+
}
|
inc/pages/settings.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2 id="wpio_settings"><?php _e('Wp Meta SEO Settings','wp-meta-seo') ?></h2>
|
2 |
+
<form method="post" action="options.php">
|
3 |
+
<?php
|
4 |
+
settings_fields( 'Wp Meta SEO' );
|
5 |
+
do_settings_sections('metaseo_settings');
|
6 |
+
submit_button();
|
7 |
+
?>
|
8 |
+
</form>
|
js/cliffpyles.js
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function ($) {
|
2 |
+
var $pc = $('#progressController');
|
3 |
+
var $pCaption = $('.metaseo-progress-bar p');
|
4 |
+
var iProgress = document.getElementById('inactiveProgress');
|
5 |
+
var aProgress = document.getElementById('activeProgress');
|
6 |
+
var iProgressCTX = iProgress.getContext('2d');
|
7 |
+
|
8 |
+
jQuery('#reload_analysis').on('click',function(){
|
9 |
+
$('.wpmseotab .spinner').css({'visibility':' inherit'}).show();
|
10 |
+
$('.metaseo_right').html('');
|
11 |
+
var title = $('#title').val();
|
12 |
+
var meta_title = $('#metaseo_wpmseo_title').val();
|
13 |
+
var mpageurl = $('#editable-post-name').text();
|
14 |
+
var meta_desc = $('#metaseo_wpmseo_desc').val();
|
15 |
+
var mcontent = '';
|
16 |
+
|
17 |
+
if (typeof tinyMCE !== 'undefined' && tinyMCE.get('content') !== null) {
|
18 |
+
mcontent = tinyMCE.editors.content.getContent();
|
19 |
+
}
|
20 |
+
|
21 |
+
var data = {'title':title , 'meta_title':meta_title , 'mpageurl':mpageurl , 'meta_desc':meta_desc , 'content':mcontent};
|
22 |
+
$.ajax({
|
23 |
+
dataType : 'json',
|
24 |
+
method : 'POST',
|
25 |
+
url : ajaxurl,
|
26 |
+
data: {
|
27 |
+
'action':'metaseo_reload_analysis',
|
28 |
+
'datas': data
|
29 |
+
},
|
30 |
+
success: function(res){
|
31 |
+
if(res != false){
|
32 |
+
$('.wpmseotab .spinner').hide();
|
33 |
+
$('.metaseo_right').html(res.output);
|
34 |
+
$('#progressController').val(res.circliful).change();
|
35 |
+
}
|
36 |
+
}
|
37 |
+
});
|
38 |
+
|
39 |
+
drawInactive(iProgressCTX);
|
40 |
+
});
|
41 |
+
|
42 |
+
drawInactive(iProgressCTX);
|
43 |
+
|
44 |
+
$pc.on('change', function () {
|
45 |
+
var percentage = $(this).val() / 100;
|
46 |
+
drawProgress(aProgress, percentage, $pCaption);
|
47 |
+
});
|
48 |
+
|
49 |
+
function drawInactive(iProgressCTX) {
|
50 |
+
iProgressCTX.lineCap = 'square';
|
51 |
+
|
52 |
+
//outer ring
|
53 |
+
iProgressCTX.beginPath();
|
54 |
+
iProgressCTX.lineWidth = 15;
|
55 |
+
iProgressCTX.strokeStyle = '#e1e1e1';
|
56 |
+
iProgressCTX.arc(137.5, 137.5, 129, 0, 2 * Math.PI);
|
57 |
+
iProgressCTX.stroke();
|
58 |
+
|
59 |
+
//progress bar
|
60 |
+
iProgressCTX.beginPath();
|
61 |
+
iProgressCTX.lineWidth = 0;
|
62 |
+
iProgressCTX.fillStyle = '#e6e6e6';
|
63 |
+
iProgressCTX.arc(137.5, 137.5, 121, 0, 2 * Math.PI);
|
64 |
+
iProgressCTX.fill();
|
65 |
+
|
66 |
+
//progressbar caption
|
67 |
+
iProgressCTX.beginPath();
|
68 |
+
iProgressCTX.lineWidth = 0;
|
69 |
+
iProgressCTX.fillStyle = '#fff';
|
70 |
+
iProgressCTX.arc(137.5, 137.5, 100, 0, 2 * Math.PI);
|
71 |
+
iProgressCTX.fill();
|
72 |
+
|
73 |
+
}
|
74 |
+
function drawProgress(bar, percentage, $pCaption) {
|
75 |
+
var barCTX = bar.getContext("2d");
|
76 |
+
var quarterTurn = Math.PI / 2;
|
77 |
+
var endingAngle = ((2 * percentage) * Math.PI) - quarterTurn;
|
78 |
+
var startingAngle = 0 - quarterTurn;
|
79 |
+
|
80 |
+
bar.width = bar.width;
|
81 |
+
barCTX.lineCap = 'square';
|
82 |
+
|
83 |
+
barCTX.beginPath();
|
84 |
+
barCTX.lineWidth = 20;
|
85 |
+
barCTX.strokeStyle = '#76e1e5';
|
86 |
+
barCTX.arc(137.5, 137.5, 111, startingAngle, endingAngle);
|
87 |
+
barCTX.stroke();
|
88 |
+
|
89 |
+
$pCaption.text((parseInt(percentage * 100, 10)) + '%');
|
90 |
+
}
|
91 |
+
|
92 |
+
var percentage = $pc.val() / 100;
|
93 |
+
drawProgress(aProgress, percentage, $pCaption);
|
94 |
+
|
95 |
+
|
96 |
+
});
|
js/jquery.qtip.min.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/* qTip2 v2.2.1 | Plugins: tips modal viewport svg imagemap ie6 | Styles: core basic css3 | qtip2.com | Licensed MIT | Sat Sep 06 2014 23:12:07 */
|
2 |
+
|
3 |
+
!function(a,b,c){!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):jQuery&&!jQuery.fn.qtip&&a(jQuery)}(function(d){"use strict";function e(a,b,c,e){this.id=c,this.target=a,this.tooltip=F,this.elements={target:a},this._id=S+"-"+c,this.timers={img:{}},this.options=b,this.plugins={},this.cache={event:{},target:d(),disabled:E,attr:e,onTooltip:E,lastClass:""},this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=E}function f(a){return a===F||"object"!==d.type(a)}function g(a){return!(d.isFunction(a)||a&&a.attr||a.length||"object"===d.type(a)&&(a.jquery||a.then))}function h(a){var b,c,e,h;return f(a)?E:(f(a.metadata)&&(a.metadata={type:a.metadata}),"content"in a&&(b=a.content,f(b)||b.jquery||b.done?b=a.content={text:c=g(b)?E:b}:c=b.text,"ajax"in b&&(e=b.ajax,h=e&&e.once!==E,delete b.ajax,b.text=function(a,b){var f=c||d(this).attr(b.options.content.attr)||"Loading...",g=d.ajax(d.extend({},e,{context:b})).then(e.success,F,e.error).then(function(a){return a&&h&&b.set("content.text",a),a},function(a,c,d){b.destroyed||0===a.status||b.set("content.text",c+": "+d)});return h?f:(b.set("content.text",f),g)}),"title"in b&&(d.isPlainObject(b.title)&&(b.button=b.title.button,b.title=b.title.text),g(b.title||E)&&(b.title=E))),"position"in a&&f(a.position)&&(a.position={my:a.position,at:a.position}),"show"in a&&f(a.show)&&(a.show=a.show.jquery?{target:a.show}:a.show===D?{ready:D}:{event:a.show}),"hide"in a&&f(a.hide)&&(a.hide=a.hide.jquery?{target:a.hide}:{event:a.hide}),"style"in a&&f(a.style)&&(a.style={classes:a.style}),d.each(R,function(){this.sanitize&&this.sanitize(a)}),a)}function i(a,b){for(var c,d=0,e=a,f=b.split(".");e=e[f[d++]];)d<f.length&&(c=e);return[c||a,f.pop()]}function j(a,b){var c,d,e;for(c in this.checks)for(d in this.checks[c])(e=new RegExp(d,"i").exec(a))&&(b.push(e),("builtin"===c||this.plugins[c])&&this.checks[c][d].apply(this.plugins[c]||this,b))}function k(a){return V.concat("").join(a?"-"+a+" ":" ")}function l(a,b){return b>0?setTimeout(d.proxy(a,this),b):void a.call(this)}function m(a){this.tooltip.hasClass(ab)||(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this.timers.show=l.call(this,function(){this.toggle(D,a)},this.options.show.delay))}function n(a){if(!this.tooltip.hasClass(ab)&&!this.destroyed){var b=d(a.relatedTarget),c=b.closest(W)[0]===this.tooltip[0],e=b[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==b[0]&&"mouse"===this.options.position.target&&c||this.options.hide.fixed&&/mouse(out|leave|move)/.test(a.type)&&(c||e))try{a.preventDefault(),a.stopImmediatePropagation()}catch(f){}else this.timers.hide=l.call(this,function(){this.toggle(E,a)},this.options.hide.delay,this)}}function o(a){!this.tooltip.hasClass(ab)&&this.options.hide.inactive&&(clearTimeout(this.timers.inactive),this.timers.inactive=l.call(this,function(){this.hide(a)},this.options.hide.inactive))}function p(a){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(a)}function q(a,c,e){d(b.body).delegate(a,(c.split?c:c.join("."+S+" "))+"."+S,function(){var a=y.api[d.attr(this,U)];a&&!a.disabled&&e.apply(a,arguments)})}function r(a,c,f){var g,i,j,k,l,m=d(b.body),n=a[0]===b?m:a,o=a.metadata?a.metadata(f.metadata):F,p="html5"===f.metadata.type&&o?o[f.metadata.name]:F,q=a.data(f.metadata.name||"qtipopts");try{q="string"==typeof q?d.parseJSON(q):q}catch(r){}if(k=d.extend(D,{},y.defaults,f,"object"==typeof q?h(q):F,h(p||o)),i=k.position,k.id=c,"boolean"==typeof k.content.text){if(j=a.attr(k.content.attr),k.content.attr===E||!j)return E;k.content.text=j}if(i.container.length||(i.container=m),i.target===E&&(i.target=n),k.show.target===E&&(k.show.target=n),k.show.solo===D&&(k.show.solo=i.container.closest("body")),k.hide.target===E&&(k.hide.target=n),k.position.viewport===D&&(k.position.viewport=i.container),i.container=i.container.eq(0),i.at=new A(i.at,D),i.my=new A(i.my),a.data(S))if(k.overwrite)a.qtip("destroy",!0);else if(k.overwrite===E)return E;return a.attr(T,c),k.suppress&&(l=a.attr("title"))&&a.removeAttr("title").attr(cb,l).attr("title",""),g=new e(a,k,c,!!j),a.data(S,g),g}function s(a){return a.charAt(0).toUpperCase()+a.slice(1)}function t(a,b){var d,e,f=b.charAt(0).toUpperCase()+b.slice(1),g=(b+" "+rb.join(f+" ")+f).split(" "),h=0;if(qb[b])return a.css(qb[b]);for(;d=g[h++];)if((e=a.css(d))!==c)return qb[b]=d,e}function u(a,b){return Math.ceil(parseFloat(t(a,b)))}function v(a,b){this._ns="tip",this.options=b,this.offset=b.offset,this.size=[b.width,b.height],this.init(this.qtip=a)}function w(a,b){this.options=b,this._ns="-modal",this.init(this.qtip=a)}function x(a){this._ns="ie6",this.init(this.qtip=a)}var y,z,A,B,C,D=!0,E=!1,F=null,G="x",H="y",I="width",J="height",K="top",L="left",M="bottom",N="right",O="center",P="flipinvert",Q="shift",R={},S="qtip",T="data-hasqtip",U="data-qtip-id",V=["ui-widget","ui-tooltip"],W="."+S,X="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),Y=S+"-fixed",Z=S+"-default",$=S+"-focus",_=S+"-hover",ab=S+"-disabled",bb="_replacedByqTip",cb="oldtitle",db={ie:function(){for(var a=4,c=b.createElement("div");(c.innerHTML="<!--[if gt IE "+a+"]><i></i><![endif]-->")&&c.getElementsByTagName("i")[0];a+=1);return a>4?a:0/0}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||E};z=e.prototype,z._when=function(a){return d.when.apply(d,a)},z.render=function(a){if(this.rendered||this.destroyed)return this;var b,c=this,e=this.options,f=this.cache,g=this.elements,h=e.content.text,i=e.content.title,j=e.content.button,k=e.position,l=("."+this._id+" ",[]);return d.attr(this.target[0],"aria-describedby",this._id),f.posClass=this._createPosClass((this.position={my:k.my,at:k.at}).my),this.tooltip=g.tooltip=b=d("<div/>",{id:this._id,"class":[S,Z,e.style.classes,f.posClass].join(" "),width:e.style.width||"",height:e.style.height||"",tracking:"mouse"===k.target&&k.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":E,"aria-describedby":this._id+"-content","aria-hidden":D}).toggleClass(ab,this.disabled).attr(U,this.id).data(S,this).appendTo(k.container).append(g.content=d("<div />",{"class":S+"-content",id:this._id+"-content","aria-atomic":D})),this.rendered=-1,this.positioning=D,i&&(this._createTitle(),d.isFunction(i)||l.push(this._updateTitle(i,E))),j&&this._createButton(),d.isFunction(h)||l.push(this._updateContent(h,E)),this.rendered=D,this._setWidget(),d.each(R,function(a){var b;"render"===this.initialize&&(b=this(c))&&(c.plugins[a]=b)}),this._unassignEvents(),this._assignEvents(),this._when(l).then(function(){c._trigger("render"),c.positioning=E,c.hiddenDuringWait||!e.show.ready&&!a||c.toggle(D,f.event,E),c.hiddenDuringWait=E}),y.api[this.id]=this,this},z.destroy=function(a){function b(){if(!this.destroyed){this.destroyed=D;var a,b=this.target,c=b.attr(cb);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove(),d.each(this.plugins,function(){this.destroy&&this.destroy()});for(a in this.timers)clearTimeout(this.timers[a]);b.removeData(S).removeAttr(U).removeAttr(T).removeAttr("aria-describedby"),this.options.suppress&&c&&b.attr("title",c).removeAttr(cb),this._unassignEvents(),this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=F,delete y.api[this.id]}}return this.destroyed?this.target:(a===D&&"hide"!==this.triggering||!this.rendered?b.call(this):(this.tooltip.one("tooltiphidden",d.proxy(b,this)),!this.triggering&&this.hide()),this.target)},B=z.checks={builtin:{"^id$":function(a,b,c,e){var f=c===D?y.nextid:c,g=S+"-"+f;f!==E&&f.length>0&&!d("#"+g).length?(this._id=g,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):a[b]=e},"^prerender":function(a,b,c){c&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(a,b,c){this._updateContent(c)},"^content.attr$":function(a,b,c,d){this.options.content.text===this.target.attr(d)&&this._updateContent(this.target.attr(c))},"^content.title$":function(a,b,c){return c?(c&&!this.elements.title&&this._createTitle(),void this._updateTitle(c)):this._removeTitle()},"^content.button$":function(a,b,c){this._updateButton(c)},"^content.title.(text|button)$":function(a,b,c){this.set("content."+b,c)},"^position.(my|at)$":function(a,b,c){"string"==typeof c&&(this.position[b]=a[b]=new A(c,"at"===b))},"^position.container$":function(a,b,c){this.rendered&&this.tooltip.appendTo(c)},"^show.ready$":function(a,b,c){c&&(!this.rendered&&this.render(D)||this.toggle(D))},"^style.classes$":function(a,b,c,d){this.rendered&&this.tooltip.removeClass(d).addClass(c)},"^style.(width|height)":function(a,b,c){this.rendered&&this.tooltip.css(b,c)},"^style.widget|content.title":function(){this.rendered&&this._setWidget()},"^style.def":function(a,b,c){this.rendered&&this.tooltip.toggleClass(Z,!!c)},"^events.(render|show|move|hide|focus|blur)$":function(a,b,c){this.rendered&&this.tooltip[(d.isFunction(c)?"":"un")+"bind"]("tooltip"+b,c)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){if(this.rendered){var a=this.options.position;this.tooltip.attr("tracking","mouse"===a.target&&a.adjust.mouse),this._unassignEvents(),this._assignEvents()}}}},z.get=function(a){if(this.destroyed)return this;var b=i(this.options,a.toLowerCase()),c=b[0][b[1]];return c.precedance?c.string():c};var eb=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,fb=/^prerender|show\.ready/i;z.set=function(a,b){if(this.destroyed)return this;{var c,e=this.rendered,f=E,g=this.options;this.checks}return"string"==typeof a?(c=a,a={},a[c]=b):a=d.extend({},a),d.each(a,function(b,c){if(e&&fb.test(b))return void delete a[b];var h,j=i(g,b.toLowerCase());h=j[0][j[1]],j[0][j[1]]=c&&c.nodeType?d(c):c,f=eb.test(b)||f,a[b]=[j[0],j[1],c,h]}),h(g),this.positioning=D,d.each(a,d.proxy(j,this)),this.positioning=E,this.rendered&&this.tooltip[0].offsetWidth>0&&f&&this.reposition("mouse"===g.position.target?F:this.cache.event),this},z._update=function(a,b){var c=this,e=this.cache;return this.rendered&&a?(d.isFunction(a)&&(a=a.call(this.elements.target,e.event,this)||""),d.isFunction(a.then)?(e.waiting=D,a.then(function(a){return e.waiting=E,c._update(a,b)},F,function(a){return c._update(a,b)})):a===E||!a&&""!==a?E:(a.jquery&&a.length>0?b.empty().append(a.css({display:"block",visibility:"visible"})):b.html(a),this._waitForContent(b).then(function(a){c.rendered&&c.tooltip[0].offsetWidth>0&&c.reposition(e.event,!a.length)}))):E},z._waitForContent=function(a){var b=this.cache;return b.waiting=D,(d.fn.imagesLoaded?a.imagesLoaded():d.Deferred().resolve([])).done(function(){b.waiting=E}).promise()},z._updateContent=function(a,b){this._update(a,this.elements.content,b)},z._updateTitle=function(a,b){this._update(a,this.elements.title,b)===E&&this._removeTitle(E)},z._createTitle=function(){var a=this.elements,b=this._id+"-title";a.titlebar&&this._removeTitle(),a.titlebar=d("<div />",{"class":S+"-titlebar "+(this.options.style.widget?k("header"):"")}).append(a.title=d("<div />",{id:b,"class":S+"-title","aria-atomic":D})).insertBefore(a.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(a){d(this).toggleClass("ui-state-active ui-state-focus","down"===a.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(a){d(this).toggleClass("ui-state-hover","mouseover"===a.type)}),this.options.content.button&&this._createButton()},z._removeTitle=function(a){var b=this.elements;b.title&&(b.titlebar.remove(),b.titlebar=b.title=b.button=F,a!==E&&this.reposition())},z._createPosClass=function(a){return S+"-pos-"+(a||this.options.position.my).abbrev()},z.reposition=function(c,e){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=D;var f,g,h,i,j=this.cache,k=this.tooltip,l=this.options.position,m=l.target,n=l.my,o=l.at,p=l.viewport,q=l.container,r=l.adjust,s=r.method.split(" "),t=k.outerWidth(E),u=k.outerHeight(E),v=0,w=0,x=k.css("position"),y={left:0,top:0},z=k[0].offsetWidth>0,A=c&&"scroll"===c.type,B=d(a),C=q[0].ownerDocument,F=this.mouse;if(d.isArray(m)&&2===m.length)o={x:L,y:K},y={left:m[0],top:m[1]};else if("mouse"===m)o={x:L,y:K},(!r.mouse||this.options.hide.distance)&&j.origin&&j.origin.pageX?c=j.origin:!c||c&&("resize"===c.type||"scroll"===c.type)?c=j.event:F&&F.pageX&&(c=F),"static"!==x&&(y=q.offset()),C.body.offsetWidth!==(a.innerWidth||C.documentElement.clientWidth)&&(g=d(b.body).offset()),y={left:c.pageX-y.left+(g&&g.left||0),top:c.pageY-y.top+(g&&g.top||0)},r.mouse&&A&&F&&(y.left-=(F.scrollX||0)-B.scrollLeft(),y.top-=(F.scrollY||0)-B.scrollTop());else{if("event"===m?c&&c.target&&"scroll"!==c.type&&"resize"!==c.type?j.target=d(c.target):c.target||(j.target=this.elements.target):"event"!==m&&(j.target=d(m.jquery?m:this.elements.target)),m=j.target,m=d(m).eq(0),0===m.length)return this;m[0]===b||m[0]===a?(v=db.iOS?a.innerWidth:m.width(),w=db.iOS?a.innerHeight:m.height(),m[0]===a&&(y={top:(p||m).scrollTop(),left:(p||m).scrollLeft()})):R.imagemap&&m.is("area")?f=R.imagemap(this,m,o,R.viewport?s:E):R.svg&&m&&m[0].ownerSVGElement?f=R.svg(this,m,o,R.viewport?s:E):(v=m.outerWidth(E),w=m.outerHeight(E),y=m.offset()),f&&(v=f.width,w=f.height,g=f.offset,y=f.position),y=this.reposition.offset(m,y,q),(db.iOS>3.1&&db.iOS<4.1||db.iOS>=4.3&&db.iOS<4.33||!db.iOS&&"fixed"===x)&&(y.left-=B.scrollLeft(),y.top-=B.scrollTop()),(!f||f&&f.adjustable!==E)&&(y.left+=o.x===N?v:o.x===O?v/2:0,y.top+=o.y===M?w:o.y===O?w/2:0)}return y.left+=r.x+(n.x===N?-t:n.x===O?-t/2:0),y.top+=r.y+(n.y===M?-u:n.y===O?-u/2:0),R.viewport?(h=y.adjusted=R.viewport(this,y,l,v,w,t,u),g&&h.left&&(y.left+=g.left),g&&h.top&&(y.top+=g.top),h.my&&(this.position.my=h.my)):y.adjusted={left:0,top:0},j.posClass!==(i=this._createPosClass(this.position.my))&&k.removeClass(j.posClass).addClass(j.posClass=i),this._trigger("move",[y,p.elem||p],c)?(delete y.adjusted,e===E||!z||isNaN(y.left)||isNaN(y.top)||"mouse"===m||!d.isFunction(l.effect)?k.css(y):d.isFunction(l.effect)&&(l.effect.call(k,this,d.extend({},y)),k.queue(function(a){d(this).css({opacity:"",height:""}),db.ie&&this.style.removeAttribute("filter"),a()})),this.positioning=E,this):this},z.reposition.offset=function(a,c,e){function f(a,b){c.left+=b*a.scrollLeft(),c.top+=b*a.scrollTop()}if(!e[0])return c;var g,h,i,j,k=d(a[0].ownerDocument),l=!!db.ie&&"CSS1Compat"!==b.compatMode,m=e[0];do"static"!==(h=d.css(m,"position"))&&("fixed"===h?(i=m.getBoundingClientRect(),f(k,-1)):(i=d(m).position(),i.left+=parseFloat(d.css(m,"borderLeftWidth"))||0,i.top+=parseFloat(d.css(m,"borderTopWidth"))||0),c.left-=i.left+(parseFloat(d.css(m,"marginLeft"))||0),c.top-=i.top+(parseFloat(d.css(m,"marginTop"))||0),g||"hidden"===(j=d.css(m,"overflow"))||"visible"===j||(g=d(m)));while(m=m.offsetParent);return g&&(g[0]!==k[0]||l)&&f(g,1),c};var gb=(A=z.reposition.Corner=function(a,b){a=(""+a).replace(/([A-Z])/," $1").replace(/middle/gi,O).toLowerCase(),this.x=(a.match(/left|right/i)||a.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(a.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.forceY=!!b;var c=a.charAt(0);this.precedance="t"===c||"b"===c?H:G}).prototype;gb.invert=function(a,b){this[a]=this[a]===L?N:this[a]===N?L:b||this[a]},gb.string=function(a){var b=this.x,c=this.y,d=b!==c?"center"===b||"center"!==c&&(this.precedance===H||this.forceY)?[c,b]:[b,c]:[b];return a!==!1?d.join(" "):d},gb.abbrev=function(){var a=this.string(!1);return a[0].charAt(0)+(a[1]&&a[1].charAt(0)||"")},gb.clone=function(){return new A(this.string(),this.forceY)},z.toggle=function(a,c){var e=this.cache,f=this.options,g=this.tooltip;if(c){if(/over|enter/.test(c.type)&&e.event&&/out|leave/.test(e.event.type)&&f.show.target.add(c.target).length===f.show.target.length&&g.has(c.relatedTarget).length)return this;e.event=d.event.fix(c)}if(this.waiting&&!a&&(this.hiddenDuringWait=D),!this.rendered)return a?this.render(1):this;if(this.destroyed||this.disabled)return this;var h,i,j,k=a?"show":"hide",l=this.options[k],m=(this.options[a?"hide":"show"],this.options.position),n=this.options.content,o=this.tooltip.css("width"),p=this.tooltip.is(":visible"),q=a||1===l.target.length,r=!c||l.target.length<2||e.target[0]===c.target;return(typeof a).search("boolean|number")&&(a=!p),h=!g.is(":animated")&&p===a&&r,i=h?F:!!this._trigger(k,[90]),this.destroyed?this:(i!==E&&a&&this.focus(c),!i||h?this:(d.attr(g[0],"aria-hidden",!a),a?(this.mouse&&(e.origin=d.event.fix(this.mouse)),d.isFunction(n.text)&&this._updateContent(n.text,E),d.isFunction(n.title)&&this._updateTitle(n.title,E),!C&&"mouse"===m.target&&m.adjust.mouse&&(d(b).bind("mousemove."+S,this._storeMouse),C=D),o||g.css("width",g.outerWidth(E)),this.reposition(c,arguments[2]),o||g.css("width",""),l.solo&&("string"==typeof l.solo?d(l.solo):d(W,l.solo)).not(g).not(l.target).qtip("hide",d.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete e.origin,C&&!d(W+'[tracking="true"]:visible',l.solo).not(g).length&&(d(b).unbind("mousemove."+S),C=E),this.blur(c)),j=d.proxy(function(){a?(db.ie&&g[0].style.removeAttribute("filter"),g.css("overflow",""),"string"==typeof l.autofocus&&d(this.options.show.autofocus,g).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):g.css({display:"",visibility:"",opacity:"",left:"",top:""}),this._trigger(a?"visible":"hidden")},this),l.effect===E||q===E?(g[k](),j()):d.isFunction(l.effect)?(g.stop(1,1),l.effect.call(g,this),g.queue("fx",function(a){j(),a()})):g.fadeTo(90,a?1:0,j),a&&l.target.trigger("qtip-"+this.id+"-inactive"),this))},z.show=function(a){return this.toggle(D,a)},z.hide=function(a){return this.toggle(E,a)},z.focus=function(a){if(!this.rendered||this.destroyed)return this;var b=d(W),c=this.tooltip,e=parseInt(c[0].style.zIndex,10),f=y.zindex+b.length;return c.hasClass($)||this._trigger("focus",[f],a)&&(e!==f&&(b.each(function(){this.style.zIndex>e&&(this.style.zIndex=this.style.zIndex-1)}),b.filter("."+$).qtip("blur",a)),c.addClass($)[0].style.zIndex=f),this},z.blur=function(a){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass($),this._trigger("blur",[this.tooltip.css("zIndex")],a),this)},z.disable=function(a){return this.destroyed?this:("toggle"===a?a=!(this.rendered?this.tooltip.hasClass(ab):this.disabled):"boolean"!=typeof a&&(a=D),this.rendered&&this.tooltip.toggleClass(ab,a).attr("aria-disabled",a),this.disabled=!!a,this)},z.enable=function(){return this.disable(E)},z._createButton=function(){var a=this,b=this.elements,c=b.tooltip,e=this.options.content.button,f="string"==typeof e,g=f?e:"Close tooltip";b.button&&b.button.remove(),b.button=e.jquery?e:d("<a />",{"class":"qtip-close "+(this.options.style.widget?"":S+"-icon"),title:g,"aria-label":g}).prepend(d("<span />",{"class":"ui-icon ui-icon-close",html:"×"})),b.button.appendTo(b.titlebar||c).attr("role","button").click(function(b){return c.hasClass(ab)||a.hide(b),E})},z._updateButton=function(a){if(!this.rendered)return E;var b=this.elements.button;a?this._createButton():b.remove()},z._setWidget=function(){var a=this.options.style.widget,b=this.elements,c=b.tooltip,d=c.hasClass(ab);c.removeClass(ab),ab=a?"ui-state-disabled":"qtip-disabled",c.toggleClass(ab,d),c.toggleClass("ui-helper-reset "+k(),a).toggleClass(Z,this.options.style.def&&!a),b.content&&b.content.toggleClass(k("content"),a),b.titlebar&&b.titlebar.toggleClass(k("header"),a),b.button&&b.button.toggleClass(S+"-icon",!a)},z._storeMouse=function(a){return(this.mouse=d.event.fix(a)).type="mousemove",this},z._bind=function(a,b,c,e,f){if(a&&c&&b.length){var g="."+this._id+(e?"-"+e:"");return d(a).bind((b.split?b:b.join(g+" "))+g,d.proxy(c,f||this)),this}},z._unbind=function(a,b){return a&&d(a).unbind("."+this._id+(b?"-"+b:"")),this},z._trigger=function(a,b,c){var e=d.Event("tooltip"+a);return e.originalEvent=c&&d.extend({},c)||this.cache.event||F,this.triggering=a,this.tooltip.trigger(e,[this].concat(b||[])),this.triggering=E,!e.isDefaultPrevented()},z._bindEvents=function(a,b,c,e,f,g){var h=c.filter(e).add(e.filter(c)),i=[];h.length&&(d.each(b,function(b,c){var e=d.inArray(c,a);e>-1&&i.push(a.splice(e,1)[0])}),i.length&&(this._bind(h,i,function(a){var b=this.rendered?this.tooltip[0].offsetWidth>0:!1;(b?g:f).call(this,a)}),c=c.not(h),e=e.not(h))),this._bind(c,a,f),this._bind(e,b,g)},z._assignInitialEvents=function(a){function b(a){return this.disabled||this.destroyed?E:(this.cache.event=a&&d.event.fix(a),this.cache.target=a&&d(a.target),clearTimeout(this.timers.show),void(this.timers.show=l.call(this,function(){this.render("object"==typeof a||c.show.ready)},c.prerender?0:c.show.delay)))}var c=this.options,e=c.show.target,f=c.hide.target,g=c.show.event?d.trim(""+c.show.event).split(" "):[],h=c.hide.event?d.trim(""+c.hide.event).split(" "):[];this._bind(this.elements.target,["remove","removeqtip"],function(){this.destroy(!0)},"destroy"),/mouse(over|enter)/i.test(c.show.event)&&!/mouse(out|leave)/i.test(c.hide.event)&&h.push("mouseleave"),this._bind(e,"mousemove",function(a){this._storeMouse(a),this.cache.onTarget=D}),this._bindEvents(g,h,e,f,b,function(){return this.timers?void clearTimeout(this.timers.show):E}),(c.show.ready||c.prerender)&&b.call(this,a)},z._assignEvents=function(){var c=this,e=this.options,f=e.position,g=this.tooltip,h=e.show.target,i=e.hide.target,j=f.container,k=f.viewport,l=d(b),q=(d(b.body),d(a)),r=e.show.event?d.trim(""+e.show.event).split(" "):[],s=e.hide.event?d.trim(""+e.hide.event).split(" "):[];d.each(e.events,function(a,b){c._bind(g,"toggle"===a?["tooltipshow","tooltiphide"]:["tooltip"+a],b,null,g)}),/mouse(out|leave)/i.test(e.hide.event)&&"window"===e.hide.leave&&this._bind(l,["mouseout","blur"],function(a){/select|option/.test(a.target.nodeName)||a.relatedTarget||this.hide(a)}),e.hide.fixed?i=i.add(g.addClass(Y)):/mouse(over|enter)/i.test(e.show.event)&&this._bind(i,"mouseleave",function(){clearTimeout(this.timers.show)}),(""+e.hide.event).indexOf("unfocus")>-1&&this._bind(j.closest("html"),["mousedown","touchstart"],function(a){var b=d(a.target),c=this.rendered&&!this.tooltip.hasClass(ab)&&this.tooltip[0].offsetWidth>0,e=b.parents(W).filter(this.tooltip[0]).length>0;b[0]===this.target[0]||b[0]===this.tooltip[0]||e||this.target.has(b[0]).length||!c||this.hide(a)}),"number"==typeof e.hide.inactive&&(this._bind(h,"qtip-"+this.id+"-inactive",o,"inactive"),this._bind(i.add(g),y.inactiveEvents,o)),this._bindEvents(r,s,h,i,m,n),this._bind(h.add(g),"mousemove",function(a){if("number"==typeof e.hide.distance){var b=this.cache.origin||{},c=this.options.hide.distance,d=Math.abs;(d(a.pageX-b.pageX)>=c||d(a.pageY-b.pageY)>=c)&&this.hide(a)}this._storeMouse(a)}),"mouse"===f.target&&f.adjust.mouse&&(e.hide.event&&this._bind(h,["mouseenter","mouseleave"],function(a){return this.cache?void(this.cache.onTarget="mouseenter"===a.type):E}),this._bind(l,"mousemove",function(a){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass(ab)&&this.tooltip[0].offsetWidth>0&&this.reposition(a)})),(f.adjust.resize||k.length)&&this._bind(d.event.special.resize?k:q,"resize",p),f.adjust.scroll&&this._bind(q.add(f.container),"scroll",p)},z._unassignEvents=function(){var c=this.options,e=c.show.target,f=c.hide.target,g=d.grep([this.elements.target[0],this.rendered&&this.tooltip[0],c.position.container[0],c.position.viewport[0],c.position.container.closest("html")[0],a,b],function(a){return"object"==typeof a});e&&e.toArray&&(g=g.concat(e.toArray())),f&&f.toArray&&(g=g.concat(f.toArray())),this._unbind(g)._unbind(g,"destroy")._unbind(g,"inactive")},d(function(){q(W,["mouseenter","mouseleave"],function(a){var b="mouseenter"===a.type,c=d(a.currentTarget),e=d(a.relatedTarget||a.target),f=this.options;b?(this.focus(a),c.hasClass(Y)&&!c.hasClass(ab)&&clearTimeout(this.timers.hide)):"mouse"===f.position.target&&f.position.adjust.mouse&&f.hide.event&&f.show.target&&!e.closest(f.show.target[0]).length&&this.hide(a),c.toggleClass(_,b)}),q("["+U+"]",X,o)}),y=d.fn.qtip=function(a,b,e){var f=(""+a).toLowerCase(),g=F,i=d.makeArray(arguments).slice(1),j=i[i.length-1],k=this[0]?d.data(this[0],S):F;return!arguments.length&&k||"api"===f?k:"string"==typeof a?(this.each(function(){var a=d.data(this,S);if(!a)return D;if(j&&j.timeStamp&&(a.cache.event=j),!b||"option"!==f&&"options"!==f)a[f]&&a[f].apply(a,i);else{if(e===c&&!d.isPlainObject(b))return g=a.get(b),E;a.set(b,e)}}),g!==F?g:this):"object"!=typeof a&&arguments.length?void 0:(k=h(d.extend(D,{},a)),this.each(function(a){var b,c;return c=d.isArray(k.id)?k.id[a]:k.id,c=!c||c===E||c.length<1||y.api[c]?y.nextid++:c,b=r(d(this),c,k),b===E?D:(y.api[c]=b,d.each(R,function(){"initialize"===this.initialize&&this(b)}),void b._assignInitialEvents(j))}))},d.qtip=e,y.api={},d.each({attr:function(a,b){if(this.length){var c=this[0],e="title",f=d.data(c,"qtip");if(a===e&&f&&"object"==typeof f&&f.options.suppress)return arguments.length<2?d.attr(c,cb):(f&&f.options.content.attr===e&&f.cache.attr&&f.set("content.text",b),this.attr(cb,b))}return d.fn["attr"+bb].apply(this,arguments)},clone:function(a){var b=(d([]),d.fn["clone"+bb].apply(this,arguments));return a||b.filter("["+cb+"]").attr("title",function(){return d.attr(this,cb)}).removeAttr(cb),b}},function(a,b){if(!b||d.fn[a+bb])return D;var c=d.fn[a+bb]=d.fn[a];d.fn[a]=function(){return b.apply(this,arguments)||c.apply(this,arguments)}}),d.ui||(d["cleanData"+bb]=d.cleanData,d.cleanData=function(a){for(var b,c=0;(b=d(a[c])).length;c++)if(b.attr(T))try{b.triggerHandler("removeqtip")}catch(e){}d["cleanData"+bb].apply(this,arguments)}),y.version="2.2.1",y.nextid=0,y.inactiveEvents=X,y.zindex=15e3,y.defaults={prerender:E,id:E,overwrite:D,suppress:D,content:{text:D,attr:"title",title:E,button:E},position:{my:"top left",at:"bottom right",target:E,container:E,viewport:E,adjust:{x:0,y:0,mouse:D,scroll:D,resize:D,method:"flipinvert flipinvert"},effect:function(a,b){d(this).animate(b,{duration:200,queue:E})}},show:{target:E,event:"mouseenter",effect:D,delay:90,solo:E,ready:E,autofocus:E},hide:{target:E,event:"mouseleave",effect:D,delay:0,fixed:E,inactive:E,leave:"window",distance:E},style:{classes:"",widget:E,width:E,height:E,def:D},events:{render:F,move:F,show:F,hide:F,toggle:F,visible:F,hidden:F,focus:F,blur:F}};var hb,ib="margin",jb="border",kb="color",lb="background-color",mb="transparent",nb=" !important",ob=!!b.createElement("canvas").getContext,pb=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,qb={},rb=["Webkit","O","Moz","ms"];if(ob)var sb=a.devicePixelRatio||1,tb=function(){var a=b.createElement("canvas").getContext("2d");return a.backingStorePixelRatio||a.webkitBackingStorePixelRatio||a.mozBackingStorePixelRatio||a.msBackingStorePixelRatio||a.oBackingStorePixelRatio||1}(),ub=sb/tb;else var vb=function(a,b,c){return"<qtipvml:"+a+' xmlns="urn:schemas-microsoft.com:vml" class="qtip-vml" '+(b||"")+' style="behavior: url(#default#VML); '+(c||"")+'" />'};d.extend(v.prototype,{init:function(a){var b,c;c=this.element=a.elements.tip=d("<div />",{"class":S+"-tip"}).prependTo(a.tooltip),ob?(b=d("<canvas />").appendTo(this.element)[0].getContext("2d"),b.lineJoin="miter",b.miterLimit=1e5,b.save()):(b=vb("shape",'coordorigin="0,0"',"position:absolute;"),this.element.html(b+b),a._bind(d("*",c).add(c),["click","mousedown"],function(a){a.stopPropagation()},this._ns)),a._bind(a.tooltip,"tooltipmove",this.reposition,this._ns,this),this.create()},_swapDimensions:function(){this.size[0]=this.options.height,this.size[1]=this.options.width},_resetDimensions:function(){this.size[0]=this.options.width,this.size[1]=this.options.height},_useTitle:function(a){var b=this.qtip.elements.titlebar;return b&&(a.y===K||a.y===O&&this.element.position().top+this.size[1]/2+this.options.offset<b.outerHeight(D))},_parseCorner:function(a){var b=this.qtip.options.position.my;return a===E||b===E?a=E:a===D?a=new A(b.string()):a.string||(a=new A(a),a.fixed=D),a},_parseWidth:function(a,b,c){var d=this.qtip.elements,e=jb+s(b)+"Width";return(c?u(c,e):u(d.content,e)||u(this._useTitle(a)&&d.titlebar||d.content,e)||u(d.tooltip,e))||0},_parseRadius:function(a){var b=this.qtip.elements,c=jb+s(a.y)+s(a.x)+"Radius";return db.ie<9?0:u(this._useTitle(a)&&b.titlebar||b.content,c)||u(b.tooltip,c)||0},_invalidColour:function(a,b,c){var d=a.css(b);return!d||c&&d===a.css(c)||pb.test(d)?E:d},_parseColours:function(a){var b=this.qtip.elements,c=this.element.css("cssText",""),e=jb+s(a[a.precedance])+s(kb),f=this._useTitle(a)&&b.titlebar||b.content,g=this._invalidColour,h=[];return h[0]=g(c,lb)||g(f,lb)||g(b.content,lb)||g(b.tooltip,lb)||c.css(lb),h[1]=g(c,e,kb)||g(f,e,kb)||g(b.content,e,kb)||g(b.tooltip,e,kb)||b.tooltip.css(e),d("*",c).add(c).css("cssText",lb+":"+mb+nb+";"+jb+":0"+nb+";"),h},_calculateSize:function(a){var b,c,d,e=a.precedance===H,f=this.options.width,g=this.options.height,h="c"===a.abbrev(),i=(e?f:g)*(h?.5:1),j=Math.pow,k=Math.round,l=Math.sqrt(j(i,2)+j(g,2)),m=[this.border/i*l,this.border/g*l];return m[2]=Math.sqrt(j(m[0],2)-j(this.border,2)),m[3]=Math.sqrt(j(m[1],2)-j(this.border,2)),b=l+m[2]+m[3]+(h?0:m[0]),c=b/l,d=[k(c*f),k(c*g)],e?d:d.reverse()},_calculateTip:function(a,b,c){c=c||1,b=b||this.size;var d=b[0]*c,e=b[1]*c,f=Math.ceil(d/2),g=Math.ceil(e/2),h={br:[0,0,d,e,d,0],bl:[0,0,d,0,0,e],tr:[0,e,d,0,d,e],tl:[0,0,0,e,d,e],tc:[0,e,f,0,d,e],bc:[0,0,d,0,f,e],rc:[0,0,d,g,0,e],lc:[d,0,d,e,0,g]};return h.lt=h.br,h.rt=h.bl,h.lb=h.tr,h.rb=h.tl,h[a.abbrev()]},_drawCoords:function(a,b){a.beginPath(),a.moveTo(b[0],b[1]),a.lineTo(b[2],b[3]),a.lineTo(b[4],b[5]),a.closePath()},create:function(){var a=this.corner=(ob||db.ie)&&this._parseCorner(this.options.corner);return(this.enabled=!!this.corner&&"c"!==this.corner.abbrev())&&(this.qtip.cache.corner=a.clone(),this.update()),this.element.toggle(this.enabled),this.corner},update:function(b,c){if(!this.enabled)return this;var e,f,g,h,i,j,k,l,m=this.qtip.elements,n=this.element,o=n.children(),p=this.options,q=this.size,r=p.mimic,s=Math.round;b||(b=this.qtip.cache.corner||this.corner),r===E?r=b:(r=new A(r),r.precedance=b.precedance,"inherit"===r.x?r.x=b.x:"inherit"===r.y?r.y=b.y:r.x===r.y&&(r[b.precedance]=b[b.precedance])),f=r.precedance,b.precedance===G?this._swapDimensions():this._resetDimensions(),e=this.color=this._parseColours(b),e[1]!==mb?(l=this.border=this._parseWidth(b,b[b.precedance]),p.border&&1>l&&!pb.test(e[1])&&(e[0]=e[1]),this.border=l=p.border!==D?p.border:l):this.border=l=0,k=this.size=this._calculateSize(b),n.css({width:k[0],height:k[1],lineHeight:k[1]+"px"}),j=b.precedance===H?[s(r.x===L?l:r.x===N?k[0]-q[0]-l:(k[0]-q[0])/2),s(r.y===K?k[1]-q[1]:0)]:[s(r.x===L?k[0]-q[0]:0),s(r.y===K?l:r.y===M?k[1]-q[1]-l:(k[1]-q[1])/2)],ob?(g=o[0].getContext("2d"),g.restore(),g.save(),g.clearRect(0,0,6e3,6e3),h=this._calculateTip(r,q,ub),i=this._calculateTip(r,this.size,ub),o.attr(I,k[0]*ub).attr(J,k[1]*ub),o.css(I,k[0]).css(J,k[1]),this._drawCoords(g,i),g.fillStyle=e[1],g.fill(),g.translate(j[0]*ub,j[1]*ub),this._drawCoords(g,h),g.fillStyle=e[0],g.fill()):(h=this._calculateTip(r),h="m"+h[0]+","+h[1]+" l"+h[2]+","+h[3]+" "+h[4]+","+h[5]+" xe",j[2]=l&&/^(r|b)/i.test(b.string())?8===db.ie?2:1:0,o.css({coordsize:k[0]+l+" "+(k[1]+l),antialias:""+(r.string().indexOf(O)>-1),left:j[0]-j[2]*Number(f===G),top:j[1]-j[2]*Number(f===H),width:k[0]+l,height:k[1]+l}).each(function(a){var b=d(this);b[b.prop?"prop":"attr"]({coordsize:k[0]+l+" "+(k[1]+l),path:h,fillcolor:e[0],filled:!!a,stroked:!a}).toggle(!(!l&&!a)),!a&&b.html(vb("stroke",'weight="'+2*l+'px" color="'+e[1]+'" miterlimit="1000" joinstyle="miter"'))})),a.opera&&setTimeout(function(){m.tip.css({display:"inline-block",visibility:"visible"})},1),c!==E&&this.calculate(b,k)},calculate:function(a,b){if(!this.enabled)return E;var c,e,f=this,g=this.qtip.elements,h=this.element,i=this.options.offset,j=(g.tooltip.hasClass("ui-widget"),{});return a=a||this.corner,c=a.precedance,b=b||this._calculateSize(a),e=[a.x,a.y],c===G&&e.reverse(),d.each(e,function(d,e){var h,k,l;
|
4 |
+
e===O?(h=c===H?L:K,j[h]="50%",j[ib+"-"+h]=-Math.round(b[c===H?0:1]/2)+i):(h=f._parseWidth(a,e,g.tooltip),k=f._parseWidth(a,e,g.content),l=f._parseRadius(a),j[e]=Math.max(-f.border,d?k:i+(l>h?l:-h)))}),j[a[c]]-=b[c===G?0:1],h.css({margin:"",top:"",bottom:"",left:"",right:""}).css(j),j},reposition:function(a,b,d){function e(a,b,c,d,e){a===Q&&j.precedance===b&&k[d]&&j[c]!==O?j.precedance=j.precedance===G?H:G:a!==Q&&k[d]&&(j[b]=j[b]===O?k[d]>0?d:e:j[b]===d?e:d)}function f(a,b,e){j[a]===O?p[ib+"-"+b]=o[a]=g[ib+"-"+b]-k[b]:(h=g[e]!==c?[k[b],-g[b]]:[-k[b],g[b]],(o[a]=Math.max(h[0],h[1]))>h[0]&&(d[b]-=k[b],o[b]=E),p[g[e]!==c?e:b]=o[a])}if(this.enabled){var g,h,i=b.cache,j=this.corner.clone(),k=d.adjusted,l=b.options.position.adjust.method.split(" "),m=l[0],n=l[1]||l[0],o={left:E,top:E,x:0,y:0},p={};this.corner.fixed!==D&&(e(m,G,H,L,N),e(n,H,G,K,M),(j.string()!==i.corner.string()||i.cornerTop!==k.top||i.cornerLeft!==k.left)&&this.update(j,E)),g=this.calculate(j),g.right!==c&&(g.left=-g.right),g.bottom!==c&&(g.top=-g.bottom),g.user=this.offset,(o.left=m===Q&&!!k.left)&&f(G,L,N),(o.top=n===Q&&!!k.top)&&f(H,K,M),this.element.css(p).toggle(!(o.x&&o.y||j.x===O&&o.y||j.y===O&&o.x)),d.left-=g.left.charAt?g.user:m!==Q||o.top||!o.left&&!o.top?g.left+this.border:0,d.top-=g.top.charAt?g.user:n!==Q||o.left||!o.left&&!o.top?g.top+this.border:0,i.cornerLeft=k.left,i.cornerTop=k.top,i.corner=j.clone()}},destroy:function(){this.qtip._unbind(this.qtip.tooltip,this._ns),this.qtip.elements.tip&&this.qtip.elements.tip.find("*").remove().end().remove()}}),hb=R.tip=function(a){return new v(a,a.options.style.tip)},hb.initialize="render",hb.sanitize=function(a){if(a.style&&"tip"in a.style){var b=a.style.tip;"object"!=typeof b&&(b=a.style.tip={corner:b}),/string|boolean/i.test(typeof b.corner)||(b.corner=D)}},B.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){this.create(),this.qtip.reposition()},"^style.tip.(height|width)$":function(a){this.size=[a.width,a.height],this.update(),this.qtip.reposition()},"^content.title|style.(classes|widget)$":function(){this.update()}},d.extend(D,y.defaults,{style:{tip:{corner:D,mimic:E,width:6,height:6,border:D,offset:0}}});var wb,xb,yb="qtip-modal",zb="."+yb;xb=function(){function a(a){if(d.expr[":"].focusable)return d.expr[":"].focusable;var b,c,e,f=!isNaN(d.attr(a,"tabindex")),g=a.nodeName&&a.nodeName.toLowerCase();return"area"===g?(b=a.parentNode,c=b.name,a.href&&c&&"map"===b.nodeName.toLowerCase()?(e=d("img[usemap=#"+c+"]")[0],!!e&&e.is(":visible")):!1):/input|select|textarea|button|object/.test(g)?!a.disabled:"a"===g?a.href||f:f}function c(a){k.length<1&&a.length?a.not("body").blur():k.first().focus()}function e(a){if(i.is(":visible")){var b,e=d(a.target),h=f.tooltip,j=e.closest(W);b=j.length<1?E:parseInt(j[0].style.zIndex,10)>parseInt(h[0].style.zIndex,10),b||e.closest(W)[0]===h[0]||c(e),g=a.target===k[k.length-1]}}var f,g,h,i,j=this,k={};d.extend(j,{init:function(){return i=j.elem=d("<div />",{id:"qtip-overlay",html:"<div></div>",mousedown:function(){return E}}).hide(),d(b.body).bind("focusin"+zb,e),d(b).bind("keydown"+zb,function(a){f&&f.options.show.modal.escape&&27===a.keyCode&&f.hide(a)}),i.bind("click"+zb,function(a){f&&f.options.show.modal.blur&&f.hide(a)}),j},update:function(b){f=b,k=b.options.show.modal.stealfocus!==E?b.tooltip.find("*").filter(function(){return a(this)}):[]},toggle:function(a,e,g){var k=(d(b.body),a.tooltip),l=a.options.show.modal,m=l.effect,n=e?"show":"hide",o=i.is(":visible"),p=d(zb).filter(":visible:not(:animated)").not(k);return j.update(a),e&&l.stealfocus!==E&&c(d(":focus")),i.toggleClass("blurs",l.blur),e&&i.appendTo(b.body),i.is(":animated")&&o===e&&h!==E||!e&&p.length?j:(i.stop(D,E),d.isFunction(m)?m.call(i,e):m===E?i[n]():i.fadeTo(parseInt(g,10)||90,e?1:0,function(){e||i.hide()}),e||i.queue(function(a){i.css({left:"",top:""}),d(zb).length||i.detach(),a()}),h=e,f.destroyed&&(f=F),j)}}),j.init()},xb=new xb,d.extend(w.prototype,{init:function(a){var b=a.tooltip;return this.options.on?(a.elements.overlay=xb.elem,b.addClass(yb).css("z-index",y.modal_zindex+d(zb).length),a._bind(b,["tooltipshow","tooltiphide"],function(a,c,e){var f=a.originalEvent;if(a.target===b[0])if(f&&"tooltiphide"===a.type&&/mouse(leave|enter)/.test(f.type)&&d(f.relatedTarget).closest(xb.elem[0]).length)try{a.preventDefault()}catch(g){}else(!f||f&&"tooltipsolo"!==f.type)&&this.toggle(a,"tooltipshow"===a.type,e)},this._ns,this),a._bind(b,"tooltipfocus",function(a,c){if(!a.isDefaultPrevented()&&a.target===b[0]){var e=d(zb),f=y.modal_zindex+e.length,g=parseInt(b[0].style.zIndex,10);xb.elem[0].style.zIndex=f-1,e.each(function(){this.style.zIndex>g&&(this.style.zIndex-=1)}),e.filter("."+$).qtip("blur",a.originalEvent),b.addClass($)[0].style.zIndex=f,xb.update(c);try{a.preventDefault()}catch(h){}}},this._ns,this),void a._bind(b,"tooltiphide",function(a){a.target===b[0]&&d(zb).filter(":visible").not(b).last().qtip("focus",a)},this._ns,this)):this},toggle:function(a,b,c){return a&&a.isDefaultPrevented()?this:void xb.toggle(this.qtip,!!b,c)},destroy:function(){this.qtip.tooltip.removeClass(yb),this.qtip._unbind(this.qtip.tooltip,this._ns),xb.toggle(this.qtip,E),delete this.qtip.elements.overlay}}),wb=R.modal=function(a){return new w(a,a.options.show.modal)},wb.sanitize=function(a){a.show&&("object"!=typeof a.show.modal?a.show.modal={on:!!a.show.modal}:"undefined"==typeof a.show.modal.on&&(a.show.modal.on=D))},y.modal_zindex=y.zindex-200,wb.initialize="render",B.modal={"^show.modal.(on|blur)$":function(){this.destroy(),this.init(),this.qtip.elems.overlay.toggle(this.qtip.tooltip[0].offsetWidth>0)}},d.extend(D,y.defaults,{show:{modal:{on:E,effect:D,blur:D,stealfocus:D,escape:D}}}),R.viewport=function(c,d,e,f,g,h,i){function j(a,b,c,e,f,g,h,i,j){var k=d[f],s=u[a],t=v[a],w=c===Q,x=s===f?j:s===g?-j:-j/2,y=t===f?i:t===g?-i:-i/2,z=q[f]+r[f]-(n?0:m[f]),A=z-k,B=k+j-(h===I?o:p)-z,C=x-(u.precedance===a||s===u[b]?y:0)-(t===O?i/2:0);return w?(C=(s===f?1:-1)*x,d[f]+=A>0?A:B>0?-B:0,d[f]=Math.max(-m[f]+r[f],k-C,Math.min(Math.max(-m[f]+r[f]+(h===I?o:p),k+C),d[f],"center"===s?k-x:1e9))):(e*=c===P?2:0,A>0&&(s!==f||B>0)?(d[f]-=C+e,l.invert(a,f)):B>0&&(s!==g||A>0)&&(d[f]-=(s===O?-C:C)+e,l.invert(a,g)),d[f]<q&&-d[f]>B&&(d[f]=k,l=u.clone())),d[f]-k}var k,l,m,n,o,p,q,r,s=e.target,t=c.elements.tooltip,u=e.my,v=e.at,w=e.adjust,x=w.method.split(" "),y=x[0],z=x[1]||x[0],A=e.viewport,B=e.container,C=(c.cache,{left:0,top:0});return A.jquery&&s[0]!==a&&s[0]!==b.body&&"none"!==w.method?(m=B.offset()||C,n="static"===B.css("position"),k="fixed"===t.css("position"),o=A[0]===a?A.width():A.outerWidth(E),p=A[0]===a?A.height():A.outerHeight(E),q={left:k?0:A.scrollLeft(),top:k?0:A.scrollTop()},r=A.offset()||C,("shift"!==y||"shift"!==z)&&(l=u.clone()),C={left:"none"!==y?j(G,H,y,w.x,L,N,I,f,h):0,top:"none"!==z?j(H,G,z,w.y,K,M,J,g,i):0,my:l}):C},R.polys={polygon:function(a,b){var c,d,e,f={width:0,height:0,position:{top:1e10,right:0,bottom:0,left:1e10},adjustable:E},g=0,h=[],i=1,j=1,k=0,l=0;for(g=a.length;g--;)c=[parseInt(a[--g],10),parseInt(a[g+1],10)],c[0]>f.position.right&&(f.position.right=c[0]),c[0]<f.position.left&&(f.position.left=c[0]),c[1]>f.position.bottom&&(f.position.bottom=c[1]),c[1]<f.position.top&&(f.position.top=c[1]),h.push(c);if(d=f.width=Math.abs(f.position.right-f.position.left),e=f.height=Math.abs(f.position.bottom-f.position.top),"c"===b.abbrev())f.position={left:f.position.left+f.width/2,top:f.position.top+f.height/2};else{for(;d>0&&e>0&&i>0&&j>0;)for(d=Math.floor(d/2),e=Math.floor(e/2),b.x===L?i=d:b.x===N?i=f.width-d:i+=Math.floor(d/2),b.y===K?j=e:b.y===M?j=f.height-e:j+=Math.floor(e/2),g=h.length;g--&&!(h.length<2);)k=h[g][0]-f.position.left,l=h[g][1]-f.position.top,(b.x===L&&k>=i||b.x===N&&i>=k||b.x===O&&(i>k||k>f.width-i)||b.y===K&&l>=j||b.y===M&&j>=l||b.y===O&&(j>l||l>f.height-j))&&h.splice(g,1);f.position={left:h[0][0],top:h[0][1]}}return f},rect:function(a,b,c,d){return{width:Math.abs(c-a),height:Math.abs(d-b),position:{left:Math.min(a,c),top:Math.min(b,d)}}},_angles:{tc:1.5,tr:7/4,tl:5/4,bc:.5,br:.25,bl:.75,rc:2,lc:1,c:0},ellipse:function(a,b,c,d,e){var f=R.polys._angles[e.abbrev()],g=0===f?0:c*Math.cos(f*Math.PI),h=d*Math.sin(f*Math.PI);return{width:2*c-Math.abs(g),height:2*d-Math.abs(h),position:{left:a+g,top:b+h},adjustable:E}},circle:function(a,b,c,d){return R.polys.ellipse(a,b,c,c,d)}},R.svg=function(a,c,e){for(var f,g,h,i,j,k,l,m,n,o=(d(b),c[0]),p=d(o.ownerSVGElement),q=o.ownerDocument,r=(parseInt(c.css("stroke-width"),10)||0)/2;!o.getBBox;)o=o.parentNode;if(!o.getBBox||!o.parentNode)return E;switch(o.nodeName){case"ellipse":case"circle":m=R.polys.ellipse(o.cx.baseVal.value,o.cy.baseVal.value,(o.rx||o.r).baseVal.value+r,(o.ry||o.r).baseVal.value+r,e);break;case"line":case"polygon":case"polyline":for(l=o.points||[{x:o.x1.baseVal.value,y:o.y1.baseVal.value},{x:o.x2.baseVal.value,y:o.y2.baseVal.value}],m=[],k=-1,i=l.numberOfItems||l.length;++k<i;)j=l.getItem?l.getItem(k):l[k],m.push.apply(m,[j.x,j.y]);m=R.polys.polygon(m,e);break;default:m=o.getBBox(),m={width:m.width,height:m.height,position:{left:m.x,top:m.y}}}return n=m.position,p=p[0],p.createSVGPoint&&(g=o.getScreenCTM(),l=p.createSVGPoint(),l.x=n.left,l.y=n.top,h=l.matrixTransform(g),n.left=h.x,n.top=h.y),q!==b&&"mouse"!==a.position.target&&(f=d((q.defaultView||q.parentWindow).frameElement).offset(),f&&(n.left+=f.left,n.top+=f.top)),q=d(q),n.left+=q.scrollLeft(),n.top+=q.scrollTop(),m},R.imagemap=function(a,b,c){b.jquery||(b=d(b));var e,f,g,h,i,j=(b.attr("shape")||"rect").toLowerCase().replace("poly","polygon"),k=d('img[usemap="#'+b.parent("map").attr("name")+'"]'),l=d.trim(b.attr("coords")),m=l.replace(/,$/,"").split(",");if(!k.length)return E;if("polygon"===j)h=R.polys.polygon(m,c);else{if(!R.polys[j])return E;for(g=-1,i=m.length,f=[];++g<i;)f.push(parseInt(m[g],10));h=R.polys[j].apply(this,f.concat(c))}return e=k.offset(),e.left+=Math.ceil((k.outerWidth(E)-k.width())/2),e.top+=Math.ceil((k.outerHeight(E)-k.height())/2),h.position.left+=e.left,h.position.top+=e.top,h};var Ab,Bb='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:\'\';" style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=0); -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";"></iframe>';d.extend(x.prototype,{_scroll:function(){var b=this.qtip.elements.overlay;b&&(b[0].style.top=d(a).scrollTop()+"px")},init:function(c){var e=c.tooltip;d("select, object").length<1&&(this.bgiframe=c.elements.bgiframe=d(Bb).appendTo(e),c._bind(e,"tooltipmove",this.adjustBGIFrame,this._ns,this)),this.redrawContainer=d("<div/>",{id:S+"-rcontainer"}).appendTo(b.body),c.elements.overlay&&c.elements.overlay.addClass("qtipmodal-ie6fix")&&(c._bind(a,["scroll","resize"],this._scroll,this._ns,this),c._bind(e,["tooltipshow"],this._scroll,this._ns,this)),this.redraw()},adjustBGIFrame:function(){var a,b,c=this.qtip.tooltip,d={height:c.outerHeight(E),width:c.outerWidth(E)},e=this.qtip.plugins.tip,f=this.qtip.elements.tip;b=parseInt(c.css("borderLeftWidth"),10)||0,b={left:-b,top:-b},e&&f&&(a="x"===e.corner.precedance?[I,L]:[J,K],b[a[1]]-=f[a[0]]()),this.bgiframe.css(b).css(d)},redraw:function(){if(this.qtip.rendered<1||this.drawing)return this;var a,b,c,d,e=this.qtip.tooltip,f=this.qtip.options.style,g=this.qtip.options.position.container;return this.qtip.drawing=1,f.height&&e.css(J,f.height),f.width?e.css(I,f.width):(e.css(I,"").appendTo(this.redrawContainer),b=e.width(),1>b%2&&(b+=1),c=e.css("maxWidth")||"",d=e.css("minWidth")||"",a=(c+d).indexOf("%")>-1?g.width()/100:0,c=(c.indexOf("%")>-1?a:1)*parseInt(c,10)||b,d=(d.indexOf("%")>-1?a:1)*parseInt(d,10)||0,b=c+d?Math.min(Math.max(b,d),c):b,e.css(I,Math.round(b)).appendTo(g)),this.drawing=0,this},destroy:function(){this.bgiframe&&this.bgiframe.remove(),this.qtip._unbind([a,this.qtip.tooltip],this._ns)}}),Ab=R.ie6=function(a){return 6===db.ie?new x(a):E},Ab.initialize="render",B.ie6={"^content|style$":function(){this.redraw()}}})}(window,document);
|
js/wp-metaseo-admin-media.js
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
var wpmseo_target_id;
|
3 |
+
jQuery(document).ready(function ($) {
|
4 |
+
var wpmseo_uploader;
|
5 |
+
$('.wpmseo_image_upload_button').click(function (e) {
|
6 |
+
wpmseo_target_id = $(this).attr('id').replace(/_button$/, '');
|
7 |
+
e.preventDefault();
|
8 |
+
if (wpmseo_uploader) {
|
9 |
+
wpmseo_uploader.open();
|
10 |
+
return;
|
11 |
+
}
|
12 |
+
wpmseo_uploader = wp.media.frames.file_frame = wp.media({
|
13 |
+
title: wpmseoMediaL10n.choose_image,
|
14 |
+
button: {text: wpmseoMediaL10n.choose_image},
|
15 |
+
multiple: false
|
16 |
+
});
|
17 |
+
|
18 |
+
wpmseo_uploader.on('select', function () {
|
19 |
+
var attachment = wpmseo_uploader.state().get('selection').first().toJSON();
|
20 |
+
$('#' + wpmseo_target_id).val(attachment.url);
|
21 |
+
wpmseo_uploader.close();
|
22 |
+
});
|
23 |
+
|
24 |
+
wpmseo_uploader.open();
|
25 |
+
});
|
26 |
+
});
|
js/wp-metaseo-metabox.js
ADDED
@@ -0,0 +1,379 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function msClean(str) {
|
2 |
+
if (str === '' || typeof (str) === 'undefined') {
|
3 |
+
return '';
|
4 |
+
}
|
5 |
+
|
6 |
+
try {
|
7 |
+
str = str.replace(/<\/?[^>]+>/gi, '');
|
8 |
+
str = str.replace(/\[(.+?)](.+?\[\/\\1])?/g, '');
|
9 |
+
str = jQuery('<div/>').html(str).text();
|
10 |
+
}
|
11 |
+
catch (e) {
|
12 |
+
}
|
13 |
+
|
14 |
+
return str;
|
15 |
+
}
|
16 |
+
|
17 |
+
function msReplaceVariables(str, callback) {
|
18 |
+
if (typeof str === 'undefined') {
|
19 |
+
return;
|
20 |
+
}
|
21 |
+
// title
|
22 |
+
if (jQuery('#title').length) {
|
23 |
+
str = str.replace(/%%title%%/g, jQuery('#title').val().replace(/(<([^>]+)>)/ig, ''));
|
24 |
+
}
|
25 |
+
|
26 |
+
// These are added in the head for performance reasons.
|
27 |
+
str = str.replace(/%%sitedesc%%/g, wpmseoMetaboxL10n.sitedesc);
|
28 |
+
str = str.replace(/%%sitename%%/g, wpmseoMetaboxL10n.sitename);
|
29 |
+
str = str.replace(/%%sep%%/g, wpmseoMetaboxL10n.sep);
|
30 |
+
str = str.replace(/%%date%%/g, wpmseoMetaboxL10n.date);
|
31 |
+
str = str.replace(/%%id%%/g, wpmseoMetaboxL10n.id);
|
32 |
+
str = str.replace(/%%page%%/g, wpmseoMetaboxL10n.page);
|
33 |
+
str = str.replace(/%%currenttime%%/g, wpmseoMetaboxL10n.currenttime);
|
34 |
+
str = str.replace(/%%currentdate%%/g, wpmseoMetaboxL10n.currentdate);
|
35 |
+
str = str.replace(/%%currentday%%/g, wpmseoMetaboxL10n.currentday);
|
36 |
+
str = str.replace(/%%currentmonth%%/g, wpmseoMetaboxL10n.currentmonth);
|
37 |
+
str = str.replace(/%%currentyear%%/g, wpmseoMetaboxL10n.currentyear);
|
38 |
+
|
39 |
+
// str = str.replace(/%%mfocuskw%%/g, jQuery('#metaseo_wpmseo_mfocuskw').val().replace(/(<([^>]+)>)/ig, ''));
|
40 |
+
// excerpt
|
41 |
+
var excerpt = '';
|
42 |
+
if (jQuery('#excerpt').length) {
|
43 |
+
excerpt = msClean(jQuery('#excerpt').val().replace(/(<([^>]+)>)/ig, ''));
|
44 |
+
str = str.replace(/%%excerpt_only%%/g, excerpt);
|
45 |
+
}
|
46 |
+
if ('' === excerpt && jQuery('#content').length) {
|
47 |
+
excerpt = jQuery('#content').val().replace(/(<([^>]+)>)/ig, '').substring(0, wpmseoMetaboxL10n.wpmseo_meta_desc_length - 1);
|
48 |
+
}
|
49 |
+
str = str.replace(/%%excerpt%%/g, excerpt);
|
50 |
+
|
51 |
+
// parent page
|
52 |
+
if (jQuery('#parent_id').length && jQuery('#parent_id option:selected').text() !== wpmseoMetaboxL10n.no_parent_text) {
|
53 |
+
str = str.replace(/%%parent_title%%/g, jQuery('#parent_id option:selected').text());
|
54 |
+
}
|
55 |
+
|
56 |
+
// remove double separators
|
57 |
+
var esc_sep = msEscapeFocusKw(wpmseoMetaboxL10n.sep);
|
58 |
+
var pattern = new RegExp(esc_sep + ' ' + esc_sep, 'g');
|
59 |
+
str = str.replace(pattern, wpmseoMetaboxL10n.sep);
|
60 |
+
|
61 |
+
if (str.indexOf('%%') !== -1 && str.match(/%%[a-z0-9_-]+%%/i) !== null) {
|
62 |
+
var regex = /%%[a-z0-9_-]+%%/gi;
|
63 |
+
var matches = str.match(regex);
|
64 |
+
for (var i = 0; i < matches.length; i++) {
|
65 |
+
if (typeof (replacedVars[ matches[ i ] ]) === 'undefined') {
|
66 |
+
str = str.replace(matches[ i ], replacedVars[ matches[ i ] ]);
|
67 |
+
}
|
68 |
+
else {
|
69 |
+
var replaceableVar = matches[ i ];
|
70 |
+
|
71 |
+
// create the cache already, so we don't do the request twice.
|
72 |
+
replacedVars[ replaceableVar ] = '';
|
73 |
+
msAjaxReplaceVariables(replaceableVar, callback);
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
77 |
+
callback(str);
|
78 |
+
}
|
79 |
+
|
80 |
+
function msAjaxReplaceVariables(replaceableVar, callback) {
|
81 |
+
jQuery.post(ajaxurl, {
|
82 |
+
action: 'wpmseo_replace_vars',
|
83 |
+
string: replaceableVar,
|
84 |
+
post_id: jQuery('#post_ID').val(),
|
85 |
+
_wpnonce: wpmseoMetaboxL10n.wpmseo_replace_vars_nonce
|
86 |
+
}, function (data) {
|
87 |
+
if (data) {
|
88 |
+
replacedVars[ replaceableVar ] = data;
|
89 |
+
}
|
90 |
+
|
91 |
+
msReplaceVariables(replaceableVar, callback);
|
92 |
+
});
|
93 |
+
}
|
94 |
+
|
95 |
+
function msUpdateTitle(force) {
|
96 |
+
var title = '';
|
97 |
+
var titleElm = jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'title');
|
98 |
+
var titleLengthError = jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'title-length-warning');
|
99 |
+
var divHtml = jQuery('<div />');
|
100 |
+
var snippetTitle = jQuery('#wpmseosnippet_title');
|
101 |
+
|
102 |
+
if (titleElm.val() !== '') {
|
103 |
+
var len = wpmseoMetaboxL10n.wpmseo_meta_title_length - titleElm.val().length;
|
104 |
+
metaseo_status_length(len,'#' + wpmseoMetaboxL10n.field_prefix + 'title-length');
|
105 |
+
jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'title-length').html(len);
|
106 |
+
} else {
|
107 |
+
jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'title-length').addClass('length-true').removeClass('length-wrong').html('<span class="good">'+ wpmseoMetaboxL10n.wpmseo_meta_title_length +'</span>');
|
108 |
+
}
|
109 |
+
|
110 |
+
if (titleElm.val()) {
|
111 |
+
title = titleElm.val().replace(/(<([^>]+)>)/ig, '');
|
112 |
+
}
|
113 |
+
else {
|
114 |
+
title = wpmseoMetaboxL10n.wpmseo_title_template;
|
115 |
+
title = divHtml.html(title).text();
|
116 |
+
}
|
117 |
+
if (title === '') {
|
118 |
+
snippetTitle.html('');
|
119 |
+
titleLengthError.hide();
|
120 |
+
return;
|
121 |
+
}
|
122 |
+
|
123 |
+
title = msClean(title);
|
124 |
+
title = jQuery.trim(title);
|
125 |
+
title = divHtml.text(title).html();
|
126 |
+
|
127 |
+
if (force) {
|
128 |
+
titleElm.val(title);
|
129 |
+
}
|
130 |
+
|
131 |
+
title = msReplaceVariables(title, function (title) {
|
132 |
+
title = msSanitizeTitle(title);
|
133 |
+
|
134 |
+
jQuery('#wpmseosnippet_title').html(title);
|
135 |
+
|
136 |
+
// do the placeholder
|
137 |
+
var placeholder_title = divHtml.html(title).text();
|
138 |
+
titleElm.attr('placeholder', placeholder_title);
|
139 |
+
|
140 |
+
var titleElement = document.getElementById('wpmseosnippet_title');
|
141 |
+
if (titleElement !== null) {
|
142 |
+
if (titleElement.scrollWidth > titleElement.clientWidth) {
|
143 |
+
titleLengthError.show();
|
144 |
+
}
|
145 |
+
else {
|
146 |
+
titleLengthError.hide();
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
//msTestFocusKw();
|
151 |
+
});
|
152 |
+
}
|
153 |
+
|
154 |
+
function msSanitizeTitle(title) {
|
155 |
+
title = msClean(title);
|
156 |
+
return title;
|
157 |
+
}
|
158 |
+
|
159 |
+
function msUpdateDesc() {
|
160 |
+
var desc = jQuery.trim(msClean(jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'desc').val()));
|
161 |
+
var divHtml = jQuery('<div />');
|
162 |
+
var snippet = jQuery('#wpmseosnippet');
|
163 |
+
|
164 |
+
if (desc === '' && wpmseoMetaboxL10n.wpmseo_desc_template !== '') {
|
165 |
+
desc = wpmseoMetaboxL10n.wpmseo_desc_template;
|
166 |
+
}
|
167 |
+
|
168 |
+
if (desc !== '') {
|
169 |
+
desc = msReplaceVariables(desc, function (desc) {
|
170 |
+
desc = divHtml.text(desc).html();
|
171 |
+
desc = msClean(desc);
|
172 |
+
|
173 |
+
var len = wpmseoMetaboxL10n.wpmseo_meta_desc_length - desc.length;
|
174 |
+
metaseo_status_length(len,'#' + wpmseoMetaboxL10n.field_prefix + 'desc-length');
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
desc = msSanitizeDesc(desc);
|
179 |
+
|
180 |
+
// Clear the autogen description.
|
181 |
+
snippet.find('.desc span.autogen').html('');
|
182 |
+
// Set our new one.
|
183 |
+
snippet.find('.desc span.content').html(desc);
|
184 |
+
});
|
185 |
+
} else {
|
186 |
+
jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'desc-length').addClass('length-true').removeClass('length-wrong').html('<span class="good">'+ wpmseoMetaboxL10n.wpmseo_meta_desc_length +'</span>');
|
187 |
+
// Clear the generated description
|
188 |
+
snippet.find('.desc span.content').html('');
|
189 |
+
|
190 |
+
|
191 |
+
if (typeof tinyMCE !== 'undefined' && tinyMCE.get('excerpt') !== null) {
|
192 |
+
desc = tinyMCE.get('excerpt').getContent();
|
193 |
+
desc = msClean(desc);
|
194 |
+
}
|
195 |
+
|
196 |
+
if (typeof tinyMCE !== 'undefined' && tinyMCE.get('content') !== null && desc.length === 0) {
|
197 |
+
desc = tinyMCE.get('content').getContent();
|
198 |
+
|
199 |
+
desc = msClean(desc);
|
200 |
+
}
|
201 |
+
|
202 |
+
desc = desc.substr(0, wpmseoMetaboxL10n.wpmseo_meta_desc_length);
|
203 |
+
desc = msSanitizeDesc(desc);
|
204 |
+
|
205 |
+
snippet.find('.desc span.autogen').html(desc);
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
function msSanitizeDesc(desc) {
|
210 |
+
desc = msTrimDesc(desc);
|
211 |
+
return desc;
|
212 |
+
}
|
213 |
+
|
214 |
+
function msTrimDesc(desc) {
|
215 |
+
if (desc.length > wpmseoMetaboxL10n.wpmseo_meta_desc_length) {
|
216 |
+
var space;
|
217 |
+
if (desc.length > wpmseoMetaboxL10n.wpmseo_meta_desc_length) {
|
218 |
+
space = desc.lastIndexOf(' ', (wpmseoMetaboxL10n.wpmseo_meta_desc_length - 3));
|
219 |
+
}
|
220 |
+
else {
|
221 |
+
space = wpmseoMetaboxL10n.wpmseo_meta_desc_length;
|
222 |
+
}
|
223 |
+
desc = desc.substring(0, space).concat(' ...');
|
224 |
+
}
|
225 |
+
return desc;
|
226 |
+
}
|
227 |
+
|
228 |
+
function msUpdateURL() {
|
229 |
+
var url;
|
230 |
+
if (jQuery('#editable-post-name-full').length) {
|
231 |
+
var name = jQuery('#editable-post-name-full').text();
|
232 |
+
url = wpmseoMetaboxL10n.wpmseo_permalink_template.replace('%postname%', name).replace('http://', '');
|
233 |
+
}
|
234 |
+
|
235 |
+
jQuery('#wpmseosnippet').find('.url').html(url);
|
236 |
+
}
|
237 |
+
|
238 |
+
function msUpdateSnippet() {
|
239 |
+
msUpdateURL();
|
240 |
+
msUpdateTitle();
|
241 |
+
msUpdateDesc();
|
242 |
+
}
|
243 |
+
|
244 |
+
function msEscapeFocusKw(str) {
|
245 |
+
return str.replace(/[\-\[\]\/\{}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
246 |
+
}
|
247 |
+
|
248 |
+
function metaseo_status_length(len,id){
|
249 |
+
if (len < 0) {
|
250 |
+
jQuery(id).addClass('length-wrong').removeClass('length-true');
|
251 |
+
len = '<span class="wrong">' + len + '</span>';
|
252 |
+
}else {
|
253 |
+
jQuery(id).addClass('length-true').removeClass('length-wrong');
|
254 |
+
len = '<span class="good">' + len + '</span>';
|
255 |
+
}
|
256 |
+
|
257 |
+
jQuery(id).html(len);
|
258 |
+
}
|
259 |
+
|
260 |
+
(function () {
|
261 |
+
var timer = 0;
|
262 |
+
return function (callback, ms) {
|
263 |
+
clearTimeout(timer);
|
264 |
+
timer = setTimeout(callback, ms);
|
265 |
+
};
|
266 |
+
})();
|
267 |
+
|
268 |
+
jQuery(document).ready(function ($) {
|
269 |
+
// add countdown for title and description
|
270 |
+
var titleval = jQuery.trim(msClean(jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'title').val()));
|
271 |
+
var descval = jQuery.trim(msClean(jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'desc').val()));
|
272 |
+
if (titleval === '') {
|
273 |
+
jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'title-length').html('<span class="good">'+ wpmseoMetaboxL10n.wpmseo_meta_title_length +'</span>');
|
274 |
+
}else{
|
275 |
+
metaseo_status_length(titleval.length,'#' + wpmseoMetaboxL10n.field_prefix + 'title-length');
|
276 |
+
}
|
277 |
+
if (descval === '') {
|
278 |
+
jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'desc-length').html('<span class="good">'+ wpmseoMetaboxL10n.wpmseo_meta_desc_length +'</span>');
|
279 |
+
}else{
|
280 |
+
metaseo_status_length(descval.length,'#' + wpmseoMetaboxL10n.field_prefix + 'desc-length');
|
281 |
+
}
|
282 |
+
|
283 |
+
var replacedVars = []; // jshint ignore:line
|
284 |
+
|
285 |
+
if (jQuery('.wpmseo-metabox-tabs-div').length > 0) {
|
286 |
+
var active_tab = window.location.hash;
|
287 |
+
if (active_tab === '' || active_tab.search('wpmseo') === -1) {
|
288 |
+
active_tab = 'general';
|
289 |
+
}
|
290 |
+
else {
|
291 |
+
active_tab = active_tab.replace('#wpmseo_', '');
|
292 |
+
}
|
293 |
+
jQuery('.' + active_tab).addClass('active');
|
294 |
+
|
295 |
+
var descElm = jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'desc');
|
296 |
+
var desc = jQuery.trim(msClean(descElm.val()));
|
297 |
+
desc = jQuery('<div />').html(desc).text();
|
298 |
+
descElm.val(desc);
|
299 |
+
|
300 |
+
jQuery('a.wpmseo_tablink').click(function () {
|
301 |
+
jQuery('.wpmseo-metabox-tabs li').removeClass('active');
|
302 |
+
jQuery('.wpmseotab').removeClass('active');
|
303 |
+
|
304 |
+
var link = jQuery(this).data('link').replace('wpmseo_', '');
|
305 |
+
jQuery('.wpmseo-metabox-tabs-div .' + link).addClass('active');
|
306 |
+
jQuery(this).parent('.wpmseo-metabox-tabs-div li').addClass('active');
|
307 |
+
|
308 |
+
if (jQuery(this).hasClass('scroll')) {
|
309 |
+
var scrollto = jQuery(this).attr('href').replace('wpmseo_', '');
|
310 |
+
jQuery('html, body').animate({
|
311 |
+
scrollTop: jQuery(scrollto).offset().top
|
312 |
+
}, 500
|
313 |
+
);
|
314 |
+
}
|
315 |
+
}
|
316 |
+
);
|
317 |
+
}
|
318 |
+
|
319 |
+
jQuery('.wpmseo-heading').hide();
|
320 |
+
jQuery('.wpmseo-metabox-tabs').show();
|
321 |
+
|
322 |
+
jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'title').keyup(function () {
|
323 |
+
msUpdateTitle();
|
324 |
+
});
|
325 |
+
|
326 |
+
jQuery('#title').keyup(function () {
|
327 |
+
msUpdateTitle();
|
328 |
+
msUpdateDesc();
|
329 |
+
});
|
330 |
+
|
331 |
+
jQuery('#parent_id').change(function () {
|
332 |
+
msUpdateTitle();
|
333 |
+
msUpdateDesc();
|
334 |
+
});
|
335 |
+
|
336 |
+
// DON'T 'optimize' this to use descElm! descElm might not be defined and will cause js errors (Soliloquy issue)
|
337 |
+
jQuery('#' + wpmseoMetaboxL10n.field_prefix + 'desc').keyup(function () {
|
338 |
+
msUpdateDesc();
|
339 |
+
});
|
340 |
+
|
341 |
+
// Set time out because of tinymce is initialized later then this is done
|
342 |
+
setTimeout(
|
343 |
+
function () {
|
344 |
+
msUpdateSnippet();
|
345 |
+
|
346 |
+
// Adding events to content and excerpt
|
347 |
+
if (typeof tinyMCE !== 'undefined' && tinyMCE.get('content') !== null) {
|
348 |
+
tinyMCE.get('content').on('blur', msUpdateDesc);
|
349 |
+
}
|
350 |
+
|
351 |
+
if (typeof tinyMCE !== 'undefined' && tinyMCE.get('excerpt') !== null) {
|
352 |
+
tinyMCE.get('excerpt').on('blur', msUpdateDesc);
|
353 |
+
}
|
354 |
+
},
|
355 |
+
500
|
356 |
+
);
|
357 |
+
|
358 |
+
jQuery('.metaseo_help').qtip({
|
359 |
+
content: {
|
360 |
+
attr: 'alt'
|
361 |
+
},
|
362 |
+
position: {
|
363 |
+
my: 'bottom left',
|
364 |
+
at: 'top center'
|
365 |
+
},
|
366 |
+
style: {
|
367 |
+
tip: {
|
368 |
+
corner: true
|
369 |
+
},
|
370 |
+
classes: 'metaseo-qtip qtip-rounded qtip-blue'
|
371 |
+
},
|
372 |
+
show: 'click',
|
373 |
+
hide: {
|
374 |
+
fixed: true,
|
375 |
+
delay: 500
|
376 |
+
}
|
377 |
+
|
378 |
+
});
|
379 |
+
});
|
readme.txt
CHANGED
@@ -1,22 +1,46 @@
|
|
1 |
=== WP Meta SEO ===
|
2 |
Contributors: JoomUnited
|
3 |
-
Tags:
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 4.3
|
6 |
-
Stable tag: 1.0
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
-
WP Meta SEO
|
11 |
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
WP meta SEO got
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
**More details here:** http://www.joomunited.com/wordpress-products/wp-meta-seo
|
22 |
|
@@ -24,14 +48,14 @@ You can now optimize the size of your images in articles. A bunch of people redu
|
|
24 |
[vimeo https://vimeo.com/113695156]
|
25 |
|
26 |
|
27 |
-
|
28 |
|
29 |
* Reduce page weight by fix image size
|
30 |
* All alt tags edition on single view
|
31 |
-
* See all your snippet in one
|
32 |
* Image name, title, description and legend
|
33 |
* Automatic AJAX saving
|
34 |
-
*
|
35 |
* Custom type mate edition
|
36 |
* Yoast SEO import & sync
|
37 |
* Alexa world rank
|
@@ -46,6 +70,13 @@ You can now optimize the size of your images in articles. A bunch of people redu
|
|
46 |
* Bulk image resizing
|
47 |
* One click image title copy
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
= Support =
|
50 |
|
51 |
A PDF support documant is provided and a dedicated support can be provided additionnaly with a membership.
|
@@ -53,20 +84,19 @@ A PDF support documant is provided and a dedicated support can be provided addit
|
|
53 |
|
54 |
== Installation ==
|
55 |
|
56 |
-
|
57 |
-
Once the plugin is installed, just load the main plugin view to configure all meta and image optimization
|
58 |
|
59 |
|
60 |
== Screenshots ==
|
61 |
|
62 |
1. Main dashboad of the plugin with missing optimization and alexa rank
|
63 |
-
1. Bulk content meta edition
|
64 |
-
1.
|
|
|
65 |
1. Image resized in HTML (with handles) is automatically detected and can be resized
|
66 |
1. SEO Yoast and AIO SEO plugin and detected and data sync
|
67 |
1. Detail and alert on the element that you can optimize
|
68 |
1. Image replace confirmation
|
69 |
-
1. Title and filename image edition without and broken link
|
70 |
|
71 |
|
72 |
== Revisions ==
|
@@ -75,25 +105,44 @@ Once the plugin is installed, just load the main plugin view to configure all me
|
|
75 |
* 1.0.1
|
76 |
* 1.0.2
|
77 |
* 1.0.3
|
|
|
|
|
78 |
|
79 |
== Changelog ==
|
80 |
|
81 |
-
= 1.
|
82 |
|
83 |
-
*
|
|
|
84 |
|
85 |
-
= 1.0.
|
86 |
|
87 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
= 1.0.2 =
|
90 |
|
91 |
* Fix filter broken and icons broken
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
== Upgrade Notice ==
|
95 |
|
96 |
-
|
97 |
|
98 |
|
99 |
== Requirements ==
|
1 |
=== WP Meta SEO ===
|
2 |
Contributors: JoomUnited
|
3 |
+
Tags: google, webmaster tools, keywords, meta, meta description, meta keywords, meta title, robots meta, search engine optimization, seo, wordpress seo, yahoo, image optimization, image resize, custom post seo
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 4.3.1
|
6 |
+
Stable tag: 1.1.0
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
+
WP Meta SEO gives you the control over all your meta content and images. Bulk SEO content and image optimization, SEO on page analysis.
|
11 |
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
= WP meta SEO got 5 major functionnalities: =
|
16 |
|
17 |
+
* Bulk edit all website meta on a single view
|
18 |
+
* Edit meta in content with SEO analysis
|
19 |
+
* Fix HTML image resizing
|
20 |
+
* Bulk edit image file name and meta
|
21 |
+
* Facebook and Twitter social sharing custom elements per content
|
22 |
+
|
23 |
+
|
24 |
+
= Bulk meta edition and image resizing =
|
25 |
+
|
26 |
+
It was annoying to edit meta on an existing website, open each post, page and almost nobody was doing it. Especially if you need to edit content + image meta.
|
27 |
+
WP Meta SEO is going to list all posts, pages, custom post types and all images. Type your meta content and fix image size size and everything is AJAX saved.
|
28 |
+
A bunch of people reduce the size of the pictures handling the border and resizing in html/css. You can now optimize the size of your images in articles, click fix and it's replaced.
|
29 |
+
|
30 |
+
|
31 |
+
= On page SEO optimization and analysis =
|
32 |
+
|
33 |
+
* Content SEO smart analysis bellow content
|
34 |
+
* Search engine snippet preview
|
35 |
+
* AJAX anaysis refresh
|
36 |
+
* 7 criteria of analysis
|
37 |
+
* Check: Page title word in content heading
|
38 |
+
* Check: Page title word in content
|
39 |
+
* Check: Page url matches with page title
|
40 |
+
* Check: Meta title filled
|
41 |
+
* Check: Meta description filled
|
42 |
+
* Check: Wrong image resizing
|
43 |
+
* Check: Image meta title or alt
|
44 |
|
45 |
**More details here:** http://www.joomunited.com/wordpress-products/wp-meta-seo
|
46 |
|
48 |
[vimeo https://vimeo.com/113695156]
|
49 |
|
50 |
|
51 |
+
= SEO features list =
|
52 |
|
53 |
* Reduce page weight by fix image size
|
54 |
* All alt tags edition on single view
|
55 |
+
* See all your snippet in one view
|
56 |
* Image name, title, description and legend
|
57 |
* Automatic AJAX saving
|
58 |
+
* On page analysis: fix SEO criteria
|
59 |
* Custom type mate edition
|
60 |
* Yoast SEO import & sync
|
61 |
* Alexa world rank
|
70 |
* Bulk image resizing
|
71 |
* One click image title copy
|
72 |
|
73 |
+
= Main plugins from JoomUnited: =
|
74 |
+
* WP Media Folder: https://www.joomunited.com/wordpress-products/wp-media-folder
|
75 |
+
* WP File Download: https://www.joomunited.com/wordpress-products/wp-table-manager
|
76 |
+
* WP Table Manager: https://www.joomunited.com/wordpress-products/wp-file-download
|
77 |
+
* WP Meta SEO: https://www.joomunited.com/wordpress-products/wp-meta-seo
|
78 |
+
* WP Latest Posts: https://www.joomunited.com/wordpress-products/wp-latest-posts
|
79 |
+
|
80 |
= Support =
|
81 |
|
82 |
A PDF support documant is provided and a dedicated support can be provided additionnaly with a membership.
|
84 |
|
85 |
== Installation ==
|
86 |
|
87 |
+
Once the plugin is installed, open the bulk edition through the admin menu or open a content to load SEO on page analysis
|
|
|
88 |
|
89 |
|
90 |
== Screenshots ==
|
91 |
|
92 |
1. Main dashboad of the plugin with missing optimization and alexa rank
|
93 |
+
1. Bulk content meta edition with AJAX saving
|
94 |
+
1. On page dynamic SEO analysis for page, posts and custom post type
|
95 |
+
1. Social shaing information, on page optimization
|
96 |
1. Image resized in HTML (with handles) is automatically detected and can be resized
|
97 |
1. SEO Yoast and AIO SEO plugin and detected and data sync
|
98 |
1. Detail and alert on the element that you can optimize
|
99 |
1. Image replace confirmation
|
|
|
100 |
|
101 |
|
102 |
== Revisions ==
|
105 |
* 1.0.1
|
106 |
* 1.0.2
|
107 |
* 1.0.3
|
108 |
+
* 1.0.4
|
109 |
+
* 1.1.0
|
110 |
|
111 |
== Changelog ==
|
112 |
|
113 |
+
= 1.1.0 =
|
114 |
|
115 |
+
* On page SEO analysis
|
116 |
+
* Social sharing custom content
|
117 |
|
118 |
+
= 1.0.5 =
|
119 |
|
120 |
+
* Title tag value is empty
|
121 |
+
|
122 |
+
= 1.0.4 =
|
123 |
+
|
124 |
+
* Check empty array
|
125 |
+
|
126 |
+
= 1.0.3 =
|
127 |
+
|
128 |
+
* Escape meta title and meta description
|
129 |
|
130 |
= 1.0.2 =
|
131 |
|
132 |
* Fix filter broken and icons broken
|
133 |
+
|
134 |
+
= 1.0.1 =
|
135 |
+
|
136 |
+
* display (no title) in column title if post is no titled
|
137 |
+
|
138 |
+
= 1.0.0 =
|
139 |
+
|
140 |
+
* Initial release
|
141 |
+
|
142 |
|
143 |
== Upgrade Notice ==
|
144 |
|
145 |
+
Update through the automatic WordPress updater, WP Meta SEO content will remain in place
|
146 |
|
147 |
|
148 |
== Requirements ==
|
wp-meta-seo.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: WP Meta SEO
|
5 |
* Plugin URI: http://www.joomunited.com/wordpress-products/wp-meta-seo
|
6 |
* Description: WP Meta SEO is a plugin for WordPress to fill meta for content, images and main SEO info in a single view.
|
7 |
-
* Version: 1.0
|
8 |
* Author: JoomUnited
|
9 |
* Author URI: http://www.joomunited.com
|
10 |
* License: GPL2
|
@@ -44,6 +44,12 @@ if (!defined('WPMETASEO_PLUGIN_DIR'))
|
|
44 |
if (!defined('URL'))
|
45 |
define('URL', get_site_url());
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
register_activation_hook(__FILE__, array('WpMetaSeo', 'plugin_activation'));
|
48 |
register_deactivation_hook(__FILE__, array('WpMetaSeo', 'plugin_deactivation'));
|
49 |
|
@@ -61,6 +67,14 @@ if (is_admin()) {
|
|
61 |
|
62 |
add_filter('wp_prepare_attachment_for_js', array('MetaSeo_Image_List_Table', 'add_more_attachment_sizes_js'), 10, 2);
|
63 |
add_filter('image_size_names_choose', array('MetaSeo_Image_List_Table', 'add_more_attachment_sizes_choose'), 10, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
} else {
|
65 |
/******** Check again and modify title, meta title, meta description before output ********/
|
66 |
//add_filter('wp_title', array('WpMetaSeo', 'new_title'), 99);
|
@@ -72,51 +86,127 @@ if (is_admin()) {
|
|
72 |
function buffer_end() { ob_end_flush(); }
|
73 |
|
74 |
function callback($buffer) {
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
}
|
121 |
/***********************************************/
|
122 |
}
|
@@ -202,4 +292,4 @@ function metaseo_utf8($obj, $action = 'encode'){
|
|
202 |
|
203 |
return $obj;
|
204 |
}
|
205 |
-
/**********************************************************************************/
|
4 |
* Plugin Name: WP Meta SEO
|
5 |
* Plugin URI: http://www.joomunited.com/wordpress-products/wp-meta-seo
|
6 |
* Description: WP Meta SEO is a plugin for WordPress to fill meta for content, images and main SEO info in a single view.
|
7 |
+
* Version: 1.1.0
|
8 |
* Author: JoomUnited
|
9 |
* Author URI: http://www.joomunited.com
|
10 |
* License: GPL2
|
44 |
if (!defined('URL'))
|
45 |
define('URL', get_site_url());
|
46 |
|
47 |
+
if (!defined('WPMSEO_VERSION'))
|
48 |
+
define('WPMSEO_VERSION', '1.1.0');
|
49 |
+
|
50 |
+
if (!defined('WPMSEO_FILE'))
|
51 |
+
define('WPMSEO_FILE', __FILE__);
|
52 |
+
|
53 |
register_activation_hook(__FILE__, array('WpMetaSeo', 'plugin_activation'));
|
54 |
register_deactivation_hook(__FILE__, array('WpMetaSeo', 'plugin_deactivation'));
|
55 |
|
67 |
|
68 |
add_filter('wp_prepare_attachment_for_js', array('MetaSeo_Image_List_Table', 'add_more_attachment_sizes_js'), 10, 2);
|
69 |
add_filter('image_size_names_choose', array('MetaSeo_Image_List_Table', 'add_more_attachment_sizes_choose'), 10, 1);
|
70 |
+
add_filter( 'user_contactmethods','metaseo_contactuser', 10, 1 );
|
71 |
+
|
72 |
+
function metaseo_contactuser( $contactusers ) {
|
73 |
+
$contactusers['mtwitter'] = __( 'Twitter username (without @)', 'wp-meta-seo' );
|
74 |
+
$contactusers['mfacebook'] = __( 'Facebook profile URL', 'wp-meta-seo' );
|
75 |
+
return $contactusers;
|
76 |
+
}
|
77 |
+
|
78 |
} else {
|
79 |
/******** Check again and modify title, meta title, meta description before output ********/
|
80 |
//add_filter('wp_title', array('WpMetaSeo', 'new_title'), 99);
|
86 |
function buffer_end() { ob_end_flush(); }
|
87 |
|
88 |
function callback($buffer) {
|
89 |
+
// modify buffer here, and then return the updated code
|
90 |
+
global $wp_query;
|
91 |
+
$meta_title = get_post_meta($wp_query->post->ID, '_metaseo_metatitle', true);
|
92 |
+
if($meta_title == '') $meta_title = $wp_query->post->post_title;
|
93 |
+
$meta_title_esc = esc_attr($meta_title);
|
94 |
+
|
95 |
+
$meta_description = get_post_meta($wp_query->post->ID, '_metaseo_metadesc', true);
|
96 |
+
if($meta_description == '') $meta_description = $wp_query->post->post_title;
|
97 |
+
$meta_description_esc = esc_attr($meta_description);
|
98 |
+
|
99 |
+
$twitter_title = get_post_meta($wp_query->post->ID, '_metaseo_metatwitter-title', true);
|
100 |
+
$meta_twitter_title = esc_attr($twitter_title);
|
101 |
+
if($meta_twitter_title == '') $meta_twitter_title = $meta_title_esc;
|
102 |
+
|
103 |
+
$twitter_desc = get_post_meta($wp_query->post->ID, '_metaseo_metatwitter-desc', true);
|
104 |
+
$meta_twitter_desc = esc_attr($twitter_desc);
|
105 |
+
if($meta_twitter_desc == '') $meta_twitter_desc = $meta_description_esc;
|
106 |
+
|
107 |
+
$sitename = get_bloginfo('name');
|
108 |
+
$meta_twitter_site = get_user_meta($wp_query->post->post_author,'mtwitter',true);
|
109 |
+
$facebook_admin = get_user_meta($wp_query->post->post_author,'mfacebook',true);
|
110 |
+
|
111 |
+
$metaseo_settings = get_option( '_metaseo_settings' );
|
112 |
+
if($metaseo_settings){
|
113 |
+
if($meta_twitter_site == '' && $metaseo_settings['metaseo_showtwitter'] != ''){
|
114 |
+
$meta_twitter_site = $metaseo_settings['metaseo_showtwitter'];
|
115 |
+
}
|
116 |
+
|
117 |
+
if($facebook_admin == '' && $metaseo_settings['metaseo_showfacebook'] != ''){
|
118 |
+
$facebook_admin = $metaseo_settings['metaseo_showfacebook'];
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
$meta_twitter_card = 'summary';
|
123 |
+
$meta_twitter_image = get_post_meta($wp_query->post->ID,'_metaseo_metatwitter-image',true);
|
124 |
+
|
125 |
+
$meta_facebook_title = get_post_meta($wp_query->post->ID,'_metaseo_metaopengraph-title',true);
|
126 |
+
if($meta_facebook_title == '') $meta_facebook_title = $meta_title_esc;
|
127 |
+
|
128 |
+
$meta_facebook_desc = get_post_meta($wp_query->post->ID,'_metaseo_metaopengraph-desc',true);
|
129 |
+
$meta_facebook_image = get_post_meta($wp_query->post->ID,'_metaseo_metaopengraph-image',true);
|
130 |
+
|
131 |
+
$patterns = array(
|
132 |
+
'twitter_image' => array(
|
133 |
+
'#<meta name="twitter:image" [^<>]+ ?>#i',
|
134 |
+
'<meta name="twitter:image" content="' . $meta_twitter_image . '" />',
|
135 |
+
($meta_twitter_image != '' ? true : false)),
|
136 |
+
'twitter_card' => array(
|
137 |
+
'#<meta name="twitter:card" [^<>]+ ?>#i',
|
138 |
+
'<meta name="twitter:card" content="' . $meta_twitter_card . '" />',
|
139 |
+
($meta_twitter_card != '' ? true : false)),
|
140 |
+
'twitter_site' => array(
|
141 |
+
'#<meta name="twitter:site" [^<>]+ ?>#i',
|
142 |
+
'<meta name="twitter:site" content="@' . $meta_twitter_site . '" />',
|
143 |
+
($meta_twitter_site != '' ? true : false)),
|
144 |
+
'twitter_domain' => array(
|
145 |
+
'#<meta name="twitter:domain" [^<>]+ ?>#i',
|
146 |
+
'<meta name="twitter:domain" content="' . $sitename . '" />',
|
147 |
+
($sitename != '' ? true : false)),
|
148 |
+
'twitter_desc' => array(
|
149 |
+
'#<meta name="twitter:description" [^<>]+ ?>#i',
|
150 |
+
'<meta name="twitter:description" content="' . $meta_twitter_desc . '" />',
|
151 |
+
($meta_twitter_desc != '' ? true : false)),
|
152 |
+
'twitter_title' => array(
|
153 |
+
'#<meta name="twitter:title" [^<>]+ ?>#i',
|
154 |
+
'<meta name="twitter:title" content="' . $meta_twitter_title . '" />',
|
155 |
+
($meta_twitter_title != '' ? true : false)),
|
156 |
+
'_title' => array('#<title>[^<>]+?<\/title>#i', '<title>' . $meta_title . '</title>',
|
157 |
+
($meta_title != '' ? true : false)),
|
158 |
+
'facebook_admin' => array(
|
159 |
+
'#<meta property="fb:admins" [^<>]+ ?>#i',
|
160 |
+
'<meta property="fb:admins" content="' . $facebook_admin . '" />',
|
161 |
+
($facebook_admin != '' ? true : false)),
|
162 |
+
'facebook_image' => array(
|
163 |
+
'#<meta property="og:image" [^<>]+ ?>#i',
|
164 |
+
'<meta property="og:image" content="' . $meta_facebook_image . '" />',
|
165 |
+
($meta_facebook_image != '' ? true : false)),
|
166 |
+
'site_name' => array(
|
167 |
+
'#<meta property="og:site_name" [^<>]+ ?>#i',
|
168 |
+
'<meta property="og:site_name" content="' . $sitename . '" />',
|
169 |
+
($sitename != '' ? true : false)),
|
170 |
+
'og:description' => array(
|
171 |
+
'#<meta property="og:description" [^<>]+ ?>#i',
|
172 |
+
'<meta property="og:description" content="' . $meta_facebook_desc . '" />',
|
173 |
+
($meta_facebook_desc != '' ? true : false)),
|
174 |
+
'og:title' => array(
|
175 |
+
'#<meta property="og:title" [^<>]+ ?>#i',
|
176 |
+
'<meta property="og:title" content="' . $meta_facebook_title . '" />',
|
177 |
+
($meta_facebook_title != '' ? true : false)),
|
178 |
+
'_description' => array(
|
179 |
+
'#<meta name="description" [^<>]+ ?>#i',
|
180 |
+
'<meta name="description" content="' . $meta_description_esc . '" />',
|
181 |
+
($meta_description_esc != '' ? true : false)),
|
182 |
+
|
183 |
+
'title' => array(),
|
184 |
+
);
|
185 |
+
|
186 |
+
if(get_post_meta($wp_query->post->ID, '_metaseo_metatitle', true) != ''){
|
187 |
+
$patterns['title'] = array(
|
188 |
+
'#<meta name="title" [^<>]+ ?>#i',
|
189 |
+
'<meta name="title" content="' . $meta_title_esc . '" />',
|
190 |
+
($meta_title_esc != '' ? true : false));
|
191 |
+
}
|
192 |
+
|
193 |
+
foreach($patterns as $k => $pattern){
|
194 |
+
if(preg_match_all($pattern[0], $buffer, $matches)){
|
195 |
+
$replacement = array();
|
196 |
+
foreach($matches[0] as $key => $match){
|
197 |
+
if($key < 1){
|
198 |
+
$replacement[] = $pattern[2] ? $pattern[1] : $match."\n";
|
199 |
+
} else { $replacement[] = ''; }
|
200 |
+
}
|
201 |
+
|
202 |
+
$buffer = str_ireplace($matches[0], $replacement, $buffer);
|
203 |
+
}
|
204 |
+
else{
|
205 |
+
$buffer = str_ireplace('</title>', "</title>\n" . $pattern[1], $buffer);
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
return $buffer;
|
210 |
}
|
211 |
/***********************************************/
|
212 |
}
|
292 |
|
293 |
return $obj;
|
294 |
}
|
295 |
+
/**********************************************************************************/
|