Compare commits
714 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85806701cf | ||
|
|
7785eaddd7 | ||
|
|
d20349b9b8 | ||
|
|
15372a22b6 | ||
|
|
fd17fe449d | ||
|
|
6486085cf4 | ||
|
|
a48973211c | ||
|
|
8d349aa85c | ||
|
|
e76e370638 | ||
|
|
5f4c602776 | ||
|
|
683db28b4c | ||
|
|
add4250c0d | ||
|
|
72e74add8d | ||
|
|
e56c1c2097 | ||
|
|
0fb4233fdf | ||
|
|
c005340430 | ||
|
|
d3d447d6e9 | ||
|
|
48813443db | ||
|
|
a366ee01ef | ||
|
|
81482db30b | ||
|
|
2794b34f4a | ||
|
|
94349171ec | ||
|
|
5177c0e5c7 | ||
|
|
40b7e58b82 | ||
|
|
3be5215e08 | ||
|
|
4a03a94051 | ||
|
|
3542e01f19 | ||
|
|
315a28c4b5 | ||
|
|
4f6b825b8b | ||
|
|
9eb6351d24 | ||
|
|
3ac0df5170 | ||
|
|
f25f33c4ba | ||
|
|
192cb2dda5 | ||
|
|
3c89a5c5d7 | ||
|
|
deb7701a85 | ||
|
|
1fa2f6df66 | ||
|
|
dbd3d07274 | ||
|
|
bbe284b1d1 | ||
|
|
8eceaca349 | ||
|
|
1d146b6153 | ||
|
|
39152aff25 | ||
|
|
c352f29893 | ||
|
|
9bfccd6286 | ||
|
|
f30cd7acec | ||
|
|
3ccba6071a | ||
|
|
6d53f77f31 | ||
|
|
76fee1da02 | ||
|
|
1e127b413c | ||
|
|
4216f95b64 | ||
|
|
e08024d86e | ||
|
|
8bfcfae2f8 | ||
|
|
d3db272764 | ||
|
|
8a6802ef00 | ||
|
|
ec182d74a6 | ||
|
|
b36db5619b | ||
|
|
3d3846ee8a | ||
|
|
9ea001d704 | ||
|
|
b36471d4cf | ||
|
|
9e61170004 | ||
|
|
3fc1d4f08d | ||
|
|
76d0f29698 | ||
|
|
103e793478 | ||
|
|
95908afb48 | ||
|
|
1cae6a8691 | ||
|
|
7bbd23f3c6 | ||
|
|
b9dcf3c0c3 | ||
|
|
ec6416ec0b | ||
|
|
791aec14b2 | ||
|
|
0880ca8693 | ||
|
|
1f3ce09d52 | ||
|
|
d1acf020b5 | ||
|
|
223182463d | ||
|
|
2f44508e9b | ||
|
|
cf26b9d049 | ||
|
|
60bec14a4e | ||
|
|
48b96208e2 | ||
|
|
159ea09341 | ||
|
|
8e5302b57f | ||
|
|
a1046188b8 | ||
|
|
98d52ab1f2 | ||
|
|
c06e70516a | ||
|
|
4bc7869c84 | ||
|
|
ca4ddf50f8 | ||
|
|
446c704af5 | ||
|
|
e3db8369d0 | ||
|
|
6d983b5bb5 | ||
|
|
33953bc337 | ||
|
|
c3155a54b2 | ||
|
|
6df40aea78 | ||
|
|
87fcc363c1 | ||
|
|
c8077169aa | ||
|
|
368b18d383 | ||
|
|
9fbbf54462 | ||
|
|
a4a609093e | ||
|
|
d84f590203 | ||
|
|
ba6e8f4a92 | ||
|
|
51299852ef | ||
|
|
d59743c972 | ||
|
|
7931d5eca5 | ||
|
|
79c4324e01 | ||
|
|
23b1e871a1 | ||
|
|
229a52b3a1 | ||
|
|
6a1c63e2f7 | ||
|
|
ead6bfebf7 | ||
|
|
6ecaec3d1f | ||
|
|
95b86a22f5 | ||
|
|
1ba81b4f02 | ||
|
|
eb2d6cea06 | ||
|
|
445d7b077f | ||
|
|
8bbd1008f1 | ||
|
|
8d33c59576 | ||
|
|
f851dc2257 | ||
|
|
a428494291 | ||
|
|
94973a275b | ||
|
|
a40345190e | ||
|
|
827ed61968 | ||
|
|
b5a2f7431e | ||
|
|
2ee9183f8a | ||
|
|
7bdf6d6c6e | ||
|
|
bdd9e5e1e4 | ||
|
|
c5d33cbebd | ||
|
|
98a92950a3 | ||
|
|
c8215773ce | ||
|
|
f396867f60 | ||
|
|
1760555e8b | ||
|
|
64382fbdc9 | ||
|
|
d7c37c0c02 | ||
|
|
40527f6ac2 | ||
|
|
1e8e248b97 | ||
|
|
ab71cc4a4f | ||
|
|
5913b16065 | ||
|
|
2f0e0c8760 | ||
|
|
a4f8a52b4e | ||
|
|
321c310717 | ||
|
|
87c4f3a17f | ||
|
|
d38d018ce9 | ||
|
|
8c8c1cb4f7 | ||
|
|
e468628526 | ||
|
|
58c7ce91e3 | ||
|
|
6cfdd1934b | ||
|
|
03d6c4d0ba | ||
|
|
36851becbd | ||
|
|
3235902cff | ||
|
|
4726644b8b | ||
|
|
97918578a4 | ||
|
|
986715f5b6 | ||
|
|
f87baf5b1f | ||
|
|
d723ff00d8 | ||
|
|
2662be2098 | ||
|
|
7e45ed193a | ||
|
|
e26363a568 | ||
|
|
747bd2cf21 | ||
|
|
d60384b385 | ||
|
|
b04e8d39ee | ||
|
|
1290e8caed | ||
|
|
7b9174524a | ||
|
|
7612bc20b1 | ||
|
|
a43e37b8a1 | ||
|
|
0906863d2c | ||
|
|
93840b1632 | ||
|
|
277e5aa914 | ||
|
|
c8d7b27ed2 | ||
|
|
a2cac0cf09 | ||
|
|
0219651b96 | ||
|
|
bacbca924f | ||
|
|
f0b39c1b5c | ||
|
|
f9e28418ce | ||
|
|
5a997f588b | ||
|
|
88f73f7f41 | ||
|
|
8790a28916 | ||
|
|
56dd1d2033 | ||
|
|
b92227412a | ||
|
|
560b73b9e3 | ||
|
|
aac14d9531 | ||
|
|
395ee1acad | ||
|
|
816f89fb03 | ||
|
|
440c4dedd6 | ||
|
|
d330ec7e34 | ||
|
|
0f6dfb8b1f | ||
|
|
9e48d38752 | ||
|
|
ef5caabe37 | ||
|
|
6a0629e717 | ||
|
|
ad90a8f560 | ||
|
|
51bde8f657 | ||
|
|
5691b03700 | ||
|
|
36ec45d7ff | ||
|
|
f78592cf01 | ||
|
|
0cb5968afc | ||
|
|
014915caea | ||
|
|
c630733e1d | ||
|
|
6050182157 | ||
|
|
82705c845d | ||
|
|
67d21286a8 | ||
|
|
9b742b7959 | ||
|
|
3fe16de587 | ||
|
|
c0287d8f23 | ||
|
|
666bfd2d91 | ||
|
|
5fc07fcd15 | ||
|
|
501833e41e | ||
|
|
3d9dce3497 | ||
|
|
788512c881 | ||
|
|
f8d09ad828 | ||
|
|
7aa077d6a0 | ||
|
|
27f66be1cd | ||
|
|
5217cd1838 | ||
|
|
d9793c3e8d | ||
|
|
c89928a4c8 | ||
|
|
e80177b92b | ||
|
|
86932908e3 | ||
|
|
62f60a666d | ||
|
|
77c64399d0 | ||
|
|
a03073ef0a | ||
|
|
a5fbb3f85f | ||
|
|
4340c63de1 | ||
|
|
51b6d6f6ea | ||
|
|
ccdf20ef62 | ||
|
|
c8723a4f3f | ||
|
|
6db72e6e43 | ||
|
|
7c0ecf6202 | ||
|
|
f3ed626d52 | ||
|
|
fcd0a36f09 | ||
|
|
31992bac0d | ||
|
|
8047b60291 | ||
|
|
ac46bc16c7 | ||
|
|
07ff444b6f | ||
|
|
c6d79a79b0 | ||
|
|
68501fd51b | ||
|
|
276b690c7e | ||
|
|
f65528ed41 | ||
|
|
200f0b020f | ||
|
|
02df4f722c | ||
|
|
cbad9a2993 | ||
|
|
1a2aa3fcc3 | ||
|
|
27657cd8cf | ||
|
|
851ce58496 | ||
|
|
763f8b8821 | ||
|
|
9b395107f4 | ||
|
|
d3754cc69b | ||
|
|
eb30d086be | ||
|
|
567bc9d3f1 | ||
|
|
ba0f401390 | ||
|
|
7bacf89b7e | ||
|
|
f273f7a17b | ||
|
|
645bbfa324 | ||
|
|
04558f4424 | ||
|
|
b4cd7ba224 | ||
|
|
4f183b4fe7 | ||
|
|
8d75bcef27 | ||
|
|
0458d919c0 | ||
|
|
be96bdbdaa | ||
|
|
096bece621 | ||
|
|
242e21e732 | ||
|
|
7c2dbb9cb1 | ||
|
|
410a3c5762 | ||
|
|
6fc031de6b | ||
|
|
54639a391b | ||
|
|
d55ac9708c | ||
|
|
e9c8915627 | ||
|
|
84f43891f6 | ||
|
|
948284b296 | ||
|
|
96aba6a4c7 | ||
|
|
08e94676ef | ||
|
|
19f1e721bb | ||
|
|
4ae69ee6a8 | ||
|
|
aa1b4e8968 | ||
|
|
5e34cab763 | ||
|
|
f478ddaa36 | ||
|
|
eb3e9e6dc7 | ||
|
|
4ab52670e9 | ||
|
|
ff20fd6c17 | ||
|
|
8b205f4e87 | ||
|
|
951a41ad1e | ||
|
|
13b23aa20a | ||
|
|
ddc05f60ea | ||
|
|
2ae70d7c72 | ||
|
|
dc1c54a35c | ||
|
|
638d5e6e39 | ||
|
|
7c1ce10fae | ||
|
|
74fcc19b8e | ||
|
|
98a674b2e9 | ||
|
|
c13a667443 | ||
|
|
5b82b1c426 | ||
|
|
676ea2ea3c | ||
|
|
0311e61389 | ||
|
|
b64ce2d0f0 | ||
|
|
48b20cf17d | ||
|
|
2af150e496 | ||
|
|
773e23d2e6 | ||
|
|
5c83a39e33 | ||
|
|
44df30f2d6 | ||
|
|
fa0dc110d9 | ||
|
|
763b0b689e | ||
|
|
9e21fb42fc | ||
|
|
25abcd1338 | ||
|
|
5897a90fd7 | ||
|
|
3ba71111de | ||
|
|
f359dab72e | ||
|
|
f526180278 | ||
|
|
0c1b4f93ca | ||
|
|
f28dad8261 | ||
|
|
ad81604c8c | ||
|
|
e9b0e8284b | ||
|
|
5a833d50ef | ||
|
|
8c454d7909 | ||
|
|
e06883dfcc | ||
|
|
51ce46e892 | ||
|
|
764f50bd3d | ||
|
|
343cbb9421 | ||
|
|
f2223e6dc5 | ||
|
|
401f581879 | ||
|
|
b01cbf1b76 | ||
|
|
00ac511053 | ||
|
|
a7720182d1 | ||
|
|
451ec5e6ec | ||
|
|
5f26b1b415 | ||
|
|
491ee1a1aa | ||
|
|
75a3af7d17 | ||
|
|
c510f1060d | ||
|
|
e7d71efdd9 | ||
|
|
7217266ca3 | ||
|
|
460ddd3a1d | ||
|
|
db54c8c57d | ||
|
|
714f8edd6c | ||
|
|
05c0d6840b | ||
|
|
b6978b2123 | ||
|
|
d8d651221c | ||
|
|
17a5de92fe | ||
|
|
22c16718c5 | ||
|
|
c140ccb72d | ||
|
|
ebf520f0d7 | ||
|
|
9813daa487 | ||
|
|
b4557ec25b | ||
|
|
6eb4acd7fd | ||
|
|
e47dfd7529 | ||
|
|
76ed1bdad8 | ||
|
|
97daaa0d03 | ||
|
|
9b0c0d56db | ||
|
|
b721942f26 | ||
|
|
d5842abd35 | ||
|
|
4ba5f806d7 | ||
|
|
fd4c86f9a4 | ||
|
|
2304077c2b | ||
|
|
821cf4b63f | ||
|
|
0d05f746cf | ||
|
|
45db1a512a | ||
|
|
fbdfcce157 | ||
|
|
c671554b03 | ||
|
|
6e0ef646b7 | ||
|
|
d31029a026 | ||
|
|
46110c7774 | ||
|
|
aec08dedad | ||
|
|
a2f7332558 | ||
|
|
83d0dab731 | ||
|
|
c1adb3c7ad | ||
|
|
0e2d9ff004 | ||
|
|
4e9c69747b | ||
|
|
64ef1ed841 | ||
|
|
9a91481a2b | ||
|
|
d9d5fde1e7 | ||
|
|
829ace3e68 | ||
|
|
1d13d95eeb | ||
|
|
3dc720588b | ||
|
|
5ebed51846 | ||
|
|
b1a12f6718 | ||
|
|
267997a4fd | ||
|
|
0e7483cc5a | ||
|
|
a5e56dc9db | ||
|
|
2fd0094ce3 | ||
|
|
ed549303d7 | ||
|
|
1111b0c5fe | ||
|
|
d50996b941 | ||
|
|
a05fcdcf23 | ||
|
|
3f154010f3 | ||
|
|
ad9271f86f | ||
|
|
bf8b03a928 | ||
|
|
eefdd4cef7 | ||
|
|
37dbcc2a80 | ||
|
|
74bc9bb8a6 | ||
|
|
21e8f43f8c | ||
|
|
9d84bef608 | ||
|
|
fd5da3a85e | ||
|
|
7ffc5ee8b0 | ||
|
|
7b09e504e7 | ||
|
|
0eb86404da | ||
|
|
e2dc2a8dd3 | ||
|
|
e8dc080307 | ||
|
|
c09f6ffbdb | ||
|
|
3ca7762517 | ||
|
|
9fbb55032a | ||
|
|
e30a9ba012 | ||
|
|
64d3a54b85 | ||
|
|
404e50bfb3 | ||
|
|
e7890261e5 | ||
|
|
2ea53cf51a | ||
|
|
560d294867 | ||
|
|
aac03a2066 | ||
|
|
9d3d20f063 | ||
|
|
7f44512c5d | ||
|
|
e211aa64e7 | ||
|
|
99f0971b73 | ||
|
|
9fac8dcbae | ||
|
|
2f09416258 | ||
|
|
72c169c2f1 | ||
|
|
cbdc90759c | ||
|
|
a14a68b216 | ||
|
|
ab2e725577 | ||
|
|
8187ddb3d7 | ||
|
|
81dd1f1737 | ||
|
|
6dca00cae6 | ||
|
|
f1fa801385 | ||
|
|
d4f95b7fd4 | ||
|
|
845ae5609d | ||
|
|
e3328ca20b | ||
|
|
b26a66ced0 | ||
|
|
6d5da3e33c | ||
|
|
cf2b700d93 | ||
|
|
56272d8507 | ||
|
|
21dff0640c | ||
|
|
66e6a55c7e | ||
|
|
81c90fcd76 | ||
|
|
ff6f1383d1 | ||
|
|
458b65a2f0 | ||
|
|
6e5e54b5ae | ||
|
|
a79c4dbda3 | ||
|
|
32a890bd26 | ||
|
|
d84178acd7 | ||
|
|
64b91fc94b | ||
|
|
b5598e2bda | ||
|
|
f2f6101e1c | ||
|
|
fbfafcf27a | ||
|
|
4d5baa0fad | ||
|
|
02959eb9d4 | ||
|
|
adda69e289 | ||
|
|
ff1e0f32fc | ||
|
|
a09031ecd0 | ||
|
|
d2188a7dde | ||
|
|
bac1fccf3a | ||
|
|
d5f3d0c2d7 | ||
|
|
539b2e48f0 | ||
|
|
1390f9deee | ||
|
|
9f46c4af44 | ||
|
|
f904142767 | ||
|
|
e515401912 | ||
|
|
b8c0875ef0 | ||
|
|
16e8f842f5 | ||
|
|
bf88d4adc0 | ||
|
|
9ce729e656 | ||
|
|
64820ed1ae | ||
|
|
026cdded71 | ||
|
|
4214428322 | ||
|
|
9828d17066 | ||
|
|
73e7d2ff2e | ||
|
|
23057b57fb | ||
|
|
16c43baa92 | ||
|
|
5d27044a24 | ||
|
|
cac67278d2 | ||
|
|
c927ae3f37 | ||
|
|
168c858844 | ||
|
|
f7ba6b94d9 | ||
|
|
d9757a4426 | ||
|
|
82e3bf32c3 | ||
|
|
a437fa5e23 | ||
|
|
06e670d043 | ||
|
|
b8c26df7e0 | ||
|
|
9e8bfa7f7b | ||
|
|
fb6ce027e1 | ||
|
|
bd89b78f8d | ||
|
|
09202da539 | ||
|
|
fbe9b4d76e | ||
|
|
71a095d0ee | ||
|
|
01af55cbf7 | ||
|
|
e836ded63b | ||
|
|
e7e4c113fd | ||
|
|
d268eae391 | ||
|
|
544f18ce7d | ||
|
|
fb2f7fb6b0 | ||
|
|
48bfddf9fc | ||
|
|
ce8ddce5c4 | ||
|
|
990ca286c1 | ||
|
|
ba3abf0733 | ||
|
|
fc76cc488d | ||
|
|
ebee78ae54 | ||
|
|
e83a798987 | ||
|
|
a8d5942028 | ||
|
|
7800ed531e | ||
|
|
df1a8696d5 | ||
|
|
7c39499aa0 | ||
|
|
facc7245fa | ||
|
|
e2a9845a94 | ||
|
|
083dfb059b | ||
|
|
3176f1acd2 | ||
|
|
6a314d85d8 | ||
|
|
b0ffd98c95 | ||
|
|
007e5937cf | ||
|
|
4efb612c1a | ||
|
|
c09ea05543 | ||
|
|
13a01467dc | ||
|
|
283458e631 | ||
|
|
957cd7955b | ||
|
|
fcf640dd6b | ||
|
|
16dab6f6db | ||
|
|
4b9d4641be | ||
|
|
380d9c3487 | ||
|
|
5aedce1521 | ||
|
|
6621b8eed0 | ||
|
|
a438f8a92a | ||
|
|
a5e4caba87 | ||
|
|
6800fa5564 | ||
|
|
673cab8183 | ||
|
|
7e9cfad780 | ||
|
|
070d2fd62b | ||
|
|
6a41f63aae | ||
|
|
0617eb51d0 | ||
|
|
965e63b970 | ||
|
|
e3f7055082 | ||
|
|
0ee4823f71 | ||
|
|
ab1d417e55 | ||
|
|
ee5ec0c505 | ||
|
|
2857b43d78 | ||
|
|
333d77ea9c | ||
|
|
eb541a962f | ||
|
|
49953705f1 | ||
|
|
128bbfa161 | ||
|
|
3e59a81327 | ||
|
|
c816b51b8c | ||
|
|
2918f50e90 | ||
|
|
474e769f07 | ||
|
|
80ce3031d1 | ||
|
|
b068bd6447 | ||
|
|
f24ed6715f | ||
|
|
77a141151f | ||
|
|
a98bb3abda | ||
|
|
8a3ed389bb | ||
|
|
629dde868c | ||
|
|
fa860d54c0 | ||
|
|
f7e5557f6e | ||
|
|
8e547a3677 | ||
|
|
770613e763 | ||
|
|
92e7d3c3bc | ||
|
|
677b609ee2 | ||
|
|
6445fc55a2 | ||
|
|
fe5e71cfaa | ||
|
|
315fcd5cd6 | ||
|
|
cf3f7ac197 | ||
|
|
76d2530a7e | ||
|
|
6251eb3ca6 | ||
|
|
1b783b9b9a | ||
|
|
563c0ab7a2 | ||
|
|
b00beb3027 | ||
|
|
0e05576999 | ||
|
|
675cc0d029 | ||
|
|
040263799f | ||
|
|
4d9a6e1a98 | ||
|
|
42df47a478 | ||
|
|
557eafd82e | ||
|
|
4bbddb6559 | ||
|
|
b450105bfd | ||
|
|
0b795ff92b | ||
|
|
e623c78708 | ||
|
|
6a1b3fcd19 | ||
|
|
c5967f3432 | ||
|
|
fe1178d848 | ||
|
|
6ecc901391 | ||
|
|
0c80a47d13 | ||
|
|
9a75737897 | ||
|
|
634a33c206 | ||
|
|
3ed5b0a01e | ||
|
|
3fab6618e2 | ||
|
|
7048b27ede | ||
|
|
aeb569d93d | ||
|
|
b634b18433 | ||
|
|
041135b01b | ||
|
|
b83c9dae09 | ||
|
|
69c2d56a31 | ||
|
|
4e6e08e11d | ||
|
|
7a3c62d0dd | ||
|
|
4a83568904 | ||
|
|
a45c3a3f23 | ||
|
|
1d47f812cd | ||
|
|
90986b4697 | ||
|
|
592c3c0767 | ||
|
|
5d40bf562c | ||
|
|
8da6590866 | ||
|
|
349ba3a536 | ||
|
|
d6b4808d80 | ||
|
|
77b86e7c68 | ||
|
|
d4288b9aee | ||
|
|
a291731ed3 | ||
|
|
1fbb89b1a0 | ||
|
|
b0d60f0351 | ||
|
|
537f72cffb | ||
|
|
05c0fccdf9 | ||
|
|
0e8598a256 | ||
|
|
d7e422644f | ||
|
|
5b000b1507 | ||
|
|
f5b4234c59 | ||
|
|
b820d101d6 | ||
|
|
24399dcbfb | ||
|
|
f417e94b89 | ||
|
|
a22990a56e | ||
|
|
51ace86089 | ||
|
|
1fb3798eb5 | ||
|
|
65454107d1 | ||
|
|
492592d5ec | ||
|
|
0b847d9933 | ||
|
|
ac72ff2a42 | ||
|
|
b354bc3813 | ||
|
|
ee7d9e9e18 | ||
|
|
f432ed648a | ||
|
|
e6c189902c | ||
|
|
70c17cc871 | ||
|
|
f7de9ede8a | ||
|
|
272fbe5c8a | ||
|
|
58b1093938 | ||
|
|
93266da580 | ||
|
|
fec23e1837 | ||
|
|
b3165ed3c1 | ||
|
|
26dfd309f6 | ||
|
|
56a1232923 | ||
|
|
28f3106ee9 | ||
|
|
58839706d0 | ||
|
|
ece3623070 | ||
|
|
17be568a6d | ||
|
|
6f6062af97 | ||
|
|
1fbc800c8b | ||
|
|
a8c91f6c0b | ||
|
|
49407420a2 | ||
|
|
1e30a12eb5 | ||
|
|
627725be1a | ||
|
|
bbad336b10 | ||
|
|
481e505d49 | ||
|
|
ef4ad331e1 | ||
|
|
9b1b9b2084 | ||
|
|
9805be9f11 | ||
|
|
23b99491a2 | ||
|
|
b6fc2cacce | ||
|
|
f7f55f0883 | ||
|
|
69f36791f1 | ||
|
|
8638b7ab3a | ||
|
|
bc423b6e4c | ||
|
|
3768d8363d | ||
|
|
b33a7e9cfb | ||
|
|
e98183c527 | ||
|
|
b311e786fe | ||
|
|
48c85562b8 | ||
|
|
0a8b69c947 | ||
|
|
2cc75dbc63 | ||
|
|
ce488547e8 | ||
|
|
0b1ce5d4f8 | ||
|
|
7db9d9f6b2 | ||
|
|
f8b2a63e57 | ||
|
|
ab530a67d5 | ||
|
|
2fff1e5671 | ||
|
|
37745efcae | ||
|
|
e5fb2523b4 | ||
|
|
9e54a128b8 | ||
|
|
f20cad1508 | ||
|
|
b159bcacff | ||
|
|
6658364b30 | ||
|
|
b21f9bdc98 | ||
|
|
5339481434 | ||
|
|
4c26ea65a1 | ||
|
|
58d8ed1284 | ||
|
|
72a19935ff | ||
|
|
8efa935340 | ||
|
|
6c0b1d6a5f | ||
|
|
f47ebf8582 | ||
|
|
247d22682a | ||
|
|
5fe0bd0c61 | ||
|
|
a50e0e4c41 | ||
|
|
9ddfc38833 | ||
|
|
6f0a508666 | ||
|
|
61059a3dc7 | ||
|
|
32c3de1779 | ||
|
|
b06cdd876f | ||
|
|
df9d590cbc | ||
|
|
e5ea802c0c | ||
|
|
72f35d050c | ||
|
|
a59fcf3c3a | ||
|
|
b028d6eaa3 | ||
|
|
638337cf4a | ||
|
|
05996c589f | ||
|
|
8a486dfe60 | ||
|
|
8aaa48e041 | ||
|
|
d44752d2ca | ||
|
|
8d6b81e175 | ||
|
|
007a086bcd | ||
|
|
9843f9df79 | ||
|
|
1f39b8dce7 | ||
|
|
44088f5463 | ||
|
|
93bd5ffe05 | ||
|
|
cb6d5b0c4b | ||
|
|
6a307367a8 | ||
|
|
85902939a7 | ||
|
|
309491de6d | ||
|
|
2a03779965 | ||
|
|
b3d3d731ac | ||
|
|
1657ad3db3 | ||
|
|
bc90e51a2f | ||
|
|
129931fdcd | ||
|
|
d3f52c3b45 | ||
|
|
56add54053 | ||
|
|
559fa91b8d | ||
|
|
ea9d389751 | ||
|
|
534eeaf7bc | ||
|
|
c03e74ab48 | ||
|
|
a0985c387b | ||
|
|
9426bb5642 | ||
|
|
03e6c2ed9a | ||
|
|
c28054301c | ||
|
|
2e72244bde | ||
|
|
be8f80d6d2 | ||
|
|
eb2b42e800 | ||
|
|
978cf8aee5 |
@@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<title>WordPress › ReadMe</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="wp-admin/install.css" type="text/css" />
|
||||
<link rel="stylesheet" href="wp-admin/css/install.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="logo" style="text-align: center">
|
||||
<img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
|
||||
<br /> Version 2.2
|
||||
<br /> Version 2.3
|
||||
</h1>
|
||||
<p style="text-align: center">Semantic Personal Publishing Platform</p>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<h1>Upgrading</h1>
|
||||
<p>Before you upgrade anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</p>
|
||||
<h2>Upgrading from any previous WordPress to 2.2:</h2>
|
||||
<h2>Upgrading from any previous WordPress to 2.3:</h2>
|
||||
<ol>
|
||||
<li>Delete your old WP files, saving ones you've modified.</li>
|
||||
<li>Upload the new files.</li>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require_once('../wp-config.php');
|
||||
require_once('admin-functions.php');
|
||||
require_once('admin-db.php');
|
||||
require_once('includes/admin.php');
|
||||
|
||||
define('DOING_AJAX', true);
|
||||
|
||||
@@ -126,6 +125,28 @@ case 'add-category' : // On the Fly
|
||||
}
|
||||
$x->send();
|
||||
break;
|
||||
case 'add-link-category' : // On the Fly
|
||||
if ( !current_user_can( 'manage_categories' ) )
|
||||
die('-1');
|
||||
$names = explode(',', $_POST['newcat']);
|
||||
$x = new WP_Ajax_Response();
|
||||
foreach ( $names as $cat_name ) {
|
||||
$cat_name = trim($cat_name);
|
||||
if ( !$slug = sanitize_title($cat_name) )
|
||||
die('0');
|
||||
if ( !$cat_id = is_term( $cat_name, 'link_category' ) ) {
|
||||
$cat_id = wp_insert_term( $cat_name, 'link_category' );
|
||||
$cat_id = $cat_id['term_id'];
|
||||
}
|
||||
$cat_name = wp_specialchars(stripslashes($cat_name));
|
||||
$x->add( array(
|
||||
'what' => 'link-category',
|
||||
'id' => $cat_id,
|
||||
'data' => "<li id='link-category-$cat_id'><label for='in-link-category-$cat_id' class='selectit'><input value='$cat_id' type='checkbox' checked='checked' name='link_category[]' id='in-link-category-$cat_id'/> $cat_name</label></li>"
|
||||
) );
|
||||
}
|
||||
$x->send();
|
||||
break;
|
||||
case 'add-cat' : // From Manage->Categories
|
||||
if ( !current_user_can( 'manage_categories' ) )
|
||||
die('-1');
|
||||
@@ -183,8 +204,11 @@ case 'add-meta' :
|
||||
$now = current_time('timestamp', 1);
|
||||
if ( $pid = wp_insert_post( array(
|
||||
'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now))
|
||||
) ) )
|
||||
) ) ) {
|
||||
if ( is_wp_error( $pid ) )
|
||||
return $pid;
|
||||
$mid = add_meta( $pid );
|
||||
}
|
||||
else
|
||||
die('0');
|
||||
} else if ( !$mid = add_meta( $id ) ) {
|
||||
@@ -286,7 +310,7 @@ case 'autosave-generate-nonces' :
|
||||
die(wp_create_nonce('update-page_' . $ID));
|
||||
}
|
||||
}
|
||||
die($_POST['post_type']);
|
||||
die('0');
|
||||
break;
|
||||
default :
|
||||
do_action( 'wp_ajax_' . $_POST['action'] );
|
||||
|
||||
@@ -1,525 +0,0 @@
|
||||
<?php
|
||||
|
||||
function get_users_drafts( $user_id ) {
|
||||
global $wpdb;
|
||||
$user_id = (int) $user_id;
|
||||
$query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = $user_id ORDER BY ID DESC";
|
||||
$query = apply_filters('get_users_drafts', $query);
|
||||
return $wpdb->get_results( $query );
|
||||
}
|
||||
|
||||
function get_others_drafts( $user_id ) {
|
||||
global $wpdb;
|
||||
$user = get_userdata( $user_id );
|
||||
$level_key = $wpdb->prefix . 'user_level';
|
||||
|
||||
$editable = get_editable_user_ids( $user_id );
|
||||
|
||||
if( !$editable ) {
|
||||
$other_drafts = '';
|
||||
} else {
|
||||
$editable = join(',', $editable);
|
||||
$other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' ");
|
||||
}
|
||||
|
||||
return apply_filters('get_others_drafts', $other_drafts);
|
||||
}
|
||||
|
||||
function get_editable_authors( $user_id ) {
|
||||
global $wpdb;
|
||||
|
||||
$editable = get_editable_user_ids( $user_id );
|
||||
|
||||
if( !$editable ) {
|
||||
return false;
|
||||
} else {
|
||||
$editable = join(',', $editable);
|
||||
$authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
|
||||
}
|
||||
|
||||
return apply_filters('get_editable_authors', $authors);
|
||||
}
|
||||
|
||||
function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
|
||||
global $wpdb;
|
||||
|
||||
$user = new WP_User( $user_id );
|
||||
|
||||
if ( ! $user->has_cap('edit_others_posts') ) {
|
||||
if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
|
||||
return array($user->id);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
$level_key = $wpdb->prefix . 'user_level';
|
||||
|
||||
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
|
||||
if ( $exclude_zeros )
|
||||
$query .= " AND meta_value != '0'";
|
||||
|
||||
return $wpdb->get_col( $query );
|
||||
}
|
||||
|
||||
function get_author_user_ids() {
|
||||
global $wpdb;
|
||||
$level_key = $wpdb->prefix . 'user_level';
|
||||
|
||||
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value != '0'";
|
||||
|
||||
return $wpdb->get_col( $query );
|
||||
}
|
||||
|
||||
function get_nonauthor_user_ids() {
|
||||
global $wpdb;
|
||||
$level_key = $wpdb->prefix . 'user_level';
|
||||
|
||||
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value = '0'";
|
||||
|
||||
return $wpdb->get_col( $query );
|
||||
}
|
||||
|
||||
function wp_insert_category($catarr) {
|
||||
global $wpdb;
|
||||
|
||||
extract($catarr, EXTR_SKIP);
|
||||
|
||||
if( trim( $cat_name ) == '' )
|
||||
return 0;
|
||||
|
||||
$cat_ID = (int) $cat_ID;
|
||||
|
||||
// Are we updating or creating?
|
||||
if (!empty ($cat_ID))
|
||||
$update = true;
|
||||
else
|
||||
$update = false;
|
||||
|
||||
$cat_name = apply_filters('pre_category_name', $cat_name);
|
||||
|
||||
if (empty ($category_nicename))
|
||||
$category_nicename = sanitize_title($cat_name);
|
||||
else
|
||||
$category_nicename = sanitize_title($category_nicename);
|
||||
$category_nicename = apply_filters('pre_category_nicename', $category_nicename);
|
||||
|
||||
if (empty ($category_description))
|
||||
$category_description = '';
|
||||
$category_description = apply_filters('pre_category_description', $category_description);
|
||||
|
||||
$category_parent = (int) $category_parent;
|
||||
if ( empty($category_parent) || !get_category( $category_parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $category_parent) ) )
|
||||
$category_parent = 0;
|
||||
|
||||
if ( isset($posts_private) )
|
||||
$posts_private = (int) $posts_private;
|
||||
else
|
||||
$posts_private = 0;
|
||||
|
||||
if ( isset($links_private) )
|
||||
$links_private = (int) $links_private;
|
||||
else
|
||||
$links_private = 0;
|
||||
|
||||
if (!$update) {
|
||||
$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent, links_private, posts_private) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent', '$links_private', '$posts_private')");
|
||||
$cat_ID = (int) $wpdb->insert_id;
|
||||
} else {
|
||||
$wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent', links_private = '$links_private', posts_private = '$posts_private' WHERE cat_ID = '$cat_ID'");
|
||||
}
|
||||
|
||||
if ( $category_nicename == '' ) {
|
||||
$category_nicename = sanitize_title($cat_name, $cat_ID );
|
||||
$wpdb->query( "UPDATE $wpdb->categories SET category_nicename = '$category_nicename' WHERE cat_ID = '$cat_ID'" );
|
||||
}
|
||||
|
||||
// Keep in mind when using this filter and altering the cat_ID that the two queries above
|
||||
// have already taken place with the OLD cat_ID
|
||||
// Also note that you may have post2cat entries with the old cat_ID if this is an update
|
||||
|
||||
if ($update) {
|
||||
do_action('edit_category', $cat_ID);
|
||||
} else {
|
||||
do_action('create_category', $cat_ID);
|
||||
do_action('add_category', $cat_ID);
|
||||
}
|
||||
|
||||
$cat_ID = apply_filters('cat_id_filter', $cat_ID, $update);
|
||||
|
||||
clean_category_cache($cat_ID);
|
||||
|
||||
if ($update)
|
||||
do_action('edited_category', $cat_ID);
|
||||
else
|
||||
do_action('created_category', $cat_ID);
|
||||
|
||||
return $cat_ID;
|
||||
}
|
||||
|
||||
function wp_update_category($catarr) {
|
||||
global $wpdb;
|
||||
|
||||
$cat_ID = (int) $catarr['cat_ID'];
|
||||
|
||||
if( $cat_ID == $catarr['category_parent'] )
|
||||
return false;
|
||||
|
||||
// First, get all of the original fields
|
||||
$category = get_category($cat_ID, ARRAY_A);
|
||||
|
||||
// Escape data pulled from DB.
|
||||
$category = add_magic_quotes($category);
|
||||
|
||||
// Merge old and new fields with new fields overwriting old ones.
|
||||
$catarr = array_merge($category, $catarr);
|
||||
|
||||
return wp_insert_category($catarr);
|
||||
}
|
||||
|
||||
function wp_delete_category($cat_ID) {
|
||||
global $wpdb;
|
||||
|
||||
$cat_ID = (int) $cat_ID;
|
||||
$default_cat = get_option('default_category');
|
||||
$default_link_cat = get_option('default_link_category');
|
||||
|
||||
// Don't delete either of the default cats
|
||||
if ( $cat_ID == $default_cat || $cat_ID == $default_link_cat )
|
||||
return 0;
|
||||
|
||||
$category = get_category($cat_ID);
|
||||
|
||||
$parent = $category->category_parent;
|
||||
|
||||
// Delete the category
|
||||
if ( !$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'") )
|
||||
return 0;
|
||||
|
||||
// Update children to point to new parent
|
||||
$wpdb->query("UPDATE $wpdb->categories SET category_parent = '$parent' WHERE category_parent = '$cat_ID'");
|
||||
|
||||
// Only set posts and links to the default category if they're not in another category already
|
||||
$posts = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id='$cat_ID'");
|
||||
foreach ( (array) $posts as $post_id ) {
|
||||
$cats = wp_get_post_categories($post_id);
|
||||
if ( 1 == count($cats) )
|
||||
$cats = array($default_cat);
|
||||
else
|
||||
$cats = array_diff($cats, array($cat_ID));
|
||||
wp_set_post_categories($post_id, $cats);
|
||||
}
|
||||
|
||||
$links = $wpdb->get_col("SELECT link_id FROM $wpdb->link2cat WHERE category_id='$cat_ID'");
|
||||
foreach ( (array) $links as $link_id ) {
|
||||
$cats = wp_get_link_cats($link_id);
|
||||
if ( 1 == count($cats) )
|
||||
$cats = array($default_link_cat);
|
||||
else
|
||||
$cats = array_diff($cats, array($cat_ID));
|
||||
wp_set_link_cats($link_id, $cats);
|
||||
}
|
||||
|
||||
clean_category_cache($cat_ID);
|
||||
do_action('delete_category', $cat_ID);
|
||||
return 1;
|
||||
}
|
||||
|
||||
function wp_create_category($cat_name) {
|
||||
$cat_array = compact('cat_name');
|
||||
return wp_insert_category($cat_array);
|
||||
}
|
||||
|
||||
function wp_create_categories($categories, $post_id = '') {
|
||||
$cat_ids = array ();
|
||||
foreach ($categories as $category) {
|
||||
if ($id = category_exists($category))
|
||||
$cat_ids[] = $id;
|
||||
else
|
||||
if ($id = wp_create_category($category))
|
||||
$cat_ids[] = $id;
|
||||
}
|
||||
|
||||
if ($post_id)
|
||||
wp_set_post_categories($post_id, $cat_ids);
|
||||
|
||||
return $cat_ids;
|
||||
}
|
||||
|
||||
function category_exists($cat_name) {
|
||||
global $wpdb;
|
||||
if (!$category_nicename = sanitize_title($cat_name))
|
||||
return 0;
|
||||
|
||||
return (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'");
|
||||
}
|
||||
|
||||
function wp_delete_user($id, $reassign = 'novalue') {
|
||||
global $wpdb;
|
||||
|
||||
$id = (int) $id;
|
||||
$user = get_userdata($id);
|
||||
|
||||
if ($reassign == 'novalue') {
|
||||
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
|
||||
|
||||
if ($post_ids) {
|
||||
foreach ($post_ids as $post_id)
|
||||
wp_delete_post($post_id);
|
||||
}
|
||||
|
||||
// Clean links
|
||||
$wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
|
||||
} else {
|
||||
$reassign = (int) $reassign;
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_author = {$reassign} WHERE post_author = {$id}");
|
||||
$wpdb->query("UPDATE $wpdb->links SET link_owner = {$reassign} WHERE link_owner = {$id}");
|
||||
}
|
||||
|
||||
// FINALLY, delete user
|
||||
do_action('delete_user', $id);
|
||||
|
||||
$wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
|
||||
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$id'");
|
||||
|
||||
wp_cache_delete($id, 'users');
|
||||
wp_cache_delete($user->user_login, 'userlogins');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function wp_revoke_user($id) {
|
||||
$id = (int) $id;
|
||||
|
||||
$user = new WP_User($id);
|
||||
$user->remove_all_caps();
|
||||
}
|
||||
|
||||
function wp_insert_link($linkdata) {
|
||||
global $wpdb, $current_user;
|
||||
|
||||
extract($linkdata, EXTR_SKIP);
|
||||
|
||||
$update = false;
|
||||
|
||||
if ( !empty($link_id) )
|
||||
$update = true;
|
||||
|
||||
$link_id = (int) $link_id;
|
||||
|
||||
if( trim( $link_name ) == '' )
|
||||
return 0;
|
||||
$link_name = apply_filters('pre_link_name', $link_name);
|
||||
|
||||
if( trim( $link_url ) == '' )
|
||||
return 0;
|
||||
$link_url = apply_filters('pre_link_url', $link_url);
|
||||
|
||||
if ( empty($link_rating) )
|
||||
$link_rating = 0;
|
||||
else
|
||||
$link_rating = (int) $link_rating;
|
||||
|
||||
if ( empty($link_image) )
|
||||
$link_image = '';
|
||||
$link_image = apply_filters('pre_link_image', $link_image);
|
||||
|
||||
if ( empty($link_target) )
|
||||
$link_target = '';
|
||||
$link_target = apply_filters('pre_link_target', $link_target);
|
||||
|
||||
if ( empty($link_visible) )
|
||||
$link_visible = 'Y';
|
||||
$link_visibile = preg_replace('/[^YNyn]/', '', $link_visible);
|
||||
|
||||
if ( empty($link_owner) )
|
||||
$link_owner = $current_user->id;
|
||||
else
|
||||
$link_owner = (int) $link_owner;
|
||||
|
||||
if ( empty($link_notes) )
|
||||
$link_notes = '';
|
||||
$link_notes = apply_filters('pre_link_notes', $link_notes);
|
||||
|
||||
if ( empty($link_description) )
|
||||
$link_description = '';
|
||||
$link_description = apply_filters('pre_link_description', $link_description);
|
||||
|
||||
if ( empty($link_rss) )
|
||||
$link_rss = '';
|
||||
$link_rss = apply_filters('pre_link_rss', $link_rss);
|
||||
|
||||
if ( empty($link_rel) )
|
||||
$link_rel = '';
|
||||
$link_rel = apply_filters('pre_link_rel', $link_rel);
|
||||
|
||||
// Make sure we set a valid category
|
||||
if (0 == count($link_category) || !is_array($link_category)) {
|
||||
$link_category = array(get_option('default_link_category'));
|
||||
}
|
||||
|
||||
if ( $update ) {
|
||||
$wpdb->query("UPDATE $wpdb->links SET link_url='$link_url',
|
||||
link_name='$link_name', link_image='$link_image',
|
||||
link_target='$link_target',
|
||||
link_visible='$link_visible', link_description='$link_description',
|
||||
link_rating='$link_rating', link_rel='$link_rel',
|
||||
link_notes='$link_notes', link_rss = '$link_rss'
|
||||
WHERE link_id='$link_id'");
|
||||
} else {
|
||||
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
|
||||
$link_id = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
wp_set_link_cats($link_id, $link_category);
|
||||
|
||||
if ( $update )
|
||||
do_action('edit_link', $link_id);
|
||||
else
|
||||
do_action('add_link', $link_id);
|
||||
|
||||
return $link_id;
|
||||
}
|
||||
|
||||
function wp_update_link($linkdata) {
|
||||
global $wpdb;
|
||||
|
||||
$link_id = (int) $linkdata['link_id'];
|
||||
|
||||
$link = get_link($link_id, ARRAY_A);
|
||||
|
||||
// Escape data pulled from DB.
|
||||
$link = add_magic_quotes($link);
|
||||
|
||||
// Passed link category list overwrites existing category list if not empty.
|
||||
if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
|
||||
&& 0 != count($linkdata['link_category']) )
|
||||
$link_cats = $linkdata['link_category'];
|
||||
else
|
||||
$link_cats = $link['link_category'];
|
||||
|
||||
// Merge old and new fields with new fields overwriting old ones.
|
||||
$linkdata = array_merge($link, $linkdata);
|
||||
$linkdata['link_category'] = $link_cats;
|
||||
|
||||
return wp_insert_link($linkdata);
|
||||
}
|
||||
|
||||
function wp_delete_link($link_id) {
|
||||
global $wpdb;
|
||||
|
||||
do_action('delete_link', $link_id);
|
||||
|
||||
$categories = wp_get_link_cats($link_id);
|
||||
if( is_array( $categories ) ) {
|
||||
foreach ( $categories as $category ) {
|
||||
$wpdb->query("UPDATE $wpdb->categories SET link_count = link_count - 1 WHERE cat_ID = '$category'");
|
||||
wp_cache_delete($category, 'category');
|
||||
do_action('edit_category', $cat_id);
|
||||
}
|
||||
}
|
||||
|
||||
$wpdb->query("DELETE FROM $wpdb->link2cat WHERE link_id = '$link_id'");
|
||||
$wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
|
||||
|
||||
do_action('deleted_link', $link_id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function wp_get_link_cats($link_ID = 0) {
|
||||
global $wpdb;
|
||||
|
||||
$sql = "SELECT category_id
|
||||
FROM $wpdb->link2cat
|
||||
WHERE link_id = $link_ID
|
||||
ORDER BY category_id";
|
||||
|
||||
$result = $wpdb->get_col($sql);
|
||||
|
||||
if ( !$result )
|
||||
$result = array();
|
||||
|
||||
return array_unique($result);
|
||||
}
|
||||
|
||||
function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
|
||||
global $wpdb;
|
||||
// If $link_categories isn't already an array, make it one:
|
||||
if (!is_array($link_categories) || 0 == count($link_categories))
|
||||
$link_categories = array(get_option('default_link_category'));
|
||||
|
||||
$link_categories = array_unique($link_categories);
|
||||
|
||||
// First the old categories
|
||||
$old_categories = $wpdb->get_col("
|
||||
SELECT category_id
|
||||
FROM $wpdb->link2cat
|
||||
WHERE link_id = '$link_ID'");
|
||||
|
||||
if (!$old_categories) {
|
||||
$old_categories = array();
|
||||
} else {
|
||||
$old_categories = array_unique($old_categories);
|
||||
}
|
||||
|
||||
// Delete any?
|
||||
$delete_cats = array_diff($old_categories,$link_categories);
|
||||
|
||||
if ($delete_cats) {
|
||||
foreach ($delete_cats as $del) {
|
||||
$del = (int) $del;
|
||||
$wpdb->query("
|
||||
DELETE FROM $wpdb->link2cat
|
||||
WHERE category_id = '$del'
|
||||
AND link_id = '$link_ID'
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
// Add any?
|
||||
$add_cats = array_diff($link_categories, $old_categories);
|
||||
|
||||
if ($add_cats) {
|
||||
foreach ($add_cats as $new_cat) {
|
||||
$new_cat = (int) $new_cat;
|
||||
if ( !empty($new_cat) )
|
||||
$wpdb->query("
|
||||
INSERT INTO $wpdb->link2cat (link_id, category_id)
|
||||
VALUES ('$link_ID', '$new_cat')");
|
||||
}
|
||||
}
|
||||
|
||||
// Update category counts.
|
||||
$all_affected_cats = array_unique(array_merge($link_categories, $old_categories));
|
||||
foreach ( $all_affected_cats as $cat_id ) {
|
||||
$count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->link2cat, $wpdb->links WHERE $wpdb->links.link_id = $wpdb->link2cat.link_id AND category_id = '$cat_id'");
|
||||
$wpdb->query("UPDATE $wpdb->categories SET link_count = '$count' WHERE cat_ID = '$cat_id'");
|
||||
wp_cache_delete($cat_id, 'category');
|
||||
do_action('edit_category', $cat_id);
|
||||
}
|
||||
|
||||
} // wp_set_link_cats()
|
||||
|
||||
function post_exists($title, $content = '', $post_date = '') {
|
||||
global $wpdb;
|
||||
|
||||
if (!empty ($post_date))
|
||||
$post_date = "AND post_date = '$post_date'";
|
||||
|
||||
if (!empty ($title))
|
||||
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date");
|
||||
else
|
||||
if (!empty ($content))
|
||||
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function comment_exists($comment_author, $comment_date) {
|
||||
global $wpdb;
|
||||
|
||||
return $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments
|
||||
WHERE comment_author = '$comment_author' AND comment_date = '$comment_date'");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,10 +1,13 @@
|
||||
|
||||
<div id="footer">
|
||||
<p class="logo"><a href="http://wordpress.org/" id="wordpress-logo"><img src="images/wordpress-logo.png" alt="WordPress" /></a></p>
|
||||
<p class="docs"><?php _e('<a href="http://codex.wordpress.org/">Documentation</a>'); ?> — <?php _e('<a href="http://wordpress.org/support/">Support Forums</a>'); ?><br />
|
||||
<?php bloginfo('version'); ?> — <?php printf(__('%s seconds'), timer_stop(0, 2)); ?></p>
|
||||
<p><?php
|
||||
|
||||
$upgrade = apply_filters( 'update_footer', '' );
|
||||
echo __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>').' | '.__('<a href="http://codex.wordpress.org/">Documentation</a>').' | '.__('<a href="http://wordpress.org/support/forum/4">Feedback</a>').' '.$upgrade;
|
||||
|
||||
?></p>
|
||||
</div>
|
||||
<?php do_action('admin_footer', ''); ?>
|
||||
<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
|
||||
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
|
||||
if (!isset($_GET["page"])) require_once('admin.php');
|
||||
if ( $editing ) {
|
||||
wp_enqueue_script( array('dbx-admin-key?pagenow=' . attribute_escape($pagenow),'admin-custom-fields') );
|
||||
@@ -17,10 +17,7 @@ get_admin_page_title();
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
|
||||
<title><?php bloginfo('name') ?> › <?php echo wp_specialchars( strip_tags( $title ) ); ?> — WordPress</title>
|
||||
<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
|
||||
<?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
|
||||
<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" />
|
||||
<?php endif; ?>
|
||||
<?php wp_admin_css(); ?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
|
||||
@@ -42,16 +39,16 @@ else if ( isset($plugin_page) )
|
||||
do_action('admin_head');
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<body class="wp-admin <?php echo apply_filters( 'admin_body_class', '' ); ?>">
|
||||
<div id="wphead">
|
||||
<h1><?php bloginfo('name'); ?> <span>(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site »') ?></a>)</span></h1>
|
||||
<h1><?php bloginfo('name'); ?> <span id="viewsite">(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site »') ?></a>)</span></h1>
|
||||
</div>
|
||||
<div id="user_info"><p><?php printf(__('Howdy, <strong>%s</strong>.'), $user_identity) ?> [<a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php _e('Sign Out'); ?></a>, <a href="profile.php"><?php _e('My Profile'); ?></a>] </p></div>
|
||||
|
||||
<?php
|
||||
require(ABSPATH . '/wp-admin/menu-header.php');
|
||||
require(ABSPATH . 'wp-admin/menu-header.php');
|
||||
|
||||
if ( $parent_file == 'options-general.php' ) {
|
||||
require(ABSPATH . '/wp-admin/options-head.php');
|
||||
require(ABSPATH . 'wp-admin/options-head.php');
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -9,9 +9,7 @@ if ( get_option('db_version') != $wp_db_version ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(ABSPATH . 'wp-admin/admin-functions.php');
|
||||
require_once(ABSPATH . 'wp-admin/admin-db.php');
|
||||
require_once(ABSPATH . WPINC . '/registration.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/admin.php');
|
||||
|
||||
auth_redirect();
|
||||
|
||||
@@ -37,7 +35,7 @@ if (isset($_GET['page'])) {
|
||||
$plugin_page = plugin_basename($plugin_page);
|
||||
}
|
||||
|
||||
require(ABSPATH . '/wp-admin/menu.php');
|
||||
require(ABSPATH . 'wp-admin/menu.php');
|
||||
|
||||
// Handle plugin admin pages.
|
||||
if (isset($plugin_page)) {
|
||||
@@ -46,7 +44,7 @@ if (isset($plugin_page)) {
|
||||
if ( $page_hook ) {
|
||||
do_action('load-' . $page_hook);
|
||||
if (! isset($_GET['noheader']))
|
||||
require_once(ABSPATH . '/wp-admin/admin-header.php');
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
|
||||
do_action($page_hook);
|
||||
} else {
|
||||
@@ -60,7 +58,7 @@ if (isset($plugin_page)) {
|
||||
do_action('load-' . $plugin_page);
|
||||
|
||||
if (! isset($_GET['noheader']))
|
||||
require_once(ABSPATH . '/wp-admin/admin-header.php');
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
|
||||
include(ABSPATH . PLUGINDIR . "/$plugin_page");
|
||||
}
|
||||
@@ -79,10 +77,15 @@ if (isset($plugin_page)) {
|
||||
wp_die(__('Invalid importer.'));
|
||||
}
|
||||
|
||||
if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
|
||||
wp_die(__('Cannot load importer.'));
|
||||
|
||||
include(ABSPATH . "wp-admin/import/$importer.php");
|
||||
// Allow plugins to define importers as well
|
||||
if (! is_callable($wp_importers[$importer][2]))
|
||||
{
|
||||
if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
|
||||
{
|
||||
wp_die(__('Cannot load importer.'));
|
||||
}
|
||||
include(ABSPATH . "wp-admin/import/$importer.php");
|
||||
}
|
||||
|
||||
$parent_file = 'edit.php';
|
||||
$submenu_file = 'import.php';
|
||||
@@ -91,7 +94,7 @@ if (isset($plugin_page)) {
|
||||
if (! isset($_GET['noheader']))
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
|
||||
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
||||
|
||||
define('WP_IMPORTING', true);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ if ( !empty($content) ) {
|
||||
<head>
|
||||
<title><?php bloginfo('name') ?> › Bookmarklet — WordPress</title>
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
|
||||
<link rel="stylesheet" href="wp-admin.css" type="text/css" />
|
||||
<?php wp_admin_css(); ?>
|
||||
|
||||
<style type="text/css">
|
||||
<!--
|
||||
|
||||
@@ -36,9 +36,6 @@ case 'delete':
|
||||
if ( $cat_ID == get_option('default_category') )
|
||||
wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
|
||||
|
||||
if ( $cat_ID == get_option('default_link_category') )
|
||||
wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one for links"), $cat_name));
|
||||
|
||||
wp_delete_category($cat_ID);
|
||||
|
||||
wp_redirect('categories.php?message=2');
|
||||
@@ -63,9 +60,9 @@ case 'editedcat':
|
||||
wp_die(__('Cheatin’ uh?'));
|
||||
|
||||
if ( wp_update_category($_POST) )
|
||||
wp_redirect('categories.php?message=3');
|
||||
wp_redirect('categories.php?message=3');
|
||||
else
|
||||
wp_redirect('categories.php?message=5');
|
||||
wp_redirect('categories.php?message=5');
|
||||
|
||||
exit;
|
||||
break;
|
||||
@@ -99,7 +96,6 @@ $messages[5] = __('Category not updated.');
|
||||
<th scope="col"><?php _e('Name') ?></th>
|
||||
<th scope="col"><?php _e('Description') ?></th>
|
||||
<th scope="col" width="90" style="text-align: center"><?php _e('Posts') ?></th>
|
||||
<th scope="col" width="90" style="text-align: center"><?php _e('Links') ?></th>
|
||||
<th colspan="2" style="text-align: center"><?php _e('Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -114,10 +110,12 @@ cat_rows();
|
||||
|
||||
<?php if ( current_user_can('manage_categories') ) : ?>
|
||||
<div class="wrap">
|
||||
<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts and links in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong> and links that were only assigned to the deleted category are set to <strong>%s</strong>.'), apply_filters('the_category', get_catname(get_option('default_category'))), apply_filters('the_category', get_catname(get_option('default_link_category')))) ?></p>
|
||||
<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), apply_filters('the_category', get_catname(get_option('default_category')))) ?></p>
|
||||
<p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'admin.php?import=wp-cat2tag') ?></p>
|
||||
</div>
|
||||
|
||||
<?php include('edit-category-form.php'); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -91,7 +91,7 @@ case 'mac':
|
||||
<?php if ( $comment->comment_author_url ) { ?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('URL:'); ?></th>
|
||||
<td><?php echo $comment->comment_author_url; ?></td>
|
||||
<td><a href='<?php echo $comment->comment_author_url; ?>'><?php echo $comment->comment_author_url; ?></a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
@@ -155,7 +155,7 @@ case 'unapprovecomment':
|
||||
if ((wp_get_referer() != "") && (false == $noredir)) {
|
||||
wp_redirect(wp_get_referer());
|
||||
} else {
|
||||
wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='. (int) $comment->comment_post_ID.'&c=1#comments');
|
||||
wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p=' . (int) $comment->comment_post_ID.'&c=1#comments');
|
||||
}
|
||||
exit();
|
||||
break;
|
||||
@@ -185,7 +185,7 @@ case 'approvecomment':
|
||||
if ((wp_get_referer() != "") && (false == $noredir)) {
|
||||
wp_redirect(wp_get_referer());
|
||||
} else {
|
||||
wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='. (int) $comment->comment_post_ID.'&c=1#comments');
|
||||
wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p=' . (int) $comment->comment_post_ID.'&c=1#comments');
|
||||
}
|
||||
exit();
|
||||
break;
|
||||
|
||||
15
wp-admin/css/install-rtl.css
Normal file
15
wp-admin/css/install-rtl.css
Normal file
@@ -0,0 +1,15 @@
|
||||
body { font: 13px Tahoma, Georgia, "Times New Roman", Times, serif; }
|
||||
|
||||
ul, ol { padding: 5px 20px 5px 5px; }
|
||||
|
||||
h1, h2, h3 { font-family: "Times New Roman", Times, serif; font-weight: 700 }
|
||||
|
||||
.step, th { text-align: left }
|
||||
|
||||
input { font-family: "Times New Roman", Times, serif; padding: 1px }
|
||||
|
||||
#logo { background: url(../wp-content/plugins/WP-Jalali/wp-fa-logo.png) center right no-repeat; text-align: left; }
|
||||
|
||||
#admin_email {direction: ltr; text-align: left; }
|
||||
|
||||
#footer { font-style: normal; }
|
||||
12
wp-admin/css/upload-rtl.css
Normal file
12
wp-admin/css/upload-rtl.css
Normal file
@@ -0,0 +1,12 @@
|
||||
html {
|
||||
direction: ltr;
|
||||
}
|
||||
#uploadoptions, table {
|
||||
direction: rtl;
|
||||
}
|
||||
td {
|
||||
padding: 1px 6px 0;
|
||||
}
|
||||
.submit {
|
||||
text-align: left;
|
||||
}
|
||||
38
wp-admin/css/widgets-rtl.css
Normal file
38
wp-admin/css/widgets-rtl.css
Normal file
@@ -0,0 +1,38 @@
|
||||
.dropzone,
|
||||
#palettediv,
|
||||
.handle,
|
||||
.controlform {
|
||||
direction: rtl;
|
||||
text-align: justify;
|
||||
}
|
||||
.dropzone {
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
margin-right: auto;
|
||||
width: 240px;
|
||||
}
|
||||
* html .dropzone ul {
|
||||
margin-right: 0;
|
||||
}
|
||||
* .handle, #lastmodule span {
|
||||
border-left: 1px solid #e8e8e8;
|
||||
border-right: 1px solid #f2f2f2;
|
||||
}
|
||||
* .popper {
|
||||
right: auto;
|
||||
left: 3px;
|
||||
}
|
||||
#palettediv .module, #lastmodule {
|
||||
margin-right: auto;
|
||||
margin-left: 10px;
|
||||
float: right;
|
||||
}
|
||||
#palettediv ul {
|
||||
padding: 0 10px 0 0;
|
||||
margin-right: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.placemat {
|
||||
margin-right: 0;
|
||||
float: right;
|
||||
}
|
||||
@@ -14,10 +14,10 @@ body {
|
||||
}
|
||||
|
||||
.dropzone {
|
||||
border: 1px solid #bbb;
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
padding: 5px;
|
||||
border: 1px solid #bbb;
|
||||
background-color: #f0f8ff;
|
||||
}
|
||||
|
||||
@@ -26,15 +26,21 @@ body {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.dropzone ul {
|
||||
list-style-type: none;
|
||||
width: 240px;
|
||||
float: left;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
.dropzone input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
* .module, #lastmodule {
|
||||
.dropzone ul {
|
||||
float: left;
|
||||
list-style-type: none;
|
||||
width: 240px;
|
||||
margin: 0;
|
||||
min-height: 200px;
|
||||
padding: 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
* .module {
|
||||
width: 238px;
|
||||
padding: 0;
|
||||
margin: 5px 0;
|
||||
@@ -42,14 +48,16 @@ body {
|
||||
display: block;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #fbfbfb;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
* .handle, #lastmodule span {
|
||||
* .handle {
|
||||
display: block;
|
||||
width: 216px;
|
||||
padding: 0 10px;
|
||||
position: relative;
|
||||
border-top: 1px solid #f2f2f2;
|
||||
border-right: 1px solid #e8e8e8;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
@@ -70,7 +78,7 @@ body {
|
||||
cursor: pointer;
|
||||
padding: 0 3px 1px;
|
||||
border-top: 4px solid #6da6d1;
|
||||
background: url( images/fade-butt.png ) -5px 0px;
|
||||
background: url( ../images/fade-butt.png ) -5px 0px;
|
||||
}
|
||||
|
||||
* html .popper {
|
||||
@@ -83,53 +91,67 @@ body {
|
||||
clear: left;
|
||||
}
|
||||
|
||||
.placematt {
|
||||
.placemat {
|
||||
cursor: default;
|
||||
margin: 10px 0 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 238px;
|
||||
float:left;
|
||||
background-color: #ffe;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
* html .placematt {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.placematt h4 {
|
||||
.placemat h4 {
|
||||
text-align: center;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.placematt span {
|
||||
.placemat span {
|
||||
background-color: #ffe;
|
||||
border: 1px solid #ccc;
|
||||
padding: 0 10px 10px;
|
||||
position: absolute;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
|
||||
#palettediv {
|
||||
border: 1px solid #bbb;
|
||||
background-color: #f0f8ff;
|
||||
height:auto;
|
||||
margin-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
#palettediv:after, #zones:after, .dropzone:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#palettediv, #zones, .dropzone {
|
||||
display: block;
|
||||
min-height: 1px;
|
||||
}
|
||||
|
||||
* html #palettediv, * html #zones, * html .dropzone {
|
||||
height: 1%;
|
||||
}
|
||||
|
||||
#palettediv h3 {
|
||||
text-align: center;
|
||||
color: #333;
|
||||
min-height: 1px;
|
||||
}
|
||||
|
||||
#palettediv ul {
|
||||
padding: 0 0 0 10px;
|
||||
}
|
||||
|
||||
#palettediv .module, #lastmodule {
|
||||
#palettediv .module {
|
||||
margin-right: 10px;
|
||||
float: left;
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
#palettediv .handle, #lastmodule span {
|
||||
#palettediv .handle {
|
||||
height: 40px;
|
||||
font-size: 90%;
|
||||
width: 110px;
|
||||
@@ -140,20 +162,11 @@ body {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#lastmodule {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
* html #palettediv ul {
|
||||
margin: 0;
|
||||
padding: 0 0 0 10px;
|
||||
}
|
||||
|
||||
* html #palettediv .module {
|
||||
float: none;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#controls {
|
||||
height: 0px;
|
||||
}
|
||||
@@ -211,4 +224,13 @@ body {
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
#dragHelper {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#dragHelper li.module {
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ Event.observe( window, 'load', hide_text );
|
||||
<h2><?php _e('Your Header Image'); ?></h2>
|
||||
<p><?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?></p>
|
||||
|
||||
<div id="headimg" style="background: url(<?php clean_url(header_image()) ?>) no-repeat;">
|
||||
<div id="headimg" style="background-image: url(<?php clean_url(header_image()) ?>);">
|
||||
<h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1>
|
||||
<div id="desc"><?php bloginfo('description');?></div>
|
||||
</div>
|
||||
@@ -169,7 +169,7 @@ Event.observe( window, 'load', hide_text );
|
||||
<input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
|
||||
<input type="button" value="<?php _e('Select a Text Color'); ?>" onclick="colorSelect($('textcolor'), 'pickcolor')" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
|
||||
<?php wp_nonce_field('custom-header') ?>
|
||||
<input type="hidden" name="textcolor" id="textcolor" value="#<?php attribute_escape(header_textcolor()) ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?> »" /></form>
|
||||
<input type="hidden" name="textcolor" id="textcolor" value="#<?php attribute_escape(header_textcolor()) ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes »'); ?>" /></form>
|
||||
<?php } ?>
|
||||
|
||||
<div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
|
||||
@@ -183,7 +183,7 @@ Event.observe( window, 'load', hide_text );
|
||||
<input type="hidden" name="action" value="save" />
|
||||
<?php wp_nonce_field('custom-header') ?>
|
||||
<p class="submit">
|
||||
<input type="submit" value="<?php _e('Upload'); ?> »" />
|
||||
<input type="submit" value="<?php _e('Upload »'); ?>" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -21,26 +21,26 @@ if ( ! empty($cat_ID) ) {
|
||||
<div id="ajax-response"></div>
|
||||
<?php echo $form ?>
|
||||
<input type="hidden" name="action" value="<?php echo $action ?>" />
|
||||
<input type="hidden" name="cat_ID" value="<?php echo $category->cat_ID ?>" />
|
||||
<input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" />
|
||||
<?php wp_nonce_field($nonce_action); ?>
|
||||
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
||||
<tr>
|
||||
<th width="33%" scope="row" valign="top"><label for="cat_name"><?php _e('Category name:') ?></label></th>
|
||||
<td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->cat_name); ?>" size="40" /></td>
|
||||
<td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><label for="category_nicename"><?php _e('Category slug:') ?></label></th>
|
||||
<td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape($category->category_nicename); ?>" size="40" /></td>
|
||||
<td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape($category->slug); ?>" size="40" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><label for="category_parent"><?php _e('Category parent:') ?></label></th>
|
||||
<td>
|
||||
<?php wp_dropdown_categories('hide_empty=0&name=category_parent&orderby=name&selected=' . $category->category_parent . '&hierarchical=1&show_option_none=' . __('None')); ?>
|
||||
<td>
|
||||
<?php wp_dropdown_categories('hide_empty=0&name=category_parent&orderby=name&selected=' . $category->parent . '&hierarchical=1&show_option_none=' . __('None')); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><label for="category_description"><?php _e('Description: (optional)') ?></label></th>
|
||||
<td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($category->category_description); ?></textarea></td>
|
||||
<td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($category->description); ?></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>
|
||||
|
||||
@@ -39,14 +39,14 @@ function getNumChecked(form)
|
||||
</script>
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Comments'); ?></h2>
|
||||
<form name="searchform" action="" method="get" id="editcomments">
|
||||
<fieldset>
|
||||
<legend><?php _e('Show Comments That Contain...') ?></legend>
|
||||
<input type="text" name="s" value="<?php if (isset($_GET['s'])) echo attribute_escape($_GET['s']); ?>" size="17" />
|
||||
<input type="submit" name="submit" value="<?php _e('Search') ?>" />
|
||||
<form name="searchform" action="" method="get" id="editcomments">
|
||||
<fieldset>
|
||||
<legend><?php _e('Show Comments That Contain...') ?></legend>
|
||||
<input type="text" name="s" value="<?php if (isset($_GET['s'])) echo attribute_escape($_GET['s']); ?>" size="17" />
|
||||
<input type="submit" name="submit" value="<?php _e('Search') ?>" />
|
||||
<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
|
||||
<?php _e('(Searches within comment text, e-mail, URL, and IP address.)') ?>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</form>
|
||||
<p><a href="?mode=view"><?php _e('View Mode') ?></a> | <a href="?mode=edit"><?php _e('Mass Edit Mode') ?></a></p>
|
||||
<?php
|
||||
@@ -88,7 +88,7 @@ $comments = array_slice($_comments, 0, 20);
|
||||
$extra_comments = array_slice($_comments, 20);
|
||||
|
||||
$page_links = paginate_links( array(
|
||||
'base' => add_query_arg( 'apage', '%#%' ),
|
||||
'base' => add_query_arg( 'apage', '%#%' ),
|
||||
'format' => '',
|
||||
'total' => ceil($total / 20),
|
||||
'current' => $page
|
||||
@@ -151,21 +151,22 @@ if ( $extra_comments ) : ?>
|
||||
</tr>
|
||||
</thead>';
|
||||
foreach ($comments as $comment) {
|
||||
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
|
||||
$post = get_post($comment->comment_post_ID);
|
||||
$authordata = get_userdata($post->post_author);
|
||||
$comment_status = wp_get_comment_status($comment->comment_ID);
|
||||
$class = ('alternate' == $class) ? '' : 'alternate';
|
||||
$class .= ('unapproved' == $comment_status) ? ' unapproved' : '';
|
||||
?>
|
||||
<tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'>
|
||||
<td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
|
||||
<td style="text-align: center"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
|
||||
<td><?php comment_author_link() ?></td>
|
||||
<td><?php comment_author_email_link() ?></td>
|
||||
<td><a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></td>
|
||||
<td><a href="edit-comments.php?s=<?php comment_author_IP() ?>&mode=edit"><?php comment_author_IP() ?></a></td>
|
||||
<td><?php comment_excerpt(); ?></td>
|
||||
<td>
|
||||
<?php if ('unapproved' == $comment_status) { ?>
|
||||
(Unapproved)
|
||||
<?php } else { ?>
|
||||
<?php if ('unapproved' == $comment_status) {
|
||||
_e('Unapproved');
|
||||
} else { ?>
|
||||
<a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
@@ -175,7 +176,7 @@ if ( $extra_comments ) : ?>
|
||||
echo "<a href=\"comment.php?action=deletecomment&p=".$comment->comment_post_ID."&c=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to delete this comment by '%s'. \n 'Cancel' to stop, 'OK' to delete."), $comment->comment_author )) . "', theCommentList );\" class='delete'>" . __('Delete') . "</a> ";
|
||||
} ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
} // end foreach
|
||||
?></table>
|
||||
<p class="submit"><input type="submit" name="delete_button" class="delete" value="<?php _e('Delete Checked Comments »') ?>" onclick="var numchecked = getNumChecked(document.getElementById('deletecomments')); if(numchecked < 1) { alert('<?php echo js_escape(__("Please select some comments to delete")); ?>'); return false } return confirm('<?php echo sprintf(js_escape(__("You are about to delete %s comments permanently \n 'Cancel' to stop, 'OK' to delete.")), "' + numchecked + '"); ?>')" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
if ( isset($_GET['message']) )
|
||||
$_GET['message'] = (int) $_GET['message'];
|
||||
$_GET['message'] = (int) $_GET['message'];
|
||||
$messages[1] = __('Post updated');
|
||||
$messages[2] = __('Custom field updated');
|
||||
$messages[3] = __('Custom field deleted.');
|
||||
@@ -57,7 +57,7 @@ if (empty($post->post_status)) $post->post_status = 'draft';
|
||||
<input type="hidden" id="post_type" name="post_type" value="post" />
|
||||
|
||||
<?php echo $form_extra ?>
|
||||
<?php if (isset($_GET['message']) && 2 > $_GET['message']) : ?>
|
||||
<?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?>
|
||||
<script type="text/javascript">
|
||||
function focusit() {
|
||||
// focus on first input field
|
||||
@@ -84,26 +84,28 @@ addLoadEvent(focusit);
|
||||
<input name="advanced_view" type="hidden" value="1" />
|
||||
<label for="comment_status" class="selectit">
|
||||
<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
|
||||
<?php _e('Allow Comments') ?></label>
|
||||
<?php _e('Allow Comments') ?></label>
|
||||
<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="passworddiv" class="dbx-box">
|
||||
<h3 class="dbx-handle"><?php _e('Post Password') ?></h3>
|
||||
<h3 class="dbx-handle"><?php _e('Post Password') ?></h3>
|
||||
<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="slugdiv" class="dbx-box">
|
||||
<h3 class="dbx-handle"><?php _e('Post Slug') ?></h3>
|
||||
<h3 class="dbx-handle"><?php _e('Post Slug') ?></h3>
|
||||
<div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" /></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="poststatusdiv" class="dbx-box">
|
||||
<h3 class="dbx-handle"><?php _e('Post Status') ?></h3>
|
||||
<div class="dbx-content"><?php if ( current_user_can('publish_posts') ) : ?>
|
||||
<label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); checked($post->post_status, 'future'); ?> /> <?php _e('Published') ?></label>
|
||||
<h3 class="dbx-handle"><?php _e('Post Status') ?></h3>
|
||||
<div class="dbx-content">
|
||||
<?php if ( current_user_can('publish_posts') ) : ?>
|
||||
<label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); checked($post->post_status, 'future'); ?> /> <?php _e('Published') ?></label>
|
||||
<?php endif; ?>
|
||||
<label for="post_status_pending" class="selectit"><input id="post_status_pending" name="post_status" type="radio" value="pending" <?php checked($post->post_status, 'pending'); ?> /> <?php _e('Pending Review') ?></label>
|
||||
<label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post->post_status, 'draft'); ?> /> <?php _e('Draft') ?></label>
|
||||
<label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></div>
|
||||
</fieldset>
|
||||
@@ -115,23 +117,16 @@ addLoadEvent(focusit);
|
||||
</fieldset>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
$authors = get_editable_authors( $current_user->id ); // TODO: ROLE SYSTEM
|
||||
<?php
|
||||
$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
|
||||
if ( $post->post_author && !in_array($post->post_author, $authors) )
|
||||
$authors[] = $post->post_author;
|
||||
if ( $authors && count( $authors ) > 1 ) :
|
||||
?>
|
||||
<fieldset id="authordiv" class="dbx-box">
|
||||
<h3 class="dbx-handle"><?php _e('Post Author'); ?></h3>
|
||||
<div class="dbx-content">
|
||||
<select name="post_author_override" id="post_author_override">
|
||||
<?php
|
||||
foreach ($authors as $o) :
|
||||
$o = get_userdata( $o->ID );
|
||||
if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
|
||||
else $selected = '';
|
||||
echo "<option value='" . (int) $o->ID . "' $selected>" . wp_specialchars( $o->display_name ) . "</option>";
|
||||
endforeach;
|
||||
?>
|
||||
</select>
|
||||
<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php endif; ?>
|
||||
@@ -162,21 +157,27 @@ endforeach;
|
||||
<?php echo $form_pingback ?>
|
||||
<?php echo $form_prevstatus ?>
|
||||
|
||||
<fieldset id="tagdiv">
|
||||
<legend><?php _e('Tags (separate multiple tags with commas: cats, pet food, dogs)'); ?></legend>
|
||||
<div><input type="text" name="tags_input" class="tags-input" id="tags-input" size="30" tabindex="3" value="<?php echo get_tags_to_edit( $post_ID ); ?>" /></div>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
<span id="autosave"></span>
|
||||
<?php echo $saveasdraft; ?>
|
||||
<input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" />
|
||||
<?php
|
||||
if ('publish' != $post->post_status || 0 == $post_ID) {
|
||||
<input type="submit" name="submit" value="<?php _e('Save'); ?>" style="font-weight: bold;" tabindex="4" />
|
||||
<?php
|
||||
if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) {
|
||||
?>
|
||||
<?php if ( current_user_can('publish_posts') ) : ?>
|
||||
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish'); ?>" />
|
||||
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
|
||||
<?php else : ?>
|
||||
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input name="referredby" type="hidden" id="referredby" value="<?php
|
||||
<input name="referredby" type="hidden" id="referredby" value="<?php
|
||||
if ( !empty($_REQUEST['popupurl']) )
|
||||
echo clean_url(stripslashes($_REQUEST['popupurl']));
|
||||
else if ( url_to_postid(wp_get_referer()) == $post_ID )
|
||||
@@ -193,7 +194,7 @@ if (current_user_can('upload_files')) {
|
||||
$uploading_iframe_src = wp_nonce_url("upload.php?style=inline&tab=upload&post_id=$uploading_iframe_ID", 'inlineuploading');
|
||||
$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
|
||||
if ( false != $uploading_iframe_src )
|
||||
echo '<iframe id="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
|
||||
echo '<iframe id="uploading" name="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ $form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment-
|
||||
?>
|
||||
|
||||
<form name="post" action="comment.php" method="post" id="post">
|
||||
<h2><?php echo $toprow_title; ?></h2>
|
||||
<?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?>
|
||||
<div class="wrap">
|
||||
<input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
|
||||
@@ -32,7 +33,7 @@ addLoadEvent(focusit);
|
||||
<fieldset id="uridiv">
|
||||
<legend><label for="newcomment_author_url"><?php _e('URL:') ?></label></legend>
|
||||
<div>
|
||||
<input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo attribute_escape( $comment->comment_author_url ); ?>" tabindex="3" />
|
||||
<input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo attribute_escape( $comment->comment_author_url ); ?>" tabindex="2" />
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
@@ -53,21 +54,21 @@ addLoadEvent(focusit);
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
|
||||
<tr>
|
||||
<th scope="row" valign="top"><?php _e('Comment Status') ?>:</th>
|
||||
<td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment->comment_approved, '1'); ?> /> <?php _e('Approved') ?></label><br />
|
||||
<label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> /> <?php _e('Moderated') ?></label><br />
|
||||
<label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> /> <?php _e('Spam') ?></label></td>
|
||||
<td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment->comment_approved, '1'); ?> tabindex="4" /> <?php _e('Approved') ?></label>
|
||||
<label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> tabindex="4" /> <?php _e('Moderated') ?></label>
|
||||
<label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> tabindex="4" /> <?php _e('Spam') ?></label></td>
|
||||
</tr>
|
||||
|
||||
<?php if ( current_user_can('edit_posts') ) : ?>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><?php _e('Edit time'); ?>:</th>
|
||||
<td><?php touch_time(('editcomment' == $action), 0); ?> </td>
|
||||
<td><?php touch_time(('editcomment' == $action), 0, 5); ?> </td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<tr>
|
||||
<th scope="row" valign="top"><?php _e('Delete'); $delete_nonce = wp_create_nonce( 'delete-comment_' . $comment->comment_ID ); ?>:</th>
|
||||
<td><input name="deletecomment" class="button delete" type="submit" id="deletecomment" tabindex="10" value="<?php _e('Delete this comment') ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true; } return false;\""; ?> />
|
||||
<th scope="row" valign="top"> </th>
|
||||
<td><input name="deletecomment" class="button delete" type="submit" id="deletecomment" tabindex="10" value="<?php _e('Delete this comment') ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ) { document.forms.post._wpnonce.value = '" . wp_create_nonce( 'delete-comment_' . $comment->comment_ID ) . "'; return true; } return false;\""; ?> />
|
||||
<input type="hidden" name="c" value="<?php echo $comment->comment_ID ?>" />
|
||||
<input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" />
|
||||
<input type="hidden" name="noredir" value="1" />
|
||||
|
||||
@@ -20,19 +20,18 @@ addLoadEvent(focusit);
|
||||
|
||||
<div id="poststuff">
|
||||
<fieldset id="titlediv">
|
||||
<legend><a href="http://wordpress.org/docs/reference/post/#title" title="<?php _e('Help on titles') ?>"><?php _e('Title') ?></a></legend>
|
||||
<legend><a href="http://wordpress.org/docs/reference/post/#title" title="<?php _e('Help on titles') ?>"><?php _e('Title') ?></a></legend>
|
||||
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="categorydiv">
|
||||
<legend><a href="http://wordpress.org/docs/reference/post/#category" title="<?php _e('Help on categories') ?>"><?php _e('Categories') ?></a></legend>
|
||||
<legend><a href="http://wordpress.org/docs/reference/post/#category" title="<?php _e('Help on categories') ?>"><?php _e('Categories') ?></a></legend>
|
||||
<div><?php dropdown_categories($post->post_category); ?></div>
|
||||
</fieldset>
|
||||
|
||||
<br />
|
||||
<fieldset id="postdiv">
|
||||
<legend><a href="http://wordpress.org/docs/reference/post/#post" title="<?php _e('Help with post field') ?>"><?php _e('Post') ?></a></legend>
|
||||
<?php the_quicktags(); ?>
|
||||
<?php
|
||||
$rows = get_option('default_post_edit_rows');
|
||||
if (($rows < 3) || ($rows > 100)) {
|
||||
|
||||
93
wp-admin/edit-link-categories.php
Normal file
93
wp-admin/edit-link-categories.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
require_once('admin.php');
|
||||
|
||||
$title = __('Categories');
|
||||
$parent_file = 'link-manager.php';
|
||||
|
||||
//wp_enqueue_script( 'admin-categories' ); TODO: Fix AJAX
|
||||
require_once ('admin-header.php');
|
||||
|
||||
$messages[1] = __('Category added.');
|
||||
$messages[2] = __('Category deleted.');
|
||||
$messages[3] = __('Category updated.');
|
||||
$messages[4] = __('Category not added.');
|
||||
$messages[5] = __('Category not updated.');
|
||||
|
||||
function link_cat_row($category) {
|
||||
global $class;
|
||||
|
||||
if ( current_user_can( 'manage_categories' ) ) {
|
||||
$edit = "<a href='link-category.php?action=edit&cat_ID=$category->term_id' class='edit'>".__( 'Edit' )."</a></td>";
|
||||
$default_cat_id = (int) get_option( 'default_link_category' );
|
||||
|
||||
if ( $category->term_id != $default_cat_id )
|
||||
$edit .= "<td><a href='" . wp_nonce_url( "link-category.php?action=delete&cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_id, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->name, get_term_field( 'name', $default_cat_id, 'link_category' ))) . "' );\" class='delete'>".__( 'Delete' )."</a>";
|
||||
else
|
||||
$edit .= "<td style='text-align:center'>".__( "Default" );
|
||||
} else {
|
||||
$edit = '';
|
||||
}
|
||||
|
||||
$class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
|
||||
|
||||
$category->count = number_format_i18n( $category->count );
|
||||
$count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
|
||||
return "<tr id='cat-$category->term_id'$class>
|
||||
<th scope='row' style='text-align: center'>$category->term_id</th>
|
||||
<td>" . ( $name_override ? $name_override : $pad . ' ' . $category->name ) . "</td>
|
||||
<td>$category->description</td>
|
||||
<td align='center'>$count</td>
|
||||
<td>$edit</td>\n\t</tr>\n";
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if (isset($_GET['message'])) : ?>
|
||||
<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="wrap">
|
||||
<?php if ( current_user_can('manage_categories') ) : ?>
|
||||
<h2><?php printf(__('Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2>
|
||||
<?php else : ?>
|
||||
<h2><?php _e('Categories') ?> </h2>
|
||||
<?php endif; ?>
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" style="text-align: center"><?php _e('ID') ?></th>
|
||||
<th scope="col"><?php _e('Name') ?></th>
|
||||
<th scope="col"><?php _e('Description') ?></th>
|
||||
<th scope="col" width="90" style="text-align: center"><?php _e('Links') ?></th>
|
||||
<th colspan="2" style="text-align: center"><?php _e('Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="the-list">
|
||||
<?php
|
||||
$categories = get_terms( 'link_category', 'hide_empty=0' );
|
||||
if ( $categories ) {
|
||||
$output = '';
|
||||
foreach ( $categories as $category ) {
|
||||
$category = sanitize_term($category, 'link_category', 'display');
|
||||
$output .= link_cat_row($category);
|
||||
}
|
||||
$output = apply_filters('cat_rows', $output);
|
||||
echo $output;
|
||||
unset($category);
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ( current_user_can('manage_categories') ) : ?>
|
||||
<div class="wrap">
|
||||
<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the links in that category. Instead, links that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), get_term_field('name', get_option('default_link_category'), 'link_category')) ?></p>
|
||||
</div>
|
||||
|
||||
<?php include('edit-link-category-form.php'); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php include('admin-footer.php'); ?>
|
||||
43
wp-admin/edit-link-category-form.php
Normal file
43
wp-admin/edit-link-category-form.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
if ( ! empty($cat_ID) ) {
|
||||
$heading = __('Edit Category');
|
||||
$submit_text = __('Edit Category »');
|
||||
$form = '<form name="editcat" id="editcat" method="post" action="link-category.php">';
|
||||
$action = 'editedcat';
|
||||
$nonce_action = 'update-link-category_' . $cat_ID;
|
||||
do_action('edit_link_category_form_pre', $category);
|
||||
} else {
|
||||
$heading = __('Add Category');
|
||||
$submit_text = __('Add Category »');
|
||||
$form = '<form name="addcat" id="addcat" method="post" action="link-category.php">';
|
||||
$action = 'addcat';
|
||||
$nonce_action = 'add-link-category';
|
||||
do_action('add_link_category_form_pre', $category);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php echo $heading ?></h2>
|
||||
<div id="ajax-response"></div>
|
||||
<?php echo $form ?>
|
||||
<input type="hidden" name="action" value="<?php echo $action ?>" />
|
||||
<input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" />
|
||||
<?php wp_nonce_field($nonce_action); ?>
|
||||
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
||||
<tr>
|
||||
<th width="33%" scope="row" valign="top"><label for="name"><?php _e('Category name:') ?></label></th>
|
||||
<td width="67%"><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><label for="slug"><?php _e('Category slug:') ?></label></th>
|
||||
<td><input name="slug" id="slug" type="text" value="<?php echo $category->slug; ?>" size="40" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><label for="description"><?php _e('Description: (optional)') ?></label></th>
|
||||
<td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>
|
||||
<?php do_action('edit_link_category_form', $category); ?>
|
||||
</form>
|
||||
</div>
|
||||
@@ -43,7 +43,7 @@ function xfn_check($class, $value = '', $type = 'check') {
|
||||
<h3 class="dbx-handle"><?php _e('Categories') ?></h3>
|
||||
<div class="dbx-content">
|
||||
<p id="jaxcat"></p>
|
||||
<ul id="categorychecklist"><?php dropdown_link_categories(get_option('default_link_category')); ?></ul>
|
||||
<ul id="linkcategorychecklist"><?php dropdown_link_categories(get_option('default_link_category')); ?></ul>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
@@ -80,15 +80,15 @@ function xfn_check($class, $value = '', $type = 'check') {
|
||||
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
||||
<tr>
|
||||
<th scope="row" valign="top"><label for="link_name"><?php _e('Name:') ?></label></th>
|
||||
<td><input type="text" name="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td>
|
||||
<td><input type="text" name="link_name" id="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="20%" scope="row" valign="top"><label for="link_url"><?php _e('Address:') ?></label></th>
|
||||
<td width="80%"><input type="text" name="link_url" value="<?php echo $link->link_url; if ( empty( $link->link_url ) ) echo 'http://'; ?>" style="width: 95%" /></td>
|
||||
<td width="80%"><input type="text" name="link_url" id="link_url" value="<?php echo $link->link_url; if ( empty( $link->link_url ) ) echo 'http://'; ?>" style="width: 95%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><label for="link_description"><?php _e('Description:') ?></label></th>
|
||||
<td><input type="text" name="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td>
|
||||
<td><input type="text" name="link_description" id="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -241,6 +241,7 @@ function xfn_check($class, $value = '', $type = 'check') {
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ if (current_user_can('upload_files')) {
|
||||
$uploading_iframe_src = wp_nonce_url("upload.php?style=inline&tab=upload&post_id=$uploading_iframe_ID", 'inlineuploading');
|
||||
$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
|
||||
if ( false != $uploading_iframe_src )
|
||||
echo '<iframe id="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
|
||||
echo '<iframe id="uploading" name="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -4,31 +4,74 @@ $title = __('Pages');
|
||||
$parent_file = 'edit.php';
|
||||
wp_enqueue_script( 'listman' );
|
||||
require_once('admin-header.php');
|
||||
|
||||
$post_stati = array( // array( adj, noun )
|
||||
'publish' => array(__('Published'), __('Published pages')),
|
||||
'draft' => array(__('Draft'), __('Draft pages')),
|
||||
'private' => array(__('Private'), __('Private pages'))
|
||||
);
|
||||
|
||||
|
||||
$post_status_label = __('Pages');
|
||||
$post_status_q = '';
|
||||
if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
|
||||
$post_status_label = $post_stati[$_GET['post_status']][1];
|
||||
$post_status_q = '&post_status=' . $_GET['post_status'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Page Management'); ?></h2>
|
||||
|
||||
<h2><?php
|
||||
// Use $_GET instead of is_ since they can override each other
|
||||
$h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching “%s”'), wp_specialchars( stripslashes( $_GET['s'] ) ) ) : '';
|
||||
$h2_author = '';
|
||||
if ( isset($_GET['author']) && $_GET['author'] ) {
|
||||
$author_user = get_userdata( (int) $_GET['author'] );
|
||||
$h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name ));
|
||||
}
|
||||
printf( _c( '%1$s%2$s%3$s|You can reorder these: 1: Pages, 2: by {s}, 3: matching {s}' ), $post_status_label, $h2_author, $h2_search );
|
||||
?></h2>
|
||||
|
||||
<p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page »'); ?></a></p>
|
||||
|
||||
<form name="searchform" action="" method="get">
|
||||
<fieldset>
|
||||
<legend><?php _e('Search Pages…') ?></legend>
|
||||
<input type="text" name="s" value="<?php if (isset($_GET['s'])) echo attribute_escape($_GET['s']); ?>" size="17" />
|
||||
<input type="submit" name="submit" value="<?php _e('Search') ?>" />
|
||||
<form name="searchform" id="searchform" action="" method="get">
|
||||
<fieldset><legend><?php _e('Search Terms…') ?></legend>
|
||||
<input type="text" name="s" id="s" value="<?php echo attribute_escape( stripslashes( $_GET['s'] ) ); ?>" size="17" />
|
||||
</fieldset>
|
||||
|
||||
|
||||
<fieldset><legend><?php _e('Page Type…'); ?></legend>
|
||||
<select name='post_status'>
|
||||
<option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
|
||||
<?php foreach ( $post_stati as $status => $label ) : ?>
|
||||
<option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label[0]; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</fieldset>
|
||||
|
||||
<?php $editable_ids = get_editable_user_ids( $user_ID ); if ( $editable_ids && count( $editable_ids ) > 1 ) : ?>
|
||||
|
||||
<fieldset><legend><?php _e('Author…'); ?></legend>
|
||||
<?php wp_dropdown_users( array('include' => $editable_ids, 'show_option_all' => __('Any'), 'name' => 'author', 'selected' => isset($_GET['author']) ? $_GET['author'] : 0) ); ?>
|
||||
</fieldset>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="submit" id="post-query-submit" value="<?php _e('Filter »'); ?>" class="button" />
|
||||
</form>
|
||||
|
||||
<?php
|
||||
wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1&order=asc');
|
||||
<br style="clear:both;" />
|
||||
|
||||
if ( $_GET['s'] )
|
||||
$all = false;
|
||||
else
|
||||
$all = true;
|
||||
<?php
|
||||
wp("post_type=page&orderby=menu_order&what_to_show=posts$post_status_q&posts_per_page=-1&posts_per_archive_page=-1&order=asc");
|
||||
|
||||
$all = !( $h2_search || $post_status_q );
|
||||
|
||||
if ($posts) {
|
||||
?>
|
||||
<table class="widefat">
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" style="text-align: center"><?php _e('ID') ?></th>
|
||||
@@ -39,9 +82,7 @@ if ($posts) {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="the-list">
|
||||
<?php
|
||||
page_rows(0, 0, $posts, $all);
|
||||
?>
|
||||
<?php page_rows(0, 0, $posts, $all); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -50,7 +91,7 @@ page_rows(0, 0, $posts, $all);
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<p><?php _e('No pages yet.') ?></p>
|
||||
<p><?php _e('No pages found.') ?></p>
|
||||
<?php
|
||||
} // end if ($posts)
|
||||
?>
|
||||
|
||||
117
wp-admin/edit-post-rows.php
Normal file
117
wp-admin/edit-post-rows.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<?php foreach($posts_columns as $column_display_name) { ?>
|
||||
<th scope="col"><?php echo $column_display_name; ?></th>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="the-list">
|
||||
<?php
|
||||
if ( have_posts() ) {
|
||||
$bgcolor = '';
|
||||
add_filter('the_title','wp_specialchars');
|
||||
while (have_posts()) : the_post();
|
||||
$class = ('alternate' == $class) ? '' : 'alternate';
|
||||
global $current_user;
|
||||
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
|
||||
?>
|
||||
<tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>'>
|
||||
|
||||
<?php
|
||||
|
||||
foreach($posts_columns as $column_name=>$column_display_name) {
|
||||
|
||||
switch($column_name) {
|
||||
|
||||
case 'id':
|
||||
?>
|
||||
<th scope="row" style="text-align: center"><?php echo $id ?></th>
|
||||
<?php
|
||||
break;
|
||||
case 'modified':
|
||||
?>
|
||||
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Never'); else the_modified_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
|
||||
<?php
|
||||
break;
|
||||
case 'date':
|
||||
?>
|
||||
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_date) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
|
||||
<?php
|
||||
break;
|
||||
case 'title':
|
||||
?>
|
||||
<td><?php the_title() ?>
|
||||
<?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'categories':
|
||||
?>
|
||||
<td><?php the_category(','); ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'comments':
|
||||
?>
|
||||
<td style="text-align: center">
|
||||
<?php
|
||||
$left = get_pending_comments_num( $post->ID );
|
||||
$pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
|
||||
if ( $left )
|
||||
echo '<strong>';
|
||||
comments_number("<a href='edit.php?p=$id&c=1' title='$pending_phrase'>" . __('0') . '</a>', "<a href='edit.php?p=$id&c=1' title='$pending_phrase'>" . __('1') . '</a>', "<a href='edit.php?p=$id&c=1' title='$pending_phrase'>" . __('%') . '</a>');
|
||||
if ( $left )
|
||||
echo '</strong>';
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'author':
|
||||
?>
|
||||
<td><?php the_author() ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'control_view':
|
||||
?>
|
||||
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'control_edit':
|
||||
?>
|
||||
<td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'control_delete':
|
||||
?>
|
||||
<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
default:
|
||||
?>
|
||||
<td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
endwhile;
|
||||
} else {
|
||||
?>
|
||||
<tr style='background-color: <?php echo $bgcolor; ?>'>
|
||||
<td colspan="8"><?php _e('No posts found.') ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end if ( have_posts() )
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -6,134 +6,58 @@ $parent_file = 'edit.php';
|
||||
wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' );
|
||||
require_once('admin-header.php');
|
||||
|
||||
$_GET['m'] = (int) $_GET['m'];
|
||||
$_GET['m'] = (int) $_GET['m'];
|
||||
$_GET['cat'] = (int) $_GET['cat'];
|
||||
$post_stati = array( // array( adj, noun )
|
||||
'publish' => array(__('Published'), __('Published posts')),
|
||||
'future' => array(__('Scheduled'), __('Scheduled posts')),
|
||||
'pending' => array(__('Pending Review'), __('Pending posts')),
|
||||
'draft' => array(__('Draft'), _c('Drafts|manage posts header')),
|
||||
'private' => array(__('Private'), __('Private posts'))
|
||||
);
|
||||
|
||||
$drafts = get_users_drafts( $user_ID );
|
||||
$other_drafts = get_others_drafts( $user_ID);
|
||||
$avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'");
|
||||
|
||||
if ($drafts || $other_drafts) {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<?php if ($drafts) { ?>
|
||||
<p><strong><?php _e('Your Drafts:') ?></strong>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($drafts as $draft) {
|
||||
if (0 != $i)
|
||||
echo ', ';
|
||||
$draft->post_title = apply_filters('the_title', stripslashes($draft->post_title));
|
||||
if ($draft->post_title == '')
|
||||
$draft->post_title = sprintf(__('Post #%s'), $draft->ID);
|
||||
echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
|
||||
++$i;
|
||||
}
|
||||
?>
|
||||
.</p>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($other_drafts) { ?>
|
||||
<p><strong><?php _e('Other’s Drafts:') ?></strong>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($other_drafts as $draft) {
|
||||
if (0 != $i)
|
||||
echo ', ';
|
||||
$draft->post_title = apply_filters('the_title', stripslashes($draft->post_title));
|
||||
if ($draft->post_title == '')
|
||||
$draft->post_title = sprintf(__('Post #%s'), $draft->ID);
|
||||
echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
|
||||
++$i;
|
||||
}
|
||||
?>
|
||||
.</p>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2>
|
||||
<?php
|
||||
|
||||
wp('what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1');
|
||||
|
||||
if ( is_month() ) {
|
||||
single_month_title(' ');
|
||||
} elseif ( is_search() ) {
|
||||
printf(__('Search for “%s”'), wp_specialchars($_GET['s']) );
|
||||
} else {
|
||||
if ( is_single() )
|
||||
printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
|
||||
elseif ( ! is_paged() || get_query_var('paged') == 1 )
|
||||
_e('Last 15 Posts');
|
||||
else
|
||||
_e('Previous Posts');
|
||||
$post_status_q = '';
|
||||
$post_status_label = __('Posts');
|
||||
if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
|
||||
$post_status_label = $post_stati[$_GET['post_status']][1];
|
||||
$post_status_q = '&post_status=' . $_GET['post_status'];
|
||||
}
|
||||
?>
|
||||
</h2>
|
||||
|
||||
<form name="searchform" id="searchform" action="" method="get">
|
||||
<fieldset>
|
||||
<legend><?php _e('Search Posts…') ?></legend>
|
||||
<input type="text" name="s" value="<?php if (isset($s)) echo attribute_escape($s); ?>" size="17" />
|
||||
<input type="submit" name="submit" value="<?php _e('Search') ?>" class="button" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC");
|
||||
|
||||
if ( count($arc_result) ) { ?>
|
||||
|
||||
<form name="viewarc" id="viewarc" action="" method="get">
|
||||
<fieldset>
|
||||
<legend><?php _e('Browse Month…') ?></legend>
|
||||
<select name='m'>
|
||||
<?php
|
||||
foreach ($arc_result as $arc_row) {
|
||||
if ( $arc_row->yyear == 0 )
|
||||
continue;
|
||||
$arc_row->mmonth = zeroise($arc_row->mmonth, 2);
|
||||
|
||||
if( isset($_GET['m']) && $arc_row->yyear . $arc_row->mmonth == (int) $_GET['m'] )
|
||||
$default = 'selected="selected"';
|
||||
else
|
||||
$default = null;
|
||||
|
||||
echo "<option $default value='$arc_row->yyear$arc_row->mmonth'>";
|
||||
echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
|
||||
echo "</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="submit" name="submit" value="<?php _e('Show Month') ?>" class="button" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<form name="viewcat" id="viewcat" action="" method="get">
|
||||
<fieldset>
|
||||
<legend><?php _e('Browse Category…') ?></legend>
|
||||
<?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?>
|
||||
<input type="submit" name="submit" value="<?php _e('Show Category') ?>" class="button" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<?php do_action('restrict_manage_posts'); ?>
|
||||
|
||||
<br style="clear:both;" />
|
||||
<div class="wrap">
|
||||
|
||||
<?php
|
||||
|
||||
if ( 'pending' === $_GET['post_status'] ) {
|
||||
$order = 'ASC';
|
||||
$orderby = 'modified';
|
||||
} elseif ( 'draft' === $_GET['post_status'] ) {
|
||||
$order = 'DESC';
|
||||
$orderby = 'modified';
|
||||
} else {
|
||||
$order = 'DESC';
|
||||
$orderby = 'date';
|
||||
}
|
||||
|
||||
wp("what_to_show=posts$post_status_q&posts_per_page=15&order=$order&orderby=$orderby");
|
||||
|
||||
// define the columns to display, the syntax is 'internal name' => 'display name'
|
||||
$posts_columns = array(
|
||||
'id' => '<div style="text-align: center">' . __('ID') . '</div>',
|
||||
'date' => __('When'),
|
||||
'title' => __('Title'),
|
||||
'categories' => __('Categories'),
|
||||
'comments' => '<div style="text-align: center">' . __('Comments') . '</div>',
|
||||
'author' => __('Author')
|
||||
);
|
||||
$posts_columns = array();
|
||||
$posts_columns['id'] = '<div style="text-align: center">' . __('ID') . '</div>';
|
||||
if ( 'draft' === $_GET['post_status'] )
|
||||
$posts_columns['modified'] = __('Modified');
|
||||
elseif ( 'pending' === $_GET['post_status'] )
|
||||
$posts_columns['modified'] = __('Submitted');
|
||||
else
|
||||
$posts_columns['date'] = __('When');
|
||||
$posts_columns['title'] = __('Title');
|
||||
$posts_columns['categories'] = __('Categories');
|
||||
if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
|
||||
$posts_columns['comments'] = '<div style="text-align: center">' . __('Comments') . '</div>';
|
||||
$posts_columns['author'] = __('Author');
|
||||
|
||||
$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
|
||||
|
||||
// you can not edit these at the moment
|
||||
@@ -143,109 +67,100 @@ $posts_columns['control_delete'] = '';
|
||||
|
||||
?>
|
||||
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<h2><?php
|
||||
if ( is_single() ) {
|
||||
printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
|
||||
} else {
|
||||
if ( $post_listing_pageable && !is_archive() && !is_search() )
|
||||
$h2_noun = is_paged() ? sprintf(__( 'Previous %s' ), $post_status_label) : sprintf(__('Latest %s'), $post_status_label);
|
||||
else
|
||||
$h2_noun = $post_status_label;
|
||||
// Use $_GET instead of is_ since they can override each other
|
||||
$h2_author = '';
|
||||
$_GET['author'] = (int) $_GET['author'];
|
||||
if ( $_GET['author'] != 0 ) {
|
||||
if ( $_GET['author'] == '-' . $user_ID ) { // author exclusion
|
||||
$h2_author = ' ' . __('by other authors');
|
||||
} else {
|
||||
$author_user = get_userdata( get_query_var( 'author' ) );
|
||||
$h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name ));
|
||||
}
|
||||
}
|
||||
$h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching “%s”'), wp_specialchars( get_search_query() ) ) : '';
|
||||
$h2_cat = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in “%s”'), single_cat_title('', false) ) : '';
|
||||
$h2_month = isset($_GET['m']) && $_GET['m'] ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : '';
|
||||
printf( _c( '%1$s%2$s%3$s%4$s%5$s|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_month );
|
||||
}
|
||||
?></h2>
|
||||
|
||||
<form name="searchform" id="searchform" action="" method="get">
|
||||
<fieldset><legend><?php _e('Search terms…'); ?></legend>
|
||||
<input type="text" name="s" id="s" value="<?php the_search_query(); ?>" size="17" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset><legend><?php _e('Status…'); ?></legend>
|
||||
<select name='post_status'>
|
||||
<option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
|
||||
<?php foreach ( $post_stati as $status => $label ) : if ( !in_array($status, $avail_post_stati) ) continue; ?>
|
||||
<option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label[0]; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</fieldset>
|
||||
|
||||
<?php
|
||||
$editable_ids = get_editable_user_ids( $user_ID );
|
||||
if ( $editable_ids && count( $editable_ids ) > 1 ) :
|
||||
?>
|
||||
<fieldset><legend><?php _e('Author…'); ?></legend>
|
||||
<?php wp_dropdown_users( array('include' => $editable_ids, 'show_option_all' => __('Any'), 'name' => 'author', 'selected' => isset($_GET['author']) ? $_GET['author'] : 0) ); ?>
|
||||
</fieldset>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
|
||||
$arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC";
|
||||
|
||||
$arc_result = $wpdb->get_results( $arc_query );
|
||||
|
||||
$month_count = count($arc_result);
|
||||
|
||||
if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
|
||||
|
||||
<fieldset><legend><?php _e('Month…') ?></legend>
|
||||
<select name='m'>
|
||||
<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
|
||||
<?php
|
||||
foreach ($arc_result as $arc_row) {
|
||||
if ( $arc_row->yyear == 0 )
|
||||
continue;
|
||||
$arc_row->mmonth = zeroise($arc_row->mmonth, 2);
|
||||
|
||||
if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
|
||||
$default = ' selected="selected"';
|
||||
else
|
||||
$default = '';
|
||||
|
||||
echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>";
|
||||
echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
|
||||
echo "</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</fieldset>
|
||||
|
||||
<?php foreach($posts_columns as $column_display_name) { ?>
|
||||
<th scope="col"><?php echo $column_display_name; ?></th>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="the-list">
|
||||
<?php
|
||||
if ($posts) {
|
||||
$bgcolor = '';
|
||||
while (have_posts()) : the_post();
|
||||
add_filter('the_title','wp_specialchars');
|
||||
$class = ('alternate' == $class) ? '' : 'alternate';
|
||||
?>
|
||||
<tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'>
|
||||
<fieldset><legend><?php _e('Category…') ?></legend>
|
||||
<?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?>
|
||||
</fieldset>
|
||||
<input type="submit" id="post-query-submit" value="<?php _e('Filter »'); ?>" class="button" />
|
||||
</form>
|
||||
|
||||
<?php
|
||||
<?php do_action('restrict_manage_posts'); ?>
|
||||
|
||||
foreach($posts_columns as $column_name=>$column_display_name) {
|
||||
<br style="clear:both;" />
|
||||
|
||||
switch($column_name) {
|
||||
|
||||
case 'id':
|
||||
?>
|
||||
<th scope="row" style="text-align: center"><?php echo $id ?></th>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'date':
|
||||
?>
|
||||
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
|
||||
<?php
|
||||
break;
|
||||
case 'title':
|
||||
?>
|
||||
<td><?php the_title() ?>
|
||||
<?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'categories':
|
||||
?>
|
||||
<td><?php the_category(','); ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'comments':
|
||||
?>
|
||||
<td style="text-align: center">
|
||||
<?php comments_number(__('0'), "<a href='edit.php?p=$id&c=1'>" . __('1') . '</a>', "<a href='edit.php?p=$id&c=1'>" . __('%') . '</a>') ?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'author':
|
||||
?>
|
||||
<td><?php the_author() ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'control_view':
|
||||
?>
|
||||
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'control_edit':
|
||||
?>
|
||||
<td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'control_delete':
|
||||
?>
|
||||
<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
default:
|
||||
?>
|
||||
<td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
endwhile;
|
||||
} else {
|
||||
?>
|
||||
<tr style='background-color: <?php echo $bgcolor; ?>'>
|
||||
<td colspan="8"><?php _e('No posts found.') ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end if ($posts)
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php include( 'edit-post-rows.php' ); ?>
|
||||
|
||||
<div id="ajax-response"></div>
|
||||
|
||||
@@ -255,10 +170,12 @@ endwhile;
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
if ( 1 == count($posts) ) {
|
||||
|
||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
|
||||
if ($comments) {
|
||||
update_comment_cache($comments);
|
||||
?>
|
||||
<h3 id="comments"><?php _e('Comments') ?></h3>
|
||||
<ol id="the-comment-list" class="commentlist">
|
||||
@@ -267,7 +184,8 @@ $i = 0;
|
||||
foreach ($comments as $comment) {
|
||||
|
||||
++$i; $class = '';
|
||||
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
|
||||
$post = get_post($comment->comment_post_ID);
|
||||
$authordata = get_userdata($post->post_author);
|
||||
$comment_status = wp_get_comment_status($comment->comment_ID);
|
||||
if ('unapproved' == $comment_status)
|
||||
$class .= ' unapproved';
|
||||
@@ -275,22 +193,22 @@ foreach ($comments as $comment) {
|
||||
$class .= ' alternate';
|
||||
echo "<li id='comment-$comment->comment_ID' class='$class'>";
|
||||
?>
|
||||
<p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
|
||||
<p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="edit-comments.php?s=<?php comment_author_IP() ?>&mode=edit"><?php comment_author_IP() ?></a></p>
|
||||
|
||||
<?php comment_text() ?>
|
||||
|
||||
<p><?php comment_date(__('M j, g:i A')); ?> — [
|
||||
<p><?php comment_date(__('M j, g:i A')); ?> — [
|
||||
<?php
|
||||
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
echo " <a href='comment.php?action=editcomment&c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
|
||||
echo " <a href='comment.php?action=editcomment&c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
|
||||
echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
|
||||
if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
|
||||
echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
|
||||
echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
|
||||
}
|
||||
echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&dt=spam&p=" . $comment->comment_post_ID . "&c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ";
|
||||
echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&dt=spam&p=" . $comment->comment_post_ID . "&c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ";
|
||||
}
|
||||
?>
|
||||
?> ]
|
||||
</p>
|
||||
</li>
|
||||
|
||||
@@ -301,6 +219,5 @@ if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
include('admin-footer.php');
|
||||
?>
|
||||
|
||||
<?php include('admin-footer.php'); ?>
|
||||
|
||||
@@ -25,7 +25,7 @@ require_once ('admin-header.php');
|
||||
<select name="author">
|
||||
<option value="all" selected="selected"><?php _e('All'); ?></option>
|
||||
<?php
|
||||
$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
|
||||
$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
|
||||
foreach ( $authors as $id ) {
|
||||
$o = get_userdata( $id );
|
||||
echo "<option value='$o->ID'>$o->display_name</option>";
|
||||
@@ -45,13 +45,15 @@ foreach ( $authors as $id ) {
|
||||
<?php
|
||||
|
||||
function export_wp() {
|
||||
global $wpdb, $posts, $post;
|
||||
global $wpdb, $post_ids, $post;
|
||||
|
||||
do_action('export_wp');
|
||||
|
||||
$filename = 'wordpress.' . date('Y-m-d') . '.xml';
|
||||
|
||||
header('Content-Description: File Transfer');
|
||||
header("Content-Disposition: attachment; filename=$filename");
|
||||
header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
|
||||
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
|
||||
|
||||
$where = '';
|
||||
if ( isset( $_GET['author'] ) && $_GET['author'] != 'all' ) {
|
||||
@@ -59,16 +61,18 @@ if ( isset( $_GET['author'] ) && $_GET['author'] != 'all' ) {
|
||||
$where = " WHERE post_author = '$author_id' ";
|
||||
}
|
||||
|
||||
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
|
||||
// grab a snapshot of post IDs, just in case it changes during the export
|
||||
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
|
||||
|
||||
$categories = (array) $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, posts_private, links_private FROM $wpdb->categories LEFT JOIN $wpdb->post2cat ON (category_id = cat_id) LEFT JOIN $wpdb->posts ON (post_id <=> id) $where GROUP BY cat_id");
|
||||
$categories = (array) get_categories('get=all');
|
||||
$tags = (array) get_tags('get=all');
|
||||
|
||||
function wxr_missing_parents($categories) {
|
||||
if ( !is_array($categories) || empty($categories) )
|
||||
return array();
|
||||
|
||||
foreach ( $categories as $category )
|
||||
$parents[$category->cat_ID] = $category->category_parent;
|
||||
$parents[$category->term_id] = $category->parent;
|
||||
|
||||
$parents = array_unique(array_diff($parents, array_keys($parents)));
|
||||
|
||||
@@ -79,7 +83,7 @@ function wxr_missing_parents($categories) {
|
||||
}
|
||||
|
||||
while ( $parents = wxr_missing_parents($categories) ) {
|
||||
$found_parents = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, posts_private, links_private FROM $wpdb->categories WHERE cat_ID IN (" . join(', ', $parents) . ")");
|
||||
$found_parents = get_categories("include=" . join(', ', $parents));
|
||||
if ( is_array($found_parents) && count($found_parents) )
|
||||
$categories = array_merge($categories, $found_parents);
|
||||
else
|
||||
@@ -90,8 +94,8 @@ while ( $parents = wxr_missing_parents($categories) ) {
|
||||
$pass = 0;
|
||||
$passes = 1000 + count($categories);
|
||||
while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) {
|
||||
if ( $cat->category_parent == 0 || isset($cats[$cat->category_parent]) ) {
|
||||
$cats[$cat->cat_ID] = $cat;
|
||||
if ( $cat->parent == 0 || isset($cats[$cat->parent]) ) {
|
||||
$cats[$cat->term_id] = $cat;
|
||||
} else {
|
||||
$categories[] = $cat;
|
||||
}
|
||||
@@ -110,42 +114,72 @@ function wxr_cdata($str) {
|
||||
}
|
||||
|
||||
function wxr_cat_name($c) {
|
||||
if ( empty($c->cat_name) )
|
||||
if ( empty($c->name) )
|
||||
return;
|
||||
|
||||
echo '<wp:cat_name>' . wxr_cdata($c->cat_name) . '</wp:cat_name>';
|
||||
echo '<wp:cat_name>' . wxr_cdata($c->name) . '</wp:cat_name>';
|
||||
}
|
||||
|
||||
function wxr_category_description($c) {
|
||||
if ( empty($c->category_description) )
|
||||
if ( empty($c->description) )
|
||||
return;
|
||||
|
||||
echo '<wp:category_description>' . wxr_cdata($c->category_description) . '</wp:category_description>';
|
||||
echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
|
||||
}
|
||||
|
||||
print '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
|
||||
function wxr_tag_name($t) {
|
||||
if ( empty($t->name) )
|
||||
return;
|
||||
|
||||
echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
|
||||
}
|
||||
|
||||
function wxr_tag_description($t) {
|
||||
if ( empty($t->description) )
|
||||
return;
|
||||
|
||||
echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
|
||||
}
|
||||
|
||||
function wxr_post_taxonomy() {
|
||||
$categories = get_the_category();
|
||||
$tags = get_the_tags();
|
||||
$cat_names = array();
|
||||
$tag_names = array();
|
||||
$the_list = '';
|
||||
$filter = 'rss';
|
||||
|
||||
if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
|
||||
$cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
|
||||
$the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n";
|
||||
}
|
||||
|
||||
if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
|
||||
$tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
|
||||
$the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[$tag_name]]></category>\n";
|
||||
}
|
||||
|
||||
echo $the_list;
|
||||
}
|
||||
|
||||
echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
|
||||
|
||||
?>
|
||||
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
|
||||
<!-- It contains information about your blog's posts, comments, and categories. -->
|
||||
<!-- You may use this file to transfer that content from one site to another. -->
|
||||
<!-- This file is not intended to serve as a complete backup of your blog. -->
|
||||
|
||||
<!--
|
||||
This is a WordPress eXtended RSS file generated by WordPress as an export of
|
||||
your blog. It contains information about your blog's posts, comments, and
|
||||
categories. You may use this file to transfer that content from one site to
|
||||
another. This file is not intended to serve as a complete backup of your
|
||||
blog.
|
||||
|
||||
To import this information into a WordPress blog follow these steps:
|
||||
|
||||
1. Log into that blog as an administrator.
|
||||
2. Go to Manage > Import in the blog's admin.
|
||||
3. Choose "WordPress" from the list of importers.
|
||||
4. Upload this file using the form provided on that page.
|
||||
5. You will first be asked to map the authors in this export file to users
|
||||
on the blog. For each author, you may choose to map an existing user on
|
||||
the blog or to create a new user.
|
||||
6. WordPress will then import each of the posts, comments, and categories
|
||||
contained in this file onto your blog.
|
||||
-->
|
||||
<!-- To import this information into a WordPress blog follow these steps. -->
|
||||
<!-- 1. Log into that blog as an administrator. -->
|
||||
<!-- 2. Go to Manage: Import in the blog's admin panels. -->
|
||||
<!-- 3. Choose "WordPress" from the list. -->
|
||||
<!-- 4. Upload this file using the form provided on that page. -->
|
||||
<!-- 5. You will first be asked to map the authors in this export file to users -->
|
||||
<!-- on the blog. For each author, you may choose to map to an -->
|
||||
<!-- existing user on the blog or to create a new user -->
|
||||
<!-- 6. WordPress will then import each of the posts, comments, and categories -->
|
||||
<!-- contained in this file into your blog -->
|
||||
|
||||
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:i'); ?>"-->
|
||||
<rss version="2.0"
|
||||
@@ -163,16 +197,27 @@ print '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
|
||||
<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
|
||||
<language><?php echo get_option('rss_language'); ?></language>
|
||||
<?php if ( $cats ) : foreach ( $cats as $c ) : ?>
|
||||
<wp:category><wp:category_nicename><?php echo $c->category_nicename; ?></wp:category_nicename><wp:category_parent><?php echo $c->category_parent ? $cats[$c->category_parent]->cat_name : ''; ?></wp:category_parent><wp:posts_private><?php echo $c->posts_private ? '1' : '0'; ?></wp:posts_private><wp:links_private><?php echo $c->links_private ? '1' : '0'; ?></wp:links_private><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
|
||||
<wp:category><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->name : ''; ?></wp:category_parent><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
|
||||
<?php endforeach; endif; ?>
|
||||
<?php if ( $tags ) : foreach ( $tags as $t ) : ?>
|
||||
<wp:tag><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name($t); ?><?php wxr_tag_description($t); ?></wp:tag>
|
||||
<?php endforeach; endif; ?>
|
||||
<?php do_action('rss2_head'); ?>
|
||||
<?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
|
||||
<?php if ($post_ids) {
|
||||
global $wp_query;
|
||||
$wp_query->in_the_loop = true; // Fake being in the loop.
|
||||
// fetch 20 posts at a time rather than loading the entire table into memory
|
||||
while ( $next_posts = array_splice($post_ids, 0, 20) ) {
|
||||
$where = "WHERE ID IN (".join(',', $next_posts).")";
|
||||
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
|
||||
foreach ($posts as $post) {
|
||||
setup_postdata($post); ?>
|
||||
<item>
|
||||
<title><?php the_title_rss() ?></title>
|
||||
<link><?php permalink_single_rss() ?></link>
|
||||
<link><?php the_permalink_rss() ?></link>
|
||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
|
||||
<dc:creator><?php the_author() ?></dc:creator>
|
||||
<?php the_category_rss() ?>
|
||||
<?php wxr_post_taxonomy() ?>
|
||||
|
||||
<guid isPermaLink="false"><?php the_guid(); ?></guid>
|
||||
<description></description>
|
||||
@@ -203,7 +248,7 @@ $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post
|
||||
if ( $comments ) { foreach ( $comments as $c ) { ?>
|
||||
<wp:comment>
|
||||
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
|
||||
<wp:comment_author><?php echo $c->comment_author; ?></wp:comment_author>
|
||||
<wp:comment_author><?php echo wxr_cdata($c->comment_author); ?></wp:comment_author>
|
||||
<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
|
||||
<wp:comment_author_url><?php echo $c->comment_author_url; ?></wp:comment_author_url>
|
||||
<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
|
||||
@@ -216,7 +261,7 @@ if ( $comments ) { foreach ( $comments as $c ) { ?>
|
||||
</wp:comment>
|
||||
<?php } } ?>
|
||||
</item>
|
||||
<?php } } ?>
|
||||
<?php } } } ?>
|
||||
</channel>
|
||||
</rss>
|
||||
<?php
|
||||
|
||||
BIN
wp-admin/images/heading-bg.gif
Normal file
BIN
wp-admin/images/heading-bg.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 B |
BIN
wp-admin/images/logo-ghost.png
Normal file
BIN
wp-admin/images/logo-ghost.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 992 B |
@@ -14,9 +14,9 @@ require_once ('admin-header.php');
|
||||
// Load all importers so that they can register.
|
||||
$import_loc = 'wp-admin/import';
|
||||
$import_root = ABSPATH.$import_loc;
|
||||
$imports_dir = @ dir($import_root);
|
||||
$imports_dir = @ opendir($import_root);
|
||||
if ($imports_dir) {
|
||||
while (($file = $imports_dir->read()) !== false) {
|
||||
while (($file = readdir($imports_dir)) !== false) {
|
||||
if ($file{0} == '.') {
|
||||
continue;
|
||||
} elseif (substr($file, -4) == '.php') {
|
||||
@@ -24,6 +24,7 @@ if ($imports_dir) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@closedir($imports_dir);
|
||||
|
||||
$importers = get_importers();
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class Blogger_Import {
|
||||
if ( empty($this->blogs) ) {
|
||||
$headers = array(
|
||||
"GET /feeds/default/blogs HTTP/1.0",
|
||||
"Host: www2.blogger.com",
|
||||
"Host: www.blogger.com",
|
||||
"Authorization: AuthSub token=\"$this->token\""
|
||||
);
|
||||
$request = join( "\r\n", $headers ) . "\r\n\r\n";
|
||||
@@ -380,7 +380,9 @@ class Blogger_Import {
|
||||
$entry = "<feed>$entry</feed>";
|
||||
$AtomParser = new AtomParser();
|
||||
$AtomParser->parse( $entry );
|
||||
$this->import_post($AtomParser->entry);
|
||||
$result = $this->import_post($AtomParser->entry);
|
||||
if ( is_wp_error( $result ) )
|
||||
return $result;
|
||||
unset($AtomParser);
|
||||
}
|
||||
} else break;
|
||||
@@ -509,15 +511,17 @@ class Blogger_Import {
|
||||
$post_content = str_replace('<hr>', '<hr />', $post_content);
|
||||
|
||||
// Checks for duplicates
|
||||
if (
|
||||
isset( $this->blogs[$importing_blog]['posts'][$entry->old_permalink] ) ||
|
||||
post_exists( $post_title, $post_content, $post_date )
|
||||
) {
|
||||
if ( isset( $this->blogs[$importing_blog]['posts'][$entry->old_permalink] ) ) {
|
||||
++$this->blogs[$importing_blog]['posts_skipped'];
|
||||
} elseif ( $post_id = post_exists( $post_title, $post_content, $post_date ) ) {
|
||||
$this->blogs[$importing_blog]['posts'][$entry->old_permalink] = $post_id;
|
||||
++$this->blogs[$importing_blog]['posts_skipped'];
|
||||
} else {
|
||||
$post = compact('post_date', 'post_content', 'post_title', 'post_status');
|
||||
|
||||
$post_id = wp_insert_post($post);
|
||||
if ( is_wp_error( $post_id ) )
|
||||
return $post_id;
|
||||
|
||||
wp_create_categories( array_map( 'addslashes', $entry->categories ), $post_id );
|
||||
|
||||
@@ -531,6 +535,7 @@ class Blogger_Import {
|
||||
++$this->blogs[$importing_blog]['posts_done'];
|
||||
}
|
||||
$this->save_vars();
|
||||
return;
|
||||
}
|
||||
|
||||
function import_comment( $entry ) {
|
||||
@@ -767,7 +772,9 @@ class Blogger_Import {
|
||||
if ( isset( $_REQUEST['blog'] ) ) {
|
||||
$blog = is_array($_REQUEST['blog']) ? array_shift( array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog'];
|
||||
$blog = (int) $blog;
|
||||
$this->import_blog( $blog );
|
||||
$result = $this->import_blog( $blog );
|
||||
if ( is_wp_error( $result ) )
|
||||
echo $result->get_error_message();
|
||||
} elseif ( isset($_GET['token']) )
|
||||
$this->auth();
|
||||
elseif ( $this->token && $this->token_is_valid() )
|
||||
@@ -915,11 +922,11 @@ class AtomParser {
|
||||
if(count($this->in_content) == 2) {
|
||||
array_push($this->in_content, ">");
|
||||
}
|
||||
|
||||
|
||||
array_push($this->in_content, "<". $this->ns_to_prefix($name) ."{$xmlns_str}{$attrs_str}");
|
||||
} else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) {
|
||||
$this->in_content = array();
|
||||
$this->is_xhtml = $attrs['type'] == 'xhtml';
|
||||
$this->is_xhtml = $attrs['type'] == 'xhtml';
|
||||
array_push($this->in_content, array($tag,$this->depth));
|
||||
} else if($tag == 'link') {
|
||||
array_push($this->entry->links, $attrs);
|
||||
@@ -935,7 +942,7 @@ class AtomParser {
|
||||
$tag = array_pop(split(":", $name));
|
||||
|
||||
if(!empty($this->in_content)) {
|
||||
if($this->in_content[0][0] == $tag &&
|
||||
if($this->in_content[0][0] == $tag &&
|
||||
$this->in_content[0][1] == $this->depth) {
|
||||
array_shift($this->in_content);
|
||||
if($this->is_xhtml) {
|
||||
@@ -998,14 +1005,14 @@ class AtomParser {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
function xml_escape($string)
|
||||
{
|
||||
return str_replace(array('&','"',"'",'<','>'),
|
||||
array('&','"',''','<','>'),
|
||||
return str_replace(array('&','"',"'",'<','>'),
|
||||
array('&','"',''','<','>'),
|
||||
$string );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,9 @@ class BW_Import {
|
||||
printf(__('Importing post <i>%s</i>...'), stripslashes($post_title));
|
||||
$postdata = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status');
|
||||
$post_id = wp_insert_post($postdata);
|
||||
if ( is_wp_error( $post_id ) ) {
|
||||
return $post_id;
|
||||
}
|
||||
if (!$post_id) {
|
||||
_e("Couldn't get post ID");
|
||||
echo '</li>';
|
||||
@@ -155,7 +158,9 @@ class BW_Import {
|
||||
}
|
||||
|
||||
$this->file = $file['file'];
|
||||
$this->import_posts();
|
||||
$result = $this->import_posts();
|
||||
if ( is_wp_error( $result ) )
|
||||
return $result;
|
||||
wp_import_cleanup($file['id']);
|
||||
|
||||
echo '<h3>';
|
||||
@@ -176,7 +181,9 @@ class BW_Import {
|
||||
$this->greet();
|
||||
break;
|
||||
case 1 :
|
||||
$this->import();
|
||||
$result = $this->import();
|
||||
if ( is_wp_error( $result ) )
|
||||
$result->get_error_message();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
115
wp-admin/import/btt.php
Normal file
115
wp-admin/import/btt.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
class BunnyTags_Import {
|
||||
|
||||
function header() {
|
||||
echo '<div class="wrap">';
|
||||
echo '<h2>'.__('Import Bunny’s Technorati Tags').'</h2>';
|
||||
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
|
||||
}
|
||||
|
||||
function footer() {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function greet() {
|
||||
echo '<div class="narrow">';
|
||||
echo '<p>'.__('Howdy! This imports tags from an existing Bunny’s Technorati Tags installation into this blog using the new WordPress native tagging structure.').'</p>';
|
||||
echo '<p>'.__('This is suitable for Bunny’s Technorati Tags version 0.6.').'</p>';
|
||||
echo '<p><strong>'.__('All existing Bunny’s Technorati Tags will be removed after import.').'</strong></p>';
|
||||
echo '<p><strong>'.__('Don’t be stupid - backup your database before proceeding!').'</strong></p>';
|
||||
echo '<form action="admin.php?import=btt&step=1" method="post">';
|
||||
wp_nonce_field('import-btt');
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Import Tags »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function dispatch() {
|
||||
if ( empty($_GET['step']) )
|
||||
$step = 0;
|
||||
else
|
||||
$step = abs(intval($_GET['step']));
|
||||
|
||||
// load the header
|
||||
$this->header();
|
||||
|
||||
switch ( $step ) {
|
||||
case 0 :
|
||||
$this->greet();
|
||||
break;
|
||||
case 1 :
|
||||
check_admin_referer('import-btt');
|
||||
$this->check_post_keyword( true );
|
||||
break;
|
||||
case 2 :
|
||||
check_admin_referer('import-btt');
|
||||
$this->check_post_keyword( false );
|
||||
break;
|
||||
case 3:
|
||||
$this->done();
|
||||
break;
|
||||
}
|
||||
|
||||
// load the footer
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function check_post_keyword($precheck = true) {
|
||||
global $wpdb;
|
||||
|
||||
echo '<div class="narrow">';
|
||||
echo '<p><h3>'.__('Reading Bunny’s Technorati Tags…').'</h3></p>';
|
||||
|
||||
// import Bunny's Keywords tags
|
||||
$metakeys = $wpdb->get_results("SELECT post_id, meta_id, meta_key, meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'tags'");
|
||||
if ( !is_array($metakeys)) {
|
||||
echo '<p>' . __('No Tags Found!') . '</p>';
|
||||
return false;
|
||||
} else {
|
||||
$count = count($metakeys);
|
||||
echo '<p>' . sprintf( __('Done! <strong>%s</strong> posts with tags were read.'), $count ) . '<br /></p>';
|
||||
echo '<ul>';
|
||||
foreach ( $metakeys as $post_meta ) {
|
||||
if ( $post_meta->meta_value != '' ) {
|
||||
$post_keys = explode(' ', $post_meta->meta_value);
|
||||
foreach ( $post_keys as $keyword ) {
|
||||
$keyword = addslashes(trim(str_replace('+',' ',$keyword)));
|
||||
if ( '' != $keyword ) {
|
||||
echo '<li>' . $post_meta->post_id . ' - ' . $keyword . '</li>';
|
||||
if ( !$precheck )
|
||||
wp_add_post_tags($post_meta->post_id, $keyword);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !$precheck )
|
||||
delete_post_meta($post_meta->post_id, 'tags');
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
echo '<form action="admin.php?import=btt&step='.($precheck? 2:3).'" method="post">';
|
||||
wp_nonce_field('import-btt');
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Next »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function done() {
|
||||
echo '<div class="narrow">';
|
||||
echo '<p><h3>'.__('Import Complete!').'</h3></p>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function BunnyTags_Import() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// create the import object
|
||||
$btt_import = new BunnyTags_Import();
|
||||
|
||||
// add it to the import page!
|
||||
register_importer('btt', 'Bunny’s Technorati Tags', __('Import Bunny’s Technorati Tags into the new native tagging structure.'), array($btt_import, 'dispatch'));
|
||||
|
||||
?>
|
||||
@@ -7,18 +7,6 @@
|
||||
/**
|
||||
Add These Functions to make our lives easier
|
||||
**/
|
||||
if(!function_exists('get_catbynicename'))
|
||||
{
|
||||
function get_catbynicename($category_nicename)
|
||||
{
|
||||
global $wpdb;
|
||||
|
||||
$cat_id -= 0; // force numeric
|
||||
$name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
|
||||
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('get_comment_count'))
|
||||
{
|
||||
@@ -29,15 +17,6 @@ if(!function_exists('get_comment_count'))
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('link_cat_exists'))
|
||||
{
|
||||
function link_cat_exists($catname)
|
||||
{
|
||||
global $wpdb;
|
||||
return $wpdb->get_var('SELECT cat_id FROM '.$wpdb->linkcategories.' WHERE cat_name = "'.$wpdb->escape($catname).'"');
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('link_exists'))
|
||||
{
|
||||
function link_exists($linkname)
|
||||
@@ -130,19 +109,19 @@ function textconv ($s) {
|
||||
**/
|
||||
class Dotclear_Import {
|
||||
|
||||
function header()
|
||||
function header()
|
||||
{
|
||||
echo '<div class="wrap">';
|
||||
echo '<h2>'.__('Import DotClear').'</h2>';
|
||||
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
|
||||
}
|
||||
|
||||
function footer()
|
||||
function footer()
|
||||
{
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function greet()
|
||||
function greet()
|
||||
{
|
||||
echo '<div class="narrow"><p>'.__('Howdy! This importer allows you to extract posts from a DotClear database into your blog. Mileage may vary.').'</p>';
|
||||
echo '<p>'.__('Your DotClear Configuration settings are as follows:').'</p>';
|
||||
@@ -385,6 +364,8 @@ class Dotclear_Import {
|
||||
'ping_status' => $comment_status_map[$post_open_tb],
|
||||
'comment_count' => $post_nb_comment + $post_nb_trackback)
|
||||
);
|
||||
if ( is_wp_error( $ret_id ) )
|
||||
return $ret_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -403,12 +384,17 @@ class Dotclear_Import {
|
||||
'ping_status' => $comment_status_map[$post_open_tb],
|
||||
'comment_count' => $post_nb_comment + $post_nb_trackback)
|
||||
);
|
||||
if ( is_wp_error( $ret_id ) )
|
||||
return $ret_id;
|
||||
}
|
||||
$dcposts2wpposts[$post_id] = $ret_id;
|
||||
|
||||
// Make Post-to-Category associations
|
||||
$cats = array();
|
||||
if($cat1 = get_catbynicename($post_cat_name)) { $cats[1] = $cat1; }
|
||||
$category1 = get_category_by_slug($post_cat_name);
|
||||
$category1 = $category1->term_id;
|
||||
|
||||
if($cat1 = $category1) { $cats[1] = $cat1; }
|
||||
|
||||
if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
|
||||
}
|
||||
@@ -509,12 +495,11 @@ class Dotclear_Import {
|
||||
extract($link);
|
||||
|
||||
if ($title != "") {
|
||||
if ($cinfo = link_cat_exists (csc ($title))) {
|
||||
$category = $cinfo;
|
||||
if ($cinfo = is_term(csc ($title), 'link_category')) {
|
||||
$category = $cinfo['term_id'];
|
||||
} else {
|
||||
$wpdb->query ("INSERT INTO $wpdb->linkcategories (cat_name) VALUES ('".
|
||||
$wpdb->escape (csc ($title))."')");
|
||||
$category = $wpdb->insert_id;
|
||||
$category = wp_insert_term($wpdb->escape (csc ($title)), 'link_category');
|
||||
$category = $category['term_id'];
|
||||
}
|
||||
} else {
|
||||
$linkname = $wpdb->escape(csc ($label));
|
||||
@@ -581,7 +566,9 @@ class Dotclear_Import {
|
||||
{
|
||||
// Post Import
|
||||
$posts = $this->get_dc_posts();
|
||||
$this->posts2wp($posts);
|
||||
$result = $this->posts2wp($posts);
|
||||
if ( is_wp_error( $result ) )
|
||||
return $result;
|
||||
|
||||
echo '<form action="admin.php?import=dotclear&step=4" method="post">';
|
||||
wp_nonce_field('import-dotclear');
|
||||
@@ -729,7 +716,9 @@ class Dotclear_Import {
|
||||
$this->import_users();
|
||||
break;
|
||||
case 3 :
|
||||
$this->import_posts();
|
||||
$result = $this->import_posts();
|
||||
if ( is_wp_error( $result ) )
|
||||
echo $result->get_error_message();
|
||||
break;
|
||||
case 4 :
|
||||
$this->import_comments();
|
||||
|
||||
@@ -233,6 +233,8 @@ class GM_Import {
|
||||
|
||||
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt');
|
||||
$post_ID = wp_insert_post($postdata);
|
||||
if ( is_wp_error( $post_ID ) )
|
||||
return $post_ID;
|
||||
}
|
||||
|
||||
$c=count($entry);
|
||||
@@ -287,6 +289,7 @@ class GM_Import {
|
||||
<p><?php _e('Completed GreyMatter import!') ?></p>
|
||||
<?php
|
||||
$this->footer();
|
||||
return;
|
||||
}
|
||||
|
||||
function dispatch() {
|
||||
@@ -301,7 +304,9 @@ class GM_Import {
|
||||
break;
|
||||
case 1:
|
||||
check_admin_referer('import-greymatter');
|
||||
$this->import();
|
||||
$result = $this->import();
|
||||
if ( is_wp_error( $result ) )
|
||||
echo $result->get_error_message();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
178
wp-admin/import/jkw.php
Normal file
178
wp-admin/import/jkw.php
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
class JeromesKeyword_Import {
|
||||
|
||||
function header() {
|
||||
echo '<div class="wrap">';
|
||||
echo '<h2>'.__('Import Jerome’s Keywords').'</h2>';
|
||||
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
|
||||
}
|
||||
|
||||
function footer() {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function greet() {
|
||||
echo '<div class="narrow">';
|
||||
echo '<p>'.__('Howdy! This imports tags from an existing Jerome’s Keywords installation into this blog using the new WordPress native tagging structure.').'</p>';
|
||||
echo '<p>'.__('This is suitable for Jerome’s Keywords version 1.x and 2.0a.').'</p>';
|
||||
echo '<p><strong>'.__('All existing Jerome’s Keywords will be removed after import.').'</strong></p>';
|
||||
echo '<p><strong>'.__('Don’t be stupid - backup your database before proceeding!').'</strong></p>';
|
||||
echo '<form action="admin.php?import=jkw&step=1" method="post">';
|
||||
wp_nonce_field('import-jkw');
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Import Version 1.x »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '<form action="admin.php?import=jkw&step=3" method="post">';
|
||||
wp_nonce_field('import-jkw');
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Import Version 2.0a »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function dispatch() {
|
||||
if ( empty($_GET['step']) )
|
||||
$step = 0;
|
||||
else
|
||||
$step = abs(intval($_GET['step']));
|
||||
|
||||
// load the header
|
||||
$this->header();
|
||||
|
||||
switch ( $step ) {
|
||||
case 0 :
|
||||
$this->greet();
|
||||
break;
|
||||
case 1 :
|
||||
check_admin_referer('import-jkw');
|
||||
$this->check_V1_post_keyword( true );
|
||||
break;
|
||||
case 2 :
|
||||
check_admin_referer('import-jkw');
|
||||
$this->check_V1_post_keyword( false );
|
||||
break;
|
||||
case 3 :
|
||||
check_admin_referer('import-jkw');
|
||||
$this->check_V2_post_keyword( true );
|
||||
break;
|
||||
case 4 :
|
||||
check_admin_referer('import-jkw');
|
||||
$this->check_V2_post_keyword( false );
|
||||
break;
|
||||
case 5:
|
||||
check_admin_referer('import-jkw');
|
||||
$this->cleanup_V2_import();
|
||||
break;
|
||||
case 6:
|
||||
$this->done();
|
||||
break;
|
||||
}
|
||||
|
||||
// load the footer
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function check_V1_post_keyword($precheck = true) {
|
||||
global $wpdb;
|
||||
|
||||
echo '<div class="narrow">';
|
||||
echo '<p><h3>'.__('Reading Jerome’s Keywords Tags…').'</h3></p>';
|
||||
|
||||
// import Jerome's Keywords tags
|
||||
$metakeys = $wpdb->get_results("SELECT post_id, meta_id, meta_key, meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'keywords'");
|
||||
if ( !is_array($metakeys)) {
|
||||
echo '<p>' . __('No Tags Found!') . '</p>';
|
||||
return false;
|
||||
} else {
|
||||
$count = count($metakeys);
|
||||
echo '<p>' . sprintf( __('Done! <strong>%s</strong> posts with tags were read.'), $count ) . '<br /></p>';
|
||||
echo '<ul>';
|
||||
foreach ( $metakeys as $post_meta ) {
|
||||
if ( $post_meta->meta_value != '' ) {
|
||||
$post_keys = explode(',', $post_meta->meta_value);
|
||||
foreach ( $post_keys as $keyword ) {
|
||||
$keyword = addslashes(trim($keyword));
|
||||
if ( '' != $keyword ) {
|
||||
echo '<li>' . $post_meta->post_id . ' - ' . $keyword . '</li>';
|
||||
if ( !$precheck )
|
||||
wp_add_post_tags($post_meta->post_id, $keyword);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !$precheck )
|
||||
delete_post_meta($post_meta->post_id, 'keywords');
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
echo '<form action="admin.php?import=jkw&step='.($precheck? 2:6).'" method="post">';
|
||||
wp_nonce_field('import-jkw');
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Next »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function check_V2_post_keyword($precheck = true) {
|
||||
global $wpdb;
|
||||
|
||||
echo '<div class="narrow">';
|
||||
echo '<p><h3>'.__('Reading Jerome’s Keywords Tags…').'</h3></p>';
|
||||
|
||||
// import Jerome's Keywords tags
|
||||
$tablename = $wpdb->prefix . substr(get_option('jkeywords_keywords_table'), 1, -1);
|
||||
$metakeys = $wpdb->get_results("SELECT post_id, tag_name FROM $tablename");
|
||||
if ( !is_array($metakeys) ) {
|
||||
echo '<p>' . __('No Tags Found!') . '</p>';
|
||||
return false;
|
||||
} else {
|
||||
$count = count($metakeys);
|
||||
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags were read.'), $count ) . '<br /></p>';
|
||||
echo '<ul>';
|
||||
foreach ( $metakeys as $post_meta ) {
|
||||
$keyword = addslashes(trim($post_meta->tag_name));
|
||||
if ( $keyword != '' ) {
|
||||
echo '<li>' . $post_meta->post_id . ' - ' . $keyword . '</li>';
|
||||
if ( !$precheck )
|
||||
wp_add_post_tags($post_meta->post_id, $keyword);
|
||||
}
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
echo '<form action="admin.php?import=jkw&step='.($precheck? 4:5).'" method="post">';
|
||||
wp_nonce_field('import-jkw');
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Next »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function cleanup_V2_import() {
|
||||
global $wpdb;
|
||||
|
||||
/* options from V2.0a (jeromes-keywords.php) */
|
||||
$options = array('version', 'keywords_table', 'query_varname', 'template', 'meta_always_include', 'meta_includecats', 'meta_autoheader', 'search_strict', 'use_feed_cats', 'post_linkformat', 'post_tagseparator', 'post_includecats', 'post_notagstext', 'cloud_linkformat', 'cloud_tagseparator', 'cloud_includecats', 'cloud_sortorder', 'cloud_displaymax', 'cloud_displaymin', 'cloud_scalemax', 'cloud_scalemin');
|
||||
|
||||
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . substr(get_option('jkeywords_keywords_table'), 1, -1));
|
||||
|
||||
foreach ( $options as $o )
|
||||
delete_option('jkeywords_' . $o);
|
||||
|
||||
$this->done();
|
||||
}
|
||||
|
||||
function done() {
|
||||
echo '<div class="narrow">';
|
||||
echo '<p><h3>'.__('Import Complete!').'</h3></p>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function JeromesKeyword_Import() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// create the import object
|
||||
$jkw_import = new JeromesKeyword_Import();
|
||||
|
||||
// add it to the import page!
|
||||
register_importer('jkw', 'Jerome’s Keywords', __('Import Jerome’s Keywords into the new native tagging structure.'), array($jkw_import, 'dispatch'));
|
||||
|
||||
?>
|
||||
@@ -49,7 +49,7 @@ class LJ_Import {
|
||||
|
||||
preg_match('|<eventtime>(.*?)</eventtime>|is', $post, $post_date);
|
||||
$post_date = strtotime($post_date[1]);
|
||||
$post_date = gmdate('Y-m-d H:i:s', $post_date);
|
||||
$post_date = date('Y-m-d H:i:s', $post_date);
|
||||
|
||||
preg_match('|<event>(.*?)</event>|is', $post, $post_content);
|
||||
$post_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($post_content[1]));
|
||||
@@ -71,6 +71,8 @@ class LJ_Import {
|
||||
printf(__('Importing post <i>%s</i>...'), stripslashes($post_title));
|
||||
$postdata = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status');
|
||||
$post_id = wp_insert_post($postdata);
|
||||
if ( is_wp_error( $post_id ) )
|
||||
return $post_id;
|
||||
if (!$post_id) {
|
||||
_e("Couldn't get post ID");
|
||||
echo '</li>';
|
||||
@@ -132,7 +134,9 @@ class LJ_Import {
|
||||
}
|
||||
|
||||
$this->file = $file['file'];
|
||||
$this->import_posts();
|
||||
$result = $this->import_posts();
|
||||
if ( is_wp_error( $result ) )
|
||||
return $result;
|
||||
wp_import_cleanup($file['id']);
|
||||
|
||||
echo '<h3>';
|
||||
@@ -154,7 +158,9 @@ class LJ_Import {
|
||||
break;
|
||||
case 1 :
|
||||
check_admin_referer('import-upload');
|
||||
$this->import();
|
||||
$result = $this->import();
|
||||
if ( is_wp_error( $result ) )
|
||||
echo $result->get_error_message();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,18 @@ class MT_Import {
|
||||
$this->header();
|
||||
?>
|
||||
<div class="narrow">
|
||||
<p><?php _e('Howdy! We’re about to begin importing all of your Movable Type or Typepad entries into WordPress. To begin, choose a file to upload and click Upload file and import.'); ?></p>
|
||||
<p><?php _e('Howdy! We’re about to begin importing all of your Movable Type or Typepad entries into WordPress. To begin, either choose a file to upload and click "Upload file and import," or use FTP to upload your MT export file as <code>mt-export.txt</code> in your <code>/wp-content/</code> directory and then click "Import mt-export.txt"'); ?></p>
|
||||
<?php wp_import_upload_form( add_query_arg('step', 1) ); ?>
|
||||
<p><?php _e('The importer is smart enough not to import duplicates, so you can run this multiple times without worry if—for whatever reason—it doesn\'t finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces.'); ?> </p>
|
||||
<form method="post" action="<?php echo add_query_arg('step', 1); ?>" class="import-upload-form">
|
||||
<?php wp_nonce_field('import-upload'); ?>
|
||||
<p>
|
||||
<input type="hidden" name="upload_type" value="ftp" />
|
||||
<?php _e('Or use <code>mt-export.txt</code> in your <code>/wp-content/</code> directory'); ?></p>
|
||||
<p class="submit">
|
||||
<input type="submit" value="<?php _e(sprintf('Import %s', 'mt-export.txt »')); ?>" />
|
||||
</p>
|
||||
</form>
|
||||
<p><?php _e('The importer is smart enough not to import duplicates, so you can run this multiple times without worry if—for whatever reason—it doesn\'t finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces.'); ?> </p>
|
||||
</div>
|
||||
<?php
|
||||
$this->footer();
|
||||
@@ -75,25 +84,27 @@ class MT_Import {
|
||||
return $user_id;
|
||||
}
|
||||
|
||||
function get_entries() {
|
||||
set_magic_quotes_runtime(0);
|
||||
$importdata = file($this->file); // Read the file into an array
|
||||
$importdata = implode('', $importdata); // squish it
|
||||
$importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata);
|
||||
$importdata = preg_replace("/\n--------\n/", "--MT-ENTRY--\n", $importdata);
|
||||
$this->posts = explode("--MT-ENTRY--", $importdata);
|
||||
}
|
||||
|
||||
function get_mt_authors() {
|
||||
$temp = array ();
|
||||
$i = -1;
|
||||
foreach ($this->posts as $post) {
|
||||
if ('' != trim($post)) {
|
||||
++ $i;
|
||||
preg_match("|AUTHOR:(.*)|", $post, $thematch);
|
||||
$thematch = trim($thematch[1]);
|
||||
array_push($temp, "$thematch"); //store the extracted author names in a temporary array
|
||||
}
|
||||
$temp = array();
|
||||
$authors = array();
|
||||
|
||||
$handle = fopen($this->file, 'r');
|
||||
if ( $handle == null )
|
||||
return false;
|
||||
|
||||
$in_comment = false;
|
||||
while ( $line = fgets($handle) ) {
|
||||
$line = trim($line);
|
||||
|
||||
if ( 'COMMENT:' == $line )
|
||||
$in_comment = true;
|
||||
else if ( '-----' == $line )
|
||||
$in_comment = false;
|
||||
|
||||
if ( $in_comment || 0 !== strpos($line,"AUTHOR:") )
|
||||
continue;
|
||||
|
||||
$temp[] = trim( substr($line, strlen("AUTHOR:")) );
|
||||
}
|
||||
|
||||
//we need to find unique values of author names, while preserving the order, so this function emulates the unique_value(); php function, without the sorting.
|
||||
@@ -105,6 +116,8 @@ class MT_Import {
|
||||
array_push($authors, "$next");
|
||||
}
|
||||
|
||||
fclose($handle);
|
||||
|
||||
return $authors;
|
||||
}
|
||||
|
||||
@@ -138,7 +151,7 @@ class MT_Import {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Assign Authors'); ?></h2>
|
||||
<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.'); ?></p>
|
||||
<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as admin\'s entries.'); ?></p>
|
||||
<p><?php _e('Below, you can see the names of the authors of the MovableType posts in <i>italics</i>. For each of these names, you can either pick an author in your WordPress installation from the menu, or enter a name for the author in the textbox.'); ?></p>
|
||||
<p><?php _e('If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)'); ?></p>
|
||||
<?php
|
||||
@@ -156,14 +169,20 @@ class MT_Import {
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
echo '<input type="submit" value="'.__('Submit').'">'.'<br/>';
|
||||
echo '<input type="submit" value="'.__('Submit').'">'.'<br />';
|
||||
echo '</form>';
|
||||
echo '</ol></div>';
|
||||
|
||||
}
|
||||
|
||||
function select_authors() {
|
||||
$file = wp_import_handle_upload();
|
||||
if ( $_POST['upload_type'] === 'ftp' ) {
|
||||
$file['file'] = ABSPATH . 'wp-content/mt-export.txt';
|
||||
if ( !file_exists($file['file']) )
|
||||
$file['error'] = __('<code>mt-export.txt</code> does not exist');
|
||||
} else {
|
||||
$file = wp_import_handle_upload();
|
||||
}
|
||||
if ( isset($file['error']) ) {
|
||||
$this->header();
|
||||
echo '<p>'.__('Sorry, there has been an error').'.</p>';
|
||||
@@ -174,237 +193,235 @@ class MT_Import {
|
||||
$this->file = $file['file'];
|
||||
$this->id = (int) $file['id'];
|
||||
|
||||
$this->get_entries();
|
||||
$this->mt_authors_form();
|
||||
}
|
||||
|
||||
function save_post(&$post, &$comments, &$pings) {
|
||||
// Reset the counter
|
||||
set_time_limit(30);
|
||||
$post = get_object_vars($post);
|
||||
$post = add_magic_quotes($post);
|
||||
$post = (object) $post;
|
||||
|
||||
if ( $post_id = post_exists($post->post_title, '', $post->post_date) ) {
|
||||
echo '<li>';
|
||||
printf(__('Post <i>%s</i> already exists.'), stripslashes($post->post_title));
|
||||
} else {
|
||||
echo '<li>';
|
||||
printf(__('Importing post <i>%s</i>...'), stripslashes($post->post_title));
|
||||
|
||||
if ( '' != trim( $post->extended ) )
|
||||
$post->post_content .= "\n<!--more-->\n$post->extended";
|
||||
|
||||
$post->post_author = $this->checkauthor($post->post_author); //just so that if a post already exists, new users are not created by checkauthor
|
||||
$post_id = wp_insert_post($post);
|
||||
if ( is_wp_error( $post_id ) )
|
||||
return $post_id;
|
||||
|
||||
// Add categories.
|
||||
if ( 0 != count($post->categories) ) {
|
||||
wp_create_categories($post->categories, $post_id);
|
||||
}
|
||||
}
|
||||
|
||||
$num_comments = 0;
|
||||
foreach ( $comments as $comment ) {
|
||||
$comment = get_object_vars($comment);
|
||||
$comment = add_magic_quotes($comment);
|
||||
|
||||
if ( !comment_exists($comment['comment_author'], $comment['comment_date'])) {
|
||||
$comment['comment_post_ID'] = $post_id;
|
||||
$comment = wp_filter_comment($comment);
|
||||
wp_insert_comment($comment);
|
||||
$num_comments++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $num_comments )
|
||||
printf(' '.__('(%s comments)'), $num_comments);
|
||||
|
||||
$num_pings = 0;
|
||||
foreach ( $pings as $ping ) {
|
||||
$ping = get_object_vars($ping);
|
||||
$ping = add_magic_quotes($ping);
|
||||
|
||||
if ( !comment_exists($ping['comment_author'], $ping['comment_date'])) {
|
||||
$ping['comment_content'] = "<strong>{$ping['title']}</strong>\n\n{$ping['comment_content']}";
|
||||
$ping['comment_post_ID'] = $post_id;
|
||||
$ping = wp_filter_comment($ping);
|
||||
wp_insert_comment($ping);
|
||||
$num_pings++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $num_pings )
|
||||
printf(' '.__('(%s pings)'), $num_pings);
|
||||
|
||||
echo "</li>";
|
||||
//ob_flush();flush();
|
||||
}
|
||||
|
||||
function process_posts() {
|
||||
global $wpdb;
|
||||
$i = -1;
|
||||
|
||||
$handle = fopen($this->file, 'r');
|
||||
if ( $handle == null )
|
||||
return false;
|
||||
|
||||
$context = '';
|
||||
$post = new StdClass();
|
||||
$comment = new StdClass();
|
||||
$comments = array();
|
||||
$ping = new StdClass();
|
||||
$pings = array();
|
||||
|
||||
echo "<div class='wrap'><ol>";
|
||||
foreach ($this->posts as $post) {
|
||||
if ('' != trim($post)) {
|
||||
++ $i;
|
||||
unset ($post_categories);
|
||||
|
||||
// Take the pings out first
|
||||
preg_match("|(-----\n\nPING:.*)|s", $post, $pings);
|
||||
$post = preg_replace("|(-----\n\nPING:.*)|s", '', $post);
|
||||
while ( $line = fgets($handle) ) {
|
||||
$line = trim($line);
|
||||
|
||||
// Then take the comments out
|
||||
preg_match("|(-----\nCOMMENT:.*)|s", $post, $comments);
|
||||
$post = preg_replace("|(-----\nCOMMENT:.*)|s", '', $post);
|
||||
|
||||
// We ignore the keywords
|
||||
$post = preg_replace("|(-----\nKEYWORDS:.*)|s", '', $post);
|
||||
|
||||
// We want the excerpt
|
||||
preg_match("|-----\nEXCERPT:(.*)|s", $post, $excerpt);
|
||||
$post_excerpt = $wpdb->escape(trim($excerpt[1]));
|
||||
$post = preg_replace("|(-----\nEXCERPT:.*)|s", '', $post);
|
||||
|
||||
// We're going to put extended body into main body with a more tag
|
||||
preg_match("|-----\nEXTENDED BODY:(.*)|s", $post, $extended);
|
||||
$extended = trim($extended[1]);
|
||||
if ('' != $extended)
|
||||
$extended = "\n<!--more-->\n$extended";
|
||||
$post = preg_replace("|(-----\nEXTENDED BODY:.*)|s", '', $post);
|
||||
|
||||
// Now for the main body
|
||||
preg_match("|-----\nBODY:(.*)|s", $post, $body);
|
||||
$body = trim($body[1]);
|
||||
$post_content = $wpdb->escape($body.$extended);
|
||||
$post = preg_replace("|(-----\nBODY:.*)|s", '', $post);
|
||||
|
||||
// Grab the metadata from what's left
|
||||
$metadata = explode("\n", $post);
|
||||
foreach ($metadata as $line) {
|
||||
preg_match("/^(.*?):(.*)/", $line, $token);
|
||||
$key = trim($token[1]);
|
||||
$value = trim($token[2]);
|
||||
// Now we decide what it is and what to do with it
|
||||
switch ($key) {
|
||||
case '' :
|
||||
break;
|
||||
case 'AUTHOR' :
|
||||
$post_author = $value;
|
||||
break;
|
||||
case 'TITLE' :
|
||||
$post_title = $wpdb->escape($value);
|
||||
break;
|
||||
case 'STATUS' :
|
||||
// "publish" and "draft" enumeration items match up; no change required
|
||||
$post_status = $value;
|
||||
if (empty ($post_status))
|
||||
$post_status = 'publish';
|
||||
break;
|
||||
case 'ALLOW COMMENTS' :
|
||||
$post_allow_comments = $value;
|
||||
if ($post_allow_comments == 1) {
|
||||
$comment_status = 'open';
|
||||
} else {
|
||||
$comment_status = 'closed';
|
||||
}
|
||||
break;
|
||||
case 'CONVERT BREAKS' :
|
||||
$post_convert_breaks = $value;
|
||||
break;
|
||||
case 'ALLOW PINGS' :
|
||||
$ping_status = trim($meta[2][0]);
|
||||
if ($ping_status == 1) {
|
||||
$ping_status = 'open';
|
||||
} else {
|
||||
$ping_status = 'closed';
|
||||
}
|
||||
break;
|
||||
case 'PRIMARY CATEGORY' :
|
||||
if (! empty ($value) )
|
||||
$post_categories[] = $wpdb->escape($value);
|
||||
break;
|
||||
case 'CATEGORY' :
|
||||
if (! empty ($value) )
|
||||
$post_categories[] = $wpdb->escape($value);
|
||||
break;
|
||||
case 'DATE' :
|
||||
$post_modified = strtotime($value);
|
||||
$post_modified = date('Y-m-d H:i:s', $post_modified);
|
||||
$post_modified_gmt = get_gmt_from_date("$post_modified");
|
||||
$post_date = $post_modified;
|
||||
$post_date_gmt = $post_modified_gmt;
|
||||
break;
|
||||
default :
|
||||
// echo "\n$key: $value";
|
||||
break;
|
||||
} // end switch
|
||||
} // End foreach
|
||||
|
||||
// Let's check to see if it's in already
|
||||
if ($post_id = post_exists($post_title, '', $post_date)) {
|
||||
echo '<li>';
|
||||
printf(__('Post <i>%s</i> already exists.'), stripslashes($post_title));
|
||||
} else {
|
||||
echo '<li>';
|
||||
printf(__('Importing post <i>%s</i>...'), stripslashes($post_title));
|
||||
|
||||
$post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
|
||||
|
||||
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt');
|
||||
$post_id = wp_insert_post($postdata);
|
||||
// Add categories.
|
||||
if (0 != count($post_categories)) {
|
||||
wp_create_categories($post_categories, $post_id);
|
||||
}
|
||||
if ( '-----' == $line ) {
|
||||
// Finishing a multi-line field
|
||||
if ( 'comment' == $context ) {
|
||||
$comments[] = $comment;
|
||||
$comment = new StdClass();
|
||||
} else if ( 'ping' == $context ) {
|
||||
$pings[] = $ping;
|
||||
$ping = new StdClass();
|
||||
}
|
||||
|
||||
$comment_post_ID = (int) $post_id;
|
||||
$comment_approved = 1;
|
||||
|
||||
// Now for comments
|
||||
$comments = explode("-----\nCOMMENT:", $comments[0]);
|
||||
$num_comments = 0;
|
||||
foreach ($comments as $comment) {
|
||||
if ('' != trim($comment)) {
|
||||
// Author
|
||||
preg_match("|AUTHOR:(.*)|", $comment, $comment_author);
|
||||
$comment_author = $wpdb->escape(trim($comment_author[1]));
|
||||
$comment = preg_replace('|(\n?AUTHOR:.*)|', '', $comment);
|
||||
preg_match("|EMAIL:(.*)|", $comment, $comment_author_email);
|
||||
$comment_author_email = $wpdb->escape(trim($comment_author_email[1]));
|
||||
$comment = preg_replace('|(\n?EMAIL:.*)|', '', $comment);
|
||||
|
||||
preg_match("|IP:(.*)|", $comment, $comment_author_IP);
|
||||
$comment_author_IP = trim($comment_author_IP[1]);
|
||||
$comment = preg_replace('|(\n?IP:.*)|', '', $comment);
|
||||
|
||||
preg_match("|URL:(.*)|", $comment, $comment_author_url);
|
||||
$comment_author_url = $wpdb->escape(trim($comment_author_url[1]));
|
||||
$comment = preg_replace('|(\n?URL:.*)|', '', $comment);
|
||||
|
||||
preg_match("|DATE:(.*)|", $comment, $comment_date);
|
||||
$comment_date = trim($comment_date[1]);
|
||||
$comment_date = date('Y-m-d H:i:s', strtotime($comment_date));
|
||||
$comment = preg_replace('|(\n?DATE:.*)|', '', $comment);
|
||||
|
||||
$comment_content = $wpdb->escape(trim($comment));
|
||||
$comment_content = str_replace('-----', '', $comment_content);
|
||||
// Check if it's already there
|
||||
if (!comment_exists($comment_author, $comment_date)) {
|
||||
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_approved');
|
||||
$commentdata = wp_filter_comment($commentdata);
|
||||
wp_insert_comment($commentdata);
|
||||
$num_comments++;
|
||||
}
|
||||
}
|
||||
$context = '';
|
||||
} else if ( '--------' == $line ) {
|
||||
// Finishing a post.
|
||||
$context = '';
|
||||
$result = $this->save_post($post, $comments, $pings);
|
||||
if ( is_wp_error( $result ) )
|
||||
return $result;
|
||||
$post = new StdClass;
|
||||
$comment = new StdClass();
|
||||
$ping = new StdClass();
|
||||
$comments = array();
|
||||
$pings = array();
|
||||
} else if ( 'BODY:' == $line ) {
|
||||
$context = 'body';
|
||||
} else if ( 'EXTENDED BODY:' == $line ) {
|
||||
$context = 'extended';
|
||||
} else if ( 'EXCERPT:' == $line ) {
|
||||
$context = 'excerpt';
|
||||
} else if ( 'KEYWORDS:' == $line ) {
|
||||
$context = 'keywords';
|
||||
} else if ( 'COMMENT:' == $line ) {
|
||||
$context = 'comment';
|
||||
} else if ( 'PING:' == $line ) {
|
||||
$context = 'ping';
|
||||
} else if ( 0 === strpos($line, "AUTHOR:") ) {
|
||||
$author = trim( substr($line, strlen("AUTHOR:")) );
|
||||
if ( '' == $context )
|
||||
$post->post_author = $author;
|
||||
else if ( 'comment' == $context )
|
||||
$comment->comment_author = $author;
|
||||
} else if ( 0 === strpos($line, "TITLE:") ) {
|
||||
$title = trim( substr($line, strlen("TITLE:")) );
|
||||
if ( '' == $context )
|
||||
$post->post_title = $title;
|
||||
else if ( 'ping' == $context )
|
||||
$ping->title = $title;
|
||||
} else if ( 0 === strpos($line, "STATUS:") ) {
|
||||
$status = trim( substr($line, strlen("STATUS:")) );
|
||||
if ( empty($status) )
|
||||
$status = 'publish';
|
||||
$post->post_status = $status;
|
||||
} else if ( 0 === strpos($line, "ALLOW COMMENTS:") ) {
|
||||
$allow = trim( substr($line, strlen("ALLOW COMMENTS:")) );
|
||||
if ( $allow == 1 )
|
||||
$post->comment_status = 'open';
|
||||
else
|
||||
$post->comment_status = 'closed';
|
||||
} else if ( 0 === strpos($line, "ALLOW PINGS:") ) {
|
||||
$allow = trim( substr($line, strlen("ALLOW PINGS:")) );
|
||||
if ( $allow == 1 )
|
||||
$post->ping_status = 'open';
|
||||
else
|
||||
$post->ping_status = 'closed';
|
||||
} else if ( 0 === strpos($line, "CATEGORY:") ) {
|
||||
$category = trim( substr($line, strlen("CATEGORY:")) );
|
||||
if ( '' != $category )
|
||||
$post->categories[] = $category;
|
||||
} else if ( 0 === strpos($line, "PRIMARY CATEGORY:") ) {
|
||||
$category = trim( substr($line, strlen("PRIMARY CATEGORY:")) );
|
||||
if ( '' != $category )
|
||||
$post->categories[] = $category;
|
||||
} else if ( 0 === strpos($line, "DATE:") ) {
|
||||
$date = trim( substr($line, strlen("DATE:")) );
|
||||
$date = strtotime($date);
|
||||
$date = date('Y-m-d H:i:s', $date);
|
||||
$date_gmt = get_gmt_from_date($date);
|
||||
if ( '' == $context ) {
|
||||
$post->post_modified = $date;
|
||||
$post->post_modified_gmt = $date_gmt;
|
||||
$post->post_date = $date;
|
||||
$post->post_date_gmt = $date_gmt;
|
||||
} else if ( 'comment' == $context ) {
|
||||
$comment->comment_date = $date;
|
||||
} else if ( 'ping' == $context ) {
|
||||
$ping->comment_date = $date;
|
||||
}
|
||||
if ( $num_comments )
|
||||
printf(' '.__('(%s comments)'), $num_comments);
|
||||
} else if ( 0 === strpos($line, "EMAIL:") ) {
|
||||
$email = trim( substr($line, strlen("EMAIL:")) );
|
||||
if ( 'comment' == $context )
|
||||
$comment->comment_author_email = $email;
|
||||
else
|
||||
$ping->comment_author_email = '';
|
||||
} else if ( 0 === strpos($line, "IP:") ) {
|
||||
$ip = trim( substr($line, strlen("IP:")) );
|
||||
if ( 'comment' == $context )
|
||||
$comment->comment_author_IP = $ip;
|
||||
else
|
||||
$ping->comment_author_IP = $ip;
|
||||
} else if ( 0 === strpos($line, "URL:") ) {
|
||||
$url = trim( substr($line, strlen("URL:")) );
|
||||
if ( 'comment' == $context )
|
||||
$comment->comment_author_url = $url;
|
||||
else
|
||||
$ping->comment_author_url = $url;
|
||||
} else if ( 0 === strpos($line, "BLOG NAME:") ) {
|
||||
$blog = trim( substr($line, strlen("BLOG NAME:")) );
|
||||
$ping->comment_author = $blog;
|
||||
} else {
|
||||
// Processing multi-line field, check context.
|
||||
|
||||
// Finally the pings
|
||||
// fix the double newline on the first one
|
||||
$pings[0] = str_replace("-----\n\n", "-----\n", $pings[0]);
|
||||
$pings = explode("-----\nPING:", $pings[0]);
|
||||
$num_pings = 0;
|
||||
foreach ($pings as $ping) {
|
||||
if ('' != trim($ping)) {
|
||||
// 'Author'
|
||||
preg_match("|BLOG NAME:(.*)|", $ping, $comment_author);
|
||||
$comment_author = $wpdb->escape(trim($comment_author[1]));
|
||||
$ping = preg_replace('|(\n?BLOG NAME:.*)|', '', $ping);
|
||||
|
||||
preg_match("|IP:(.*)|", $ping, $comment_author_IP);
|
||||
$comment_author_IP = trim($comment_author_IP[1]);
|
||||
$ping = preg_replace('|(\n?IP:.*)|', '', $ping);
|
||||
|
||||
preg_match("|URL:(.*)|", $ping, $comment_author_url);
|
||||
$comment_author_url = $wpdb->escape(trim($comment_author_url[1]));
|
||||
$ping = preg_replace('|(\n?URL:.*)|', '', $ping);
|
||||
|
||||
preg_match("|DATE:(.*)|", $ping, $comment_date);
|
||||
$comment_date = trim($comment_date[1]);
|
||||
$comment_date = date('Y-m-d H:i:s', strtotime($comment_date));
|
||||
$ping = preg_replace('|(\n?DATE:.*)|', '', $ping);
|
||||
|
||||
preg_match("|TITLE:(.*)|", $ping, $ping_title);
|
||||
$ping_title = $wpdb->escape(trim($ping_title[1]));
|
||||
$ping = preg_replace('|(\n?TITLE:.*)|', '', $ping);
|
||||
|
||||
$comment_content = $wpdb->escape(trim($ping));
|
||||
$comment_content = str_replace('-----', '', $comment_content);
|
||||
|
||||
$comment_content = "<strong>$ping_title</strong>\n\n$comment_content";
|
||||
|
||||
$comment_type = 'trackback';
|
||||
|
||||
// Check if it's already there
|
||||
if (!comment_exists($comment_author, $comment_date)) {
|
||||
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_type', 'comment_approved');
|
||||
$commentdata = wp_filter_comment($commentdata);
|
||||
wp_insert_comment($commentdata);
|
||||
$num_pings++;
|
||||
}
|
||||
}
|
||||
$line .= "\n";
|
||||
if ( 'body' == $context ) {
|
||||
$post->post_content .= $line;
|
||||
} else if ( 'extended' == $context ) {
|
||||
$post->extended .= $line;
|
||||
} else if ( 'excerpt' == $context ) {
|
||||
$post->post_excerpt .= $line;
|
||||
} else if ( 'comment' == $context ) {
|
||||
$comment->comment_content .= $line;
|
||||
} else if ( 'ping' == $context ) {
|
||||
$ping->comment_content .= $line;
|
||||
}
|
||||
if ( $num_pings )
|
||||
printf(' '.__('(%s pings)'), $num_pings);
|
||||
|
||||
echo "</li>";
|
||||
}
|
||||
}
|
||||
|
||||
echo '</ol>';
|
||||
|
||||
wp_import_cleanup($this->id);
|
||||
do_action('import_done', 'mt');
|
||||
|
||||
echo '<h3>'.sprintf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')).'</h3></div>';
|
||||
}
|
||||
|
||||
function import() {
|
||||
$this->id = (int) $_GET['id'];
|
||||
|
||||
$this->file = get_attached_file($this->id);
|
||||
if ( $this->id == 0 )
|
||||
$this->file = ABSPATH . 'wp-content/mt-export.txt';
|
||||
else
|
||||
$this->file = get_attached_file($this->id);
|
||||
$this->get_authors_from_post();
|
||||
$this->get_entries();
|
||||
$this->process_posts();
|
||||
$result = $this->process_posts();
|
||||
if ( is_wp_error( $result ) )
|
||||
return $result;
|
||||
}
|
||||
|
||||
function dispatch() {
|
||||
@@ -423,7 +440,9 @@ class MT_Import {
|
||||
break;
|
||||
case 2:
|
||||
check_admin_referer('import-mt');
|
||||
$this->import();
|
||||
$result = $this->import();
|
||||
if ( is_wp_error( $result ) )
|
||||
echo $result->get_error_message();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -436,4 +455,4 @@ class MT_Import {
|
||||
$mt_import = new MT_Import();
|
||||
|
||||
register_importer('mt', __('Movable Type and TypePad'), __('Import posts and comments from a Movable Type or Typepad blog'), array ($mt_import, 'dispatch'));
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -110,6 +110,8 @@ class RSS_Import {
|
||||
_e('Post already imported');
|
||||
} else {
|
||||
$post_id = wp_insert_post($post);
|
||||
if ( is_wp_error( $post_id ) )
|
||||
return $post_id;
|
||||
if (!$post_id) {
|
||||
_e("Couldn't get post ID");
|
||||
return;
|
||||
@@ -135,7 +137,9 @@ class RSS_Import {
|
||||
|
||||
$this->file = $file['file'];
|
||||
$this->get_posts();
|
||||
$this->import_posts();
|
||||
$result = $this->import_posts();
|
||||
if ( is_wp_error( $result ) )
|
||||
return $result;
|
||||
wp_import_cleanup($file['id']);
|
||||
|
||||
echo '<h3>';
|
||||
@@ -157,7 +161,9 @@ class RSS_Import {
|
||||
break;
|
||||
case 1 :
|
||||
check_admin_referer('import-upload');
|
||||
$this->import();
|
||||
$result = $this->import();
|
||||
if ( is_wp_error( $result ) )
|
||||
echo $result->get_error_message();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
155
wp-admin/import/stp.php
Normal file
155
wp-admin/import/stp.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
class STP_Import {
|
||||
function header() {
|
||||
echo '<div class="wrap">';
|
||||
echo '<h2>'.__('Import Simple Tagging').'</h2>';
|
||||
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
|
||||
}
|
||||
|
||||
function footer() {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function greet() {
|
||||
echo '<div class="narrow">';
|
||||
echo '<p>'.__('Howdy! This imports tags from an existing Simple Tagging 1.6.2 installation into this blog using the new WordPress native tagging structure.').'</p>';
|
||||
echo '<p>'.__('This has not been tested on any other versions of Simple Tagging. Mileage may vary.').'</p>';
|
||||
echo '<p>'.__('To accommodate larger databases for those tag-crazy authors out there, we have made this into an easy 4-step program to help you kick that nasty Simple Tagging habit. Just keep clicking along and we will let you know when you are in the clear!').'</p>';
|
||||
echo '<p><strong>'.__('Don’t be stupid - backup your database before proceeding!').'</strong></p>';
|
||||
echo '<form action="admin.php?import=stp&step=1" method="post">';
|
||||
wp_nonce_field('import-stp');
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 1 »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function dispatch () {
|
||||
if ( empty( $_GET['step'] ) ) {
|
||||
$step = 0;
|
||||
} else {
|
||||
$step = (int) $_GET['step'];
|
||||
}
|
||||
// load the header
|
||||
$this->header();
|
||||
switch ( $step ) {
|
||||
case 0 :
|
||||
$this->greet();
|
||||
break;
|
||||
case 1 :
|
||||
check_admin_referer('import-stp');
|
||||
$this->import_posts();
|
||||
break;
|
||||
case 2:
|
||||
check_admin_referer('import-stp');
|
||||
$this->import_t2p();
|
||||
break;
|
||||
case 3:
|
||||
check_admin_referer('import-stp');
|
||||
$this->cleanup_import();
|
||||
break;
|
||||
}
|
||||
// load the footer
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
|
||||
function import_posts ( ) {
|
||||
echo '<div class="narrow">';
|
||||
echo '<p><h3>'.__('Reading STP Post Tags…').'</h3></p>';
|
||||
|
||||
// read in all the STP tag -> post settings
|
||||
$posts = $this->get_stp_posts();
|
||||
|
||||
// if we didn't get any tags back, that's all there is folks!
|
||||
if ( !is_array($posts) ) {
|
||||
echo '<p>' . __('No posts were found to have tags!') . '</p>';
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// if there's an existing entry, delete it
|
||||
if ( get_option('stpimp_posts') ) {
|
||||
delete_option('stpimp_posts');
|
||||
}
|
||||
|
||||
add_option('stpimp_posts', $posts);
|
||||
$count = count($posts);
|
||||
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tag to post relationships were read.'), $count ) . '<br /></p>';
|
||||
}
|
||||
|
||||
echo '<form action="admin.php?import=stp&step=2" method="post">';
|
||||
wp_nonce_field('import-stp');
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 2 »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
function import_t2p ( ) {
|
||||
echo '<div class="narrow">';
|
||||
echo '<p><h3>'.__('Adding Tags to Posts…').'</h3></p>';
|
||||
|
||||
// run that funky magic!
|
||||
$tags_added = $this->tag2post();
|
||||
|
||||
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags where added!'), $tags_added ) . '<br /></p>';
|
||||
echo '<form action="admin.php?import=stp&step=3" method="post">';
|
||||
wp_nonce_field('import-stp');
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 3 »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function get_stp_posts ( ) {
|
||||
global $wpdb;
|
||||
// read in all the posts from the STP post->tag table: should be wp_post2tag
|
||||
$posts_query = "SELECT post_id, tag_name FROM " . $wpdb->prefix . "stp_tags";
|
||||
$posts = $wpdb->get_results($posts_query);
|
||||
return $posts;
|
||||
}
|
||||
|
||||
function tag2post ( ) {
|
||||
global $wpdb;
|
||||
|
||||
// get the tags and posts we imported in the last 2 steps
|
||||
$posts = get_option('stpimp_posts');
|
||||
|
||||
// null out our results
|
||||
$tags_added = 0;
|
||||
|
||||
// loop through each post and add its tags to the db
|
||||
foreach ( $posts as $this_post ) {
|
||||
$the_post = (int) $this_post->post_id;
|
||||
$the_tag = $wpdb->escape($this_post->tag_name);
|
||||
// try to add the tag
|
||||
wp_add_post_tags($the_post, $the_tag);
|
||||
$tags_added++;
|
||||
}
|
||||
|
||||
// that's it, all posts should be linked to their tags properly, pending any errors we just spit out!
|
||||
return $tags_added;
|
||||
}
|
||||
|
||||
function cleanup_import ( ) {
|
||||
delete_option('stpimp_posts');
|
||||
$this->done();
|
||||
}
|
||||
|
||||
function done ( ) {
|
||||
echo '<div class="narrow">';
|
||||
echo '<p><h3>'.__('Import Complete!').'</h3></p>';
|
||||
echo '<p>' . __('OK, so we lied about this being a 4-step program! You’re done!') . '</p>';
|
||||
echo '<p>' . __('Now wasn’t that easy?') . '</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function STP_Import ( ) {
|
||||
// Nothing.
|
||||
}
|
||||
}
|
||||
|
||||
// create the import object
|
||||
$stp_import = new STP_Import();
|
||||
|
||||
// add it to the import page!
|
||||
register_importer('stp', 'Simple Tagging', __('Import Simple Tagging tags into the new native tagging structure.'), array($stp_import, 'dispatch'));
|
||||
?>
|
||||
@@ -2,18 +2,6 @@
|
||||
/**
|
||||
Add These Functions to make our lives easier
|
||||
**/
|
||||
if(!function_exists('get_catbynicename'))
|
||||
{
|
||||
function get_catbynicename($category_nicename)
|
||||
{
|
||||
global $wpdb;
|
||||
|
||||
$cat_id -= 0; // force numeric
|
||||
$name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
|
||||
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('get_comment_count'))
|
||||
{
|
||||
@@ -38,14 +26,14 @@ if(!function_exists('link_exists'))
|
||||
**/
|
||||
class Textpattern_Import {
|
||||
|
||||
function header()
|
||||
function header()
|
||||
{
|
||||
echo '<div class="wrap">';
|
||||
echo '<h2>'.__('Import Textpattern').'</h2>';
|
||||
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
|
||||
}
|
||||
|
||||
function footer()
|
||||
function footer()
|
||||
{
|
||||
echo '</div>';
|
||||
}
|
||||
@@ -317,6 +305,8 @@ class Textpattern_Import {
|
||||
'post_name' => $url_title,
|
||||
'comment_count' => $comments_count)
|
||||
);
|
||||
if ( is_wp_error( $ret_id ) )
|
||||
return $ret_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -333,13 +323,19 @@ class Textpattern_Import {
|
||||
'post_name' => $url_title,
|
||||
'comment_count' => $comments_count)
|
||||
);
|
||||
if ( is_wp_error( $ret_id ) )
|
||||
return $ret_id;
|
||||
}
|
||||
$txpposts2wpposts[$ID] = $ret_id;
|
||||
|
||||
// Make Post-to-Category associations
|
||||
$cats = array();
|
||||
if($cat1 = get_catbynicename($Category1)) { $cats[1] = $cat1; }
|
||||
if($cat2 = get_catbynicename($Category2)) { $cats[2] = $cat2; }
|
||||
$category1 = get_category_by_slug($Category1);
|
||||
$category1 = $category1->term_id;
|
||||
$category2 = get_category_by_slug($Category2);
|
||||
$category2 = $category1->term_id;
|
||||
if($cat1 = $category1) { $cats[1] = $cat1; }
|
||||
if($cat2 = $category2) { $cats[2] = $cat2; }
|
||||
|
||||
if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
|
||||
}
|
||||
@@ -506,7 +502,9 @@ class Textpattern_Import {
|
||||
{
|
||||
// Post Import
|
||||
$posts = $this->get_txp_posts();
|
||||
$this->posts2wp($posts);
|
||||
$result = $this->posts2wp($posts);
|
||||
if ( is_wp_error( $result ) )
|
||||
return $result;
|
||||
|
||||
echo '<form action="admin.php?import=textpattern&step=4" method="post">';
|
||||
wp_nonce_field('import-textpattern');
|
||||
@@ -559,11 +557,11 @@ class Textpattern_Import {
|
||||
{
|
||||
echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Textpattern, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>';
|
||||
echo '<h3>'.__('Users').'</h3>';
|
||||
echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password. Forget it. You didn\'t have that login in Textpattern, why should you have it here? Instead we have taken care to import all of your users into our system. Unfortunately there is one downside. Because both WordPress and Textpattern uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users. <strong>Every user has the same username, but their passwords are reset to password123.</strong> So <a href="%1$s">Login</a> and change it.'), '/wp-login.php').'</p>';
|
||||
echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password. Forget it. You didn’t have that login in Textpattern, why should you have it here? Instead we have taken care to import all of your users into our system. Unfortunately there is one downside. Because both WordPress and Textpattern uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users. <strong>Every user has the same username, but their passwords are reset to password123.</strong> So <a href="%1$s">Login</a> and change it.'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>';
|
||||
echo '<h3>'.__('Preserving Authors').'</h3>';
|
||||
echo '<p>'.__('Secondly, we have attempted to preserve post authors. If you are the only author or contributor to your blog, then you are safe. In most cases, we are successful in this preservation endeavor. However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>';
|
||||
echo '<h3>'.__('Textile').'</h3>';
|
||||
echo '<p>'.__('Also, since you\'re coming from Textpattern, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>. Trust me... You\'ll want it.').'</p>';
|
||||
echo '<p>'.__('Also, since you’re coming from Textpattern, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>. Trust me... You’ll want it.').'</p>';
|
||||
echo '<h3>'.__('WordPress Resources').'</h3>';
|
||||
echo '<p>'.__('Finally, there are numerous WordPress resources around the internet. Some of them are:').'</p>';
|
||||
echo '<ul>';
|
||||
@@ -571,7 +569,7 @@ class Textpattern_Import {
|
||||
echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums</a>').'</li>';
|
||||
echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
|
||||
echo '</ul>';
|
||||
echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>';
|
||||
echo '<p>'.sprintf(__('That’s it! What are you waiting for? Go <a href="%1$s">login</a>!'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>';
|
||||
}
|
||||
|
||||
function db_form()
|
||||
@@ -646,7 +644,9 @@ class Textpattern_Import {
|
||||
$this->import_users();
|
||||
break;
|
||||
case 3 :
|
||||
$this->import_posts();
|
||||
$result = $this->import_posts();
|
||||
if ( is_wp_error( $result ) )
|
||||
echo $result->get_error_message();
|
||||
break;
|
||||
case 4 :
|
||||
$this->import_comments();
|
||||
|
||||
276
wp-admin/import/utw.php
Normal file
276
wp-admin/import/utw.php
Normal file
@@ -0,0 +1,276 @@
|
||||
<?php
|
||||
|
||||
class UTW_Import {
|
||||
|
||||
function header() {
|
||||
echo '<div class="wrap">';
|
||||
echo '<h2>'.__('Import Ultimate Tag Warrior').'</h2>';
|
||||
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
|
||||
}
|
||||
|
||||
function footer() {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function greet() {
|
||||
echo '<div class="narrow">';
|
||||
echo '<p>'.__('Howdy! This imports tags from an existing Ultimate Tag Warrior 3 installation into this blog using the new WordPress native tagging structure.').'</p>';
|
||||
echo '<p>'.__('This has not been tested on any other versions of Ultimate Tag Warrior. Mileage may vary.').'</p>';
|
||||
echo '<p>'.__('To accommodate larger databases for those tag-crazy authors out there, we have made this into an easy 5-step program to help you kick that nasty UTW habit. Just keep clicking along and we will let you know when you are in the clear!').'</p>';
|
||||
echo '<p><strong>'.__('Don’t be stupid - backup your database before proceeding!').'</strong></p>';
|
||||
echo '<form action="admin.php?import=utw&step=1" method="post">';
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 1 »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
function dispatch () {
|
||||
if ( empty( $_GET['step'] ) ) {
|
||||
$step = 0;
|
||||
} else {
|
||||
$step = (int) $_GET['step'];
|
||||
}
|
||||
|
||||
if ( $step > 1 )
|
||||
check_admin_referer('import-utw');
|
||||
|
||||
// load the header
|
||||
$this->header();
|
||||
|
||||
switch ( $step ) {
|
||||
case 0 :
|
||||
$this->greet();
|
||||
break;
|
||||
case 1 :
|
||||
$this->import_tags();
|
||||
break;
|
||||
case 2 :
|
||||
$this->import_posts();
|
||||
break;
|
||||
case 3:
|
||||
$this->import_t2p();
|
||||
break;
|
||||
case 4:
|
||||
$this->cleanup_import();
|
||||
break;
|
||||
}
|
||||
|
||||
// load the footer
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
|
||||
function import_tags ( ) {
|
||||
echo '<div class="narrow">';
|
||||
echo '<p><h3>'.__('Reading UTW Tags…').'</h3></p>';
|
||||
|
||||
$tags = $this->get_utw_tags();
|
||||
|
||||
// if we didn't get any tags back, that's all there is folks!
|
||||
if ( !is_array($tags) ) {
|
||||
echo '<p>' . __('No Tags Found!') . '</p>';
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
||||
// if there's an existing entry, delete it
|
||||
if ( get_option('utwimp_tags') ) {
|
||||
delete_option('utwimp_tags');
|
||||
}
|
||||
|
||||
add_option('utwimp_tags', $tags);
|
||||
|
||||
|
||||
$count = count($tags);
|
||||
|
||||
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags were read.'), $count ) . '<br /></p>';
|
||||
echo '<p>' . __('The following tags were found:') . '</p>';
|
||||
|
||||
echo '<ul>';
|
||||
|
||||
foreach ( $tags as $tag_id => $tag_name ) {
|
||||
|
||||
echo '<li>' . $tag_name . '</li>';
|
||||
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
|
||||
echo '<br />';
|
||||
|
||||
echo '<p>' . __('If you don’t want to import any of these tags, you should delete them from the UTW tag management page and then re-run this import.') . '</p>';
|
||||
|
||||
|
||||
}
|
||||
|
||||
echo '<form action="admin.php?import=utw&step=2" method="post">';
|
||||
wp_nonce_field('import-utw');
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 2 »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
function import_posts ( ) {
|
||||
echo '<div class="narrow">';
|
||||
echo '<p><h3>'.__('Reading UTW Post Tags…').'</h3></p>';
|
||||
|
||||
// read in all the UTW tag -> post settings
|
||||
$posts = $this->get_utw_posts();
|
||||
|
||||
// if we didn't get any tags back, that's all there is folks!
|
||||
if ( !is_array($posts) ) {
|
||||
echo '<p>' . __('No posts were found to have tags!') . '</p>';
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
||||
// if there's an existing entry, delete it
|
||||
if ( get_option('utwimp_posts') ) {
|
||||
delete_option('utwimp_posts');
|
||||
}
|
||||
|
||||
add_option('utwimp_posts', $posts);
|
||||
|
||||
|
||||
$count = count($posts);
|
||||
|
||||
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tag to post relationships were read.'), $count ) . '<br /></p>';
|
||||
|
||||
}
|
||||
|
||||
echo '<form action="admin.php?import=utw&step=3" method="post">';
|
||||
wp_nonce_field('import-utw');
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 3 »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
function import_t2p ( ) {
|
||||
|
||||
echo '<div class="narrow">';
|
||||
echo '<p><h3>'.__('Adding Tags to Posts…').'</h3></p>';
|
||||
|
||||
// run that funky magic!
|
||||
$tags_added = $this->tag2post();
|
||||
|
||||
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags where added!'), $tags_added ) . '<br /></p>';
|
||||
|
||||
echo '<form action="admin.php?import=utw&step=4" method="post">';
|
||||
wp_nonce_field('import-utw');
|
||||
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 4 »').'" /></p>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
function get_utw_tags ( ) {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
// read in all the tags from the UTW tags table: should be wp_tags
|
||||
$tags_query = "SELECT tag_id, tag FROM " . $wpdb->prefix . "tags";
|
||||
|
||||
$tags = $wpdb->get_results($tags_query);
|
||||
|
||||
// rearrange these tags into something we can actually use
|
||||
foreach ( $tags as $tag ) {
|
||||
|
||||
$new_tags[$tag->tag_id] = $tag->tag;
|
||||
|
||||
}
|
||||
|
||||
return $new_tags;
|
||||
|
||||
}
|
||||
|
||||
function get_utw_posts ( ) {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
// read in all the posts from the UTW post->tag table: should be wp_post2tag
|
||||
$posts_query = "SELECT tag_id, post_id FROM " . $wpdb->prefix . "post2tag";
|
||||
|
||||
$posts = $wpdb->get_results($posts_query);
|
||||
|
||||
return $posts;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function tag2post ( ) {
|
||||
|
||||
// get the tags and posts we imported in the last 2 steps
|
||||
$tags = get_option('utwimp_tags');
|
||||
$posts = get_option('utwimp_posts');
|
||||
|
||||
// null out our results
|
||||
$tags_added = 0;
|
||||
|
||||
// loop through each post and add its tags to the db
|
||||
foreach ( $posts as $this_post ) {
|
||||
|
||||
$the_post = (int) $this_post->post_id;
|
||||
$the_tag = (int) $this_post->tag_id;
|
||||
|
||||
// what's the tag name for that id?
|
||||
$the_tag = $tags[$the_tag];
|
||||
|
||||
// screw it, just try to add the tag
|
||||
wp_add_post_tags($the_post, $the_tag);
|
||||
|
||||
$tags_added++;
|
||||
|
||||
}
|
||||
|
||||
// that's it, all posts should be linked to their tags properly, pending any errors we just spit out!
|
||||
return $tags_added;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function cleanup_import ( ) {
|
||||
|
||||
delete_option('utwimp_tags');
|
||||
delete_option('utwimp_posts');
|
||||
|
||||
$this->done();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function done ( ) {
|
||||
|
||||
echo '<div class="narrow">';
|
||||
echo '<p><h3>'.__('Import Complete!').'</h3></p>';
|
||||
|
||||
echo '<p>' . __('OK, so we lied about this being a 5-step program! You’re done!') . '</p>';
|
||||
|
||||
echo '<p>' . __('Now wasn’t that easy?') . '</p>';
|
||||
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
function UTW_Import ( ) {
|
||||
|
||||
// Nothing.
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// create the import object
|
||||
$utw_import = new UTW_Import();
|
||||
|
||||
// add it to the import page!
|
||||
register_importer('utw', 'Ultimate Tag Warrior', __('Import Ultimate Tag Warrior tags into the new native tagging structure.'), array($utw_import, 'dispatch'));
|
||||
|
||||
?>
|
||||
@@ -44,7 +44,7 @@ class WP_Import {
|
||||
|
||||
function users_form($n) {
|
||||
global $wpdb, $testing;
|
||||
$users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
|
||||
$users = $wpdb->get_results("SELECT user_login FROM $wpdb->users ORDER BY user_login");
|
||||
?><select name="userselect[<?php echo $n; ?>]">
|
||||
<option value="#NONE#">- Select -</option>
|
||||
<?php
|
||||
@@ -85,39 +85,52 @@ class WP_Import {
|
||||
|
||||
function get_entries() {
|
||||
set_magic_quotes_runtime(0);
|
||||
$importdata = array_map('rtrim', file($this->file)); // Read the file into an array
|
||||
|
||||
$this->posts = array();
|
||||
$this->categories = array();
|
||||
$this->tags = array();
|
||||
$num = 0;
|
||||
$doing_entry = false;
|
||||
foreach ($importdata as $importline) {
|
||||
if ( false !== strpos($importline, '<wp:category>') ) {
|
||||
preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category);
|
||||
$this->categories[] = $category[1];
|
||||
continue;
|
||||
}
|
||||
if ( false !== strpos($importline, '<item>') ) {
|
||||
$this->posts[$num] = '';
|
||||
$doing_entry = true;
|
||||
continue;
|
||||
}
|
||||
if ( false !== strpos($importline, '</item>') ) {
|
||||
$num++;
|
||||
$doing_entry = false;
|
||||
continue;
|
||||
}
|
||||
if ( $doing_entry ) {
|
||||
$this->posts[$num] .= $importline . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->posts as $post) {
|
||||
$post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
|
||||
if ($post_ID) {
|
||||
$this->posts_processed[$post_ID][0] = &$post;
|
||||
$this->posts_processed[$post_ID][1] = 0;
|
||||
$fp = fopen($this->file, 'r');
|
||||
if ($fp) {
|
||||
while ( !feof($fp) ) {
|
||||
$importline = rtrim(fgets($fp));
|
||||
|
||||
if ( false !== strpos($importline, '<wp:category>') ) {
|
||||
preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category);
|
||||
$this->categories[] = $category[1];
|
||||
continue;
|
||||
}
|
||||
if ( false !== strpos($importline, '<wp:tag>') ) {
|
||||
preg_match('|<wp:tag>(.*?)</wp:tag>|is', $importline, $tag);
|
||||
$this->tags[] = $tag[1];
|
||||
continue;
|
||||
}
|
||||
if ( false !== strpos($importline, '<item>') ) {
|
||||
$this->posts[$num] = '';
|
||||
$doing_entry = true;
|
||||
continue;
|
||||
}
|
||||
if ( false !== strpos($importline, '</item>') ) {
|
||||
$num++;
|
||||
$doing_entry = false;
|
||||
continue;
|
||||
}
|
||||
if ( $doing_entry ) {
|
||||
$this->posts[$num] .= $importline . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->posts as $post) {
|
||||
$post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
|
||||
if ($post_ID) {
|
||||
$this->posts_processed[$post_ID][0] = &$post;
|
||||
$this->posts_processed[$post_ID][1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +203,7 @@ class WP_Import {
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
echo '<input type="submit" value="Submit">'.'<br/>';
|
||||
echo '<input type="submit" value="Submit">'.'<br />';
|
||||
echo '</form>';
|
||||
echo '</ol>';
|
||||
|
||||
@@ -213,7 +226,7 @@ class WP_Import {
|
||||
function process_categories() {
|
||||
global $wpdb;
|
||||
|
||||
$cat_names = (array) $wpdb->get_col("SELECT cat_name FROM $wpdb->categories");
|
||||
$cat_names = (array) get_terms('category', 'fields=names');
|
||||
|
||||
while ( $c = array_shift($this->categories) ) {
|
||||
$cat_name = trim($this->get_tag( $c, 'wp:cat_name' ));
|
||||
@@ -239,12 +252,36 @@ class WP_Import {
|
||||
}
|
||||
}
|
||||
|
||||
function process_tags() {
|
||||
global $wpdb;
|
||||
|
||||
$tag_names = (array) get_terms('post_tag', 'fields=names');
|
||||
|
||||
while ( $c = array_shift($this->tags) ) {
|
||||
$tag_name = trim($this->get_tag( $c, 'wp:tag_name' ));
|
||||
|
||||
// If the category exists we leave it alone
|
||||
if ( in_array($tag_name, $tag_names) )
|
||||
continue;
|
||||
|
||||
$slug = $this->get_tag( $c, 'wp:tag_slug' );
|
||||
$description = $this->get_tag( $c, 'wp:tag_description' );
|
||||
|
||||
$tagarr = compact('slug', 'description');
|
||||
|
||||
$tag_ID = wp_insert_term($tag_name, 'post_tag', $tagarr);
|
||||
}
|
||||
}
|
||||
|
||||
function process_posts() {
|
||||
$i = -1;
|
||||
echo '<ol>';
|
||||
|
||||
foreach ($this->posts as $post)
|
||||
$this->process_post($post);
|
||||
foreach ($this->posts as $post) {
|
||||
$result = $this->process_post($post);
|
||||
if ( is_wp_error( $result ) )
|
||||
return $result;
|
||||
}
|
||||
|
||||
echo '</ol>';
|
||||
|
||||
@@ -252,14 +289,14 @@ class WP_Import {
|
||||
|
||||
echo '<h3>'.sprintf(__('All done.').' <a href="%s">'.__('Have fun!').'</a>', get_option('home')).'</h3>';
|
||||
}
|
||||
|
||||
|
||||
function process_post($post) {
|
||||
global $wpdb;
|
||||
|
||||
$post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
|
||||
if ( $post_ID && !empty($this->posts_processed[$post_ID][1]) ) // Processed already
|
||||
return 0;
|
||||
|
||||
|
||||
// There are only ever one of these
|
||||
$post_title = $this->get_tag( $post, 'title' );
|
||||
$post_date = $this->get_tag( $post, 'wp:post_date' );
|
||||
@@ -279,6 +316,15 @@ class WP_Import {
|
||||
$post_content = str_replace('<br>', '<br />', $post_content);
|
||||
$post_content = str_replace('<hr>', '<hr />', $post_content);
|
||||
|
||||
preg_match_all('|<category domain="tag">(.*?)</category>|is', $post, $tags);
|
||||
$tags = $tags[1];
|
||||
|
||||
$tag_index = 0;
|
||||
foreach ($tags as $tag) {
|
||||
$tags[$tag_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $tag)));
|
||||
$tag_index++;
|
||||
}
|
||||
|
||||
preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
|
||||
$categories = $categories[1];
|
||||
|
||||
@@ -296,7 +342,11 @@ class WP_Import {
|
||||
// If it has parent, process parent first.
|
||||
$post_parent = (int) $post_parent;
|
||||
if ($parent = $this->posts_processed[$post_parent]) {
|
||||
if (!$parent[1]) $this->process_post($parent[0]); // If not yet, process the parent first.
|
||||
if (!$parent[1]) {
|
||||
$result = $this->process_post($parent[0]); // If not yet, process the parent first.
|
||||
if ( is_wp_error( $result ) )
|
||||
return $result;
|
||||
}
|
||||
$post_parent = $parent[1]; // New ID of the parent;
|
||||
}
|
||||
|
||||
@@ -307,23 +357,49 @@ class WP_Import {
|
||||
|
||||
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'post_name', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt', 'guid', 'post_parent', 'menu_order', 'post_type');
|
||||
$comment_post_ID = $post_id = wp_insert_post($postdata);
|
||||
if ( is_wp_error( $post_id ) )
|
||||
return $post_id;
|
||||
|
||||
// Memorize old and new ID.
|
||||
if ( $post_id && $post_ID && $this->posts_processed[$post_ID] )
|
||||
$this->posts_processed[$post_ID][1] = $post_id; // New ID.
|
||||
|
||||
|
||||
// Add categories.
|
||||
if (count($categories) > 0) {
|
||||
$post_cats = array();
|
||||
foreach ($categories as $category) {
|
||||
$cat_ID = (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name = '$category'");
|
||||
$slug = sanitize_term_field('slug', $category, 0, 'category', 'db');
|
||||
$cat = get_term_by('slug', $slug, 'category');
|
||||
$cat_ID = 0;
|
||||
if ( ! empty($cat) )
|
||||
$cat_ID = $cat->term_id;
|
||||
if ($cat_ID == 0) {
|
||||
$category = $wpdb->escape($category);
|
||||
$cat_ID = wp_insert_category(array('cat_name' => $category));
|
||||
}
|
||||
$post_cats[] = $cat_ID;
|
||||
}
|
||||
wp_set_post_categories($post_id, $post_cats);
|
||||
}
|
||||
}
|
||||
|
||||
// Add tags.
|
||||
if (count($tags) > 0) {
|
||||
$post_tags = array();
|
||||
foreach ($tags as $tag) {
|
||||
$slug = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
|
||||
$tag_obj = get_term_by('slug', $slug, 'post_tag');
|
||||
$tag_id = 0;
|
||||
if ( ! empty($tag_obj) )
|
||||
$tag_id = $tag_obj->term_id;
|
||||
if ( $tag_id == 0 ) {
|
||||
$tag = $wpdb->escape($tag);
|
||||
$tag_id = wp_insert_term($tag, 'post_tag');
|
||||
$tag_id = $tag_id['term_id'];
|
||||
}
|
||||
$post_tags[] = $tag_id;
|
||||
}
|
||||
wp_set_post_tags($post_id, $post_tags);
|
||||
}
|
||||
}
|
||||
|
||||
// Now for comments
|
||||
@@ -370,7 +446,10 @@ class WP_Import {
|
||||
$this->get_authors_from_post();
|
||||
$this->get_entries();
|
||||
$this->process_categories();
|
||||
$this->process_posts();
|
||||
$this->process_tags();
|
||||
$result = $this->process_posts();
|
||||
if ( is_wp_error( $result ) )
|
||||
return $result;
|
||||
}
|
||||
|
||||
function dispatch() {
|
||||
@@ -390,7 +469,9 @@ class WP_Import {
|
||||
break;
|
||||
case 2:
|
||||
check_admin_referer('import-wordpress');
|
||||
$this->import();
|
||||
$result = $this->import();
|
||||
if ( is_wp_error( $result ) )
|
||||
echo $result->get_error_message();
|
||||
break;
|
||||
}
|
||||
$this->footer();
|
||||
|
||||
240
wp-admin/import/wp-cat2tag.php
Normal file
240
wp-admin/import/wp-cat2tag.php
Normal file
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
|
||||
class WP_Categories_to_Tags {
|
||||
var $categories_to_convert = array();
|
||||
var $all_categories = array();
|
||||
|
||||
function header() {
|
||||
print '<div class="wrap">';
|
||||
print '<h2>' . __('Convert Categories to Tags') . '</h2>';
|
||||
}
|
||||
|
||||
function footer() {
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
function populate_all_categories() {
|
||||
global $wpdb;
|
||||
|
||||
$categories = get_categories('get=all');
|
||||
foreach ( $categories as $category ) {
|
||||
if ( !tag_exists($wpdb->escape($category->name)) )
|
||||
$this->all_categories[] = $category;
|
||||
}
|
||||
}
|
||||
|
||||
function welcome() {
|
||||
$this->populate_all_categories();
|
||||
|
||||
print '<div class="narrow">';
|
||||
|
||||
if (count($this->all_categories) > 0) {
|
||||
print '<p>' . __('Howdy! This converter allows you to selectively convert existing categories to tags. To get started, check the checkboxes of the categories you wish to be converted, then click the Convert button.') . '</p>';
|
||||
print '<p>' . __('Keep in mind that if you convert a category with child categories, those child categories get their parent setting removed, so they\'re in the root.') . '</p>';
|
||||
|
||||
$this->categories_form();
|
||||
} else {
|
||||
print '<p>'.__('You have no categories to convert!').'</p>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
function categories_form() {
|
||||
print '<form action="admin.php?import=wp-cat2tag&step=2" method="post">';
|
||||
wp_nonce_field('import-cat2tag');
|
||||
print '<ul style="list-style:none">';
|
||||
|
||||
$hier = _get_term_hierarchy('category');
|
||||
|
||||
foreach ($this->all_categories as $category) {
|
||||
$category = sanitize_term( $category, 'category', 'display' );
|
||||
|
||||
if ((int) $category->parent == 0) {
|
||||
print '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($category->term_id) . '" /> ' . $category->name . ' (' . $category->count . ')</label>';
|
||||
|
||||
if (isset($hier[$category->term_id])) {
|
||||
$this->_category_children($category, $hier);
|
||||
}
|
||||
|
||||
print '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</ul>';
|
||||
|
||||
print '<p class="submit"><input type="submit" name="maybe_convert_all_cats" value="' . __('Convert All Categories') . '" /> <input type="submit" name="submit" value="' . __('Convert »') . '" /></p>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
function _category_children($parent, $hier) {
|
||||
print '<ul style="list-style:none">';
|
||||
|
||||
foreach ($hier[$parent->term_id] as $child_id) {
|
||||
$child =& get_category($child_id);
|
||||
|
||||
print '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($child->term_id) . '" /> ' . $child->name . ' (' . $child->count . ')</label>';
|
||||
|
||||
if (isset($hier[$child->term_id])) {
|
||||
$this->_category_children($child, $hier);
|
||||
}
|
||||
|
||||
print '</li>';
|
||||
}
|
||||
|
||||
print '</ul>';
|
||||
}
|
||||
|
||||
function _category_exists($cat_id) {
|
||||
global $wpdb;
|
||||
|
||||
$cat_id = (int) $cat_id;
|
||||
|
||||
$maybe_exists = category_exists($cat_id);
|
||||
|
||||
if ( $maybe_exists ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function convert_them() {
|
||||
global $wpdb;
|
||||
|
||||
if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) {
|
||||
print '<div class="narrow">';
|
||||
print '<p>' . sprintf(__('Uh, oh. Something didn\'t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag') . '</p>';
|
||||
print '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( empty($this->categories_to_convert) )
|
||||
$this->categories_to_convert = $_POST['cats_to_convert'];
|
||||
$hier = _get_term_hierarchy('category');
|
||||
|
||||
print '<ul>';
|
||||
|
||||
foreach ( (array) $this->categories_to_convert as $cat_id) {
|
||||
$cat_id = (int) $cat_id;
|
||||
|
||||
print '<li>' . sprintf(__('Converting category #%s ... '), $cat_id);
|
||||
|
||||
if (!$this->_category_exists($cat_id)) {
|
||||
_e('Category doesn\'t exist!');
|
||||
} else {
|
||||
$category =& get_category($cat_id);
|
||||
|
||||
if ( tag_exists($wpdb->escape($category->name)) ) {
|
||||
_e('Category is already a tag.');
|
||||
print '</li>';
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the category is the default, leave category in place and create tag.
|
||||
if ( get_option('default_category') == $category->term_id ) {
|
||||
$id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
|
||||
$id = $id['term_taxonomy_id'];
|
||||
$posts = get_objects_in_term($category->term_id, 'category');
|
||||
foreach ( $posts as $post ) {
|
||||
if ( !$wpdb->get_var("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = '$post' AND term_taxonomy_id = '$id'") )
|
||||
$wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post', '$id')");
|
||||
}
|
||||
} else {
|
||||
// Change the category to a tag.
|
||||
$wpdb->query("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
|
||||
|
||||
// Set all parents to 0 (root-level) if their parent was the converted tag
|
||||
$wpdb->query("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
|
||||
}
|
||||
// Clean the cache
|
||||
clean_category_cache($category->term_id);
|
||||
|
||||
_e('Converted successfully.');
|
||||
}
|
||||
|
||||
print '</li>';
|
||||
}
|
||||
|
||||
print '</ul>';
|
||||
}
|
||||
|
||||
function convert_all_confirm() {
|
||||
print '<div class="narrow">';
|
||||
|
||||
print '<h3>' . __('Confirm') . '</h3>';
|
||||
|
||||
print '<p>' . __('You are about to convert all categories to tags. Are you sure you want to continue?') . '</p>';
|
||||
|
||||
print '<form action="admin.php?import=wp-cat2tag" method="post">';
|
||||
wp_nonce_field('import-cat2tag');
|
||||
print '<p style="text-align:center" class="submit"><input type="submit" value="' . __('Yes') . '" name="yes_convert_all_cats" /> <input type="submit" value="' . __('No') . '" name="no_dont_do_it" /></p>';
|
||||
print '</form>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
function convert_all() {
|
||||
global $wpdb;
|
||||
|
||||
$this->populate_all_categories();
|
||||
foreach ( $this->all_categories as $category )
|
||||
$this->categories_to_convert[] = $category->term_id;
|
||||
$this->convert_them();
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
||||
if (isset($_POST['maybe_convert_all_cats'])) {
|
||||
$step = 3;
|
||||
} elseif (isset($_POST['yes_convert_all_cats'])) {
|
||||
$step = 4;
|
||||
} elseif (isset($_POST['no_dont_do_it'])) {
|
||||
die('no_dont_do_it');
|
||||
} else {
|
||||
$step = (isset($_GET['step'])) ? (int) $_GET['step'] : 1;
|
||||
}
|
||||
|
||||
$this->header();
|
||||
|
||||
if (!current_user_can('manage_categories')) {
|
||||
print '<div class="narrow">';
|
||||
print '<p>' . __('Cheatin’ uh?') . '</p>';
|
||||
print '</div>';
|
||||
} else {
|
||||
if ( $step > 1 )
|
||||
check_admin_referer('import-cat2tag');
|
||||
|
||||
switch ($step) {
|
||||
case 1 :
|
||||
$this->welcome();
|
||||
break;
|
||||
|
||||
case 2 :
|
||||
$this->convert_them();
|
||||
break;
|
||||
|
||||
case 3 :
|
||||
$this->convert_all_confirm();
|
||||
break;
|
||||
|
||||
case 4 :
|
||||
$this->convert_all();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function WP_Categories_to_Tags() {
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
$wp_cat2tag_importer = new WP_Categories_to_Tags();
|
||||
|
||||
register_importer('wp-cat2tag', __('Categories to Tags Converter'), __('Convert existing categories to tags, selectively.'), array(&$wp_cat2tag_importer, 'init'));
|
||||
|
||||
?>
|
||||
19
wp-admin/includes/admin.php
Normal file
19
wp-admin/includes/admin.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
require_once(ABSPATH . 'wp-admin/includes/bookmark.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/comment.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/file.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/import.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/misc.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/post.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/template.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/theme.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/user.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/update.php');
|
||||
|
||||
require_once(ABSPATH . WPINC . '/registration.php');
|
||||
|
||||
?>
|
||||
177
wp-admin/includes/bookmark.php
Normal file
177
wp-admin/includes/bookmark.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
function add_link() {
|
||||
return edit_link();
|
||||
}
|
||||
|
||||
function edit_link( $link_id = '' ) {
|
||||
if (!current_user_can( 'manage_links' ))
|
||||
wp_die( __( 'Cheatin’ uh?' ));
|
||||
|
||||
$_POST['link_url'] = wp_specialchars( $_POST['link_url'] );
|
||||
$_POST['link_url'] = clean_url($_POST['link_url']);
|
||||
$_POST['link_name'] = wp_specialchars( $_POST['link_name'] );
|
||||
$_POST['link_image'] = wp_specialchars( $_POST['link_image'] );
|
||||
$_POST['link_rss'] = clean_url($_POST['link_rss']);
|
||||
|
||||
if ( !empty( $link_id ) ) {
|
||||
$_POST['link_id'] = $link_id;
|
||||
return wp_update_link( $_POST);
|
||||
} else {
|
||||
return wp_insert_link( $_POST);
|
||||
}
|
||||
}
|
||||
|
||||
function get_default_link_to_edit() {
|
||||
if ( isset( $_GET['linkurl'] ) )
|
||||
$link->link_url = clean_url( $_GET['linkurl']);
|
||||
else
|
||||
$link->link_url = '';
|
||||
|
||||
if ( isset( $_GET['name'] ) )
|
||||
$link->link_name = attribute_escape( $_GET['name']);
|
||||
else
|
||||
$link->link_name = '';
|
||||
|
||||
$link->link_visible = 'Y';
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
function wp_delete_link($link_id) {
|
||||
global $wpdb;
|
||||
|
||||
do_action('delete_link', $link_id);
|
||||
|
||||
wp_delete_object_term_relationships($link_id, 'link_category');
|
||||
|
||||
$wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
|
||||
|
||||
do_action('deleted_link', $link_id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function wp_get_link_cats($link_id = 0) {
|
||||
|
||||
$cats = wp_get_object_terms($link_id, 'link_category', 'fields=ids');
|
||||
|
||||
return array_unique($cats);
|
||||
}
|
||||
|
||||
function get_link_to_edit( $link_id ) {
|
||||
return get_link( $link_id, OBJECT, 'edit' );
|
||||
}
|
||||
|
||||
function wp_insert_link($linkdata) {
|
||||
global $wpdb, $current_user;
|
||||
|
||||
$defaults = array('link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0 );
|
||||
|
||||
$linkdata = wp_parse_args($linkdata, $defaults);
|
||||
$linkdata = sanitize_bookmark($linkdata, 'db');
|
||||
|
||||
extract($linkdata, EXTR_SKIP);
|
||||
|
||||
$update = false;
|
||||
|
||||
if ( !empty($link_id) )
|
||||
$update = true;
|
||||
|
||||
if ( trim( $link_name ) == '' )
|
||||
return 0;
|
||||
|
||||
if ( trim( $link_url ) == '' )
|
||||
return 0;
|
||||
|
||||
if ( empty($link_rating) )
|
||||
$link_rating = 0;
|
||||
|
||||
if ( empty($link_image) )
|
||||
$link_image = '';
|
||||
|
||||
if ( empty($link_target) )
|
||||
$link_target = '';
|
||||
|
||||
if ( empty($link_visible) )
|
||||
$link_visible = 'Y';
|
||||
|
||||
if ( empty($link_owner) )
|
||||
$link_owner = $current_user->id;
|
||||
|
||||
if ( empty($link_notes) )
|
||||
$link_notes = '';
|
||||
|
||||
if ( empty($link_description) )
|
||||
$link_description = '';
|
||||
|
||||
if ( empty($link_rss) )
|
||||
$link_rss = '';
|
||||
|
||||
if ( empty($link_rel) )
|
||||
$link_rel = '';
|
||||
|
||||
// Make sure we set a valid category
|
||||
if (0 == count($link_category) || !is_array($link_category)) {
|
||||
$link_category = array(get_option('default_link_category'));
|
||||
}
|
||||
|
||||
if ( $update ) {
|
||||
$wpdb->query("UPDATE $wpdb->links SET link_url='$link_url',
|
||||
link_name='$link_name', link_image='$link_image',
|
||||
link_target='$link_target',
|
||||
link_visible='$link_visible', link_description='$link_description',
|
||||
link_rating='$link_rating', link_rel='$link_rel',
|
||||
link_notes='$link_notes', link_rss = '$link_rss'
|
||||
WHERE link_id='$link_id'");
|
||||
} else {
|
||||
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
|
||||
$link_id = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
wp_set_link_cats($link_id, $link_category);
|
||||
|
||||
if ( $update )
|
||||
do_action('edit_link', $link_id);
|
||||
else
|
||||
do_action('add_link', $link_id);
|
||||
|
||||
return $link_id;
|
||||
}
|
||||
|
||||
function wp_set_link_cats($link_id = 0, $link_categories = array()) {
|
||||
// If $link_categories isn't already an array, make it one:
|
||||
if (!is_array($link_categories) || 0 == count($link_categories))
|
||||
$link_categories = array(get_option('default_link_category'));
|
||||
|
||||
$link_categories = array_map('intval', $link_categories);
|
||||
$link_categories = array_unique($link_categories);
|
||||
|
||||
wp_set_object_terms($link_id, $link_categories, 'link_category');
|
||||
} // wp_set_link_cats()
|
||||
|
||||
function wp_update_link($linkdata) {
|
||||
global $wpdb;
|
||||
|
||||
$link_id = (int) $linkdata['link_id'];
|
||||
|
||||
$link = get_link($link_id, ARRAY_A);
|
||||
|
||||
// Escape data pulled from DB.
|
||||
$link = add_magic_quotes($link);
|
||||
|
||||
// Passed link category list overwrites existing category list if not empty.
|
||||
if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
|
||||
&& 0 != count($linkdata['link_category']) )
|
||||
$link_cats = $linkdata['link_category'];
|
||||
else
|
||||
$link_cats = $link['link_category'];
|
||||
|
||||
// Merge old and new fields with new fields overwriting old ones.
|
||||
$linkdata = array_merge($link, $linkdata);
|
||||
$linkdata['link_category'] = $link_cats;
|
||||
|
||||
return wp_insert_link($linkdata);
|
||||
}
|
||||
|
||||
?>
|
||||
68
wp-admin/includes/comment.php
Normal file
68
wp-admin/includes/comment.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
function comment_exists($comment_author, $comment_date) {
|
||||
global $wpdb;
|
||||
|
||||
return $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments
|
||||
WHERE comment_author = '$comment_author' AND comment_date = '$comment_date'");
|
||||
}
|
||||
|
||||
function edit_comment() {
|
||||
global $user_ID;
|
||||
|
||||
$comment_ID = (int) $_POST['comment_ID'];
|
||||
$comment_post_ID = (int) $_POST['comment_post_ID'];
|
||||
|
||||
if (!current_user_can( 'edit_post', $comment_post_ID ))
|
||||
wp_die( __('You are not allowed to edit comments on this post, so you cannot edit this comment.' ));
|
||||
|
||||
$_POST['comment_author'] = $_POST['newcomment_author'];
|
||||
$_POST['comment_author_email'] = $_POST['newcomment_author_email'];
|
||||
$_POST['comment_author_url'] = $_POST['newcomment_author_url'];
|
||||
$_POST['comment_approved'] = $_POST['comment_status'];
|
||||
$_POST['comment_content'] = $_POST['content'];
|
||||
$_POST['comment_ID'] = (int) $_POST['comment_ID'];
|
||||
|
||||
if (!empty ( $_POST['edit_date'] ) ) {
|
||||
$aa = $_POST['aa'];
|
||||
$mm = $_POST['mm'];
|
||||
$jj = $_POST['jj'];
|
||||
$hh = $_POST['hh'];
|
||||
$mn = $_POST['mn'];
|
||||
$ss = $_POST['ss'];
|
||||
$jj = ($jj > 31 ) ? 31 : $jj;
|
||||
$hh = ($hh > 23 ) ? $hh -24 : $hh;
|
||||
$mn = ($mn > 59 ) ? $mn -60 : $mn;
|
||||
$ss = ($ss > 59 ) ? $ss -60 : $ss;
|
||||
$_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
|
||||
}
|
||||
|
||||
wp_update_comment( $_POST);
|
||||
}
|
||||
|
||||
function get_comment_to_edit( $id ) {
|
||||
if ( !$comment = get_comment($id) )
|
||||
return false;
|
||||
|
||||
$comment->comment_ID = (int) $comment->comment_ID;
|
||||
$comment->comment_post_ID = (int) $comment->comment_post_ID;
|
||||
|
||||
$comment->comment_content = format_to_edit( $comment->comment_content );
|
||||
$comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content);
|
||||
|
||||
$comment->comment_author = format_to_edit( $comment->comment_author );
|
||||
$comment->comment_author_email = format_to_edit( $comment->comment_author_email );
|
||||
$comment->comment_author_url = clean_url($comment->comment_author_url);
|
||||
$comment->comment_author_url = format_to_edit( $comment->comment_author_url );
|
||||
|
||||
return $comment;
|
||||
}
|
||||
|
||||
function get_pending_comments_num( $post_id ) {
|
||||
global $wpdb;
|
||||
$post_id = (int) $post_id;
|
||||
$pending = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = $post_id AND comment_approved = '0'" );
|
||||
return $pending;
|
||||
}
|
||||
|
||||
?>
|
||||
189
wp-admin/includes/file.php
Normal file
189
wp-admin/includes/file.php
Normal file
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
|
||||
$wp_file_descriptions = array ('index.php' => __( 'Main Index Template' ), 'style.css' => __( 'Stylesheet' ), 'comments.php' => __( 'Comments' ), 'comments-popup.php' => __( 'Popup Comments' ), 'footer.php' => __( 'Footer' ), 'header.php' => __( 'Header' ), 'sidebar.php' => __( 'Sidebar' ), 'archive.php' => __( 'Archives' ), 'category.php' => __( 'Category Template' ), 'page.php' => __( 'Page Template' ), 'search.php' => __( 'Search Results' ), 'single.php' => __( 'Single Post' ), '404.php' => __( '404 Template' ), 'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ), '.htaccess' => __( '.htaccess (for rewrite rules )' ),
|
||||
// Deprecated files
|
||||
'wp-layout.css' => __( 'Stylesheet' ), 'wp-comments.php' => __( 'Comments Template' ), 'wp-comments-popup.php' => __( 'Popup Comments Template' ));
|
||||
function get_file_description( $file ) {
|
||||
global $wp_file_descriptions;
|
||||
|
||||
if ( isset( $wp_file_descriptions[basename( $file )] ) ) {
|
||||
return $wp_file_descriptions[basename( $file )];
|
||||
}
|
||||
elseif ( file_exists( ABSPATH . $file ) && is_file( ABSPATH . $file ) ) {
|
||||
$template_data = implode( '', file( ABSPATH . $file ) );
|
||||
if ( preg_match( "|Template Name:(.*)|i", $template_data, $name ))
|
||||
return $name[1];
|
||||
}
|
||||
|
||||
return basename( $file );
|
||||
}
|
||||
|
||||
function get_home_path() {
|
||||
$home = get_option( 'home' );
|
||||
if ( $home != '' && $home != get_option( 'siteurl' ) ) {
|
||||
$home_path = parse_url( $home );
|
||||
$home_path = $home_path['path'];
|
||||
$root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] );
|
||||
$home_path = trailingslashit( $root.$home_path );
|
||||
} else {
|
||||
$home_path = ABSPATH;
|
||||
}
|
||||
|
||||
return $home_path;
|
||||
}
|
||||
|
||||
function get_real_file_to_edit( $file ) {
|
||||
if ('index.php' == $file || '.htaccess' == $file ) {
|
||||
$real_file = get_home_path().$file;
|
||||
} else {
|
||||
$real_file = ABSPATH.$file;
|
||||
}
|
||||
|
||||
return $real_file;
|
||||
}
|
||||
|
||||
function validate_file( $file, $allowed_files = '' ) {
|
||||
if ( false !== strpos( $file, './' ))
|
||||
return 1;
|
||||
|
||||
if (':' == substr( $file, 1, 1 ))
|
||||
return 2;
|
||||
|
||||
if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) )
|
||||
return 3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function validate_file_to_edit( $file, $allowed_files = '' ) {
|
||||
$file = stripslashes( $file );
|
||||
|
||||
$code = validate_file( $file, $allowed_files );
|
||||
|
||||
if (!$code )
|
||||
return $file;
|
||||
|
||||
switch ( $code ) {
|
||||
case 1 :
|
||||
wp_die( __('Sorry, can’t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' ));
|
||||
|
||||
case 2 :
|
||||
wp_die( __('Sorry, can’t call files with their real path.' ));
|
||||
|
||||
case 3 :
|
||||
wp_die( __('Sorry, that file cannot be edited.' ));
|
||||
}
|
||||
}
|
||||
|
||||
// array wp_handle_upload ( array &file [, array overrides] )
|
||||
// file: reference to a single element of $_FILES. Call the function once for each uploaded file.
|
||||
// overrides: an associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
|
||||
// On success, returns an associative array of file attributes.
|
||||
// On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
|
||||
function wp_handle_upload( &$file, $overrides = false ) {
|
||||
// The default error handler.
|
||||
if (! function_exists( 'wp_handle_upload_error' ) ) {
|
||||
function wp_handle_upload_error( &$file, $message ) {
|
||||
return array( 'error'=>$message );
|
||||
}
|
||||
}
|
||||
|
||||
// You may define your own function and pass the name in $overrides['upload_error_handler']
|
||||
$upload_error_handler = 'wp_handle_upload_error';
|
||||
|
||||
// $_POST['action'] must be set and its value must equal $overrides['action'] or this:
|
||||
$action = 'wp_handle_upload';
|
||||
|
||||
// Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
|
||||
$upload_error_strings = array( false,
|
||||
__( "The uploaded file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ),
|
||||
__( "The uploaded file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ),
|
||||
__( "The uploaded file was only partially uploaded." ),
|
||||
__( "No file was uploaded." ),
|
||||
__( "Missing a temporary folder." ),
|
||||
__( "Failed to write file to disk." ));
|
||||
|
||||
// All tests are on by default. Most can be turned off by $override[{test_name}] = false;
|
||||
$test_form = true;
|
||||
$test_size = true;
|
||||
|
||||
// If you override this, you must provide $ext and $type!!!!
|
||||
$test_type = true;
|
||||
|
||||
// Install user overrides. Did we mention that this voids your warranty?
|
||||
if ( is_array( $overrides ) )
|
||||
extract( $overrides, EXTR_OVERWRITE );
|
||||
|
||||
// A correct form post will pass this test.
|
||||
if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) )
|
||||
return $upload_error_handler( $file, __( 'Invalid form submission.' ));
|
||||
|
||||
// A successful upload will pass this test. It makes no sense to override this one.
|
||||
if ( $file['error'] > 0 )
|
||||
return $upload_error_handler( $file, $upload_error_strings[$file['error']] );
|
||||
|
||||
// A non-empty file will pass this test.
|
||||
if ( $test_size && !($file['size'] > 0 ) )
|
||||
return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' ));
|
||||
|
||||
// A properly uploaded file will pass this test. There should be no reason to override this one.
|
||||
if (! @ is_uploaded_file( $file['tmp_name'] ) )
|
||||
return $upload_error_handler( $file, __( 'Specified file failed upload test.' ));
|
||||
|
||||
// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
|
||||
if ( $test_type ) {
|
||||
$wp_filetype = wp_check_filetype( $file['name'], $mimes );
|
||||
|
||||
extract( $wp_filetype );
|
||||
|
||||
if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
|
||||
return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
|
||||
|
||||
if ( !$ext )
|
||||
$ext = ltrim(strrchr($file['name'], '.'), '.');
|
||||
}
|
||||
|
||||
// A writable uploads dir will pass this test. Again, there's no point overriding this one.
|
||||
if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
|
||||
return $upload_error_handler( $file, $uploads['error'] );
|
||||
|
||||
// Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied.
|
||||
if ( isset( $unique_filename_callback ) && function_exists( $unique_filename_callback ) ) {
|
||||
$filename = $unique_filename_callback( $uploads['path'], $file['name'] );
|
||||
} else {
|
||||
$number = '';
|
||||
$filename = str_replace( '#', '_', $file['name'] );
|
||||
$filename = str_replace( array( '\\', "'" ), '', $filename );
|
||||
if ( empty( $ext) )
|
||||
$ext = '';
|
||||
else
|
||||
$ext = ".$ext";
|
||||
while ( file_exists( $uploads['path'] . "/$filename" ) ) {
|
||||
if ( '' == "$number$ext" )
|
||||
$filename = $filename . ++$number . $ext;
|
||||
else
|
||||
$filename = str_replace( "$number$ext", ++$number . $ext, $filename );
|
||||
}
|
||||
$filename = str_replace( $ext, '', $filename );
|
||||
$filename = sanitize_title_with_dashes( $filename ) . $ext;
|
||||
}
|
||||
|
||||
// Move the file to the uploads dir
|
||||
$new_file = $uploads['path'] . "/$filename";
|
||||
if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) )
|
||||
wp_die( printf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ));
|
||||
|
||||
// Set correct file permissions
|
||||
$stat = stat( dirname( $new_file ));
|
||||
$perms = $stat['mode'] & 0000666;
|
||||
@ chmod( $new_file, $perms );
|
||||
|
||||
// Compute the URL
|
||||
$url = $uploads['url'] . "/$filename";
|
||||
|
||||
$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
?>
|
||||
192
wp-admin/includes/image.php
Normal file
192
wp-admin/includes/image.php
Normal file
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
function get_udims( $width, $height) {
|
||||
if ( $height <= 96 && $width <= 128 )
|
||||
return array( $width, $height);
|
||||
elseif ( $width / $height > 4 / 3 )
|
||||
return array( 128, (int) ($height / $width * 128 ));
|
||||
else
|
||||
return array( (int) ($width / $height * 96 ), 96 );
|
||||
}
|
||||
|
||||
function wp_create_thumbnail( $file, $max_side, $effect = '' ) {
|
||||
|
||||
// 1 = GIF, 2 = JPEG, 3 = PNG
|
||||
|
||||
if ( file_exists( $file ) ) {
|
||||
$type = getimagesize( $file );
|
||||
|
||||
// if the associated function doesn't exist - then it's not
|
||||
// handle. duh. i hope.
|
||||
|
||||
if (!function_exists( 'imagegif' ) && $type[2] == 1 ) {
|
||||
$error = __( 'Filetype not supported. Thumbnail not created.' );
|
||||
}
|
||||
elseif (!function_exists( 'imagejpeg' ) && $type[2] == 2 ) {
|
||||
$error = __( 'Filetype not supported. Thumbnail not created.' );
|
||||
}
|
||||
elseif (!function_exists( 'imagepng' ) && $type[2] == 3 ) {
|
||||
$error = __( 'Filetype not supported. Thumbnail not created.' );
|
||||
} else {
|
||||
|
||||
// create the initial copy from the original file
|
||||
if ( $type[2] == 1 ) {
|
||||
$image = imagecreatefromgif( $file );
|
||||
}
|
||||
elseif ( $type[2] == 2 ) {
|
||||
$image = imagecreatefromjpeg( $file );
|
||||
}
|
||||
elseif ( $type[2] == 3 ) {
|
||||
$image = imagecreatefrompng( $file );
|
||||
}
|
||||
|
||||
if ( function_exists( 'imageantialias' ))
|
||||
imageantialias( $image, TRUE );
|
||||
|
||||
$image_attr = getimagesize( $file );
|
||||
|
||||
// figure out the longest side
|
||||
|
||||
if ( $image_attr[0] > $image_attr[1] ) {
|
||||
$image_width = $image_attr[0];
|
||||
$image_height = $image_attr[1];
|
||||
$image_new_width = $max_side;
|
||||
|
||||
$image_ratio = $image_width / $image_new_width;
|
||||
$image_new_height = $image_height / $image_ratio;
|
||||
//width is > height
|
||||
} else {
|
||||
$image_width = $image_attr[0];
|
||||
$image_height = $image_attr[1];
|
||||
$image_new_height = $max_side;
|
||||
|
||||
$image_ratio = $image_height / $image_new_height;
|
||||
$image_new_width = $image_width / $image_ratio;
|
||||
//height > width
|
||||
}
|
||||
|
||||
$thumbnail = imagecreatetruecolor( $image_new_width, $image_new_height);
|
||||
@ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1] );
|
||||
|
||||
// If no filters change the filename, we'll do a default transformation.
|
||||
if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) )
|
||||
$thumb = preg_replace( '!(\.[^.]+)?$!', '.thumbnail' . '$1', basename( $file ), 1 );
|
||||
|
||||
$thumbpath = str_replace( basename( $file ), $thumb, $file );
|
||||
|
||||
// move the thumbnail to its final destination
|
||||
if ( $type[2] == 1 ) {
|
||||
if (!imagegif( $thumbnail, $thumbpath ) ) {
|
||||
$error = __( "Thumbnail path invalid" );
|
||||
}
|
||||
}
|
||||
elseif ( $type[2] == 2 ) {
|
||||
if (!imagejpeg( $thumbnail, $thumbpath ) ) {
|
||||
$error = __( "Thumbnail path invalid" );
|
||||
}
|
||||
}
|
||||
elseif ( $type[2] == 3 ) {
|
||||
if (!imagepng( $thumbnail, $thumbpath ) ) {
|
||||
$error = __( "Thumbnail path invalid" );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$error = __( 'File not found' );
|
||||
}
|
||||
|
||||
if (!empty ( $error ) ) {
|
||||
return $error;
|
||||
} else {
|
||||
return apply_filters( 'wp_create_thumbnail', $thumbpath );
|
||||
}
|
||||
}
|
||||
|
||||
function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
|
||||
if ( ctype_digit( $src_file ) ) // Handle int as attachment ID
|
||||
$src_file = get_attached_file( $src_file );
|
||||
|
||||
$src = wp_load_image( $src_file );
|
||||
|
||||
if ( !is_resource( $src ))
|
||||
return $src;
|
||||
|
||||
$dst = imagecreatetruecolor( $dst_w, $dst_h );
|
||||
|
||||
if ( $src_abs ) {
|
||||
$src_w -= $src_x;
|
||||
$src_h -= $src_y;
|
||||
}
|
||||
|
||||
if (function_exists('imageantialias'))
|
||||
imageantialias( $dst, true );
|
||||
|
||||
imagecopyresampled( $dst, $src, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
|
||||
|
||||
if ( !$dst_file )
|
||||
$dst_file = str_replace( basename( $src_file ), 'cropped-'.basename( $src_file ), $src_file );
|
||||
|
||||
$dst_file = preg_replace( '/\\.[^\\.]+$/', '.jpg', $dst_file );
|
||||
|
||||
if ( imagejpeg( $dst, $dst_file ) )
|
||||
return $dst_file;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function wp_generate_attachment_metadata( $attachment_id, $file ) {
|
||||
$attachment = get_post( $attachment_id );
|
||||
|
||||
$metadata = array();
|
||||
if ( preg_match('!^image/!', get_post_mime_type( $attachment )) ) {
|
||||
$imagesize = getimagesize($file);
|
||||
$metadata['width'] = $imagesize['0'];
|
||||
$metadata['height'] = $imagesize['1'];
|
||||
list($uwidth, $uheight) = get_udims($metadata['width'], $metadata['height']);
|
||||
$metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";
|
||||
$metadata['file'] = $file;
|
||||
|
||||
$max = apply_filters( 'wp_thumbnail_creation_size_limit', 3 * 1024 * 1024, $attachment_id, $file );
|
||||
|
||||
if ( $max < 0 || $metadata['width'] * $metadata['height'] < $max ) {
|
||||
$max_side = apply_filters( 'wp_thumbnail_max_side_length', 128, $attachment_id, $file );
|
||||
$thumb = wp_create_thumbnail( $file, $max_side );
|
||||
|
||||
if ( @file_exists($thumb) )
|
||||
$metadata['thumb'] = basename($thumb);
|
||||
}
|
||||
}
|
||||
return apply_filters( 'wp_generate_attachment_metadata', $metadata );
|
||||
}
|
||||
|
||||
function wp_load_image( $file ) {
|
||||
if ( ctype_digit( $file ) )
|
||||
$file = get_attached_file( $file );
|
||||
|
||||
if ( !file_exists( $file ) )
|
||||
return sprintf(__("File '%s' doesn't exist?"), $file);
|
||||
|
||||
if ( ! function_exists('imagecreatefromstring') )
|
||||
return __('The GD image library is not installed.');
|
||||
|
||||
$contents = file_get_contents( $file );
|
||||
|
||||
$image = imagecreatefromstring( $contents );
|
||||
|
||||
if ( !is_resource( $image ) )
|
||||
return sprintf(__("File '%s' is not an image."), $file);
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
|
||||
if ( $height <= $hmax && $width <= $wmax )
|
||||
return array( $width, $height);
|
||||
elseif ( $width / $height > $wmax / $hmax )
|
||||
return array( $wmax, (int) ($height / $width * $wmax ));
|
||||
else
|
||||
return array( (int) ($width / $height * $hmax ), $hmax );
|
||||
}
|
||||
|
||||
?>
|
||||
45
wp-admin/includes/import.php
Normal file
45
wp-admin/includes/import.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
function get_importers() {
|
||||
global $wp_importers;
|
||||
uasort($wp_importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);'));
|
||||
return $wp_importers;
|
||||
}
|
||||
|
||||
function register_importer( $id, $name, $description, $callback ) {
|
||||
global $wp_importers;
|
||||
if ( is_wp_error( $callback ) )
|
||||
return $callback;
|
||||
$wp_importers[$id] = array ( $name, $description, $callback );
|
||||
}
|
||||
|
||||
function wp_import_cleanup( $id ) {
|
||||
wp_delete_attachment( $id );
|
||||
}
|
||||
|
||||
function wp_import_handle_upload() {
|
||||
$overrides = array( 'test_form' => false, 'test_type' => false );
|
||||
$file = wp_handle_upload( $_FILES['import'], $overrides );
|
||||
|
||||
if ( isset( $file['error'] ) )
|
||||
return $file;
|
||||
|
||||
$url = $file['url'];
|
||||
$type = $file['type'];
|
||||
$file = addslashes( $file['file'] );
|
||||
$filename = basename( $file );
|
||||
|
||||
// Construct the object array
|
||||
$object = array( 'post_title' => $filename,
|
||||
'post_content' => $url,
|
||||
'post_mime_type' => $type,
|
||||
'guid' => $url
|
||||
);
|
||||
|
||||
// Save the data
|
||||
$id = wp_insert_attachment( $object, $file );
|
||||
|
||||
return array( 'file' => $file, 'id' => $id );
|
||||
}
|
||||
|
||||
?>
|
||||
177
wp-admin/includes/misc.php
Normal file
177
wp-admin/includes/misc.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
function got_mod_rewrite() {
|
||||
global $is_apache;
|
||||
|
||||
// take 3 educated guesses as to whether or not mod_rewrite is available
|
||||
if ( !$is_apache )
|
||||
return false;
|
||||
|
||||
if ( function_exists( 'apache_get_modules' ) ) {
|
||||
if ( !in_array( 'mod_rewrite', apache_get_modules() ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns an array of strings from a file (.htaccess ) from between BEGIN
|
||||
// and END markers.
|
||||
function extract_from_markers( $filename, $marker ) {
|
||||
$result = array ();
|
||||
|
||||
if (!file_exists( $filename ) ) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ( $markerdata = explode( "\n", implode( '', file( $filename ) ) ));
|
||||
{
|
||||
$state = false;
|
||||
foreach ( $markerdata as $markerline ) {
|
||||
if (strpos($markerline, '# END ' . $marker) !== false)
|
||||
$state = false;
|
||||
if ( $state )
|
||||
$result[] = $markerline;
|
||||
if (strpos($markerline, '# BEGIN ' . $marker) !== false)
|
||||
$state = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Inserts an array of strings into a file (.htaccess ), placing it between
|
||||
// BEGIN and END markers. Replaces existing marked info. Retains surrounding
|
||||
// data. Creates file if none exists.
|
||||
// Returns true on write success, false on failure.
|
||||
function insert_with_markers( $filename, $marker, $insertion ) {
|
||||
if (!file_exists( $filename ) || is_writeable( $filename ) ) {
|
||||
if (!file_exists( $filename ) ) {
|
||||
$markerdata = '';
|
||||
} else {
|
||||
$markerdata = explode( "\n", implode( '', file( $filename ) ) );
|
||||
}
|
||||
|
||||
$f = fopen( $filename, 'w' );
|
||||
$foundit = false;
|
||||
if ( $markerdata ) {
|
||||
$state = true;
|
||||
foreach ( $markerdata as $n => $markerline ) {
|
||||
if (strpos($markerline, '# BEGIN ' . $marker) !== false)
|
||||
$state = false;
|
||||
if ( $state ) {
|
||||
if ( $n + 1 < count( $markerdata ) )
|
||||
fwrite( $f, "{$markerline}\n" );
|
||||
else
|
||||
fwrite( $f, "{$markerline}" );
|
||||
}
|
||||
if (strpos($markerline, '# END ' . $marker) !== false) {
|
||||
fwrite( $f, "# BEGIN {$marker}\n" );
|
||||
if ( is_array( $insertion ))
|
||||
foreach ( $insertion as $insertline )
|
||||
fwrite( $f, "{$insertline}\n" );
|
||||
fwrite( $f, "# END {$marker}\n" );
|
||||
$state = true;
|
||||
$foundit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$foundit) {
|
||||
fwrite( $f, "# BEGIN {$marker}\n" );
|
||||
foreach ( $insertion as $insertline )
|
||||
fwrite( $f, "{$insertline}\n" );
|
||||
fwrite( $f, "# END {$marker}\n" );
|
||||
}
|
||||
fclose( $f );
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the htaccess file with the current rules if it is writable.
|
||||
*
|
||||
* Always writes to the file if it exists and is writable to ensure that we blank out old rules.
|
||||
*/
|
||||
|
||||
function save_mod_rewrite_rules() {
|
||||
global $wp_rewrite;
|
||||
|
||||
$home_path = get_home_path();
|
||||
$htaccess_file = $home_path.'.htaccess';
|
||||
|
||||
// If the file doesn't already exists check for write access to the directory and whether of not we have some rules.
|
||||
// else check for write access to the file.
|
||||
if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
|
||||
if ( got_mod_rewrite() ) {
|
||||
$rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );
|
||||
return insert_with_markers( $htaccess_file, 'WordPress', $rules );
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function update_recently_edited( $file ) {
|
||||
$oldfiles = (array ) get_option( 'recently_edited' );
|
||||
if ( $oldfiles ) {
|
||||
$oldfiles = array_reverse( $oldfiles );
|
||||
$oldfiles[] = $file;
|
||||
$oldfiles = array_reverse( $oldfiles );
|
||||
$oldfiles = array_unique( $oldfiles );
|
||||
if ( 5 < count( $oldfiles ))
|
||||
array_pop( $oldfiles );
|
||||
} else {
|
||||
$oldfiles[] = $file;
|
||||
}
|
||||
update_option( 'recently_edited', $oldfiles );
|
||||
}
|
||||
|
||||
// If siteurl or home changed, reset cookies and flush rewrite rules.
|
||||
function update_home_siteurl( $old_value, $value ) {
|
||||
global $wp_rewrite, $user_login, $user_pass_md5;
|
||||
|
||||
if ( defined( "WP_INSTALLING" ) )
|
||||
return;
|
||||
|
||||
// If home changed, write rewrite rules to new location.
|
||||
$wp_rewrite->flush_rules();
|
||||
// Clear cookies for old paths.
|
||||
wp_clearcookie();
|
||||
// Set cookies for new paths.
|
||||
wp_setcookie( $user_login, $user_pass_md5, true, get_option( 'home' ), get_option( 'siteurl' ));
|
||||
}
|
||||
|
||||
add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
|
||||
add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
|
||||
|
||||
function url_shorten( $url ) {
|
||||
$short_url = str_replace( 'http://', '', stripslashes( $url ));
|
||||
$short_url = str_replace( 'www.', '', $short_url );
|
||||
if ('/' == substr( $short_url, -1 ))
|
||||
$short_url = substr( $short_url, 0, -1 );
|
||||
if ( strlen( $short_url ) > 35 )
|
||||
$short_url = substr( $short_url, 0, 32 ).'...';
|
||||
return $short_url;
|
||||
}
|
||||
|
||||
function wp_reset_vars( $vars ) {
|
||||
for ( $i=0; $i<count( $vars ); $i += 1 ) {
|
||||
$var = $vars[$i];
|
||||
global $$var;
|
||||
|
||||
if (!isset( $$var ) ) {
|
||||
if ( empty( $_POST["$var"] ) ) {
|
||||
if ( empty( $_GET["$var"] ) )
|
||||
$$var = '';
|
||||
else
|
||||
$$var = $_GET["$var"];
|
||||
} else {
|
||||
$$var = $_POST["$var"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
382
wp-admin/includes/plugin.php
Normal file
382
wp-admin/includes/plugin.php
Normal file
@@ -0,0 +1,382 @@
|
||||
<?php
|
||||
|
||||
function get_plugin_data( $plugin_file ) {
|
||||
$plugin_data = implode( '', file( $plugin_file ));
|
||||
preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $plugin_name );
|
||||
preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $plugin_uri );
|
||||
preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
|
||||
preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name );
|
||||
preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
|
||||
|
||||
if ( preg_match( "|Version:(.*)|i", $plugin_data, $version ))
|
||||
$version = trim( $version[1] );
|
||||
else
|
||||
$version = '';
|
||||
|
||||
$description = wptexturize( trim( $description[1] ));
|
||||
|
||||
$name = $plugin_name[1];
|
||||
$name = trim( $name );
|
||||
$plugin = $name;
|
||||
if ('' != trim($plugin_uri[1]) && '' != $name ) {
|
||||
$plugin = '<a href="' . trim( $plugin_uri[1] ) . '" title="'.__( 'Visit plugin homepage' ).'">'.$plugin.'</a>';
|
||||
}
|
||||
|
||||
if ('' == $author_uri[1] ) {
|
||||
$author = trim( $author_name[1] );
|
||||
} else {
|
||||
$author = '<a href="' . trim( $author_uri[1] ) . '" title="'.__( 'Visit author homepage' ).'">' . trim( $author_name[1] ) . '</a>';
|
||||
}
|
||||
|
||||
return array('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version);
|
||||
}
|
||||
|
||||
function get_plugins() {
|
||||
global $wp_plugins;
|
||||
|
||||
if ( isset( $wp_plugins ) ) {
|
||||
return $wp_plugins;
|
||||
}
|
||||
|
||||
$wp_plugins = array ();
|
||||
$plugin_root = ABSPATH . PLUGINDIR;
|
||||
|
||||
// Files in wp-content/plugins directory
|
||||
$plugins_dir = @ opendir( $plugin_root);
|
||||
if ( $plugins_dir ) {
|
||||
while (($file = readdir( $plugins_dir ) ) !== false ) {
|
||||
if ( substr($file, 0, 1) == '.' )
|
||||
continue;
|
||||
if ( is_dir( $plugin_root.'/'.$file ) ) {
|
||||
$plugins_subdir = @ opendir( $plugin_root.'/'.$file );
|
||||
if ( $plugins_subdir ) {
|
||||
while (($subfile = readdir( $plugins_subdir ) ) !== false ) {
|
||||
if ( substr($subfile, 0, 1) == '.' )
|
||||
continue;
|
||||
if ( substr($subfile, -4) == '.php' )
|
||||
$plugin_files[] = "$file/$subfile";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( substr($file, -4) == '.php' )
|
||||
$plugin_files[] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
@closedir( $plugins_dir );
|
||||
@closedir( $plugins_subdir );
|
||||
|
||||
if ( !$plugins_dir || !$plugin_files )
|
||||
return $wp_plugins;
|
||||
|
||||
foreach ( $plugin_files as $plugin_file ) {
|
||||
if ( !is_readable( "$plugin_root/$plugin_file" ) )
|
||||
continue;
|
||||
|
||||
$plugin_data = get_plugin_data( "$plugin_root/$plugin_file" );
|
||||
|
||||
if ( empty ( $plugin_data['Name'] ) )
|
||||
continue;
|
||||
|
||||
$wp_plugins[plugin_basename( $plugin_file )] = $plugin_data;
|
||||
}
|
||||
|
||||
uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
|
||||
|
||||
return $wp_plugins;
|
||||
}
|
||||
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
function add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
|
||||
global $menu, $admin_page_hooks;
|
||||
|
||||
$file = plugin_basename( $file );
|
||||
|
||||
$menu[] = array ( $menu_title, $access_level, $file, $page_title );
|
||||
|
||||
$admin_page_hooks[$file] = sanitize_title( $menu_title );
|
||||
|
||||
$hookname = get_plugin_page_hookname( $file, '' );
|
||||
if (!empty ( $function ) && !empty ( $hookname ))
|
||||
add_action( $hookname, $function );
|
||||
|
||||
return $hookname;
|
||||
}
|
||||
|
||||
function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function = '' ) {
|
||||
global $submenu;
|
||||
global $menu;
|
||||
global $_wp_real_parent_file;
|
||||
global $_wp_submenu_nopriv;
|
||||
global $_wp_menu_nopriv;
|
||||
|
||||
$file = plugin_basename( $file );
|
||||
|
||||
$parent = plugin_basename( $parent);
|
||||
if ( isset( $_wp_real_parent_file[$parent] ) )
|
||||
$parent = $_wp_real_parent_file[$parent];
|
||||
|
||||
if ( !current_user_can( $access_level ) ) {
|
||||
$_wp_submenu_nopriv[$parent][$file] = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the parent doesn't already have a submenu, add a link to the parent
|
||||
// as the first item in the submenu. If the submenu file is the same as the
|
||||
// parent file someone is trying to link back to the parent manually. In
|
||||
// this case, don't automatically add a link back to avoid duplication.
|
||||
if (!isset( $submenu[$parent] ) && $file != $parent ) {
|
||||
foreach ( $menu as $parent_menu ) {
|
||||
if ( $parent_menu[2] == $parent && current_user_can( $parent_menu[1] ) )
|
||||
$submenu[$parent][] = $parent_menu;
|
||||
}
|
||||
}
|
||||
|
||||
$submenu[$parent][] = array ( $menu_title, $access_level, $file, $page_title );
|
||||
|
||||
$hookname = get_plugin_page_hookname( $file, $parent);
|
||||
if (!empty ( $function ) && !empty ( $hookname ))
|
||||
add_action( $hookname, $function );
|
||||
|
||||
return $hookname;
|
||||
}
|
||||
|
||||
function add_management_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
|
||||
return add_submenu_page( 'edit.php', $page_title, $menu_title, $access_level, $file, $function );
|
||||
}
|
||||
|
||||
function add_options_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
|
||||
return add_submenu_page( 'options-general.php', $page_title, $menu_title, $access_level, $file, $function );
|
||||
}
|
||||
|
||||
function add_theme_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
|
||||
return add_submenu_page( 'themes.php', $page_title, $menu_title, $access_level, $file, $function );
|
||||
}
|
||||
|
||||
function add_users_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
|
||||
if ( current_user_can('edit_users') )
|
||||
$parent = 'users.php';
|
||||
else
|
||||
$parent = 'profile.php';
|
||||
return add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function );
|
||||
}
|
||||
|
||||
//
|
||||
// Pluggable Menu Support -- Private
|
||||
//
|
||||
|
||||
function get_admin_page_parent() {
|
||||
global $parent_file;
|
||||
global $menu;
|
||||
global $submenu;
|
||||
global $pagenow;
|
||||
global $plugin_page;
|
||||
global $_wp_real_parent_file;
|
||||
global $_wp_menu_nopriv;
|
||||
global $_wp_submenu_nopriv;
|
||||
|
||||
if ( !empty ( $parent_file ) ) {
|
||||
if ( isset( $_wp_real_parent_file[$parent_file] ) )
|
||||
$parent_file = $_wp_real_parent_file[$parent_file];
|
||||
|
||||
return $parent_file;
|
||||
}
|
||||
|
||||
if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) {
|
||||
foreach ( $menu as $parent_menu ) {
|
||||
if ( $parent_menu[2] == $plugin_page ) {
|
||||
$parent_file = $plugin_page;
|
||||
if ( isset( $_wp_real_parent_file[$parent_file] ) )
|
||||
$parent_file = $_wp_real_parent_file[$parent_file];
|
||||
return $parent_file;
|
||||
}
|
||||
}
|
||||
if ( isset( $_wp_menu_nopriv[$plugin_page] ) ) {
|
||||
$parent_file = $plugin_page;
|
||||
if ( isset( $_wp_real_parent_file[$parent_file] ) )
|
||||
$parent_file = $_wp_real_parent_file[$parent_file];
|
||||
return $parent_file;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) {
|
||||
$parent_file = $pagenow;
|
||||
if ( isset( $_wp_real_parent_file[$parent_file] ) )
|
||||
$parent_file = $_wp_real_parent_file[$parent_file];
|
||||
return $parent_file;
|
||||
}
|
||||
|
||||
foreach (array_keys( $submenu ) as $parent) {
|
||||
foreach ( $submenu[$parent] as $submenu_array ) {
|
||||
if ( isset( $_wp_real_parent_file[$parent] ) )
|
||||
$parent = $_wp_real_parent_file[$parent];
|
||||
if ( $submenu_array[2] == $pagenow ) {
|
||||
$parent_file = $parent;
|
||||
return $parent;
|
||||
} else
|
||||
if ( isset( $plugin_page ) && ($plugin_page == $submenu_array[2] ) ) {
|
||||
$parent_file = $parent;
|
||||
return $parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$parent_file = '';
|
||||
return '';
|
||||
}
|
||||
|
||||
function get_admin_page_title() {
|
||||
global $title;
|
||||
global $menu;
|
||||
global $submenu;
|
||||
global $pagenow;
|
||||
global $plugin_page;
|
||||
|
||||
if ( isset( $title ) && !empty ( $title ) ) {
|
||||
return $title;
|
||||
}
|
||||
|
||||
$hook = get_plugin_page_hook( $plugin_page, $pagenow );
|
||||
|
||||
$parent = $parent1 = get_admin_page_parent();
|
||||
if ( empty ( $parent) ) {
|
||||
foreach ( $menu as $menu_array ) {
|
||||
if ( isset( $menu_array[3] ) ) {
|
||||
if ( $menu_array[2] == $pagenow ) {
|
||||
$title = $menu_array[3];
|
||||
return $menu_array[3];
|
||||
} else
|
||||
if ( isset( $plugin_page ) && ($plugin_page == $menu_array[2] ) && ($hook == $menu_array[3] ) ) {
|
||||
$title = $menu_array[3];
|
||||
return $menu_array[3];
|
||||
}
|
||||
} else {
|
||||
$title = $menu_array[0];
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach (array_keys( $submenu ) as $parent) {
|
||||
foreach ( $submenu[$parent] as $submenu_array ) {
|
||||
if ( isset( $plugin_page ) &&
|
||||
($plugin_page == $submenu_array[2] ) &&
|
||||
(($parent == $pagenow ) || ($parent == $plugin_page ) || ($plugin_page == $hook ) || (($pagenow == 'admin.php' ) && ($parent1 != $submenu_array[2] ) ) )
|
||||
) {
|
||||
$title = $submenu_array[3];
|
||||
return $submenu_array[3];
|
||||
}
|
||||
|
||||
if ( $submenu_array[2] != $pagenow || isset( $_GET['page'] ) ) // not the current page
|
||||
continue;
|
||||
|
||||
if ( isset( $submenu_array[3] ) ) {
|
||||
$title = $submenu_array[3];
|
||||
return $submenu_array[3];
|
||||
} else {
|
||||
$title = $submenu_array[0];
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
function get_plugin_page_hook( $plugin_page, $parent_page ) {
|
||||
global $wp_filter;
|
||||
|
||||
$hook = get_plugin_page_hookname( $plugin_page, $parent_page );
|
||||
if ( isset( $wp_filter[$hook] ))
|
||||
return $hook;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
function get_plugin_page_hookname( $plugin_page, $parent_page ) {
|
||||
global $admin_page_hooks;
|
||||
|
||||
$parent = get_admin_page_parent();
|
||||
|
||||
if ( empty ( $parent_page ) || 'admin.php' == $parent_page ) {
|
||||
if ( isset( $admin_page_hooks[$plugin_page] ))
|
||||
$page_type = 'toplevel';
|
||||
else
|
||||
if ( isset( $admin_page_hooks[$parent] ))
|
||||
$page_type = $admin_page_hooks[$parent];
|
||||
} else
|
||||
if ( isset( $admin_page_hooks[$parent_page] ) ) {
|
||||
$page_type = $admin_page_hooks[$parent_page];
|
||||
} else {
|
||||
$page_type = 'admin';
|
||||
}
|
||||
|
||||
$plugin_name = preg_replace( '!\.php!', '', $plugin_page );
|
||||
|
||||
return $page_type.'_page_'.$plugin_name;
|
||||
}
|
||||
|
||||
function user_can_access_admin_page() {
|
||||
global $pagenow;
|
||||
global $menu;
|
||||
global $submenu;
|
||||
global $_wp_menu_nopriv;
|
||||
global $_wp_submenu_nopriv;
|
||||
global $plugin_page;
|
||||
|
||||
$parent = get_admin_page_parent();
|
||||
|
||||
if ( isset( $_wp_submenu_nopriv[$parent][$pagenow] ) )
|
||||
return false;
|
||||
|
||||
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
|
||||
return false;
|
||||
|
||||
if ( empty( $parent) ) {
|
||||
if ( isset( $_wp_menu_nopriv[$pagenow] ) )
|
||||
return false;
|
||||
if ( isset( $_wp_submenu_nopriv[$pagenow][$pagenow] ) )
|
||||
return false;
|
||||
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) )
|
||||
return false;
|
||||
foreach (array_keys( $_wp_submenu_nopriv ) as $key ) {
|
||||
if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) )
|
||||
return false;
|
||||
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( isset( $submenu[$parent] ) ) {
|
||||
foreach ( $submenu[$parent] as $submenu_array ) {
|
||||
if ( isset( $plugin_page ) && ( $submenu_array[2] == $plugin_page ) ) {
|
||||
if ( current_user_can( $submenu_array[1] ))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
} else if ( $submenu_array[2] == $pagenow ) {
|
||||
if ( current_user_can( $submenu_array[1] ))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $menu as $menu_array ) {
|
||||
if ( $menu_array[2] == $parent) {
|
||||
if ( current_user_can( $menu_array[1] ))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
471
wp-admin/includes/post.php
Normal file
471
wp-admin/includes/post.php
Normal file
@@ -0,0 +1,471 @@
|
||||
<?php
|
||||
|
||||
// Update an existing post with values provided in $_POST.
|
||||
function edit_post() {
|
||||
global $user_ID;
|
||||
|
||||
$post_ID = (int) $_POST['post_ID'];
|
||||
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ( !current_user_can( 'edit_page', $post_ID ) )
|
||||
wp_die( __('You are not allowed to edit this page.' ));
|
||||
} else {
|
||||
if ( !current_user_can( 'edit_post', $post_ID ) )
|
||||
wp_die( __('You are not allowed to edit this post.' ));
|
||||
}
|
||||
|
||||
// Autosave shouldn't save too soon after a real save
|
||||
if ( 'autosave' == $_POST['action'] ) {
|
||||
$post =& get_post( $post_ID );
|
||||
$now = time();
|
||||
$then = strtotime($post->post_date_gmt . ' +0000');
|
||||
// Keep autosave_interval in sync with autosave-js.php.
|
||||
$delta = apply_filters( 'autosave_interval', 120 ) / 2;
|
||||
if ( ($now - $then) < $delta )
|
||||
return $post_ID;
|
||||
}
|
||||
|
||||
// Rename.
|
||||
$_POST['ID'] = (int) $_POST['post_ID'];
|
||||
$_POST['post_content'] = $_POST['content'];
|
||||
$_POST['post_excerpt'] = $_POST['excerpt'];
|
||||
$_POST['post_parent'] = $_POST['parent_id'];
|
||||
$_POST['to_ping'] = $_POST['trackback_url'];
|
||||
|
||||
if (!empty ( $_POST['post_author_override'] ) ) {
|
||||
$_POST['post_author'] = (int) $_POST['post_author_override'];
|
||||
} else
|
||||
if (!empty ( $_POST['post_author'] ) ) {
|
||||
$_POST['post_author'] = (int) $_POST['post_author'];
|
||||
} else {
|
||||
$_POST['post_author'] = (int) $_POST['user_ID'];
|
||||
}
|
||||
|
||||
if ( $_POST['post_author'] != $_POST['user_ID'] ) {
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ( !current_user_can( 'edit_others_pages' ) )
|
||||
wp_die( __('You are not allowed to edit pages as this user.' ));
|
||||
} else {
|
||||
if ( !current_user_can( 'edit_others_posts' ) )
|
||||
wp_die( __('You are not allowed to edit posts as this user.' ));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// What to do based on which button they pressed
|
||||
if ('' != $_POST['saveasdraft'] )
|
||||
$_POST['post_status'] = 'draft';
|
||||
if ('' != $_POST['saveasprivate'] )
|
||||
$_POST['post_status'] = 'private';
|
||||
if ('' != $_POST['publish'] )
|
||||
$_POST['post_status'] = 'publish';
|
||||
if ('' != $_POST['advanced'] )
|
||||
$_POST['post_status'] = 'draft';
|
||||
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ('publish' == $_POST['post_status'] && !current_user_can( 'edit_published_pages' ))
|
||||
$_POST['post_status'] = 'pending';
|
||||
} else {
|
||||
if ('publish' == $_POST['post_status'] && !current_user_can( 'edit_published_posts' ))
|
||||
$_POST['post_status'] = 'pending';
|
||||
}
|
||||
|
||||
if (!isset( $_POST['comment_status'] ))
|
||||
$_POST['comment_status'] = 'closed';
|
||||
|
||||
if (!isset( $_POST['ping_status'] ))
|
||||
$_POST['ping_status'] = 'closed';
|
||||
|
||||
if (!empty ( $_POST['edit_date'] ) ) {
|
||||
$aa = $_POST['aa'];
|
||||
$mm = $_POST['mm'];
|
||||
$jj = $_POST['jj'];
|
||||
$hh = $_POST['hh'];
|
||||
$mn = $_POST['mn'];
|
||||
$ss = $_POST['ss'];
|
||||
$jj = ($jj > 31 ) ? 31 : $jj;
|
||||
$hh = ($hh > 23 ) ? $hh -24 : $hh;
|
||||
$mn = ($mn > 59 ) ? $mn -60 : $mn;
|
||||
$ss = ($ss > 59 ) ? $ss -60 : $ss;
|
||||
$_POST['post_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
|
||||
$_POST['post_date_gmt'] = get_gmt_from_date( "$aa-$mm-$jj $hh:$mn:$ss" );
|
||||
}
|
||||
|
||||
// Meta Stuff
|
||||
if ( $_POST['meta'] ) {
|
||||
foreach ( $_POST['meta'] as $key => $value )
|
||||
update_meta( $key, $value['key'], $value['value'] );
|
||||
}
|
||||
|
||||
if ( $_POST['deletemeta'] ) {
|
||||
foreach ( $_POST['deletemeta'] as $key => $value )
|
||||
delete_meta( $key );
|
||||
}
|
||||
|
||||
add_meta( $post_ID );
|
||||
|
||||
wp_update_post( $_POST );
|
||||
|
||||
// Reunite any orphaned attachments with their parent
|
||||
if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
|
||||
$draft_ids = array();
|
||||
if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
|
||||
_relocate_children( $draft_temp_id, $post_ID );
|
||||
|
||||
// Now that we have an ID we can fix any attachment anchor hrefs
|
||||
_fix_attachment_links( $post_ID );
|
||||
|
||||
return $post_ID;
|
||||
}
|
||||
|
||||
// Default post information to use when populating the "Write Post" form.
|
||||
function get_default_post_to_edit() {
|
||||
if ( !empty( $_REQUEST['post_title'] ) )
|
||||
$post_title = wp_specialchars( stripslashes( $_REQUEST['post_title'] ));
|
||||
else if ( !empty( $_REQUEST['popuptitle'] ) ) {
|
||||
$post_title = wp_specialchars( stripslashes( $_REQUEST['popuptitle'] ));
|
||||
$post_title = funky_javascript_fix( $post_title );
|
||||
} else {
|
||||
$post_title = '';
|
||||
}
|
||||
|
||||
if ( !empty( $_REQUEST['content'] ) )
|
||||
$post_content = wp_specialchars( stripslashes( $_REQUEST['content'] ));
|
||||
else if ( !empty( $post_title ) ) {
|
||||
$text = wp_specialchars( stripslashes( urldecode( $_REQUEST['text'] ) ) );
|
||||
$text = funky_javascript_fix( $text);
|
||||
$popupurl = clean_url($_REQUEST['popupurl']);
|
||||
$post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
|
||||
}
|
||||
|
||||
if ( !empty( $_REQUEST['excerpt'] ) )
|
||||
$post_excerpt = wp_specialchars( stripslashes( $_REQUEST['excerpt'] ));
|
||||
else
|
||||
$post_excerpt = '';
|
||||
|
||||
$post->post_status = 'draft';
|
||||
$post->comment_status = get_option( 'default_comment_status' );
|
||||
$post->ping_status = get_option( 'default_ping_status' );
|
||||
$post->post_pingback = get_option( 'default_pingback_flag' );
|
||||
$post->post_category = get_option( 'default_category' );
|
||||
$post->post_content = apply_filters( 'default_content', $post_content);
|
||||
$post->post_title = apply_filters( 'default_title', $post_title );
|
||||
$post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt);
|
||||
$post->page_template = 'default';
|
||||
$post->post_parent = 0;
|
||||
$post->menu_order = 0;
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
||||
// Get an existing post and format it for editing.
|
||||
function get_post_to_edit( $id ) {
|
||||
|
||||
$post = get_post( $id, OBJECT, 'edit' );
|
||||
|
||||
if ( $post->post_type == 'page' )
|
||||
$post->page_template = get_post_meta( $id, '_wp_page_template', true );
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
||||
function post_exists($title, $content = '', $post_date = '') {
|
||||
global $wpdb;
|
||||
|
||||
if (!empty ($post_date))
|
||||
$post_date = "AND post_date = '$post_date'";
|
||||
|
||||
if (!empty ($title))
|
||||
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date");
|
||||
else
|
||||
if (!empty ($content))
|
||||
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Creates a new post from the "Write Post" form using $_POST information.
|
||||
function wp_write_post() {
|
||||
global $user_ID;
|
||||
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ( !current_user_can( 'edit_pages' ) )
|
||||
return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this blog.' ) );
|
||||
} else {
|
||||
if ( !current_user_can( 'edit_posts' ) )
|
||||
return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this blog.' ) );
|
||||
}
|
||||
|
||||
|
||||
// Check for autosave collisions
|
||||
$temp_id = false;
|
||||
if ( isset($_POST['temp_ID']) ) {
|
||||
$temp_id = (int) $_POST['temp_ID'];
|
||||
if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
|
||||
$draft_ids = array();
|
||||
foreach ( $draft_ids as $temp => $real )
|
||||
if ( time() + $temp > 86400 ) // 1 day: $temp is equal to -1 * time( then )
|
||||
unset($draft_ids[$temp]);
|
||||
|
||||
if ( isset($draft_ids[$temp_id]) ) { // Edit, don't write
|
||||
$_POST['post_ID'] = $draft_ids[$temp_id];
|
||||
unset($_POST['temp_ID']);
|
||||
update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );
|
||||
return edit_post();
|
||||
}
|
||||
}
|
||||
|
||||
// Rename.
|
||||
$_POST['post_content'] = $_POST['content'];
|
||||
$_POST['post_excerpt'] = $_POST['excerpt'];
|
||||
$_POST['post_parent'] = $_POST['parent_id'];
|
||||
$_POST['to_ping'] = $_POST['trackback_url'];
|
||||
|
||||
if (!empty ( $_POST['post_author_override'] ) ) {
|
||||
$_POST['post_author'] = (int) $_POST['post_author_override'];
|
||||
} else {
|
||||
if (!empty ( $_POST['post_author'] ) ) {
|
||||
$_POST['post_author'] = (int) $_POST['post_author'];
|
||||
} else {
|
||||
$_POST['post_author'] = (int) $_POST['user_ID'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( $_POST['post_author'] != $_POST['user_ID'] ) {
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ( !current_user_can( 'edit_others_pages' ) )
|
||||
return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) );
|
||||
} else {
|
||||
if ( !current_user_can( 'edit_others_posts' ) )
|
||||
return new WP_Error( 'edit_others_posts', __( 'You are not allowed to post as this user.' ) );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// What to do based on which button they pressed
|
||||
if ('' != $_POST['saveasdraft'] )
|
||||
$_POST['post_status'] = 'draft';
|
||||
if ('' != $_POST['saveasprivate'] )
|
||||
$_POST['post_status'] = 'private';
|
||||
if ('' != $_POST['publish'] )
|
||||
$_POST['post_status'] = 'publish';
|
||||
if ('' != $_POST['advanced'] )
|
||||
$_POST['post_status'] = 'draft';
|
||||
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
|
||||
$_POST['post_status'] = 'pending';
|
||||
} else {
|
||||
if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) )
|
||||
$_POST['post_status'] = 'pending';
|
||||
}
|
||||
|
||||
if (!isset( $_POST['comment_status'] ))
|
||||
$_POST['comment_status'] = 'closed';
|
||||
|
||||
if (!isset( $_POST['ping_status'] ))
|
||||
$_POST['ping_status'] = 'closed';
|
||||
|
||||
if (!empty ( $_POST['edit_date'] ) ) {
|
||||
$aa = $_POST['aa'];
|
||||
$mm = $_POST['mm'];
|
||||
$jj = $_POST['jj'];
|
||||
$hh = $_POST['hh'];
|
||||
$mn = $_POST['mn'];
|
||||
$ss = $_POST['ss'];
|
||||
$jj = ($jj > 31 ) ? 31 : $jj;
|
||||
$hh = ($hh > 23 ) ? $hh -24 : $hh;
|
||||
$mn = ($mn > 59 ) ? $mn -60 : $mn;
|
||||
$ss = ($ss > 59 ) ? $ss -60 : $ss;
|
||||
$_POST['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
|
||||
$_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
|
||||
}
|
||||
|
||||
// Create the post.
|
||||
$post_ID = wp_insert_post( $_POST );
|
||||
if ( is_wp_error( $post_ID ) )
|
||||
return $post_ID;
|
||||
|
||||
if ( empty($post_ID) )
|
||||
return 0;
|
||||
|
||||
add_meta( $post_ID );
|
||||
|
||||
// Reunite any orphaned attachments with their parent
|
||||
if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
|
||||
$draft_ids = array();
|
||||
if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
|
||||
_relocate_children( $draft_temp_id, $post_ID );
|
||||
if ( $temp_id && $temp_id != $draft_temp_id )
|
||||
_relocate_children( $temp_id, $post_ID );
|
||||
|
||||
// Update autosave collision detection
|
||||
if ( $temp_id ) {
|
||||
$draft_ids[$temp_id] = $post_ID;
|
||||
update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );
|
||||
}
|
||||
|
||||
// Now that we have an ID we can fix any attachment anchor hrefs
|
||||
_fix_attachment_links( $post_ID );
|
||||
|
||||
return $post_ID;
|
||||
}
|
||||
|
||||
function write_post() {
|
||||
$result = wp_write_post();
|
||||
if( is_wp_error( $result ) )
|
||||
wp_die( $result->get_error_message() );
|
||||
else
|
||||
return $result;
|
||||
}
|
||||
|
||||
//
|
||||
// Post Meta
|
||||
//
|
||||
|
||||
function add_meta( $post_ID ) {
|
||||
global $wpdb;
|
||||
$post_ID = (int) $post_ID;
|
||||
|
||||
$protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
|
||||
|
||||
$metakeyselect = $wpdb->escape( stripslashes( trim( $_POST['metakeyselect'] ) ) );
|
||||
$metakeyinput = $wpdb->escape( stripslashes( trim( $_POST['metakeyinput'] ) ) );
|
||||
$metavalue = maybe_serialize( stripslashes( (trim( $_POST['metavalue'] ) ) ));
|
||||
$metavalue = $wpdb->escape( $metavalue );
|
||||
|
||||
if ( ('0' === $metavalue || !empty ( $metavalue ) ) && ((('#NONE#' != $metakeyselect) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput) ) ) {
|
||||
// We have a key/value pair. If both the select and the
|
||||
// input for the key have data, the input takes precedence:
|
||||
|
||||
if ('#NONE#' != $metakeyselect)
|
||||
$metakey = $metakeyselect;
|
||||
|
||||
if ( $metakeyinput)
|
||||
$metakey = $metakeyinput; // default
|
||||
|
||||
if ( in_array($metakey, $protected) )
|
||||
return false;
|
||||
|
||||
$result = $wpdb->query( "
|
||||
INSERT INTO $wpdb->postmeta
|
||||
(post_id,meta_key,meta_value )
|
||||
VALUES ('$post_ID','$metakey','$metavalue' )
|
||||
" );
|
||||
return $wpdb->insert_id;
|
||||
}
|
||||
return false;
|
||||
} // add_meta
|
||||
|
||||
function delete_meta( $mid ) {
|
||||
global $wpdb;
|
||||
$mid = (int) $mid;
|
||||
|
||||
return $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
|
||||
}
|
||||
|
||||
// Get a list of previously defined keys
|
||||
function get_meta_keys() {
|
||||
global $wpdb;
|
||||
|
||||
$keys = $wpdb->get_col( "
|
||||
SELECT meta_key
|
||||
FROM $wpdb->postmeta
|
||||
GROUP BY meta_key
|
||||
ORDER BY meta_key" );
|
||||
|
||||
return $keys;
|
||||
}
|
||||
|
||||
function get_post_meta_by_id( $mid ) {
|
||||
global $wpdb;
|
||||
$mid = (int) $mid;
|
||||
|
||||
$meta = $wpdb->get_row( "SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
|
||||
if ( is_serialized_string( $meta->meta_value ) )
|
||||
$meta->meta_value = maybe_unserialize( $meta->meta_value );
|
||||
return $meta;
|
||||
}
|
||||
|
||||
// Some postmeta stuff
|
||||
function has_meta( $postid ) {
|
||||
global $wpdb;
|
||||
|
||||
return $wpdb->get_results( "
|
||||
SELECT meta_key, meta_value, meta_id, post_id
|
||||
FROM $wpdb->postmeta
|
||||
WHERE post_id = '$postid'
|
||||
ORDER BY meta_key,meta_id", ARRAY_A );
|
||||
|
||||
}
|
||||
|
||||
function update_meta( $mid, $mkey, $mvalue ) {
|
||||
global $wpdb;
|
||||
|
||||
$protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
|
||||
|
||||
if ( in_array($mkey, $protected) )
|
||||
return false;
|
||||
|
||||
$mvalue = maybe_serialize( stripslashes( $mvalue ));
|
||||
$mvalue = $wpdb->escape( $mvalue );
|
||||
$mid = (int) $mid;
|
||||
return $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'" );
|
||||
}
|
||||
|
||||
//
|
||||
// Private
|
||||
//
|
||||
|
||||
// Replace hrefs of attachment anchors with up-to-date permalinks.
|
||||
function _fix_attachment_links( $post_ID ) {
|
||||
global $wp_rewrite;
|
||||
|
||||
$post = & get_post( $post_ID, ARRAY_A );
|
||||
|
||||
$search = "#<a[^>]+rel=('|\")[^'\"]*attachment[^>]*>#ie";
|
||||
|
||||
// See if we have any rel="attachment" links
|
||||
if ( 0 == preg_match_all( $search, $post['post_content'], $anchor_matches, PREG_PATTERN_ORDER ) )
|
||||
return;
|
||||
|
||||
$i = 0;
|
||||
$search = "#[\s]+rel=(\"|')(.*?)wp-att-(\d+)\\1#i";
|
||||
foreach ( $anchor_matches[0] as $anchor ) {
|
||||
if ( 0 == preg_match( $search, $anchor, $id_matches ) )
|
||||
continue;
|
||||
|
||||
$id = (int) $id_matches[3];
|
||||
|
||||
// While we have the attachment ID, let's adopt any orphans.
|
||||
$attachment = & get_post( $id, ARRAY_A );
|
||||
if ( ! empty( $attachment) && ! is_object( get_post( $attachment['post_parent'] ) ) ) {
|
||||
$attachment['post_parent'] = $post_ID;
|
||||
// Escape data pulled from DB.
|
||||
$attachment = add_magic_quotes( $attachment);
|
||||
wp_update_post( $attachment);
|
||||
}
|
||||
|
||||
$post_search[$i] = $anchor;
|
||||
$post_replace[$i] = preg_replace( "#href=(\"|')[^'\"]*\\1#e", "stripslashes( 'href=\\1' ).get_attachment_link( $id ).stripslashes( '\\1' )", $anchor );
|
||||
++$i;
|
||||
}
|
||||
|
||||
$post['post_content'] = str_replace( $post_search, $post_replace, $post['post_content'] );
|
||||
|
||||
// Escape data pulled from DB.
|
||||
$post = add_magic_quotes( $post);
|
||||
|
||||
return wp_update_post( $post);
|
||||
}
|
||||
|
||||
// Move child posts to a new parent
|
||||
function _relocate_children( $old_ID, $new_ID ) {
|
||||
global $wpdb;
|
||||
$old_ID = (int) $old_ID;
|
||||
$new_ID = (int) $new_ID;
|
||||
return $wpdb->query( "UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID" );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -10,18 +10,29 @@ if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
|
||||
$charset_collate .= " COLLATE $wpdb->collate";
|
||||
}
|
||||
|
||||
$wp_queries="CREATE TABLE $wpdb->categories (
|
||||
cat_ID bigint(20) NOT NULL auto_increment,
|
||||
cat_name varchar(55) NOT NULL default '',
|
||||
category_nicename varchar(200) NOT NULL default '',
|
||||
category_description longtext NOT NULL,
|
||||
category_parent bigint(20) NOT NULL default '0',
|
||||
category_count bigint(20) NOT NULL default '0',
|
||||
link_count bigint(20) NOT NULL default '0',
|
||||
posts_private tinyint(1) NOT NULL default '0',
|
||||
links_private tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY (cat_ID),
|
||||
KEY category_nicename (category_nicename)
|
||||
$wp_queries="CREATE TABLE $wpdb->terms (
|
||||
term_id bigint(20) NOT NULL auto_increment,
|
||||
name varchar(55) NOT NULL default '',
|
||||
slug varchar(200) NOT NULL default '',
|
||||
term_group bigint(10) NOT NULL default 0,
|
||||
PRIMARY KEY (term_id),
|
||||
UNIQUE KEY slug (slug)
|
||||
) $charset_collate;
|
||||
CREATE TABLE $wpdb->term_taxonomy (
|
||||
term_taxonomy_id bigint(20) NOT NULL auto_increment,
|
||||
term_id bigint(20) NOT NULL default 0,
|
||||
taxonomy varchar(32) NOT NULL default '',
|
||||
description longtext NOT NULL,
|
||||
parent bigint(20) NOT NULL default 0,
|
||||
count bigint(20) NOT NULL default 0,
|
||||
PRIMARY KEY (term_taxonomy_id),
|
||||
UNIQUE KEY term_id_taxonomy (term_id,taxonomy)
|
||||
) $charset_collate;
|
||||
CREATE TABLE $wpdb->term_relationships (
|
||||
object_id bigint(20) NOT NULL default 0,
|
||||
term_taxonomy_id bigint(20) NOT NULL default 0,
|
||||
PRIMARY KEY (object_id,term_taxonomy_id),
|
||||
KEY term_taxonomy_id (term_taxonomy_id)
|
||||
) $charset_collate;
|
||||
CREATE TABLE $wpdb->comments (
|
||||
comment_ID bigint(20) unsigned NOT NULL auto_increment,
|
||||
@@ -43,13 +54,6 @@ CREATE TABLE $wpdb->comments (
|
||||
KEY comment_approved (comment_approved),
|
||||
KEY comment_post_ID (comment_post_ID)
|
||||
) $charset_collate;
|
||||
CREATE TABLE $wpdb->link2cat (
|
||||
rel_id bigint(20) NOT NULL auto_increment,
|
||||
link_id bigint(20) NOT NULL default '0',
|
||||
category_id bigint(20) NOT NULL default '0',
|
||||
PRIMARY KEY (rel_id),
|
||||
KEY link_id (link_id,category_id)
|
||||
) $charset_collate;
|
||||
CREATE TABLE $wpdb->links (
|
||||
link_id bigint(20) NOT NULL auto_increment,
|
||||
link_url varchar(255) NOT NULL default '',
|
||||
@@ -73,24 +77,11 @@ CREATE TABLE $wpdb->options (
|
||||
option_id bigint(20) NOT NULL auto_increment,
|
||||
blog_id int(11) NOT NULL default '0',
|
||||
option_name varchar(64) NOT NULL default '',
|
||||
option_can_override enum('Y','N') NOT NULL default 'Y',
|
||||
option_type int(11) NOT NULL default '1',
|
||||
option_value longtext NOT NULL,
|
||||
option_width int(11) NOT NULL default '20',
|
||||
option_height int(11) NOT NULL default '8',
|
||||
option_description tinytext NOT NULL,
|
||||
option_admin_level int(11) NOT NULL default '1',
|
||||
autoload enum('yes','no') NOT NULL default 'yes',
|
||||
PRIMARY KEY (option_id,blog_id,option_name),
|
||||
KEY option_name (option_name)
|
||||
) $charset_collate;
|
||||
CREATE TABLE $wpdb->post2cat (
|
||||
rel_id bigint(20) NOT NULL auto_increment,
|
||||
post_id bigint(20) NOT NULL default '0',
|
||||
category_id bigint(20) NOT NULL default '0',
|
||||
PRIMARY KEY (rel_id),
|
||||
KEY post_id (post_id,category_id)
|
||||
) $charset_collate;
|
||||
CREATE TABLE $wpdb->postmeta (
|
||||
meta_id bigint(20) NOT NULL auto_increment,
|
||||
post_id bigint(20) NOT NULL default '0',
|
||||
@@ -109,7 +100,7 @@ CREATE TABLE $wpdb->posts (
|
||||
post_title text NOT NULL,
|
||||
post_category int(4) NOT NULL default '0',
|
||||
post_excerpt text NOT NULL,
|
||||
post_status enum('publish','draft','private','static','object','attachment','inherit','future') NOT NULL default 'publish',
|
||||
post_status enum('publish','draft','private','static','object','attachment','inherit','future', 'pending') NOT NULL default 'publish',
|
||||
comment_status enum('open','closed','registered_only') NOT NULL default 'open',
|
||||
ping_status enum('open','closed') NOT NULL default 'open',
|
||||
post_password varchar(20) NOT NULL default '',
|
||||
@@ -141,7 +132,8 @@ CREATE TABLE $wpdb->users (
|
||||
user_status int(11) NOT NULL default '0',
|
||||
display_name varchar(250) NOT NULL default '',
|
||||
PRIMARY KEY (ID),
|
||||
KEY user_login_key (user_login)
|
||||
KEY user_login_key (user_login),
|
||||
KEY user_nicename (user_nicename)
|
||||
) $charset_collate;
|
||||
CREATE TABLE $wpdb->usermeta (
|
||||
umeta_id bigint(20) NOT NULL auto_increment,
|
||||
@@ -158,10 +150,9 @@ function populate_options() {
|
||||
|
||||
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
|
||||
$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
||||
add_option('siteurl', $guessurl, __('WordPress web address'));
|
||||
add_option('blogname', __('My Weblog'), __('Blog title'));
|
||||
add_option('blogdescription', __('Just another WordPress weblog'), __('Short tagline'));
|
||||
add_option('new_users_can_blog', 0);
|
||||
add_option('siteurl', $guessurl);
|
||||
add_option('blogname', __('My Blog'));
|
||||
add_option('blogdescription', __('Just another WordPress weblog'));
|
||||
add_option('users_can_register', 0);
|
||||
add_option('admin_email', 'you@example.com');
|
||||
add_option('start_of_week', 1);
|
||||
@@ -206,7 +197,7 @@ function populate_options() {
|
||||
add_option('comment_max_links', 2);
|
||||
add_option('gmt_offset', date('Z') / 3600);
|
||||
// 1.5
|
||||
add_option('default_email_category', 1, __('Posts by email go to this category'));
|
||||
add_option('default_email_category', 1);
|
||||
add_option('recently_edited');
|
||||
add_option('use_linksupdate', 0);
|
||||
add_option('template', 'default');
|
||||
@@ -240,6 +231,9 @@ function populate_options() {
|
||||
add_option('default_link_category', 2);
|
||||
add_option('show_on_front', 'posts');
|
||||
|
||||
// 2.2
|
||||
add_option('tag_base');
|
||||
|
||||
// Delete unused options
|
||||
$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing');
|
||||
foreach ($unusedoptions as $option) :
|
||||
@@ -256,6 +250,7 @@ function populate_options() {
|
||||
function populate_roles() {
|
||||
populate_roles_160();
|
||||
populate_roles_210();
|
||||
populate_roles_230();
|
||||
}
|
||||
|
||||
function populate_roles_160() {
|
||||
@@ -389,4 +384,12 @@ function populate_roles_210() {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
function populate_roles_230() {
|
||||
$role = get_role( 'administrator' );
|
||||
|
||||
if ( !empty( $role ) ) {
|
||||
$role->add_cap( 'unfiltered_upload' );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
148
wp-admin/includes/taxonomy.php
Normal file
148
wp-admin/includes/taxonomy.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
//
|
||||
// Category
|
||||
//
|
||||
|
||||
function category_exists($cat_name) {
|
||||
$id = is_term($cat_name, 'category');
|
||||
if ( is_array($id) )
|
||||
$id = $id['term_id'];
|
||||
return $id;
|
||||
}
|
||||
|
||||
function get_category_to_edit( $id ) {
|
||||
$category = get_category( $id, OBJECT, 'edit' );
|
||||
return $category;
|
||||
}
|
||||
|
||||
function wp_create_category($cat_name) {
|
||||
if ( $id = category_exists($cat_name) )
|
||||
return $id;
|
||||
|
||||
return wp_insert_category( array('cat_name' => $cat_name) );
|
||||
}
|
||||
|
||||
function wp_create_categories($categories, $post_id = '') {
|
||||
$cat_ids = array ();
|
||||
foreach ($categories as $category) {
|
||||
if ($id = category_exists($category))
|
||||
$cat_ids[] = $id;
|
||||
else
|
||||
if ($id = wp_create_category($category))
|
||||
$cat_ids[] = $id;
|
||||
}
|
||||
|
||||
if ($post_id)
|
||||
wp_set_post_categories($post_id, $cat_ids);
|
||||
|
||||
return $cat_ids;
|
||||
}
|
||||
|
||||
function wp_delete_category($cat_ID) {
|
||||
global $wpdb;
|
||||
|
||||
$cat_ID = (int) $cat_ID;
|
||||
$default = get_option('default_category');
|
||||
|
||||
// Don't delete the default cat
|
||||
if ( $cat_ID == $default )
|
||||
return 0;
|
||||
|
||||
return wp_delete_term($cat_ID, 'category', "default=$default");
|
||||
}
|
||||
|
||||
function wp_insert_category($catarr) {
|
||||
global $wpdb;
|
||||
|
||||
extract($catarr, EXTR_SKIP);
|
||||
|
||||
if ( trim( $cat_name ) == '' )
|
||||
return 0;
|
||||
|
||||
$cat_ID = (int) $cat_ID;
|
||||
|
||||
// Are we updating or creating?
|
||||
if ( !empty ($cat_ID) )
|
||||
$update = true;
|
||||
else
|
||||
$update = false;
|
||||
|
||||
$name = $cat_name;
|
||||
$description = $category_description;
|
||||
$slug = $category_nicename;
|
||||
$parent = $category_parent;
|
||||
|
||||
$parent = (int) $parent;
|
||||
if ( empty($parent) || !category_exists( $parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $parent) ) )
|
||||
$parent = 0;
|
||||
|
||||
$args = compact('name', 'slug', 'parent', 'description');
|
||||
|
||||
if ( $update )
|
||||
$cat_ID = wp_update_term($cat_ID, 'category', $args);
|
||||
else
|
||||
$cat_ID = wp_insert_term($cat_name, 'category', $args);
|
||||
|
||||
if ( is_wp_error($cat_ID) )
|
||||
return 0;
|
||||
|
||||
return $cat_ID['term_id'];
|
||||
}
|
||||
|
||||
function wp_update_category($catarr) {
|
||||
global $wpdb;
|
||||
|
||||
$cat_ID = (int) $catarr['cat_ID'];
|
||||
|
||||
if ( $cat_ID == $catarr['category_parent'] )
|
||||
return false;
|
||||
|
||||
// First, get all of the original fields
|
||||
$category = get_category($cat_ID, ARRAY_A);
|
||||
|
||||
// Escape data pulled from DB.
|
||||
$category = add_magic_quotes($category);
|
||||
|
||||
// Merge old and new fields with new fields overwriting old ones.
|
||||
$catarr = array_merge($category, $catarr);
|
||||
|
||||
return wp_insert_category($catarr);
|
||||
}
|
||||
|
||||
//
|
||||
// Tags
|
||||
//
|
||||
|
||||
function get_tags_to_edit( $post_id ) {
|
||||
global $wpdb;
|
||||
|
||||
$post_id = (int) $post_id;
|
||||
if ( !$post_id )
|
||||
return false;
|
||||
|
||||
$tags = wp_get_post_tags($post_id);
|
||||
|
||||
if ( !$tags )
|
||||
return false;
|
||||
|
||||
foreach ( $tags as $tag )
|
||||
$tag_names[] = $tag->name;
|
||||
$tags_to_edit = join( ', ', $tag_names );
|
||||
$tags_to_edit = attribute_escape( $tags_to_edit );
|
||||
$tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit );
|
||||
return $tags_to_edit;
|
||||
}
|
||||
|
||||
function tag_exists($tag_name) {
|
||||
return is_term($tag_name, 'post_tag');
|
||||
}
|
||||
|
||||
function wp_create_tag($tag_name) {
|
||||
if ( $id = tag_exists($tag_name) )
|
||||
return $id;
|
||||
|
||||
return wp_insert_term($tag_name, 'post_tag');
|
||||
}
|
||||
|
||||
?>
|
||||
616
wp-admin/includes/template.php
Normal file
616
wp-admin/includes/template.php
Normal file
@@ -0,0 +1,616 @@
|
||||
<?php
|
||||
|
||||
//
|
||||
// Big Mess
|
||||
//
|
||||
|
||||
// Dandy new recursive multiple category stuff.
|
||||
function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
|
||||
if ( !$categories )
|
||||
$categories = get_categories( 'hide_empty=0' );
|
||||
|
||||
$children = _get_term_hierarchy('category');
|
||||
|
||||
if ( $categories ) {
|
||||
ob_start();
|
||||
foreach ( $categories as $category ) {
|
||||
if ( $category->parent == $parent) {
|
||||
echo "\t" . _cat_row( $category, $level );
|
||||
if ( isset($children[$category->term_id]) )
|
||||
cat_rows( $category->term_id, $level +1, $categories );
|
||||
}
|
||||
}
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$output = apply_filters('cat_rows', $output);
|
||||
|
||||
echo $output;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _cat_row( $category, $level, $name_override = false ) {
|
||||
global $class;
|
||||
|
||||
$pad = str_repeat( '— ', $level );
|
||||
if ( current_user_can( 'manage_categories' ) ) {
|
||||
$edit = "<a href='categories.php?action=edit&cat_ID=$category->term_id' class='edit'>".__( 'Edit' )."</a></td>";
|
||||
$default_cat_id = (int) get_option( 'default_category' );
|
||||
|
||||
if ( $category->term_id != $default_cat_id )
|
||||
$edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&cat_ID=$category->term_id", 'delete-category_' . $category->term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_id, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";
|
||||
else
|
||||
$edit .= "<td style='text-align:center'>".__( "Default" );
|
||||
} else
|
||||
$edit = '';
|
||||
|
||||
$class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
|
||||
|
||||
$category->count = number_format_i18n( $category->count );
|
||||
$posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
|
||||
$output = "<tr id='cat-$category->term_id'$class>
|
||||
<th scope='row' style='text-align: center'>$category->term_id</th>
|
||||
<td>" . ( $name_override ? $name_override : $pad . ' ' . $category->name ) . "</td>
|
||||
<td>$category->description</td>
|
||||
<td align='center'>$posts_count</td>
|
||||
<td>$edit</td>\n\t</tr>\n";
|
||||
|
||||
return apply_filters('cat_row', $output);
|
||||
}
|
||||
|
||||
function checked( $checked, $current) {
|
||||
if ( $checked == $current)
|
||||
echo ' checked="checked"';
|
||||
}
|
||||
|
||||
// TODO: Remove?
|
||||
function documentation_link( $for ) {
|
||||
return;
|
||||
}
|
||||
|
||||
function selected( $selected, $current) {
|
||||
if ( $selected == $current)
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
|
||||
//
|
||||
// Nasty Category Stuff
|
||||
//
|
||||
|
||||
function sort_cats( $cat1, $cat2 ) {
|
||||
if ( $cat1['checked'] || $cat2['checked'] )
|
||||
return ( $cat1['checked'] && !$cat2['checked'] ) ? -1 : 1;
|
||||
else
|
||||
return strcasecmp( $cat1['cat_name'], $cat2['cat_name'] );
|
||||
}
|
||||
|
||||
function get_nested_categories( $default = 0, $parent = 0 ) {
|
||||
global $post_ID, $mode, $wpdb, $checked_categories;
|
||||
|
||||
if ( empty($checked_categories) ) {
|
||||
if ( $post_ID ) {
|
||||
$checked_categories = wp_get_post_categories($post_ID);
|
||||
|
||||
if ( count( $checked_categories ) == 0 ) {
|
||||
// No selected categories, strange
|
||||
$checked_categories[] = $default;
|
||||
}
|
||||
} else {
|
||||
$checked_categories[] = $default;
|
||||
}
|
||||
}
|
||||
|
||||
$cats = get_categories("parent=$parent&hide_empty=0&fields=ids");
|
||||
|
||||
$result = array ();
|
||||
if ( is_array( $cats ) ) {
|
||||
foreach ( $cats as $cat) {
|
||||
$result[$cat]['children'] = get_nested_categories( $default, $cat);
|
||||
$result[$cat]['cat_ID'] = $cat;
|
||||
$result[$cat]['checked'] = in_array( $cat, $checked_categories );
|
||||
$result[$cat]['cat_name'] = get_the_category_by_ID( $cat);
|
||||
}
|
||||
}
|
||||
|
||||
$result = apply_filters('get_nested_categories', $result);
|
||||
usort( $result, 'sort_cats' );
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function write_nested_categories( $categories ) {
|
||||
foreach ( $categories as $category ) {
|
||||
echo '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( apply_filters('the_category', $category['cat_name'] )), "</label></li>";
|
||||
|
||||
if ( $category['children'] ) {
|
||||
echo "<ul>\n";
|
||||
write_nested_categories( $category['children'] );
|
||||
echo "</ul>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function dropdown_categories( $default = 0 ) {
|
||||
write_nested_categories( get_nested_categories( $default) );
|
||||
}
|
||||
|
||||
function dropdown_link_categories( $default = 0 ) {
|
||||
global $link_id;
|
||||
|
||||
if ( $link_id ) {
|
||||
$checked_categories = wp_get_link_cats($link_id);
|
||||
|
||||
if ( count( $checked_categories ) == 0 ) {
|
||||
// No selected categories, strange
|
||||
$checked_categories[] = $default;
|
||||
}
|
||||
} else {
|
||||
$checked_categories[] = $default;
|
||||
}
|
||||
|
||||
$categories = get_terms('link_category', 'orderby=count&hide_empty=0');
|
||||
|
||||
if ( empty($categories) )
|
||||
return;
|
||||
|
||||
foreach ( $categories as $category ) {
|
||||
$cat_id = $category->term_id;
|
||||
$name = wp_specialchars( apply_filters('the_category', $category->name));
|
||||
$checked = in_array( $cat_id, $checked_categories );
|
||||
echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', ($checked ? ' checked="checked"' : "" ), '/> ', $name, "</label></li>";
|
||||
}
|
||||
}
|
||||
|
||||
function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) {
|
||||
global $wpdb, $class, $post;
|
||||
|
||||
if (!$pages )
|
||||
$pages = get_pages( 'sort_column=menu_order' );
|
||||
|
||||
if (! $pages )
|
||||
return false;
|
||||
|
||||
foreach ( $pages as $post) {
|
||||
setup_postdata( $post);
|
||||
if ( $hierarchy && ($post->post_parent != $parent) )
|
||||
continue;
|
||||
|
||||
$post->post_title = wp_specialchars( $post->post_title );
|
||||
$pad = str_repeat( '— ', $level );
|
||||
$id = (int) $post->ID;
|
||||
$class = ('alternate' == $class ) ? '' : 'alternate';
|
||||
?>
|
||||
<tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
|
||||
<th scope="row" style="text-align: center"><?php echo $post->ID; ?></th>
|
||||
<td>
|
||||
<?php echo $pad; ?><?php the_title() ?>
|
||||
</td>
|
||||
<td><?php the_author() ?></td>
|
||||
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else echo mysql2date( __('Y-m-d g:i a'), $post->post_modified ); ?></td>
|
||||
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e( 'View' ); ?></a></td>
|
||||
<td><?php if ( current_user_can( 'edit_page', $id ) ) { echo "<a href='page.php?action=edit&post=$id' class='edit'>" . __( 'Edit' ) . "</a>"; } ?></td>
|
||||
<td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&post=$id", 'delete-page_' . $id ) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . js_escape(sprintf( __("You are about to delete the '%s' page.\n'OK' to delete, 'Cancel' to stop." ), get_the_title() ) ) . "' );\">" . __( 'Delete' ) . "</a>"; } ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
if ( $hierarchy ) page_rows( $id, $level + 1, $pages );
|
||||
}
|
||||
}
|
||||
|
||||
function user_row( $user_object, $style = '' ) {
|
||||
if ( !(is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
|
||||
$user_object = new WP_User( (int) $user_object );
|
||||
$email = $user_object->user_email;
|
||||
$url = $user_object->user_url;
|
||||
$short_url = str_replace( 'http://', '', $url );
|
||||
$short_url = str_replace( 'www.', '', $short_url );
|
||||
if ('/' == substr( $short_url, -1 ))
|
||||
$short_url = substr( $short_url, 0, -1 );
|
||||
if ( strlen( $short_url ) > 35 )
|
||||
$short_url = substr( $short_url, 0, 32 ).'...';
|
||||
$numposts = get_usernumposts( $user_object->ID );
|
||||
$r = "<tr id='user-$user_object->ID'$style>
|
||||
<td><input type='checkbox' name='users[]' id='user_{$user_object->ID}' value='{$user_object->ID}' /> <label for='user_{$user_object->ID}'>{$user_object->ID}</label></td>
|
||||
<td><label for='user_{$user_object->ID}'><strong>$user_object->user_login</strong></label></td>
|
||||
<td><label for='user_{$user_object->ID}'>$user_object->first_name $user_object->last_name</label></td>
|
||||
<td><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td>
|
||||
<td><a href='$url' title='website: $url'>$short_url</a></td>";
|
||||
$r .= "\n\t\t<td align='center'>";
|
||||
if ( $numposts > 0 ) {
|
||||
$r .= "<a href='edit.php?author=$user_object->ID' title='" . __( 'View posts by this author' ) . "' class='edit'>";
|
||||
$r .= sprintf(__ngettext( 'View %s post', 'View %s posts', $numposts ), $numposts);
|
||||
$r .= '</a>';
|
||||
}
|
||||
$r .= "</td>\n\t\t<td>";
|
||||
if ( current_user_can( 'edit_user', $user_object->ID ) ) {
|
||||
$edit_link = add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" );
|
||||
$r .= "<a href='$edit_link' class='edit'>".__( 'Edit' )."</a>";
|
||||
}
|
||||
$r .= "</td>\n\t</tr>";
|
||||
return $r;
|
||||
}
|
||||
|
||||
function _wp_get_comment_list( $s = false, $start, $num ) {
|
||||
global $wpdb;
|
||||
|
||||
$start = abs( (int) $start );
|
||||
$num = (int) $num;
|
||||
|
||||
if ( $s ) {
|
||||
$s = $wpdb->escape($s);
|
||||
$comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE
|
||||
(comment_author LIKE '%$s%' OR
|
||||
comment_author_email LIKE '%$s%' OR
|
||||
comment_author_url LIKE ('%$s%') OR
|
||||
comment_author_IP LIKE ('%$s%') OR
|
||||
comment_content LIKE ('%$s%') ) AND
|
||||
comment_approved != 'spam'
|
||||
ORDER BY comment_date DESC LIMIT $start, $num");
|
||||
} else {
|
||||
$comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $start, $num" );
|
||||
}
|
||||
|
||||
update_comment_cache($comments);
|
||||
|
||||
$total = $wpdb->get_var( "SELECT FOUND_ROWS()" );
|
||||
|
||||
return array($comments, $total);
|
||||
}
|
||||
|
||||
function _wp_comment_list_item( $id, $alt = 0 ) {
|
||||
global $authordata, $comment, $wpdb;
|
||||
$id = (int) $id;
|
||||
$comment =& get_comment( $id );
|
||||
$class = '';
|
||||
$post = get_post($comment->comment_post_ID);
|
||||
$authordata = get_userdata($post->post_author);
|
||||
$comment_status = wp_get_comment_status($comment->comment_ID);
|
||||
if ( 'unapproved' == $comment_status )
|
||||
$class .= ' unapproved';
|
||||
if ( $alt % 2 )
|
||||
$class .= ' alternate';
|
||||
echo "<li id='comment-$comment->comment_ID' class='$class'>";
|
||||
?>
|
||||
<p><strong><?php comment_author(); ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
|
||||
|
||||
<?php comment_text() ?>
|
||||
|
||||
<p><?php comment_date(__('M j, g:i A')); ?> — [
|
||||
<?php
|
||||
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
echo " <a href='comment.php?action=editcomment&c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
|
||||
echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
|
||||
if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
|
||||
echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
|
||||
echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
|
||||
}
|
||||
echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&dt=spam&p=" . $comment->comment_post_ID . "&c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ";
|
||||
}
|
||||
$post = get_post($comment->comment_post_ID, OBJECT, 'display');
|
||||
$post_title = wp_specialchars( $post->post_title, 'double' );
|
||||
$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
|
||||
?>
|
||||
] — <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a></p>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
|
||||
global $wpdb;
|
||||
if (!$categories )
|
||||
$categories = get_categories( 'hide_empty=0' );
|
||||
|
||||
if ( $categories ) {
|
||||
foreach ( $categories as $category ) {
|
||||
if ( $currentcat != $category->term_id && $parent == $category->parent) {
|
||||
$pad = str_repeat( '– ', $level );
|
||||
$category->name = wp_specialchars( $category->name );
|
||||
echo "\n\t<option value='$category->term_id'";
|
||||
if ( $currentparent == $category->term_id )
|
||||
echo " selected='selected'";
|
||||
echo ">$pad$category->name</option>";
|
||||
wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function list_meta( $meta ) {
|
||||
global $post_ID;
|
||||
// Exit if no meta
|
||||
if (!$meta ) {
|
||||
echo '<tbody id="the-list"><tr style="display: none;"><td> </td></tr></tbody>'; //TBODY needed for list-manipulation JS
|
||||
return;
|
||||
}
|
||||
$count = 0;
|
||||
?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php _e( 'Key' ) ?></th>
|
||||
<th><?php _e( 'Value' ) ?></th>
|
||||
<th colspan='2'><?php _e( 'Action' ) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
$r ="\n\t<tbody id='the-list'>";
|
||||
foreach ( $meta as $entry ) {
|
||||
++ $count;
|
||||
if ( $count % 2 )
|
||||
$style = 'alternate';
|
||||
else
|
||||
$style = '';
|
||||
if ('_' == $entry['meta_key'] { 0 } )
|
||||
$style .= ' hidden';
|
||||
|
||||
if ( is_serialized( $entry['meta_value'] ) ) {
|
||||
if ( is_serialized_string( $entry['meta_value'] ) ) {
|
||||
// this is a serialized string, so we should display it
|
||||
$entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
|
||||
} else {
|
||||
// this is a serialized array/object so we should NOT display it
|
||||
--$count;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$key_js = js_escape( $entry['meta_key'] );
|
||||
$entry['meta_key'] = attribute_escape($entry['meta_key']);
|
||||
$entry['meta_value'] = attribute_escape($entry['meta_value']);
|
||||
$entry['meta_id'] = (int) $entry['meta_id'];
|
||||
$r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
|
||||
$r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
|
||||
$r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
|
||||
$r .= "\n\t\t<td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".attribute_escape(__( 'Update' ))."' /><br />";
|
||||
$r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' onclick=\"return deleteSomething( 'meta', {$entry['meta_id']}, '";
|
||||
$r .= js_escape(sprintf( __("You are about to delete the '%s' custom field on this post.\n'OK' to delete, 'Cancel' to stop." ), $key_js ) );
|
||||
$r .= "' );\" class='deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' /></td>";
|
||||
$r .= "\n\t</tr>";
|
||||
}
|
||||
echo $r;
|
||||
echo "\n\t</tbody>";
|
||||
}
|
||||
|
||||
function meta_form() {
|
||||
global $wpdb;
|
||||
$limit = (int) apply_filters( 'postmeta_form_limit', 30 );
|
||||
$keys = $wpdb->get_col( "
|
||||
SELECT meta_key
|
||||
FROM $wpdb->postmeta
|
||||
WHERE meta_key NOT LIKE '\_%'
|
||||
GROUP BY meta_key
|
||||
ORDER BY meta_id DESC
|
||||
LIMIT $limit" );
|
||||
if ( $keys )
|
||||
natcasesort($keys);
|
||||
?>
|
||||
<h3><?php _e( 'Add a new custom field:' ) ?></h3>
|
||||
<table id="newmeta" cellspacing="3" cellpadding="3">
|
||||
<tr>
|
||||
<th colspan="2"><?php _e( 'Key' ) ?></th>
|
||||
<th><?php _e( 'Value' ) ?></th>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" width="18%">
|
||||
<?php if ( $keys ) : ?>
|
||||
<select id="metakeyselect" name="metakeyselect" tabindex="7">
|
||||
<option value="#NONE#"><?php _e( '- Select -' ); ?></option>
|
||||
<?php
|
||||
|
||||
foreach ( $keys as $key ) {
|
||||
$key = attribute_escape( $key );
|
||||
echo "\n\t<option value='$key'>$key</option>";
|
||||
}
|
||||
?>
|
||||
</select> <?php _e( 'or' ); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><input type="text" id="metakeyinput" name="metakeyinput" tabindex="7" /></td>
|
||||
<td><textarea id="metavalue" name="metavalue" rows="3" cols="25" tabindex="8"></textarea></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<p class="submit"><input type="submit" id="updatemetasub" name="updatemeta" tabindex="9" value="<?php _e( 'Add Custom Field »' ) ?>" /></p>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
function touch_time( $edit = 1, $for_post = 1, $tab_index = 0 ) {
|
||||
global $wp_locale, $post, $comment;
|
||||
|
||||
if ( $for_post )
|
||||
$edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true;
|
||||
|
||||
$tab_index_attribute = '';
|
||||
if ( (int) $tab_index > 0 )
|
||||
$tab_index_attribute = " tabindex=\"$tab_index\"";
|
||||
|
||||
echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> <label for="timestamp">'.__( 'Edit timestamp' ).'</label></legend>';
|
||||
|
||||
$time_adj = time() + (get_option( 'gmt_offset' ) * 3600 );
|
||||
$post_date = ($for_post) ? $post->post_date : $comment->comment_date;
|
||||
$jj = ($edit) ? mysql2date( 'd', $post_date ) : gmdate( 'd', $time_adj );
|
||||
$mm = ($edit) ? mysql2date( 'm', $post_date ) : gmdate( 'm', $time_adj );
|
||||
$aa = ($edit) ? mysql2date( 'Y', $post_date ) : gmdate( 'Y', $time_adj );
|
||||
$hh = ($edit) ? mysql2date( 'H', $post_date ) : gmdate( 'H', $time_adj );
|
||||
$mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj );
|
||||
$ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj );
|
||||
|
||||
echo "<select name=\"mm\" onchange=\"edit_date.checked=true\"$tab_index_attribute>\n";
|
||||
for ( $i = 1; $i < 13; $i = $i +1 ) {
|
||||
echo "\t\t\t<option value=\"$i\"";
|
||||
if ( $i == $mm )
|
||||
echo ' selected="selected"';
|
||||
echo '>' . $wp_locale->get_month( $i ) . "</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" onchange="edit_date.checked=true"<?php echo $tab_index_attribute ?> />
|
||||
<input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true"<?php echo $tab_index_attribute ?> /> @
|
||||
<input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true"<?php echo $tab_index_attribute ?> /> :
|
||||
<input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true"<?php echo $tab_index_attribute ?> />
|
||||
<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
|
||||
<?php
|
||||
if ( $edit ) {
|
||||
printf( _c( 'Existing timestamp: %1$s %2$s, %3$s @ %4$s:%5$s|1: month, 2: month string, 3: full year, 4: hours, 5: minutes' ), $wp_locale->get_month( $mm ), $jj, $aa, $hh, $mn );
|
||||
}
|
||||
?>
|
||||
</fieldset>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
function page_template_dropdown( $default = '' ) {
|
||||
$templates = get_page_templates();
|
||||
ksort( $templates );
|
||||
foreach (array_keys( $templates ) as $template )
|
||||
: if ( $default == $templates[$template] )
|
||||
$selected = " selected='selected'";
|
||||
else
|
||||
$selected = '';
|
||||
echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";
|
||||
endforeach;
|
||||
}
|
||||
|
||||
function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
|
||||
global $wpdb, $post_ID;
|
||||
$items = $wpdb->get_results( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order" );
|
||||
|
||||
if ( $items ) {
|
||||
foreach ( $items as $item ) {
|
||||
// A page cannot be its own parent.
|
||||
if (!empty ( $post_ID ) ) {
|
||||
if ( $item->ID == $post_ID ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$pad = str_repeat( ' ', $level * 3 );
|
||||
if ( $item->ID == $default)
|
||||
$current = ' selected="selected"';
|
||||
else
|
||||
$current = '';
|
||||
|
||||
echo "\n\t<option value='$item->ID'$current>$pad $item->post_title</option>";
|
||||
parent_dropdown( $default, $item->ID, $level +1 );
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function browse_happy() {
|
||||
$getit = __( 'WordPress recommends a better browser' );
|
||||
echo '
|
||||
<p id="bh" style="text-align: center;"><a href="http://browsehappy.com/" title="'.$getit.'"><img src="images/browse-happy.gif" alt="Browse Happy" /></a></p>
|
||||
';
|
||||
}
|
||||
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)
|
||||
add_action( 'admin_footer', 'browse_happy' );
|
||||
|
||||
function the_attachment_links( $id = false ) {
|
||||
$id = (int) $id;
|
||||
$post = & get_post( $id );
|
||||
|
||||
if ( $post->post_type != 'attachment' )
|
||||
return false;
|
||||
|
||||
$icon = get_attachment_icon( $post->ID );
|
||||
$attachment_data = wp_get_attachment_metadata( $id );
|
||||
$thumb = isset( $attachment_data['thumb'] );
|
||||
?>
|
||||
<form id="the-attachment-links">
|
||||
<table>
|
||||
<col />
|
||||
<col class="widefat" />
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'URL' ) ?></th>
|
||||
<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><?php echo wp_get_attachment_url(); ?></textarea></td>
|
||||
</tr>
|
||||
<?php if ( $icon ) : ?>
|
||||
<tr>
|
||||
<th scope="row"><?php $thumb ? _e( 'Thumbnail linked to file' ) : _e( 'Image linked to file' ); ?></th>
|
||||
<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>"><?php echo $icon ?></a></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php $thumb ? _e( 'Thumbnail linked to page' ) : _e( 'Image linked to page' ); ?></th>
|
||||
<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link( $post->ID ) ?>" rel="attachment wp-att-<?php echo $post->ID; ?>"><?php echo $icon ?></a></textarea></td>
|
||||
</tr>
|
||||
<?php else : ?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Link to file' ) ?></th>
|
||||
<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>" class="attachmentlink"><?php echo basename( wp_get_attachment_url() ); ?></a></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Link to page' ) ?></th>
|
||||
<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link( $post->ID ) ?>" rel="attachment wp-att-<?php echo $post->ID ?>"><?php the_title(); ?></a></textarea></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
function wp_dropdown_roles( $default = false ) {
|
||||
global $wp_roles;
|
||||
$r = '';
|
||||
foreach( $wp_roles->role_names as $role => $name )
|
||||
if ( $default == $role ) // Make default first in list
|
||||
$p = "\n\t<option selected='selected' value='$role'>$name</option>";
|
||||
else
|
||||
$r .= "\n\t<option value='$role'>$name</option>";
|
||||
echo $p . $r;
|
||||
}
|
||||
|
||||
function wp_convert_hr_to_bytes( $size ) {
|
||||
$size = strtolower($size);
|
||||
$bytes = (int) $size;
|
||||
if ( strpos($size, 'k') !== false )
|
||||
$bytes = intval($size) * 1024;
|
||||
elseif ( strpos($size, 'm') !== false )
|
||||
$bytes = intval($size) * 1024 * 1024;
|
||||
elseif ( strpos($size, 'g') !== false )
|
||||
$bytes = intval($size) * 1024 * 1024 * 1024;
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
function wp_convert_bytes_to_hr( $bytes ) {
|
||||
$units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' );
|
||||
$log = log( $bytes, 1024 );
|
||||
$power = (int) $log;
|
||||
$size = pow(1024, $log - $power);
|
||||
return $size . $units[$power];
|
||||
}
|
||||
|
||||
function wp_import_upload_form( $action ) {
|
||||
$u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
|
||||
$p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
|
||||
$bytes = apply_filters( 'import_upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes );
|
||||
$size = wp_convert_bytes_to_hr( $bytes );
|
||||
?>
|
||||
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>">
|
||||
<p>
|
||||
<?php wp_nonce_field('import-upload'); ?>
|
||||
<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
|
||||
<input type="file" id="upload" name="import" size="25" />
|
||||
<input type="hidden" name="action" value="save" />
|
||||
<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
|
||||
</p>
|
||||
<p class="submit">
|
||||
<input type="submit" value="<?php _e( 'Upload file and import »' ); ?>" />
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
function wp_remember_old_slug() {
|
||||
global $post;
|
||||
$name = attribute_escape($post->post_name); // just in case
|
||||
if ( strlen($name) )
|
||||
echo '<input type="hidden" id="wp-old-slug" name="wp-old-slug" value="' . $name . '" />';
|
||||
}
|
||||
|
||||
?>
|
||||
52
wp-admin/includes/theme.php
Normal file
52
wp-admin/includes/theme.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
function current_theme_info() {
|
||||
$themes = get_themes();
|
||||
$current_theme = get_current_theme();
|
||||
$ct->name = $current_theme;
|
||||
$ct->title = $themes[$current_theme]['Title'];
|
||||
$ct->version = $themes[$current_theme]['Version'];
|
||||
$ct->parent_theme = $themes[$current_theme]['Parent Theme'];
|
||||
$ct->template_dir = $themes[$current_theme]['Template Dir'];
|
||||
$ct->stylesheet_dir = $themes[$current_theme]['Stylesheet Dir'];
|
||||
$ct->template = $themes[$current_theme]['Template'];
|
||||
$ct->stylesheet = $themes[$current_theme]['Stylesheet'];
|
||||
$ct->screenshot = $themes[$current_theme]['Screenshot'];
|
||||
$ct->description = $themes[$current_theme]['Description'];
|
||||
$ct->author = $themes[$current_theme]['Author'];
|
||||
return $ct;
|
||||
}
|
||||
|
||||
function get_broken_themes() {
|
||||
global $wp_broken_themes;
|
||||
|
||||
get_themes();
|
||||
return $wp_broken_themes;
|
||||
}
|
||||
|
||||
function get_page_templates() {
|
||||
$themes = get_themes();
|
||||
$theme = get_current_theme();
|
||||
$templates = $themes[$theme]['Template Files'];
|
||||
$page_templates = array ();
|
||||
|
||||
if ( is_array( $templates ) ) {
|
||||
foreach ( $templates as $template ) {
|
||||
$template_data = implode( '', file( ABSPATH.$template ));
|
||||
|
||||
preg_match( '|Template Name:(.*)$|mi', $template_data, $name );
|
||||
preg_match( '|Description:(.*)$|mi', $template_data, $description );
|
||||
|
||||
$name = $name[1];
|
||||
$description = $description[1];
|
||||
|
||||
if ( !empty( $name ) ) {
|
||||
$page_templates[trim( $name )] = basename( $template );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $page_templates;
|
||||
}
|
||||
|
||||
?>
|
||||
122
wp-admin/includes/update.php
Normal file
122
wp-admin/includes/update.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
// The admin side of our 1.0 update system
|
||||
|
||||
function core_update_footer( $msg ) {
|
||||
if ( !current_user_can('manage_options') )
|
||||
return sprintf( '| '.__( 'Version %s' ), $GLOBALS['wp_version'] );
|
||||
|
||||
$cur = get_option( 'update_core' );
|
||||
|
||||
switch ( $cur->response ) {
|
||||
case 'development' :
|
||||
return sprintf( '| '.__( 'You are using a development version (%s). Cool! Please <a href="%s">stay updated</a>.' ), $GLOBALS['wp_version'], 'http://wordpress.org/download/svn/' );
|
||||
break;
|
||||
|
||||
case 'upgrade' :
|
||||
return sprintf( '| <strong>'.__( 'Your WordPress %s is out of date. <a href="%s">Please update</a>.' ).'</strong>', $GLOBALS['wp_version'], $cur->url );
|
||||
break;
|
||||
|
||||
case 'latest' :
|
||||
default :
|
||||
return sprintf( '| '.__( 'Version %s' ), $GLOBALS['wp_version'] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
add_filter( 'update_footer', 'core_update_footer' );
|
||||
|
||||
function update_nag() {
|
||||
$cur = get_option( 'update_core' );
|
||||
|
||||
if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
|
||||
return false;
|
||||
|
||||
if ( current_user_can('manage_options') )
|
||||
$msg = sprintf( __('A new version of WordPress is available! <a href="%s">Please update now</a>.'), $cur->url );
|
||||
else
|
||||
$msg = __('A new version of WordPress is available! Please notify the site administrator.');
|
||||
|
||||
echo "<div id='update-nag'>$msg</div>";
|
||||
}
|
||||
add_action( 'admin_notices', 'update_nag', 3 );
|
||||
|
||||
function wp_update_plugins() {
|
||||
global $wp_version;
|
||||
|
||||
if ( !function_exists('fsockopen') )
|
||||
return false;
|
||||
|
||||
$plugins = get_plugins();
|
||||
$active = get_option( 'active_plugins' );
|
||||
$current = get_option( 'update_plugins' );
|
||||
|
||||
$new_option = '';
|
||||
$new_option->last_checked = time();
|
||||
|
||||
$plugin_changed = false;
|
||||
foreach ( $plugins as $file => $p ) {
|
||||
$new_option->checked[ $file ] = $p['Version'];
|
||||
|
||||
if ( !isset( $current->checked[ $file ] ) ) {
|
||||
$plugin_changed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $current->checked[ $file ] != $p['Version'] )
|
||||
$plugin_changed = true;
|
||||
}
|
||||
|
||||
if (
|
||||
isset( $current->last_checked ) &&
|
||||
43200 > ( time() - $current->last_checked ) &&
|
||||
!$plugin_changed
|
||||
)
|
||||
return false;
|
||||
|
||||
$to_send->plugins = $plugins;
|
||||
$to_send->active = $active;
|
||||
$send = serialize( $to_send );
|
||||
|
||||
$request = 'plugins=' . urlencode( $send );
|
||||
$http_request = "POST /plugins/update-check/1.0/ HTTP/1.0\r\n";
|
||||
$http_request .= "Host: api.wordpress.org\r\n";
|
||||
$http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n";
|
||||
$http_request .= "Content-Length: " . strlen($request) . "\r\n";
|
||||
$http_request .= 'User-Agent: WordPress/' . $wp_version . '; ' . get_bloginfo('url') . "\r\n";
|
||||
$http_request .= "\r\n";
|
||||
$http_request .= $request;
|
||||
|
||||
$response = '';
|
||||
if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) && is_resource($fs) ) {
|
||||
fwrite($fs, $http_request);
|
||||
|
||||
while ( !feof($fs) )
|
||||
$response .= fgets($fs, 1160); // One TCP-IP packet
|
||||
fclose($fs);
|
||||
$response = explode("\r\n\r\n", $response, 2);
|
||||
}
|
||||
|
||||
$response = unserialize( $response[1] );
|
||||
|
||||
if ( $response )
|
||||
$new_option->response = $response;
|
||||
|
||||
update_option( 'update_plugins', $new_option );
|
||||
}
|
||||
add_action( 'load-plugins.php', 'wp_update_plugins' );
|
||||
|
||||
function wp_plugin_update_row( $file ) {
|
||||
global $plugin_data;
|
||||
$current = get_option( 'update_plugins' );
|
||||
if ( !isset( $current->response[ $file ] ) )
|
||||
return false;
|
||||
|
||||
$r = $current->response[ $file ];
|
||||
|
||||
echo "<tr><td colspan='5' class='plugin-update'>";
|
||||
printf( __('There is a new version of %s available. <a href="%s">Download version %s here</a>.'), $plugin_data['Name'], $r->url, $r->new_version );
|
||||
echo "</td></tr>";
|
||||
}
|
||||
add_action( 'after_plugin_row', 'wp_plugin_update_row' );
|
||||
|
||||
?>
|
||||
1262
wp-admin/includes/upgrade.php
Normal file
1262
wp-admin/includes/upgrade.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
function wp_upload_display( $dims = false, $href = '' ) {
|
||||
global $post;
|
||||
$id = get_the_ID();
|
||||
$attachment_data = wp_get_attachment_metadata( $id );
|
||||
$is_image = (int) wp_attachment_is_image();
|
||||
$filesystem_path = get_attached_file( $id );
|
||||
if ( !isset($attachment_data['width']) && $is_image ) {
|
||||
if ( $image_data = getimagesize( get_attached_file( $id ) ) ) {
|
||||
if ( $image_data = getimagesize( $filesystem_path ) ) {
|
||||
$attachment_data['width'] = $image_data[0];
|
||||
$attachment_data['height'] = $image_data[1];
|
||||
wp_update_attachment_metadata( $id, $attachment_data );
|
||||
@@ -14,10 +16,7 @@ function wp_upload_display( $dims = false, $href = '' ) {
|
||||
if ( isset($attachment_data['width']) )
|
||||
list($width,$height) = wp_shrink_dimensions($attachment_data['width'], $attachment_data['height'], 171, 128);
|
||||
|
||||
ob_start();
|
||||
the_title();
|
||||
$post_title = attribute_escape(ob_get_contents());
|
||||
ob_end_clean();
|
||||
$post_title = attribute_escape( the_title( '', '', false ) );
|
||||
$post_content = attribute_escape(apply_filters( 'content_edit_pre', $post->post_content ));
|
||||
|
||||
$class = 'text';
|
||||
@@ -40,6 +39,7 @@ function wp_upload_display( $dims = false, $href = '' ) {
|
||||
$r .= "\t\t\t$innerHTML";
|
||||
if ( $href )
|
||||
$r .= "</a>\n";
|
||||
$r .= "\t\t\t\t<span class='upload-file-size'>".size_format(filesize($filesystem_path))."</span>\n";
|
||||
$r .= "\n\t\t<div class='upload-file-data'>\n\t\t\t<p>\n";
|
||||
$r .= "\t\t\t\t<input type='hidden' name='attachment-url-$id' id='attachment-url-$id' value='$src' />\n";
|
||||
$r .= "\t\t\t\t<input type='hidden' name='attachment-url-base-$id' id='attachment-url-base-$id' value='$src_base' />\n";
|
||||
@@ -172,7 +172,7 @@ function wp_upload_form() {
|
||||
<?php endif; ?>
|
||||
<?php wp_nonce_field( 'inlineuploading' ); ?>
|
||||
<div class="submit">
|
||||
<input type="submit" value="<?php $id ? _e('Save') : _e('Upload'); ?> »" />
|
||||
<input type="submit" value="<?php $id ? _e('Save »') : _e('Upload »'); ?>" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -222,7 +222,7 @@ function wp_upload_tab_upload_action() {
|
||||
|
||||
// Construct the attachment array
|
||||
$attachment = array(
|
||||
'post_title' => $post_title ? $post_title : $filename,
|
||||
'post_title' => $post_title,
|
||||
'post_content' => $post_content,
|
||||
'post_type' => 'attachment',
|
||||
'post_parent' => $post_id,
|
||||
@@ -284,7 +284,7 @@ function wp_upload_posts_where( $where ) {
|
||||
}
|
||||
|
||||
function wp_upload_tab_browse() {
|
||||
global $wpdb, $action, $paged;
|
||||
global $action, $paged;
|
||||
$old_vars = compact( 'paged' );
|
||||
|
||||
switch ( $action ) :
|
||||
@@ -301,11 +301,7 @@ function wp_upload_tab_browse() {
|
||||
add_action( 'pre_get_posts', 'wp_upload_grab_attachments' );
|
||||
if ( 'browse' == $tab && $post_id )
|
||||
add_filter( 'posts_where', 'wp_upload_posts_where' );
|
||||
$attachments = query_posts("what_to_show=posts&posts_per_page=10&paged=$paged");
|
||||
$count_query = "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment'";
|
||||
if ( $post_id )
|
||||
$count_query .= " AND post_parent = '$post_id'";
|
||||
$total = $wpdb->get_var($count_query);
|
||||
$attachments = query_posts("what_to_show=posts&post_status=any&posts_per_page=10&paged=$paged");
|
||||
|
||||
echo "<ul id='upload-files'>\n";
|
||||
if ( have_posts() ) : while ( have_posts() ) : the_post();
|
||||
@@ -343,10 +339,7 @@ add_action( 'upload_files_browse', 'wp_upload_tab_browse_action' );
|
||||
add_action( 'upload_files_browse-all', 'wp_upload_tab_browse_action' );
|
||||
|
||||
function wp_upload_admin_head() {
|
||||
global $wp_locale;
|
||||
echo "<link rel='stylesheet' href='" . get_option('siteurl') . '/wp-admin/upload.css?version=' . get_bloginfo('version') . "a' type='text/css' />\n";
|
||||
if ( 'rtl' == $wp_locale->text_direction )
|
||||
echo "<link rel='stylesheet' href='" . get_option('siteurl') . '/wp-admin/upload-rtl.css?version=' . get_bloginfo('version') . "a' type='text/css' />\n";
|
||||
wp_admin_css( 'css/upload' );
|
||||
if ( 'inline' == @$_GET['style'] ) {
|
||||
echo "<style type='text/css' media='screen'>\n";
|
||||
echo "\t#upload-menu { position: absolute; z-index: 2; }\n";
|
||||
@@ -357,4 +350,4 @@ function wp_upload_admin_head() {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
282
wp-admin/includes/user.php
Normal file
282
wp-admin/includes/user.php
Normal file
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
|
||||
// Creates a new user from the "Users" form using $_POST information.
|
||||
function add_user() {
|
||||
if ( func_num_args() ) { // The hackiest hack that ever did hack
|
||||
global $current_user, $wp_roles;
|
||||
$user_id = (int) func_get_arg( 0 );
|
||||
|
||||
if ( isset( $_POST['role'] ) ) {
|
||||
if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ) ) {
|
||||
$user = new WP_User( $user_id );
|
||||
$user->set_role( $_POST['role'] );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
add_action( 'user_register', 'add_user' ); // See above
|
||||
return edit_user();
|
||||
}
|
||||
}
|
||||
|
||||
function edit_user( $user_id = 0 ) {
|
||||
global $current_user, $wp_roles, $wpdb;
|
||||
if ( $user_id != 0 ) {
|
||||
$update = true;
|
||||
$user->ID = (int) $user_id;
|
||||
$userdata = get_userdata( $user_id );
|
||||
$user->user_login = $wpdb->escape( $userdata->user_login );
|
||||
} else {
|
||||
$update = false;
|
||||
$user = '';
|
||||
}
|
||||
|
||||
if ( isset( $_POST['user_login'] ))
|
||||
$user->user_login = wp_specialchars( trim( $_POST['user_login'] ));
|
||||
|
||||
$pass1 = $pass2 = '';
|
||||
if ( isset( $_POST['pass1'] ))
|
||||
$pass1 = $_POST['pass1'];
|
||||
if ( isset( $_POST['pass2'] ))
|
||||
$pass2 = $_POST['pass2'];
|
||||
|
||||
if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) {
|
||||
if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ))
|
||||
$user->role = $_POST['role'];
|
||||
}
|
||||
|
||||
if ( isset( $_POST['email'] ))
|
||||
$user->user_email = wp_specialchars( trim( $_POST['email'] ));
|
||||
if ( isset( $_POST['url'] ) ) {
|
||||
$user->user_url = clean_url( trim( $_POST['url'] ));
|
||||
$user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url;
|
||||
}
|
||||
if ( isset( $_POST['first_name'] ))
|
||||
$user->first_name = wp_specialchars( trim( $_POST['first_name'] ));
|
||||
if ( isset( $_POST['last_name'] ))
|
||||
$user->last_name = wp_specialchars( trim( $_POST['last_name'] ));
|
||||
if ( isset( $_POST['nickname'] ))
|
||||
$user->nickname = wp_specialchars( trim( $_POST['nickname'] ));
|
||||
if ( isset( $_POST['display_name'] ))
|
||||
$user->display_name = wp_specialchars( trim( $_POST['display_name'] ));
|
||||
if ( isset( $_POST['description'] ))
|
||||
$user->description = trim( $_POST['description'] );
|
||||
if ( isset( $_POST['jabber'] ))
|
||||
$user->jabber = wp_specialchars( trim( $_POST['jabber'] ));
|
||||
if ( isset( $_POST['aim'] ))
|
||||
$user->aim = wp_specialchars( trim( $_POST['aim'] ));
|
||||
if ( isset( $_POST['yim'] ))
|
||||
$user->yim = wp_specialchars( trim( $_POST['yim'] ));
|
||||
if ( !$update )
|
||||
$user->rich_editing = 'true'; // Default to true for new users.
|
||||
else if ( isset( $_POST['rich_editing'] ) )
|
||||
$user->rich_editing = $_POST['rich_editing'];
|
||||
else
|
||||
$user->rich_editing = 'false';
|
||||
|
||||
$errors = new WP_Error();
|
||||
|
||||
/* checking that username has been typed */
|
||||
if ( $user->user_login == '' )
|
||||
$errors->add( 'user_login', __( '<strong>ERROR</strong>: Please enter a username.' ));
|
||||
|
||||
/* checking the password has been typed twice */
|
||||
do_action_ref_array( 'check_passwords', array ( $user->user_login, & $pass1, & $pass2 ));
|
||||
|
||||
if (!$update ) {
|
||||
if ( $pass1 == '' || $pass2 == '' )
|
||||
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter your password twice.' ));
|
||||
} else {
|
||||
if ((empty ( $pass1 ) && !empty ( $pass2 ) ) || (empty ( $pass2 ) && !empty ( $pass1 ) ) )
|
||||
$errors->add( 'pass', __( "<strong>ERROR</strong>: you typed your new password only once." ));
|
||||
}
|
||||
|
||||
/* Check for "\" in password */
|
||||
if( strpos( " ".$pass1, "\\" ) )
|
||||
$errors->add( 'pass', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ));
|
||||
|
||||
/* checking the password has been typed twice the same */
|
||||
if ( $pass1 != $pass2 )
|
||||
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please type the same password in the two password fields.' ));
|
||||
|
||||
if (!empty ( $pass1 ))
|
||||
$user->user_pass = $pass1;
|
||||
|
||||
if ( !$update && !validate_username( $user->user_login ) )
|
||||
$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid. Please enter a valid username.' ));
|
||||
|
||||
if (!$update && username_exists( $user->user_login ))
|
||||
$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered, please choose another one.' ));
|
||||
|
||||
/* checking e-mail address */
|
||||
if ( empty ( $user->user_email ) ) {
|
||||
$errors->add( 'user_email', __( "<strong>ERROR</strong>: please type an e-mail address" ));
|
||||
} else
|
||||
if (!is_email( $user->user_email ) ) {
|
||||
$errors->add( 'user_email', __( "<strong>ERROR</strong>: the email address isn't correct" ));
|
||||
}
|
||||
|
||||
if ( $errors->get_error_codes() )
|
||||
return $errors;
|
||||
|
||||
if ( $update ) {
|
||||
$user_id = wp_update_user( get_object_vars( $user ));
|
||||
} else {
|
||||
$user_id = wp_insert_user( get_object_vars( $user ));
|
||||
wp_new_user_notification( $user_id );
|
||||
}
|
||||
return $user_id;
|
||||
}
|
||||
|
||||
function get_author_user_ids() {
|
||||
global $wpdb;
|
||||
$level_key = $wpdb->prefix . 'user_level';
|
||||
|
||||
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value != '0'";
|
||||
|
||||
return $wpdb->get_col( $query );
|
||||
}
|
||||
|
||||
function get_editable_authors( $user_id ) {
|
||||
global $wpdb;
|
||||
|
||||
$editable = get_editable_user_ids( $user_id );
|
||||
|
||||
if( !$editable ) {
|
||||
return false;
|
||||
} else {
|
||||
$editable = join(',', $editable);
|
||||
$authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
|
||||
}
|
||||
|
||||
return apply_filters('get_editable_authors', $authors);
|
||||
}
|
||||
|
||||
function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
|
||||
global $wpdb;
|
||||
|
||||
$user = new WP_User( $user_id );
|
||||
|
||||
if ( ! $user->has_cap('edit_others_posts') ) {
|
||||
if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
|
||||
return array($user->id);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
$level_key = $wpdb->prefix . 'user_level';
|
||||
|
||||
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
|
||||
if ( $exclude_zeros )
|
||||
$query .= " AND meta_value != '0'";
|
||||
|
||||
return $wpdb->get_col( $query );
|
||||
}
|
||||
|
||||
function get_nonauthor_user_ids() {
|
||||
global $wpdb;
|
||||
$level_key = $wpdb->prefix . 'user_level';
|
||||
|
||||
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value = '0'";
|
||||
|
||||
return $wpdb->get_col( $query );
|
||||
}
|
||||
|
||||
function get_others_unpublished_posts($user_id, $type='any') {
|
||||
global $wpdb;
|
||||
$user = get_userdata( $user_id );
|
||||
$level_key = $wpdb->prefix . 'user_level';
|
||||
|
||||
$editable = get_editable_user_ids( $user_id );
|
||||
|
||||
if ( in_array($type, array('draft', 'pending')) )
|
||||
$type_sql = " post_status = '$type' ";
|
||||
else
|
||||
$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
|
||||
|
||||
$dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
|
||||
|
||||
if( !$editable ) {
|
||||
$other_unpubs = '';
|
||||
} else {
|
||||
$editable = join(',', $editable);
|
||||
$other_unpubs = $wpdb->get_results("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != '$user_id' ORDER BY post_modified $dir");
|
||||
}
|
||||
|
||||
return apply_filters('get_others_drafts', $other_unpubs);
|
||||
}
|
||||
|
||||
function get_others_drafts($user_id) {
|
||||
return get_others_unpublished_posts($user_id, 'draft');
|
||||
}
|
||||
|
||||
function get_others_pending($user_id) {
|
||||
return get_others_unpublished_posts($user_id, 'pending');
|
||||
}
|
||||
|
||||
function get_user_to_edit( $user_id ) {
|
||||
$user = new WP_User( $user_id );
|
||||
$user->user_login = attribute_escape($user->user_login);
|
||||
$user->user_email = attribute_escape($user->user_email);
|
||||
$user->user_url = clean_url($user->user_url);
|
||||
$user->first_name = attribute_escape($user->first_name);
|
||||
$user->last_name = attribute_escape($user->last_name);
|
||||
$user->display_name = attribute_escape($user->display_name);
|
||||
$user->nickname = attribute_escape($user->nickname);
|
||||
$user->aim = attribute_escape($user->aim);
|
||||
$user->yim = attribute_escape($user->yim);
|
||||
$user->jabber = attribute_escape($user->jabber);
|
||||
$user->description = wp_specialchars($user->description);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
function get_users_drafts( $user_id ) {
|
||||
global $wpdb;
|
||||
$user_id = (int) $user_id;
|
||||
$query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = $user_id ORDER BY post_modified DESC";
|
||||
$query = apply_filters('get_users_drafts', $query);
|
||||
return $wpdb->get_results( $query );
|
||||
}
|
||||
|
||||
function wp_delete_user($id, $reassign = 'novalue') {
|
||||
global $wpdb;
|
||||
|
||||
$id = (int) $id;
|
||||
$user = get_userdata($id);
|
||||
|
||||
if ($reassign == 'novalue') {
|
||||
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
|
||||
|
||||
if ($post_ids) {
|
||||
foreach ($post_ids as $post_id)
|
||||
wp_delete_post($post_id);
|
||||
}
|
||||
|
||||
// Clean links
|
||||
$wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
|
||||
} else {
|
||||
$reassign = (int) $reassign;
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_author = {$reassign} WHERE post_author = {$id}");
|
||||
$wpdb->query("UPDATE $wpdb->links SET link_owner = {$reassign} WHERE link_owner = {$id}");
|
||||
}
|
||||
|
||||
// FINALLY, delete user
|
||||
do_action('delete_user', $id);
|
||||
|
||||
$wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
|
||||
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$id'");
|
||||
|
||||
wp_cache_delete($id, 'users');
|
||||
wp_cache_delete($user->user_login, 'userlogins');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function wp_revoke_user($id) {
|
||||
$id = (int) $id;
|
||||
|
||||
$user = new WP_User($id);
|
||||
$user->remove_all_caps();
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -2,15 +2,19 @@
|
||||
require_once('admin.php');
|
||||
require_once (ABSPATH . WPINC . '/rss.php');
|
||||
|
||||
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
|
||||
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
|
||||
|
||||
switch ( $_GET['jax'] ) {
|
||||
|
||||
case 'incominglinks' :
|
||||
$rss = @fetch_rss('http://feeds.technorati.com/cosmos/rss/?url='. trailingslashit(get_option('home')) .'&partner=wordpress');
|
||||
|
||||
$rss_feed = apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) );
|
||||
$more_link = apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) );
|
||||
|
||||
$rss = @fetch_rss( $rss_feed );
|
||||
if ( isset($rss->items) && 1 < count($rss->items) ) { // Technorati returns a 1-item feed when it has no results
|
||||
?>
|
||||
<h3><?php _e('Incoming Links'); ?> <cite><a href="http://www.technorati.com/search/<?php echo trailingslashit(get_option('home')); ?>?partner=wordpress"><?php _e('More »'); ?></a></cite></h3>
|
||||
<h3><?php _e('Incoming Links'); ?> <cite><a href="<?php echo htmlspecialchars( $more_link ); ?>"><?php _e('More »'); ?></a></cite></h3>
|
||||
<ul>
|
||||
<?php
|
||||
$rss->items = array_slice($rss->items, 0, 10);
|
||||
@@ -24,10 +28,10 @@ foreach ($rss->items as $item ) {
|
||||
break;
|
||||
|
||||
case 'devnews' :
|
||||
$rss = @fetch_rss('http://wordpress.org/development/feed/');
|
||||
$rss = @fetch_rss(apply_filters( 'dashboard_primary_feed', 'http://wordpress.org/development/feed/' ));
|
||||
if ( isset($rss->items) && 0 != count($rss->items) ) {
|
||||
?>
|
||||
<h3><?php _e('WordPress Development Blog'); ?></h3>
|
||||
<h3><?php echo apply_filters( 'dashboard_primary_title', __('WordPress Development Blog') ); ?></h3>
|
||||
<?php
|
||||
$rss->items = array_slice($rss->items, 0, 3);
|
||||
foreach ($rss->items as $item ) {
|
||||
@@ -43,10 +47,10 @@ foreach ($rss->items as $item ) {
|
||||
break;
|
||||
|
||||
case 'planetnews' :
|
||||
$rss = @fetch_rss('http://planet.wordpress.org/feed/');
|
||||
$rss = @fetch_rss(apply_filters( 'dashboard_secondary_feed', 'http://planet.wordpress.org/feed/' ));
|
||||
if ( isset($rss->items) && 0 != count($rss->items) ) {
|
||||
?>
|
||||
<h3><?php _e('Other WordPress News'); ?></h3>
|
||||
<h3><?php echo apply_filters( 'dashboard_secondary_title', __('Other WordPress News') ); ?></h3>
|
||||
<ul>
|
||||
<?php
|
||||
$rss->items = array_slice($rss->items, 0, 20);
|
||||
@@ -60,7 +64,7 @@ $post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<p class="readmore"><a href="http://planet.wordpress.org/"><?php _e('Read more'); ?> »</a></p>
|
||||
<p class="readmore"><a href="<?php echo apply_filters( 'dashboard_secondary_link', 'http://planet.wordpress.org/' ); ?>"><?php _e('Read more »'); ?></a></p>
|
||||
<?php
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
<?php
|
||||
require_once('admin.php');
|
||||
require_once('admin.php');
|
||||
|
||||
function index_js() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
Event.observe( window, 'load', dashboard_init, false );
|
||||
function dashboard_init() {
|
||||
var update1 = new Ajax.Updater( 'incominglinks', 'index-extra.php?jax=incominglinks' );
|
||||
var update2 = new Ajax.Updater( 'devnews', 'index-extra.php?jax=devnews' );
|
||||
var update3 = new Ajax.Updater( 'planetnews', 'index-extra.php?jax=planetnews' );
|
||||
}
|
||||
jQuery(function() {
|
||||
jQuery('#incominglinks').load('index-extra.php?jax=incominglinks');
|
||||
jQuery('#devnews').load('index-extra.php?jax=devnews');
|
||||
jQuery('#planetnews').load('index-extra.php?jax=planetnews');
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
add_action( 'admin_head', 'index_js' );
|
||||
wp_enqueue_script('prototype');
|
||||
wp_enqueue_script('interface');
|
||||
|
||||
$title = __('Dashboard');
|
||||
wp_enqueue_script( 'jquery' );
|
||||
|
||||
$title = __('Dashboard');
|
||||
$parent_file = 'index.php';
|
||||
require_once('admin-header.php');
|
||||
|
||||
@@ -40,17 +39,17 @@ $numcomments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE commen
|
||||
if ( $comments || $numcomments ) :
|
||||
?>
|
||||
<div>
|
||||
<h3><?php _e('Comments'); ?> <a href="edit-comments.php" title="<?php _e('More comments...'); ?>">»</a></h3>
|
||||
<h3><?php printf( __( 'Comments <a href="%s" title="More comments…">»</a>' ), 'edit-comments.php' ); ?></h3>
|
||||
|
||||
<?php if ( $numcomments ) : ?>
|
||||
<p><strong><a href="moderation.php"><?php echo sprintf(__('Comments in moderation (%s)'), number_format($numcomments) ); ?> »</a></strong></p>
|
||||
<p><strong><a href="moderation.php"><?php echo sprintf(__('Comments in moderation (%s) »'), number_format_i18n($numcomments) ); ?></a></strong></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
if ( $comments ) {
|
||||
foreach ($comments as $comment) {
|
||||
echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . apply_filters('the_title', get_the_title($comment->comment_post_ID)) . '</a>');
|
||||
echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
|
||||
edit_comment_link(__("Edit"), ' <small>(', ')</small>');
|
||||
echo '</li>';
|
||||
}
|
||||
@@ -64,7 +63,7 @@ foreach ($comments as $comment) {
|
||||
if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql('post') . " AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) :
|
||||
?>
|
||||
<div>
|
||||
<h3><?php _e('Posts'); ?> <a href="edit.php" title="<?php _e('More posts...'); ?>">»</a></h3>
|
||||
<h3><?php printf( __( 'Posts <a href="%s" title="More posts…">»</a>' ), 'edit.php' ); ?></h3>
|
||||
<ul>
|
||||
<?php
|
||||
foreach ($recentposts as $post) {
|
||||
@@ -101,14 +100,16 @@ foreach ($scheduled as $post) {
|
||||
<?php
|
||||
$numposts = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'");
|
||||
$numcomms = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
|
||||
$numcats = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
|
||||
$numcats = wp_count_terms('category');
|
||||
$numtags = wp_count_terms('post_tag');
|
||||
|
||||
$post_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Posts">post</a>', '%1$s <a href="%2$s" title="Posts">posts</a>', $numposts), number_format($numposts), 'edit.php');
|
||||
$comm_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Comments">comment</a>', '%1$s <a href="%2$s" title="Comments">comments</a>', $numcomms), number_format($numcomms), 'edit-comments.php');
|
||||
$cat_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Categories">category</a>', '%1$s <a href="%2$s" title="Categories">categories</a>', $numcats), number_format($numcats), 'categories.php');
|
||||
$post_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Posts">post</a>', '%1$s <a href="%2$s" title="Posts">posts</a>', $numposts), number_format_i18n($numposts), 'edit.php');
|
||||
$comm_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Comments">comment</a>', '%1$s <a href="%2$s" title="Comments">comments</a>', $numcomms), number_format_i18n($numcomms), 'edit-comments.php');
|
||||
$cat_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Categories">category</a>', '%1$s <a href="%2$s" title="Categories">categories</a>', $numcats), number_format_i18n($numcats), 'categories.php');
|
||||
$tag_str = sprintf(__ngettext('%1$s tag', '%1$s tags', $numtags), number_format_i18n($numtags));
|
||||
?>
|
||||
|
||||
<p><?php printf(__('There are currently %1$s and %2$s, contained within %3$s.'), $post_str, $comm_str, $cat_str); ?></p>
|
||||
<p><?php printf(__('There are currently %1$s and %2$s, contained within %3$s and %4$s.'), $post_str, $comm_str, $cat_str, $tag_str); ?></p>
|
||||
</div>
|
||||
|
||||
<?php do_action('activity_box_end'); ?>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
body { font-family: Tahoma, Georgia, "Times New Roman", Times, serif; }
|
||||
|
||||
ul, ol { padding: 5px 20px 5px 5px; }
|
||||
|
||||
.step, th { text-align: left; }
|
||||
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
define('WP_INSTALLING', true);
|
||||
if (!file_exists('../wp-config.php')) {
|
||||
require_once('../wp-includes/compat.php');
|
||||
require_once('../wp-includes/functions.php');
|
||||
wp_die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can <a href='setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.", "WordPress › Error");
|
||||
}
|
||||
|
||||
require_once('../wp-config.php');
|
||||
require_once('./upgrade-functions.php');
|
||||
require_once('./includes/upgrade.php');
|
||||
|
||||
if (isset($_GET['step']))
|
||||
$step = $_GET['step'];
|
||||
@@ -19,10 +20,7 @@ header( 'Content-Type: text/html; charset=utf-8' );
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title><?php _e('WordPress › Installation'); ?></title>
|
||||
<link rel="stylesheet" href="install.css?version=<?php bloginfo('version'); ?>" type="text/css" />
|
||||
<?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
|
||||
<link rel="stylesheet" href="install-rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" />
|
||||
<?php endif; ?>
|
||||
<?php wp_admin_css( 'css/install' ); ?>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
|
||||
@@ -32,20 +30,19 @@ if ( is_blog_installed() ) die('<h1>'.__('Already Installed').'</h1><p>'.__('You
|
||||
|
||||
switch($step) {
|
||||
case 0:
|
||||
case 1: // in case people are directly linking to this
|
||||
?>
|
||||
<p><?php printf(__('Welcome to WordPress installation. We’re now going to go through a few steps to get you up and running with the latest in personal publishing platforms. You may want to peruse the <a href="%s">ReadMe documentation</a> at your leisure.'), '../readme.html'); ?></p>
|
||||
<h2 class="step"><a href="install.php?step=1"><?php _e('First Step »'); ?></a></h2>
|
||||
<?php
|
||||
break;
|
||||
case 1:
|
||||
?>
|
||||
<h1><?php _e('First Step'); ?></h1>
|
||||
<p><?php _e("Before we begin we need a little bit of information. Don't worry, you can always change these later."); ?></p>
|
||||
<h1><?php _e('Welcome'); ?></h1>
|
||||
<p><?php printf(__('Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure. Otherwise, just fill in the information below and you\'ll be on your way to using the most extendable and powerful personal publishing platform in the world.'), '../readme.html'); ?></p>
|
||||
<!--<h2 class="step"><a href="install.php?step=1"><?php _e('First Step »'); ?></a></h2>-->
|
||||
|
||||
<h1><?php _e('Information needed'); ?></h1>
|
||||
<p><?php _e("Please provide the following information. Don't worry, you can always change these settings later."); ?></p>
|
||||
|
||||
<form id="setup" method="post" action="install.php?step=2">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<th width="33%"><?php _e('Weblog title:'); ?></th>
|
||||
<th width="33%"><?php _e('Blog title:'); ?></th>
|
||||
<td><input name="weblog_title" type="text" id="weblog_title" size="25" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -53,12 +50,12 @@ switch($step) {
|
||||
<td><input name="admin_email" type="text" id="admin_email" size="25" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"> <?php __('Privacy:'); ?></th>
|
||||
<td><label><input type="checkbox" name="blog_public" value="1" checked="checked" /> <?php _e('I would like my blog to appear in search engines like Google and Technorati.'); ?></label></td>
|
||||
<td> </td>
|
||||
<td><label><input type="checkbox" name="blog_public" value="1" checked="checked" /> <?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?></label></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p><em><?php _e('Double-check that email address before continuing.'); ?></em></p>
|
||||
<h2 class="step"><input type="submit" name="Submit" value="<?php _e('Continue to Second Step »'); ?>" /></h2>
|
||||
<p><em><?php _e('Double-check your email address before continuing.'); ?></em></p>
|
||||
<h2 class="step"><input type="submit" name="Submit" value="<?php _e('Install WordPress »'); ?>" /></h2>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
@@ -70,25 +67,21 @@ switch($step) {
|
||||
$public = (int) $_POST['blog_public'];
|
||||
// check e-mail address
|
||||
if (empty($admin_email)) {
|
||||
die(__("<strong>ERROR</strong>: please type your e-mail address"));
|
||||
// TODO: poka-yoke
|
||||
die(__("<strong>ERROR</strong>: you must provide an e-mail address"));
|
||||
} else if (!is_email($admin_email)) {
|
||||
die(__("<strong>ERROR</strong>: the e-mail address isn't correct"));
|
||||
// TODO: poka-yoke
|
||||
die(__('<strong>ERROR</strong>: that isn\'t a valid e-mail address. E-mail addresses look like: <code>username@example.com</code>'));
|
||||
}
|
||||
|
||||
?>
|
||||
<h1><?php _e('Second Step'); ?></h1>
|
||||
<p><?php _e('Now we’re going to create the database tables and fill them with some default data.'); ?></p>
|
||||
|
||||
|
||||
<?php
|
||||
$result = wp_install($weblog_title, 'admin', $admin_email, $public);
|
||||
extract($result, EXTR_SKIP);
|
||||
?>
|
||||
|
||||
<p><em><?php _e('Finished!'); ?></em></p>
|
||||
<h1><?php _e('Success!'); ?></h1>
|
||||
|
||||
<p><?php printf(__('Now you can <a href="%1$s">log in</a> with the <strong>username</strong> "<code>admin</code>" and <strong>password</strong> "<code>%2$s</code>".'), '../wp-login.php', $password); ?></p>
|
||||
<p><?php _e('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you. If you lose it, you will have to delete the tables from the database yourself, and re-install WordPress. So to review:'); ?></p>
|
||||
<p><?php printf(__('WordPress has been installed. Now you can <a href="%1$s">log in</a> with the <strong>username</strong> "<code>admin</code>" and <strong>password</strong> "<code>%2$s</code>".'), '../wp-login.php', $password); ?></p>
|
||||
<p><?php _e('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.'); ?></p>
|
||||
|
||||
<dl>
|
||||
<dt><?php _e('Username'); ?></dt>
|
||||
@@ -98,7 +91,7 @@ switch($step) {
|
||||
<dt><?php _e('Login address'); ?></dt>
|
||||
<dd><a href="../wp-login.php">wp-login.php</a></dd>
|
||||
</dl>
|
||||
<p><?php _e('Were you expecting more steps? Sorry to disappoint. All done! :)'); ?></p>
|
||||
<p><?php _e('Were you expecting more steps? Sorry to disappoint. :)'); ?></p>
|
||||
|
||||
<?php
|
||||
break;
|
||||
|
||||
@@ -4,7 +4,8 @@ function newCatAddIn() {
|
||||
var jaxcat = $('jaxcat');
|
||||
if ( !jaxcat )
|
||||
return false;
|
||||
Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span>');
|
||||
// These multiple blank hidden inputs are needed: https://bugzilla.mozilla.org/show_bug.cgi?id=377815 , #3895 , #4664
|
||||
Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span>');
|
||||
$('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); };
|
||||
$('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); };
|
||||
}
|
||||
10
wp-admin/js/link-cat.js
Normal file
10
wp-admin/js/link-cat.js
Normal file
@@ -0,0 +1,10 @@
|
||||
addLoadEvent(function(){linkcatList=new listMan('linkcategorychecklist');linkcatList.ajaxRespEl='jaxcat';linkcatList.topAdder=1;linkcatList.alt=0;linkcatList.showLink=0;});
|
||||
addLoadEvent(newLinkCatAddIn);
|
||||
function newLinkCatAddIn() {
|
||||
var jaxcat = $('jaxcat');
|
||||
if ( !jaxcat )
|
||||
return false;
|
||||
Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + linkcatL10n.add + '"/><input type="hidden"/><span id="howto">' + linkcatL10n.how + '</span></span>');
|
||||
$('newcat').onkeypress = function(e) { return killSubmit("linkcatList.ajaxAdder('link-category','jaxcat');", e); };
|
||||
$('catadd').onclick = function() { linkcatList.ajaxAdder('link-category', 'jaxcat'); };
|
||||
}
|
||||
@@ -5,18 +5,38 @@ addLoadEvent( function() {
|
||||
tab: '',
|
||||
postID: 0,
|
||||
|
||||
toQueryParams: function(qryStrOrig) {
|
||||
var params = new Object();
|
||||
var qryStr = qryStrOrig;
|
||||
var i = 0;
|
||||
do {
|
||||
params[qryStr.split("=")[0].replace(/&/, "")] = ( qryStr.split("=")[1] ) ? qryStr.split("=")[1].split(/&|$/)[0] : '';
|
||||
qryStr = ( qryStr.split("=")[1] ) ? qryStr.split(qryStr.split("=")[1].split(/&|$/)[0])[1] : '';
|
||||
i++;
|
||||
}
|
||||
while(i < (qryStrOrig.split("=").length - 1));
|
||||
return params;
|
||||
},
|
||||
|
||||
toQueryString: function(params) {
|
||||
var qryStr = '';
|
||||
for ( var key in params )
|
||||
qryStr += key + '=' + params[key] + '&';
|
||||
return qryStr;
|
||||
},
|
||||
|
||||
initializeVars: function() {
|
||||
this.urlData = document.location.href.split('?');
|
||||
this.params = this.urlData[1].toQueryParams();
|
||||
this.params = this.toQueryParams(this.urlData[1]);
|
||||
this.postID = this.params['post_id'];
|
||||
this.tab = this.params['tab'];
|
||||
this.style = this.params['style'];
|
||||
this.ID = this.params['ID'];
|
||||
if ( !this.style )
|
||||
this.style = 'default';
|
||||
var nonceEl = $('nonce-value');
|
||||
var nonceEl = jQuery('#nonce-value');
|
||||
if ( nonceEl )
|
||||
this.nonce = nonceEl.value;
|
||||
this.nonce = jQuery(nonceEl).val();
|
||||
if ( this.ID ) {
|
||||
this.grabImageData( this.ID );
|
||||
this.imageView( this.ID );
|
||||
@@ -26,36 +46,38 @@ addLoadEvent( function() {
|
||||
initializeLinks: function() {
|
||||
if ( this.ID )
|
||||
return;
|
||||
$$('a.file-link').each( function(i) {
|
||||
var id = i.id.split('-').pop();
|
||||
i.onclick = function(e) { theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e); }
|
||||
} );
|
||||
jQuery('a.file-link').each(function() {
|
||||
var id = jQuery(this).attr('id').split('-').pop();
|
||||
jQuery(this).attr('href','javascript:void(0)').click(function(e) {
|
||||
theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
grabImageData: function(id) {
|
||||
if ( id == this.currentImage.ID )
|
||||
return;
|
||||
var thumbEl = $('attachment-thumb-url-' + id);
|
||||
var thumbEl = jQuery('#attachment-thumb-url-' + id);
|
||||
if ( thumbEl ) {
|
||||
this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value );
|
||||
this.currentImage.thumbBase = ( 0 == id ? '' : $('attachment-thumb-url-base-' + id).value );
|
||||
this.currentImage.thumb = ( 0 == id ? '' : jQuery(thumbEl).val() );
|
||||
this.currentImage.thumbBase = ( 0 == id ? '' : jQuery('#attachment-thumb-url-base-' + id).val() );
|
||||
} else {
|
||||
this.currentImage.thumb = false;
|
||||
}
|
||||
this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value );
|
||||
this.currentImage.srcBase = ( 0 == id ? '' : $('attachment-url-base-' + id).value );
|
||||
this.currentImage.page = ( 0 == id ? '' : $('attachment-page-url-' + id).value );
|
||||
this.currentImage.title = ( 0 == id ? '' : $('attachment-title-' + id).value );
|
||||
this.currentImage.description = ( 0 == id ? '' : $('attachment-description-' + id).value );
|
||||
var widthEl = $('attachment-width-' + id);
|
||||
this.currentImage.src = ( 0 == id ? '' : jQuery('#attachment-url-' + id).val() );
|
||||
this.currentImage.srcBase = ( 0 == id ? '' : jQuery('#attachment-url-base-' + id).val() );
|
||||
this.currentImage.page = ( 0 == id ? '' : jQuery('#attachment-page-url-' + id).val() );
|
||||
this.currentImage.title = ( 0 == id ? '' : jQuery('#attachment-title-' + id).val() );
|
||||
this.currentImage.description = ( 0 == id ? '' : jQuery('#attachment-description-' + id).val() );
|
||||
var widthEl = jQuery('#attachment-width-' + id);
|
||||
if ( widthEl ) {
|
||||
this.currentImage.width = ( 0 == id ? '' : widthEl.value );
|
||||
this.currentImage.height = ( 0 == id ? '' : $('attachment-height-' + id).value );
|
||||
this.currentImage.width = ( 0 == id ? '' : jQuery(widthEl).val() );
|
||||
this.currentImage.height = ( 0 == id ? '' : jQuery('#attachment-height-' + id).val() );
|
||||
} else {
|
||||
this.currentImage.width = false;
|
||||
this.currentImage.height = false;
|
||||
}
|
||||
this.currentImage.isImage = ( 0 == id ? 0 : $('attachment-is-image-' + id).value );
|
||||
this.currentImage.isImage = ( 0 == id ? 0 : jQuery('#attachment-is-image-' + id).val() );
|
||||
this.currentImage.ID = id;
|
||||
},
|
||||
|
||||
@@ -65,10 +87,10 @@ addLoadEvent( function() {
|
||||
|
||||
h += "<div id='upload-file'>"
|
||||
if ( this.ID ) {
|
||||
var params = $H(this.params);
|
||||
var params = this.params;
|
||||
params.ID = '';
|
||||
params.action = '';
|
||||
h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'";
|
||||
h += "<a href='" + this.urlData[0] + '?' + this.toQueryString(params) + "'";
|
||||
} else {
|
||||
h += "<a href='#' onclick='return theFileList.cancelView();'";
|
||||
}
|
||||
@@ -108,7 +130,7 @@ addLoadEvent( function() {
|
||||
if ( display.length ) {
|
||||
display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + this.title + "</label>");
|
||||
h += "<tr><th style='padding-bottom:.5em'>" + this.show + "</th><td style='padding-bottom:.5em'>";
|
||||
$A(display).each( function(i) { h += i; } );
|
||||
jQuery(display).each( function() { h += this; } );
|
||||
h += "</td></tr>";
|
||||
}
|
||||
|
||||
@@ -125,12 +147,9 @@ addLoadEvent( function() {
|
||||
|
||||
h += "</div>";
|
||||
|
||||
new Insertion.Top('upload-content', h);
|
||||
var displayEl = $(checked);
|
||||
if ( displayEl )
|
||||
displayEl.checked = true;
|
||||
|
||||
if (e) Event.stop(e);
|
||||
jQuery(h).prependTo('#upload-content');
|
||||
jQuery('#' + checked).attr('checked','checked');
|
||||
if (e) return e.stopPropagation();
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -144,10 +163,10 @@ addLoadEvent( function() {
|
||||
|
||||
h += "<form id='upload-file' method='post' action='" + action + "'>";
|
||||
if ( this.ID ) {
|
||||
var params = $H(this.params);
|
||||
var params = this.params;
|
||||
params.ID = '';
|
||||
params.action = '';
|
||||
h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'";
|
||||
h += "<a href='" + this.urlData[0] + '?' + this.toQueryString(params) + "'";
|
||||
} else {
|
||||
h += "<a href='#' onclick='return theFileList.cancelView();'";
|
||||
}
|
||||
@@ -182,23 +201,24 @@ addLoadEvent( function() {
|
||||
h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>";
|
||||
h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='" + this.deleteText + "' onclick='theFileList.deleteFile(" + id + ");' />";
|
||||
h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />";
|
||||
h += "<input type='hidden' name='post_parent' value='" + parseInt(this.postID,10) + "' />";
|
||||
h += "<input type='hidden' name='action' id='action-value' value='save' />";
|
||||
h += "<input type='hidden' name='ID' value='" + id + "' />";
|
||||
h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";
|
||||
h += "<div class='submit'><input type='submit' value='" + this.saveText + "' /></div>";
|
||||
h += "</td></tr></table></form>";
|
||||
|
||||
new Insertion.Top('upload-content', h);
|
||||
if (e) Event.stop(e);
|
||||
jQuery(h).prependTo('#upload-content');
|
||||
if (e) e.stopPropagation();
|
||||
return false;
|
||||
},
|
||||
|
||||
prepView: function(id) {
|
||||
this.cancelView( true );
|
||||
var filesEl = $('upload-files');
|
||||
var filesEl = jQuery('#upload-files');
|
||||
if ( filesEl )
|
||||
filesEl.hide();
|
||||
var navEl = $('current-tab-nav');
|
||||
var navEl = jQuery('#current-tab-nav');
|
||||
if ( navEl )
|
||||
navEl.hide();
|
||||
this.grabImageData(id);
|
||||
@@ -206,18 +226,18 @@ addLoadEvent( function() {
|
||||
|
||||
cancelView: function( prep ) {
|
||||
if ( !prep ) {
|
||||
var filesEl = $('upload-files');
|
||||
var filesEl = jQuery('#upload-files');
|
||||
if ( filesEl )
|
||||
Element.show(filesEl);
|
||||
var navEl = $('current-tab-nav');
|
||||
jQuery(filesEl).show();
|
||||
var navEl = jQuery('#current-tab-nav');
|
||||
if ( navEl )
|
||||
Element.show(navEl);
|
||||
jQuery(navEl).show();
|
||||
}
|
||||
if ( !this.ID )
|
||||
this.grabImageData(0);
|
||||
var div = $('upload-file');
|
||||
var div = jQuery('#upload-file');
|
||||
if ( div )
|
||||
Element.remove(div);
|
||||
jQuery(div).remove();
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -227,10 +247,10 @@ addLoadEvent( function() {
|
||||
var display = '';
|
||||
var h = '';
|
||||
|
||||
link = $A(document.forms.uploadoptions.elements.link).detect( function(i) { return i.checked; } ).value;
|
||||
displayEl = $A(document.forms.uploadoptions.elements.display).detect( function(i) { return i.checked; } )
|
||||
link = jQuery('input[@type=radio][@name="link"][@checked]','#uploadoptions').val();
|
||||
displayEl = jQuery('input[@type=radio][@name="display"][@checked]','#uploadoptions');
|
||||
if ( displayEl )
|
||||
display = displayEl.value;
|
||||
display = jQuery(displayEl).val();
|
||||
else if ( 1 == this.currentImage.isImage )
|
||||
display = 'full';
|
||||
|
||||
@@ -259,15 +279,17 @@ addLoadEvent( function() {
|
||||
|
||||
deleteFile: function(id) {
|
||||
if ( confirm( this.confirmText.replace(/%title%/g, this.currentImage.title) ) ) {
|
||||
$('action-value').value = 'delete';
|
||||
$('upload-file').submit();
|
||||
jQuery('#action-value').attr('value','delete');
|
||||
jQuery('#upload-file').submit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
Object.extend( theFileList, uploadL10n );
|
||||
|
||||
for ( var property in uploadL10n )
|
||||
theFileList[property] = uploadL10n[property];
|
||||
theFileList.initializeVars();
|
||||
theFileList.initializeLinks();
|
||||
} );
|
||||
@@ -13,7 +13,7 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
|
||||
|
||||
wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
|
||||
if ( current_user_can( 'manage_categories' ) )
|
||||
wp_enqueue_script( 'ajaxcat' );
|
||||
wp_enqueue_script( 'ajaxlinkcat' );
|
||||
require('admin-header.php');
|
||||
?>
|
||||
|
||||
|
||||
71
wp-admin/link-category.php
Normal file
71
wp-admin/link-category.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
require_once('admin.php');
|
||||
|
||||
wp_reset_vars(array('action', 'cat'));
|
||||
|
||||
switch($action) {
|
||||
|
||||
case 'addcat':
|
||||
|
||||
check_admin_referer('add-link-category');
|
||||
|
||||
if ( !current_user_can('manage_categories') )
|
||||
wp_die(__('Cheatin’ uh?'));
|
||||
|
||||
if ( wp_insert_term($_POST['name'], 'link_category', $_POST ) ) {
|
||||
wp_redirect('edit-link-categories.php?message=1#addcat');
|
||||
} else {
|
||||
wp_redirect('edit-link-categories.php?message=4#addcat');
|
||||
}
|
||||
exit;
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$cat_ID = (int) $_GET['cat_ID'];
|
||||
check_admin_referer('delete-link-category_' . $cat_ID);
|
||||
|
||||
if ( !current_user_can('manage_categories') )
|
||||
wp_die(__('Cheatin’ uh?'));
|
||||
|
||||
$cat_name = get_term_field('name', $cat_ID, 'link_category');
|
||||
|
||||
// Don't delete the default cats.
|
||||
if ( $cat_ID == get_option('default_link_category') )
|
||||
wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
|
||||
|
||||
wp_delete_term($cat_ID, 'link_category');
|
||||
|
||||
wp_redirect('edit-link-categories.php?message=2');
|
||||
exit;
|
||||
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$title = __('Categories');
|
||||
$parent_file = 'link-manager.php';
|
||||
$submenu_file = 'edit-link-categories.php';
|
||||
require_once ('admin-header.php');
|
||||
$cat_ID = (int) $_GET['cat_ID'];
|
||||
$category = get_term_to_edit($cat_ID, 'link_category');
|
||||
include('edit-link-category-form.php');
|
||||
include('admin-footer.php');
|
||||
exit;
|
||||
break;
|
||||
|
||||
case 'editedcat':
|
||||
$cat_ID = (int) $_POST['cat_ID'];
|
||||
check_admin_referer('update-link-category_' . $cat_ID);
|
||||
|
||||
if ( !current_user_can('manage_categories') )
|
||||
wp_die(__('Cheatin’ uh?'));
|
||||
|
||||
if ( wp_update_term($cat_ID, 'link_category', $_POST) )
|
||||
wp_redirect('edit-link-categories.php?message=3');
|
||||
else
|
||||
wp_redirect('edit-link-categories.php?message=5');
|
||||
|
||||
exit;
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -98,7 +98,7 @@ foreach ($categories as $category) {
|
||||
} else {
|
||||
$opml = file_get_contents($opml_url);
|
||||
}
|
||||
|
||||
|
||||
include_once('link-parse-opml.php');
|
||||
|
||||
$link_count = count($names);
|
||||
@@ -123,7 +123,7 @@ else
|
||||
} // end else
|
||||
|
||||
if ( ! $blogrolling )
|
||||
apply_filters( 'wp_delete_file', $opml_url);
|
||||
apply_filters( 'wp_delete_file', $opml_url);
|
||||
@unlink($opml_url);
|
||||
?>
|
||||
</div>
|
||||
|
||||
@@ -76,11 +76,11 @@ if ( isset($_GET['deleted']) ) {
|
||||
<p><?php _e('Here you <a href="link-add.php">add links</a> to sites that you visit often and share them on your blog. When you have a list of links in your sidebar to other blogs, it’s called a “blogroll.”'); ?></p>
|
||||
<form id="cats" method="get" action="">
|
||||
<p><?php
|
||||
$categories = get_categories("hide_empty=1&type=link");
|
||||
$categories = get_terms('link_category', "hide_empty=1");
|
||||
$select_cat = "<select name=\"cat_id\">\n";
|
||||
$select_cat .= '<option value="all"' . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('All') . "</option>\n";
|
||||
foreach ((array) $categories as $cat)
|
||||
$select_cat .= '<option value="' . $cat->cat_ID . '"' . (($cat->cat_ID == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars(apply_filters('link_category', $cat->cat_name)) . "</option>\n";
|
||||
$select_cat .= '<option value="' . $cat->term_id . '"' . (($cat->term_id == $cat_id) ? " selected='selected'" : '') . '>' . sanitize_term_field('name', $cat->name, $cat->term_id, 'link_category', 'display') . "</option>\n";
|
||||
$select_cat .= "</select>\n";
|
||||
|
||||
$select_order = "<select name=\"order_by\">\n";
|
||||
@@ -131,9 +131,8 @@ if ( $links ) {
|
||||
<tbody id="the-list">
|
||||
<?php
|
||||
foreach ($links as $link) {
|
||||
$link->link_name = attribute_escape(apply_filters('link_title', $link->link_name));
|
||||
$link->link_description = wp_specialchars(apply_filters('link_description', $link->link_description));
|
||||
$link->link_url = clean_url($link->link_url);
|
||||
$link = sanitize_bookmark($link);
|
||||
$link->link_name = attribute_escape($link->link_name);
|
||||
$link->link_category = wp_get_link_cats($link->link_id);
|
||||
$short_url = str_replace('http://', '', $link->link_url);
|
||||
$short_url = str_replace('www.', '', $short_url);
|
||||
@@ -159,8 +158,10 @@ if ( $links ) {
|
||||
?><td><?php
|
||||
$cat_names = array();
|
||||
foreach ($link->link_category as $category) {
|
||||
$cat_name = get_the_category_by_ID($category);
|
||||
$cat_name = wp_specialchars(apply_filters('link_category', $cat_name));
|
||||
$cat = get_term($category, 'link_category', OBJECT, 'display');
|
||||
if ( is_wp_error( $cat ) )
|
||||
echo $cat->get_error_message();
|
||||
$cat_name = $cat->name;
|
||||
if ( $cat_id != $category )
|
||||
$cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
|
||||
$cat_names[] = $cat_name;
|
||||
@@ -195,7 +196,7 @@ if ( $links ) {
|
||||
|
||||
<div id="ajax-response"></div>
|
||||
|
||||
<p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Links') ?> »" onclick="return confirm('<?php echo js_escape(__("You are about to delete these links permanently.\n'Cancel' to stop, 'OK' to delete.")); ?>')" /></p>
|
||||
<p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Links »') ?>" onclick="return confirm('<?php echo js_escape(__("You are about to delete these links permanently.\n'Cancel' to stop, 'OK' to delete.")); ?>')" /></p>
|
||||
</form>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
@@ -93,7 +93,7 @@ switch ($action) {
|
||||
case 'edit' :
|
||||
wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
|
||||
if ( current_user_can( 'manage_categories' ) )
|
||||
wp_enqueue_script( 'ajaxcat' );
|
||||
wp_enqueue_script( 'ajaxlinkcat' );
|
||||
$parent_file = 'link-manager.php';
|
||||
$submenu_file = 'link-manager.php';
|
||||
$title = __('Edit Link');
|
||||
|
||||
@@ -46,6 +46,7 @@ $submenu['edit.php'][40] = array(__('Export'), 'import', 'export.php');
|
||||
$submenu['link-manager.php'][5] = array(__('Manage Blogroll'), 'manage_links', 'link-manager.php');
|
||||
$submenu['link-manager.php'][10] = array(__('Add Link'), 'manage_links', 'link-add.php');
|
||||
$submenu['link-manager.php'][20] = array(__('Import Links'), 'manage_links', 'link-import.php');
|
||||
$submenu['link-manager.php'][30] = array(__('Categories'), 'manage_links', 'edit-link-categories.php');
|
||||
|
||||
if ( current_user_can('edit_users') ) {
|
||||
$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
|
||||
@@ -95,7 +96,7 @@ foreach ($submenu as $parent => $sub) {
|
||||
// Menus for which the original parent is not acessible due to lack of privs will have the next
|
||||
// submenu in line be assigned as the new menu parent.
|
||||
foreach ( $menu as $id => $data ) {
|
||||
if ( empty($submenu[$data[2]]) )
|
||||
if ( empty($submenu[$data[2]]) )
|
||||
continue;
|
||||
$subs = $submenu[$data[2]];
|
||||
$first_sub = array_shift($subs);
|
||||
|
||||
@@ -1,206 +1,226 @@
|
||||
<?php
|
||||
require_once('admin.php');
|
||||
|
||||
$title = __('Moderate comments');
|
||||
require_once './admin.php';
|
||||
|
||||
$title = __( 'Moderate Comments' );
|
||||
$parent_file = 'edit-comments.php';
|
||||
|
||||
wp_enqueue_script( 'admin-comments' );
|
||||
|
||||
wp_reset_vars(array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky'));
|
||||
wp_reset_vars( array( 'action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky' ) );
|
||||
|
||||
$comment = array();
|
||||
if (isset($_POST["comment"])) {
|
||||
foreach ($_POST["comment"] as $k => $v) {
|
||||
$comment[intval($k)] = $v;
|
||||
|
||||
if ( isset( $_POST['comment'] ) && is_array( $_POST['comment'] ) ) {
|
||||
foreach ( $_POST['comment'] as $k => $v ) {
|
||||
$comment[intval( $k )] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
switch($action) {
|
||||
if ( $action == 'update' ) {
|
||||
check_admin_referer( 'moderate-comments' );
|
||||
|
||||
case 'update':
|
||||
|
||||
check_admin_referer('moderate-comments');
|
||||
|
||||
if ( !current_user_can('moderate_comments') )
|
||||
wp_die(__('Your level is not high enough to moderate comments.'));
|
||||
if ( !current_user_can( 'moderate_comments' ) ) {
|
||||
wp_die( __( 'Your level is not high enough to moderate comments.' ) );
|
||||
}
|
||||
|
||||
$item_ignored = 0;
|
||||
$item_deleted = 0;
|
||||
$item_approved = 0;
|
||||
$item_spam = 0;
|
||||
|
||||
foreach($comment as $key => $value) {
|
||||
if ($feelinglucky && 'later' == $value)
|
||||
$value = 'delete';
|
||||
switch($value) {
|
||||
case 'later':
|
||||
// do nothing with that comment
|
||||
// wp_set_comment_status($key, "hold");
|
||||
++$item_ignored;
|
||||
break;
|
||||
case 'delete':
|
||||
wp_set_comment_status($key, 'delete');
|
||||
++$item_deleted;
|
||||
break;
|
||||
case 'spam':
|
||||
wp_set_comment_status($key, 'spam');
|
||||
++$item_spam;
|
||||
break;
|
||||
case 'approve':
|
||||
wp_set_comment_status($key, 'approve');
|
||||
if ( get_option('comments_notify') == true ) {
|
||||
wp_notify_postauthor($key);
|
||||
foreach ( $comment as $k => $v ) {
|
||||
if ( $feelinglucky && $v == 'later' ) {
|
||||
$v = 'delete';
|
||||
}
|
||||
|
||||
switch ( $v ) {
|
||||
case 'later' :
|
||||
$item_ignored++;
|
||||
break;
|
||||
|
||||
case 'delete' :
|
||||
wp_set_comment_status( $k, 'delete' );
|
||||
$item_deleted++;
|
||||
break;
|
||||
|
||||
case 'spam' :
|
||||
wp_set_comment_status( $k, 'spam' );
|
||||
$item_spam++;
|
||||
break;
|
||||
|
||||
case 'approve' :
|
||||
wp_set_comment_status( $k, 'approve' );
|
||||
|
||||
if ( get_option( 'comments_notify' ) == true ) {
|
||||
wp_notify_postauthor( $k );
|
||||
}
|
||||
++$item_approved;
|
||||
break;
|
||||
|
||||
$item_approved++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$file = basename(__FILE__);
|
||||
wp_redirect("$file?ignored=$item_ignored&deleted=$item_deleted&approved=$item_approved&spam=$item_spam");
|
||||
exit();
|
||||
wp_redirect( basename( __FILE__ ) . '?ignored=' . $item_ignored . '&deleted=' . $item_deleted . '&approved=' . $item_approved . '&spam=' . $item_spam );
|
||||
exit;
|
||||
}
|
||||
|
||||
break;
|
||||
require_once './admin-header.php';
|
||||
|
||||
default:
|
||||
if ( !current_user_can( 'moderate_comments' ) ) {
|
||||
echo '<div class="wrap"><p>' . __( 'Your level is not high enough to moderate comments.' ) . '</p></div>';
|
||||
include_once './admin-footer.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once('admin-header.php');
|
||||
if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['spam'] ) ) {
|
||||
$approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0;
|
||||
$deleted = isset( $_GET['deleted'] ) ? (int) $_GET['deleted'] : 0;
|
||||
$spam = isset( $_GET['ignored'] ) ? (int) $_GET['spam'] : 0;
|
||||
|
||||
if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored']) ) {
|
||||
echo "<div id='moderated' class='updated fade'>\n<p>";
|
||||
$approved = (int) $_GET['approved'];
|
||||
$deleted = (int) $_GET['deleted'];
|
||||
$ignored = (int) $_GET['ignored'];
|
||||
$spam = (int) $_GET['spam'];
|
||||
if ($approved) {
|
||||
printf(__ngettext('%s comment approved', '%s comments approved', $approved), $approved);
|
||||
echo "<br/>\n";
|
||||
if ( $approved > 0 || $deleted > 0 || $spam > 0 ) {
|
||||
echo '<div id="moderated" class="updated fade"><p>';
|
||||
|
||||
if ( $approved > 0 ) {
|
||||
printf( __ngettext( '%s comment approved.', '%s comments approved.', $approved ), $approved );
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
if ( $deleted > 0 ) {
|
||||
printf( __ngettext( '%s comment deleted', '%s comments deleted.', $deleted ), $deleted );
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
if ( $spam > 0 ) {
|
||||
printf( __ngettext( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam );
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
echo '</p></div>';
|
||||
}
|
||||
if ($deleted) {
|
||||
printf(__ngettext('%s comment deleted', '%s comments deleted', $deleted), $deleted);
|
||||
echo "<br/>\n";
|
||||
}
|
||||
if ($spam) {
|
||||
printf(__ngettext('%s comment marked as spam', '%s comments marked as spam', $spam), $spam);
|
||||
echo "<br/>\n";
|
||||
}
|
||||
if ($ignored) {
|
||||
printf(__ngettext('%s comment unchanged', '%s comments unchanged', $ignored), $ignored);
|
||||
echo "<br/>\n";
|
||||
}
|
||||
echo "</p></div>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
|
||||
<?php
|
||||
if ( current_user_can('moderate_comments') )
|
||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0'");
|
||||
else
|
||||
$comments = '';
|
||||
|
||||
if ($comments) {
|
||||
// list all comments that are waiting for approval
|
||||
$file = basename(__FILE__);
|
||||
?>
|
||||
<h2><?php _e('Moderation Queue') ?></h2>
|
||||
<form name="approval" action="moderation.php" method="post">
|
||||
<?php wp_nonce_field('moderate-comments') ?>
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<ol id="the-comment-list" class="commentlist">
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach($comments as $comment) {
|
||||
++$i;
|
||||
$comment_date = mysql2date(get_option("date_format") . " @ " . get_option("time_format"), $comment->comment_date);
|
||||
$post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID='$comment->comment_post_ID'");
|
||||
if ($i % 2) $class = 'js-unapproved alternate';
|
||||
else $class = 'js-unapproved';
|
||||
echo "\n\t<li id='comment-$comment->comment_ID' class='$class'>";
|
||||
?>
|
||||
<p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
|
||||
<?php comment_text() ?>
|
||||
<p><?php comment_date(__('M j, g:i A')); ?> — [ <?php
|
||||
echo '<a href="comment.php?action=editcomment&c='.$comment->comment_ID.'">' . __('Edit') . '</a> | ';
|
||||
echo " <a href=\"post.php?action=deletecomment&p=".$comment->comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author )) . "', theCommentList );\">" . __('Delete') . "</a> | "; ?>
|
||||
<?php
|
||||
$post = get_post($comment->comment_post_ID);
|
||||
$post_title = wp_specialchars( $post->post_title, 'double' );
|
||||
$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
|
||||
?>
|
||||
<a href="<?php echo get_permalink($comment->comment_post_ID); ?>" title="<?php echo $post_title; ?>"><?php _e('View Post') ?></a> ] —
|
||||
<?php _e('Bulk action:') ?>
|
||||
<input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment-<?php echo $comment->comment_ID; ?>-approve" value="approve" /> <label for="comment-<?php echo $comment->comment_ID; ?>-approve"><?php _e('Approve') ?></label>
|
||||
<input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment-<?php echo $comment->comment_ID; ?>-spam" value="spam" /> <label for="comment-<?php echo $comment->comment_ID; ?>-spam"><?php _e('Spam') ?></label>
|
||||
<input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment-<?php echo $comment->comment_ID; ?>-delete" value="delete" /> <label for="comment-<?php echo $comment->comment_ID; ?>-delete"><?php _e('Delete') ?></label>
|
||||
<input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment-<?php echo $comment->comment_ID; ?>-nothing" value="later" checked="checked" /> <label for="comment-<?php echo $comment->comment_ID; ?>-nothing"><?php _e('Defer until later') ?></label>
|
||||
</p>
|
||||
$comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0'" );
|
||||
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ol>
|
||||
|
||||
<div id="ajax-response"></div>
|
||||
|
||||
<p class="submit"><input type="submit" name="submit" value="<?php _e('Bulk Moderate Comments »') ?>" /></p>
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
function markAllForDelete() {
|
||||
for (var i=0; i< document.approval.length; i++) {
|
||||
if (document.approval[i].value == "delete") {
|
||||
document.approval[i].checked = true;
|
||||
}
|
||||
}
|
||||
if ( !$comments ) {
|
||||
echo '<p>' . __( 'Currently there are no comments for you to moderate.' ) . '</p></div>';
|
||||
include_once './admin-footer.php';
|
||||
exit;
|
||||
}
|
||||
function markAllForApprove() {
|
||||
for (var i=0; i< document.approval.length; i++) {
|
||||
if (document.approval[i].value == "approve") {
|
||||
document.approval[i].checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
function markAllForDefer() {
|
||||
for (var i=0; i< document.approval.length; i++) {
|
||||
if (document.approval[i].value == "later") {
|
||||
document.approval[i].checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
function markAllAsSpam() {
|
||||
for (var i=0; i< document.approval.length; i++) {
|
||||
if (document.approval[i].value == "spam") {
|
||||
document.approval[i].checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
document.write('<ul><li><a href="javascript:markAllForApprove()"><?php _e('Mark all for approval'); ?></a></li><li><a href="javascript:markAllAsSpam()"><?php _e('Mark all as spam'); ?></a></li><li><a href="javascript:markAllForDelete()"><?php _e('Mark all for deletion'); ?></a></li><li><a href="javascript:markAllForDefer()"><?php _e('Mark all for later'); ?></a></li></ul>');
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<p>
|
||||
<input name="feelinglucky" type="checkbox" id="feelinglucky" value="true" /> <label for="feelinglucky"><?php _e('Delete every comment marked "defer." <strong>Warning: This can’t be undone.</strong>'); ?></label>
|
||||
</p>
|
||||
</noscript>
|
||||
</form>
|
||||
<?php
|
||||
$total = count( $comments );
|
||||
$per = 100;
|
||||
|
||||
if ( isset( $_GET['paged'] ) ) {
|
||||
$page = (int) $_GET['paged'];
|
||||
} else {
|
||||
// nothing to approve
|
||||
echo '<p>'.__("Currently there are no comments for you to moderate.") . "</p>\n";
|
||||
$page = 1;
|
||||
}
|
||||
?>
|
||||
|
||||
$start = ( $page * $per ) - $per;
|
||||
$stop = $start + $per;
|
||||
|
||||
$page_links = paginate_links( array(
|
||||
'base' => add_query_arg( 'paged', '%#%' ),
|
||||
'format' => '',
|
||||
'total' => ceil( $total / $per ),
|
||||
'current' => $page,
|
||||
'prev_text' => '«',
|
||||
'next_text' => '»'
|
||||
) );
|
||||
|
||||
$comments = array_slice( $comments, $start, $stop );
|
||||
|
||||
?>
|
||||
<h2><?php _e( 'Moderation Queue' ); ?></h2>
|
||||
|
||||
<?php
|
||||
if ( $page_links ) {
|
||||
echo '<p class="pagenav">' . $page_links . '</p>';
|
||||
}
|
||||
?>
|
||||
|
||||
<form name="approval" id="approval" action="<?php echo basename( __FILE__ ); ?>" method="post">
|
||||
<?php wp_nonce_field( 'moderate-comments' ); ?>
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<ol id="the-comments-list" class="commentlist">
|
||||
<?php
|
||||
$i = 0;
|
||||
|
||||
foreach ( $comments as $comment ) {
|
||||
$class = 'js-unapproved';
|
||||
|
||||
if ( $i++ % 2 ) {
|
||||
$class .= ' alternate';
|
||||
}
|
||||
?>
|
||||
<li id="comment-<?php comment_ID(); ?>" class="<?php echo $class; ?>">
|
||||
<p>
|
||||
<strong><?php comment_author(); ?></strong>
|
||||
<?php if ( !empty( $comment->comment_author_email ) ) { ?>| <?php comment_author_email_link(); ?> <?php } ?>
|
||||
<?php if ( !empty( $comment->comment_author_url ) && $comment->comment_author_url != 'http://' ) { ?>| <?php comment_author_url_link(); ?> <?php } ?>
|
||||
| <?php _e( 'IP:' ); ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP(); ?>"><?php comment_author_IP(); ?></a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php comment_text(); ?>
|
||||
</p>
|
||||
|
||||
<p><small>
|
||||
<?php comment_date( __( 'M j, g:i A' ) ); ?> —
|
||||
[ <a href="comment.php?action=editcomment&c=<?php comment_ID(); ?>" title="<?php _e( 'Edit this comment' ); ?>"><?php _e( 'Edit' ); ?></a> |
|
||||
<a href="post.php?action=deletecomment&p=<?php echo $comment->comment_post_ID; ?>" title="<?php _e( 'Delete this comment' ); ?>" onclick="return deleteSomething( 'comment', <?php comment_ID(); ?>, '<?php echo js_escape( sprintf( __( "You are about to delete this comment by '%s'.\n'OK' to delete, 'Cancel' to stop." ), get_comment_author() ) ); ?>', theCommentList );"><?php _e( 'Delete' ); ?></a> ] —
|
||||
<a href="<?php echo get_permalink( $comment->comment_post_ID ); ?>" title="<?php _e( 'View the post' ); ?>"><?php printf( __( 'View post “%s”' ), get_the_title( $comment->comment_post_ID ) ); ?></a>
|
||||
</small></p>
|
||||
|
||||
<p><small>
|
||||
<?php _e( 'Bulk action:' ); ?>
|
||||
<label for="comment-<?php comment_ID(); ?>-approve"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-approve" value="approve" /> <?php _e( 'Approve' ); ?></label>
|
||||
<label for="comment-<?php comment_ID(); ?>-spam"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-spam" value="spam" /> <?php _e( 'Spam' ); ?></label>
|
||||
<label for="comment-<?php comment_ID(); ?>-delete"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-delete" value="delete" /> <?php _e( 'Delete' ); ?></label>
|
||||
<label for="comment-<?php comment_ID(); ?>-nothing"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-nothing" value="later" checked="checked" /> <?php _e( 'No action' ); ?></label>
|
||||
</small></p>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ol>
|
||||
|
||||
<?php
|
||||
if ( $page_links ) {
|
||||
echo '<p class="pagenav">' . $page_links . '</p>';
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="ajax-response"></div>
|
||||
|
||||
<noscript>
|
||||
<p class="submit">
|
||||
<label for="feelinglucky"><input name="feelinglucky" id="feelinglucky" type="checkbox" value="true" /> <?php _e( 'Delete every comment marked “defer.” <strong>Warning: This can’t be undone.</strong>' ); ?></label>
|
||||
</p>
|
||||
</noscript>
|
||||
|
||||
<p class="submit">
|
||||
<input type="submit" id="submit" name="submit" value="<?php _e( 'Bulk Moderate Comments »' ); ?>" />
|
||||
</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
function mark_all_as( what ) {
|
||||
for ( var i = 0; i < document.approval.length; i++ ) {
|
||||
if ( document.approval[i].value == what ) {
|
||||
document.approval[i].checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.write( '<p><strong><?php _e( 'Mark all:' ); ?></strong> <a href="javascript:mark_all_as(\'approve\')"><?php _e( 'Approved' ); ?></a> – <a href="javascript:mark_all_as(\'spam\')"><?php _e( 'Spam' ); ?></a> – <a href="javascript:mark_all_as(\'delete\')"><?php _e( 'Deleted' ); ?></a> – <a href="javascript:mark_all_as(\'later\')"><?php _e( 'Later' ); ?></a></p>' );
|
||||
// ]]>
|
||||
</script>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
include('admin-footer.php');
|
||||
|
||||
?>
|
||||
<?php include_once './admin-footer.php'; ?>
|
||||
@@ -7,80 +7,80 @@ $parent_file = 'options-general.php';
|
||||
include('admin-header.php');
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Discussion Options') ?></h2>
|
||||
<form method="post" action="options.php">
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Discussion Options') ?></h2>
|
||||
<form method="post" action="options.php">
|
||||
<?php wp_nonce_field('update-options') ?>
|
||||
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /></p>
|
||||
<fieldset class="options">
|
||||
<legend><?php echo __('Usual settings for an article:').'<br /><small><em>('.__('These settings may be overridden for individual articles.').')</em></small>'; ?></legend>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="default_pingback_flag">
|
||||
<input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> />
|
||||
<?php _e('Attempt to notify any Weblogs linked to from the article (slows down posting.)') ?></label>
|
||||
</li>
|
||||
<li>
|
||||
<label for="default_ping_status">
|
||||
<input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked('open', get_option('default_ping_status')); ?> />
|
||||
<?php _e('Allow link notifications from other Weblogs (pingbacks and trackbacks.)') ?></label>
|
||||
</li>
|
||||
<li>
|
||||
<label for="default_comment_status">
|
||||
<input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> />
|
||||
<?php _e('Allow people to post comments on the article') ?></label>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('E-mail me whenever:') ?></legend>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="comments_notify">
|
||||
<input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />
|
||||
<?php _e('Anyone posts a comment') ?> </label>
|
||||
</li>
|
||||
<li>
|
||||
<label for="moderation_notify">
|
||||
<input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> />
|
||||
<?php _e('A comment is held for moderation') ?> </label>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Before a comment appears:') ?></legend>
|
||||
<legend><?php echo __('Usual settings for an article:').'<br /><small><em>('.__('These settings may be overridden for individual articles.').')</em></small>'; ?></legend>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="comment_moderation">
|
||||
<input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> />
|
||||
<?php _e('An administrator must always approve the comment') ?> </label>
|
||||
</li>
|
||||
<li><label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label></li>
|
||||
<li><label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label></li>
|
||||
</ul>
|
||||
<label for="default_pingback_flag">
|
||||
<input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> />
|
||||
<?php _e('Attempt to notify any blogs linked to from the article (slows down posting.)') ?></label>
|
||||
</li>
|
||||
<li>
|
||||
<label for="default_ping_status">
|
||||
<input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked('open', get_option('default_ping_status')); ?> />
|
||||
<?php _e('Allow link notifications from other blogs (pingbacks and trackbacks.)') ?></label>
|
||||
</li>
|
||||
<li>
|
||||
<label for="default_comment_status">
|
||||
<input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> />
|
||||
<?php _e('Allow people to post comments on the article') ?></label>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('E-mail me whenever:') ?></legend>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="comments_notify">
|
||||
<input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />
|
||||
<?php _e('Anyone posts a comment') ?> </label>
|
||||
</li>
|
||||
<li>
|
||||
<label for="moderation_notify">
|
||||
<input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> />
|
||||
<?php _e('A comment is held for moderation') ?> </label>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Before a comment appears:') ?></legend>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="comment_moderation">
|
||||
<input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> />
|
||||
<?php _e('An administrator must always approve the comment') ?> </label>
|
||||
</li>
|
||||
<li><label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label></li>
|
||||
<li><label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label></li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Comment Moderation') ?></legend>
|
||||
<p><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . get_option('comment_max_links'). '" />' ) ?></p>
|
||||
|
||||
<p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="moderation.php">moderation queue</a>. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
|
||||
<p>
|
||||
<textarea name="moderation_keys" cols="60" rows="4" id="moderation_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('moderation_keys'); ?></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<textarea name="moderation_keys" cols="60" rows="4" id="moderation_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('moderation_keys'); ?></textarea>
|
||||
</p>
|
||||
</fieldset>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Comment Blacklist') ?></legend>
|
||||
<p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
|
||||
<p>
|
||||
<textarea name="blacklist_keys" cols="60" rows="4" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('blacklist_keys'); ?></textarea>
|
||||
<p>
|
||||
<textarea name="blacklist_keys" cols="60" rows="4" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('blacklist_keys'); ?></textarea>
|
||||
</p>
|
||||
</fieldset>
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="default_pingback_flag,default_ping_status,default_comment_status,comments_notify,moderation_notify,comment_moderation,require_name_email,comment_whitelist,comment_max_links,moderation_keys,blacklist_keys" />
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" />
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="default_pingback_flag,default_ping_status,default_comment_status,comments_notify,moderation_notify,comment_moderation,require_name_email,comment_whitelist,comment_max_links,moderation_keys,blacklist_keys" />
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php include('./admin-footer.php'); ?>
|
||||
<?php include('./admin-footer.php'); ?>
|
||||
|
||||
@@ -6,65 +6,65 @@ $parent_file = 'options-general.php';
|
||||
|
||||
include('./admin-header.php');
|
||||
?>
|
||||
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('General Options') ?></h2>
|
||||
<form method="post" action="options.php">
|
||||
<form method="post" action="options.php">
|
||||
<?php wp_nonce_field('update-options') ?>
|
||||
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /></p>
|
||||
<table class="optiontable">
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Weblog title:') ?></th>
|
||||
<td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" size="40" /></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Tagline:') ?></th>
|
||||
<table class="optiontable">
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Blog title:') ?></th>
|
||||
<td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" size="40" /></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Tagline:') ?></th>
|
||||
<td><input name="blogdescription" type="text" id="blogdescription" style="width: 95%" value="<?php form_option('blogdescription'); ?>" size="45" />
|
||||
<br />
|
||||
<?php _e('In a few words, explain what this weblog is about.') ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('WordPress address (URL):') ?></th>
|
||||
<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td>
|
||||
</tr>
|
||||
<?php _e('In a few words, explain what this blog is about.') ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('WordPress address (URL):') ?></th>
|
||||
<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Blog address (URL):') ?></th>
|
||||
<td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" size="40" class="code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /><br /><?php _e('Enter the address here if you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different from the directory</a> you installed WordPress.'); ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('E-mail address:') ?> </th>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('E-mail address:') ?> </th>
|
||||
<td><input name="admin_email" type="text" id="admin_email" value="<?php form_option('admin_email'); ?>" size="40" class="code" />
|
||||
<br />
|
||||
<?php _e('This address is used only for admin purposes.') ?></td>
|
||||
<?php _e('This address is used only for admin purposes.') ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Membership:') ?></th>
|
||||
<td> <label for="users_can_register">
|
||||
<input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Membership:') ?></th>
|
||||
<td> <label for="users_can_register">
|
||||
<input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
|
||||
<?php _e('Anyone can register') ?></label><br />
|
||||
<label for="comment_registration">
|
||||
<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
|
||||
<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
|
||||
<?php _e('Users must be registered and logged in to comment') ?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('New User Default Role:') ?></th>
|
||||
<td><label for="default_role">
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('New User Default Role:') ?></th>
|
||||
<td><label for="default_role">
|
||||
<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select></label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Date and Time') ?></legend>
|
||||
<table class="optiontable">
|
||||
<tr>
|
||||
<th scope="row"><?php _e('<abbr title="Coordinated Universal Time">UTC</abbr> time is:') ?> </th>
|
||||
<td><code><?php echo gmdate(__('Y-m-d g:i:s a')); ?></code></td>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Date and Time') ?></legend>
|
||||
<table class="optiontable">
|
||||
<tr>
|
||||
<th scope="row"><?php _e('<abbr title="Coordinated Universal Time">UTC</abbr> time is:') ?> </th>
|
||||
<td><code><?php echo gmdate(__('Y-m-d g:i:s a')); ?></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Times in the weblog should differ by:') ?> </th>
|
||||
<td><input name="gmt_offset" type="text" id="gmt_offset" size="2" value="<?php form_option('gmt_offset'); ?>" />
|
||||
<th scope="row"><?php _e('Times in the blog should differ by:') ?> </th>
|
||||
<td><input name="gmt_offset" type="text" id="gmt_offset" size="2" value="<?php form_option('gmt_offset'); ?>" />
|
||||
<?php _e('hours') ?> (<?php _e('Your timezone offset, for example <code>-6</code> for Central Time.'); ?>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -76,7 +76,7 @@ include('./admin-header.php');
|
||||
<th scope="row"><?php _e('Default time format:') ?></th>
|
||||
<td><input name="time_format" type="text" id="time_format" size="30" value="<?php form_option('time_format'); ?>" /><br />
|
||||
<?php _e('Output:') ?> <strong><?php echo gmdate(get_option('time_format'), current_time('timestamp')); ?></strong></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"> </th>
|
||||
<td><?php _e('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click "Update options" to update sample output.') ?> </td>
|
||||
@@ -93,14 +93,14 @@ endfor;
|
||||
</select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" />
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="<?php if ( ! defined( 'WP_SITEURL' ) ) echo 'siteurl,'; if ( ! defined( 'WP_HOME' ) ) echo 'home,'; ?>blogname,blogdescription,admin_email,users_can_register,gmt_offset,date_format,time_format,start_of_week,comment_registration,default_role" />
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="<?php if ( ! defined( 'WP_SITEURL' ) ) echo 'siteurl,'; if ( ! defined( 'WP_HOME' ) ) echo 'home,'; ?>blogname,blogdescription,admin_email,users_can_register,gmt_offset,date_format,time_format,start_of_week,comment_registration,default_role" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include('./admin-footer.php') ?>
|
||||
|
||||
@@ -73,10 +73,18 @@ if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
|
||||
$category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']);
|
||||
$wp_rewrite->set_category_base($category_base);
|
||||
}
|
||||
|
||||
if ( isset($_POST['tag_base']) ) {
|
||||
$tag_base = $_POST['tag_base'];
|
||||
if (! empty($tag_base) )
|
||||
$tag_base = preg_replace('#/+#', '/', '/' . $_POST['tag_base']);
|
||||
$wp_rewrite->set_tag_base($tag_base);
|
||||
}
|
||||
}
|
||||
|
||||
$permalink_structure = get_option('permalink_structure');
|
||||
$category_base = get_option('category_base');
|
||||
$tag_base = get_option( 'tag_base' );
|
||||
|
||||
if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') )
|
||||
$writable = true;
|
||||
@@ -93,16 +101,16 @@ $wp_rewrite->flush_rules();
|
||||
|
||||
<?php if (isset($_POST['submit'])) : ?>
|
||||
<div id="message" class="updated fade"><p><?php
|
||||
if ($writable)
|
||||
_e('Permalink structure updated.');
|
||||
if ( $permalink_structure && !$usingpi && !$writable )
|
||||
_e('You should update your .htaccess now.');
|
||||
else
|
||||
_e('You should update your .htaccess now.');
|
||||
_e('Permalink structure updated.');
|
||||
?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Customize Permalink Structure') ?></h2>
|
||||
<form name="form" action="options-permalink.php" method="post">
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Customize Permalink Structure') ?></h2>
|
||||
<form name="form" action="options-permalink.php" method="post">
|
||||
<?php wp_nonce_field('update-permalink') ?>
|
||||
<p class="submit"><input type="submit" name="submit" value="<?php _e('Update Permalink Structure »') ?>" /></p>
|
||||
<p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
|
||||
@@ -122,20 +130,20 @@ $structures = array(
|
||||
<h3><?php _e('Common options:'); ?></h3>
|
||||
<p>
|
||||
<label>
|
||||
<input name="selection" type="radio" value="" class="tog" <?php checked('', $permalink_structure); ?> />
|
||||
<?php _e('Default'); ?><br /> <span> » <code><?php echo get_option('home'); ?>/?p=123</code></span>
|
||||
<input name="selection" type="radio" value="" class="tog" <?php checked('', $permalink_structure); ?> />
|
||||
<?php _e('Default'); ?><br /> <span> <?php echo _c('»|Used as a list bullet'); ?> <code><?php echo get_option('home'); ?>/?p=123</code></span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="selection" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> />
|
||||
<?php _e('Date and name based'); ?><br /> <span> » <code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></span>
|
||||
<input name="selection" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> />
|
||||
<?php _e('Date and name based'); ?><br /> <span> <?php echo _c('»|Used as a list bullet'); ?> <code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input name="selection" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> />
|
||||
<?php _e('Numeric'); ?><br /> <span> » <code><?php echo get_option('home') . $prefix ; ?>/archives/123</code></span>
|
||||
<input name="selection" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> />
|
||||
<?php _e('Numeric'); ?><br /> <span> <?php echo _c('»|Used as a list bullet'); ?> <code><?php echo get_option('home') . $prefix ; ?>/archives/123</code></span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
@@ -153,25 +161,25 @@ checked="checked"
|
||||
|
||||
<h3><?php _e('Optional'); ?></h3>
|
||||
<?php if ($is_apache) : ?>
|
||||
<p><?php _e('If you like, you may enter a custom prefix for your category <abbr title="Universal Resource Locator">URL</abbr>s here. For example, <code>/taxonomy/tags</code> would make your category links like <code>http://example.org/taxonomy/tags/uncategorized/</code>. If you leave this blank the default will be used.') ?></p>
|
||||
<p><?php _e('If you like, you may enter custom bases for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
|
||||
<?php else : ?>
|
||||
<p><?php _e('If you like, you may enter a custom prefix for your category <abbr title="Universal Resource Locator">URL</abbr>s here. For example, <code>/index.php/taxonomy/tags</code> would make your category links like <code>http://example.org/index.php/taxonomy/tags/uncategorized/</code>. If you leave this blank the default will be used.') ?></p>
|
||||
<p><?php _e('If you like, you may enter custom bases for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
|
||||
<?php endif; ?>
|
||||
<p>
|
||||
<?php _e('Category base'); ?>: <input name="category_base" type="text" class="code" value="<?php echo attribute_escape($category_base); ?>" size="30" />
|
||||
</p>
|
||||
<p class="submit">
|
||||
<input type="submit" name="submit" value="<?php _e('Update Permalink Structure »') ?>" />
|
||||
</p>
|
||||
</form>
|
||||
<p>
|
||||
<?php _e('Category base'); ?>: <input name="category_base" id="category_base" type="text" class="code" value="<?php echo attribute_escape($category_base); ?>" size="30" />
|
||||
</p>
|
||||
<p>
|
||||
<?php _e('Tag base'); ?>: <input name="tag_base" id="tag_base" type="text" class="code" value="<?php echo attribute_escape($tag_base); ?>" size="30" />
|
||||
</p>
|
||||
<p class="submit">
|
||||
<input type="submit" name="submit" value="<?php _e('Update Permalink Structure »') ?>" />
|
||||
</p>
|
||||
</form>
|
||||
<?php if ( $permalink_structure && !$usingpi && !$writable ) : ?>
|
||||
<p><?php _e('If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Make_a_Directory_Writable">writable</a>, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p>
|
||||
<form action="options-permalink.php" method="post">
|
||||
<?php wp_nonce_field('update-permalink') ?>
|
||||
<p>
|
||||
<textarea rows="5" style="width: 98%;" name="rules"><?php echo wp_specialchars($wp_rewrite->mod_rewrite_rules()); ?>
|
||||
</textarea>
|
||||
</p>
|
||||
<p><textarea rows="5" style="width: 98%;" name="rules" id="rules"><?php echo wp_specialchars($wp_rewrite->mod_rewrite_rules()); ?></textarea></p>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
@@ -7,25 +7,25 @@ $parent_file = 'options-general.php';
|
||||
include('admin-header.php');
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Reading Options') ?></h2>
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Reading Options') ?></h2>
|
||||
<form name="form1" method="post" action="options.php">
|
||||
<?php wp_nonce_field('update-options') ?>
|
||||
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /></p>
|
||||
<?php if ( get_pages() ): ?>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Front Page') ?></legend>
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
|
||||
<tr valign="top">
|
||||
<th width="33%" scope="row"><?php _e('Front page displays:')?></th>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Front Page') ?></legend>
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
|
||||
<tr valign="top">
|
||||
<th width="33%" scope="row"><?php _e('Front page displays:')?></th>
|
||||
<td>
|
||||
<p><label>
|
||||
<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
|
||||
<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
|
||||
<?php _e('Your latest posts'); ?>
|
||||
</label>
|
||||
</p>
|
||||
<p><label>
|
||||
<input name="show_on_front" type="radio" value="page" class="tog" <?php checked('page', get_option('show_on_front')); ?> />
|
||||
<input name="show_on_front" type="radio" value="page" class="tog" <?php checked('page', get_option('show_on_front')); ?> />
|
||||
<?php printf(__('A <a href="%s">static page</a> (select below)'), 'edit-pages.php'); ?>
|
||||
</label>
|
||||
</p>
|
||||
@@ -40,30 +40,30 @@ include('admin-header.php');
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<?php endif; ?>
|
||||
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Blog Pages') ?></legend>
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
|
||||
<tr valign="top">
|
||||
<th width="33%" scope="row"><?php _e('Show at most:') ?></th>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Blog Pages') ?></legend>
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
|
||||
<tr valign="top">
|
||||
<th width="33%" scope="row"><?php _e('Show at most:') ?></th>
|
||||
<td>
|
||||
<input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" size="3" /> <?php _e('posts') ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Syndication Feeds') ?></legend>
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
|
||||
<tr valign="top">
|
||||
<th width="33%" scope="row"><?php _e('Show the most recent:') ?></th>
|
||||
<td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" size="3" /> <?php _e('posts') ?></td>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Syndication Feeds') ?></legend>
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
|
||||
<tr valign="top">
|
||||
<th width="33%" scope="row"><?php _e('Show the most recent:') ?></th>
|
||||
<td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" size="3" /> <?php _e('posts') ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('For each article, show:') ?> </th>
|
||||
@@ -72,25 +72,25 @@ include('admin-header.php');
|
||||
<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label></p>
|
||||
<p><?php _e('Note: If you use the <code><!--more--></code> feature, it will cut off posts in RSS feeds.'); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
|
||||
<tr valign="top">
|
||||
<th width="33%" scope="row"><?php _e('Encoding for pages and feeds:') ?></th>
|
||||
<td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option('blog_charset'); ?>" size="20" class="code" /><br />
|
||||
<?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
</fieldset>
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
|
||||
<tr valign="top">
|
||||
<th width="33%" scope="row"><?php _e('Encoding for pages and feeds:') ?></th>
|
||||
<td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option('blog_charset'); ?>" size="20" class="code" /><br />
|
||||
<?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
<label><input type="checkbox" name="gzipcompression" value="1" <?php checked('1', get_option('gzipcompression')); ?> />
|
||||
<label><input type="checkbox" name="gzipcompression" value="1" <?php checked('1', get_option('gzipcompression')); ?> />
|
||||
<?php _e('WordPress should compress articles (gzip) if browsers ask for them') ?></label>
|
||||
</p>
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="posts_per_page,posts_per_rss,rss_use_excerpt,blog_charset,gzipcompression,show_on_front,page_on_front,page_for_posts" />
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="posts_per_page,posts_per_rss,rss_use_excerpt,blog_charset,gzipcompression,show_on_front,page_on_front,page_for_posts" />
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<?php include('./admin-footer.php'); ?>
|
||||
@@ -7,17 +7,17 @@ $parent_file = 'options-general.php';
|
||||
include('admin-header.php');
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Writing Options') ?></h2>
|
||||
<form method="post" action="options.php">
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Writing Options') ?></h2>
|
||||
<form method="post" action="options.php">
|
||||
<?php wp_nonce_field('update-options') ?>
|
||||
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /></p>
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
|
||||
<tr valign="top">
|
||||
<th width="33%" scope="row"> <?php _e('Size of the post box:') ?></th>
|
||||
<td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php form_option('default_post_edit_rows'); ?>" size="2" style="width: 1.5em; " />
|
||||
<?php _e('lines') ?></td>
|
||||
</tr>
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
|
||||
<tr valign="top">
|
||||
<th width="33%" scope="row"> <?php _e('Size of the post box:') ?></th>
|
||||
<td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php form_option('default_post_edit_rows'); ?>" size="2" style="width: 1.5em; " />
|
||||
<?php _e('lines') ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Formatting:') ?></th>
|
||||
<td>
|
||||
@@ -31,11 +31,12 @@ include('admin-header.php');
|
||||
<th scope="row"><?php _e('Default post category:') ?></th>
|
||||
<td><select name="default_category" id="default_category">
|
||||
<?php
|
||||
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
|
||||
$categories = get_categories('get=all');
|
||||
foreach ($categories as $category) :
|
||||
if ($category->cat_ID == get_option('default_category')) $selected = " selected='selected'";
|
||||
$category = sanitize_category($category);
|
||||
if ($category->term_id == get_option('default_category')) $selected = " selected='selected'";
|
||||
else $selected = '';
|
||||
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
|
||||
echo "\n\t<option value='$category->term_id' $selected>$category->name</option>";
|
||||
endforeach;
|
||||
?>
|
||||
</select></td>
|
||||
@@ -44,10 +45,12 @@ endforeach;
|
||||
<th scope="row"><?php _e('Default link category:') ?></th>
|
||||
<td><select name="default_link_category" id="default_link_category">
|
||||
<?php
|
||||
foreach ($categories as $category) :
|
||||
if ($category->cat_ID == get_option('default_link_category')) $selected = " selected='selected'";
|
||||
$link_categories = get_terms('link_category', 'get=all');
|
||||
foreach ($link_categories as $category) :
|
||||
$category = sanitize_term($category, 'link_category');
|
||||
if ($category->term_id == get_option('default_link_category')) $selected = " selected='selected'";
|
||||
else $selected = '';
|
||||
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
|
||||
echo "\n\t<option value='$category->term_id' $selected>$category->name</option>";
|
||||
endforeach;
|
||||
?>
|
||||
</select></td>
|
||||
@@ -82,6 +85,7 @@ endforeach;
|
||||
<?php
|
||||
//Alreay have $categories from default_category
|
||||
foreach ($categories as $category) :
|
||||
$category = sanitize_category($category);
|
||||
if ($category->cat_ID == get_option('default_email_category')) $selected = " selected='selected'";
|
||||
else $selected = '';
|
||||
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
|
||||
|
||||
@@ -10,77 +10,6 @@ wp_reset_vars(array('action'));
|
||||
if ( !current_user_can('manage_options') )
|
||||
wp_die(__('Cheatin’ uh?'));
|
||||
|
||||
function sanitize_option($option, $value) { // Remember to call stripslashes!
|
||||
|
||||
switch ($option) {
|
||||
case 'admin_email':
|
||||
$value = stripslashes($value);
|
||||
$value = sanitize_email($value);
|
||||
break;
|
||||
|
||||
case 'default_post_edit_rows':
|
||||
case 'mailserver_port':
|
||||
case 'comment_max_links':
|
||||
$value = stripslashes($value);
|
||||
$value = abs((int) $value);
|
||||
break;
|
||||
|
||||
case 'posts_per_page':
|
||||
case 'posts_per_rss':
|
||||
$value = stripslashes($value);
|
||||
$value = (int) $value;
|
||||
if ( empty($value) ) $value = 1;
|
||||
if ( $value < -1 ) $value = abs($value);
|
||||
break;
|
||||
|
||||
case 'default_ping_status':
|
||||
case 'default_comment_status':
|
||||
$value = stripslashes($value);
|
||||
// Options that if not there have 0 value but need to be something like "closed"
|
||||
if ( $value == '0' || $value == '')
|
||||
$value = 'closed';
|
||||
break;
|
||||
|
||||
case 'blogdescription':
|
||||
case 'blogname':
|
||||
if (current_user_can('unfiltered_html') == false)
|
||||
$value = wp_filter_post_kses( $value ); // calls stripslashes then addslashes
|
||||
$value = stripslashes($value);
|
||||
break;
|
||||
|
||||
case 'blog_charset':
|
||||
$value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value); // strips slashes
|
||||
break;
|
||||
|
||||
case 'date_format':
|
||||
case 'time_format':
|
||||
case 'mailserver_url':
|
||||
case 'mailserver_login':
|
||||
case 'mailserver_pass':
|
||||
case 'ping_sites':
|
||||
case 'upload_path':
|
||||
$value = strip_tags($value);
|
||||
$value = wp_filter_kses($value); // calls stripslashes then addslashes
|
||||
$value = stripslashes($value);
|
||||
break;
|
||||
|
||||
case 'gmt_offset':
|
||||
$value = preg_replace('/[^0-9:.-]/', '', $value); // strips slashes
|
||||
break;
|
||||
|
||||
case 'siteurl':
|
||||
case 'home':
|
||||
$value = stripslashes($value);
|
||||
$value = clean_url($value);
|
||||
break;
|
||||
default :
|
||||
$value = stripslashes($value);
|
||||
break;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
switch($action) {
|
||||
|
||||
case 'update':
|
||||
@@ -100,15 +29,14 @@ case 'update':
|
||||
if ($options) {
|
||||
foreach ($options as $option) {
|
||||
$option = trim($option);
|
||||
$value = trim($_POST[$option]);
|
||||
$value = sanitize_option($option, $value); // This does stripslashes on those that need it
|
||||
$value = $_POST[$option];
|
||||
if(!is_array($value)) $value = trim($value);
|
||||
$value = stripslashes_deep($value);
|
||||
update_option($option, $value);
|
||||
}
|
||||
}
|
||||
|
||||
$referred = remove_query_arg('updated' , wp_get_referer());
|
||||
|
||||
$goback = add_query_arg('updated', 'true', wp_get_referer());
|
||||
$goback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $goback);
|
||||
wp_redirect($goback);
|
||||
break;
|
||||
|
||||
@@ -153,7 +81,6 @@ foreach ( (array) $options as $option) :
|
||||
else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . attribute_escape($value) . "'$disabled />";
|
||||
|
||||
echo "</td>
|
||||
<td>$option->option_description</td>
|
||||
</tr>";
|
||||
endforeach;
|
||||
?>
|
||||
|
||||
@@ -10,7 +10,7 @@ require_once('admin-header.php');
|
||||
?>
|
||||
|
||||
<?php if ( (isset($_GET['posted']) && $_GET['posted']) || isset($_GET['saved']) ) : ?>
|
||||
<div id="message" class="updated fade"><p><strong><?php _e('Page saved.') ?></strong> <a href="edit-pages.php"><?php _e('Manage pages'); ?></a> | <a href="<?php echo get_page_link( isset($_GET['posted']) ? $_GET['posted'] : $_GET['saved'] ); ?>"><?php _e('View page') ; ?> »</a></p></div>
|
||||
<div id="message" class="updated fade"><p><strong><?php _e('Page saved.') ?></strong> <a href="edit-pages.php"><?php _e('Manage pages'); ?></a> | <a href="<?php echo get_page_link( isset($_GET['posted']) ? $_GET['posted'] : $_GET['saved'] ); ?>"><?php _e('View page »') ; ?></a></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
@@ -23,4 +23,4 @@ if ( current_user_can('edit_pages') ) {
|
||||
}
|
||||
?>
|
||||
|
||||
<?php include('admin-footer.php'); ?>
|
||||
<?php include('admin-footer.php'); ?>
|
||||
|
||||
@@ -45,6 +45,8 @@ case 'edit':
|
||||
$page_ID = $post_ID = $p = (int) $_GET['post'];
|
||||
$post = get_post_to_edit($page_ID);
|
||||
|
||||
if ( empty($post->ID) ) wp_die( __("You attempted to edit a page that doesn't exist. Perhaps it was deleted?") );
|
||||
|
||||
if ( 'post' == $post->post_type ) {
|
||||
wp_redirect("post.php?action=edit&post=$post_ID");
|
||||
exit();
|
||||
@@ -137,7 +139,7 @@ case 'delete':
|
||||
if ( ! wp_delete_attachment($page_id) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
} else {
|
||||
if ( !wp_delete_post($page_id) )
|
||||
if ( !wp_delete_post($page_id) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ if ( isset($_GET['action']) ) {
|
||||
if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
|
||||
wp_die(__('Plugin file does not exist.'));
|
||||
if (!in_array($plugin, $current)) {
|
||||
wp_redirect('plugins.php?error=true'); // we'll override this later if the plugin can be included without fatal error
|
||||
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), 'plugins.php?error=true&plugin=' . $plugin)); // we'll override this later if the plugin can be included without fatal error
|
||||
ob_start();
|
||||
@include(ABSPATH . PLUGINDIR . '/' . $plugin);
|
||||
$current[] = $plugin;
|
||||
@@ -21,7 +21,15 @@ if ( isset($_GET['action']) ) {
|
||||
ob_end_clean();
|
||||
}
|
||||
wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
|
||||
} else if ('deactivate' == $_GET['action']) {
|
||||
} elseif ('error_scrape' == $_GET['action']) {
|
||||
$plugin = trim($_GET['plugin']);
|
||||
check_admin_referer('plugin-activation-error_' . $plugin);
|
||||
if ( validate_file($plugin) )
|
||||
wp_die(__('Invalid plugin.'));
|
||||
if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
|
||||
wp_die(__('Plugin file does not exist.'));
|
||||
include(ABSPATH . PLUGINDIR . '/' . $plugin);
|
||||
} elseif ('deactivate' == $_GET['action']) {
|
||||
check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
|
||||
$current = get_option('active_plugins');
|
||||
array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu!
|
||||
@@ -31,12 +39,12 @@ if ( isset($_GET['action']) ) {
|
||||
} elseif ($_GET['action'] == 'deactivate-all') {
|
||||
check_admin_referer('deactivate-all');
|
||||
$current = get_option('active_plugins');
|
||||
|
||||
|
||||
foreach ($current as $plugin) {
|
||||
array_splice($current, array_search($plugin, $current), 1);
|
||||
do_action('deactivate_' . $plugin);
|
||||
}
|
||||
|
||||
|
||||
update_option('active_plugins', array());
|
||||
wp_redirect('plugins.php?deactivate-all=true');
|
||||
}
|
||||
@@ -73,7 +81,15 @@ foreach ($check_plugins as $check_plugin) {
|
||||
?>
|
||||
|
||||
<?php if ( isset($_GET['error']) ) : ?>
|
||||
<div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p></div>
|
||||
<div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p>
|
||||
<?php
|
||||
$plugin = trim($_GET['plugin']);
|
||||
if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) && 1 == strtolower(ini_get('display_errors'))) { ?>
|
||||
<iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&plugin=<?php echo attribute_escape($plugin); ?>&_wpnonce=<?php echo attribute_escape($_GET['_error_nonce']); ?>"></iframe>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php elseif ( isset($_GET['activate']) ) : ?>
|
||||
<div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
|
||||
<?php elseif ( isset($_GET['deactivate']) ) : ?>
|
||||
@@ -136,17 +152,20 @@ if (empty($plugins)) {
|
||||
else
|
||||
$edit = '';
|
||||
|
||||
$author = ( empty($plugin_data['Author']) ) ? '' : ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
|
||||
|
||||
echo "
|
||||
<tr $style>
|
||||
<td class='name'>{$plugin_data['Title']}</td>
|
||||
<td class='vers'>{$plugin_data['Version']}</td>
|
||||
<td class='desc'><p>{$plugin_data['Description']} <cite>".sprintf(__('By %s'), $plugin_data['Author']).".</cite></p></td>
|
||||
<td class='desc'><p>{$plugin_data['Description']}$author</p></td>
|
||||
<td class='togl'>$toggle</td>";
|
||||
if ( current_user_can('edit_plugins') )
|
||||
echo "
|
||||
<td>$edit</td>";
|
||||
echo"
|
||||
</tr>";
|
||||
do_action( 'after_plugin_row', $plugin_file );
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ require_once ('./admin-header.php');
|
||||
|
||||
if ( ! current_user_can('edit_posts') ) { ?>
|
||||
<div class="wrap">
|
||||
<p><?php printf(__('Since you’re a newcomer, you’ll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br />
|
||||
<p><?php printf(__('Since you’re a newcomer, you’ll have to wait for an admin to add the <code>edit_posts</code> capability to your user, in order to be authorized to post.<br />
|
||||
You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />
|
||||
When you’re promoted, just reload this page and you’ll be able to blog. :)'), get_option('admin_email')); ?>
|
||||
</p>
|
||||
@@ -21,34 +21,65 @@ When you’re promoted, just reload this page and you’ll be able to bl
|
||||
}
|
||||
|
||||
if ( isset($_GET['posted']) && $_GET['posted'] ) : ?>
|
||||
<div id="message" class="updated fade"><p><strong><?php _e('Post saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?> »</a></p></div>
|
||||
<div id="message" class="updated fade"><p><strong><?php _e('Post saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post »'); ?></a></p></div>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
|
||||
|
||||
if ( $drafts = get_users_drafts( $user_ID ) ) { ?>
|
||||
<div class="wrap">
|
||||
<p><strong><?php _e('Your Drafts:') ?></strong>
|
||||
<?php
|
||||
// Show drafts.
|
||||
$num_drafts = count($drafts);
|
||||
if ( $num_drafts > 15 ) $num_drafts = 15;
|
||||
for ( $i = 0; $i < $num_drafts; $i++ ) {
|
||||
$draft = $drafts[$i];
|
||||
if ( 0 != $i )
|
||||
echo ', ';
|
||||
if ( empty($draft->post_title) )
|
||||
$draft->post_title = sprintf(__('Post # %s'), $draft->ID);
|
||||
echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
|
||||
$my_drafts = get_users_drafts($user_ID);
|
||||
$pending = get_others_pending($user_ID);
|
||||
$others_drafts = get_others_drafts($user_ID);
|
||||
|
||||
$nag_posts_limit = (int) apply_filters('nag_posts_limit', 3);
|
||||
|
||||
$nag_posts = array(
|
||||
array(
|
||||
'my_drafts',
|
||||
__('Your Drafts:'),
|
||||
'edit.php?post_status=draft&author=' . $user_ID,
|
||||
count($my_drafts)),
|
||||
array(
|
||||
'pending',
|
||||
__('Pending Review:'),
|
||||
'edit.php?post_status=pending',
|
||||
count($pending)),
|
||||
array(
|
||||
'others_drafts',
|
||||
__('Others’ Drafts:'),
|
||||
'edit.php?post_status=draft&author=-' . $user_ID,
|
||||
count($others_drafts))
|
||||
);
|
||||
|
||||
if ( !empty($my_drafts) || !empty($pending) || !empty($others_drafts) ) {
|
||||
echo '<div class="wrap" id="draft-nag">';
|
||||
|
||||
foreach ( $nag_posts as $nag ) {
|
||||
if ( ${$nag[0]} ) {
|
||||
echo '<p><strong>' . wp_specialchars($nag[1]) . '</strong> ';
|
||||
$i = 0;
|
||||
foreach ( ${$nag[0]} as $post ) {
|
||||
$i++;
|
||||
if ( $i > $nag_posts_limit )
|
||||
break;
|
||||
echo '<a href="post.php?action=edit&post=' . $post->ID . '">';
|
||||
( '' == the_title('', '', FALSE) ) ? printf( __('Post #%s'), $post->ID ) : the_title();
|
||||
echo '</a>';
|
||||
if ( $i < min($nag[3], $nag_posts_limit) )
|
||||
echo ', ';
|
||||
}
|
||||
if ( $nag[3] > $nag_posts_limit )
|
||||
printf(__(', and <a href="%s">%d more</a>'), $nag[2], $nag[3] - $nag_posts_limit);
|
||||
echo '.</p>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 15 < count($drafts) ) { ?>
|
||||
, <a href="edit.php"><?php echo sprintf(__('and %s more'), (count($drafts) - 15) ); ?> »</a>
|
||||
<?php } ?>
|
||||
.</p>
|
||||
</div>
|
||||
<?php
|
||||
echo "</div>\n";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
// Show post form.
|
||||
$post = get_default_post_to_edit();
|
||||
include('edit-form-advanced.php');
|
||||
@@ -57,17 +88,17 @@ include('edit-form-advanced.php');
|
||||
<?php if ( $is_NS4 || $is_gecko || $is_winIE ) { ?>
|
||||
<div id="wp-bookmarklet" class="wrap">
|
||||
<h3><?php _e('WordPress Bookmarklet'); ?></h3>
|
||||
<p><?php _e('Right click on the following link and choose "Add to favorites" to create a posting shortcut.'); ?></p>
|
||||
<p><?php _e('Right click on the following link and choose “Bookmark This Link...” or “Add to Favorites...” to create a posting shortcut.'); ?></p>
|
||||
<p>
|
||||
|
||||
<?php
|
||||
if ($is_NS4 || $is_gecko) {
|
||||
?>
|
||||
<a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}location.href='<?php echo get_option('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&popupurl='+encodeURIComponent(location.href)+'&popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press It - %s'), wp_specialchars(get_option('blogname'))); ?></a>
|
||||
<a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}location.href='<?php echo get_option('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&popupurl='+encodeURIComponent(location.href)+'&popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press It - %s'), get_bloginfo('name', 'display')); ?></a>
|
||||
<?php
|
||||
} else if ($is_winIE) {
|
||||
?>
|
||||
<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;location.href='<?php echo get_option('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&popupurl='+encodeURIComponent(location.href)+'&popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a>
|
||||
<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;location.href='<?php echo get_option('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&popupurl='+encodeURIComponent(location.href)+'&popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press it - %s'), get_bloginfo('name', 'display')); ?></a>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function oneclickbookmarklet(blah) {
|
||||
@@ -78,15 +109,15 @@ window.open ("profile.php?action=IErightclick", "oneclickbookmarklet", "width=50
|
||||
<br />
|
||||
<br />
|
||||
<?php _e('One-click bookmarklet:') ?><br />
|
||||
<a href="javascript:oneclickbookmarklet(0);"><?php _e('click here') ?></a>
|
||||
<a href="javascript:oneclickbookmarklet(0);"><?php _e('click here') ?></a>
|
||||
<?php
|
||||
} else if ($is_opera) {
|
||||
?>
|
||||
<a href="javascript:location.href='<?php echo get_option('siteurl'); ?>/wp-admin/post-new.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a>
|
||||
<a href="javascript:location.href='<?php echo get_option('siteurl'); ?>/wp-admin/post-new.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a>
|
||||
<?php
|
||||
} else if ($is_macIE) {
|
||||
?>
|
||||
<a href="javascript:Q='';location.href='<?php echo get_option('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a>
|
||||
<a href="javascript:Q='';location.href='<?php echo get_option('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -38,6 +38,9 @@ case 'post':
|
||||
if ( isset($_POST['save']) )
|
||||
$location = "post.php?action=edit&post=$post_ID";
|
||||
|
||||
if ( empty($post_ID) )
|
||||
$location = 'post-new.php';
|
||||
|
||||
wp_redirect($location);
|
||||
exit();
|
||||
break;
|
||||
@@ -48,6 +51,8 @@ case 'edit':
|
||||
$post_ID = $p = (int) $_GET['post'];
|
||||
$post = get_post($post_ID);
|
||||
|
||||
if ( empty($post->ID) ) wp_die( __("You attempted to edit a post that doesn't exist. Perhaps it was deleted?") );
|
||||
|
||||
if ( 'page' == $post->post_type ) {
|
||||
wp_redirect("page.php?action=edit&post=$post_ID");
|
||||
exit();
|
||||
@@ -149,7 +154,7 @@ case 'delete':
|
||||
if ( ! wp_delete_attachment($post_id) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
} else {
|
||||
if ( !wp_delete_post($post_id) )
|
||||
if ( !wp_delete_post($post_id) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
}
|
||||
|
||||
|
||||
@@ -39,23 +39,23 @@ $bookmarklet_height= 440;
|
||||
|
||||
<p class="submit"><input type="submit" value="<?php _e('Update Profile »') ?>" name="submit" /></p>
|
||||
|
||||
<fieldset>
|
||||
<fieldset id="information">
|
||||
<legend><?php _e('Name'); ?></legend>
|
||||
<p><label><?php _e('Username: (no editing)'); ?><br />
|
||||
<input type="text" name="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" />
|
||||
</label></p>
|
||||
|
||||
<p><label><?php _e('First name:') ?><br />
|
||||
<input type="text" name="first_name" value="<?php echo $profileuser->first_name ?>" /></label></p>
|
||||
<input type="text" name="first_name" id="first_name" value="<?php echo $profileuser->first_name ?>" /></label></p>
|
||||
|
||||
<p><label><?php _e('Last name:') ?><br />
|
||||
<input type="text" name="last_name" value="<?php echo $profileuser->last_name ?>" /></label></p>
|
||||
<input type="text" name="last_name" id="last_name" value="<?php echo $profileuser->last_name ?>" /></label></p>
|
||||
|
||||
<p><label><?php _e('Nickname:') ?><br />
|
||||
<input type="text" name="nickname" value="<?php echo $profileuser->nickname ?>" /></label></p>
|
||||
<input type="text" name="nickname" id="nickname" value="<?php echo $profileuser->nickname ?>" /></label></p>
|
||||
|
||||
<p><label><?php _e('Display name publicly as:') ?> <br />
|
||||
<select name="display_name">
|
||||
<select name="display_name" id="display_name">
|
||||
<option value="<?php echo $profileuser->display_name; ?>"><?php echo $profileuser->display_name; ?></option>
|
||||
<option value="<?php echo $profileuser->nickname ?>"><?php echo $profileuser->nickname ?></option>
|
||||
<option value="<?php echo $profileuser->user_login ?>"><?php echo $profileuser->user_login ?></option>
|
||||
@@ -72,47 +72,47 @@ $bookmarklet_height= 440;
|
||||
</select></label></p>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<fieldset id="contact-info">
|
||||
<legend><?php _e('Contact Info'); ?></legend>
|
||||
|
||||
<p><label><?php _e('E-mail: (required)') ?><br />
|
||||
<input type="text" name="email" value="<?php echo $profileuser->user_email ?>" /></label></p>
|
||||
<input type="text" name="email" id="email" value="<?php echo $profileuser->user_email ?>" /></label></p>
|
||||
|
||||
<p><label><?php _e('Website:') ?><br />
|
||||
<input type="text" name="url" value="<?php echo $profileuser->user_url ?>" />
|
||||
<input type="text" name="url" id="url" value="<?php echo $profileuser->user_url ?>" />
|
||||
</label></p>
|
||||
|
||||
<p><label><?php _e('AIM:') ?><br />
|
||||
<input type="text" name="aim" value="<?php echo $profileuser->aim ?>" />
|
||||
<input type="text" name="aim" id="aim" value="<?php echo $profileuser->aim ?>" />
|
||||
</label></p>
|
||||
|
||||
<p><label><?php _e('Yahoo IM:') ?><br />
|
||||
<input type="text" name="yim" value="<?php echo $profileuser->yim ?>" />
|
||||
<input type="text" name="yim" id="yim" value="<?php echo $profileuser->yim ?>" />
|
||||
</label></p>
|
||||
|
||||
<p><label><?php _e('Jabber / Google Talk:') ?><br />
|
||||
<input type="text" name="jabber" value="<?php echo $profileuser->jabber ?>" /></label>
|
||||
<input type="text" name="jabber" id="jabber" value="<?php echo $profileuser->jabber ?>" /></label>
|
||||
</p>
|
||||
</fieldset>
|
||||
<br clear="all" />
|
||||
<fieldset>
|
||||
<fieldset id="about-yourself">
|
||||
<legend><?php _e('About Yourself'); ?></legend>
|
||||
<p class="desc"><?php _e('Share a little biographical information. '); ?></p>
|
||||
<p><textarea name="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea></p>
|
||||
<p><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea></p>
|
||||
</fieldset>
|
||||
|
||||
<?php
|
||||
$show_password_fields = apply_filters('show_password_fields', true);
|
||||
if ( $show_password_fields ) :
|
||||
?>
|
||||
<fieldset>
|
||||
<fieldset id="update-password">
|
||||
<legend><?php _e('Update Your Password'); ?></legend>
|
||||
<p class="desc"><?php _e('If you would like to change your password type a new one twice below. Otherwise leave this blank.'); ?></p>
|
||||
<p><label><?php _e('New Password:'); ?><br />
|
||||
<input type="password" name="pass1" size="16" value="" />
|
||||
<input type="password" name="pass1" id="pass1" size="16" value="" />
|
||||
</label></p>
|
||||
<p><label><?php _e('Type it one more time:'); ?><br />
|
||||
<input type="password" name="pass2" size="16" value="" />
|
||||
<input type="password" name="pass2" id="pass2" size="16" value="" />
|
||||
</label></p>
|
||||
</fieldset>
|
||||
<?php endif; ?>
|
||||
|
||||
296
wp-admin/rtl.css
296
wp-admin/rtl.css
@@ -1,205 +1,133 @@
|
||||
#viewarc, #viewcat, #namediv, #emaildiv, #uridiv, #planetnews li, #login ul li, #your-profile fieldset,
|
||||
#footer .logo, .alignleft .available-theme { float: right; }
|
||||
|
||||
#templateside, .alignright { float: left; }
|
||||
|
||||
#login #send, .readmore, .widefat th { text-align: right; }
|
||||
|
||||
#postcustomsubmit, form#upload th, .submit, .editform th { text-align: left; }
|
||||
|
||||
#devnews h4, #wphead h1, #your-profile legend, fieldset.options legend,
|
||||
#planetnews li .post { font-family: Tahoma, Georgia, "Times New Roman", Times, serif; }
|
||||
|
||||
#wphead { padding: .8em 2em .8em 19em; }
|
||||
|
||||
#wphead h1 { font-size: 2.4em; }
|
||||
|
||||
#postdiv, #titlediv, #guiddiv, #tagdiv { margin: 0 0 0 8px; }
|
||||
|
||||
#ed_toolbar input { margin: 3px 0 2px 2px; }
|
||||
|
||||
#edButtons input, #edButtons input:active { margin: 0px 0 -1px 2px; }
|
||||
|
||||
body, td { font: 13px Tahoma, "Lucida Grande", "Lucida Sans Unicode", Verdana; }
|
||||
|
||||
h2 { font: normal 32px/5px serif; }
|
||||
|
||||
textarea, input, select { font: 13px Tahoma, Verdana, Arial, Helvetica, sans-serif; }
|
||||
|
||||
.quicktags, .search { font: 12px Tahoma, Georgia, "Times New Roman", Times, serif; }
|
||||
|
||||
.updated, .confirm { padding: 0 3em 0 1em; }
|
||||
|
||||
.submit input, .submit input:focus, .button, .button:focus {
|
||||
border-left-color: #999;
|
||||
border-right-color: #ccc;
|
||||
}
|
||||
|
||||
.submit input:active, .button:active {
|
||||
border-left-color: #ccc;
|
||||
border-right-color: #999;
|
||||
}
|
||||
|
||||
html,
|
||||
.dbx-handle,
|
||||
#post_name,
|
||||
input[name=link_url],
|
||||
input[name=link_image],
|
||||
input[name=opml_url],
|
||||
input[name=file],
|
||||
input#rss_uri,
|
||||
#template #newcontent,
|
||||
#devnews,
|
||||
#planetnews,
|
||||
#content,
|
||||
body.login #login a,
|
||||
#newcomment_author_url,
|
||||
#email {
|
||||
direction: ltr;
|
||||
}
|
||||
#adminmenu,
|
||||
#submenu,
|
||||
#minisub,
|
||||
.wrap,
|
||||
.updated,
|
||||
.confirm,
|
||||
#devnews h3,
|
||||
#planetnews h3,
|
||||
#wphead,
|
||||
#user_info,
|
||||
body.login,
|
||||
#login_error {
|
||||
direction: rtl;
|
||||
}
|
||||
p.submit,
|
||||
.dbx-handle {
|
||||
text-align: left;
|
||||
}
|
||||
html *,
|
||||
select,
|
||||
input,
|
||||
table * {
|
||||
font-family: tahoma, Tahoma, "Times New Roman", Times, serif;
|
||||
}
|
||||
#wphead {
|
||||
padding: .8em 2em .8em 19em;
|
||||
}
|
||||
#user_info {
|
||||
right: auto;
|
||||
left: 1em;
|
||||
}
|
||||
#adminmenu {
|
||||
padding: .2em 2em .3em .2em;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
#adminmenu li { line-height: 160%; }
|
||||
|
||||
}
|
||||
* html #adminmenu {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
#adminmenu a {
|
||||
margin: 0 0 0 10px;
|
||||
display: block;
|
||||
float: right;
|
||||
}
|
||||
|
||||
font: 700 16px/130% "Times New Roman", Times, serif;
|
||||
}
|
||||
#adminmenu a.current {
|
||||
border-right: 0;
|
||||
border-left: 2px solid #4f96c8;
|
||||
}
|
||||
|
||||
#submenu, #minisub { padding: 1px 3em 0 2em; }
|
||||
|
||||
#submenu { height: 28px; }
|
||||
|
||||
#submenu li { line-height: 160%; }
|
||||
|
||||
}
|
||||
#submenu, #minisub {
|
||||
padding: 1px 3em 0 2em;
|
||||
}
|
||||
#submenu {
|
||||
height: 28px;
|
||||
}
|
||||
#submenu a {
|
||||
margin: 0 0 0 10px;
|
||||
display: block;
|
||||
float: right;
|
||||
}
|
||||
|
||||
line-height: 155%;
|
||||
}
|
||||
#submenu .current {
|
||||
border-right: 0;
|
||||
border-left: 2px solid #045290;
|
||||
}
|
||||
|
||||
#currenttheme img {
|
||||
float: right;
|
||||
margin-right: auto;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
#postdiv #quicktags {
|
||||
padding-right: 0;
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
.readmore {
|
||||
margin-right: auto;
|
||||
margin-left: 5em;
|
||||
}
|
||||
|
||||
#postexcerpt div, #attachmentlinks div {
|
||||
margin-right: auto;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
* html #postexcerpt .dbx-toggle-open {
|
||||
padding-right: 0;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
#searchform {
|
||||
float: right;
|
||||
margin-right: auto;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
#poststuff {
|
||||
margin-right: auto;
|
||||
margin-left: 16em;
|
||||
}
|
||||
|
||||
#template div {
|
||||
margin-right: auto;
|
||||
margin-left: 190px;
|
||||
}
|
||||
|
||||
* html #template div {
|
||||
margin-right: auto;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
#user_info {
|
||||
right: auto;
|
||||
left: 1em;
|
||||
}
|
||||
|
||||
#zeitgeist {
|
||||
float: left;
|
||||
margin-left: auto;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
#zeitgeist ul {
|
||||
margin: 0 .6em .3em 0;
|
||||
padding: 0 .6em 0 0;
|
||||
}
|
||||
|
||||
#categorydiv ul {
|
||||
margin-left: auto;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#moremeta fieldset div { margin: 2px 0px 0 0; }
|
||||
|
||||
#moremeta {
|
||||
margin-right: auto;
|
||||
margin-left: 15px;
|
||||
right: auto;
|
||||
left: 5%;
|
||||
}
|
||||
|
||||
#moremeta .dbx-content {
|
||||
background: url(images/box-butt.gif) no-repeat bottom left;
|
||||
padding-right: 0;
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
#moremeta .dbx-handle { background: #2685af url(images/box-head.gif) no-repeat left; }
|
||||
|
||||
#moremeta .dbx-box { background: url(images/box-bg.gif) repeat-y left; }
|
||||
|
||||
a.dbx-toggle, a.dbx-toggle:visited {
|
||||
right: auto;
|
||||
left: 2px;
|
||||
}
|
||||
|
||||
#advancedstuff a.dbx-toggle, #advancedstuff a.dbx-toggle-open:visited {
|
||||
right: auto;
|
||||
left: 5px;
|
||||
}
|
||||
|
||||
#advancedstuff a.dbx-toggle-open, #advancedstuff a.dbx-toggle-open:visited {
|
||||
right: auto;
|
||||
left: 5px;
|
||||
}
|
||||
|
||||
#categorychecklist {
|
||||
margin-right: auto;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
#ajax-response.alignleft {
|
||||
margin-left: auto;
|
||||
margin-right: 2em;
|
||||
}
|
||||
|
||||
#postdivrich #edButtons {
|
||||
padding-left: 0;
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
}
|
||||
.dbx-content input, .dbx-content select {
|
||||
margin-right: 8px;
|
||||
}
|
||||
#newcat {
|
||||
width: 100px;
|
||||
}
|
||||
.updated, .confirm {
|
||||
background-position: 98.5%;
|
||||
padding: 0 3em 0 1em;
|
||||
}
|
||||
.page-numbers {
|
||||
margin-right: auto;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
}
|
||||
.wrap ul {
|
||||
margin-right: 45%;
|
||||
margin-left: 0;
|
||||
}
|
||||
* html .wrap ul {
|
||||
margin-right: 50%;
|
||||
}
|
||||
.wrap h2 {
|
||||
font-family: "Times New Roman", Times, serif;
|
||||
}
|
||||
#zeitgeist {
|
||||
margin-right: 1em;
|
||||
}
|
||||
#zeitgeist ul {
|
||||
margin: 0 .6em .3em 0;
|
||||
padding: 0 .6em 0 0;
|
||||
}
|
||||
#categorydiv ul {
|
||||
margin-left: auto;
|
||||
margin-right: 10px;
|
||||
}
|
||||
a.view-link {
|
||||
right:auto;
|
||||
left:5%;
|
||||
margin-right:0;
|
||||
margin-left:220px;
|
||||
}
|
||||
left: 6%;
|
||||
right: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
#postdiv #quicktags {
|
||||
padding-right: 0;
|
||||
padding-left: 6px;
|
||||
margin-right: 0;
|
||||
}
|
||||
.options ul {
|
||||
margin-right: 0;
|
||||
}
|
||||
*form#template > div > textarea#newcontent {
|
||||
margin-right: -300px;
|
||||
width: 107%;
|
||||
}
|
||||
@@ -1,19 +1,28 @@
|
||||
<?php
|
||||
define('WP_INSTALLING', true);
|
||||
|
||||
require_once('../wp-includes/compat.php');
|
||||
require_once('../wp-includes/functions.php');
|
||||
|
||||
if (!file_exists('../wp-config-sample.php'))
|
||||
die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
|
||||
wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
|
||||
|
||||
$configFile = file('../wp-config-sample.php');
|
||||
|
||||
if (!is_writable('../')) die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually.");
|
||||
if ( !is_writable('../'))
|
||||
wp_die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually.");
|
||||
|
||||
// Check if wp-config.php has been created
|
||||
if (file_exists('../wp-config.php'))
|
||||
wp_die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>");
|
||||
|
||||
if (isset($_GET['step']))
|
||||
$step = $_GET['step'];
|
||||
else
|
||||
$step = 0;
|
||||
header( 'Content-Type: text/html; charset=utf-8' );
|
||||
|
||||
function display_header(){
|
||||
header( 'Content-Type: text/html; charset=utf-8' );
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
@@ -76,12 +85,11 @@ header( 'Content-Type: text/html; charset=utf-8' );
|
||||
<body>
|
||||
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
|
||||
<?php
|
||||
// Check if wp-config.php has been created
|
||||
if (file_exists('../wp-config.php'))
|
||||
die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p></body></html>");
|
||||
}//end function display_header();
|
||||
|
||||
switch($step) {
|
||||
case 0:
|
||||
display_header();
|
||||
?>
|
||||
|
||||
<p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p>
|
||||
@@ -98,6 +106,7 @@ switch($step) {
|
||||
break;
|
||||
|
||||
case 1:
|
||||
display_header();
|
||||
?>
|
||||
</p>
|
||||
<form method="post" action="setup-config.php?step=2">
|
||||
@@ -177,6 +186,8 @@ switch($step) {
|
||||
}
|
||||
fclose($handle);
|
||||
chmod('../wp-config.php', 0666);
|
||||
|
||||
display_header();
|
||||
?>
|
||||
<p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p>
|
||||
<?php
|
||||
|
||||
@@ -13,7 +13,7 @@ if ('b' == $_GET['a']) {
|
||||
<head>
|
||||
<title>WordPress › Posted</title>
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=UTF-8" />
|
||||
<link rel="stylesheet" href="wp-admin.css" type="text/css" />
|
||||
<?php wp_admin_css(); ?>
|
||||
</head>
|
||||
<body>
|
||||
<p>Posted !</p>
|
||||
@@ -28,7 +28,7 @@ if ('b' == $_GET['a']) {
|
||||
<head>
|
||||
<title>WordPress › Sidebar</title>
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('blog_charset'); ?>" />
|
||||
<link rel="stylesheet" href="wp-admin.css" type="text/css" />
|
||||
<?php wp_admin_css(); ?>
|
||||
<style type="text/css" media="screen">
|
||||
form {
|
||||
padding: 3px;
|
||||
|
||||
@@ -97,7 +97,7 @@ default:
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="wrap">
|
||||
<div class="wrap">
|
||||
<?php
|
||||
if ( is_writeable($real_file) ) {
|
||||
echo '<h2>' . sprintf(__('Editing <code>%s</code>'), $file_show) . '</h2>';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user