Version Description
- added support for comment columns
- added support for link columns
- added links to taxonomies
- added sorting user custom fields
- added sorting to links columns
- added user columns so you can see how many articles an author has published of a certain post type
- added Textual help
- added the option to specify column width
- added role column to all posts screens
- added posts status column to all posts screens
- added image path to media library
- added added apply_filters('cpac-get-post-types', $post_types) to filter out certain post types
- added option to enter license key for activating sorting on ALL columns
- fixed a php5 warning
- fixed a conflict with the Co-Authors plugin
Download this release
Release Info
Developer | codepress |
Plugin | Admin Columns |
Version | 1.4 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.4
- assets/css/admin-column.css +332 -18
- assets/css/column.css +7 -0
- assets/images/addon_sortable_1.png +0 -0
- assets/images/arrows.png +0 -0
- assets/images/cross.png +0 -0
- assets/images/information.png +0 -0
- assets/images/loading.gif +0 -0
- assets/images/no.png +0 -0
- assets/images/reorder_arrow.png +0 -0
- assets/images/settings.png +0 -0
- assets/images/sort.png +0 -0
- assets/images/square.png +0 -0
- assets/js/admin-column.js +230 -6
- assets/js/jquery.qtip.js +19 -0
- assets/ui-theme/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- assets/ui-theme/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- assets/ui-theme/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- assets/ui-theme/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- assets/ui-theme/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- assets/ui-theme/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- assets/ui-theme/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- assets/ui-theme/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- assets/ui-theme/images/ui-icons_222222_256x240.png +0 -0
- assets/ui-theme/images/ui-icons_2e83ff_256x240.png +0 -0
- assets/ui-theme/images/ui-icons_454545_256x240.png +0 -0
- assets/ui-theme/images/ui-icons_888888_256x240.png +0 -0
- assets/ui-theme/images/ui-icons_cd0a0a_256x240.png +0 -0
- assets/ui-theme/jquery-ui-1.8.18.custom.css +120 -0
- classes/sortable.php +890 -0
- codepress-admin-columns.php +2503 -644
- languages/codepress-admin-columns-nl_NL.mo +0 -0
- languages/codepress-admin-columns-nl_NL.po +262 -212
- readme.txt +147 -25
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- screenshot-5.png +0 -0
- screenshot-6.png +0 -0
- screenshot-7.png +0 -0
assets/css/admin-column.css
CHANGED
@@ -1,15 +1,58 @@
|
|
1 |
-
#
|
|
|
|
|
2 |
#cpac .postbox {
|
3 |
margin: 0 10px 10px 0;
|
4 |
}
|
5 |
#cpac .cpac-menu {
|
6 |
clear: both;
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
}
|
10 |
#icon-codepress-admin-columns {
|
11 |
background: transparent url('../images/icon.png') no-repeat 0 0;
|
12 |
}
|
|
|
|
|
|
|
13 |
#general-cpac-settings > .inside {
|
14 |
padding: 0;
|
15 |
margin: 0;
|
@@ -34,18 +77,30 @@
|
|
34 |
#general-cpac-settings table.form-table tr.bottom td {
|
35 |
border-bottom: none;
|
36 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
#general-cpac-settings .cpac-box {
|
38 |
position: relative;
|
39 |
}
|
40 |
#general-cpac-settings .cpac-option-list {
|
41 |
overflow: hidden;
|
42 |
-
width: 360px;
|
|
|
43 |
}
|
44 |
#general-cpac-settings .cpac-reorder-msg {
|
45 |
-
background: transparent url('../images/
|
46 |
margin-left: 5px;
|
47 |
height: 23px;
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
49 |
clear: both;
|
50 |
}
|
51 |
#general-cpac-settings .cpac-option-list li {
|
@@ -63,19 +118,9 @@
|
|
63 |
background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec);
|
64 |
background-image: linear-gradient(top, #f9f9f9, #ececec);
|
65 |
border-radius: 3px 3px 3px 3px;
|
66 |
-
border: 1px solid #
|
67 |
margin-top: 1px;
|
68 |
}
|
69 |
-
#general-cpac-settings .cpac-option-list li.active {
|
70 |
-
background-color: #d8d8d8;
|
71 |
-
background-image: -ms-linear-gradient(top, #f0f0f0, #d8d8d8);
|
72 |
-
background-image: -moz-linear-gradient(top, #f0f0f0, #d8d8d8);
|
73 |
-
background-image: -o-linear-gradient(top, #f0f0f0, #d8d8d8);
|
74 |
-
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0f0f0), to(#d8d8d8));
|
75 |
-
background-image: -webkit-linear-gradient(top, #f0f0f0, #d8d8d8);
|
76 |
-
background-image: linear-gradient(top, #f0f0f0, #d8d8d8);
|
77 |
-
border-color: #c5c5c5;
|
78 |
-
}
|
79 |
#general-cpac-settings .cpac-option-list li .cpac-sort-handle {
|
80 |
background: transparent url('../images/sort.png') no-repeat 5px 5px;
|
81 |
width: 20px;
|
@@ -109,7 +154,8 @@
|
|
109 |
display: block;
|
110 |
margin-right: 30px;
|
111 |
overflow: hidden;
|
112 |
-
height:
|
|
|
113 |
}
|
114 |
#general-cpac-settings .cpac-option-list li .cpac-type-options input {
|
115 |
margin-top: 6px;
|
@@ -130,6 +176,11 @@
|
|
130 |
text-indent: -999em;
|
131 |
overflow: hidden;
|
132 |
}
|
|
|
|
|
|
|
|
|
|
|
133 |
#general-cpac-settings .cpac-option-list li div.cpac-meta-title span {
|
134 |
display: inline-block;
|
135 |
margin: 5px 5px 0 0;
|
@@ -165,6 +216,31 @@
|
|
165 |
#general-cpac-settings .cpac-option-list li .cpac-type-inside select {
|
166 |
min-width: 184px;
|
167 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
#general-cpac-settings .cpac-add-column a {
|
169 |
display: block;
|
170 |
}
|
@@ -187,6 +263,123 @@
|
|
187 |
color: #832525;
|
188 |
text-shadow: none;
|
189 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
#restore-cpac-settings .inside {
|
191 |
padding: 10px;
|
192 |
}
|
@@ -206,4 +399,125 @@
|
|
206 |
}
|
207 |
#restore-cpac-settings .inside .description {
|
208 |
color: #832525;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
}
|
1 |
+
#cpac {
|
2 |
+
/* overflow: hidden; */
|
3 |
+
}
|
4 |
#cpac .postbox {
|
5 |
margin: 0 10px 10px 0;
|
6 |
}
|
7 |
#cpac .cpac-menu {
|
8 |
clear: both;
|
9 |
+
overflow: hidden;
|
10 |
+
margin-right: 276px;
|
11 |
+
}
|
12 |
+
#cpac .cpac-menu .subsubsub {
|
13 |
+
white-space: normal;
|
14 |
+
margin-right: 14px;
|
15 |
+
}
|
16 |
+
#cpac .cpac-settings-link {
|
17 |
+
float: right;
|
18 |
+
float: right;
|
19 |
+
margin: 12px 14px 5px 0;
|
20 |
+
background: transparent url('../images/settings.png') no-repeat 0 0;
|
21 |
+
padding-left: 20px;
|
22 |
+
text-decoration: none;
|
23 |
+
display: inline-block;
|
24 |
+
line-height: 16px;
|
25 |
+
}
|
26 |
+
#cpac .cpac-settings-link.current {
|
27 |
+
font-weight: bold;
|
28 |
+
}
|
29 |
+
#cpac .cpac-col-left {
|
30 |
+
/* width: 70%; */
|
31 |
+
clear: left;
|
32 |
+
float: left;
|
33 |
+
margin-right: -2000px;
|
34 |
+
width: 100%;
|
35 |
+
}
|
36 |
+
#cpac .cpac-col-left .metabox-holder {
|
37 |
+
margin-right: 276px;
|
38 |
+
}
|
39 |
+
#cpac .cpac-col-right {
|
40 |
+
/* width: 20%; */
|
41 |
+
margin-right: auto;
|
42 |
+
width: 266px;
|
43 |
+
float: right;
|
44 |
+
position: relative;
|
45 |
+
clear: right;
|
46 |
+
}
|
47 |
+
#cpac .cpac-col-right .inside {
|
48 |
+
padding: 0 10px;
|
49 |
}
|
50 |
#icon-codepress-admin-columns {
|
51 |
background: transparent url('../images/icon.png') no-repeat 0 0;
|
52 |
}
|
53 |
+
|
54 |
+
/* =General settings
|
55 |
+
-------------------------------------------------------------- */
|
56 |
#general-cpac-settings > .inside {
|
57 |
padding: 0;
|
58 |
margin: 0;
|
77 |
#general-cpac-settings table.form-table tr.bottom td {
|
78 |
border-bottom: none;
|
79 |
}
|
80 |
+
#general-cpac-settings a.go-to-screen {
|
81 |
+
display: block;
|
82 |
+
padding: 5px 0;
|
83 |
+
font-weight: normal;
|
84 |
+
text-decoration: none;
|
85 |
+
}
|
86 |
#general-cpac-settings .cpac-box {
|
87 |
position: relative;
|
88 |
}
|
89 |
#general-cpac-settings .cpac-option-list {
|
90 |
overflow: hidden;
|
91 |
+
width: 360px;
|
92 |
+
margin-bottom: 5px;
|
93 |
}
|
94 |
#general-cpac-settings .cpac-reorder-msg {
|
95 |
+
background: transparent url('../images/reorder_arrow.png') no-repeat scroll 0 0;
|
96 |
margin-left: 5px;
|
97 |
height: 23px;
|
98 |
+
line-height: 25px;
|
99 |
+
padding-left: 25px;
|
100 |
+
color: #727272;
|
101 |
+
font-size: 12px;
|
102 |
+
font-family: 'Trebuchet MS', Arial, Verdana;
|
103 |
+
font-style: italic;
|
104 |
clear: both;
|
105 |
}
|
106 |
#general-cpac-settings .cpac-option-list li {
|
118 |
background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec);
|
119 |
background-image: linear-gradient(top, #f9f9f9, #ececec);
|
120 |
border-radius: 3px 3px 3px 3px;
|
121 |
+
border: 1px solid #cbcbcb;
|
122 |
margin-top: 1px;
|
123 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
#general-cpac-settings .cpac-option-list li .cpac-sort-handle {
|
125 |
background: transparent url('../images/sort.png') no-repeat 5px 5px;
|
126 |
width: 20px;
|
154 |
display: block;
|
155 |
margin-right: 30px;
|
156 |
overflow: hidden;
|
157 |
+
height: 17px;
|
158 |
+
line-height: 17px;
|
159 |
}
|
160 |
#general-cpac-settings .cpac-option-list li .cpac-type-options input {
|
161 |
margin-top: 6px;
|
176 |
text-indent: -999em;
|
177 |
overflow: hidden;
|
178 |
}
|
179 |
+
#general-cpac-settings .cpac-option-list li.opened a.cpac-action {}
|
180 |
+
#general-cpac-settings .cpac-option-list li.active a.cpac-action {
|
181 |
+
background-position: 50% -66px;
|
182 |
+
}
|
183 |
+
#general-cpac-settings .cpac-option-list li.active.opened a.cpac-action {}
|
184 |
#general-cpac-settings .cpac-option-list li div.cpac-meta-title span {
|
185 |
display: inline-block;
|
186 |
margin: 5px 5px 0 0;
|
216 |
#general-cpac-settings .cpac-option-list li .cpac-type-inside select {
|
217 |
min-width: 184px;
|
218 |
}
|
219 |
+
#general-cpac-settings .cpac-option-list li .cpac-type-inside input.input-width {
|
220 |
+
min-width: 25px;
|
221 |
+
width: 25px;
|
222 |
+
border: none;
|
223 |
+
background: transparent;
|
224 |
+
padding: 0;
|
225 |
+
margin-left: 0px;
|
226 |
+
text-align: right;
|
227 |
+
}
|
228 |
+
#general-cpac-settings .cpac-option-list li .cpac-type-inside div.input-width-range {
|
229 |
+
display: inline-block;
|
230 |
+
min-width: 136px;
|
231 |
+
width: 136px;
|
232 |
+
margin: 8px 0 0;
|
233 |
+
position: relative;
|
234 |
+
}
|
235 |
+
#general-cpac-settings .cpac-option-list li .cpac-type-inside div.input-width-range .ui-slider-handle {
|
236 |
+
cursor:e-resize;
|
237 |
+
}
|
238 |
+
#general-cpac-settings .cpac-option-list li .cpac-type-inside div.description {
|
239 |
+
display: inline-block;
|
240 |
+
font-size: 11px;
|
241 |
+
padding: 0 4px 0 0;
|
242 |
+
width: 36px;
|
243 |
+
}
|
244 |
#general-cpac-settings .cpac-add-column a {
|
245 |
display: block;
|
246 |
}
|
263 |
color: #832525;
|
264 |
text-shadow: none;
|
265 |
}
|
266 |
+
#general-cpac-settings .cpac-option-list li.active {
|
267 |
+
background-color: #c7c7c7;
|
268 |
+
background-image: -ms-linear-gradient(top, #e9e9e9, #c7c7c7);
|
269 |
+
background-image: -moz-linear-gradient(top, #e9e9e9, #c7c7c7);
|
270 |
+
background-image: -o-linear-gradient(top, #e9e9e9, #c7c7c7);
|
271 |
+
background-image: -webkit-gradient(linear, left top, left bottom, from(#e9e9e9), to(#c7c7c7));
|
272 |
+
background-image: -webkit-linear-gradient(top, #e9e9e9, #c7c7c7);
|
273 |
+
background-image: linear-gradient(top, #e9e9e9, #c7c7c7);
|
274 |
+
border-color: #aeaeae;
|
275 |
+
}
|
276 |
+
#general-cpac-settings .cpac-option-list li.active .cpac-sort-handle {
|
277 |
+
background-position: 5px -19px;
|
278 |
+
}
|
279 |
+
#general-cpac-settings .cpac-option-list li.active div.cpac-meta-title {
|
280 |
+
color: #151515;
|
281 |
+
}
|
282 |
+
#general-cpac-settings .cpac-option-list li.active div.cpac-meta-title span {
|
283 |
+
color: #5c5c5c
|
284 |
+
}
|
285 |
+
|
286 |
+
/* =Plugin settings (Options)
|
287 |
+
-------------------------------------------------------------- */
|
288 |
+
#cpac-box-plugin_settings {}
|
289 |
+
#cpac-box-plugin_settings > td {
|
290 |
+
border: none;
|
291 |
+
padding: 0;
|
292 |
+
margin: 0;
|
293 |
+
}
|
294 |
+
#cpac-box-plugin_settings table.nopadding {
|
295 |
+
border-collapse: separate;
|
296 |
+
border-spacing: 0;
|
297 |
+
border: none;
|
298 |
+
width: 100%;
|
299 |
+
}
|
300 |
+
#cpac-box-plugin_settings table.nopadding tr.last > td {
|
301 |
+
border-bottom: none;
|
302 |
+
border-top: none;
|
303 |
+
}
|
304 |
+
#cpac-box-plugin_settings table.addons {
|
305 |
+
/* max-width: 620px; */
|
306 |
+
}
|
307 |
+
#cpac-box-plugin_settings table.addons th.activation_type {
|
308 |
+
width: 110px;
|
309 |
+
}
|
310 |
+
#cpac-box-plugin_settings table.addons th.activation_status {
|
311 |
+
width: 90px;
|
312 |
+
}
|
313 |
+
#cpac-box-plugin_settings table.addons th.activation_code {
|
314 |
+
/* width: auto; */
|
315 |
+
min-width: 260px;
|
316 |
+
}
|
317 |
+
#cpac-box-plugin_settings table.addons th.activation_more {
|
318 |
+
/* min-width: 120px; */
|
319 |
+
text-align: left;
|
320 |
+
width: auto;
|
321 |
+
}
|
322 |
+
#cpac-box-plugin_settings table.addons td.activation_type span {
|
323 |
+
font-size: 14px;
|
324 |
+
display: inline-block;
|
325 |
+
background: transparent url('../images/information.png') no-repeat right 50%;
|
326 |
+
padding-right: 20px;
|
327 |
+
}
|
328 |
+
#cpac-box-plugin_settings table.addons td {
|
329 |
+
background: #ffffff;
|
330 |
+
/* vertical-align: middle; */
|
331 |
+
padding: 18px 10px;
|
332 |
+
}
|
333 |
+
#cpac-box-plugin_settings table.addons td.activation_code input {
|
334 |
+
width: 176px;
|
335 |
+
color: #555555;
|
336 |
+
font-family: Arial;
|
337 |
+
font-size: 12px;
|
338 |
+
}
|
339 |
+
#cpac-box-plugin_settings table.addons td.activation_more {
|
340 |
+
text-align: left;
|
341 |
+
}
|
342 |
+
#cpac-box-plugin_settings table.addons td.activation_more a{
|
343 |
+
float: none;
|
344 |
+
display: inline-block;
|
345 |
+
margin-top: 1px;
|
346 |
+
}
|
347 |
+
#cpac-box-plugin_settings table.addons tr.last td {
|
348 |
+
border-bottom: none;
|
349 |
+
}
|
350 |
+
#cpac-box-plugin_settings table.addons .masked_key {
|
351 |
+
padding: 0;
|
352 |
+
}
|
353 |
+
#cpac-box-plugin_settings .cpac-options {}
|
354 |
+
#cpac-box-plugin_settings .cpac-options li {
|
355 |
+
overflow: hidden;
|
356 |
+
}
|
357 |
+
#cpac-box-plugin_settings .cpac-option-label {
|
358 |
+
float: left;
|
359 |
+
width: 140px;
|
360 |
+
}
|
361 |
+
#cpac-box-plugin_settings .cpac-option-inputs {
|
362 |
+
float: left;
|
363 |
+
width: 220px;
|
364 |
+
}
|
365 |
+
#cpac-box-plugin_settings table.addons .button {
|
366 |
+
position: relative;
|
367 |
+
}
|
368 |
+
#cpac-box-plugin_settings table.addons .button.loading {
|
369 |
+
padding-right: 25px;
|
370 |
+
}
|
371 |
+
#cpac-box-plugin_settings table.addons .button.loading span {
|
372 |
+
position: absolute;
|
373 |
+
top: 2px;
|
374 |
+
right: 6px;
|
375 |
+
background: transparent url('../images/loading.gif') no-repeat right 50%;
|
376 |
+
width: 16px;
|
377 |
+
height: 16px;
|
378 |
+
display: inline-block;
|
379 |
+
}
|
380 |
+
|
381 |
+
/* =Restore settings
|
382 |
+
-------------------------------------------------------------- */
|
383 |
#restore-cpac-settings .inside {
|
384 |
padding: 10px;
|
385 |
}
|
399 |
}
|
400 |
#restore-cpac-settings .inside .description {
|
401 |
color: #832525;
|
402 |
+
}
|
403 |
+
|
404 |
+
/* =Addons settings
|
405 |
+
-------------------------------------------------------------- */
|
406 |
+
#addons-cpac-settings {
|
407 |
+
overflow: hidden;
|
408 |
+
}
|
409 |
+
#addons-cpac-settings h2 {
|
410 |
+
font-size: 14px;
|
411 |
+
line-height: 14px;
|
412 |
+
margin-bottom: 0;
|
413 |
+
padding-bottom: 0;
|
414 |
+
}
|
415 |
+
#addons-cpac-settings a {
|
416 |
+
padding: 0 10px 10px;
|
417 |
+
text-decoration: none;
|
418 |
+
color: green;
|
419 |
+
text-decoration: underline;
|
420 |
+
}
|
421 |
+
#addons-cpac-settings a:hover {
|
422 |
+
color: darkgreen;
|
423 |
+
}
|
424 |
+
|
425 |
+
|
426 |
+
/* =Like this plugin settings
|
427 |
+
-------------------------------------------------------------- */
|
428 |
+
#likethisplugin-cpac-settings {
|
429 |
+
padding: 0;
|
430 |
+
}
|
431 |
+
#likethisplugin-cpac-settings ul {
|
432 |
+
margin-left: 20px;
|
433 |
+
}
|
434 |
+
#likethisplugin-cpac-settings li {
|
435 |
+
list-style: square;
|
436 |
+
line-height: 16px;
|
437 |
+
}
|
438 |
+
#likethisplugin-cpac-settings li a {
|
439 |
+
text-decoration: none;
|
440 |
+
}
|
441 |
+
#likethisplugin-cpac-settings li.donate_link a {
|
442 |
+
/* color: green;
|
443 |
+
text-decoration: underline; */
|
444 |
+
}
|
445 |
+
#likethisplugin-cpac-settings li.donate_link a:hover {
|
446 |
+
color: darkgreen;
|
447 |
+
}
|
448 |
+
|
449 |
+
/* =Activation
|
450 |
+
-------------------------------------------------------------- */
|
451 |
+
#cpac-box-plugin_settings .addons .activation_code .activate,
|
452 |
+
#cpac-box-plugin_settings .addons .activation_code .deactivate {
|
453 |
+
min-height: 25px;
|
454 |
+
}
|
455 |
+
#cpac-box-plugin_settings .activation_status .activate {
|
456 |
+
color: #CC0000;
|
457 |
+
}
|
458 |
+
#cpac-box-plugin_settings .activation_status .deactivate {
|
459 |
+
color: darkgreen;
|
460 |
+
}
|
461 |
+
#cpac-box-plugin_settings .activation-error-msg {
|
462 |
+
color: #CC0000;
|
463 |
+
line-height: 20px;
|
464 |
+
padding: 0 6px;
|
465 |
+
}
|
466 |
+
|
467 |
+
/* =Tooltip
|
468 |
+
-------------------------------------------------------------- */
|
469 |
+
.qtip .qtip-tip {
|
470 |
+
left: 74px !important;
|
471 |
+
top: 1px !important;
|
472 |
+
}
|
473 |
+
.qtip .qtip-wrapper {
|
474 |
+
background: #fff;
|
475 |
+
border-style: solid;
|
476 |
+
border-width: 1px;
|
477 |
+
border-color: #dfdfdf;
|
478 |
+
border-color: rgba(0,0,0,.125);
|
479 |
+
border-top: none;
|
480 |
+
-webkit-border-radius: 3px;
|
481 |
+
border-radius: 3px;
|
482 |
+
border-radius: 5px;
|
483 |
+
-webkit-box-shadow: 0 2px 4px rgba(0,0,0,.19);
|
484 |
+
-moz-box-shadow: 0 2px 4px rgba(0,0,0,.19);
|
485 |
+
box-shadow: 0 2px 4px rgba(0,0,0,.19);
|
486 |
+
|
487 |
+
}
|
488 |
+
.qtip .qtip-wrapper .qtip_title {
|
489 |
+
padding: 15px 18px 14px 15px;
|
490 |
+
clear: both;
|
491 |
+
line-height: 1.4em;
|
492 |
+
font-size: 14px;
|
493 |
+
color: #fff;
|
494 |
+
border-radius: 3px 3px 0 0;
|
495 |
+
text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
|
496 |
+
background-color: #8cc1e9;
|
497 |
+
background-image: -webkit-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(140,193,233) 100%);
|
498 |
+
background-image: -moz-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(140,193,233) 100%);
|
499 |
+
background-image: -ms-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(140,193,233) 100%);
|
500 |
+
background-image: -o-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(140,193,233) 100%);
|
501 |
+
background-image: linear-gradient(bottom, rgb(114,167,207) 0%, rgb(140,193,233) 100%);
|
502 |
+
}
|
503 |
+
.qtip .qtip-wrapper .qtip_content {
|
504 |
+
padding: 0 14px 14px;
|
505 |
+
margin: 0;
|
506 |
+
overflow: hidden;
|
507 |
+
clear: both;
|
508 |
+
min-height: 40px;
|
509 |
+
font-size: 13px;
|
510 |
+
background: #fff;
|
511 |
+
}
|
512 |
+
.qtip .qtip-wrapper .qtip_content .button-primary {
|
513 |
+
margin: 6px 0 0;
|
514 |
+
}
|
515 |
+
|
516 |
+
/* =Responsive Design
|
517 |
+
-------------------------------------------------------------- */
|
518 |
+
body.folded #cpac .cpac-col-left .metabox-holder {
|
519 |
+
margin-right: 0;
|
520 |
+
}
|
521 |
+
body.folded #cpac .cpac-col-right {
|
522 |
+
display: none;
|
523 |
}
|
assets/css/column.css
CHANGED
@@ -1,4 +1,11 @@
|
|
|
|
1 |
.column-column-attachment img {
|
2 |
padding-right: 5px;
|
3 |
padding-bottom: 4px;
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
}
|
1 |
+
.cpac-column-value-image,
|
2 |
.column-column-attachment img {
|
3 |
padding-right: 5px;
|
4 |
padding-bottom: 4px;
|
5 |
+
}
|
6 |
+
.cpac-divider {
|
7 |
+
display: inline-block;
|
8 |
+
width: 14px;
|
9 |
+
height: 12px;
|
10 |
+
background: transparent url(../images/square.png) no-repeat 50% 7px;
|
11 |
}
|
assets/images/addon_sortable_1.png
ADDED
Binary file
|
assets/images/arrows.png
CHANGED
Binary file
|
assets/images/cross.png
ADDED
Binary file
|
assets/images/information.png
ADDED
Binary file
|
assets/images/loading.gif
ADDED
Binary file
|
assets/images/no.png
ADDED
Binary file
|
assets/images/reorder_arrow.png
ADDED
Binary file
|
assets/images/settings.png
ADDED
Binary file
|
assets/images/sort.png
CHANGED
Binary file
|
assets/images/square.png
ADDED
Binary file
|
assets/js/admin-column.js
CHANGED
@@ -2,12 +2,20 @@
|
|
2 |
* fires when the dom is ready
|
3 |
*
|
4 |
*/
|
5 |
-
jQuery(document).ready(function()
|
|
|
|
|
|
|
|
|
6 |
cpac_sortable();
|
7 |
cpac_checked();
|
8 |
cpac_box_events();
|
9 |
cpac_menu();
|
10 |
cpac_add_custom_column();
|
|
|
|
|
|
|
|
|
11 |
});
|
12 |
|
13 |
/**
|
@@ -15,7 +23,7 @@ jQuery(document).ready(function(){
|
|
15 |
*
|
16 |
*/
|
17 |
function cpac_sortable()
|
18 |
-
{
|
19 |
jQuery('ul.cpac-option-list').sortable({
|
20 |
handle: 'div.cpac-sort-handle',
|
21 |
placeholder: 'cpac-placeholder',
|
@@ -38,7 +46,7 @@ function cpac_checked()
|
|
38 |
// toggle on
|
39 |
if ( value != 'on') {
|
40 |
li.addClass('active');
|
41 |
-
state.attr('value', 'on');
|
42 |
}
|
43 |
|
44 |
// toggle off
|
@@ -59,7 +67,10 @@ function cpac_box_events()
|
|
59 |
// fold in/out
|
60 |
jQuery('#cpac .cpac-option-list .cpac-action').unbind('click').click(function(e){
|
61 |
e.preventDefault();
|
62 |
-
jQuery(this).closest('li')
|
|
|
|
|
|
|
63 |
});
|
64 |
|
65 |
// remove custom field box
|
@@ -72,8 +83,7 @@ function cpac_box_events()
|
|
72 |
height: 0
|
73 |
}, 350, function() {
|
74 |
el.remove();
|
75 |
-
});
|
76 |
-
|
77 |
});
|
78 |
}
|
79 |
|
@@ -189,4 +199,218 @@ function cpac_add_custom_column()
|
|
189 |
// retrigger click events
|
190 |
cpac_box_events();
|
191 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
}
|
2 |
* fires when the dom is ready
|
3 |
*
|
4 |
*/
|
5 |
+
jQuery(document).ready(function()
|
6 |
+
{
|
7 |
+
if (jQuery('#cpac').length == 0)
|
8 |
+
return false;
|
9 |
+
|
10 |
cpac_sortable();
|
11 |
cpac_checked();
|
12 |
cpac_box_events();
|
13 |
cpac_menu();
|
14 |
cpac_add_custom_column();
|
15 |
+
cpac_clear_input_defaults();
|
16 |
+
cpac_tooltips();
|
17 |
+
cpac_addon_activation();
|
18 |
+
cpac_width_range();
|
19 |
});
|
20 |
|
21 |
/**
|
23 |
*
|
24 |
*/
|
25 |
function cpac_sortable()
|
26 |
+
{
|
27 |
jQuery('ul.cpac-option-list').sortable({
|
28 |
handle: 'div.cpac-sort-handle',
|
29 |
placeholder: 'cpac-placeholder',
|
46 |
// toggle on
|
47 |
if ( value != 'on') {
|
48 |
li.addClass('active');
|
49 |
+
state.attr('value', 'on');
|
50 |
}
|
51 |
|
52 |
// toggle off
|
67 |
// fold in/out
|
68 |
jQuery('#cpac .cpac-option-list .cpac-action').unbind('click').click(function(e){
|
69 |
e.preventDefault();
|
70 |
+
var li = jQuery(this).closest('li');
|
71 |
+
li.find('.cpac-type-inside').slideToggle(150, function() {
|
72 |
+
li.toggleClass('opened');
|
73 |
+
});
|
74 |
});
|
75 |
|
76 |
// remove custom field box
|
83 |
height: 0
|
84 |
}, 350, function() {
|
85 |
el.remove();
|
86 |
+
});
|
|
|
87 |
});
|
88 |
}
|
89 |
|
199 |
// retrigger click events
|
200 |
cpac_box_events();
|
201 |
});
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Clear Input Defaults
|
206 |
+
*
|
207 |
+
*/
|
208 |
+
function cpac_clear_input_defaults()
|
209 |
+
{
|
210 |
+
jQuery.fn.cleardefault = function() {
|
211 |
+
return this.focus(function() {
|
212 |
+
if( this.value == this.defaultValue ) {
|
213 |
+
this.value = "";
|
214 |
+
}
|
215 |
+
}).blur(function() {
|
216 |
+
if( !this.value.length ) {
|
217 |
+
this.value = this.defaultValue;
|
218 |
+
}
|
219 |
+
});
|
220 |
+
};
|
221 |
+
jQuery("#cpac-box-plugin_settings .addons input").cleardefault();
|
222 |
+
}
|
223 |
+
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Tooltip
|
227 |
+
*
|
228 |
+
*/
|
229 |
+
function cpac_tooltips()
|
230 |
+
{
|
231 |
+
jQuery('#cpac .activation_type span').each(function() {
|
232 |
+
var info = jQuery(this).next('.cpac-tooltip').html();
|
233 |
+
|
234 |
+
if ( ! info )
|
235 |
+
return;
|
236 |
+
|
237 |
+
jQuery('#cpac .activation_type span').qtip({
|
238 |
+
content: info,
|
239 |
+
title: 'title',
|
240 |
+
style: {
|
241 |
+
width: 400,
|
242 |
+
padding: 0,
|
243 |
+
background: 'transparent',
|
244 |
+
color: 'black',
|
245 |
+
textAlign: 'left',
|
246 |
+
border: {
|
247 |
+
width: 0,
|
248 |
+
radius: 0
|
249 |
+
},
|
250 |
+
tip: {
|
251 |
+
corner: 'topMiddle',
|
252 |
+
color: '#8cc1e9',
|
253 |
+
size: {
|
254 |
+
x: 32,
|
255 |
+
y : 15
|
256 |
+
}
|
257 |
+
}
|
258 |
+
},
|
259 |
+
position: {
|
260 |
+
corner: {
|
261 |
+
target: 'bottomRight'
|
262 |
+
},
|
263 |
+
adjust: {
|
264 |
+
x: -80,
|
265 |
+
y: 0
|
266 |
+
}
|
267 |
+
},
|
268 |
+
hide: {
|
269 |
+
when: 'mouseout',
|
270 |
+
fixed: true ,
|
271 |
+
delay: 100
|
272 |
+
}
|
273 |
+
});
|
274 |
+
});
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Width range
|
279 |
+
*
|
280 |
+
*/
|
281 |
+
function cpac_width_range()
|
282 |
+
{
|
283 |
+
if ( jQuery('.input-width-range').length == false )
|
284 |
+
return;
|
285 |
+
|
286 |
+
jQuery('.input-width-range').each( function(){
|
287 |
+
|
288 |
+
var input = jQuery(this).closest('.cpac-type-inside').find('.input-width');
|
289 |
+
var descr = jQuery(this).closest('.cpac-type-inside').find('.width-decription');
|
290 |
+
var input_default = jQuery(input)[0].defaultValue;
|
291 |
+
var translation_default = descr.attr('title');
|
292 |
+
|
293 |
+
jQuery(this).slider({
|
294 |
+
range: 'min',
|
295 |
+
value: 1,
|
296 |
+
min: 0,
|
297 |
+
max: 100,
|
298 |
+
value: input_default,
|
299 |
+
slide: function( event, ui ) {
|
300 |
+
|
301 |
+
// set default
|
302 |
+
var descr_value = ui.value > 0 ? ui.value + '%' : translation_default;
|
303 |
+
|
304 |
+
jQuery(input).val( ui.value );
|
305 |
+
jQuery(descr).text( descr_value );
|
306 |
+
}
|
307 |
+
});
|
308 |
+
});
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Addon actviate/deactivate
|
313 |
+
*
|
314 |
+
*/
|
315 |
+
function cpac_addon_activation()
|
316 |
+
{
|
317 |
+
jQuery('#cpac-box-plugin_settings .addons .activation_code a.button').click(function(e) {
|
318 |
+
e.preventDefault();
|
319 |
+
|
320 |
+
// get input values
|
321 |
+
var row = jQuery(this).closest('tr');
|
322 |
+
var type = jQuery(row).attr('id').replace('cpac-activation-','');
|
323 |
+
var parent_class = jQuery(this).parent('div');
|
324 |
+
var msg = jQuery(row).find('.activation-error-msg');
|
325 |
+
|
326 |
+
// get translated string
|
327 |
+
var translations = jQuery('#cpac-box-plugin_settings .addon-translation-string');
|
328 |
+
var msg_fillin = jQuery('.tstring-fill-in',translations).text();
|
329 |
+
var msg_unrecognised = jQuery('.tstring-unrecognised',translations).text();
|
330 |
+
|
331 |
+
// reset
|
332 |
+
jQuery(msg).empty();
|
333 |
+
|
334 |
+
// Activate
|
335 |
+
if ( parent_class.hasClass('activate') ) {
|
336 |
+
|
337 |
+
// input values
|
338 |
+
var input = jQuery('.activate input', row);
|
339 |
+
var button = jQuery('.activate .button', row);
|
340 |
+
var key = input.val();
|
341 |
+
var default_val = jQuery(input)[0].defaultValue;
|
342 |
+
|
343 |
+
// make sure the input value has changed
|
344 |
+
if ( key == default_val ) {
|
345 |
+
jQuery(msg).text(msg_fillin).hide().fadeIn();
|
346 |
+
return false;
|
347 |
+
}
|
348 |
+
|
349 |
+
// set loading icon
|
350 |
+
button.addClass('loading');
|
351 |
+
|
352 |
+
// update key
|
353 |
+
jQuery.ajax({
|
354 |
+
url : ajaxurl,
|
355 |
+
type : 'POST',
|
356 |
+
dataType : 'json',
|
357 |
+
data : {
|
358 |
+
action : 'cpac_addon_activation',
|
359 |
+
type : 'sortable',
|
360 |
+
key : key
|
361 |
+
},
|
362 |
+
success: function(data) {
|
363 |
+
if ( data != null ) {
|
364 |
+
jQuery('div.activate', row).hide();
|
365 |
+
jQuery('div.deactivate', row).show();
|
366 |
+
jQuery('div.deactivate span.masked_key', row).text(data);
|
367 |
+
} else {
|
368 |
+
jQuery(msg).text(msg_unrecognised).hide().fadeIn();
|
369 |
+
}
|
370 |
+
},
|
371 |
+
error: function(xhr, ajaxOptions, thrownError) {
|
372 |
+
jQuery(msg).text(msg_unrecognised).hide().fadeIn();
|
373 |
+
},
|
374 |
+
complete: function() {
|
375 |
+
button.removeClass('loading');
|
376 |
+
}
|
377 |
+
});
|
378 |
+
}
|
379 |
+
|
380 |
+
// Deactivate
|
381 |
+
if ( parent_class.hasClass('deactivate') ) {
|
382 |
+
|
383 |
+
var button = jQuery('.deactivate .button', row);
|
384 |
+
var input = jQuery('.activate input', row);
|
385 |
+
|
386 |
+
// set loading icon
|
387 |
+
button.addClass('loading');
|
388 |
+
|
389 |
+
// update key
|
390 |
+
jQuery.ajax({
|
391 |
+
url : ajaxurl,
|
392 |
+
type : 'POST',
|
393 |
+
dataType : 'json',
|
394 |
+
data : {
|
395 |
+
action : 'cpac_addon_activation',
|
396 |
+
type : 'sortable',
|
397 |
+
key : 'remove'
|
398 |
+
},
|
399 |
+
success: function(data) {
|
400 |
+
jQuery('div.activate', row).show();
|
401 |
+
jQuery('div.deactivate', row).hide();
|
402 |
+
jQuery('div.deactivate span.masked_key', row).empty();
|
403 |
+
input.val('');
|
404 |
+
},
|
405 |
+
error: function(xhr, ajaxOptions, thrownError) {
|
406 |
+
//console.log(xhr);
|
407 |
+
//console.log(ajaxOptions);
|
408 |
+
//console.log(thrownError);
|
409 |
+
},
|
410 |
+
complete: function() {
|
411 |
+
button.removeClass('loading');
|
412 |
+
}
|
413 |
+
});
|
414 |
+
}
|
415 |
+
});
|
416 |
}
|
assets/js/jquery.qtip.js
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* jquery.qtip. The jQuery tooltip plugin
|
3 |
+
*
|
4 |
+
* Copyright (c) 2009 Craig Thompson
|
5 |
+
* http://craigsworks.com
|
6 |
+
*
|
7 |
+
* Licensed under MIT
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
*
|
10 |
+
* Launch : February 2009
|
11 |
+
* Version : 1.0.0-rc3
|
12 |
+
* Released: Tuesday 12th May, 2009 - 00:00
|
13 |
+
* Debug: jquery.qtip.debug.js
|
14 |
+
*/
|
15 |
+
(function(f){f.fn.qtip=function(B,u){var y,t,A,s,x,w,v,z;if(typeof B=="string"){if(typeof f(this).data("qtip")!=="object"){f.fn.qtip.log.error.call(self,1,f.fn.qtip.constants.NO_TOOLTIP_PRESENT,false)}if(B=="api"){return f(this).data("qtip").interfaces[f(this).data("qtip").current]}else{if(B=="interfaces"){return f(this).data("qtip").interfaces}}}else{if(!B){B={}}if(typeof B.content!=="object"||(B.content.jquery&&B.content.length>0)){B.content={text:B.content}}if(typeof B.content.title!=="object"){B.content.title={text:B.content.title}}if(typeof B.position!=="object"){B.position={corner:B.position}}if(typeof B.position.corner!=="object"){B.position.corner={target:B.position.corner,tooltip:B.position.corner}}if(typeof B.show!=="object"){B.show={when:B.show}}if(typeof B.show.when!=="object"){B.show.when={event:B.show.when}}if(typeof B.show.effect!=="object"){B.show.effect={type:B.show.effect}}if(typeof B.hide!=="object"){B.hide={when:B.hide}}if(typeof B.hide.when!=="object"){B.hide.when={event:B.hide.when}}if(typeof B.hide.effect!=="object"){B.hide.effect={type:B.hide.effect}}if(typeof B.style!=="object"){B.style={name:B.style}}B.style=c(B.style);s=f.extend(true,{},f.fn.qtip.defaults,B);s.style=a.call({options:s},s.style);s.user=f.extend(true,{},B)}return f(this).each(function(){if(typeof B=="string"){w=B.toLowerCase();A=f(this).qtip("interfaces");if(typeof A=="object"){if(u===true&&w=="destroy"){while(A.length>0){A[A.length-1].destroy()}}else{if(u!==true){A=[f(this).qtip("api")]}for(y=0;y<A.length;y++){if(w=="destroy"){A[y].destroy()}else{if(A[y].status.rendered===true){if(w=="show"){A[y].show()}else{if(w=="hide"){A[y].hide()}else{if(w=="focus"){A[y].focus()}else{if(w=="disable"){A[y].disable(true)}else{if(w=="enable"){A[y].disable(false)}}}}}}}}}}}else{v=f.extend(true,{},s);v.hide.effect.length=s.hide.effect.length;v.show.effect.length=s.show.effect.length;if(v.position.container===false){v.position.container=f(document.body)}if(v.position.target===false){v.position.target=f(this)}if(v.show.when.target===false){v.show.when.target=f(this)}if(v.hide.when.target===false){v.hide.when.target=f(this)}t=f.fn.qtip.interfaces.length;for(y=0;y<t;y++){if(typeof f.fn.qtip.interfaces[y]=="undefined"){t=y;break}}x=new d(f(this),v,t);f.fn.qtip.interfaces[t]=x;if(typeof f(this).data("qtip")=="object"){if(typeof f(this).attr("qtip")==="undefined"){f(this).data("qtip").current=f(this).data("qtip").interfaces.length}f(this).data("qtip").interfaces.push(x)}else{f(this).data("qtip",{current:0,interfaces:[x]})}if(v.content.prerender===false&&v.show.when.event!==false&&v.show.ready!==true){v.show.when.target.bind(v.show.when.event+".qtip-"+t+"-create",{qtip:t},function(C){z=f.fn.qtip.interfaces[C.data.qtip];z.options.show.when.target.unbind(z.options.show.when.event+".qtip-"+C.data.qtip+"-create");z.cache.mouse={x:C.pageX,y:C.pageY};p.call(z);z.options.show.when.target.trigger(z.options.show.when.event)})}else{x.cache.mouse={x:v.show.when.target.offset().left,y:v.show.when.target.offset().top};p.call(x)}}})};function d(u,t,v){var s=this;s.id=v;s.options=t;s.status={animated:false,rendered:false,disabled:false,focused:false};s.elements={target:u.addClass(s.options.style.classes.target),tooltip:null,wrapper:null,content:null,contentWrapper:null,title:null,button:null,tip:null,bgiframe:null};s.cache={mouse:{},position:{},toggle:0};s.timers={};f.extend(s,s.options.api,{show:function(y){var x,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"show")}if(s.elements.tooltip.css("display")!=="none"){return s}s.elements.tooltip.stop(true,false);x=s.beforeShow.call(s,y);if(x===false){return s}function w(){if(s.options.position.type!=="static"){s.focus()}s.onShow.call(s,y);if(f.browser.msie){s.elements.tooltip.get(0).style.removeAttribute("filter")}}s.cache.toggle=1;if(s.options.position.type!=="static"){s.updatePosition(y,(s.options.show.effect.length>0))}if(typeof s.options.show.solo=="object"){z=f(s.options.show.solo)}else{if(s.options.show.solo===true){z=f("div.qtip").not(s.elements.tooltip)}}if(z){z.each(function(){if(f(this).qtip("api").status.rendered===true){f(this).qtip("api").hide()}})}if(typeof s.options.show.effect.type=="function"){s.options.show.effect.type.call(s.elements.tooltip,s.options.show.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.show.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeIn(s.options.show.effect.length,w);break;case"slide":s.elements.tooltip.slideDown(s.options.show.effect.length,function(){w();if(s.options.position.type!=="static"){s.updatePosition(y,true)}});break;case"grow":s.elements.tooltip.show(s.options.show.effect.length,w);break;default:s.elements.tooltip.show(null,w);break}s.elements.tooltip.addClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_SHOWN,"show")},hide:function(y){var x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"hide")}else{if(s.elements.tooltip.css("display")==="none"){return s}}clearTimeout(s.timers.show);s.elements.tooltip.stop(true,false);x=s.beforeHide.call(s,y);if(x===false){return s}function w(){s.onHide.call(s,y)}s.cache.toggle=0;if(typeof s.options.hide.effect.type=="function"){s.options.hide.effect.type.call(s.elements.tooltip,s.options.hide.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.hide.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeOut(s.options.hide.effect.length,w);break;case"slide":s.elements.tooltip.slideUp(s.options.hide.effect.length,w);break;case"grow":s.elements.tooltip.hide(s.options.hide.effect.length,w);break;default:s.elements.tooltip.hide(null,w);break}s.elements.tooltip.removeClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_HIDDEN,"hide")},updatePosition:function(w,x){var C,G,L,J,H,E,y,I,B,D,K,A,F,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updatePosition")}else{if(s.options.position.type=="static"){return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.CANNOT_POSITION_STATIC,"updatePosition")}}G={position:{left:0,top:0},dimensions:{height:0,width:0},corner:s.options.position.corner.target};L={position:s.getPosition(),dimensions:s.getDimensions(),corner:s.options.position.corner.tooltip};if(s.options.position.target!=="mouse"){if(s.options.position.target.get(0).nodeName.toLowerCase()=="area"){J=s.options.position.target.attr("coords").split(",");for(C=0;C<J.length;C++){J[C]=parseInt(J[C])}H=s.options.position.target.parent("map").attr("name");E=f('img[usemap="#'+H+'"]:first').offset();G.position={left:Math.floor(E.left+J[0]),top:Math.floor(E.top+J[1])};switch(s.options.position.target.attr("shape").toLowerCase()){case"rect":G.dimensions={width:Math.ceil(Math.abs(J[2]-J[0])),height:Math.ceil(Math.abs(J[3]-J[1]))};break;case"circle":G.dimensions={width:J[2]+1,height:J[2]+1};break;case"poly":G.dimensions={width:J[0],height:J[1]};for(C=0;C<J.length;C++){if(C%2==0){if(J[C]>G.dimensions.width){G.dimensions.width=J[C]}if(J[C]<J[0]){G.position.left=Math.floor(E.left+J[C])}}else{if(J[C]>G.dimensions.height){G.dimensions.height=J[C]}if(J[C]<J[1]){G.position.top=Math.floor(E.top+J[C])}}}G.dimensions.width=G.dimensions.width-(G.position.left-E.left);G.dimensions.height=G.dimensions.height-(G.position.top-E.top);break;default:return f.fn.qtip.log.error.call(s,4,f.fn.qtip.constants.INVALID_AREA_SHAPE,"updatePosition");break}G.dimensions.width-=2;G.dimensions.height-=2}else{if(s.options.position.target.add(document.body).length===1){G.position={left:f(document).scrollLeft(),top:f(document).scrollTop()};G.dimensions={height:f(window).height(),width:f(window).width()}}else{if(typeof s.options.position.target.attr("qtip")!=="undefined"){G.position=s.options.position.target.qtip("api").cache.position}else{G.position=s.options.position.target.offset()}G.dimensions={height:s.options.position.target.outerHeight(),width:s.options.position.target.outerWidth()}}}y=f.extend({},G.position);if(G.corner.search(/right/i)!==-1){y.left+=G.dimensions.width}if(G.corner.search(/bottom/i)!==-1){y.top+=G.dimensions.height}if(G.corner.search(/((top|bottom)Middle)|center/)!==-1){y.left+=(G.dimensions.width/2)}if(G.corner.search(/((left|right)Middle)|center/)!==-1){y.top+=(G.dimensions.height/2)}}else{G.position=y={left:s.cache.mouse.x,top:s.cache.mouse.y};G.dimensions={height:1,width:1}}if(L.corner.search(/right/i)!==-1){y.left-=L.dimensions.width}if(L.corner.search(/bottom/i)!==-1){y.top-=L.dimensions.height}if(L.corner.search(/((top|bottom)Middle)|center/)!==-1){y.left-=(L.dimensions.width/2)}if(L.corner.search(/((left|right)Middle)|center/)!==-1){y.top-=(L.dimensions.height/2)}I=(f.browser.msie)?1:0;B=(f.browser.msie&&parseInt(f.browser.version.charAt(0))===6)?1:0;if(s.options.style.border.radius>0){if(L.corner.search(/Left/)!==-1){y.left-=s.options.style.border.radius}else{if(L.corner.search(/Right/)!==-1){y.left+=s.options.style.border.radius}}if(L.corner.search(/Top/)!==-1){y.top-=s.options.style.border.radius}else{if(L.corner.search(/Bottom/)!==-1){y.top+=s.options.style.border.radius}}}if(I){if(L.corner.search(/top/)!==-1){y.top-=I}else{if(L.corner.search(/bottom/)!==-1){y.top+=I}}if(L.corner.search(/left/)!==-1){y.left-=I}else{if(L.corner.search(/right/)!==-1){y.left+=I}}if(L.corner.search(/leftMiddle|rightMiddle/)!==-1){y.top-=1}}if(s.options.position.adjust.screen===true){y=o.call(s,y,G,L)}if(s.options.position.target==="mouse"&&s.options.position.adjust.mouse===true){if(s.options.position.adjust.screen===true&&s.elements.tip){K=s.elements.tip.attr("rel")}else{K=s.options.position.corner.tooltip}y.left+=(K.search(/right/i)!==-1)?-6:6;y.top+=(K.search(/bottom/i)!==-1)?-6:6}if(!s.elements.bgiframe&&f.browser.msie&&parseInt(f.browser.version.charAt(0))==6){f("select, object").each(function(){A=f(this).offset();A.bottom=A.top+f(this).height();A.right=A.left+f(this).width();if(y.top+L.dimensions.height>=A.top&&y.left+L.dimensions.width>=A.left){k.call(s)}})}y.left+=s.options.position.adjust.x;y.top+=s.options.position.adjust.y;F=s.getPosition();if(y.left!=F.left||y.top!=F.top){z=s.beforePositionUpdate.call(s,w);if(z===false){return s}s.cache.position=y;if(x===true){s.status.animated=true;s.elements.tooltip.animate(y,200,"swing",function(){s.status.animated=false})}else{s.elements.tooltip.css(y)}s.onPositionUpdate.call(s,w);if(typeof w!=="undefined"&&w.type&&w.type!=="mousemove"){f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_POSITION_UPDATED,"updatePosition")}}return s},updateWidth:function(w){var x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateWidth")}else{if(w&&typeof w!=="number"){return f.fn.qtip.log.error.call(s,2,"newWidth must be of type number","updateWidth")}}x=s.elements.contentWrapper.siblings().add(s.elements.tip).add(s.elements.button);if(!w){if(typeof s.options.style.width.value=="number"){w=s.options.style.width.value}else{s.elements.tooltip.css({width:"auto"});x.hide();if(f.browser.msie){s.elements.wrapper.add(s.elements.contentWrapper.children()).css({zoom:"normal"})}w=s.getDimensions().width+1;if(!s.options.style.width.value){if(w>s.options.style.width.max){w=s.options.style.width.max}if(w<s.options.style.width.min){w=s.options.style.width.min}}}}if(w%2!==0){w-=1}s.elements.tooltip.width(w);x.show();if(s.options.style.border.radius){s.elements.tooltip.find(".qtip-betweenCorners").each(function(y){f(this).width(w-(s.options.style.border.radius*2))})}if(f.browser.msie){s.elements.wrapper.add(s.elements.contentWrapper.children()).css({zoom:"1"});s.elements.wrapper.width(w);if(s.elements.bgiframe){s.elements.bgiframe.width(w).height(s.getDimensions.height)}}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_WIDTH_UPDATED,"updateWidth")},updateStyle:function(w){var z,A,x,y,B;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateStyle")}else{if(typeof w!=="string"||!f.fn.qtip.styles[w]){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.STYLE_NOT_DEFINED,"updateStyle")}}s.options.style=a.call(s,f.fn.qtip.styles[w],s.options.user.style);s.elements.content.css(q(s.options.style));if(s.options.content.title.text!==false){s.elements.title.css(q(s.options.style.title,true))}s.elements.contentWrapper.css({borderColor:s.options.style.border.color});if(s.options.style.tip.corner!==false){if(f("<canvas>").get(0).getContext){z=s.elements.tooltip.find(".qtip-tip canvas:first");x=z.get(0).getContext("2d");x.clearRect(0,0,300,300);y=z.parent("div[rel]:first").attr("rel");B=b(y,s.options.style.tip.size.width,s.options.style.tip.size.height);h.call(s,z,B,s.options.style.tip.color||s.options.style.border.color)}else{if(f.browser.msie){z=s.elements.tooltip.find('.qtip-tip [nodeName="shape"]');z.attr("fillcolor",s.options.style.tip.color||s.options.style.border.color)}}}if(s.options.style.border.radius>0){s.elements.tooltip.find(".qtip-betweenCorners").css({backgroundColor:s.options.style.border.color});if(f("<canvas>").get(0).getContext){A=g(s.options.style.border.radius);s.elements.tooltip.find(".qtip-wrapper canvas").each(function(){x=f(this).get(0).getContext("2d");x.clearRect(0,0,300,300);y=f(this).parent("div[rel]:first").attr("rel");r.call(s,f(this),A[y],s.options.style.border.radius,s.options.style.border.color)})}else{if(f.browser.msie){s.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function(){f(this).attr("fillcolor",s.options.style.border.color)})}}}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_STYLE_UPDATED,"updateStyle")},updateContent:function(A,y){var z,x,w;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateContent")}else{if(!A){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateContent")}}z=s.beforeContentUpdate.call(s,A);if(typeof z=="string"){A=z}else{if(z===false){return}}if(f.browser.msie){s.elements.contentWrapper.children().css({zoom:"normal"})}if(A.jquery&&A.length>0){A.clone(true).appendTo(s.elements.content).show()}else{s.elements.content.html(A)}x=s.elements.content.find("img[complete=false]");if(x.length>0){w=0;x.each(function(C){f('<img src="'+f(this).attr("src")+'" />').load(function(){if(++w==x.length){B()}})})}else{B()}function B(){s.updateWidth();if(y!==false){if(s.options.position.type!=="static"){s.updatePosition(s.elements.tooltip.is(":visible"),true)}if(s.options.style.tip.corner!==false){n.call(s)}}}s.onContentUpdate.call(s);return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_CONTENT_UPDATED,"loadContent")},loadContent:function(w,z,A){var y;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"loadContent")}y=s.beforeContentLoad.call(s);if(y===false){return s}if(A=="post"){f.post(w,z,x)}else{f.get(w,z,x)}function x(B){s.onContentLoad.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_CONTENT_LOADED,"loadContent");s.updateContent(B)}return s},updateTitle:function(w){if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateTitle")}else{if(!w){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateTitle")}}returned=s.beforeTitleUpdate.call(s);if(returned===false){return s}if(s.elements.button){s.elements.button=s.elements.button.clone(true)}s.elements.title.html(w);if(s.elements.button){s.elements.title.prepend(s.elements.button)}s.onTitleUpdate.call(s);return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_TITLE_UPDATED,"updateTitle")},focus:function(A){var y,x,w,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"focus")}else{if(s.options.position.type=="static"){return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.CANNOT_FOCUS_STATIC,"focus")}}y=parseInt(s.elements.tooltip.css("z-index"));x=6000+f("div.qtip[qtip]").length-1;if(!s.status.focused&&y!==x){z=s.beforeFocus.call(s,A);if(z===false){return s}f("div.qtip[qtip]").not(s.elements.tooltip).each(function(){if(f(this).qtip("api").status.rendered===true){w=parseInt(f(this).css("z-index"));if(typeof w=="number"&&w>-1){f(this).css({zIndex:parseInt(f(this).css("z-index"))-1})}f(this).qtip("api").status.focused=false}});s.elements.tooltip.css({zIndex:x});s.status.focused=true;s.onFocus.call(s,A);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_FOCUSED,"focus")}return s},disable:function(w){if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"disable")}if(w){if(!s.status.disabled){s.status.disabled=true;f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_DISABLED,"disable")}else{f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED,"disable")}}else{if(s.status.disabled){s.status.disabled=false;f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_ENABLED,"disable")}else{f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED,"disable")}}return s},destroy:function(){var w,x,y;x=s.beforeDestroy.call(s);if(x===false){return s}if(s.status.rendered){s.options.show.when.target.unbind("mousemove.qtip",s.updatePosition);s.options.show.when.target.unbind("mouseout.qtip",s.hide);s.options.show.when.target.unbind(s.options.show.when.event+".qtip");s.options.hide.when.target.unbind(s.options.hide.when.event+".qtip");s.elements.tooltip.unbind(s.options.hide.when.event+".qtip");s.elements.tooltip.unbind("mouseover.qtip",s.focus);s.elements.tooltip.remove()}else{s.options.show.when.target.unbind(s.options.show.when.event+".qtip-create")}if(typeof s.elements.target.data("qtip")=="object"){y=s.elements.target.data("qtip").interfaces;if(typeof y=="object"&&y.length>0){for(w=0;w<y.length-1;w++){if(y[w].id==s.id){y.splice(w,1)}}}}delete f.fn.qtip.interfaces[s.id];if(typeof y=="object"&&y.length>0){s.elements.target.data("qtip").current=y.length-1}else{s.elements.target.removeData("qtip")}s.onDestroy.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_DESTROYED,"destroy");return s.elements.target},getPosition:function(){var w,x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getPosition")}w=(s.elements.tooltip.css("display")!=="none")?false:true;if(w){s.elements.tooltip.css({visiblity:"hidden"}).show()}x=s.elements.tooltip.offset();if(w){s.elements.tooltip.css({visiblity:"visible"}).hide()}return x},getDimensions:function(){var w,x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getDimensions")}w=(!s.elements.tooltip.is(":visible"))?true:false;if(w){s.elements.tooltip.css({visiblity:"hidden"}).show()}x={height:s.elements.tooltip.outerHeight(),width:s.elements.tooltip.outerWidth()};if(w){s.elements.tooltip.css({visiblity:"visible"}).hide()}return x}})}function p(){var s,w,u,t,v,y,x;s=this;s.beforeRender.call(s);s.status.rendered=true;s.elements.tooltip='<div qtip="'+s.id+'" class="qtip '+(s.options.style.classes.tooltip||s.options.style)+'"style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;position:'+s.options.position.type+';"> <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;"> <div class="qtip-contentWrapper" style="overflow:hidden;"> <div class="qtip-content '+s.options.style.classes.content+'"></div></div></div></div>';s.elements.tooltip=f(s.elements.tooltip);s.elements.tooltip.appendTo(s.options.position.container);s.elements.tooltip.data("qtip",{current:0,interfaces:[s]});s.elements.wrapper=s.elements.tooltip.children("div:first");s.elements.contentWrapper=s.elements.wrapper.children("div:first").css({background:s.options.style.background});s.elements.content=s.elements.contentWrapper.children("div:first").css(q(s.options.style));if(f.browser.msie){s.elements.wrapper.add(s.elements.content).css({zoom:1})}if(s.options.hide.when.event=="unfocus"){s.elements.tooltip.attr("unfocus",true)}if(typeof s.options.style.width.value=="number"){s.updateWidth()}if(f("<canvas>").get(0).getContext||f.browser.msie){if(s.options.style.border.radius>0){m.call(s)}else{s.elements.contentWrapper.css({border:s.options.style.border.width+"px solid "+s.options.style.border.color})}if(s.options.style.tip.corner!==false){e.call(s)}}else{s.elements.contentWrapper.css({border:s.options.style.border.width+"px solid "+s.options.style.border.color});s.options.style.border.radius=0;s.options.style.tip.corner=false;f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED,"render")}if((typeof s.options.content.text=="string"&&s.options.content.text.length>0)||(s.options.content.text.jquery&&s.options.content.text.length>0)){u=s.options.content.text}else{if(typeof s.elements.target.attr("title")=="string"&&s.elements.target.attr("title").length>0){u=s.elements.target.attr("title").replace("\\n","<br />");s.elements.target.attr("title","")}else{if(typeof s.elements.target.attr("alt")=="string"&&s.elements.target.attr("alt").length>0){u=s.elements.target.attr("alt").replace("\\n","<br />");s.elements.target.attr("alt","")}else{u=" ";f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.NO_VALID_CONTENT,"render")}}}if(s.options.content.title.text!==false){j.call(s)}s.updateContent(u);l.call(s);if(s.options.show.ready===true){s.show()}if(s.options.content.url!==false){t=s.options.content.url;v=s.options.content.data;y=s.options.content.method||"get";s.loadContent(t,v,y)}s.onRender.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_RENDERED,"render")}function m(){var F,z,t,B,x,E,u,G,D,y,w,C,A,s,v;F=this;F.elements.wrapper.find(".qtip-borderBottom, .qtip-borderTop").remove();t=F.options.style.border.width;B=F.options.style.border.radius;x=F.options.style.border.color||F.options.style.tip.color;E=g(B);u={};for(z in E){u[z]='<div rel="'+z+'" style="'+((z.search(/Left/)!==-1)?"left":"right")+":0; position:absolute; height:"+B+"px; width:"+B+'px; overflow:hidden; line-height:0.1px; font-size:1px">';if(f("<canvas>").get(0).getContext){u[z]+='<canvas height="'+B+'" width="'+B+'" style="vertical-align: top"></canvas>'}else{if(f.browser.msie){G=B*2+3;u[z]+='<v:arc stroked="false" fillcolor="'+x+'" startangle="'+E[z][0]+'" endangle="'+E[z][1]+'" style="width:'+G+"px; height:"+G+"px; margin-top:"+((z.search(/bottom/)!==-1)?-2:-1)+"px; margin-left:"+((z.search(/Right/)!==-1)?E[z][2]-3.5:-1)+'px; vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>'}}u[z]+="</div>"}D=F.getDimensions().width-(Math.max(t,B)*2);y='<div class="qtip-betweenCorners" style="height:'+B+"px; width:"+D+"px; overflow:hidden; background-color:"+x+'; line-height:0.1px; font-size:1px;">';w='<div class="qtip-borderTop" dir="ltr" style="height:'+B+"px; margin-left:"+B+'px; line-height:0.1px; font-size:1px; padding:0;">'+u.topLeft+u.topRight+y;F.elements.wrapper.prepend(w);C='<div class="qtip-borderBottom" dir="ltr" style="height:'+B+"px; margin-left:"+B+'px; line-height:0.1px; font-size:1px; padding:0;">'+u.bottomLeft+u.bottomRight+y;F.elements.wrapper.append(C);if(f("<canvas>").get(0).getContext){F.elements.wrapper.find("canvas").each(function(){A=E[f(this).parent("[rel]:first").attr("rel")];r.call(F,f(this),A,B,x)})}else{if(f.browser.msie){F.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>')}}s=Math.max(B,(B+(t-B)));v=Math.max(t-B,0);F.elements.contentWrapper.css({border:"0px solid "+x,borderWidth:v+"px "+s+"px"})}function r(u,w,s,t){var v=u.get(0).getContext("2d");v.fillStyle=t;v.beginPath();v.arc(w[0],w[1],s,0,Math.PI*2,false);v.fill()}function e(v){var t,s,x,u,w;t=this;if(t.elements.tip!==null){t.elements.tip.remove()}s=t.options.style.tip.color||t.options.style.border.color;if(t.options.style.tip.corner===false){return}else{if(!v){v=t.options.style.tip.corner}}x=b(v,t.options.style.tip.size.width,t.options.style.tip.size.height);t.elements.tip='<div class="'+t.options.style.classes.tip+'" dir="ltr" rel="'+v+'" style="position:absolute; height:'+t.options.style.tip.size.height+"px; width:"+t.options.style.tip.size.width+'px; margin:0 auto; line-height:0.1px; font-size:1px;">';if(f("<canvas>").get(0).getContext){t.elements.tip+='<canvas height="'+t.options.style.tip.size.height+'" width="'+t.options.style.tip.size.width+'"></canvas>'}else{if(f.browser.msie){u=t.options.style.tip.size.width+","+t.options.style.tip.size.height;w="m"+x[0][0]+","+x[0][1];w+=" l"+x[1][0]+","+x[1][1];w+=" "+x[2][0]+","+x[2][1];w+=" xe";t.elements.tip+='<v:shape fillcolor="'+s+'" stroked="false" filled="true" path="'+w+'" coordsize="'+u+'" style="width:'+t.options.style.tip.size.width+"px; height:"+t.options.style.tip.size.height+"px; line-height:0.1px; display:inline-block; behavior:url(#default#VML); vertical-align:"+((v.search(/top/)!==-1)?"bottom":"top")+'"></v:shape>';t.elements.tip+='<v:image style="behavior:url(#default#VML);"></v:image>';t.elements.contentWrapper.css("position","relative")}}t.elements.tooltip.prepend(t.elements.tip+"</div>");t.elements.tip=t.elements.tooltip.find("."+t.options.style.classes.tip).eq(0);if(f("<canvas>").get(0).getContext){h.call(t,t.elements.tip.find("canvas:first"),x,s)}if(v.search(/top/)!==-1&&f.browser.msie&&parseInt(f.browser.version.charAt(0))===6){t.elements.tip.css({marginTop:-4})}n.call(t,v)}function h(t,v,s){var u=t.get(0).getContext("2d");u.fillStyle=s;u.beginPath();u.moveTo(v[0][0],v[0][1]);u.lineTo(v[1][0],v[1][1]);u.lineTo(v[2][0],v[2][1]);u.fill()}function n(u){var t,w,s,x,v;t=this;if(t.options.style.tip.corner===false||!t.elements.tip){return}if(!u){u=t.elements.tip.attr("rel")}w=positionAdjust=(f.browser.msie)?1:0;t.elements.tip.css(u.match(/left|right|top|bottom/)[0],0);if(u.search(/top|bottom/)!==-1){if(f.browser.msie){if(parseInt(f.browser.version.charAt(0))===6){positionAdjust=(u.search(/top/)!==-1)?-3:1}else{positionAdjust=(u.search(/top/)!==-1)?1:2}}if(u.search(/Middle/)!==-1){t.elements.tip.css({left:"50%",marginLeft:-(t.options.style.tip.size.width/2)})}else{if(u.search(/Left/)!==-1){t.elements.tip.css({left:t.options.style.border.radius-w})}else{if(u.search(/Right/)!==-1){t.elements.tip.css({right:t.options.style.border.radius+w})}}}if(u.search(/top/)!==-1){t.elements.tip.css({top:-positionAdjust})}else{t.elements.tip.css({bottom:positionAdjust})}}else{if(u.search(/left|right/)!==-1){if(f.browser.msie){positionAdjust=(parseInt(f.browser.version.charAt(0))===6)?1:((u.search(/left/)!==-1)?1:2)}if(u.search(/Middle/)!==-1){t.elements.tip.css({top:"50%",marginTop:-(t.options.style.tip.size.height/2)})}else{if(u.search(/Top/)!==-1){t.elements.tip.css({top:t.options.style.border.radius-w})}else{if(u.search(/Bottom/)!==-1){t.elements.tip.css({bottom:t.options.style.border.radius+w})}}}if(u.search(/left/)!==-1){t.elements.tip.css({left:-positionAdjust})}else{t.elements.tip.css({right:positionAdjust})}}}s="padding-"+u.match(/left|right|top|bottom/)[0];x=t.options.style.tip.size[(s.search(/left|right/)!==-1)?"width":"height"];t.elements.tooltip.css("padding",0);t.elements.tooltip.css(s,x);if(f.browser.msie&&parseInt(f.browser.version.charAt(0))==6){v=parseInt(t.elements.tip.css("margin-top"))||0;v+=parseInt(t.elements.content.css("margin-top"))||0;t.elements.tip.css({marginTop:v})}}function j(){var s=this;if(s.elements.title!==null){s.elements.title.remove()}s.elements.title=f('<div class="'+s.options.style.classes.title+'">').css(q(s.options.style.title,true)).css({zoom:(f.browser.msie)?1:0}).prependTo(s.elements.contentWrapper);if(s.options.content.title.text){s.updateTitle.call(s,s.options.content.title.text)}if(s.options.content.title.button!==false&&typeof s.options.content.title.button=="string"){s.elements.button=f('<a class="'+s.options.style.classes.button+'" style="float:right; position: relative"></a>').css(q(s.options.style.button,true)).html(s.options.content.title.button).prependTo(s.elements.title).click(function(t){if(!s.status.disabled){s.hide(t)}})}}function l(){var t,v,u,s;t=this;v=t.options.show.when.target;u=t.options.hide.when.target;if(t.options.hide.fixed){u=u.add(t.elements.tooltip)}if(t.options.hide.when.event=="inactive"){s=["click","dblclick","mousedown","mouseup","mousemove","mouseout","mouseenter","mouseleave","mouseover"];function y(z){if(t.status.disabled===true){return}clearTimeout(t.timers.inactive);t.timers.inactive=setTimeout(function(){f(s).each(function(){u.unbind(this+".qtip-inactive");t.elements.content.unbind(this+".qtip-inactive")});t.hide(z)},t.options.hide.delay)}}else{if(t.options.hide.fixed===true){t.elements.tooltip.bind("mouseover.qtip",function(){if(t.status.disabled===true){return}clearTimeout(t.timers.hide)})}}function x(z){if(t.status.disabled===true){return}if(t.options.hide.when.event=="inactive"){f(s).each(function(){u.bind(this+".qtip-inactive",y);t.elements.content.bind(this+".qtip-inactive",y)});y()}clearTimeout(t.timers.show);clearTimeout(t.timers.hide);t.timers.show=setTimeout(function(){t.show(z)},t.options.show.delay)}function w(z){if(t.status.disabled===true){return}if(t.options.hide.fixed===true&&t.options.hide.when.event.search(/mouse(out|leave)/i)!==-1&&f(z.relatedTarget).parents("div.qtip[qtip]").length>0){z.stopPropagation();z.preventDefault();clearTimeout(t.timers.hide);return false}clearTimeout(t.timers.show);clearTimeout(t.timers.hide);t.elements.tooltip.stop(true,true);t.timers.hide=setTimeout(function(){t.hide(z)},t.options.hide.delay)}if((t.options.show.when.target.add(t.options.hide.when.target).length===1&&t.options.show.when.event==t.options.hide.when.event&&t.options.hide.when.event!=="inactive")||t.options.hide.when.event=="unfocus"){t.cache.toggle=0;v.bind(t.options.show.when.event+".qtip",function(z){if(t.cache.toggle==0){x(z)}else{w(z)}})}else{v.bind(t.options.show.when.event+".qtip",x);if(t.options.hide.when.event!=="inactive"){u.bind(t.options.hide.when.event+".qtip",w)}}if(t.options.position.type.search(/(fixed|absolute)/)!==-1){t.elements.tooltip.bind("mouseover.qtip",t.focus)}if(t.options.position.target==="mouse"&&t.options.position.type!=="static"){v.bind("mousemove.qtip",function(z){t.cache.mouse={x:z.pageX,y:z.pageY};if(t.status.disabled===false&&t.options.position.adjust.mouse===true&&t.options.position.type!=="static"&&t.elements.tooltip.css("display")!=="none"){t.updatePosition(z)}})}}function o(u,v,A){var z,s,x,y,t,w;z=this;if(A.corner=="center"){return v.position}s=f.extend({},u);y={x:false,y:false};t={left:(s.left<f.fn.qtip.cache.screen.scroll.left),right:(s.left+A.dimensions.width+2>=f.fn.qtip.cache.screen.width+f.fn.qtip.cache.screen.scroll.left),top:(s.top<f.fn.qtip.cache.screen.scroll.top),bottom:(s.top+A.dimensions.height+2>=f.fn.qtip.cache.screen.height+f.fn.qtip.cache.screen.scroll.top)};x={left:(t.left&&(A.corner.search(/right/i)!=-1||(A.corner.search(/right/i)==-1&&!t.right))),right:(t.right&&(A.corner.search(/left/i)!=-1||(A.corner.search(/left/i)==-1&&!t.left))),top:(t.top&&A.corner.search(/top/i)==-1),bottom:(t.bottom&&A.corner.search(/bottom/i)==-1)};if(x.left){if(z.options.position.target!=="mouse"){s.left=v.position.left+v.dimensions.width}else{s.left=z.cache.mouse.x}y.x="Left"}else{if(x.right){if(z.options.position.target!=="mouse"){s.left=v.position.left-A.dimensions.width}else{s.left=z.cache.mouse.x-A.dimensions.width}y.x="Right"}}if(x.top){if(z.options.position.target!=="mouse"){s.top=v.position.top+v.dimensions.height}else{s.top=z.cache.mouse.y}y.y="top"}else{if(x.bottom){if(z.options.position.target!=="mouse"){s.top=v.position.top-A.dimensions.height}else{s.top=z.cache.mouse.y-A.dimensions.height}y.y="bottom"}}if(s.left<0){s.left=u.left;y.x=false}if(s.top<0){s.top=u.top;y.y=false}if(z.options.style.tip.corner!==false){s.corner=new String(A.corner);if(y.x!==false){s.corner=s.corner.replace(/Left|Right|Middle/,y.x)}if(y.y!==false){s.corner=s.corner.replace(/top|bottom/,y.y)}if(s.corner!==z.elements.tip.attr("rel")){e.call(z,s.corner)}}return s}function q(u,t){var v,s;v=f.extend(true,{},u);for(s in v){if(t===true&&s.search(/(tip|classes)/i)!==-1){delete v[s]}else{if(!t&&s.search(/(width|border|tip|title|classes|user)/i)!==-1){delete v[s]}}}return v}function c(s){if(typeof s.tip!=="object"){s.tip={corner:s.tip}}if(typeof s.tip.size!=="object"){s.tip.size={width:s.tip.size,height:s.tip.size}}if(typeof s.border!=="object"){s.border={width:s.border}}if(typeof s.width!=="object"){s.width={value:s.width}}if(typeof s.width.max=="string"){s.width.max=parseInt(s.width.max.replace(/([0-9]+)/i,"$1"))}if(typeof s.width.min=="string"){s.width.min=parseInt(s.width.min.replace(/([0-9]+)/i,"$1"))}if(typeof s.tip.size.x=="number"){s.tip.size.width=s.tip.size.x;delete s.tip.size.x}if(typeof s.tip.size.y=="number"){s.tip.size.height=s.tip.size.y;delete s.tip.size.y}return s}function a(){var s,t,u,x,v,w;s=this;u=[true,{}];for(t=0;t<arguments.length;t++){u.push(arguments[t])}x=[f.extend.apply(f,u)];while(typeof x[0].name=="string"){x.unshift(c(f.fn.qtip.styles[x[0].name]))}x.unshift(true,{classes:{tooltip:"qtip-"+(arguments[0].name||"defaults")}},f.fn.qtip.styles.defaults);v=f.extend.apply(f,x);w=(f.browser.msie)?1:0;v.tip.size.width+=w;v.tip.size.height+=w;if(v.tip.size.width%2>0){v.tip.size.width+=1}if(v.tip.size.height%2>0){v.tip.size.height+=1}if(v.tip.corner===true){v.tip.corner=(s.options.position.corner.tooltip==="center")?false:s.options.position.corner.tooltip}return v}function b(v,u,t){var s={bottomRight:[[0,0],[u,t],[u,0]],bottomLeft:[[0,0],[u,0],[0,t]],topRight:[[0,t],[u,0],[u,t]],topLeft:[[0,0],[0,t],[u,t]],topMiddle:[[0,t],[u/2,0],[u,t]],bottomMiddle:[[0,0],[u,0],[u/2,t]],rightMiddle:[[0,0],[u,t/2],[0,t]],leftMiddle:[[u,0],[u,t],[0,t/2]]};s.leftTop=s.bottomRight;s.rightTop=s.bottomLeft;s.leftBottom=s.topRight;s.rightBottom=s.topLeft;return s[v]}function g(s){var t;if(f("<canvas>").get(0).getContext){t={topLeft:[s,s],topRight:[0,s],bottomLeft:[s,0],bottomRight:[0,0]}}else{if(f.browser.msie){t={topLeft:[-90,90,0],topRight:[-90,90,-s],bottomLeft:[90,270,0],bottomRight:[90,270,-s]}}}return t}function k(){var s,t,u;s=this;u=s.getDimensions();t='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; height:'+u.height+"px; width:"+u.width+'px" />';s.elements.bgiframe=s.elements.wrapper.prepend(t).children(".qtip-bgiframe:first")}f(document).ready(function(){f.fn.qtip.cache={screen:{scroll:{left:f(window).scrollLeft(),top:f(window).scrollTop()},width:f(window).width(),height:f(window).height()}};var s;f(window).bind("resize scroll",function(t){clearTimeout(s);s=setTimeout(function(){if(t.type==="scroll"){f.fn.qtip.cache.screen.scroll={left:f(window).scrollLeft(),top:f(window).scrollTop()}}else{f.fn.qtip.cache.screen.width=f(window).width();f.fn.qtip.cache.screen.height=f(window).height()}for(i=0;i<f.fn.qtip.interfaces.length;i++){var u=f.fn.qtip.interfaces[i];if(u.status.rendered===true&&(u.options.position.type!=="static"||u.options.position.adjust.scroll&&t.type==="scroll"||u.options.position.adjust.resize&&t.type==="resize")){u.updatePosition(t,true)}}},100)});f(document).bind("mousedown.qtip",function(t){if(f(t.target).parents("div.qtip").length===0){f(".qtip[unfocus]").each(function(){var u=f(this).qtip("api");if(f(this).is(":visible")&&!u.status.disabled&&f(t.target).add(u.elements.target).length>1){u.hide(t)}})}})});f.fn.qtip.interfaces=[];f.fn.qtip.log={error:function(){return this}};f.fn.qtip.constants={};f.fn.qtip.defaults={content:{prerender:false,text:false,url:false,data:null,title:{text:false,button:false}},position:{target:false,corner:{target:"bottomRight",tooltip:"topLeft"},adjust:{x:0,y:0,mouse:true,screen:false,scroll:true,resize:true},type:"absolute",container:false},show:{when:{target:false,event:"mouseover"},effect:{type:"fade",length:100},delay:140,solo:false,ready:false},hide:{when:{target:false,event:"mouseout"},effect:{type:"fade",length:100},delay:0,fixed:false},api:{beforeRender:function(){},onRender:function(){},beforePositionUpdate:function(){},onPositionUpdate:function(){},beforeShow:function(){},onShow:function(){},beforeHide:function(){},onHide:function(){},beforeContentUpdate:function(){},onContentUpdate:function(){},beforeContentLoad:function(){},onContentLoad:function(){},beforeTitleUpdate:function(){},onTitleUpdate:function(){},beforeDestroy:function(){},onDestroy:function(){},beforeFocus:function(){},onFocus:function(){}}};f.fn.qtip.styles={defaults:{background:"white",color:"#111",overflow:"hidden",textAlign:"left",width:{min:0,max:250},padding:"5px 9px",border:{width:1,radius:0,color:"#d3d3d3"},tip:{corner:false,color:false,size:{width:13,height:13},opacity:1},title:{background:"#e1e1e1",fontWeight:"bold",padding:"7px 12px"},button:{cursor:"pointer"},classes:{target:"",tip:"qtip-tip",title:"qtip-title",button:"qtip-button",content:"qtip-content",active:"qtip-active"}},cream:{border:{width:3,radius:0,color:"#F9E98E"},title:{background:"#F0DE7D",color:"#A27D35"},background:"#FBF7AA",color:"#A27D35",classes:{tooltip:"qtip-cream"}},light:{border:{width:3,radius:0,color:"#E2E2E2"},title:{background:"#f1f1f1",color:"#454545"},background:"white",color:"#454545",classes:{tooltip:"qtip-light"}},dark:{border:{width:3,radius:0,color:"#303030"},title:{background:"#404040",color:"#f3f3f3"},background:"#505050",color:"#f3f3f3",classes:{tooltip:"qtip-dark"}},red:{border:{width:3,radius:0,color:"#CE6F6F"},title:{background:"#f28279",color:"#9C2F2F"},background:"#F79992",color:"#9C2F2F",classes:{tooltip:"qtip-red"}},green:{border:{width:3,radius:0,color:"#A9DB66"},title:{background:"#b9db8c",color:"#58792E"},background:"#CDE6AC",color:"#58792E",classes:{tooltip:"qtip-green"}},blue:{border:{width:3,radius:0,color:"#ADD9ED"},title:{background:"#D0E9F5",color:"#5E99BD"},background:"#E5F6FE",color:"#4D9FBF",classes:{tooltip:"qtip-blue"}}}})(jQuery);
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
|
assets/ui-theme/images/ui-bg_flat_0_aaaaaa_40x100.png
ADDED
Binary file
|
assets/ui-theme/images/ui-bg_flat_75_ffffff_40x100.png
ADDED
Binary file
|
assets/ui-theme/images/ui-bg_glass_55_fbf9ee_1x400.png
ADDED
Binary file
|
assets/ui-theme/images/ui-bg_glass_65_ffffff_1x400.png
ADDED
Binary file
|
assets/ui-theme/images/ui-bg_glass_75_dadada_1x400.png
ADDED
Binary file
|
assets/ui-theme/images/ui-bg_glass_75_e6e6e6_1x400.png
ADDED
Binary file
|
assets/ui-theme/images/ui-bg_glass_95_fef1ec_1x400.png
ADDED
Binary file
|
assets/ui-theme/images/ui-bg_highlight-soft_75_cccccc_1x100.png
ADDED
Binary file
|
assets/ui-theme/images/ui-icons_222222_256x240.png
ADDED
Binary file
|
assets/ui-theme/images/ui-icons_2e83ff_256x240.png
ADDED
Binary file
|
assets/ui-theme/images/ui-icons_454545_256x240.png
ADDED
Binary file
|
assets/ui-theme/images/ui-icons_888888_256x240.png
ADDED
Binary file
|
assets/ui-theme/images/ui-icons_cd0a0a_256x240.png
ADDED
Binary file
|
assets/ui-theme/jquery-ui-1.8.18.custom.css
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* jQuery UI CSS Framework 1.8.18
|
3 |
+
*
|
4 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI/Theming/API
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* Layout helpers
|
12 |
+
----------------------------------*/
|
13 |
+
.ui-helper-hidden { display: none; }
|
14 |
+
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
|
15 |
+
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
16 |
+
.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
|
17 |
+
.ui-helper-clearfix:after { clear: both; }
|
18 |
+
.ui-helper-clearfix { zoom: 1; }
|
19 |
+
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
20 |
+
|
21 |
+
|
22 |
+
/* Interaction Cues
|
23 |
+
----------------------------------*/
|
24 |
+
.ui-state-disabled { cursor: default !important; }
|
25 |
+
|
26 |
+
|
27 |
+
/* Icons
|
28 |
+
----------------------------------*/
|
29 |
+
|
30 |
+
/* states and images */
|
31 |
+
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
32 |
+
|
33 |
+
|
34 |
+
/* Misc visuals
|
35 |
+
----------------------------------*/
|
36 |
+
|
37 |
+
/* Overlays */
|
38 |
+
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
39 |
+
|
40 |
+
|
41 |
+
/*
|
42 |
+
* jQuery UI CSS Framework 1.8.18
|
43 |
+
*
|
44 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
45 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
46 |
+
* http://jquery.org/license
|
47 |
+
*
|
48 |
+
* http://docs.jquery.com/UI/Theming/API
|
49 |
+
*
|
50 |
+
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
|
51 |
+
*/
|
52 |
+
|
53 |
+
|
54 |
+
/* Component containers
|
55 |
+
----------------------------------*/
|
56 |
+
.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
|
57 |
+
.ui-widget .ui-widget { font-size: 1em; }
|
58 |
+
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
|
59 |
+
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
|
60 |
+
.ui-widget-content a { color: #222222; }
|
61 |
+
.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
|
62 |
+
.ui-widget-header a { color: #222222; }
|
63 |
+
|
64 |
+
/* Interaction states
|
65 |
+
----------------------------------*/
|
66 |
+
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
|
67 |
+
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
|
68 |
+
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
|
69 |
+
.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
|
70 |
+
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
|
71 |
+
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
|
72 |
+
.ui-widget :active { outline: none; }
|
73 |
+
|
74 |
+
/* Interaction Cues
|
75 |
+
----------------------------------*/
|
76 |
+
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
|
77 |
+
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
|
78 |
+
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
|
79 |
+
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
|
80 |
+
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
|
81 |
+
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
|
82 |
+
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
83 |
+
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
84 |
+
|
85 |
+
|
86 |
+
/* Misc visuals
|
87 |
+
----------------------------------*/
|
88 |
+
|
89 |
+
/* Corner radius */
|
90 |
+
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
|
91 |
+
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
|
92 |
+
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
|
93 |
+
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
|
94 |
+
|
95 |
+
/* Overlays */
|
96 |
+
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
|
97 |
+
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
|
98 |
+
* jQuery UI Slider 1.8.18
|
99 |
+
*
|
100 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
101 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
102 |
+
* http://jquery.org/license
|
103 |
+
*
|
104 |
+
* http://docs.jquery.com/UI/Slider#theming
|
105 |
+
*/
|
106 |
+
.ui-slider { position: relative; text-align: left; }
|
107 |
+
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 12px; height: 12px; cursor: default; }
|
108 |
+
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
|
109 |
+
|
110 |
+
.ui-slider-horizontal { height: 8px; }
|
111 |
+
.ui-slider-horizontal .ui-slider-handle { top: -3px; margin-left: -4px; }
|
112 |
+
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
|
113 |
+
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
|
114 |
+
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
|
115 |
+
|
116 |
+
.ui-slider-vertical { width: .8em; height: 100px; }
|
117 |
+
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
|
118 |
+
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
|
119 |
+
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
|
120 |
+
.ui-slider-vertical .ui-slider-range-max { top: 0; }
|
classes/sortable.php
ADDED
@@ -0,0 +1,890 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Coderess Sortable Columns Class
|
5 |
+
*
|
6 |
+
* @since 1.3
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
class Codepress_Sortable_Columns extends Codepress_Admin_Columns
|
10 |
+
{
|
11 |
+
private $post_types,
|
12 |
+
$unlocked,
|
13 |
+
$show_all_results;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Constructor
|
17 |
+
*
|
18 |
+
* @since 1.0
|
19 |
+
*/
|
20 |
+
function __construct()
|
21 |
+
{
|
22 |
+
add_action( 'wp_loaded', array( $this, 'init') );
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Initialize
|
27 |
+
*
|
28 |
+
* @since 1.0
|
29 |
+
*/
|
30 |
+
public function init()
|
31 |
+
{
|
32 |
+
// vars
|
33 |
+
$this->unlocked = $this->is_unlocked('sortable');
|
34 |
+
$this->post_types = $this->get_post_types();
|
35 |
+
$this->show_all_results = false;
|
36 |
+
|
37 |
+
add_action( 'admin_init', array( $this, 'register_sortable_columns' ) );
|
38 |
+
|
39 |
+
// handle requests for sorting columns
|
40 |
+
add_filter( 'request', array( $this, 'handle_requests_orderby_column'), 1 );
|
41 |
+
add_action( 'pre_user_query', array( $this, 'handle_requests_orderby_users_column'), 1 );
|
42 |
+
add_action( 'admin_init', array( $this, 'handle_requests_orderby_links_column'), 1 );
|
43 |
+
add_action( 'admin_init', array( $this, 'handle_requests_orderby_comments_column'), 1 );
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Register sortable columns
|
48 |
+
*
|
49 |
+
* Hooks into apply_filters( "manage_{$screen->id}_sortable_columns" ) which is found in class-wp-list-table.php
|
50 |
+
*
|
51 |
+
* @since 1.0
|
52 |
+
*/
|
53 |
+
function register_sortable_columns()
|
54 |
+
{
|
55 |
+
if ( ! $this->unlocked )
|
56 |
+
return false;
|
57 |
+
|
58 |
+
/** Posts */
|
59 |
+
foreach ( $this->post_types as $post_type )
|
60 |
+
add_filter( "manage_edit-{$post_type}_sortable_columns", array($this, 'callback_add_sortable_posts_column'));
|
61 |
+
|
62 |
+
/** Users */
|
63 |
+
add_filter( "manage_users_sortable_columns", array($this, 'callback_add_sortable_users_column'));
|
64 |
+
|
65 |
+
/** Media */
|
66 |
+
add_filter( "manage_upload_sortable_columns", array($this, 'callback_add_sortable_media_column'));
|
67 |
+
|
68 |
+
/** Links */
|
69 |
+
add_filter( "manage_link-manager_sortable_columns", array($this, 'callback_add_sortable_links_column'));
|
70 |
+
|
71 |
+
/** Comments */
|
72 |
+
add_filter( "manage_edit-comments_sortable_columns", array($this, 'callback_add_sortable_comments_column'));
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Callback add Posts sortable column
|
77 |
+
*
|
78 |
+
* @since 1.0
|
79 |
+
*/
|
80 |
+
public function callback_add_sortable_posts_column($columns)
|
81 |
+
{
|
82 |
+
global $post_type;
|
83 |
+
|
84 |
+
return $this->add_managed_sortable_columns($post_type, $columns);
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Callback add Users sortable column
|
89 |
+
*
|
90 |
+
* @since 1.1
|
91 |
+
*/
|
92 |
+
public function callback_add_sortable_users_column($columns)
|
93 |
+
{
|
94 |
+
return $this->add_managed_sortable_columns('wp-users', $columns);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Callback add Media sortable column
|
99 |
+
*
|
100 |
+
* @since 1.3
|
101 |
+
*/
|
102 |
+
public function callback_add_sortable_media_column($columns)
|
103 |
+
{
|
104 |
+
return $this->add_managed_sortable_columns('wp-media', $columns);
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Callback add Links sortable column
|
109 |
+
*
|
110 |
+
* @since 1.3.1
|
111 |
+
*/
|
112 |
+
public function callback_add_sortable_links_column($columns)
|
113 |
+
{
|
114 |
+
return $this->add_managed_sortable_columns('wp-links', $columns);
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Callback add Comments sortable column
|
119 |
+
*
|
120 |
+
* @since 1.3.1
|
121 |
+
*/
|
122 |
+
public function callback_add_sortable_comments_column($columns)
|
123 |
+
{
|
124 |
+
return $this->add_managed_sortable_columns('wp-comments', $columns);
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Add managed sortable columns by Type
|
129 |
+
*
|
130 |
+
* @since 1.1
|
131 |
+
*/
|
132 |
+
private function add_managed_sortable_columns( $type = 'post', $columns )
|
133 |
+
{
|
134 |
+
$display_columns = $this->get_merged_columns($type);
|
135 |
+
|
136 |
+
if ( ! $display_columns )
|
137 |
+
return $columns;
|
138 |
+
|
139 |
+
foreach ( $display_columns as $id => $vars ) {
|
140 |
+
if ( isset($vars['options']['sortorder']) && $vars['options']['sortorder'] == 'on' ){
|
141 |
+
|
142 |
+
// register format
|
143 |
+
$columns[$id] = $this->sanitize_string($vars['label']);
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
return $columns;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Admin requests for orderby column
|
152 |
+
*
|
153 |
+
* Only works for WP_Query objects ( such as posts and media )
|
154 |
+
*
|
155 |
+
* @since 1.0
|
156 |
+
*/
|
157 |
+
public function handle_requests_orderby_column( $vars )
|
158 |
+
{
|
159 |
+
if ( ! isset( $vars['orderby'] ) )
|
160 |
+
return $vars;
|
161 |
+
|
162 |
+
/** Users */
|
163 |
+
// You would expect to see get_orderby_users_vars(), but sorting for
|
164 |
+
// users is handled through a different filter. Not 'request', but 'pre_user_query'.
|
165 |
+
// See handle_requests_orderby_users_column().
|
166 |
+
|
167 |
+
/** Media */
|
168 |
+
elseif ( $this->request_uri_is('upload') )
|
169 |
+
$vars = $this->get_orderby_media_vars($vars);
|
170 |
+
|
171 |
+
/** Posts */
|
172 |
+
elseif ( !empty($vars['post_type']) )
|
173 |
+
$vars = $this->get_orderby_posts_vars($vars);
|
174 |
+
|
175 |
+
return $vars;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Orderby Users column
|
180 |
+
*
|
181 |
+
* @since 1.3
|
182 |
+
*/
|
183 |
+
public function handle_requests_orderby_users_column($user_query)
|
184 |
+
{
|
185 |
+
// query vars
|
186 |
+
$vars = $user_query->query_vars;
|
187 |
+
|
188 |
+
// Column
|
189 |
+
$column = $this->get_orderby_type( $vars['orderby'], 'wp-users' );
|
190 |
+
|
191 |
+
if ( empty($column) )
|
192 |
+
return $vars;
|
193 |
+
|
194 |
+
// id
|
195 |
+
$id = key($column);
|
196 |
+
|
197 |
+
// type
|
198 |
+
$type = $id;
|
199 |
+
|
200 |
+
// Check for user custom fields: column-meta-[customfieldname]
|
201 |
+
if ( $this->is_column_meta($type) )
|
202 |
+
$type = 'column-user-meta';
|
203 |
+
|
204 |
+
// Check for post count: column-user_postcount-[posttype]
|
205 |
+
if ( $this->get_posttype_by_postcount_column($type) )
|
206 |
+
$type = 'column-user_postcount';
|
207 |
+
|
208 |
+
// var
|
209 |
+
$cusers = array();
|
210 |
+
switch( $type ) :
|
211 |
+
|
212 |
+
case 'column-user_id':
|
213 |
+
$user_query->query_vars['orderby'] = 'ID';
|
214 |
+
break;
|
215 |
+
|
216 |
+
case 'column-user_registered':
|
217 |
+
$user_query->query_vars['orderby'] = 'registered';
|
218 |
+
break;
|
219 |
+
|
220 |
+
case 'column-nickname':
|
221 |
+
$user_query->query_vars['orderby'] = 'nickname';
|
222 |
+
break;
|
223 |
+
|
224 |
+
case 'column-first_name':
|
225 |
+
foreach ( $this->get_users_data() as $u )
|
226 |
+
if ($u->first_name || $this->show_all_results )
|
227 |
+
$cusers[$u->ID] = $this->prepare_sort_string_value($u->first_name);
|
228 |
+
$this->set_users_query_vars( &$user_query, $cusers, SORT_REGULAR );
|
229 |
+
break;
|
230 |
+
|
231 |
+
case 'column-last_name':
|
232 |
+
foreach ( $this->get_users_data() as $u )
|
233 |
+
if ($u->last_name || $this->show_all_results )
|
234 |
+
$cusers[$u->ID] = $this->prepare_sort_string_value($u->last_name);
|
235 |
+
$this->set_users_query_vars( &$user_query, $cusers, SORT_REGULAR );
|
236 |
+
break;
|
237 |
+
|
238 |
+
case 'column-user_url':
|
239 |
+
foreach ( $this->get_users_data() as $u )
|
240 |
+
if ($u->user_url || $this->show_all_results )
|
241 |
+
$cusers[$u->ID] = $this->prepare_sort_string_value($u->user_url);
|
242 |
+
$this->set_users_query_vars( &$user_query, $cusers, SORT_REGULAR );
|
243 |
+
break;
|
244 |
+
|
245 |
+
case 'column-user_description':
|
246 |
+
foreach ( $this->get_users_data() as $u )
|
247 |
+
if ($u->user_description || $this->show_all_results )
|
248 |
+
$cusers[$u->ID] = $this->prepare_sort_string_value($u->user_description);
|
249 |
+
$this->set_users_query_vars( &$user_query, $cusers, SORT_REGULAR );
|
250 |
+
break;
|
251 |
+
|
252 |
+
case 'column-user_postcount' :
|
253 |
+
$post_type = $this->get_posttype_by_postcount_column($id);
|
254 |
+
if ( $post_type ) {
|
255 |
+
foreach ( $this->get_users_data() as $u ) {
|
256 |
+
$count = $this->get_post_count( $post_type, $u->ID );
|
257 |
+
$cusers[$u->ID] = $this->prepare_sort_string_value($count);
|
258 |
+
}
|
259 |
+
$this->set_users_query_vars( &$user_query, $cusers, SORT_REGULAR );
|
260 |
+
}
|
261 |
+
break;
|
262 |
+
|
263 |
+
case 'role' :
|
264 |
+
foreach ( $this->get_users_data() as $u ) {
|
265 |
+
$role = !empty($u->roles[0]) ? $u->roles[0] : '';
|
266 |
+
if ($role || $this->show_all_results ) {
|
267 |
+
$cusers[$u->ID] = $this->prepare_sort_string_value($role);
|
268 |
+
}
|
269 |
+
}
|
270 |
+
$this->set_users_query_vars( &$user_query, $cusers, SORT_REGULAR );
|
271 |
+
break;
|
272 |
+
|
273 |
+
case 'column-user-meta' :
|
274 |
+
$field = $column[$id]['field'];
|
275 |
+
if ( $field ) {
|
276 |
+
|
277 |
+
// order numeric or string
|
278 |
+
$order = SORT_REGULAR;
|
279 |
+
if ( $column[$id]['field_type'] == 'numeric' || $column[$id]['field_type'] == 'library_id' )
|
280 |
+
$order = SORT_NUMERIC;
|
281 |
+
|
282 |
+
// sort by metavalue
|
283 |
+
foreach ( $this->get_users_data() as $u ) {
|
284 |
+
$value = get_metadata('user', $u->ID, $field, true);
|
285 |
+
$cusers[$u->ID] = $this->prepare_sort_string_value($value);
|
286 |
+
}
|
287 |
+
$this->set_users_query_vars( &$user_query, $cusers, $order );
|
288 |
+
}
|
289 |
+
break;
|
290 |
+
|
291 |
+
endswitch;
|
292 |
+
|
293 |
+
return $user_query;
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Orderby Links column
|
298 |
+
*
|
299 |
+
* Makes use of filter 'get_bookmarks' from bookmark.php to change the result set of the links
|
300 |
+
*
|
301 |
+
* @since 1.3.1
|
302 |
+
*/
|
303 |
+
public function handle_requests_orderby_links_column()
|
304 |
+
{
|
305 |
+
// fire only when we are in the admins link-manager
|
306 |
+
if ( $this->request_uri_is('link-manager') )
|
307 |
+
add_filter( 'get_bookmarks', array( $this, 'callback_requests_orderby_links_column'), 10, 2);
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Orderby Links column
|
312 |
+
*
|
313 |
+
* @since 1.3.1
|
314 |
+
*/
|
315 |
+
public function callback_requests_orderby_links_column($results, $vars)
|
316 |
+
{
|
317 |
+
global $wpdb;
|
318 |
+
|
319 |
+
// Column
|
320 |
+
$column = $this->get_orderby_type( $vars['orderby'], 'wp-links' );
|
321 |
+
|
322 |
+
if ( empty($column) )
|
323 |
+
return $results;
|
324 |
+
|
325 |
+
// id
|
326 |
+
$type = $id = key($column);
|
327 |
+
|
328 |
+
// var
|
329 |
+
$length = '';
|
330 |
+
switch( $type ) :
|
331 |
+
|
332 |
+
case 'column-link_id':
|
333 |
+
if ( version_compare( get_bloginfo('version'), '3.2', '>' ) )
|
334 |
+
$vars['orderby'] = 'link_id';
|
335 |
+
else
|
336 |
+
$vars['orderby'] = 'id';
|
337 |
+
break;
|
338 |
+
|
339 |
+
case 'column-owner':
|
340 |
+
$vars['orderby'] = 'link_owner';
|
341 |
+
break;
|
342 |
+
|
343 |
+
case 'column-length':
|
344 |
+
$vars['orderby'] = 'length';
|
345 |
+
$length = ", CHAR_LENGTH(link_name) AS length";
|
346 |
+
break;
|
347 |
+
|
348 |
+
case 'column-target':
|
349 |
+
$vars['orderby'] = 'link_target';
|
350 |
+
break;
|
351 |
+
|
352 |
+
case 'column-description':
|
353 |
+
$vars['orderby'] = 'link_description';
|
354 |
+
break;
|
355 |
+
|
356 |
+
case 'column-notes':
|
357 |
+
$vars['orderby'] = 'link_notes';
|
358 |
+
break;
|
359 |
+
|
360 |
+
case 'column-rss':
|
361 |
+
$vars['orderby'] = 'link_rss';
|
362 |
+
break;
|
363 |
+
|
364 |
+
/** native WP columns */
|
365 |
+
|
366 |
+
// Relationship
|
367 |
+
case 'rel':
|
368 |
+
$vars['orderby'] = 'link_rel';
|
369 |
+
break;
|
370 |
+
|
371 |
+
default:
|
372 |
+
$vars['orderby'] = '';
|
373 |
+
|
374 |
+
endswitch;
|
375 |
+
|
376 |
+
// get bookmarks by orderby vars
|
377 |
+
if ( $vars['orderby'] ) {
|
378 |
+
$vars['order'] = mysql_escape_string($vars['order']);
|
379 |
+
$sql = "SELECT * {$length} FROM {$wpdb->links} WHERE 1=1 ORDER BY {$vars['orderby']} {$vars['order']}";
|
380 |
+
$results = $wpdb->get_results($sql);
|
381 |
+
|
382 |
+
// check for errors
|
383 |
+
if( is_wp_error($results) )
|
384 |
+
return false;
|
385 |
+
}
|
386 |
+
|
387 |
+
return $results;
|
388 |
+
}
|
389 |
+
|
390 |
+
/**
|
391 |
+
* Orderby Comments column
|
392 |
+
*
|
393 |
+
* @since 1.3.1
|
394 |
+
*/
|
395 |
+
public function callback_requests_orderby_comments_column($pieces, $ref_comment)
|
396 |
+
{
|
397 |
+
// get query vars
|
398 |
+
$vars = $ref_comment->query_vars;
|
399 |
+
|
400 |
+
// Column
|
401 |
+
$column = $this->get_orderby_type( $vars['orderby'], 'wp-comments' );
|
402 |
+
|
403 |
+
if ( empty($column) )
|
404 |
+
return $pieces;
|
405 |
+
|
406 |
+
// id
|
407 |
+
$type = $id = key($column);
|
408 |
+
|
409 |
+
// var
|
410 |
+
switch( $type ) :
|
411 |
+
|
412 |
+
case 'column-comment_id':
|
413 |
+
$pieces['orderby'] = 'comment_ID';
|
414 |
+
break;
|
415 |
+
|
416 |
+
case 'column-author_author':
|
417 |
+
$pieces['orderby'] = 'comment_author';
|
418 |
+
break;
|
419 |
+
|
420 |
+
case 'column-author_ip':
|
421 |
+
$pieces['orderby'] = 'comment_author_IP';
|
422 |
+
break;
|
423 |
+
|
424 |
+
case 'column-author_url':
|
425 |
+
$pieces['orderby'] = 'comment_author_url';
|
426 |
+
break;
|
427 |
+
|
428 |
+
case 'column-author_email':
|
429 |
+
$pieces['orderby'] = 'comment_author_email';
|
430 |
+
break;
|
431 |
+
|
432 |
+
case 'column-reply_to':
|
433 |
+
break;
|
434 |
+
|
435 |
+
case 'column-approved':
|
436 |
+
$pieces['orderby'] = 'comment_approved';
|
437 |
+
break;
|
438 |
+
|
439 |
+
case 'column-date':
|
440 |
+
$pieces['orderby'] = 'comment_date';
|
441 |
+
break;
|
442 |
+
|
443 |
+
case 'column-agent':
|
444 |
+
$pieces['orderby'] = 'comment_agent';
|
445 |
+
break;
|
446 |
+
|
447 |
+
case 'column-excerpt':
|
448 |
+
$pieces['orderby'] = 'comment_content';
|
449 |
+
break;
|
450 |
+
|
451 |
+
case 'column-date_gmt':
|
452 |
+
// is default
|
453 |
+
break;
|
454 |
+
|
455 |
+
/** native WP columns */
|
456 |
+
|
457 |
+
// Relationship
|
458 |
+
case 'comment':
|
459 |
+
$pieces['orderby'] = 'comment_content';
|
460 |
+
break;
|
461 |
+
|
462 |
+
default:
|
463 |
+
$vars['orderby'] = '';
|
464 |
+
|
465 |
+
endswitch;
|
466 |
+
|
467 |
+
return $pieces;
|
468 |
+
}
|
469 |
+
|
470 |
+
/**
|
471 |
+
* Orderby Comments column
|
472 |
+
*
|
473 |
+
* @since 1.3.1
|
474 |
+
*/
|
475 |
+
public function handle_requests_orderby_comments_column()
|
476 |
+
{
|
477 |
+
// fire only when we are in the admins edit-comments
|
478 |
+
if ( $this->request_uri_is('edit-comments') )
|
479 |
+
add_filter('comments_clauses', array( $this, 'callback_requests_orderby_comments_column'), 10, 2);
|
480 |
+
}
|
481 |
+
|
482 |
+
/**
|
483 |
+
* Set sorting vars in User Query Object
|
484 |
+
*
|
485 |
+
* @since 1.3
|
486 |
+
*/
|
487 |
+
private function set_users_query_vars(&$user_query, $sortusers, $sort_flags = SORT_REGULAR )
|
488 |
+
{
|
489 |
+
global $wpdb;
|
490 |
+
|
491 |
+
// vars
|
492 |
+
$vars = $user_query->query_vars;
|
493 |
+
|
494 |
+
// sorting
|
495 |
+
if ( $vars['order'] == 'ASC' )
|
496 |
+
asort($sortusers, $sort_flags);
|
497 |
+
else
|
498 |
+
arsort($sortusers, $sort_flags);
|
499 |
+
|
500 |
+
// alter orderby SQL
|
501 |
+
if ( ! empty ( $sortusers ) ) {
|
502 |
+
$ids = implode(',', array_keys($sortusers));
|
503 |
+
$user_query->query_where .= " AND {$wpdb->prefix}users.ID IN ({$ids})";
|
504 |
+
$user_query->query_orderby = "ORDER BY FIELD ({$wpdb->prefix}users.ID,{$ids})";
|
505 |
+
}
|
506 |
+
|
507 |
+
// cleanup the vars we dont need
|
508 |
+
$vars['order'] = '';
|
509 |
+
$vars['orderby'] = '';
|
510 |
+
|
511 |
+
$user_query->query_vars = $vars;
|
512 |
+
}
|
513 |
+
|
514 |
+
/**
|
515 |
+
* Orderby Media column
|
516 |
+
*
|
517 |
+
* @since 1.3
|
518 |
+
*/
|
519 |
+
private function get_orderby_media_vars($vars)
|
520 |
+
{
|
521 |
+
// Column
|
522 |
+
$column = $this->get_orderby_type( $vars['orderby'], 'wp-media' );
|
523 |
+
|
524 |
+
if ( empty($column) )
|
525 |
+
return $vars;
|
526 |
+
|
527 |
+
// var
|
528 |
+
$cposts = array();
|
529 |
+
switch( key($column) ) :
|
530 |
+
|
531 |
+
case 'column-mediaid' :
|
532 |
+
$vars['orderby'] = 'ID';
|
533 |
+
break;
|
534 |
+
|
535 |
+
case 'column-width' :
|
536 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p ) {
|
537 |
+
$meta = wp_get_attachment_metadata($p->ID);
|
538 |
+
$width = !empty($meta['width']) ? $meta['width'] : 0;
|
539 |
+
if ( $width || $this->show_all_results )
|
540 |
+
$cposts[$p->ID] = $width;
|
541 |
+
}
|
542 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_NUMERIC );
|
543 |
+
break;
|
544 |
+
|
545 |
+
case 'column-height' :
|
546 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p ) {
|
547 |
+
$meta = wp_get_attachment_metadata($p->ID);
|
548 |
+
$height = !empty($meta['height']) ? $meta['height'] : 0;
|
549 |
+
if ( $height || $this->show_all_results )
|
550 |
+
$cposts[$p->ID] = $height;
|
551 |
+
}
|
552 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_NUMERIC );
|
553 |
+
break;
|
554 |
+
|
555 |
+
case 'column-dimensions' :
|
556 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p ) {
|
557 |
+
$meta = wp_get_attachment_metadata($p->ID);
|
558 |
+
$height = !empty($meta['height']) ? $meta['height'] : 0;
|
559 |
+
$width = !empty($meta['width']) ? $meta['width'] : 0;
|
560 |
+
$surface = $height*$width;
|
561 |
+
|
562 |
+
if ( $surface || $this->show_all_results )
|
563 |
+
$cposts[$p->ID] = $surface;
|
564 |
+
}
|
565 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_NUMERIC );
|
566 |
+
break;
|
567 |
+
|
568 |
+
case 'column-caption' :
|
569 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p )
|
570 |
+
if ( $p->post_excerpt || $this->show_all_results )
|
571 |
+
$cposts[$p->ID] = $this->prepare_sort_string_value($p->post_excerpt);
|
572 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING);
|
573 |
+
break;
|
574 |
+
|
575 |
+
case 'column-description' :
|
576 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p )
|
577 |
+
if ( $p->post_content || $this->show_all_results )
|
578 |
+
$cposts[$p->ID] = $this->prepare_sort_string_value( $p->post_content );
|
579 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING);
|
580 |
+
break;
|
581 |
+
|
582 |
+
case 'column-mime_type' :
|
583 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p )
|
584 |
+
if ( $p->post_mime_type || $this->show_all_results )
|
585 |
+
$cposts[$p->ID] = $this->prepare_sort_string_value( $p->post_mime_type );
|
586 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING);
|
587 |
+
break;
|
588 |
+
|
589 |
+
case 'column-file_name' :
|
590 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p ) {
|
591 |
+
$meta = get_post_meta($p->ID, '_wp_attached_file', true);
|
592 |
+
$file = !empty($meta) ? basename($meta) : '';
|
593 |
+
if ( $file || $this->show_all_results )
|
594 |
+
$cposts[$p->ID] = $file;
|
595 |
+
}
|
596 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING);
|
597 |
+
break;
|
598 |
+
|
599 |
+
case 'column-alternate_text' :
|
600 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p ) {
|
601 |
+
$alt = get_post_meta($p->ID, '_wp_attachment_image_alt', true);
|
602 |
+
if ( $alt || $this->show_all_results ) {
|
603 |
+
$cposts[$p->ID] = $this->prepare_sort_string_value( $alt );
|
604 |
+
}
|
605 |
+
}
|
606 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING);
|
607 |
+
break;
|
608 |
+
|
609 |
+
endswitch;
|
610 |
+
|
611 |
+
return $vars;
|
612 |
+
}
|
613 |
+
|
614 |
+
/**
|
615 |
+
* Orderby Posts column
|
616 |
+
*
|
617 |
+
* @since 1.3
|
618 |
+
*/
|
619 |
+
private function get_orderby_posts_vars($vars)
|
620 |
+
{
|
621 |
+
$post_type = $vars['post_type'];
|
622 |
+
|
623 |
+
// Column
|
624 |
+
$column = $this->get_orderby_type( $vars['orderby'], $post_type );
|
625 |
+
|
626 |
+
if ( empty($column) )
|
627 |
+
return $vars;
|
628 |
+
|
629 |
+
// id
|
630 |
+
$id = key($column);
|
631 |
+
|
632 |
+
// type
|
633 |
+
$type = $id;
|
634 |
+
|
635 |
+
// custom fields
|
636 |
+
if ( $this->is_column_meta($type) )
|
637 |
+
$type = 'column-post-meta';
|
638 |
+
|
639 |
+
// attachments
|
640 |
+
if ( $type == 'column-attachment-count' )
|
641 |
+
$type = 'column-attachment';
|
642 |
+
|
643 |
+
// var
|
644 |
+
$cposts = array();
|
645 |
+
switch( $type ) :
|
646 |
+
|
647 |
+
case 'column-postid' :
|
648 |
+
$vars['orderby'] = 'ID';
|
649 |
+
break;
|
650 |
+
|
651 |
+
case 'column-order' :
|
652 |
+
$vars['orderby'] = 'menu_order';
|
653 |
+
break;
|
654 |
+
|
655 |
+
case 'column-post-meta' :
|
656 |
+
$field = $column[$id]['field'];
|
657 |
+
|
658 |
+
// orderby type
|
659 |
+
$field_type = 'meta_value';
|
660 |
+
if ( $column[$id]['field_type'] == 'numeric' || $column[$id]['field_type'] == 'library_id' )
|
661 |
+
$field_type = 'meta_value_num';
|
662 |
+
|
663 |
+
$vars = array_merge($vars, array(
|
664 |
+
'meta_key' => $field,
|
665 |
+
'orderby' => $field_type
|
666 |
+
));
|
667 |
+
break;
|
668 |
+
|
669 |
+
case 'column-excerpt' :
|
670 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p ) {
|
671 |
+
|
672 |
+
// add excerpt to the post ids
|
673 |
+
$cposts[$p->ID] = $this->prepare_sort_string_value($p->post_content);
|
674 |
+
}
|
675 |
+
// we will add the sorted post ids to vars['post__in'] and remove unused vars
|
676 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING );
|
677 |
+
break;
|
678 |
+
|
679 |
+
case 'column-word-count' :
|
680 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p )
|
681 |
+
$cposts[$p->ID] = str_word_count( $this->strip_trim( $p->post_content ) );
|
682 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_NUMERIC );
|
683 |
+
break;
|
684 |
+
|
685 |
+
case 'column-page-template' :
|
686 |
+
$templates = get_page_templates();
|
687 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p ) {
|
688 |
+
$page_template = get_post_meta($p->ID, '_wp_page_template', true);
|
689 |
+
$cposts[$p->ID] = array_search($page_template, $templates);
|
690 |
+
}
|
691 |
+
$this->set_vars_post__in( &$vars, $cposts );
|
692 |
+
break;
|
693 |
+
|
694 |
+
case 'column-post_formats' :
|
695 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p ) {
|
696 |
+
$cposts[$p->ID] = get_post_format($p->ID);
|
697 |
+
}
|
698 |
+
$this->set_vars_post__in( &$vars, $cposts );
|
699 |
+
break;
|
700 |
+
|
701 |
+
case 'column-attachment' :
|
702 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p )
|
703 |
+
$cposts[$p->ID] = count( $this->get_attachment_ids($p->ID) );
|
704 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_NUMERIC );
|
705 |
+
break;
|
706 |
+
|
707 |
+
|
708 |
+
case 'column-page-slug' :
|
709 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p )
|
710 |
+
$cposts[$p->ID] = $p->post_name;
|
711 |
+
$this->set_vars_post__in( &$vars, $cposts );
|
712 |
+
break;
|
713 |
+
|
714 |
+
case 'column-sticky' :
|
715 |
+
$stickies = get_option('sticky_posts');
|
716 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p ) {
|
717 |
+
$cposts[$p->ID] = $p->ID;
|
718 |
+
if ( !empty($stickies) && in_array($p->ID, $stickies ) ) {
|
719 |
+
$cposts[$p->ID] = 0;
|
720 |
+
}
|
721 |
+
}
|
722 |
+
$this->set_vars_post__in( &$vars, $cposts );
|
723 |
+
break;
|
724 |
+
|
725 |
+
case 'column-featured_image' :
|
726 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p ) {
|
727 |
+
$cposts[$p->ID] = $p->ID;
|
728 |
+
$thumb = get_the_post_thumbnail($p->ID);
|
729 |
+
if ( !empty($thumb) ) {
|
730 |
+
$cposts[$p->ID] = 0;
|
731 |
+
}
|
732 |
+
}
|
733 |
+
$this->set_vars_post__in( &$vars, $cposts );
|
734 |
+
break;
|
735 |
+
|
736 |
+
case 'column-roles' :
|
737 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p ) {
|
738 |
+
$cposts[$p->ID] = 0;
|
739 |
+
$userdata = get_userdata($p->post_author);
|
740 |
+
if ( !empty($userdata->roles[0]) ) {
|
741 |
+
$cposts[$p->ID] = $userdata->roles[0];
|
742 |
+
}
|
743 |
+
}
|
744 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING );
|
745 |
+
break;
|
746 |
+
|
747 |
+
case 'column-status' :
|
748 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p ) {
|
749 |
+
$cposts[$p->ID] = $p->post_status.strtotime($p->post_date);
|
750 |
+
}
|
751 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING );
|
752 |
+
break;
|
753 |
+
|
754 |
+
endswitch;
|
755 |
+
|
756 |
+
return $vars;
|
757 |
+
}
|
758 |
+
|
759 |
+
/**
|
760 |
+
* Set post__in for use in WP_Query
|
761 |
+
*
|
762 |
+
* This will order the ID's asc or desc and set the appropriate filters.
|
763 |
+
*
|
764 |
+
* @since 1.2.1
|
765 |
+
*/
|
766 |
+
private function set_vars_post__in( &$vars, $sortposts, $sort_flags = SORT_REGULAR )
|
767 |
+
{
|
768 |
+
// sort post ids by value
|
769 |
+
if ( $vars['order'] == 'asc' )
|
770 |
+
asort($sortposts, $sort_flags);
|
771 |
+
else
|
772 |
+
arsort($sortposts, $sort_flags);
|
773 |
+
|
774 |
+
// this will make sure WP_Query will use the order of the ids that we have just set in 'post__in'
|
775 |
+
add_filter('posts_orderby', array( $this, 'filter_orderby_post__in'), 10, 2 );
|
776 |
+
|
777 |
+
// cleanup the vars we dont need
|
778 |
+
$vars['order'] = '';
|
779 |
+
$vars['orderby'] = '';
|
780 |
+
|
781 |
+
// add the sorted post ids to the query with the use of post__in
|
782 |
+
$vars['post__in'] = array_keys($sortposts);
|
783 |
+
}
|
784 |
+
|
785 |
+
/**
|
786 |
+
* Get orderby type
|
787 |
+
*
|
788 |
+
* @since 1.1
|
789 |
+
*/
|
790 |
+
private function get_orderby_type($orderby, $type)
|
791 |
+
{
|
792 |
+
$db_columns = $this->get_stored_columns($type);
|
793 |
+
|
794 |
+
if ( $db_columns ) {
|
795 |
+
foreach ( $db_columns as $id => $vars ) {
|
796 |
+
|
797 |
+
// check which custom column was clicked
|
798 |
+
if ( isset( $vars['label'] ) && $orderby == $this->sanitize_string( $vars['label'] ) ) {
|
799 |
+
$column[$id] = $vars;
|
800 |
+
return $column;
|
801 |
+
}
|
802 |
+
}
|
803 |
+
}
|
804 |
+
return false;
|
805 |
+
}
|
806 |
+
|
807 |
+
/**
|
808 |
+
* Maintain order of ids that are set in the post__in var.
|
809 |
+
*
|
810 |
+
* This will force the returned posts to use the order of the ID's that
|
811 |
+
* have been set in post__in. Without this the ID's will be set in numeric order.
|
812 |
+
* See the WP_Query object for more info about the use of post__in.
|
813 |
+
*
|
814 |
+
* @since 1.2.1
|
815 |
+
*/
|
816 |
+
public function filter_orderby_post__in($orderby, $wp)
|
817 |
+
{
|
818 |
+
global $wpdb;
|
819 |
+
|
820 |
+
// we need the query vars
|
821 |
+
$vars = $wp->query_vars;
|
822 |
+
if ( ! empty ( $vars['post__in'] ) ) {
|
823 |
+
// now we can get the ids
|
824 |
+
$ids = implode(',', $vars['post__in']);
|
825 |
+
|
826 |
+
// by adding FIELD to the SQL query we are forcing the order of the ID's
|
827 |
+
return "FIELD ({$wpdb->prefix}posts.ID,{$ids})";
|
828 |
+
}
|
829 |
+
}
|
830 |
+
|
831 |
+
/**
|
832 |
+
* Get any posts by post_type
|
833 |
+
*
|
834 |
+
* @since 1.2.1
|
835 |
+
*/
|
836 |
+
private function get_any_posts_by_posttype( $post_type )
|
837 |
+
{
|
838 |
+
$allposts = get_posts(array(
|
839 |
+
'numberposts' => -1,
|
840 |
+
'post_status' => 'any',
|
841 |
+
'post_type' => $post_type
|
842 |
+
));
|
843 |
+
return $allposts;
|
844 |
+
}
|
845 |
+
|
846 |
+
/**
|
847 |
+
* Request URI is
|
848 |
+
*
|
849 |
+
* @since 1.3.1
|
850 |
+
*/
|
851 |
+
private function request_uri_is( $screen_id = '' )
|
852 |
+
{
|
853 |
+
if (strpos( $_SERVER['REQUEST_URI'], "/{$screen_id}.php" ) !== false )
|
854 |
+
return true;
|
855 |
+
|
856 |
+
return false;
|
857 |
+
}
|
858 |
+
|
859 |
+
/**
|
860 |
+
* Prepare the value for being by sorting
|
861 |
+
*
|
862 |
+
* @since 1.3
|
863 |
+
*/
|
864 |
+
private function prepare_sort_string_value($string)
|
865 |
+
{
|
866 |
+
// remove tags and only get the first 20 chars and force lowercase.
|
867 |
+
$string = strtolower( substr( $this->strip_trim($string),0 ,20 ) );
|
868 |
+
|
869 |
+
return $string;
|
870 |
+
}
|
871 |
+
|
872 |
+
/**
|
873 |
+
* Get users data
|
874 |
+
*
|
875 |
+
* @since 1.3
|
876 |
+
*/
|
877 |
+
function get_users_data()
|
878 |
+
{
|
879 |
+
$userdatas = array();
|
880 |
+
$wp_users = get_users( array(
|
881 |
+
'blog_id' => $GLOBALS['blog_id'],
|
882 |
+
));
|
883 |
+
foreach ( $wp_users as $u ) {
|
884 |
+
$userdatas[$u->ID] = get_userdata($u->ID);
|
885 |
+
}
|
886 |
+
return $userdatas;
|
887 |
+
}
|
888 |
+
}
|
889 |
+
|
890 |
+
?>
|
codepress-admin-columns.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Codepress Admin Columns
|
4 |
-
Version: 1.
|
5 |
-
Description: This plugin makes it easy to
|
6 |
-
Author:
|
7 |
Author URI: http://www.codepress.nl
|
8 |
Plugin URI: http://www.codepress.nl/plugins/codepress-admin-columns/
|
9 |
Text Domain: codepress-admin-columns
|
@@ -26,17 +26,21 @@ along with this program; if not, write to the Free Software
|
|
26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
29 |
-
define( 'CPAC_VERSION', '1.
|
|
|
|
|
|
|
|
|
30 |
|
31 |
/**
|
32 |
-
*
|
33 |
*
|
34 |
-
* @since 1.
|
35 |
*/
|
36 |
-
|
37 |
|
38 |
/**
|
39 |
-
*
|
40 |
*
|
41 |
* @since 1.0
|
42 |
*
|
@@ -44,54 +48,82 @@ $cpac = new Codepress_Admin_Columns;
|
|
44 |
class Codepress_Admin_Columns
|
45 |
{
|
46 |
private $post_types,
|
47 |
-
$options,
|
48 |
-
$options_default,
|
49 |
$slug,
|
50 |
-
$textdomain
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
/**
|
53 |
-
*
|
54 |
*
|
55 |
* @since 1.0
|
56 |
*/
|
57 |
function __construct()
|
58 |
-
{
|
59 |
-
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
/**
|
63 |
-
*
|
64 |
*
|
65 |
* Loading sequence is determined and intialized.
|
66 |
*
|
67 |
* @since 1.0
|
68 |
*/
|
69 |
-
function init()
|
70 |
{
|
71 |
// vars
|
72 |
$this->post_types = $this->get_post_types();
|
73 |
-
|
74 |
-
|
75 |
-
$this->options_default = get_option('cpac_options_default');
|
76 |
-
|
77 |
-
// slug
|
78 |
$this->slug = 'codepress-admin-columns';
|
79 |
$this->textdomain = 'codepress-admin-columns';
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
// translations
|
82 |
load_plugin_textdomain( $this->textdomain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
83 |
|
84 |
-
//
|
85 |
-
add_action( 'admin_menu', array(
|
86 |
-
add_action( 'admin_init', array(
|
87 |
-
|
88 |
-
|
89 |
-
add_action( '
|
90 |
-
|
91 |
-
add_action( '
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
/**
|
97 |
* Admin Menu.
|
@@ -112,12 +144,19 @@ class Codepress_Admin_Columns
|
|
112 |
// Menu slug
|
113 |
$this->slug,
|
114 |
// Callback
|
115 |
-
array(
|
116 |
);
|
117 |
|
118 |
-
//
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
/**
|
123 |
* Add Settings link to plugin page
|
@@ -134,194 +173,194 @@ class Codepress_Admin_Columns
|
|
134 |
}
|
135 |
|
136 |
/**
|
137 |
-
* Register Columns
|
|
|
|
|
138 |
*
|
139 |
* @since 1.0
|
140 |
*/
|
141 |
public function register_columns()
|
142 |
{
|
143 |
-
|
144 |
-
|
|
|
145 |
// register column per post type
|
146 |
-
add_filter("manage_edit-{$post_type}_columns", array(
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
}
|
152 |
|
153 |
/**
|
154 |
-
* Callback
|
155 |
*
|
156 |
* @since 1.0
|
157 |
*/
|
158 |
-
public function
|
159 |
-
{
|
160 |
-
global $
|
161 |
-
|
162 |
-
|
163 |
-
return $columns;
|
164 |
}
|
165 |
|
166 |
/**
|
167 |
-
* Callback
|
168 |
*
|
169 |
-
* @since 1.
|
170 |
*/
|
171 |
-
public function
|
172 |
-
{
|
173 |
-
|
174 |
-
$columns = $this->set_sortable_filter($columns, $post_type);
|
175 |
-
|
176 |
-
return $columns;
|
177 |
}
|
178 |
|
179 |
/**
|
180 |
-
*
|
181 |
*
|
182 |
-
*
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
*
|
186 |
-
*
|
187 |
*/
|
188 |
-
public function
|
189 |
{
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
}
|
218 |
|
219 |
-
|
220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
<div id="general-cpac-settings" class="postbox">
|
232 |
-
<div title="Click to toggle" class="handlediv"><br></div>
|
233 |
-
<h3 class="hndle">
|
234 |
-
<span><?php _e('Admin Columns', $this->textdomain ); ?></span>
|
235 |
-
</h3>
|
236 |
-
<div class="inside">
|
237 |
-
<form method="post" action="options.php">
|
238 |
-
|
239 |
-
<?php settings_fields( 'cpac-settings-group' ); ?>
|
240 |
-
|
241 |
-
<table class="form-table">
|
242 |
-
|
243 |
-
<?php echo $rows ?>
|
244 |
-
|
245 |
-
<tr class="bottom" valign="top">
|
246 |
-
<th scope="row"></th>
|
247 |
-
<td>
|
248 |
-
<p class="submit">
|
249 |
-
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
250 |
-
</p>
|
251 |
-
</td>
|
252 |
-
</tr>
|
253 |
-
</table>
|
254 |
-
</form>
|
255 |
-
</div>
|
256 |
-
</div><!-- general-settings -->
|
257 |
-
|
258 |
-
<div id="restore-cpac-settings" class="postbox">
|
259 |
-
<div title="Click to toggle" class="handlediv"><br></div>
|
260 |
-
<h3 class="hndle">
|
261 |
-
<span><?php _e('Restore defaults', $this->textdomain) ?></span>
|
262 |
-
</h3>
|
263 |
-
<div class="inside">
|
264 |
-
<form method="post" action="">
|
265 |
-
<input type="submit" class="button" name="cpac-restore-defaults" value="<?php _e('Restore default settings', $this->textdomain ) ?>" onclick="return confirm('<?php _e("Warning! ALL saved admin columns data will be deleted. This cannot be undone. \'OK\' to delete, \'Cancel\' to stop", $this->textdomain); ?>');" />
|
266 |
-
</form>
|
267 |
-
<p class="description"><?php _e('This will delete all column settings and restore the default settings.', $this->textdomain); ?></p>
|
268 |
-
</div>
|
269 |
-
</div><!-- restore-cpac-settings -->
|
270 |
-
|
271 |
-
</div>
|
272 |
-
</div>
|
273 |
-
</div><!-- .postbox-container -->
|
274 |
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
|
|
293 |
|
294 |
-
|
295 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
}
|
297 |
-
|
298 |
/**
|
299 |
* Get a list of Column options per post type
|
300 |
*
|
301 |
* @since 1.0
|
302 |
*/
|
303 |
-
private function
|
304 |
{
|
305 |
// merge all columns
|
306 |
-
$display_columns = $this->get_merged_columns($
|
307 |
|
308 |
// define
|
309 |
$list = '';
|
310 |
|
311 |
// loop throught the active columns
|
312 |
if ( $display_columns ) {
|
313 |
-
foreach ( $display_columns as $
|
314 |
|
315 |
// add items to the list
|
316 |
-
$list .= $this->get_box($
|
317 |
|
318 |
}
|
319 |
}
|
320 |
|
321 |
// custom field button
|
322 |
$button_add_column = '';
|
323 |
-
if ( $this->
|
324 |
-
$button_add_column = "<a href='javacript:;' class='cpac-add-customfield-column button'>+ " . __('Add Custom Field Column') . "</a>";
|
325 |
|
326 |
return "
|
327 |
<div class='cpac-box'>
|
@@ -329,7 +368,7 @@ class Codepress_Admin_Columns
|
|
329 |
{$list}
|
330 |
</ul>
|
331 |
{$button_add_column}
|
332 |
-
<div class='cpac-reorder-msg'
|
333 |
</div>
|
334 |
";
|
335 |
}
|
@@ -339,60 +378,118 @@ class Codepress_Admin_Columns
|
|
339 |
*
|
340 |
* @since 1.0
|
341 |
*/
|
342 |
-
|
343 |
-
{
|
344 |
-
|
345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
|
347 |
-
|
348 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
|
350 |
-
//
|
351 |
-
$
|
352 |
|
353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
$default_columns = wp_parse_args($wp_custom_columns, $wp_default_columns);
|
355 |
|
356 |
-
//
|
|
|
357 |
if ( $db_columns ) {
|
358 |
-
|
|
|
|
|
|
|
|
|
|
|
359 |
|
360 |
// get column meta options from custom columns
|
361 |
-
if (
|
362 |
-
$db_columns[$
|
363 |
|
364 |
// add static options
|
365 |
-
|
366 |
-
$db_columns[$
|
367 |
|
368 |
-
unset($default_columns[$
|
369 |
}
|
370 |
}
|
371 |
|
372 |
// merge all
|
373 |
-
|
374 |
-
|
375 |
-
return $display_columns;
|
376 |
}
|
377 |
-
|
378 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
/**
|
380 |
* Get checkbox
|
381 |
*
|
382 |
* @since 1.0
|
383 |
*/
|
384 |
-
private function get_box($
|
385 |
{
|
386 |
$classes = array();
|
387 |
|
388 |
// set state
|
389 |
$state = isset($values['state']) ? $values['state'] : '';
|
390 |
|
391 |
-
// set sortorder
|
392 |
-
$sortorder = isset($values['sortorder']) && $values['sortorder'] == 'on' ? 'on' : '';
|
393 |
-
|
394 |
// class
|
395 |
-
$classes[] = "cpac-box-{$
|
396 |
if ( $state )
|
397 |
$classes[] = 'active';
|
398 |
if ( ! empty($values['options']['class']) )
|
@@ -400,31 +497,44 @@ class Codepress_Admin_Columns
|
|
400 |
$class = implode(' ', $classes);
|
401 |
|
402 |
// more box options
|
403 |
-
$more_options = $this->get_additional_box_options($
|
404 |
$action = "<a class='cpac-action' href='#open'>open</a>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
|
406 |
// hide box options
|
407 |
-
|
408 |
-
|
|
|
409 |
}
|
410 |
|
411 |
$list = "
|
412 |
<li class='{$class}'>
|
413 |
-
<div class='cpac-sort-handle'></div>
|
414 |
-
<div class='cpac-type-options'>
|
415 |
-
|
416 |
<div class='cpac-checkbox'></div>
|
417 |
-
<input type='hidden' class='cpac-state' name='cpac_options[columns][{$
|
418 |
-
<
|
419 |
-
<label class='main-label'>{$values['label']}</label>
|
420 |
</div>
|
421 |
<div class='cpac-meta-title'>
|
422 |
{$action}
|
423 |
-
<span>{$
|
424 |
</div>
|
425 |
<div class='cpac-type-inside'>
|
426 |
-
<label for='cpac_options
|
427 |
-
<input type='text' name='cpac_options[columns][{$
|
|
|
|
|
|
|
|
|
428 |
<br/>
|
429 |
{$more_options}
|
430 |
</div>
|
@@ -439,13 +549,13 @@ class Codepress_Admin_Columns
|
|
439 |
*
|
440 |
* @since 1.0
|
441 |
*/
|
442 |
-
private function get_additional_box_options($
|
443 |
{
|
444 |
$fields = '';
|
445 |
|
446 |
-
// Custom Fields
|
447 |
-
if (
|
448 |
-
$fields
|
449 |
|
450 |
return $fields;
|
451 |
}
|
@@ -455,10 +565,10 @@ class Codepress_Admin_Columns
|
|
455 |
*
|
456 |
* @since 1.0
|
457 |
*/
|
458 |
-
private function get_box_options_customfields($
|
459 |
{
|
460 |
// get post meta fields
|
461 |
-
$fields = $this->
|
462 |
|
463 |
if ( empty($fields) )
|
464 |
return false;
|
@@ -485,10 +595,15 @@ class Codepress_Admin_Columns
|
|
485 |
'library_id' => __('Media Library Icon', $this->textdomain),
|
486 |
'excerpt' => __('Excerpt'),
|
487 |
'array' => __('Multiple Values', $this->textdomain),
|
|
|
|
|
|
|
488 |
);
|
489 |
|
490 |
-
// add
|
491 |
-
$fieldtypes = apply_filters('cpac-field-types', $fieldtypes );
|
|
|
|
|
492 |
foreach ( $fieldtypes as $fkey => $fieldtype ) {
|
493 |
$fieldtype_options .= sprintf
|
494 |
(
|
@@ -499,12 +614,16 @@ class Codepress_Admin_Columns
|
|
499 |
);
|
500 |
}
|
501 |
|
|
|
|
|
|
|
|
|
502 |
if ( empty($field_options) )
|
503 |
return false;
|
504 |
|
505 |
// add remove button
|
506 |
$remove = '<p class="remove-description description">'.__('This field can not be removed', $this->textdomain).'</p>';
|
507 |
-
if ( $
|
508 |
$remove = "
|
509 |
<p>
|
510 |
<a href='javascript:;' class='cpac-delete-custom-field-box'>".__('Remove')."</a>
|
@@ -513,12 +632,18 @@ class Codepress_Admin_Columns
|
|
513 |
}
|
514 |
|
515 |
$inside = "
|
516 |
-
<label for='
|
517 |
-
<select name='cpac_options[columns][{$
|
518 |
<br/>
|
519 |
-
<label for='
|
520 |
-
<select name='cpac_options[columns][{$
|
521 |
<br/>
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
{$remove}
|
523 |
";
|
524 |
|
@@ -526,17 +651,32 @@ class Codepress_Admin_Columns
|
|
526 |
}
|
527 |
|
528 |
/**
|
529 |
-
* Get post meta fields by post
|
530 |
*
|
531 |
* @since 1.0
|
532 |
*/
|
533 |
-
private function
|
534 |
{
|
535 |
global $wpdb;
|
536 |
-
|
537 |
-
|
538 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
539 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
540 |
// postmeta
|
541 |
if ( $fields ) {
|
542 |
$meta_fields = array();
|
@@ -546,9 +686,8 @@ class Codepress_Admin_Columns
|
|
546 |
$meta_fields[] = $field[0];
|
547 |
}
|
548 |
}
|
549 |
-
|
550 |
return $meta_fields;
|
551 |
-
}
|
552 |
|
553 |
return false;
|
554 |
}
|
@@ -558,19 +697,35 @@ class Codepress_Admin_Columns
|
|
558 |
*
|
559 |
* @since 1.0
|
560 |
*/
|
561 |
-
public function
|
562 |
{
|
563 |
-
wp_enqueue_script( '
|
564 |
-
wp_enqueue_script( '
|
565 |
-
wp_enqueue_script( 'cpac-admin', $this->plugin_url('/assets/js/admin-column.js'), array('jquery', 'jquery-ui-sortable'), CPAC_VERSION );
|
566 |
}
|
567 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
568 |
/**
|
569 |
* Get post types
|
570 |
*
|
571 |
* @since 1.0
|
572 |
*/
|
573 |
-
|
574 |
{
|
575 |
$post_types = get_post_types(array(
|
576 |
'_builtin' => false
|
@@ -578,7 +733,7 @@ class Codepress_Admin_Columns
|
|
578 |
$post_types['post'] = 'post';
|
579 |
$post_types['page'] = 'page';
|
580 |
|
581 |
-
return $post_types;
|
582 |
}
|
583 |
|
584 |
/**
|
@@ -588,6 +743,7 @@ class Codepress_Admin_Columns
|
|
588 |
*/
|
589 |
public function admin_styles()
|
590 |
{
|
|
|
591 |
wp_enqueue_style( 'cpac-admin', $this->plugin_url('/assets/css/admin-column.css'), array(), CPAC_VERSION, 'all' );
|
592 |
}
|
593 |
|
@@ -609,10 +765,10 @@ class Codepress_Admin_Columns
|
|
609 |
public function register_settings()
|
610 |
{
|
611 |
// If we have no options in the database, let's add them now.
|
612 |
-
if ( false ===
|
613 |
-
add_option( 'cpac_options', array(
|
614 |
|
615 |
-
register_setting( 'cpac-settings-group', 'cpac_options', array(
|
616 |
}
|
617 |
|
618 |
/**
|
@@ -630,7 +786,7 @@ class Codepress_Admin_Columns
|
|
630 |
}
|
631 |
|
632 |
/**
|
633 |
-
*
|
634 |
*
|
635 |
* @since 1.0
|
636 |
*/
|
@@ -644,23 +800,49 @@ class Codepress_Admin_Columns
|
|
644 |
*
|
645 |
* @since 1.0
|
646 |
*/
|
647 |
-
|
648 |
{
|
649 |
// settings updated
|
650 |
-
if ( ! empty($_REQUEST['settings-updated']) )
|
651 |
-
|
652 |
-
// stores the default columns that are set by WP or set in the theme.
|
653 |
-
$wp_default_columns = array();
|
654 |
-
foreach ( $this->post_types as $post_type ) {
|
655 |
-
$wp_default_columns[$post_type] = $this->get_wp_default_columns($post_type);
|
656 |
-
}
|
657 |
-
update_option( 'cpac_options_default', $wp_default_columns );
|
658 |
-
}
|
659 |
|
660 |
// restore defaults
|
661 |
-
if ( ! empty($_REQUEST['cpac-restore-defaults']) )
|
662 |
$this->restore_defaults();
|
663 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
664 |
}
|
665 |
|
666 |
/**
|
@@ -679,15 +861,16 @@ class Codepress_Admin_Columns
|
|
679 |
*
|
680 |
* @since 1.0
|
681 |
*/
|
682 |
-
private function get_post_excerpt($post_id
|
683 |
{
|
684 |
-
global $post;
|
|
|
685 |
$save_post = $post;
|
686 |
$post = get_post($post_id);
|
687 |
$excerpt = get_the_excerpt();
|
688 |
$post = $save_post;
|
689 |
|
690 |
-
$output = $this->get_shortened_string($excerpt, $
|
691 |
|
692 |
return $output;
|
693 |
}
|
@@ -697,22 +880,12 @@ class Codepress_Admin_Columns
|
|
697 |
*
|
698 |
* @since 1.0
|
699 |
*/
|
700 |
-
private function get_shortened_string($string = '', $
|
701 |
{
|
702 |
if (!$string)
|
703 |
return false;
|
704 |
|
705 |
-
$
|
706 |
-
if ( strlen($string) > $charlength ) {
|
707 |
-
$subex = substr($string,0,$charlength-5);
|
708 |
-
$exwords = explode(" ",$subex);
|
709 |
-
$excut = -(strlen($exwords[count($exwords)-1]));
|
710 |
-
$output .= $excut < 0 ? substr($subex,0,$excut) : $subex;
|
711 |
-
$output .= "[...]";
|
712 |
-
} else {
|
713 |
-
$output = $string;
|
714 |
-
}
|
715 |
-
return $output;
|
716 |
}
|
717 |
|
718 |
/**
|
@@ -720,20 +893,20 @@ class Codepress_Admin_Columns
|
|
720 |
*
|
721 |
* @since 1.0
|
722 |
*/
|
723 |
-
public function
|
724 |
{
|
725 |
-
$type = $
|
726 |
|
727 |
// Check for taxonomies, such as column-taxonomy-[taxname]
|
728 |
if ( strpos($type, 'column-taxonomy-') !== false )
|
729 |
$type = 'column-taxonomy';
|
730 |
|
731 |
// Check for custom fields, such as column-meta-[customfieldname]
|
732 |
-
if (
|
733 |
-
$type = 'column-meta';
|
734 |
|
735 |
// Hook
|
736 |
-
do_action('cpac-manage-column', $type, $
|
737 |
|
738 |
// Switch Types
|
739 |
$result = '';
|
@@ -751,15 +924,14 @@ class Codepress_Admin_Columns
|
|
751 |
|
752 |
// Featured Image
|
753 |
case "column-featured_image" :
|
754 |
-
|
|
|
755 |
break;
|
756 |
|
757 |
// Sticky Post
|
758 |
case "column-sticky" :
|
759 |
-
if ( is_sticky($post_id) )
|
760 |
-
$
|
761 |
-
$result = "<img alt='sticky' src='{$src}' />";
|
762 |
-
}
|
763 |
break;
|
764 |
|
765 |
// Order
|
@@ -776,45 +948,77 @@ class Codepress_Admin_Columns
|
|
776 |
case "column-page-template" :
|
777 |
// file name
|
778 |
$page_template = get_post_meta($post_id, '_wp_page_template', true);
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
$result = array_search($page_template, $templates);
|
783 |
break;
|
784 |
|
785 |
// Slug
|
786 |
case "column-page-slug" :
|
787 |
-
$result = get_post($post_id)->post_name;
|
|
|
|
|
|
|
|
|
|
|
788 |
break;
|
789 |
|
790 |
// Taxonomy
|
791 |
case "column-taxonomy" :
|
792 |
-
$tax = str_replace('column-taxonomy-',''
|
793 |
$tags = get_the_terms($post_id, $tax);
|
794 |
$tarr = array();
|
|
|
|
|
795 |
if ( $tax == 'post_format' && empty($tags) ) {
|
796 |
$result = __('Standard');
|
797 |
}
|
798 |
-
|
799 |
-
|
800 |
-
|
|
|
|
|
|
|
|
|
|
|
801 |
}
|
802 |
$result = implode(', ', $tarr);
|
803 |
}
|
804 |
break;
|
805 |
|
806 |
// Custom Field
|
807 |
-
case "column-meta" :
|
808 |
-
$result = $this->get_column_value_custom_field($post_id, $
|
809 |
break;
|
810 |
|
811 |
// Attachment
|
812 |
case "column-attachment" :
|
813 |
$result = $this->get_column_value_attachments($post_id);
|
814 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
815 |
|
816 |
default :
|
817 |
-
$result = get_post_meta( $post_id, $
|
818 |
|
819 |
endswitch;
|
820 |
|
@@ -823,188 +1027,672 @@ class Codepress_Admin_Columns
|
|
823 |
|
824 |
echo $result;
|
825 |
}
|
826 |
-
|
827 |
/**
|
828 |
-
*
|
829 |
*
|
830 |
-
*
|
831 |
*/
|
832 |
-
|
833 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
834 |
$result = '';
|
835 |
-
$
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
846 |
return $result;
|
847 |
}
|
848 |
|
849 |
/**
|
850 |
-
*
|
851 |
*
|
852 |
-
*
|
853 |
*/
|
854 |
-
|
855 |
{
|
856 |
-
$
|
857 |
-
$field = isset($columns[$key]['field']) ? $columns[$key]['field'] : '';
|
858 |
-
$fieldtype = isset($columns[$key]['field_type']) ? $columns[$key]['field_type'] : '';
|
859 |
-
|
860 |
-
// Get meta field value
|
861 |
-
$meta = get_post_meta($post_id, $field, true);
|
862 |
|
863 |
-
|
864 |
-
|
865 |
-
$meta = get_post_meta($post_id, $field);
|
866 |
-
$meta = $this->recursive_implode(', ', $meta);
|
867 |
-
}
|
868 |
|
869 |
-
//
|
870 |
-
|
871 |
-
return false;
|
872 |
-
|
873 |
-
// handles each field type differently..
|
874 |
-
switch ($fieldtype) :
|
875 |
|
876 |
-
|
877 |
-
|
878 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
879 |
break;
|
880 |
|
881 |
-
//
|
882 |
-
case "
|
883 |
-
|
884 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
885 |
break;
|
886 |
|
887 |
-
//
|
888 |
-
case "
|
889 |
-
$
|
|
|
|
|
890 |
break;
|
891 |
-
|
892 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
893 |
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
* Implode for multi dimensional array
|
899 |
-
*
|
900 |
-
* @since 1.0
|
901 |
-
*/
|
902 |
-
private function recursive_implode( $glue, $pieces )
|
903 |
-
{
|
904 |
-
foreach( $pieces as $r_pieces ) {
|
905 |
-
if( is_array( $r_pieces ) ) {
|
906 |
-
$retVal[] = $this->recursive_implode( $glue, $r_pieces );
|
907 |
-
}
|
908 |
-
else {
|
909 |
-
$retVal[] = $r_pieces;
|
910 |
-
}
|
911 |
-
}
|
912 |
-
return implode( $glue, $retVal );
|
913 |
}
|
914 |
-
|
915 |
/**
|
916 |
-
*
|
917 |
*
|
918 |
-
*
|
919 |
*/
|
920 |
-
|
921 |
{
|
922 |
-
$
|
923 |
|
924 |
-
|
925 |
-
|
926 |
|
927 |
-
//
|
928 |
-
$
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
|
933 |
-
//
|
934 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
935 |
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
941 |
}
|
942 |
-
|
943 |
/**
|
944 |
-
*
|
945 |
*
|
946 |
-
* @since 1.
|
947 |
*/
|
948 |
-
|
949 |
{
|
950 |
-
$
|
951 |
|
952 |
-
|
953 |
-
|
954 |
|
955 |
-
//
|
956 |
-
|
|
|
957 |
|
958 |
-
//
|
959 |
-
$
|
960 |
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
968 |
|
969 |
-
|
|
|
|
|
|
|
970 |
}
|
971 |
|
972 |
/**
|
973 |
-
*
|
974 |
*
|
975 |
* @since 1.0
|
976 |
*/
|
977 |
-
private function
|
978 |
{
|
979 |
-
$
|
980 |
-
|
981 |
-
if (
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
foreach ( $db_columns as $key => $values ) {
|
986 |
-
|
987 |
-
// is active
|
988 |
-
if ( isset($values['sortorder']) && $values['sortorder'] == 'on' ){
|
989 |
-
|
990 |
-
// register format
|
991 |
-
$columns[$key] = $this->sanitize_string($values['label']);
|
992 |
}
|
993 |
-
}
|
994 |
-
return $
|
995 |
-
}
|
996 |
-
|
997 |
/**
|
998 |
-
*
|
999 |
*
|
1000 |
-
* @since 1.
|
1001 |
*/
|
1002 |
-
|
1003 |
{
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1008 |
|
1009 |
// we need to change the current screen
|
1010 |
global $current_screen;
|
@@ -1016,12 +1704,195 @@ class Codepress_Admin_Columns
|
|
1016 |
// ...so we can get its columns
|
1017 |
$columns = WP_Posts_List_Table::get_columns();
|
1018 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1019 |
// we remove the checkbox column as an option...
|
1020 |
-
|
|
|
1021 |
|
1022 |
// change to uniform format
|
1023 |
$uniform_columns = array();
|
1024 |
-
foreach ( $columns as $
|
1025 |
$hide_options = false;
|
1026 |
$type_label = $label;
|
1027 |
|
@@ -1030,165 +1901,403 @@ class Codepress_Admin_Columns
|
|
1030 |
$type_label = __('Comments', $this->textdomain);
|
1031 |
$hide_options = true;
|
1032 |
}
|
1033 |
-
|
1034 |
-
|
|
|
|
|
|
|
|
|
|
|
1035 |
'label' => $label,
|
1036 |
-
'state' => 'on',
|
1037 |
'options' => array(
|
1038 |
'type_label' => $type_label,
|
1039 |
'hide_options' => $hide_options,
|
1040 |
'class' => 'cpac-box-wp-native',
|
1041 |
)
|
1042 |
);
|
1043 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1044 |
|
1045 |
-
//
|
1046 |
-
$
|
1047 |
|
1048 |
-
return $
|
1049 |
}
|
1050 |
-
|
1051 |
/**
|
1052 |
-
*
|
1053 |
*
|
1054 |
-
* @since 1.
|
1055 |
*/
|
1056 |
-
private function
|
1057 |
{
|
1058 |
-
$custom_columns = array();
|
1059 |
-
|
1060 |
// default arguments
|
1061 |
-
$defaults = array(
|
|
|
|
|
1062 |
'label' => '',
|
1063 |
-
'sortorder' => '',
|
1064 |
'state' => '',
|
|
|
1065 |
|
1066 |
-
//
|
1067 |
-
'options' => array(
|
1068 |
-
'type_label'
|
1069 |
'hide_options' => false,
|
1070 |
'class' => 'cpac-box-custom',
|
1071 |
-
)
|
1072 |
-
);
|
1073 |
-
|
1074 |
-
// Thumbnail support
|
1075 |
-
if ( post_type_supports($post_type, 'thumbnail') ) {
|
1076 |
-
$custom_columns['column-featured_image'] = wp_parse_args( array(
|
1077 |
-
'label' => __('Featured Image', $this->textdomain),
|
1078 |
-
'options' => array(
|
1079 |
-
'type_label' => __('Image', $this->textdomain)
|
1080 |
-
)
|
1081 |
-
), $defaults);
|
1082 |
-
}
|
1083 |
-
|
1084 |
-
// Excerpt support
|
1085 |
-
if ( post_type_supports($post_type, 'editor') ) {
|
1086 |
-
$custom_columns['column-excerpt'] = wp_parse_args( array(
|
1087 |
-
'label' => __('Excerpt', $this->textdomain),
|
1088 |
-
'options' => array(
|
1089 |
-
'type_label' => __('Excerpt', $this->textdomain)
|
1090 |
-
)
|
1091 |
-
), $defaults);
|
1092 |
-
}
|
1093 |
-
|
1094 |
-
// Sticky support
|
1095 |
-
if ( $post_type == 'post' ) {
|
1096 |
-
$custom_columns['column-sticky'] = wp_parse_args( array(
|
1097 |
-
'label' => __('Sticky', $this->textdomain),
|
1098 |
-
'options' => array(
|
1099 |
-
'type_label' => __('Sticky', $this->textdomain)
|
1100 |
-
)
|
1101 |
-
), $defaults);
|
1102 |
-
}
|
1103 |
-
|
1104 |
-
// Order support
|
1105 |
-
if ( post_type_supports($post_type, 'page-attributes') ) {
|
1106 |
-
$custom_columns['column-order'] = wp_parse_args( array(
|
1107 |
-
'label' => __('Page Order', $this->textdomain),
|
1108 |
'sortorder' => 'on',
|
1109 |
-
'options' => array(
|
1110 |
-
'type_label' => __('Order', $this->textdomain)
|
1111 |
-
)
|
1112 |
-
), $defaults);
|
1113 |
-
}
|
1114 |
-
|
1115 |
-
// Page Template
|
1116 |
-
if ( $post_type == 'page' ) {
|
1117 |
-
$custom_columns['column-page-template'] = wp_parse_args( array(
|
1118 |
-
'label' => __('Page Template', $this->textdomain),
|
1119 |
-
'sortorder' => 'on',
|
1120 |
-
'options' => array(
|
1121 |
-
'type_label' => __('Page Template', $this->textdomain)
|
1122 |
-
)
|
1123 |
-
), $defaults);
|
1124 |
-
}
|
1125 |
-
|
1126 |
-
// Post Formats
|
1127 |
-
if ( post_type_supports($post_type, 'post-formats') ) {
|
1128 |
-
$custom_columns['column-post_formats'] = wp_parse_args( array(
|
1129 |
-
'label' => __('Post Format', $this->textdomain),
|
1130 |
-
'options' => array(
|
1131 |
-
'type_label' => __('Post Format', $this->textdomain)
|
1132 |
-
)
|
1133 |
-
), $defaults);
|
1134 |
-
}
|
1135 |
-
|
1136 |
-
// Taxonomy support
|
1137 |
-
$taxonomies = get_object_taxonomies($post_type, 'objects');
|
1138 |
-
if ( $taxonomies ) {
|
1139 |
-
foreach ( $taxonomies as $tax_slug => $tax ) {
|
1140 |
-
if ( $tax_slug != 'post_tag' && $tax_slug != 'category' && $tax_slug != 'post_format' ) {
|
1141 |
-
$custom_columns['column-taxonomy-'.$tax->name] = wp_parse_args( array(
|
1142 |
-
'label' => $tax->label,
|
1143 |
-
'options' => array(
|
1144 |
-
'type_label' => __('Taxonomy', $this->textdomain)
|
1145 |
-
)
|
1146 |
-
), $defaults);
|
1147 |
-
}
|
1148 |
-
}
|
1149 |
-
}
|
1150 |
-
|
1151 |
-
// Post ID support
|
1152 |
-
$custom_columns['column-postid'] = wp_parse_args( array(
|
1153 |
-
'label' => 'ID',
|
1154 |
-
'sortorder' => 'on',
|
1155 |
-
'options' => array(
|
1156 |
-
'type_label' => 'ID',
|
1157 |
-
)
|
1158 |
-
), $defaults);
|
1159 |
-
|
1160 |
-
// Slug support
|
1161 |
-
$custom_columns['column-page-slug'] = wp_parse_args( array(
|
1162 |
-
'label' => __('Slug', $this->textdomain),
|
1163 |
-
'sortorder' => 'on',
|
1164 |
-
'options' => array(
|
1165 |
-
'type_label' => __('Slug', $this->textdomain),
|
1166 |
-
)
|
1167 |
-
), $defaults);
|
1168 |
-
|
1169 |
-
// Attachment support
|
1170 |
-
$custom_columns['column-attachment'] = wp_parse_args( array(
|
1171 |
-
'label' => __('Attachment', $this->textdomain),
|
1172 |
-
'sortorder' => 'on',
|
1173 |
-
'options' => array(
|
1174 |
-
'type_label' => __('Attachment', $this->textdomain)
|
1175 |
)
|
1176 |
-
)
|
1177 |
|
1178 |
-
//
|
1179 |
-
|
1180 |
-
$
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
'options'
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
}
|
1190 |
|
1191 |
-
return
|
1192 |
}
|
1193 |
|
1194 |
/**
|
@@ -1196,14 +2305,14 @@ class Codepress_Admin_Columns
|
|
1196 |
*
|
1197 |
* @since 1.0
|
1198 |
*/
|
1199 |
-
|
1200 |
{
|
1201 |
// get plugin options
|
1202 |
-
$options =
|
1203 |
|
1204 |
// get saved columns
|
1205 |
-
if ( isset($options['columns'][$
|
1206 |
-
return $options['columns'][$
|
1207 |
|
1208 |
return false;
|
1209 |
}
|
@@ -1213,28 +2322,26 @@ class Codepress_Admin_Columns
|
|
1213 |
*
|
1214 |
* @since 1.0
|
1215 |
*/
|
1216 |
-
private function
|
1217 |
{
|
1218 |
// set
|
1219 |
$menu = '';
|
1220 |
$count = 1;
|
1221 |
|
1222 |
// referer
|
1223 |
-
$referer = '';
|
1224 |
-
if ( isset($_REQUEST['cpac_type']) && $_REQUEST['cpac_type'] )
|
1225 |
-
$referer = $_REQUEST['cpac_type'];
|
1226 |
|
1227 |
// loop
|
1228 |
-
foreach ( $this->
|
1229 |
-
$label = $this->get_singular_name($
|
1230 |
-
$clean_label = $this->sanitize_string($
|
1231 |
|
1232 |
// divider
|
1233 |
$divider = $count++ == 1 ? '' : ' | ';
|
1234 |
|
1235 |
// current
|
1236 |
$current = '';
|
1237 |
-
if ( $this->is_menu_type_current($
|
1238 |
$current = ' class="current"';
|
1239 |
|
1240 |
// menu list
|
@@ -1242,129 +2349,881 @@ class Codepress_Admin_Columns
|
|
1242 |
<li>{$divider}<a{$current} href='#cpac-box-{$clean_label}'>{$label}</a></li>
|
1243 |
";
|
1244 |
}
|
1245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1246 |
return "
|
1247 |
<div class='cpac-menu'>
|
1248 |
<ul class='subsubsub'>
|
1249 |
{$menu}
|
1250 |
</ul>
|
|
|
1251 |
</div>
|
1252 |
";
|
1253 |
}
|
1254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1255 |
/**
|
1256 |
-
*
|
1257 |
*
|
1258 |
-
* @since 1.
|
1259 |
*/
|
1260 |
-
private function
|
1261 |
{
|
1262 |
-
|
|
|
1263 |
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1268 |
|
1269 |
-
//
|
1270 |
-
$
|
1271 |
-
$clean_label = $this->sanitize_string($post_type);
|
1272 |
|
1273 |
-
|
1274 |
-
|
1275 |
|
1276 |
-
//
|
1277 |
-
|
1278 |
-
if ( $referer == 'cpac-box-'.$clean_label ) {
|
1279 |
-
return true;
|
1280 |
-
}
|
1281 |
|
1282 |
-
|
1283 |
-
} elseif ( $first == $post_type ) {
|
1284 |
return true;
|
1285 |
-
}
|
1286 |
|
1287 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1288 |
}
|
1289 |
-
|
1290 |
/**
|
1291 |
-
*
|
1292 |
*
|
1293 |
-
* @since 1.
|
1294 |
*/
|
1295 |
-
private function
|
1296 |
{
|
1297 |
-
|
1298 |
-
$label = $posttype_obj->labels->singular_name;
|
1299 |
-
return $label;
|
1300 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1301 |
|
|
|
|
|
|
|
1302 |
/**
|
1303 |
-
*
|
1304 |
*
|
1305 |
-
* @since 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1306 |
*/
|
1307 |
-
|
1308 |
{
|
1309 |
-
if (
|
1310 |
-
|
1311 |
-
$db_columns = $this->get_db_columns($vars['post_type']);
|
1312 |
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
// Check for Page Order
|
1320 |
-
if ( $vars['orderby'] == $label ) {
|
1321 |
-
$vars['orderby'] = 'menu_order';
|
1322 |
-
}
|
1323 |
-
}
|
1324 |
-
}
|
1325 |
-
return $vars;
|
1326 |
-
}
|
1327 |
-
|
1328 |
/**
|
1329 |
-
*
|
1330 |
*
|
1331 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1332 |
*
|
1333 |
-
* @since 1.
|
1334 |
*/
|
1335 |
-
private function
|
1336 |
{
|
1337 |
-
$
|
1338 |
-
|
|
|
|
|
1339 |
}
|
1340 |
|
1341 |
/**
|
1342 |
-
*
|
1343 |
*
|
1344 |
-
* @since 1.
|
1345 |
*/
|
1346 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1347 |
{
|
1348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1349 |
}
|
1350 |
|
1351 |
/**
|
1352 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1353 |
*
|
1354 |
* @since 1.0
|
1355 |
*/
|
1356 |
-
|
1357 |
-
{
|
1358 |
-
|
1359 |
-
|
|
|
|
|
1360 |
|
1361 |
-
|
1362 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1363 |
|
1364 |
-
|
1365 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1366 |
|
1367 |
-
|
1368 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1369 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1370 |
?>
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Codepress Admin Columns
|
4 |
+
Version: 1.4
|
5 |
+
Description: This plugin makes it easy to customise the columns on the administration screens for post(types), pages, media library and users.
|
6 |
+
Author: Codepress
|
7 |
Author URI: http://www.codepress.nl
|
8 |
Plugin URI: http://www.codepress.nl/plugins/codepress-admin-columns/
|
9 |
Text Domain: codepress-admin-columns
|
26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
29 |
+
define( 'CPAC_VERSION', '1.4' );
|
30 |
+
|
31 |
+
// only run plugin in the admin interface
|
32 |
+
if ( !is_admin() )
|
33 |
+
return false;
|
34 |
|
35 |
/**
|
36 |
+
* Dependencies
|
37 |
*
|
38 |
+
* @since 1.3
|
39 |
*/
|
40 |
+
require_once dirname( __FILE__ ) . '/classes/sortable.php';
|
41 |
|
42 |
/**
|
43 |
+
* Codepress Admin Columns Class
|
44 |
*
|
45 |
* @since 1.0
|
46 |
*
|
48 |
class Codepress_Admin_Columns
|
49 |
{
|
50 |
private $post_types,
|
|
|
|
|
51 |
$slug,
|
52 |
+
$textdomain,
|
53 |
+
$codepress_url,
|
54 |
+
$wordpress_url,
|
55 |
+
$excerpt_length,
|
56 |
+
$admin_page,
|
57 |
+
$notice_message,
|
58 |
+
$notice_type,
|
59 |
+
$api_url;
|
60 |
|
61 |
/**
|
62 |
+
* Constructor
|
63 |
*
|
64 |
* @since 1.0
|
65 |
*/
|
66 |
function __construct()
|
67 |
+
{
|
68 |
+
$this->api_url = 'http://www.codepress.nl/';
|
69 |
+
|
70 |
+
// wp is loaded
|
71 |
+
add_action( 'wp_loaded', array( $this, 'init') );
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
+
* Initialize plugin.
|
76 |
*
|
77 |
* Loading sequence is determined and intialized.
|
78 |
*
|
79 |
* @since 1.0
|
80 |
*/
|
81 |
+
public function init()
|
82 |
{
|
83 |
// vars
|
84 |
$this->post_types = $this->get_post_types();
|
85 |
+
|
86 |
+
// set
|
|
|
|
|
|
|
87 |
$this->slug = 'codepress-admin-columns';
|
88 |
$this->textdomain = 'codepress-admin-columns';
|
89 |
+
$this->codepress_url = 'http://www.codepress.nl/plugins/codepress-admin-columns';
|
90 |
+
$this->wordpress_url = 'http://wordpress.org/tags/codepress-admin-columns';
|
91 |
+
|
92 |
+
// number of words
|
93 |
+
$this->excerpt_length = 20;
|
94 |
|
95 |
// translations
|
96 |
load_plugin_textdomain( $this->textdomain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
97 |
|
98 |
+
// register settings
|
99 |
+
add_action( 'admin_menu', array( $this, 'settings_menu') );
|
100 |
+
add_action( 'admin_init', array( $this, 'register_settings') );
|
101 |
+
|
102 |
+
// styling & scripts
|
103 |
+
add_action( 'admin_enqueue_scripts' , array( $this, 'column_styles') );
|
104 |
+
add_filter( 'admin_body_class', array( $this, 'admin_class' ) );
|
105 |
+
add_action( 'admin_head', array( $this, 'admin_css') );
|
106 |
+
|
107 |
+
// register column headers
|
108 |
+
add_action( 'admin_init', array( $this, 'register_columns' ) );
|
109 |
+
|
110 |
+
// actions columns
|
111 |
+
add_action( 'manage_pages_custom_column', array( $this, 'manage_posts_column_value'), 10, 2 );
|
112 |
+
add_action( 'manage_posts_custom_column', array( $this, 'manage_posts_column_value'), 10, 2 );
|
113 |
+
add_filter( 'manage_users_custom_column', array( $this, 'manage_users_column_value'), 10, 3 );
|
114 |
+
add_action( 'manage_media_custom_column', array( $this, 'manage_media_column_value'), 10, 2 );
|
115 |
+
add_action( 'manage_link_custom_column', array( $this, 'manage_link_column_value'), 10, 2 );
|
116 |
+
add_action( 'manage_comments_custom_column', array( $this, 'manage_comments_column_value'), 10, 2 );
|
117 |
+
|
118 |
+
// action ajax
|
119 |
+
add_action( 'wp_ajax_cpac_addon_activation', array( $this, 'ajax_activation'));
|
120 |
+
|
121 |
+
// handle requests gets a low priority so it will trigger when all other plugins have loaded their columns
|
122 |
+
add_action( 'admin_init', array( $this, 'handle_requests' ), 1000 );
|
123 |
+
|
124 |
+
// filters
|
125 |
+
add_filter( 'plugin_action_links', array( $this, 'add_settings_link'), 1, 2);
|
126 |
+
}
|
127 |
|
128 |
/**
|
129 |
* Admin Menu.
|
144 |
// Menu slug
|
145 |
$this->slug,
|
146 |
// Callback
|
147 |
+
array( $this, 'plugin_settings_page')
|
148 |
);
|
149 |
|
150 |
+
// set admin page
|
151 |
+
$this->admin_page = $page;
|
152 |
+
|
153 |
+
// settings page specific styles and scripts
|
154 |
+
add_action( "admin_print_styles-$page", array( $this, 'admin_styles') );
|
155 |
+
add_action( "admin_print_scripts-$page", array( $this, 'admin_scripts') );
|
156 |
+
|
157 |
+
// add help tabs
|
158 |
+
add_action("load-$page", array( $this, 'help_tabs'));
|
159 |
+
}
|
160 |
|
161 |
/**
|
162 |
* Add Settings link to plugin page
|
173 |
}
|
174 |
|
175 |
/**
|
176 |
+
* Register Columns
|
177 |
+
*
|
178 |
+
* apply_filters location in includes/screen.php
|
179 |
*
|
180 |
* @since 1.0
|
181 |
*/
|
182 |
public function register_columns()
|
183 |
{
|
184 |
+
/** Posts */
|
185 |
+
foreach ( $this->post_types as $post_type ) {
|
186 |
+
|
187 |
// register column per post type
|
188 |
+
add_filter("manage_edit-{$post_type}_columns", array($this, 'callback_add_posts_column_headings'));
|
189 |
+
}
|
190 |
+
|
191 |
+
/** Users */
|
192 |
+
add_filter( "manage_users_columns", array($this, 'callback_add_users_column_headings'), 9);
|
193 |
+
// give higher priority, so it will load just before other plugins to prevent conflicts
|
194 |
+
|
195 |
+
/** Media */
|
196 |
+
add_filter( "manage_upload_columns", array($this, 'callback_add_media_column_headings'));
|
197 |
+
|
198 |
+
/** Links */
|
199 |
+
add_filter( "manage_link-manager_columns", array($this, 'callback_add_links_column_headings'));
|
200 |
+
|
201 |
+
/** Comments */
|
202 |
+
add_filter( "manage_edit-comments_columns", array($this, 'callback_add_comments_column_headings'));
|
203 |
}
|
204 |
|
205 |
/**
|
206 |
+
* Callback add Posts Column
|
207 |
*
|
208 |
* @since 1.0
|
209 |
*/
|
210 |
+
public function callback_add_posts_column_headings($columns)
|
211 |
+
{
|
212 |
+
global $post;
|
213 |
+
|
214 |
+
return $this->add_columns_headings($post->post_type, $columns);
|
|
|
215 |
}
|
216 |
|
217 |
/**
|
218 |
+
* Callback add Users column
|
219 |
*
|
220 |
+
* @since 1.1
|
221 |
*/
|
222 |
+
public function callback_add_users_column_headings($columns)
|
223 |
+
{
|
224 |
+
return $this->add_columns_headings('wp-users', $columns);
|
|
|
|
|
|
|
225 |
}
|
226 |
|
227 |
/**
|
228 |
+
* Callback add Media column
|
229 |
*
|
230 |
+
* @since 1.3
|
231 |
+
*/
|
232 |
+
public function callback_add_media_column_headings($columns)
|
233 |
+
{
|
234 |
+
return $this->add_columns_headings('wp-media', $columns);
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Callback add Links column
|
239 |
*
|
240 |
+
* @since 1.3.1
|
241 |
*/
|
242 |
+
public function callback_add_links_column_headings($columns)
|
243 |
{
|
244 |
+
return $this->add_columns_headings('wp-links', $columns);
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Callback add Comments column
|
249 |
+
*
|
250 |
+
* @since 1.3.1
|
251 |
+
*/
|
252 |
+
public function callback_add_comments_column_headings($columns)
|
253 |
+
{
|
254 |
+
return $this->add_columns_headings('wp-comments', $columns);
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Add managed columns by Type
|
259 |
+
*
|
260 |
+
* @since 1.1
|
261 |
+
*/
|
262 |
+
private function add_columns_headings( $type, $columns )
|
263 |
+
{
|
264 |
+
// only get stored columns.. the rest we don't need
|
265 |
+
$db_columns = $this->get_stored_columns($type);
|
266 |
+
|
267 |
+
if ( !$db_columns )
|
268 |
+
return $columns;
|
269 |
+
|
270 |
+
// filter already loaded columns by plugins
|
271 |
+
$set_columns = $this->filter_preset_columns( $type, $columns );
|
272 |
+
|
273 |
+
// loop through columns
|
274 |
+
foreach ( $db_columns as $id => $values ) {
|
275 |
+
// is active
|
276 |
+
if ( isset($values['state']) && $values['state'] == 'on' ){
|
277 |
+
|
278 |
+
// register format
|
279 |
+
$set_columns[$id] = $values['label'];
|
280 |
+
}
|
281 |
}
|
282 |
|
283 |
+
return $set_columns;
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Set columns. These columns apply either for every post or set by a plugin.
|
288 |
+
*
|
289 |
+
* @since 1.0
|
290 |
+
*/
|
291 |
+
private function filter_preset_columns( $type, $columns )
|
292 |
+
{
|
293 |
+
$options = get_option('cpac_options_default');
|
294 |
|
295 |
+
if ( !$options )
|
296 |
+
return $columns;
|
297 |
+
|
298 |
+
// we use the wp default columns for filtering...
|
299 |
+
$stored_wp_default_columns = $options[$type];
|
300 |
+
|
301 |
+
// ... the ones that are set by plugins, theme functions and such.
|
302 |
+
$dif_columns = array_diff(array_keys($columns), array_keys($stored_wp_default_columns));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
|
304 |
+
// we add those to the columns
|
305 |
+
$pre_columns = array();
|
306 |
+
if ( $dif_columns ) {
|
307 |
+
foreach ( $dif_columns as $column ) {
|
308 |
+
$pre_columns[$column] = $columns[$column];
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
return $pre_columns;
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Add managed sortable columns by Type
|
317 |
+
*
|
318 |
+
* @since 1.1
|
319 |
+
*/
|
320 |
+
private function add_managed_sortable_columns( $type, $columns )
|
321 |
+
{
|
322 |
+
$display_columns = $this->get_merged_columns($type);
|
323 |
|
324 |
+
if ( ! $display_columns )
|
325 |
+
return $columns;
|
326 |
+
|
327 |
+
foreach ( $display_columns as $id => $vars ) {
|
328 |
+
if ( isset($vars['options']['sortorder']) && $vars['options']['sortorder'] == 'on' ){
|
329 |
+
|
330 |
+
// register format
|
331 |
+
$columns[$id] = $this->sanitize_string($vars['label']);
|
332 |
+
}
|
333 |
+
}
|
334 |
+
return $columns;
|
335 |
}
|
336 |
+
|
337 |
/**
|
338 |
* Get a list of Column options per post type
|
339 |
*
|
340 |
* @since 1.0
|
341 |
*/
|
342 |
+
private function get_column_boxes($type)
|
343 |
{
|
344 |
// merge all columns
|
345 |
+
$display_columns = $this->get_merged_columns($type);
|
346 |
|
347 |
// define
|
348 |
$list = '';
|
349 |
|
350 |
// loop throught the active columns
|
351 |
if ( $display_columns ) {
|
352 |
+
foreach ( $display_columns as $id => $values ) {
|
353 |
|
354 |
// add items to the list
|
355 |
+
$list .= $this->get_box($type, $id, $values);
|
356 |
|
357 |
}
|
358 |
}
|
359 |
|
360 |
// custom field button
|
361 |
$button_add_column = '';
|
362 |
+
if ( $this->get_meta_by_type($type) )
|
363 |
+
$button_add_column = "<a href='javacript:;' class='cpac-add-customfield-column button'>+ " . __('Add Custom Field Column', $this->textdomain) . "</a>";
|
364 |
|
365 |
return "
|
366 |
<div class='cpac-box'>
|
368 |
{$list}
|
369 |
</ul>
|
370 |
{$button_add_column}
|
371 |
+
<div class='cpac-reorder-msg'>" . __('drag and drop to reorder', $this->textdomain) . "</div>
|
372 |
</div>
|
373 |
";
|
374 |
}
|
378 |
*
|
379 |
* @since 1.0
|
380 |
*/
|
381 |
+
protected function get_merged_columns( $type )
|
382 |
+
{
|
383 |
+
/** Comments */
|
384 |
+
if ( $type == 'wp-comments' ) {
|
385 |
+
$wp_default_columns = $this->get_wp_default_comments_columns();
|
386 |
+
$wp_custom_columns = $this->get_custom_comments_columns();
|
387 |
+
}
|
388 |
+
|
389 |
+
/** Links */
|
390 |
+
elseif ( $type == 'wp-links' ) {
|
391 |
+
$wp_default_columns = $this->get_wp_default_links_columns();
|
392 |
+
$wp_custom_columns = $this->get_custom_links_columns();
|
393 |
+
}
|
394 |
+
|
395 |
+
/** Users */
|
396 |
+
elseif ( $type == 'wp-users' ) {
|
397 |
+
$wp_default_columns = $this->get_wp_default_users_columns();
|
398 |
+
$wp_custom_columns = $this->get_custom_users_columns();
|
399 |
+
}
|
400 |
|
401 |
+
/** Media */
|
402 |
+
elseif ( $type == 'wp-media' ) {
|
403 |
+
$wp_default_columns = $this->get_wp_default_media_columns();
|
404 |
+
$wp_custom_columns = $this->get_custom_media_columns();
|
405 |
+
}
|
406 |
+
|
407 |
+
/** Posts */
|
408 |
+
else {
|
409 |
+
$wp_default_columns = $this->get_wp_default_posts_columns($type);
|
410 |
+
$wp_custom_columns = $this->get_custom_posts_columns($type);
|
411 |
+
}
|
412 |
|
413 |
+
// merge columns
|
414 |
+
$display_columns = $this->parse_columns($wp_custom_columns, $wp_default_columns, $type);
|
415 |
|
416 |
+
return $display_columns;
|
417 |
+
}
|
418 |
+
|
419 |
+
/**
|
420 |
+
* Merge the default columns (set by WordPress) and the added custom columns (set by plugins, theme etc.)
|
421 |
+
*
|
422 |
+
* @since 1.3.3
|
423 |
+
*/
|
424 |
+
function parse_columns($wp_custom_columns, $wp_default_columns, $type) {
|
425 |
+
// merge columns
|
426 |
$default_columns = wp_parse_args($wp_custom_columns, $wp_default_columns);
|
427 |
|
428 |
+
//get saved database columns
|
429 |
+
$db_columns = $this->get_stored_columns($type);
|
430 |
if ( $db_columns ) {
|
431 |
+
|
432 |
+
// let's remove any unavailable columns.. such as disabled plugins
|
433 |
+
$db_columns = $this->remove_unavailable_columns($db_columns, $default_columns);
|
434 |
+
|
435 |
+
// loop throught the active columns
|
436 |
+
foreach ( $db_columns as $id => $values ) {
|
437 |
|
438 |
// get column meta options from custom columns
|
439 |
+
if ( $this->is_column_meta($id) )
|
440 |
+
$db_columns[$id]['options'] = $wp_custom_columns['column-meta-1']['options'];
|
441 |
|
442 |
// add static options
|
443 |
+
elseif ( isset($default_columns[$id]['options']) )
|
444 |
+
$db_columns[$id]['options'] = $default_columns[$id]['options'];
|
445 |
|
446 |
+
unset($default_columns[$id]);
|
447 |
}
|
448 |
}
|
449 |
|
450 |
// merge all
|
451 |
+
return wp_parse_args($db_columns, $default_columns);
|
|
|
|
|
452 |
}
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Remove deactivated (plugin) columns
|
456 |
+
*
|
457 |
+
* This will remove any columns that have been stored, but are no longer available. This happends
|
458 |
+
* when plugins are deactivated or when they are removed from the theme functions.
|
459 |
+
*
|
460 |
+
* @since 1.2
|
461 |
+
*/
|
462 |
+
private function remove_unavailable_columns( array $db_columns, array $default_columns)
|
463 |
+
{
|
464 |
+
// check or differences
|
465 |
+
$diff = array_diff( array_keys($db_columns), array_keys($default_columns) );
|
466 |
+
|
467 |
+
if ( ! empty($diff) && is_array($diff) ) {
|
468 |
+
foreach ( $diff as $column_name ){
|
469 |
+
// make an exception for column-meta-xxx
|
470 |
+
if ( ! $this->is_column_meta($column_name) ) {
|
471 |
+
unset($db_columns[$column_name]);
|
472 |
+
}
|
473 |
+
}
|
474 |
+
}
|
475 |
+
|
476 |
+
return $db_columns;
|
477 |
+
}
|
478 |
+
|
479 |
/**
|
480 |
* Get checkbox
|
481 |
*
|
482 |
* @since 1.0
|
483 |
*/
|
484 |
+
private function get_box($type, $id, $values)
|
485 |
{
|
486 |
$classes = array();
|
487 |
|
488 |
// set state
|
489 |
$state = isset($values['state']) ? $values['state'] : '';
|
490 |
|
|
|
|
|
|
|
491 |
// class
|
492 |
+
$classes[] = "cpac-box-{$id}";
|
493 |
if ( $state )
|
494 |
$classes[] = 'active';
|
495 |
if ( ! empty($values['options']['class']) )
|
497 |
$class = implode(' ', $classes);
|
498 |
|
499 |
// more box options
|
500 |
+
$more_options = $this->get_additional_box_options($type, $id, $values);
|
501 |
$action = "<a class='cpac-action' href='#open'>open</a>";
|
502 |
+
|
503 |
+
// type label
|
504 |
+
$type_label = isset($values['options']['type_label']) ? $values['options']['type_label'] : '';
|
505 |
+
|
506 |
+
// label
|
507 |
+
$label = isset($values['label']) ? str_replace("'", '"', $values['label']) : '';
|
508 |
+
|
509 |
+
// width
|
510 |
+
$width = isset($values['width']) ? $values['width'] : 0;
|
511 |
+
$width_descr = isset($values['width']) && $values['width'] > 0 ? $values['width'] . '%' : __('default', $this->textdomain);
|
512 |
|
513 |
// hide box options
|
514 |
+
$label_hidden = '';
|
515 |
+
if ( ! empty($values['options']['hide_options']) || strpos($label, '<img') !== false ) {
|
516 |
+
$label_hidden = ' style="display:none"';
|
517 |
}
|
518 |
|
519 |
$list = "
|
520 |
<li class='{$class}'>
|
521 |
+
<div class='cpac-sort-handle'></div>
|
522 |
+
<div class='cpac-type-options'>
|
|
|
523 |
<div class='cpac-checkbox'></div>
|
524 |
+
<input type='hidden' class='cpac-state' name='cpac_options[columns][{$type}][{$id}][state]' value='{$state}'/>
|
525 |
+
<label class='main-label'>{$values['label']}</label>
|
|
|
526 |
</div>
|
527 |
<div class='cpac-meta-title'>
|
528 |
{$action}
|
529 |
+
<span>{$type_label}</span>
|
530 |
</div>
|
531 |
<div class='cpac-type-inside'>
|
532 |
+
<label for='cpac_options-{$type}-{$id}-label'{$label_hidden}>Label: </label>
|
533 |
+
<input type='text' name='cpac_options[columns][{$type}][{$id}][label]' id='cpac_options-{$type}-{$id}-label' value='{$label}' class='text'{$label_hidden}/>
|
534 |
+
<label for='cpac_options-{$type}-{$id}-width'>".__('Width', $this->textdomain).":</label>
|
535 |
+
<input type='hidden' maxlength='4' class='input-width' name='cpac_options[columns][{$type}][{$id}][width]' id='cpac_options-{$type}-{$id}-width' value='{$width}' />
|
536 |
+
<div class='description width-decription' title='".__('default', $this->textdomain)."'>{$width_descr}</div>
|
537 |
+
<div class='input-width-range'></div>
|
538 |
<br/>
|
539 |
{$more_options}
|
540 |
</div>
|
549 |
*
|
550 |
* @since 1.0
|
551 |
*/
|
552 |
+
private function get_additional_box_options($type, $id, $values)
|
553 |
{
|
554 |
$fields = '';
|
555 |
|
556 |
+
// Custom Fields
|
557 |
+
if ( $this->is_column_meta($id) )
|
558 |
+
$fields = $this->get_box_options_customfields($type, $id, $values);
|
559 |
|
560 |
return $fields;
|
561 |
}
|
565 |
*
|
566 |
* @since 1.0
|
567 |
*/
|
568 |
+
private function get_box_options_customfields($type, $id, $values)
|
569 |
{
|
570 |
// get post meta fields
|
571 |
+
$fields = $this->get_meta_by_type($type);
|
572 |
|
573 |
if ( empty($fields) )
|
574 |
return false;
|
595 |
'library_id' => __('Media Library Icon', $this->textdomain),
|
596 |
'excerpt' => __('Excerpt'),
|
597 |
'array' => __('Multiple Values', $this->textdomain),
|
598 |
+
'numeric' => __('Numeric', $this->textdomain),
|
599 |
+
'date' => __('Date', $this->textdomain),
|
600 |
+
'title_by_id' => __('Post Title (Post ID\'s)', $this->textdomain),
|
601 |
);
|
602 |
|
603 |
+
// add filter
|
604 |
+
$fieldtypes = apply_filters('cpac-field-types', $fieldtypes );
|
605 |
+
|
606 |
+
// set select options
|
607 |
foreach ( $fieldtypes as $fkey => $fieldtype ) {
|
608 |
$fieldtype_options .= sprintf
|
609 |
(
|
614 |
);
|
615 |
}
|
616 |
|
617 |
+
// before and after string
|
618 |
+
$before = ! empty($values['before']) ? $values['before'] : '' ;
|
619 |
+
$after = ! empty($values['after']) ? $values['after'] : '' ;
|
620 |
+
|
621 |
if ( empty($field_options) )
|
622 |
return false;
|
623 |
|
624 |
// add remove button
|
625 |
$remove = '<p class="remove-description description">'.__('This field can not be removed', $this->textdomain).'</p>';
|
626 |
+
if ( $id != 'column-meta-1') {
|
627 |
$remove = "
|
628 |
<p>
|
629 |
<a href='javascript:;' class='cpac-delete-custom-field-box'>".__('Remove')."</a>
|
632 |
}
|
633 |
|
634 |
$inside = "
|
635 |
+
<label for='cpac-{$type}-{$id}-field'>Custom Field: </label>
|
636 |
+
<select name='cpac_options[columns][{$type}][{$id}][field]' id='cpac-{$type}-{$id}-field'>{$field_options}</select>
|
637 |
<br/>
|
638 |
+
<label for='cpac-{$type}-{$id}-field_type'>Field Type: </label>
|
639 |
+
<select name='cpac_options[columns][{$type}][{$id}][field_type]' id='cpac-{$type}-{$id}-field_type'>{$fieldtype_options}</select>
|
640 |
<br/>
|
641 |
+
<label for='cpac-{$type}-{$id}-before'>Before: </label>
|
642 |
+
<input type='text' class='cpac-before' name='cpac_options[columns][{$type}][{$id}][before]' id='cpac-{$type}-{$id}-before' value='{$before}'/>
|
643 |
+
<br/>
|
644 |
+
<label for='cpac-{$type}-{$id}-after'>After: </label>
|
645 |
+
<input type='text' class='cpac-after' name='cpac_options[columns][{$type}][{$id}][after]' id='cpac-{$type}-{$id}-after' value='{$after}'/>
|
646 |
+
<br/>
|
647 |
{$remove}
|
648 |
";
|
649 |
|
651 |
}
|
652 |
|
653 |
/**
|
654 |
+
* Get post meta fields by type; post(types) or users.
|
655 |
*
|
656 |
* @since 1.0
|
657 |
*/
|
658 |
+
private function get_meta_by_type($type = 'post')
|
659 |
{
|
660 |
global $wpdb;
|
661 |
+
|
662 |
+
/** Comments */
|
663 |
+
if ( $type == 'wp-comments') {
|
664 |
+
$sql = "SELECT DISTINCT meta_key FROM {$wpdb->commentmeta} ORDER BY 1";
|
665 |
+
}
|
666 |
+
|
667 |
+
/** Users */
|
668 |
+
elseif ( $type == 'wp-users') {
|
669 |
+
$sql = "SELECT DISTINCT meta_key FROM {$wpdb->usermeta} ORDER BY 1";
|
670 |
+
}
|
671 |
|
672 |
+
/** Posts */
|
673 |
+
else {
|
674 |
+
$sql = $wpdb->prepare( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta} pm JOIN {$wpdb->posts} p ON pm.post_id = p.ID WHERE p.post_type = %s ORDER BY 1", $type);
|
675 |
+
}
|
676 |
+
|
677 |
+
// run sql
|
678 |
+
$fields = $wpdb->get_results($sql, ARRAY_N);
|
679 |
+
|
680 |
// postmeta
|
681 |
if ( $fields ) {
|
682 |
$meta_fields = array();
|
686 |
$meta_fields[] = $field[0];
|
687 |
}
|
688 |
}
|
|
|
689 |
return $meta_fields;
|
690 |
+
}
|
691 |
|
692 |
return false;
|
693 |
}
|
697 |
*
|
698 |
* @since 1.0
|
699 |
*/
|
700 |
+
public function admin_scripts()
|
701 |
{
|
702 |
+
wp_enqueue_script( 'jquery-ui-slider' );
|
703 |
+
wp_enqueue_script( 'cpac-qtip2', $this->plugin_url('/assets/js/jquery.qtip.js'), array('jquery'), CPAC_VERSION );
|
704 |
+
wp_enqueue_script( 'cpac-admin', $this->plugin_url('/assets/js/admin-column.js'), array('jquery', 'dashboard', 'jquery-ui-sortable'), CPAC_VERSION );
|
705 |
}
|
706 |
+
|
707 |
+
/**
|
708 |
+
* Get column types
|
709 |
+
*
|
710 |
+
* @since 1.1
|
711 |
+
*/
|
712 |
+
private function get_types()
|
713 |
+
{
|
714 |
+
$types = $this->post_types;
|
715 |
+
$types['wp-users'] = 'wp-users';
|
716 |
+
$types['wp-media'] = 'wp-media';
|
717 |
+
$types['wp-links'] = 'wp-links';
|
718 |
+
$types['wp-comments'] = 'wp-comments';
|
719 |
+
|
720 |
+
return $types;
|
721 |
+
}
|
722 |
+
|
723 |
/**
|
724 |
* Get post types
|
725 |
*
|
726 |
* @since 1.0
|
727 |
*/
|
728 |
+
protected function get_post_types()
|
729 |
{
|
730 |
$post_types = get_post_types(array(
|
731 |
'_builtin' => false
|
733 |
$post_types['post'] = 'post';
|
734 |
$post_types['page'] = 'page';
|
735 |
|
736 |
+
return apply_filters('cpac-get-post-types', $post_types);
|
737 |
}
|
738 |
|
739 |
/**
|
743 |
*/
|
744 |
public function admin_styles()
|
745 |
{
|
746 |
+
wp_enqueue_style( 'jquery-ui-lightness', $this->plugin_url('/assets/ui-theme/jquery-ui-1.8.18.custom.css'), array(), CPAC_VERSION, 'all' );
|
747 |
wp_enqueue_style( 'cpac-admin', $this->plugin_url('/assets/css/admin-column.css'), array(), CPAC_VERSION, 'all' );
|
748 |
}
|
749 |
|
765 |
public function register_settings()
|
766 |
{
|
767 |
// If we have no options in the database, let's add them now.
|
768 |
+
if ( false === get_option('cpac_options') )
|
769 |
+
add_option( 'cpac_options', array($this, 'get_default_plugin_options') );
|
770 |
|
771 |
+
register_setting( 'cpac-settings-group', 'cpac_options', array($this, 'options_callback') );
|
772 |
}
|
773 |
|
774 |
/**
|
786 |
}
|
787 |
|
788 |
/**
|
789 |
+
* Optional callback.
|
790 |
*
|
791 |
* @since 1.0
|
792 |
*/
|
800 |
*
|
801 |
* @since 1.0
|
802 |
*/
|
803 |
+
public function handle_requests()
|
804 |
{
|
805 |
// settings updated
|
806 |
+
if ( ! empty($_REQUEST['settings-updated']) )
|
807 |
+
$this->store_wp_default_columns();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
808 |
|
809 |
// restore defaults
|
810 |
+
if ( ! empty($_REQUEST['cpac-restore-defaults']) )
|
811 |
$this->restore_defaults();
|
812 |
+
|
813 |
+
}
|
814 |
+
|
815 |
+
/**
|
816 |
+
* Stores WP default columns
|
817 |
+
*
|
818 |
+
* This will store columns that are set by WordPress core or
|
819 |
+
* set by the theme for page, post(types) and user columns
|
820 |
+
*
|
821 |
+
* @since 1.2
|
822 |
+
*/
|
823 |
+
private function store_wp_default_columns()
|
824 |
+
{
|
825 |
+
// stores the default columns that are set by WP or set in the theme.
|
826 |
+
$wp_default_columns = array();
|
827 |
+
|
828 |
+
// Posts
|
829 |
+
foreach ( $this->post_types as $post_type ) {
|
830 |
+
$wp_default_columns[$post_type] = $this->get_wp_default_posts_columns($post_type);
|
831 |
+
}
|
832 |
+
|
833 |
+
// Users
|
834 |
+
$wp_default_columns['wp-users'] = $this->get_wp_default_users_columns();
|
835 |
+
|
836 |
+
// Media
|
837 |
+
$wp_default_columns['wp-media'] = $this->get_wp_default_media_columns();
|
838 |
+
|
839 |
+
// Links
|
840 |
+
$wp_default_columns['wp-links'] = $this->get_wp_default_links_columns();
|
841 |
+
|
842 |
+
// Comments
|
843 |
+
$wp_default_columns['wp-comments'] = $this->get_wp_default_comments_columns();
|
844 |
+
|
845 |
+
update_option( 'cpac_options_default', $wp_default_columns );
|
846 |
}
|
847 |
|
848 |
/**
|
861 |
*
|
862 |
* @since 1.0
|
863 |
*/
|
864 |
+
private function get_post_excerpt($post_id)
|
865 |
{
|
866 |
+
global $post;
|
867 |
+
|
868 |
$save_post = $post;
|
869 |
$post = get_post($post_id);
|
870 |
$excerpt = get_the_excerpt();
|
871 |
$post = $save_post;
|
872 |
|
873 |
+
$output = $this->get_shortened_string($excerpt, $this->excerpt_length );
|
874 |
|
875 |
return $output;
|
876 |
}
|
880 |
*
|
881 |
* @since 1.0
|
882 |
*/
|
883 |
+
private function get_shortened_string($string = '', $num_words = 55, $more = null)
|
884 |
{
|
885 |
if (!$string)
|
886 |
return false;
|
887 |
|
888 |
+
return wp_trim_words( $string, $num_words, $more );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
889 |
}
|
890 |
|
891 |
/**
|
893 |
*
|
894 |
* @since 1.0
|
895 |
*/
|
896 |
+
public function manage_posts_column_value($column_name, $post_id)
|
897 |
{
|
898 |
+
$type = $column_name;
|
899 |
|
900 |
// Check for taxonomies, such as column-taxonomy-[taxname]
|
901 |
if ( strpos($type, 'column-taxonomy-') !== false )
|
902 |
$type = 'column-taxonomy';
|
903 |
|
904 |
// Check for custom fields, such as column-meta-[customfieldname]
|
905 |
+
if ( $this->is_column_meta($type) )
|
906 |
+
$type = 'column-post-meta';
|
907 |
|
908 |
// Hook
|
909 |
+
do_action('cpac-manage-posts-column', $type, $column_name, $post_id);
|
910 |
|
911 |
// Switch Types
|
912 |
$result = '';
|
924 |
|
925 |
// Featured Image
|
926 |
case "column-featured_image" :
|
927 |
+
if ( has_post_thumbnail($post_id) )
|
928 |
+
$result = get_the_post_thumbnail($post_id, array(80,80));
|
929 |
break;
|
930 |
|
931 |
// Sticky Post
|
932 |
case "column-sticky" :
|
933 |
+
if ( is_sticky($post_id) )
|
934 |
+
$result = $this->get_asset_image('checkmark.png');
|
|
|
|
|
935 |
break;
|
936 |
|
937 |
// Order
|
948 |
case "column-page-template" :
|
949 |
// file name
|
950 |
$page_template = get_post_meta($post_id, '_wp_page_template', true);
|
951 |
+
|
952 |
+
// get template nice name
|
953 |
+
$result = array_search($page_template, get_page_templates());
|
|
|
954 |
break;
|
955 |
|
956 |
// Slug
|
957 |
case "column-page-slug" :
|
958 |
+
$result = get_post($post_id)->post_name;
|
959 |
+
break;
|
960 |
+
|
961 |
+
// Slug
|
962 |
+
case "column-word-count" :
|
963 |
+
$result = str_word_count( $this->strip_trim( get_post($post_id)->post_content ) );
|
964 |
break;
|
965 |
|
966 |
// Taxonomy
|
967 |
case "column-taxonomy" :
|
968 |
+
$tax = str_replace('column-taxonomy-', '', $column_name);
|
969 |
$tags = get_the_terms($post_id, $tax);
|
970 |
$tarr = array();
|
971 |
+
|
972 |
+
// for post formats we will display standard instead of empty
|
973 |
if ( $tax == 'post_format' && empty($tags) ) {
|
974 |
$result = __('Standard');
|
975 |
}
|
976 |
+
|
977 |
+
// add name with link
|
978 |
+
elseif ( !empty($tags) ) {
|
979 |
+
$post_type = get_post_type($post_id);
|
980 |
+
foreach($tags as $tag) {
|
981 |
+
// sanatize title
|
982 |
+
$tax_title = esc_html(sanitize_term_field('name', $tag->name, $tag->term_id, $tag->taxonomy, 'edit'));
|
983 |
+
$tarr[] = "<a href='edit.php?post_type={$post_type}&{$tag->taxonomy}={$tag->slug}'>{$tax_title}</a>";
|
984 |
}
|
985 |
$result = implode(', ', $tarr);
|
986 |
}
|
987 |
break;
|
988 |
|
989 |
// Custom Field
|
990 |
+
case "column-post-meta" :
|
991 |
+
$result = $this->get_column_value_custom_field($post_id, $column_name, 'post');
|
992 |
break;
|
993 |
|
994 |
// Attachment
|
995 |
case "column-attachment" :
|
996 |
$result = $this->get_column_value_attachments($post_id);
|
997 |
break;
|
998 |
+
|
999 |
+
// Attachment count
|
1000 |
+
case "column-attachment-count" :
|
1001 |
+
$result = count($this->get_attachment_ids($post_id));
|
1002 |
+
break;
|
1003 |
+
|
1004 |
+
// Roles
|
1005 |
+
case "column-roles" :
|
1006 |
+
$user_id = get_post($post_id)->post_author;
|
1007 |
+
$userdata = get_userdata( $user_id );
|
1008 |
+
if ( !empty($userdata->roles[0]) )
|
1009 |
+
echo implode(', ',$userdata->roles);
|
1010 |
+
break;
|
1011 |
+
|
1012 |
+
// Post status
|
1013 |
+
case "column-status" :
|
1014 |
+
$p = get_post($post_id);
|
1015 |
+
$result = $p->post_status;
|
1016 |
+
if ( $result == 'future')
|
1017 |
+
$result = $result . " <p class='description'>" . date_i18n( get_option('date_format') . ' ' . get_option('time_format') , strtotime($p->post_date) ) . "</p>";
|
1018 |
+
break;
|
1019 |
|
1020 |
default :
|
1021 |
+
$result = $this->strip_trim(get_post_meta( $post_id, $column_name, true ));
|
1022 |
|
1023 |
endswitch;
|
1024 |
|
1027 |
|
1028 |
echo $result;
|
1029 |
}
|
1030 |
+
|
1031 |
/**
|
1032 |
+
* Manage custom column for Users.
|
1033 |
*
|
1034 |
+
* @since 1.1
|
1035 |
*/
|
1036 |
+
public function manage_users_column_value( $value, $column_name, $user_id )
|
1037 |
{
|
1038 |
+
$type = $column_name;
|
1039 |
+
|
1040 |
+
$userdata = get_userdata( $user_id );
|
1041 |
+
|
1042 |
+
if ( ! $userdata )
|
1043 |
+
return false;
|
1044 |
+
|
1045 |
+
// Check for user custom fields: column-meta-[customfieldname]
|
1046 |
+
if ( $this->is_column_meta($type) )
|
1047 |
+
$type = 'column-user-meta';
|
1048 |
+
|
1049 |
+
// Check for post count: column-user_postcount-[posttype]
|
1050 |
+
if ( $this->get_posttype_by_postcount_column($type) )
|
1051 |
+
$type = 'column-user_postcount';
|
1052 |
+
|
1053 |
+
// Hook
|
1054 |
+
do_action('cpac-manage-users-column', $type, $column_name, $user_id);
|
1055 |
+
|
1056 |
$result = '';
|
1057 |
+
switch ($type) :
|
1058 |
+
|
1059 |
+
// user id
|
1060 |
+
case "column-user_id" :
|
1061 |
+
$result = $user_id;
|
1062 |
+
break;
|
1063 |
+
|
1064 |
+
// first name
|
1065 |
+
case "column-nickname" :
|
1066 |
+
$result = $userdata->nickname;
|
1067 |
+
break;
|
1068 |
+
|
1069 |
+
// first name
|
1070 |
+
case "column-first_name" :
|
1071 |
+
$result = $userdata->first_name;
|
1072 |
+
break;
|
1073 |
+
|
1074 |
+
// last name
|
1075 |
+
case "column-last_name" :
|
1076 |
+
$result = $userdata->last_name;
|
1077 |
+
break;
|
1078 |
+
|
1079 |
+
// user url
|
1080 |
+
case "column-user_url" :
|
1081 |
+
$result = $userdata->user_url;
|
1082 |
+
break;
|
1083 |
+
|
1084 |
+
// user registration date
|
1085 |
+
case "column-user_registered" :
|
1086 |
+
$result = $userdata->user_registered;
|
1087 |
+
break;
|
1088 |
+
|
1089 |
+
// user description
|
1090 |
+
case "column-user_description" :
|
1091 |
+
$result = $this->get_shortened_string( get_the_author_meta('user_description', $user_id), $this->excerpt_length );
|
1092 |
+
break;
|
1093 |
+
|
1094 |
+
// user description
|
1095 |
+
case "column-user_postcount" :
|
1096 |
+
$post_type = $this->get_posttype_by_postcount_column($column_name);
|
1097 |
+
|
1098 |
+
// get post count
|
1099 |
+
$count = $this->get_post_count( $post_type, $user_id );
|
1100 |
+
|
1101 |
+
// set result
|
1102 |
+
$result = $count > 0 ? "<a href='edit.php?post_type={$post_type}&author={$user_id}'>{$count}</a>" : (string) $count;
|
1103 |
+
break;
|
1104 |
+
|
1105 |
+
// user meta data ( custom field )
|
1106 |
+
case "column-user-meta" :
|
1107 |
+
$result = $this->get_column_value_custom_field($user_id, $column_name, 'user');
|
1108 |
+
break;
|
1109 |
+
|
1110 |
+
default :
|
1111 |
+
$result = get_user_meta( $user_id, $column_name, true );
|
1112 |
+
|
1113 |
+
endswitch;
|
1114 |
+
|
1115 |
+
if ( empty($result) && '0' != $result )
|
1116 |
+
$result = ' ';
|
1117 |
+
|
1118 |
return $result;
|
1119 |
}
|
1120 |
|
1121 |
/**
|
1122 |
+
* Manage custom column for Media.
|
1123 |
*
|
1124 |
+
* @since 1.3
|
1125 |
*/
|
1126 |
+
public function manage_media_column_value( $column_name, $media_id )
|
1127 |
{
|
1128 |
+
$type = $column_name;
|
|
|
|
|
|
|
|
|
|
|
1129 |
|
1130 |
+
$meta = wp_get_attachment_metadata($media_id);
|
1131 |
+
$p = get_post($media_id);
|
|
|
|
|
|
|
1132 |
|
1133 |
+
// Hook
|
1134 |
+
do_action('cpac-manage-media-column', $type, $column_name, $media_id);
|
|
|
|
|
|
|
|
|
1135 |
|
1136 |
+
$result = '';
|
1137 |
+
switch ($type) :
|
1138 |
+
|
1139 |
+
// media id
|
1140 |
+
case "column-mediaid" :
|
1141 |
+
$result = $media_id;
|
1142 |
+
break;
|
1143 |
+
|
1144 |
+
// dimensions
|
1145 |
+
case "column-dimensions" :
|
1146 |
+
if ( !empty($meta['width']) && !empty($meta['height']) )
|
1147 |
+
$result = "{$meta['width']} x {$meta['height']}";
|
1148 |
+
break;
|
1149 |
+
|
1150 |
+
// width
|
1151 |
+
case "column-width" :
|
1152 |
+
$result = !empty($meta['width']) ? $meta['width'] : '';
|
1153 |
+
break;
|
1154 |
+
|
1155 |
+
// height
|
1156 |
+
case "column-height" :
|
1157 |
+
$result = !empty($meta['height']) ? $meta['height'] : '';
|
1158 |
+
break;
|
1159 |
+
|
1160 |
+
// description
|
1161 |
+
case "column-description" :
|
1162 |
+
$result = $p->post_content;
|
1163 |
break;
|
1164 |
|
1165 |
+
// caption
|
1166 |
+
case "column-caption" :
|
1167 |
+
$result = $p->post_excerpt;
|
1168 |
+
break;
|
1169 |
+
|
1170 |
+
// alternate text
|
1171 |
+
case "column-alternate_text" :
|
1172 |
+
$alt = get_post_meta($media_id, '_wp_attachment_image_alt', true);
|
1173 |
+
$result = $this->strip_trim($alt);
|
1174 |
+
break;
|
1175 |
+
|
1176 |
+
// mime type
|
1177 |
+
case "column-mime_type" :
|
1178 |
+
$result = $p->post_mime_type;
|
1179 |
break;
|
1180 |
|
1181 |
+
// file name
|
1182 |
+
case "column-file_name" :
|
1183 |
+
$file = wp_get_attachment_url($p->ID);
|
1184 |
+
$filename = basename($file);
|
1185 |
+
$result = "<a title='{$filename}' href='{$file}'>{$filename}</a>";
|
1186 |
break;
|
1187 |
+
|
1188 |
+
// file paths
|
1189 |
+
case "column-file_paths" :
|
1190 |
+
$sizes = get_intermediate_image_sizes();
|
1191 |
+
$url = wp_get_attachment_url($p->ID);
|
1192 |
+
$filename = basename($url);
|
1193 |
+
$paths[] = "<a title='{$filename}' href='{$url}'>" . __('original', $this->textdomain) . "</a>";
|
1194 |
+
if ( $sizes ) {
|
1195 |
+
foreach ( $sizes as $size ) {
|
1196 |
+
$src = wp_get_attachment_image_src( $media_id, $size );
|
1197 |
+
if (!empty($src[0])) {
|
1198 |
+
$filename = basename($src[0]);
|
1199 |
+
$paths[] = "<a title='{$filename}' href='{$src[0]}'>{$size}</a>";
|
1200 |
+
}
|
1201 |
+
}
|
1202 |
+
}
|
1203 |
+
$result = implode('<span class="cpac-divider"></span>', $paths);
|
1204 |
+
break;
|
1205 |
+
|
1206 |
+
default:
|
1207 |
+
$result = '';
|
1208 |
+
|
1209 |
+
endswitch;
|
1210 |
|
1211 |
+
if ( empty($result) && '0' != $result )
|
1212 |
+
$result = ' ';
|
1213 |
+
|
1214 |
+
echo $result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1215 |
}
|
1216 |
+
|
1217 |
/**
|
1218 |
+
* Manage custom column for Links
|
1219 |
*
|
1220 |
+
* @since 1.3.1
|
1221 |
*/
|
1222 |
+
public function manage_link_column_value( $column_name, $link_id )
|
1223 |
{
|
1224 |
+
$type = $column_name;
|
1225 |
|
1226 |
+
// links object... called bookmark
|
1227 |
+
$bookmark = get_bookmark($link_id);
|
1228 |
|
1229 |
+
// Hook
|
1230 |
+
do_action('cpac-manage-link-column', $type, $column_name, $link_id);
|
1231 |
+
|
1232 |
+
$result = '';
|
1233 |
+
switch ($type) :
|
1234 |
|
1235 |
+
// link id
|
1236 |
+
case "column-link_id" :
|
1237 |
+
$result = $link_id;
|
1238 |
+
break;
|
1239 |
+
|
1240 |
+
// description
|
1241 |
+
case "column-description" :
|
1242 |
+
$result = $bookmark->link_description;
|
1243 |
+
break;
|
1244 |
+
|
1245 |
+
// target
|
1246 |
+
case "column-target" :
|
1247 |
+
$result = $bookmark->link_target;
|
1248 |
+
break;
|
1249 |
+
|
1250 |
+
// notes
|
1251 |
+
case "column-notes" :
|
1252 |
+
$result = $this->get_shortened_string($bookmark->link_notes, $this->excerpt_length);
|
1253 |
+
break;
|
1254 |
+
|
1255 |
+
// rss
|
1256 |
+
case "column-rss" :
|
1257 |
+
$result = $this->get_shorten_url($bookmark->link_rss);
|
1258 |
+
break;
|
1259 |
|
1260 |
+
// image
|
1261 |
+
case "column-image" :
|
1262 |
+
$result = $this->get_thumbnail($bookmark->link_image);
|
1263 |
+
break;
|
1264 |
+
|
1265 |
+
// name length
|
1266 |
+
case "column-length" :
|
1267 |
+
$result = strlen($bookmark->link_name);
|
1268 |
+
break;
|
1269 |
+
|
1270 |
+
// owner
|
1271 |
+
case "column-owner" :
|
1272 |
+
$result = $bookmark->link_owner;
|
1273 |
+
|
1274 |
+
// add user link
|
1275 |
+
$userdata = get_userdata( $bookmark->link_owner );
|
1276 |
+
if (!empty($userdata->data)) {
|
1277 |
+
$result = $userdata->data->user_nicename;
|
1278 |
+
//$result = "<a href='user-edit.php?user_id={$bookmark->link_owner}'>{$result}</a>";
|
1279 |
+
}
|
1280 |
+
break;
|
1281 |
+
|
1282 |
+
default:
|
1283 |
+
$result = '';
|
1284 |
+
|
1285 |
+
endswitch;
|
1286 |
+
|
1287 |
+
if ( empty($result) && '0' != $result )
|
1288 |
+
$result = ' ';
|
1289 |
+
|
1290 |
+
echo $result;
|
1291 |
}
|
1292 |
+
|
1293 |
/**
|
1294 |
+
* Manage custom column for Comments
|
1295 |
*
|
1296 |
+
* @since 1.3.1
|
1297 |
*/
|
1298 |
+
public function manage_comments_column_value( $column_name, $comment_id )
|
1299 |
{
|
1300 |
+
$type = $column_name;
|
1301 |
|
1302 |
+
// comments object
|
1303 |
+
$comment = get_comment($comment_id);
|
1304 |
|
1305 |
+
// Check for custom fields, such as column-meta-[customfieldname]
|
1306 |
+
if ( $this->is_column_meta($type) )
|
1307 |
+
$type = 'column-comment-meta';
|
1308 |
|
1309 |
+
// Hook
|
1310 |
+
do_action('cpac-manage-comments-column', $type, $column_name, $comment_id);
|
1311 |
|
1312 |
+
$result = '';
|
1313 |
+
switch ($type) :
|
1314 |
+
|
1315 |
+
// comment id
|
1316 |
+
case "column-comment_id" :
|
1317 |
+
$result = $comment_id;
|
1318 |
+
break;
|
1319 |
+
|
1320 |
+
// author
|
1321 |
+
case "column-author_author" :
|
1322 |
+
$result = $comment->comment_author;
|
1323 |
+
break;
|
1324 |
+
|
1325 |
+
// avatar
|
1326 |
+
case "column-author_avatar" :
|
1327 |
+
$result = get_avatar( $comment, 80 );
|
1328 |
+
break;
|
1329 |
+
|
1330 |
+
// url
|
1331 |
+
case "column-author_url" :
|
1332 |
+
$result = $this->get_shorten_url($comment->comment_author_url);
|
1333 |
+
break;
|
1334 |
+
|
1335 |
+
// ip
|
1336 |
+
case "column-author_ip" :
|
1337 |
+
$result = $comment->comment_author_IP;
|
1338 |
+
break;
|
1339 |
+
|
1340 |
+
// email
|
1341 |
+
case "column-author_email" :
|
1342 |
+
$result = $comment->comment_author_email;
|
1343 |
+
break;
|
1344 |
+
|
1345 |
+
// parent
|
1346 |
+
case "column-reply_to" :
|
1347 |
+
if ( $comment->comment_approved ) {
|
1348 |
+
$parent = get_comment( $comment->comment_parent );
|
1349 |
+
$parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
|
1350 |
+
$name = get_comment_author( $parent->comment_ID );
|
1351 |
+
$result = sprintf( '<a href="%1$s">%2$s</a>', $parent_link, $name );
|
1352 |
+
}
|
1353 |
+
break;
|
1354 |
+
|
1355 |
+
// approved
|
1356 |
+
case "column-approved" :
|
1357 |
+
$result = $this->get_asset_image('no.png');
|
1358 |
+
if ( $comment->comment_approved )
|
1359 |
+
$result = $this->get_asset_image('checkmark.png');
|
1360 |
+
break;
|
1361 |
+
|
1362 |
+
// date
|
1363 |
+
case "column-date" :
|
1364 |
+
$comment_url = esc_url( get_comment_link( $comment_id ) );
|
1365 |
+
$result = sprintf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ),
|
1366 |
+
$comment_url,
|
1367 |
+
$this->get_date($comment->comment_date),
|
1368 |
+
$this->get_time($comment->comment_date)
|
1369 |
+
);
|
1370 |
+
$result = "<div class='submitted-on'>{$result}</div>";
|
1371 |
+
break;
|
1372 |
+
|
1373 |
+
// date GMT
|
1374 |
+
case "column-date_gmt" :
|
1375 |
+
$comment_url = esc_url( get_comment_link( $comment_id ) );
|
1376 |
+
$result = sprintf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ),
|
1377 |
+
$comment_url,
|
1378 |
+
$this->get_date($comment->comment_date_gmt),
|
1379 |
+
$this->get_time($comment->comment_date_gmt)
|
1380 |
+
);
|
1381 |
+
$result = "<div class='submitted-on'>{$result}</div>";
|
1382 |
+
break;
|
1383 |
+
|
1384 |
+
// custom field
|
1385 |
+
case "column-comment-meta" :
|
1386 |
+
$result = $this->get_column_value_custom_field($comment_id, $column_name, 'comment');
|
1387 |
+
break;
|
1388 |
+
|
1389 |
+
// agent
|
1390 |
+
case "column-agent" :
|
1391 |
+
$result = $comment->comment_agent;
|
1392 |
+
break;
|
1393 |
+
|
1394 |
+
// excerpt
|
1395 |
+
case "column-excerpt" :
|
1396 |
+
$comment = get_comment($comment_id);
|
1397 |
+
$result = $this->get_shortened_string($comment->comment_content, $this->excerpt_length);
|
1398 |
+
break;
|
1399 |
+
|
1400 |
+
default:
|
1401 |
+
$result = '';
|
1402 |
+
|
1403 |
+
endswitch;
|
1404 |
|
1405 |
+
if ( empty($result) && '0' != $result )
|
1406 |
+
$result = ' ';
|
1407 |
+
|
1408 |
+
echo $result;
|
1409 |
}
|
1410 |
|
1411 |
/**
|
1412 |
+
* Get column value of post attachments
|
1413 |
*
|
1414 |
* @since 1.0
|
1415 |
*/
|
1416 |
+
private function get_column_value_attachments( $post_id )
|
1417 |
{
|
1418 |
+
$result = '';
|
1419 |
+
$attachment_ids = $this->get_attachment_ids($post_id);
|
1420 |
+
if ( $attachment_ids ) {
|
1421 |
+
foreach ( $attachment_ids as $attach_id ) {
|
1422 |
+
if ( wp_get_attachment_image($attach_id) )
|
1423 |
+
$result .= wp_get_attachment_image( $attach_id, array(80,80), true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1424 |
}
|
1425 |
+
}
|
1426 |
+
return $result;
|
1427 |
+
}
|
1428 |
+
|
1429 |
/**
|
1430 |
+
* Get column value of post attachments
|
1431 |
*
|
1432 |
+
* @since 1.2.1
|
1433 |
*/
|
1434 |
+
protected function get_attachment_ids( $post_id )
|
1435 |
{
|
1436 |
+
return get_posts(array(
|
1437 |
+
'post_type' => 'attachment',
|
1438 |
+
'numberposts' => -1,
|
1439 |
+
'post_status' => null,
|
1440 |
+
'post_parent' => $post_id,
|
1441 |
+
'fields' => 'ids'
|
1442 |
+
));
|
1443 |
+
}
|
1444 |
+
|
1445 |
+
/**
|
1446 |
+
* Get post count
|
1447 |
+
*
|
1448 |
+
* @since 1.3.1
|
1449 |
+
*/
|
1450 |
+
protected function get_post_count( $post_type, $user_id )
|
1451 |
+
{
|
1452 |
+
if ( ! post_type_exists($post_type) || ! get_userdata($user_id) )
|
1453 |
+
return false;
|
1454 |
+
|
1455 |
+
$user_posts = get_posts(array(
|
1456 |
+
'post_type' => $post_type,
|
1457 |
+
'numberposts' => -1,
|
1458 |
+
'author' => $user_id,
|
1459 |
+
'post_status' => 'publish'
|
1460 |
+
));
|
1461 |
+
return count($user_posts);
|
1462 |
+
}
|
1463 |
+
|
1464 |
+
/**
|
1465 |
+
* Get checkmark image
|
1466 |
+
*
|
1467 |
+
* @since 1.3.1
|
1468 |
+
*/
|
1469 |
+
protected function get_asset_image($name = '')
|
1470 |
+
{
|
1471 |
+
if ( $name )
|
1472 |
+
return sprintf("<img alt='' src='%s' />", $this->plugin_url("assets/images/{$name}") );
|
1473 |
+
}
|
1474 |
+
|
1475 |
+
/**
|
1476 |
+
* Shorten URL
|
1477 |
+
*
|
1478 |
+
* @since 1.3.1
|
1479 |
+
*/
|
1480 |
+
protected function get_shorten_url($url = '')
|
1481 |
+
{
|
1482 |
+
if ( !$url )
|
1483 |
+
return false;
|
1484 |
+
|
1485 |
+
// shorten url
|
1486 |
+
$short_url = url_shorten( $url );
|
1487 |
+
|
1488 |
+
return "<a title='{$url}' href='{$url}'>{$short_url}</a>";
|
1489 |
+
}
|
1490 |
+
/**
|
1491 |
+
* Get column value of Custom Field
|
1492 |
+
*
|
1493 |
+
* @since 1.0
|
1494 |
+
*/
|
1495 |
+
protected function get_column_value_custom_field($object_id, $column_name, $meta_type = 'post')
|
1496 |
+
{
|
1497 |
+
/** Users */
|
1498 |
+
if ( $meta_type == 'user' ) {
|
1499 |
+
$type = 'wp-users';
|
1500 |
+
}
|
1501 |
+
|
1502 |
+
/** Posts */
|
1503 |
+
else {
|
1504 |
+
$type = get_post_type($object_id);
|
1505 |
+
}
|
1506 |
+
|
1507 |
+
// get column
|
1508 |
+
$columns = $this->get_stored_columns($type);
|
1509 |
+
|
1510 |
+
// inputs
|
1511 |
+
$field = isset($columns[$column_name]['field']) ? $columns[$column_name]['field'] : '';
|
1512 |
+
$fieldtype = isset($columns[$column_name]['field_type']) ? $columns[$column_name]['field_type'] : '';
|
1513 |
+
$before = isset($columns[$column_name]['before']) ? $columns[$column_name]['before'] : '';
|
1514 |
+
$after = isset($columns[$column_name]['after']) ? $columns[$column_name]['after'] : '';
|
1515 |
+
|
1516 |
+
// Get meta field value
|
1517 |
+
$meta = get_metadata($meta_type, $object_id, $field, true);
|
1518 |
+
|
1519 |
+
// multiple meta values
|
1520 |
+
if ( ( $fieldtype == 'array' && is_array($meta) ) || is_array($meta) ) {
|
1521 |
+
$meta = get_metadata($meta_type, $object_id, $field, true);
|
1522 |
+
$meta = $this->recursive_implode(', ', $meta);
|
1523 |
+
}
|
1524 |
+
|
1525 |
+
// make sure there are no serialized arrays or empty meta data
|
1526 |
+
if ( empty($meta) || !is_string($meta) )
|
1527 |
+
return false;
|
1528 |
+
|
1529 |
+
// handles each field type differently..
|
1530 |
+
switch ($fieldtype) :
|
1531 |
+
|
1532 |
+
// Image
|
1533 |
+
case "image" :
|
1534 |
+
$meta = $this->get_thumbnail($meta);
|
1535 |
+
break;
|
1536 |
+
|
1537 |
+
// Media Library ID
|
1538 |
+
case "library_id" :
|
1539 |
+
$meta = $this->get_media_thumbnails($meta);
|
1540 |
+
break;
|
1541 |
+
|
1542 |
+
// Excerpt
|
1543 |
+
case "excerpt" :
|
1544 |
+
$meta = $this->get_shortened_string($meta, $this->excerpt_length);
|
1545 |
+
break;
|
1546 |
+
|
1547 |
+
// Date
|
1548 |
+
case "date" :
|
1549 |
+
$meta = $this->get_date($meta);
|
1550 |
+
break;
|
1551 |
+
|
1552 |
+
// Title
|
1553 |
+
case "title_by_id" :
|
1554 |
+
$titles = $this->get_custom_field_value_title($meta);
|
1555 |
+
if ( $titles )
|
1556 |
+
$meta = $titles;
|
1557 |
+
break;
|
1558 |
+
|
1559 |
+
endswitch;
|
1560 |
+
|
1561 |
+
// add before and after string
|
1562 |
+
$meta = "{$before}{$meta}{$after}";
|
1563 |
+
|
1564 |
+
return $meta;
|
1565 |
+
}
|
1566 |
+
|
1567 |
+
/**
|
1568 |
+
* Get custom field value 'Title by ID'
|
1569 |
+
*
|
1570 |
+
* @since 1.3
|
1571 |
+
*/
|
1572 |
+
private function get_custom_field_value_title($meta)
|
1573 |
+
{
|
1574 |
+
//remove white spaces and strip tags
|
1575 |
+
$meta = $this->strip_trim( str_replace(' ','', $meta) );
|
1576 |
+
|
1577 |
+
// var
|
1578 |
+
$ids = $titles = array();
|
1579 |
+
|
1580 |
+
// check for multiple id's
|
1581 |
+
if ( strpos($meta, ',') !== false )
|
1582 |
+
$ids = explode(',',$meta);
|
1583 |
+
elseif ( is_numeric($meta) )
|
1584 |
+
$ids[] = $meta;
|
1585 |
+
|
1586 |
+
// display title with link
|
1587 |
+
if ( $ids && is_array($ids) ) {
|
1588 |
+
foreach ( $ids as $id ) {
|
1589 |
+
$title = is_numeric($id) ? get_the_title($id) : '';
|
1590 |
+
$link = get_edit_post_link($id);
|
1591 |
+
if ( $title )
|
1592 |
+
$titles[] = $link ? "<a href='{$link}'>{$title}</a>" : $title;
|
1593 |
+
}
|
1594 |
+
}
|
1595 |
+
|
1596 |
+
return implode('<span class="cpac-divider"></span>', $titles);
|
1597 |
+
}
|
1598 |
+
|
1599 |
+
/**
|
1600 |
+
* Get column value of Custom Field
|
1601 |
+
*
|
1602 |
+
* @since 1.2
|
1603 |
+
*/
|
1604 |
+
private function get_user_column_value_custom_field($user_id, $id)
|
1605 |
+
{
|
1606 |
+
$columns = $this->get_stored_columns('wp-users');
|
1607 |
+
|
1608 |
+
// inputs
|
1609 |
+
$field = isset($columns[$id]['field']) ? $columns[$id]['field'] : '';
|
1610 |
+
$fieldtype = isset($columns[$id]['field_type']) ? $columns[$id]['field_type'] : '';
|
1611 |
+
$before = isset($columns[$id]['before']) ? $columns[$id]['before'] : '';
|
1612 |
+
$after = isset($columns[$id]['after']) ? $columns[$id]['after'] : '';
|
1613 |
+
|
1614 |
+
// Get meta field value
|
1615 |
+
$meta = get_user_meta($user_id, $field, true);
|
1616 |
+
|
1617 |
+
// multiple meta values
|
1618 |
+
if ( ( $fieldtype == 'array' && is_array($meta) ) || is_array($meta) ) {
|
1619 |
+
$meta = get_user_meta($user_id, $field);
|
1620 |
+
$meta = $this->recursive_implode(', ', $meta);
|
1621 |
+
}
|
1622 |
+
|
1623 |
+
// make sure there are no serialized arrays or empty meta data
|
1624 |
+
if ( empty($meta) || !is_string($meta) )
|
1625 |
+
return false;
|
1626 |
+
|
1627 |
+
// handles each field type differently..
|
1628 |
+
switch ($fieldtype) :
|
1629 |
+
|
1630 |
+
// Image
|
1631 |
+
case "image" :
|
1632 |
+
$meta = $this->get_thumbnail($meta);
|
1633 |
+
break;
|
1634 |
+
|
1635 |
+
// Media Library ID
|
1636 |
+
case "library_id" :
|
1637 |
+
$meta = $this->get_media_thumbnails($meta);
|
1638 |
+
break;
|
1639 |
+
|
1640 |
+
// Excerpt
|
1641 |
+
case "excerpt" :
|
1642 |
+
$meta = $this->get_shortened_string($meta, $this->excerpt_length);
|
1643 |
+
break;
|
1644 |
+
|
1645 |
+
endswitch;
|
1646 |
+
|
1647 |
+
// add before and after string
|
1648 |
+
$meta = "{$before}{$meta}{$after}";
|
1649 |
+
|
1650 |
+
return $meta;
|
1651 |
+
}
|
1652 |
+
|
1653 |
+
/**
|
1654 |
+
* Implode for multi dimensional array
|
1655 |
+
*
|
1656 |
+
* @since 1.0
|
1657 |
+
*/
|
1658 |
+
private function recursive_implode( $glue, $pieces )
|
1659 |
+
{
|
1660 |
+
foreach( $pieces as $r_pieces ) {
|
1661 |
+
if( is_array( $r_pieces ) ) {
|
1662 |
+
$retVal[] = $this->recursive_implode( $glue, $r_pieces );
|
1663 |
+
}
|
1664 |
+
else {
|
1665 |
+
$retVal[] = $r_pieces;
|
1666 |
+
}
|
1667 |
+
}
|
1668 |
+
if ( isset($retVal) && is_array($retVal) )
|
1669 |
+
return implode( $glue, $retVal );
|
1670 |
+
|
1671 |
+
return false;
|
1672 |
+
}
|
1673 |
+
|
1674 |
+
/**
|
1675 |
+
* Get WP default supported admin columns per post type.
|
1676 |
+
*
|
1677 |
+
* @since 1.0
|
1678 |
+
*/
|
1679 |
+
private function get_wp_default_posts_columns($post_type = 'post')
|
1680 |
+
{
|
1681 |
+
// load dependencies
|
1682 |
+
|
1683 |
+
// deprecated as of wp3.3
|
1684 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/template.php') )
|
1685 |
+
require_once(ABSPATH . 'wp-admin/includes/template.php');
|
1686 |
+
|
1687 |
+
// introduced since wp3.3
|
1688 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/screen.php') )
|
1689 |
+
require_once(ABSPATH . 'wp-admin/includes/screen.php');
|
1690 |
+
|
1691 |
+
// used for getting columns
|
1692 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php') )
|
1693 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1694 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-posts-list-table.php') )
|
1695 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-posts-list-table.php');
|
1696 |
|
1697 |
// we need to change the current screen
|
1698 |
global $current_screen;
|
1704 |
// ...so we can get its columns
|
1705 |
$columns = WP_Posts_List_Table::get_columns();
|
1706 |
|
1707 |
+
if ( empty ( $columns ) )
|
1708 |
+
return false;
|
1709 |
+
|
1710 |
+
// change to uniform format
|
1711 |
+
$posts_columns = $this->get_uniform_format($columns);
|
1712 |
+
|
1713 |
+
// reset current screen
|
1714 |
+
$current_screen = $org_current_screen;
|
1715 |
+
|
1716 |
+
return $posts_columns;
|
1717 |
+
}
|
1718 |
+
|
1719 |
+
/**
|
1720 |
+
* Get WP default users columns per post type.
|
1721 |
+
*
|
1722 |
+
* @since 1.1
|
1723 |
+
*/
|
1724 |
+
private function get_wp_default_users_columns()
|
1725 |
+
{
|
1726 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php') )
|
1727 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1728 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-users-list-table.php') )
|
1729 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-users-list-table.php');
|
1730 |
+
|
1731 |
+
// turn off site users
|
1732 |
+
$this->is_site_users = false;
|
1733 |
+
|
1734 |
+
// get users columns
|
1735 |
+
$columns = WP_Users_List_Table::get_columns();
|
1736 |
+
|
1737 |
+
// change to uniform format
|
1738 |
+
$columns = $this->get_uniform_format($columns);
|
1739 |
+
|
1740 |
+
// add sorting to some of the default links columns
|
1741 |
+
$columns = $this->set_sorting_to_default_users_columns($columns);
|
1742 |
+
|
1743 |
+
return apply_filters('cpac-default-users-columns', $columns);
|
1744 |
+
}
|
1745 |
+
|
1746 |
+
/**
|
1747 |
+
* Add Sorting to WP default Users columns
|
1748 |
+
*
|
1749 |
+
* @since 1.4
|
1750 |
+
*/
|
1751 |
+
private function set_sorting_to_default_users_columns($columns)
|
1752 |
+
{
|
1753 |
+
// Comment
|
1754 |
+
if ( !empty($columns['role']) ) {
|
1755 |
+
$columns['role']['options']['sortorder'] = 'on';
|
1756 |
+
}
|
1757 |
+
return $columns;
|
1758 |
+
}
|
1759 |
+
|
1760 |
+
/**
|
1761 |
+
* Get WP default media columns.
|
1762 |
+
*
|
1763 |
+
* @since 1.2.1
|
1764 |
+
*/
|
1765 |
+
private function get_wp_default_media_columns()
|
1766 |
+
{
|
1767 |
+
// could use _get_list_table('WP_Media_List_Table') ?
|
1768 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php') )
|
1769 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1770 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php') )
|
1771 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php');
|
1772 |
+
|
1773 |
+
global $current_screen;
|
1774 |
+
$org_current_screen = $current_screen;
|
1775 |
+
|
1776 |
+
// overwrite current_screen global with our media id...
|
1777 |
+
$current_screen->id = 'upload';
|
1778 |
+
|
1779 |
+
// init media class
|
1780 |
+
$wp_media = new WP_Media_List_Table;
|
1781 |
+
|
1782 |
+
// get media columns
|
1783 |
+
$columns = $wp_media->get_columns();
|
1784 |
+
|
1785 |
+
// reset current screen
|
1786 |
+
$current_screen = $org_current_screen;
|
1787 |
+
|
1788 |
+
// change to uniform format
|
1789 |
+
return $this->get_uniform_format($columns);
|
1790 |
+
}
|
1791 |
+
|
1792 |
+
/**
|
1793 |
+
* Get WP default links columns.
|
1794 |
+
*
|
1795 |
+
* @since 1.3.1
|
1796 |
+
*/
|
1797 |
+
private function get_wp_default_links_columns()
|
1798 |
+
{
|
1799 |
+
// dependencies
|
1800 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php') )
|
1801 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1802 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-links-list-table.php') )
|
1803 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-links-list-table.php');
|
1804 |
+
|
1805 |
+
// get links columns
|
1806 |
+
$columns = WP_Links_List_Table::get_columns();
|
1807 |
+
|
1808 |
+
// change to uniform format
|
1809 |
+
$columns = $this->get_uniform_format($columns);
|
1810 |
+
|
1811 |
+
// add sorting to some of the default links columns
|
1812 |
+
$columns = $this->set_sorting_to_default_links_columns($columns);
|
1813 |
+
|
1814 |
+
return apply_filters('cpac-default-links-columns', $columns);
|
1815 |
+
}
|
1816 |
+
|
1817 |
+
/**
|
1818 |
+
* Add Sorting to WP default links columns
|
1819 |
+
*
|
1820 |
+
* @since 1.4
|
1821 |
+
*/
|
1822 |
+
private function set_sorting_to_default_links_columns($columns)
|
1823 |
+
{
|
1824 |
+
// Relationship
|
1825 |
+
if ( !empty($columns['rel']) ) {
|
1826 |
+
$columns['rel']['options']['sortorder'] = 'on';
|
1827 |
+
}
|
1828 |
+
return $columns;
|
1829 |
+
}
|
1830 |
+
|
1831 |
+
/**
|
1832 |
+
* Get WP default links columns.
|
1833 |
+
*
|
1834 |
+
* @since 1.3.1
|
1835 |
+
*/
|
1836 |
+
private function get_wp_default_comments_columns()
|
1837 |
+
{
|
1838 |
+
// dependencies
|
1839 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php') )
|
1840 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1841 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-comments-list-table.php') )
|
1842 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-comments-list-table.php');
|
1843 |
+
|
1844 |
+
global $current_screen;
|
1845 |
+
$org_current_screen = $current_screen;
|
1846 |
+
|
1847 |
+
// overwrite current_screen global with our media id...
|
1848 |
+
$current_screen->id = 'edit-comments';
|
1849 |
+
|
1850 |
+
// init table object
|
1851 |
+
$wp_comment = new WP_Comments_List_Table;
|
1852 |
+
|
1853 |
+
// get comments
|
1854 |
+
$columns = $wp_comment->get_columns();
|
1855 |
+
|
1856 |
+
// reset current screen
|
1857 |
+
$current_screen = $org_current_screen;
|
1858 |
+
|
1859 |
+
// change to uniform format
|
1860 |
+
$columns = $this->get_uniform_format($columns);
|
1861 |
+
|
1862 |
+
// add sorting to some of the default links columns
|
1863 |
+
$columns = $this->set_sorting_to_default_comments_columns($columns);
|
1864 |
+
|
1865 |
+
return apply_filters('cpac-default-comments-columns', $columns);
|
1866 |
+
}
|
1867 |
+
|
1868 |
+
/**
|
1869 |
+
* Add Sorting to WP default comments columns
|
1870 |
+
*
|
1871 |
+
* @since 1.4
|
1872 |
+
*/
|
1873 |
+
private function set_sorting_to_default_comments_columns($columns)
|
1874 |
+
{
|
1875 |
+
// Comment
|
1876 |
+
if ( !empty($columns['comment']) ) {
|
1877 |
+
$columns['comment']['options']['sortorder'] = 'on';
|
1878 |
+
}
|
1879 |
+
return $columns;
|
1880 |
+
}
|
1881 |
+
|
1882 |
+
/**
|
1883 |
+
* Build uniform format for all columns
|
1884 |
+
*
|
1885 |
+
* @since 1.0
|
1886 |
+
*/
|
1887 |
+
private function get_uniform_format($columns)
|
1888 |
+
{
|
1889 |
// we remove the checkbox column as an option...
|
1890 |
+
if ( isset($columns['cb']) )
|
1891 |
+
unset($columns['cb']);
|
1892 |
|
1893 |
// change to uniform format
|
1894 |
$uniform_columns = array();
|
1895 |
+
foreach ( (array) $columns as $id => $label ) {
|
1896 |
$hide_options = false;
|
1897 |
$type_label = $label;
|
1898 |
|
1901 |
$type_label = __('Comments', $this->textdomain);
|
1902 |
$hide_options = true;
|
1903 |
}
|
1904 |
+
|
1905 |
+
// user icon excerption
|
1906 |
+
if ( $id == 'icon' ) {
|
1907 |
+
$type_label = __('Icon', $this->textdomain);
|
1908 |
+
}
|
1909 |
+
|
1910 |
+
$uniform_colums[$id] = array(
|
1911 |
'label' => $label,
|
1912 |
+
'state' => 'on',
|
1913 |
'options' => array(
|
1914 |
'type_label' => $type_label,
|
1915 |
'hide_options' => $hide_options,
|
1916 |
'class' => 'cpac-box-wp-native',
|
1917 |
)
|
1918 |
);
|
1919 |
+
}
|
1920 |
+
return $uniform_colums;
|
1921 |
+
}
|
1922 |
+
|
1923 |
+
/**
|
1924 |
+
* Custom posts columns
|
1925 |
+
*
|
1926 |
+
* @since 1.0
|
1927 |
+
*/
|
1928 |
+
private function get_custom_posts_columns($post_type)
|
1929 |
+
{
|
1930 |
+
$custom_columns = array(
|
1931 |
+
'column-featured_image' => array(
|
1932 |
+
'label' => __('Featured Image', $this->textdomain)
|
1933 |
+
),
|
1934 |
+
'column-excerpt' => array(
|
1935 |
+
'label' => __('Excerpt', $this->textdomain)
|
1936 |
+
),
|
1937 |
+
'column-order' => array(
|
1938 |
+
'label' => __('Page Order', $this->textdomain)
|
1939 |
+
),
|
1940 |
+
'column-post_formats' => array(
|
1941 |
+
'label' => __('Post Format', $this->textdomain)
|
1942 |
+
),
|
1943 |
+
'column-postid' => array(
|
1944 |
+
'label' => __('ID', $this->textdomain)
|
1945 |
+
),
|
1946 |
+
'column-page-slug' => array(
|
1947 |
+
'label' => __('Slug', $this->textdomain)
|
1948 |
+
),
|
1949 |
+
'column-attachment' => array(
|
1950 |
+
'label' => __('Attachment', $this->textdomain)
|
1951 |
+
),
|
1952 |
+
'column-attachment-count' => array(
|
1953 |
+
'label' => __('No. of Attachments', $this->textdomain)
|
1954 |
+
),
|
1955 |
+
'column-roles' => array(
|
1956 |
+
'label' => __('Roles', $this->textdomain)
|
1957 |
+
),
|
1958 |
+
'column-status' => array(
|
1959 |
+
'label' => __('Status', $this->textdomain)
|
1960 |
+
),
|
1961 |
+
);
|
1962 |
+
|
1963 |
+
// Word count support
|
1964 |
+
if ( post_type_supports($post_type, 'editor') ) {
|
1965 |
+
$custom_columns['column-word-count'] = array(
|
1966 |
+
'label' => __('Word count', $this->textdomain)
|
1967 |
+
);
|
1968 |
+
}
|
1969 |
+
|
1970 |
+
// Sticky support
|
1971 |
+
if ( $post_type == 'post' ) {
|
1972 |
+
$custom_columns['column-sticky'] = array(
|
1973 |
+
'label' => __('Sticky', $this->textdomain)
|
1974 |
+
);
|
1975 |
+
}
|
1976 |
+
|
1977 |
+
// Order support
|
1978 |
+
if ( post_type_supports($post_type, 'page-attributes') ) {
|
1979 |
+
$custom_columns['column-order'] = array(
|
1980 |
+
'label' => __('Page Order', $this->textdomain),
|
1981 |
+
'options' => array(
|
1982 |
+
'type_label' => __('Order', $this->textdomain)
|
1983 |
+
)
|
1984 |
+
);
|
1985 |
+
}
|
1986 |
+
|
1987 |
+
// Page Template
|
1988 |
+
if ( $post_type == 'page' ) {
|
1989 |
+
$custom_columns['column-page-template'] = array(
|
1990 |
+
'label' => __('Page Template', $this->textdomain)
|
1991 |
+
);
|
1992 |
+
}
|
1993 |
+
|
1994 |
+
// Post Formats
|
1995 |
+
if ( post_type_supports($post_type, 'post-formats') ) {
|
1996 |
+
$custom_columns['column-post_formats'] = array(
|
1997 |
+
'label' => __('Post Format', $this->textdomain)
|
1998 |
+
);
|
1999 |
+
}
|
2000 |
+
|
2001 |
+
// Taxonomy support
|
2002 |
+
$taxonomies = get_object_taxonomies($post_type, 'objects');
|
2003 |
+
if ( $taxonomies ) {
|
2004 |
+
foreach ( $taxonomies as $tax_slug => $tax ) {
|
2005 |
+
if ( $tax_slug != 'post_tag' && $tax_slug != 'category' && $tax_slug != 'post_format' ) {
|
2006 |
+
$custom_columns['column-taxonomy-'.$tax->name] = array(
|
2007 |
+
'label' => $tax->label,
|
2008 |
+
'options' => array(
|
2009 |
+
'type_label' => __('Taxonomy', $this->textdomain),
|
2010 |
+
'sortorder' => false
|
2011 |
+
)
|
2012 |
+
);
|
2013 |
+
}
|
2014 |
+
}
|
2015 |
+
}
|
2016 |
+
|
2017 |
+
// Custom Field support
|
2018 |
+
if ( $this->get_meta_by_type($post_type) ) {
|
2019 |
+
$custom_columns['column-meta-1'] = array(
|
2020 |
+
'label' => __('Custom Field', $this->textdomain),
|
2021 |
+
'field' => '',
|
2022 |
+
'field_type' => '',
|
2023 |
+
'before' => '',
|
2024 |
+
'after' => '',
|
2025 |
+
'options' => array(
|
2026 |
+
'type_label' => __('Field', $this->textdomain),
|
2027 |
+
'class' => 'cpac-box-metafield'
|
2028 |
+
)
|
2029 |
+
);
|
2030 |
+
}
|
2031 |
+
|
2032 |
+
// merge with defaults
|
2033 |
+
$custom_columns = $this->parse_defaults($custom_columns);
|
2034 |
+
|
2035 |
+
return apply_filters('cpac-custom-posts-columns', $custom_columns);
|
2036 |
+
}
|
2037 |
+
|
2038 |
+
/**
|
2039 |
+
* Custom users columns
|
2040 |
+
*
|
2041 |
+
* @since 1.1
|
2042 |
+
*/
|
2043 |
+
private function get_custom_users_columns()
|
2044 |
+
{
|
2045 |
+
$custom_columns = array(
|
2046 |
+
'column-user_id' => array(
|
2047 |
+
'label' => __('User ID', $this->textdomain)
|
2048 |
+
),
|
2049 |
+
'column-nickname' => array(
|
2050 |
+
'label' => __('Nickname', $this->textdomain)
|
2051 |
+
),
|
2052 |
+
'column-first_name' => array(
|
2053 |
+
'label' => __('First name', $this->textdomain)
|
2054 |
+
),
|
2055 |
+
'column-last_name' => array(
|
2056 |
+
'label' => __('Last name', $this->textdomain)
|
2057 |
+
),
|
2058 |
+
'column-user_url' => array(
|
2059 |
+
'label' => __('Url', $this->textdomain)
|
2060 |
+
),
|
2061 |
+
'column-user_registered' => array(
|
2062 |
+
'label' => __('Registered', $this->textdomain)
|
2063 |
+
),
|
2064 |
+
'column-user_description' => array(
|
2065 |
+
'label' => __('Description', $this->textdomain)
|
2066 |
+
),
|
2067 |
+
);
|
2068 |
+
|
2069 |
+
// User total number of posts
|
2070 |
+
if ($this->get_post_types()) {
|
2071 |
+
foreach ( $this->get_post_types() as $post_type ) {
|
2072 |
+
$label = $this->get_plural_name($post_type);
|
2073 |
+
$custom_columns['column-user_postcount-'.$post_type] = array(
|
2074 |
+
'label' => __( sprintf('No. of %s',$label), $this->textdomain),
|
2075 |
+
'options' => array(
|
2076 |
+
'type_label' => __('Postcount', $this->textdomain)
|
2077 |
+
)
|
2078 |
+
);
|
2079 |
+
}
|
2080 |
+
}
|
2081 |
+
|
2082 |
+
// Custom Field support
|
2083 |
+
$custom_columns['column-meta-1'] = array(
|
2084 |
+
'label' => __('Custom Field', $this->textdomain),
|
2085 |
+
'field' => '',
|
2086 |
+
'field_type' => '',
|
2087 |
+
'before' => '',
|
2088 |
+
'after' => '',
|
2089 |
+
'options' => array(
|
2090 |
+
'type_label' => __('Field', $this->textdomain),
|
2091 |
+
'class' => 'cpac-box-metafield'
|
2092 |
+
)
|
2093 |
+
);
|
2094 |
+
|
2095 |
+
// merge with defaults
|
2096 |
+
$custom_columns = $this->parse_defaults($custom_columns);
|
2097 |
+
|
2098 |
+
return apply_filters('cpac-custom-users-columns', $custom_columns);
|
2099 |
+
}
|
2100 |
+
|
2101 |
+
/**
|
2102 |
+
* Custom media columns
|
2103 |
+
*
|
2104 |
+
* @since 1.3
|
2105 |
+
*/
|
2106 |
+
private function get_custom_media_columns()
|
2107 |
+
{
|
2108 |
+
$custom_columns = array(
|
2109 |
+
'column-mediaid' => array(
|
2110 |
+
'label' => __('ID', $this->textdomain)
|
2111 |
+
),
|
2112 |
+
'column-mime_type' => array(
|
2113 |
+
'label' => __('Mime type', $this->textdomain)
|
2114 |
+
),
|
2115 |
+
'column-file_name' => array(
|
2116 |
+
'label' => __('File name', $this->textdomain)
|
2117 |
+
),
|
2118 |
+
'column-dimensions' => array(
|
2119 |
+
'label' => __('Dimensions', $this->textdomain)
|
2120 |
+
),
|
2121 |
+
'column-height' => array(
|
2122 |
+
'label' => __('Height', $this->textdomain)
|
2123 |
+
),
|
2124 |
+
'column-width' => array(
|
2125 |
+
'label' => __('Width', $this->textdomain)
|
2126 |
+
),
|
2127 |
+
'column-caption' => array(
|
2128 |
+
'label' => __('Caption', $this->textdomain)
|
2129 |
+
),
|
2130 |
+
'column-description' => array(
|
2131 |
+
'label' => __('Description', $this->textdomain)
|
2132 |
+
),
|
2133 |
+
'column-alternate_text' => array(
|
2134 |
+
'label' => __('Alt', $this->textdomain)
|
2135 |
+
),
|
2136 |
+
'column-file_paths' => array(
|
2137 |
+
'label' => __('Upload paths', $this->textdomain),
|
2138 |
+
'options' => array(
|
2139 |
+
'sortorder' => false
|
2140 |
+
)
|
2141 |
+
),
|
2142 |
+
);
|
2143 |
+
|
2144 |
+
// merge with defaults
|
2145 |
+
$custom_columns = $this->parse_defaults($custom_columns);
|
2146 |
+
|
2147 |
+
return apply_filters('cpac-custom-media-columns', $custom_columns);
|
2148 |
+
}
|
2149 |
+
|
2150 |
+
/**
|
2151 |
+
* Custom links columns
|
2152 |
+
*
|
2153 |
+
* @since 1.3.1
|
2154 |
+
*/
|
2155 |
+
private function get_custom_links_columns()
|
2156 |
+
{
|
2157 |
+
$custom_columns = array(
|
2158 |
+
'column-link_id' => array (
|
2159 |
+
'label' => __('ID', $this->textdomain)
|
2160 |
+
),
|
2161 |
+
'column-description' => array (
|
2162 |
+
'label' => __('Description', $this->textdomain)
|
2163 |
+
),
|
2164 |
+
'column-image' => array(
|
2165 |
+
'label' => __('Image', $this->textdomain)
|
2166 |
+
),
|
2167 |
+
'column-target' => array(
|
2168 |
+
'label' => __('Target', $this->textdomain)
|
2169 |
+
),
|
2170 |
+
'column-owner' => array(
|
2171 |
+
'label' => __('Owner', $this->textdomain)
|
2172 |
+
),
|
2173 |
+
'column-notes' => array(
|
2174 |
+
'label' => __('Notes', $this->textdomain)
|
2175 |
+
),
|
2176 |
+
'column-rss' => array(
|
2177 |
+
'label' => __('Rss', $this->textdomain)
|
2178 |
+
),
|
2179 |
+
'column-length' => array(
|
2180 |
+
'label' => __('Length', $this->textdomain)
|
2181 |
+
)
|
2182 |
+
);
|
2183 |
+
|
2184 |
+
// merge with defaults
|
2185 |
+
$custom_columns = $this->parse_defaults($custom_columns);
|
2186 |
+
|
2187 |
+
return apply_filters('cpac-custom-links-columns', $custom_columns);
|
2188 |
+
}
|
2189 |
+
|
2190 |
+
/**
|
2191 |
+
* Custom comments columns
|
2192 |
+
*
|
2193 |
+
* @since 1.3.1
|
2194 |
+
*/
|
2195 |
+
private function get_custom_comments_columns()
|
2196 |
+
{
|
2197 |
+
$custom_columns = array(
|
2198 |
+
'column-comment_id' => array(
|
2199 |
+
'label' => __('ID', $this->textdomain)
|
2200 |
+
),
|
2201 |
+
'column-author_author' => array(
|
2202 |
+
'label' => __('Author Name', $this->textdomain)
|
2203 |
+
),
|
2204 |
+
'column-author_avatar' => array(
|
2205 |
+
'label' => __('Avatar', $this->textdomain)
|
2206 |
+
),
|
2207 |
+
'column-author_url' => array(
|
2208 |
+
'label' => __('Author url', $this->textdomain)
|
2209 |
+
),
|
2210 |
+
'column-author_ip' => array(
|
2211 |
+
'label' => __('Author IP', $this->textdomain)
|
2212 |
+
),
|
2213 |
+
'column-author_email' => array(
|
2214 |
+
'label' => __('Author email', $this->textdomain)
|
2215 |
+
),
|
2216 |
+
'column-reply_to' => array(
|
2217 |
+
'label' => __('In Reply To', $this->textdomain),
|
2218 |
+
|
2219 |
+
// options
|
2220 |
+
'options' => array(
|
2221 |
+
'sortorder' => false
|
2222 |
+
)
|
2223 |
+
),
|
2224 |
+
'column-approved' => array(
|
2225 |
+
'label' => __('Approved', $this->textdomain)
|
2226 |
+
),
|
2227 |
+
'column-date' => array(
|
2228 |
+
'label' => __('Date', $this->textdomain)
|
2229 |
+
),
|
2230 |
+
'column-date_gmt' => array(
|
2231 |
+
'label' => __('Date GMT', $this->textdomain)
|
2232 |
+
),
|
2233 |
+
'column-agent' => array(
|
2234 |
+
'label' => __('Agent', $this->textdomain)
|
2235 |
+
),
|
2236 |
+
'column-excerpt' => array(
|
2237 |
+
'label' => __('Excerpt', $this->textdomain)
|
2238 |
+
)
|
2239 |
+
);
|
2240 |
+
|
2241 |
+
// Custom Field support
|
2242 |
+
if ( $this->get_meta_by_type('wp-comments') ) {
|
2243 |
+
$custom_columns['column-meta-1'] = array(
|
2244 |
+
'label' => __('Custom Field', $this->textdomain),
|
2245 |
+
'field' => '',
|
2246 |
+
'field_type' => '',
|
2247 |
+
'before' => '',
|
2248 |
+
'after' => '',
|
2249 |
+
'options' => array(
|
2250 |
+
'type_label' => __('Field', $this->textdomain),
|
2251 |
+
'class' => 'cpac-box-metafield',
|
2252 |
+
'sortorder' => false,
|
2253 |
+
)
|
2254 |
+
);
|
2255 |
+
}
|
2256 |
|
2257 |
+
// merge with defaults
|
2258 |
+
$custom_columns = $this->parse_defaults($custom_columns);
|
2259 |
|
2260 |
+
return apply_filters('cpac-custom-comments-columns', $custom_columns);
|
2261 |
}
|
2262 |
+
|
2263 |
/**
|
2264 |
+
* Parse defaults
|
2265 |
*
|
2266 |
+
* @since 1.1
|
2267 |
*/
|
2268 |
+
private function parse_defaults($columns)
|
2269 |
{
|
|
|
|
|
2270 |
// default arguments
|
2271 |
+
$defaults = array(
|
2272 |
+
|
2273 |
+
// stored values
|
2274 |
'label' => '',
|
|
|
2275 |
'state' => '',
|
2276 |
+
'width' => '',
|
2277 |
|
2278 |
+
// static values
|
2279 |
+
'options' => array(
|
2280 |
+
'type_label' => __('Custom', $this->textdomain),
|
2281 |
'hide_options' => false,
|
2282 |
'class' => 'cpac-box-custom',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2283 |
'sortorder' => 'on',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2284 |
)
|
2285 |
+
);
|
2286 |
|
2287 |
+
// parse args
|
2288 |
+
foreach ( $columns as $k => $column ) {
|
2289 |
+
$c[$k] = wp_parse_args( $column, $defaults);
|
2290 |
+
|
2291 |
+
// parse options args
|
2292 |
+
if ( isset($column['options']) )
|
2293 |
+
$c[$k]['options'] = wp_parse_args( $column['options'], $defaults['options']);
|
2294 |
+
|
2295 |
+
// set type label
|
2296 |
+
if ( empty($column['options']['type_label']) && !empty($column['label']) )
|
2297 |
+
$c[$k]['options']['type_label'] = $column['label'];
|
2298 |
+
}
|
2299 |
|
2300 |
+
return $c;
|
2301 |
}
|
2302 |
|
2303 |
/**
|
2305 |
*
|
2306 |
* @since 1.0
|
2307 |
*/
|
2308 |
+
protected function get_stored_columns($type)
|
2309 |
{
|
2310 |
// get plugin options
|
2311 |
+
$options = get_option('cpac_options');
|
2312 |
|
2313 |
// get saved columns
|
2314 |
+
if ( isset($options['columns'][$type]) )
|
2315 |
+
return $options['columns'][$type];
|
2316 |
|
2317 |
return false;
|
2318 |
}
|
2322 |
*
|
2323 |
* @since 1.0
|
2324 |
*/
|
2325 |
+
private function get_menu()
|
2326 |
{
|
2327 |
// set
|
2328 |
$menu = '';
|
2329 |
$count = 1;
|
2330 |
|
2331 |
// referer
|
2332 |
+
$referer = ! empty($_REQUEST['cpac_type']) ? $_REQUEST['cpac_type'] : '';
|
|
|
|
|
2333 |
|
2334 |
// loop
|
2335 |
+
foreach ( $this->get_types() as $type ) {
|
2336 |
+
$label = $this->get_singular_name($type);
|
2337 |
+
$clean_label = $this->sanitize_string($type);
|
2338 |
|
2339 |
// divider
|
2340 |
$divider = $count++ == 1 ? '' : ' | ';
|
2341 |
|
2342 |
// current
|
2343 |
$current = '';
|
2344 |
+
if ( $this->is_menu_type_current($type) )
|
2345 |
$current = ' class="current"';
|
2346 |
|
2347 |
// menu list
|
2349 |
<li>{$divider}<a{$current} href='#cpac-box-{$clean_label}'>{$label}</a></li>
|
2350 |
";
|
2351 |
}
|
2352 |
+
|
2353 |
+
// settings url
|
2354 |
+
$class_current_settings = $this->is_menu_type_current('plugin_settings') ? ' current': '';
|
2355 |
+
|
2356 |
+
// options button
|
2357 |
+
$options_btn = "<a href='#cpac-box-plugin_settings' class='cpac-settings-link{$class_current_settings}'>".__('Addons')."</a>";
|
2358 |
+
//$options_btn = '';
|
2359 |
+
|
2360 |
return "
|
2361 |
<div class='cpac-menu'>
|
2362 |
<ul class='subsubsub'>
|
2363 |
{$menu}
|
2364 |
</ul>
|
2365 |
+
{$options_btn}
|
2366 |
</div>
|
2367 |
";
|
2368 |
}
|
2369 |
+
|
2370 |
+
/**
|
2371 |
+
* Checks if menu type is currently viewed
|
2372 |
+
*
|
2373 |
+
* @since 1.0
|
2374 |
+
*/
|
2375 |
+
private function is_menu_type_current( $type )
|
2376 |
+
{
|
2377 |
+
// referer
|
2378 |
+
$referer = ! empty($_REQUEST['cpac_type']) ? $_REQUEST['cpac_type'] : '';
|
2379 |
+
|
2380 |
+
// get label
|
2381 |
+
$clean_label = $this->sanitize_string($type);
|
2382 |
+
|
2383 |
+
// get first element from post-types
|
2384 |
+
$first = array_shift( array_values($this->post_types) );
|
2385 |
+
|
2386 |
+
// display the page that was being viewed before saving
|
2387 |
+
if ( $referer ) {
|
2388 |
+
if ( $referer == 'cpac-box-'.$clean_label ) {
|
2389 |
+
return true;
|
2390 |
+
}
|
2391 |
+
|
2392 |
+
// settings page has not yet been saved
|
2393 |
+
} elseif ( $first == $type ) {
|
2394 |
+
return true;
|
2395 |
+
}
|
2396 |
+
|
2397 |
+
return false;
|
2398 |
+
}
|
2399 |
+
|
2400 |
+
/**
|
2401 |
+
* Get singular name of post type
|
2402 |
+
*
|
2403 |
+
* @since 1.0
|
2404 |
+
*/
|
2405 |
+
private function get_singular_name( $type )
|
2406 |
+
{
|
2407 |
+
// Links
|
2408 |
+
if ( $type == 'wp-links' )
|
2409 |
+
$label = 'Links';
|
2410 |
+
|
2411 |
+
// Comments
|
2412 |
+
elseif ( $type == 'wp-comments' )
|
2413 |
+
$label = 'Comments';
|
2414 |
+
|
2415 |
+
// Users
|
2416 |
+
elseif ( $type == 'wp-users' )
|
2417 |
+
$label = 'Users';
|
2418 |
+
|
2419 |
+
// Media
|
2420 |
+
elseif ( $type == 'wp-media' )
|
2421 |
+
$label = 'Media Library';
|
2422 |
+
|
2423 |
+
// Posts
|
2424 |
+
else {
|
2425 |
+
$posttype_obj = get_post_type_object($type);
|
2426 |
+
$label = $posttype_obj->labels->singular_name;
|
2427 |
+
}
|
2428 |
+
|
2429 |
+
return $label;
|
2430 |
+
}
|
2431 |
+
|
2432 |
+
/**
|
2433 |
+
* Get plural name of post type
|
2434 |
+
*
|
2435 |
+
* @since 1.3.1
|
2436 |
+
*/
|
2437 |
+
private function get_plural_name( $type )
|
2438 |
+
{
|
2439 |
+
$posttype_obj = get_post_type_object($type);
|
2440 |
+
if ( $posttype_obj )
|
2441 |
+
return $posttype_obj->labels->name;
|
2442 |
+
|
2443 |
+
return false;
|
2444 |
+
}
|
2445 |
+
|
2446 |
+
/**
|
2447 |
+
* Get screen link to overview screen
|
2448 |
+
*
|
2449 |
+
* @since 1.3.1
|
2450 |
+
*/
|
2451 |
+
private function get_type_screen_link( $type )
|
2452 |
+
{
|
2453 |
+
// Links
|
2454 |
+
if ( $type == 'wp-comments' )
|
2455 |
+
$link = get_admin_url() . 'edit-comments.php';
|
2456 |
+
|
2457 |
+
// Links
|
2458 |
+
if ( $type == 'wp-links' )
|
2459 |
+
$link = get_admin_url() . 'link-manager.php';
|
2460 |
+
|
2461 |
+
// Users
|
2462 |
+
if ( $type == 'wp-users' )
|
2463 |
+
$link = get_admin_url() . 'users.php';
|
2464 |
+
|
2465 |
+
// Media
|
2466 |
+
elseif ( $type == 'wp-media' )
|
2467 |
+
$link = get_admin_url() . 'upload.php';
|
2468 |
+
|
2469 |
+
// Posts
|
2470 |
+
else
|
2471 |
+
$link = get_admin_url() . "edit.php?post_type={$type}";
|
2472 |
+
|
2473 |
+
return $link;
|
2474 |
+
}
|
2475 |
+
|
2476 |
+
/**
|
2477 |
+
* Sanitize label
|
2478 |
+
*
|
2479 |
+
* Uses intern wordpress function esc_url so it matches the label sorting url.
|
2480 |
+
*
|
2481 |
+
* @since 1.0
|
2482 |
+
*/
|
2483 |
+
protected function sanitize_string($string)
|
2484 |
+
{
|
2485 |
+
$string = esc_url($string);
|
2486 |
+
$string = str_replace('http://','', $string);
|
2487 |
+
$string = str_replace('https://','', $string);
|
2488 |
+
|
2489 |
+
return $string;
|
2490 |
+
}
|
2491 |
+
|
2492 |
+
/**
|
2493 |
+
* Get plugin url.
|
2494 |
+
*
|
2495 |
+
* @since 1.0
|
2496 |
+
*/
|
2497 |
+
private function plugin_url( $file = '' )
|
2498 |
+
{
|
2499 |
+
return plugins_url($file, __FILE__);
|
2500 |
+
}
|
2501 |
+
|
2502 |
+
/**
|
2503 |
+
* Checks if column-meta key exists
|
2504 |
+
*
|
2505 |
+
* @since 1.0
|
2506 |
+
*/
|
2507 |
+
protected function is_column_meta( $id = '' )
|
2508 |
+
{
|
2509 |
+
if ( strpos($id, 'column-meta-') !== false )
|
2510 |
+
return true;
|
2511 |
+
|
2512 |
+
return false;
|
2513 |
+
}
|
2514 |
+
|
2515 |
+
/**
|
2516 |
+
* Get the posttype from columnname
|
2517 |
+
*
|
2518 |
+
* @since 1.3.1
|
2519 |
+
*/
|
2520 |
+
protected function get_posttype_by_postcount_column( $id = '' )
|
2521 |
+
{
|
2522 |
+
if ( strpos($id, 'column-user_postcount-') !== false )
|
2523 |
+
return str_replace('column-user_postcount-', '', $id);
|
2524 |
+
|
2525 |
+
return false;
|
2526 |
+
}
|
2527 |
+
|
2528 |
+
/**
|
2529 |
+
* Get a thumbnail
|
2530 |
+
*
|
2531 |
+
* @since 1.0
|
2532 |
+
*/
|
2533 |
+
private function get_thumbnail( $image = '' )
|
2534 |
+
{
|
2535 |
+
if ( empty($image) )
|
2536 |
+
return false;
|
2537 |
+
|
2538 |
+
// get correct image path
|
2539 |
+
$image_path = str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $image);
|
2540 |
+
|
2541 |
+
// resize image
|
2542 |
+
if ( file_exists($image_path) && $this->is_image($image_path) ) {
|
2543 |
+
$resized = image_resize( $image_path, 80, 80, true);
|
2544 |
+
|
2545 |
+
if ( ! is_wp_error( $resized ) ) {
|
2546 |
+
$image = str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, $resized);
|
2547 |
+
|
2548 |
+
return "<img src='{$image}' alt='' width='80' height='80' />";
|
2549 |
+
}
|
2550 |
+
|
2551 |
+
return $resized->get_error_message();
|
2552 |
+
}
|
2553 |
+
|
2554 |
+
return false;
|
2555 |
+
}
|
2556 |
+
|
2557 |
+
/**
|
2558 |
+
* Get a thumbnail
|
2559 |
+
*
|
2560 |
+
* @since 1.3.1
|
2561 |
+
*/
|
2562 |
+
private function get_media_thumbnails($meta)
|
2563 |
+
{
|
2564 |
+
$meta = $this->strip_trim( str_replace(' ','', $meta) );
|
2565 |
+
|
2566 |
+
// split media ids
|
2567 |
+
$media_ids = array($meta);
|
2568 |
+
if ( strpos($meta, ',') !== false )
|
2569 |
+
$media_ids = explode(',', $meta);
|
2570 |
+
|
2571 |
+
// check if media exists
|
2572 |
+
$thumbs = '';
|
2573 |
+
foreach ( $media_ids as $media_id )
|
2574 |
+
if ( is_numeric($media_id) )
|
2575 |
+
$thumbs .= wp_get_attachment_url($media_id) ? "<span class='cpac-column-value-image'>".wp_get_attachment_image( $media_id, array(80,80), true )."</span>" : '';
|
2576 |
+
|
2577 |
+
return $thumbs;
|
2578 |
+
}
|
2579 |
+
|
2580 |
+
/**
|
2581 |
+
* Checks an URL for image extension
|
2582 |
+
*
|
2583 |
+
* @since 1.2
|
2584 |
+
*/
|
2585 |
+
private function is_image($url)
|
2586 |
+
{
|
2587 |
+
$validExt = array('.jpg', '.jpeg', '.gif', '.png', '.bmp');
|
2588 |
+
$ext = strrchr($url, '.');
|
2589 |
+
|
2590 |
+
return in_array($ext, $validExt);
|
2591 |
+
}
|
2592 |
+
|
2593 |
+
/**
|
2594 |
+
* Admin body class
|
2595 |
+
*
|
2596 |
+
* @since 1.4
|
2597 |
+
*/
|
2598 |
+
function admin_class()
|
2599 |
+
{
|
2600 |
+
global $current_screen;
|
2601 |
+
|
2602 |
+
// we dont need the 'edit-' part
|
2603 |
+
$screen = str_replace('edit-', '', $current_screen->id);
|
2604 |
+
|
2605 |
+
// media library exception
|
2606 |
+
if ( $current_screen->base == 'upload' && $current_screen->id == 'upload' ) {
|
2607 |
+
$screen = 'media';
|
2608 |
+
}
|
2609 |
+
|
2610 |
+
// link exception
|
2611 |
+
if ( $current_screen->base == 'link-manager' && $current_screen->id == 'link-manager' ) {
|
2612 |
+
$screen = 'links';
|
2613 |
+
}
|
2614 |
+
|
2615 |
+
// loop the available types
|
2616 |
+
foreach ( $this->get_types() as $type => $label ) {
|
2617 |
+
|
2618 |
+
// match against screen or wp-screen
|
2619 |
+
if ( $type == $screen || $type == "wp-{$screen}" )
|
2620 |
+
return "cp-{$type}";
|
2621 |
+
}
|
2622 |
+
return false;
|
2623 |
+
}
|
2624 |
+
|
2625 |
+
/**
|
2626 |
+
* Admin CSS for Column width
|
2627 |
+
*
|
2628 |
+
* @since 1.4
|
2629 |
+
*/
|
2630 |
+
function admin_css()
|
2631 |
+
{
|
2632 |
+
$css = '';
|
2633 |
+
|
2634 |
+
// loop throug the available types...
|
2635 |
+
foreach ( $this->get_types() as $type ) {
|
2636 |
+
$cols = $this->get_stored_columns($type);
|
2637 |
+
if ( $cols ) {
|
2638 |
+
|
2639 |
+
// loop through each available column...
|
2640 |
+
foreach ( $cols as $col_name => $col ) {
|
2641 |
+
|
2642 |
+
// and check for stored width and add it to the css
|
2643 |
+
if (!empty($col['width']) && is_numeric($col['width']) && $col['width'] > 0 ) {
|
2644 |
+
$css .= ".cp-{$type} .wrap table th.column-{$col_name} { width: {$col['width']}% !important; }";
|
2645 |
+
}
|
2646 |
+
}
|
2647 |
+
}
|
2648 |
+
}
|
2649 |
+
|
2650 |
+
echo "<style type='text/css'>{$css}</style>";
|
2651 |
+
}
|
2652 |
+
|
2653 |
+
|
2654 |
+
/**
|
2655 |
+
* Unlocks
|
2656 |
+
*
|
2657 |
+
* @since 1.3
|
2658 |
+
*/
|
2659 |
+
protected function is_unlocked($type)
|
2660 |
+
{
|
2661 |
+
if ( $this->check_remote_key($type) )
|
2662 |
+
return true;
|
2663 |
+
|
2664 |
+
return false;
|
2665 |
+
}
|
2666 |
+
|
2667 |
/**
|
2668 |
+
* Get license key
|
2669 |
*
|
2670 |
+
* @since 1.3
|
2671 |
*/
|
2672 |
+
private function get_license_key($type)
|
2673 |
{
|
2674 |
+
return get_option("cpac_{$type}_ac");
|
2675 |
+
}
|
2676 |
|
2677 |
+
/**
|
2678 |
+
* Set license key
|
2679 |
+
*
|
2680 |
+
* @since 1.3
|
2681 |
+
*/
|
2682 |
+
private function set_license_key($type, $key)
|
2683 |
+
{
|
2684 |
+
update_option( "cpac_{$type}_ac", $key);
|
2685 |
+
}
|
2686 |
+
|
2687 |
+
/**
|
2688 |
+
* Remove license key
|
2689 |
+
*
|
2690 |
+
* @since 1.3.1
|
2691 |
+
*/
|
2692 |
+
private function remove_license_key($type)
|
2693 |
+
{
|
2694 |
+
delete_option( "cpac_{$type}_ac" );
|
2695 |
+
delete_transient("cpac_{$type}_trnsnt");
|
2696 |
+
}
|
2697 |
+
|
2698 |
+
/**
|
2699 |
+
* Check license key with API
|
2700 |
+
*
|
2701 |
+
* @since 1.3.3
|
2702 |
+
*/
|
2703 |
+
private function check_remote_key($type)
|
2704 |
+
{
|
2705 |
+
$result = false;
|
2706 |
|
2707 |
+
// set
|
2708 |
+
$key = $this->get_license_key($type);
|
|
|
2709 |
|
2710 |
+
if ( empty($key) )
|
2711 |
+
return false;
|
2712 |
|
2713 |
+
// get transient
|
2714 |
+
$transient = get_transient("cpac_{$type}_trnsnt");
|
|
|
|
|
|
|
2715 |
|
2716 |
+
if ( $transient != false )
|
|
|
2717 |
return true;
|
|
|
2718 |
|
2719 |
+
// check key with remote API
|
2720 |
+
$response = wp_remote_post( $this->api_url, array(
|
2721 |
+
'body' => array(
|
2722 |
+
'api' => 'addon',
|
2723 |
+
'key' => $key,
|
2724 |
+
'type' => $type,
|
2725 |
+
'url' => get_bloginfo('url')
|
2726 |
+
)
|
2727 |
+
));
|
2728 |
+
|
2729 |
+
// license will be valid in case of WP error or succes
|
2730 |
+
if ( is_wp_error($response) || ( isset($response['body']) && json_decode($response['body']) == 'valid' ) )
|
2731 |
+
$result = true;
|
2732 |
+
|
2733 |
+
// set transient
|
2734 |
+
set_transient("cpac_{$type}_trnsnt", $result, 86400);
|
2735 |
+
|
2736 |
+
return $result;
|
2737 |
}
|
2738 |
+
|
2739 |
/**
|
2740 |
+
* Set masked license key
|
2741 |
*
|
2742 |
+
* @since 1.3.1
|
2743 |
*/
|
2744 |
+
private function get_masked_license_key($type)
|
2745 |
{
|
2746 |
+
return '**************************'.substr( $this->get_license_key($type), -4 );
|
|
|
|
|
2747 |
}
|
2748 |
+
|
2749 |
+
/**
|
2750 |
+
* Ajax activation
|
2751 |
+
*
|
2752 |
+
* @since 1.3.1
|
2753 |
+
*/
|
2754 |
+
public function ajax_activation()
|
2755 |
+
{
|
2756 |
+
// keys
|
2757 |
+
$key = $_POST['key'];
|
2758 |
+
$type = $_POST['type'];
|
2759 |
+
|
2760 |
+
// update key
|
2761 |
+
if ( $key == 'remove' )
|
2762 |
+
$this->remove_license_key($type);
|
2763 |
+
else
|
2764 |
+
$this->set_license_key($type, $key);
|
2765 |
+
|
2766 |
+
// validate and return masked key
|
2767 |
+
if ( $this->is_unlocked($type) )
|
2768 |
+
echo json_encode( $this->get_masked_license_key($type) );
|
2769 |
|
2770 |
+
exit;
|
2771 |
+
}
|
2772 |
+
|
2773 |
/**
|
2774 |
+
* Strip tags and trim
|
2775 |
*
|
2776 |
+
* @since 1.3
|
2777 |
+
*/
|
2778 |
+
protected function strip_trim($string)
|
2779 |
+
{
|
2780 |
+
return trim(strip_tags($string));
|
2781 |
+
}
|
2782 |
+
|
2783 |
+
/**
|
2784 |
+
* Get date
|
2785 |
+
*
|
2786 |
+
* @since 1.3.1
|
2787 |
*/
|
2788 |
+
protected function get_date($date)
|
2789 |
{
|
2790 |
+
if ( ! $date )
|
2791 |
+
return false;
|
|
|
2792 |
|
2793 |
+
if ( ! is_numeric($date) )
|
2794 |
+
$date = strtotime($date);
|
2795 |
+
|
2796 |
+
return date_i18n( get_option('date_format'), $date );
|
2797 |
+
}
|
2798 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2799 |
/**
|
2800 |
+
* Get time
|
2801 |
*
|
2802 |
+
* @since 1.3.1
|
2803 |
+
*/
|
2804 |
+
protected function get_time($date)
|
2805 |
+
{
|
2806 |
+
if ( ! $date )
|
2807 |
+
return false;
|
2808 |
+
|
2809 |
+
if ( ! is_numeric($date) )
|
2810 |
+
$date = strtotime($date);
|
2811 |
+
|
2812 |
+
return date_i18n( get_option('time_format'), $date );
|
2813 |
+
}
|
2814 |
+
|
2815 |
+
/**
|
2816 |
+
* Admin notices
|
2817 |
*
|
2818 |
+
* @since 1.3.1
|
2819 |
*/
|
2820 |
+
private function admin_notice($message = '', $type = 'updated')
|
2821 |
{
|
2822 |
+
$this->notice_message = $message;
|
2823 |
+
$this->notice_type = $type; // updated, error
|
2824 |
+
|
2825 |
+
add_action('admin_notices', array( $this, 'callback_admin_notice' ) );
|
2826 |
}
|
2827 |
|
2828 |
/**
|
2829 |
+
* Output Notice
|
2830 |
*
|
2831 |
+
* @since 1.3.1
|
2832 |
*/
|
2833 |
+
public function callback_admin_notice()
|
2834 |
+
{
|
2835 |
+
echo "<div class='{$this->notice_type}' id='message'><p>{$this->notice_message}</p></div>";
|
2836 |
+
}
|
2837 |
+
|
2838 |
+
/**
|
2839 |
+
* Add help tabs
|
2840 |
+
*
|
2841 |
+
* @since 1.3
|
2842 |
+
*/
|
2843 |
+
public function help_tabs($page)
|
2844 |
{
|
2845 |
+
$screen = get_current_screen();
|
2846 |
+
|
2847 |
+
if ( $screen->id != $this->admin_page || ! method_exists($screen,'add_help_tab') )
|
2848 |
+
return;
|
2849 |
+
|
2850 |
+
$admin_url = get_admin_url();
|
2851 |
+
|
2852 |
+
// add help content
|
2853 |
+
$tabs = array(
|
2854 |
+
array(
|
2855 |
+
'title' => 'Overview',
|
2856 |
+
'content' => "
|
2857 |
+
<h5>Codepress Admin Columns</h5>
|
2858 |
+
<p>
|
2859 |
+
This plugin is for adding and removing additional columns to the administration screens for post(types), pages, media library, comments, links and users. Change the column's label and reorder them.
|
2860 |
+
</p>
|
2861 |
+
|
2862 |
+
"
|
2863 |
+
),
|
2864 |
+
array(
|
2865 |
+
'title' => 'Basics',
|
2866 |
+
'content' => "
|
2867 |
+
<h5>Show / Hide</h5>
|
2868 |
+
<p>
|
2869 |
+
You can switch columns on or off by cliking on the checkbox. This will show or hide each column heading.
|
2870 |
+
</p>
|
2871 |
+
<h5>Change order</h5>
|
2872 |
+
<p>
|
2873 |
+
By dragging the columns you can change the order which they will appear in.
|
2874 |
+
</p>
|
2875 |
+
<h5>Change label</h5>
|
2876 |
+
<p>
|
2877 |
+
By clicking on the triangle you will see the column options. Here you can change each label of the columns heading.
|
2878 |
+
</p>
|
2879 |
+
<h5>Change coluimn width</h5>
|
2880 |
+
<p>
|
2881 |
+
By clicking on the triangle you will see the column options. By using the draggable slider yo can set the width of the columns in percentages.
|
2882 |
+
</p>
|
2883 |
+
"
|
2884 |
+
),
|
2885 |
+
array(
|
2886 |
+
'title' => 'Custom Field',
|
2887 |
+
'content' => "
|
2888 |
+
<h5>'Custom Field' column</h5>
|
2889 |
+
<p>
|
2890 |
+
The custom field colum uses the custom fields from posts and users. There are 8 types which you can set.
|
2891 |
+
</p>
|
2892 |
+
<ul>
|
2893 |
+
<li><strong>Default</strong><br/>Value: Can be either a string or array. Arrays will be flattened and values are seperated by a ',' comma.</li>
|
2894 |
+
<li><strong>Image</strong><br/>Value: should only contain an image URL.</li>
|
2895 |
+
<li><strong>Media Library Icon</strong><br/>Value: should only contain Attachment IDs ( seperated by ',' ).</li>
|
2896 |
+
<li><strong>Excerpt</strong><br/>Value: This will show the first 20 words of the Post content.</li>
|
2897 |
+
<li><strong>Multiple Values</strong><br/>Value: should be an array. This will flatten any ( multi dimensional ) array.</li>
|
2898 |
+
<li><strong>Numeric</strong><br/>Value: Integers only.<br/>If you have the 'sorting addon' this will be used for sorting, so you can sort your posts on numeric (custom field) values.</li>
|
2899 |
+
<li><strong>Date</strong><br/>Value: Can be unix time stamp of date format as described in the <a href='http://codex.wordpress.org/Formatting_Date_and_Time'>Codex</a>. You can change the outputted date format at the <a href='{$admin_url}options-general.php'>general settings</a> page.</li>
|
2900 |
+
<li><strong>Post Titles</strong><br/>Value: can be one or more Post ID's (seperated by ',').</li>
|
2901 |
+
</ul>
|
2902 |
+
"
|
2903 |
+
)
|
2904 |
+
);
|
2905 |
+
|
2906 |
+
foreach ( $tabs as $k => $tab ) {
|
2907 |
+
$screen->add_help_tab(array(
|
2908 |
+
'id' => 'cpac-tab-'.$k, // unique id
|
2909 |
+
'title' => $tab['title'], // label
|
2910 |
+
'content' => $tab['content'], // body
|
2911 |
+
));
|
2912 |
+
}
|
2913 |
}
|
2914 |
|
2915 |
/**
|
2916 |
+
* Activation settings
|
2917 |
+
*
|
2918 |
+
* @since 1.3.1
|
2919 |
+
*/
|
2920 |
+
private function activation_settings()
|
2921 |
+
{
|
2922 |
+
$class_current_settings = $this->is_menu_type_current('plugin_settings') ? ' current' : ' hidden'; '';
|
2923 |
+
|
2924 |
+
/** Sortable */
|
2925 |
+
$masked_key = '';
|
2926 |
+
$class_sortorder_activate = '';
|
2927 |
+
$class_sortorder_deactivate = ' hidden';
|
2928 |
+
|
2929 |
+
// is unlocked
|
2930 |
+
if ( $this->is_unlocked('sortable') ) {
|
2931 |
+
$masked_key = $this->get_masked_license_key('sortable');
|
2932 |
+
$class_sortorder_activate = ' hidden';
|
2933 |
+
$class_sortorder_deactivate = '';
|
2934 |
+
}
|
2935 |
+
|
2936 |
+
// find out more
|
2937 |
+
$find_out_more = "<a href='{$this->codepress_url}/sortorder-addon/' class='button-primary alignright' target='_blank'>".__('find out more', $this->textdomain)." »</a>";
|
2938 |
+
|
2939 |
+
// info box
|
2940 |
+
$sortable_tooltip = "
|
2941 |
+
<p>".__('This will make all of the new columns support sorting', $this->textdomain).".</p>
|
2942 |
+
<p>".__('By default WordPress let\'s you sort by title, date, comments and author. This will make you be able to <strong>sort by any column of any type!</strong>', $this->textdomain)."</p>
|
2943 |
+
<p>".__('Perfect for sorting your articles, media files, comments, links and users', $this->textdomain).".</p>
|
2944 |
+
<img src='" . $this->plugin_url('/assets/images/addon_sortable_1.png') . "' alt='' />
|
2945 |
+
{$find_out_more}
|
2946 |
+
";
|
2947 |
+
|
2948 |
+
// markup
|
2949 |
+
$sortable = "
|
2950 |
+
<tr id='cpac-activation-sortable' class='last'>
|
2951 |
+
<td class='activation_type'>
|
2952 |
+
<span>" . __('Sortorder', $this->textdomain) . "</span>
|
2953 |
+
<div class='cpac-tooltip hidden'>
|
2954 |
+
<div class='qtip_title'>" . __('Sortorder', $this->textdomain) . "</div>
|
2955 |
+
<div class='qtip_content'>
|
2956 |
+
<p>" . __($sortable_tooltip, $this->textdomain) . "</p>
|
2957 |
+
</div>
|
2958 |
+
</div>
|
2959 |
+
</td>
|
2960 |
+
<td class='activation_status'>
|
2961 |
+
<div class='activate{$class_sortorder_activate}'>
|
2962 |
+
" . __('Inactive', $this->textdomain) . "
|
2963 |
+
</div>
|
2964 |
+
<div class='deactivate{$class_sortorder_deactivate}'>
|
2965 |
+
" . __('Active', $this->textdomain) . "
|
2966 |
+
</div>
|
2967 |
+
</td>
|
2968 |
+
<td class='activation_code'>
|
2969 |
+
<div class='activate{$class_sortorder_activate}'>
|
2970 |
+
<input type='text' value='" . __('Fill in your activation code', $this->textdomain) . "' name='cpac-sortable-key'>
|
2971 |
+
<a href='javascript:;' class='button'>" . __('Activate', $this->textdomain) . "<span></span></a>
|
2972 |
+
</div>
|
2973 |
+
<div class='deactivate{$class_sortorder_deactivate}'>
|
2974 |
+
<span class='masked_key'>{$masked_key}</span>
|
2975 |
+
<a href='javascript:;' class='button'>" . __('Deactivate', $this->textdomain) . "<span></span></a>
|
2976 |
+
</div>
|
2977 |
+
<div class='activation-error-msg'></div>
|
2978 |
+
</td>
|
2979 |
+
<td class='activation_more'>{$find_out_more}</td>
|
2980 |
+
</tr><!-- #cpac-activation-sortable -->
|
2981 |
+
";
|
2982 |
+
|
2983 |
+
// settings
|
2984 |
+
$row = "
|
2985 |
+
<tr id='cpac-box-plugin_settings' valign='top' class='cpac-box-row {$class_current_settings}'>
|
2986 |
+
<td colspan='2'>
|
2987 |
+
<table class='nopadding'>
|
2988 |
+
<tr class='last'>
|
2989 |
+
<td>
|
2990 |
+
<h2>".__('Activate Add-ons', $this->textdomain)."</h2>
|
2991 |
+
<p>".__('Add-ons can be unlocked by purchasing a license key. Each key can be used on multiple sites', $this->textdomain)." <a target='_blank' href='{$this->codepress_url}/sortorder-addon/'>Visit the Plugin Store</a>.</p>
|
2992 |
+
<table class='widefat addons'>
|
2993 |
+
<thead>
|
2994 |
+
<tr>
|
2995 |
+
<th class='activation_type'>".__('Addon', $this->textdomain)."</th>
|
2996 |
+
<th class='activation_status'>".__('Status', $this->textdomain)."</th>
|
2997 |
+
<th class='activation_code'>".__('Activation Code', $this->textdomain)."</th>
|
2998 |
+
<th class='activation_more'></th>
|
2999 |
+
</tr>
|
3000 |
+
</thead>
|
3001 |
+
<tbody>
|
3002 |
+
{$sortable}
|
3003 |
+
</tbody>
|
3004 |
+
</table>
|
3005 |
+
<div class='addon-translation-string hidden'>
|
3006 |
+
<span class='tstring-fill-in'>" . __('Enter your activation code', $this->textdomain) . "</span>
|
3007 |
+
<span class='tstring-unrecognised'>" . __('Activation code unrecognised', $this->textdomain) . "</span>
|
3008 |
+
</div>
|
3009 |
+
</td>
|
3010 |
+
</tr>
|
3011 |
+
<!--
|
3012 |
+
<tr class='last'>
|
3013 |
+
<td colspan='2'>
|
3014 |
+
<h2>Options</h2>
|
3015 |
+
<ul class='cpac-options'>
|
3016 |
+
<li>
|
3017 |
+
<div class='cpac-option-label'>Thumbnail size</div>
|
3018 |
+
<div class='cpac-option-inputs'>
|
3019 |
+
<input type='text' id='thumbnail_size_w' class='small-text' name='cpac_options[settings][thumb_width]' value='80'/>
|
3020 |
+
<label for='thumbnail_size_w'>Width</label>
|
3021 |
+
<br/>
|
3022 |
+
<input type='text' id='thumbnail_size_h' class='small-text' name='cpac_options[settings][thumb_height]' value='80'/>
|
3023 |
+
<label for='thumbnail_size_h'>Height</label>
|
3024 |
+
</div>
|
3025 |
+
</li>
|
3026 |
+
<li>
|
3027 |
+
<div class='cpac-option-label'>Excerpt length</div>
|
3028 |
+
<div class='cpac-option-inputs'>
|
3029 |
+
|
3030 |
+
<input type='text' id='excerpt_length' class='small-text' name='cpac_options[settings][excerpt_length]' value='15'/>
|
3031 |
+
<label for='excerpt_length'>Number of words</label>
|
3032 |
+
</div>
|
3033 |
+
</li>
|
3034 |
+
</ul>
|
3035 |
+
</td>
|
3036 |
+
</tr>
|
3037 |
+
-->
|
3038 |
+
</table>
|
3039 |
+
</td>
|
3040 |
+
</tr><!-- #cpac-box-plugin_settings -->
|
3041 |
+
";
|
3042 |
+
|
3043 |
+
return $row;
|
3044 |
+
}
|
3045 |
+
|
3046 |
+
/**
|
3047 |
+
* Settings Page Template.
|
3048 |
+
*
|
3049 |
+
* This function in conjunction with others usei the WordPress
|
3050 |
+
* Settings API to create a settings page where users can adjust
|
3051 |
+
* the behaviour of this plugin.
|
3052 |
*
|
3053 |
* @since 1.0
|
3054 |
*/
|
3055 |
+
public function plugin_settings_page()
|
3056 |
+
{
|
3057 |
+
|
3058 |
+
// loop through post types
|
3059 |
+
$rows = '';
|
3060 |
+
foreach ( $this->get_types() as $type ) {
|
3061 |
|
3062 |
+
// post type label
|
3063 |
+
$label = $this->get_singular_name($type);
|
3064 |
+
|
3065 |
+
// screen link
|
3066 |
+
$screen_link = '';
|
3067 |
+
//$screen_link = $this->get_type_screen_link($type);
|
3068 |
+
//$screen_link = "<a href='{$screen_link}' class='go-to-screen'>" . sprintf( __('go to %s screen'), strtolower($label) ) . "</a>";
|
3069 |
+
|
3070 |
+
// id
|
3071 |
+
$id = $this->sanitize_string($type);
|
3072 |
+
|
3073 |
+
// build draggable boxes
|
3074 |
+
$boxes = $this->get_column_boxes($type);
|
3075 |
+
|
3076 |
+
// class
|
3077 |
+
$class = $this->is_menu_type_current($type) ? ' current' : ' hidden';
|
3078 |
+
|
3079 |
+
$rows .= "
|
3080 |
+
<tr id='cpac-box-{$id}' valign='top' class='cpac-box-row{$class}'>
|
3081 |
+
<th class='cpac_post_type' scope='row'>
|
3082 |
+
{$label}{$screen_link}
|
3083 |
+
</th>
|
3084 |
+
<td>
|
3085 |
+
<h3 class='cpac_post_type hidden'>{$label}</h3>
|
3086 |
+
{$boxes}
|
3087 |
+
</td>
|
3088 |
+
</tr>
|
3089 |
+
";
|
3090 |
+
}
|
3091 |
+
|
3092 |
+
// Activation
|
3093 |
+
$activation_settings = $this->activation_settings();
|
3094 |
+
|
3095 |
+
// Post Type Menu
|
3096 |
+
$menu = $this->get_menu();
|
3097 |
|
3098 |
+
// Help screen message
|
3099 |
+
$help_text = '';
|
3100 |
+
if ( version_compare( get_bloginfo('version'), '3.2', '>' ) )
|
3101 |
+
$help_text = '<p>'.__('You will find a short overview at the <strong>Help</strong> section in the top-right screen.', $this->textdomain).'</p>';
|
3102 |
+
|
3103 |
+
// find out more
|
3104 |
+
$find_out_more = "<a href='{$this->codepress_url}/sortorder-addon/' class='alignright green' target='_blank'>".__('find out more', $this->textdomain)." »</a>";
|
3105 |
+
|
3106 |
+
?>
|
3107 |
+
<div id="cpac" class="wrap">
|
3108 |
+
<?php screen_icon($this->slug) ?>
|
3109 |
+
<h2><?php _e('Codepress Admin Columns', $this->textdomain); ?></h2>
|
3110 |
+
<?php echo $menu ?>
|
3111 |
|
3112 |
+
<div class="postbox-container cpac-col-right">
|
3113 |
+
<div class="metabox-holder">
|
3114 |
+
<div class="meta-box-sortables">
|
3115 |
+
|
3116 |
+
<div id="addons-cpac-settings" class="postbox">
|
3117 |
+
<div title="Click to toggle" class="handlediv"><br></div>
|
3118 |
+
<h3 class="hndle">
|
3119 |
+
<span><?php _e('Addons', $this->textdomain) ?></span>
|
3120 |
+
</h3>
|
3121 |
+
<div class="inside">
|
3122 |
+
<p><?php _e('By default WordPress let\'s you only sort by title, date, comments and author.', $this->textdomain) ?></p>
|
3123 |
+
<p><?php _e('Make <strong>all columns</strong> of <strong>all types</strong> support sorting — with the sorting addon.', $this->textdomain) ?></p>
|
3124 |
+
<?php echo $find_out_more ?>
|
3125 |
+
</div>
|
3126 |
+
</div><!-- addons-cpac-settings -->
|
3127 |
+
|
3128 |
+
<div id="likethisplugin-cpac-settings" class="postbox">
|
3129 |
+
<div title="Click to toggle" class="handlediv"><br></div>
|
3130 |
+
<h3 class="hndle">
|
3131 |
+
<span><?php _e('Like this plugin?', $this->textdomain) ?></span>
|
3132 |
+
</h3>
|
3133 |
+
<div class="inside">
|
3134 |
+
<p><?php _e('Why not do any or all of the following', $this->textdomain) ?>:</p>
|
3135 |
+
<ul>
|
3136 |
+
<li><a href="<?php echo $this->codepress_url ?>/"><?php _e('Link to it so other folks can find out about it.', $this->textdomain) ?></a></li>
|
3137 |
+
<li><a href="<?php echo $this->wordpress_url ?>"><?php _e('Give it a 5 star rating on WordPress.org.', $this->textdomain) ?></a></li>
|
3138 |
+
<li class="donate_link"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZDZRSYLQ4Z76J"><?php _e('Donate a token of your appreciation.', $this->textdomain) ?></a></li>
|
3139 |
+
</ul>
|
3140 |
+
</div>
|
3141 |
+
</div><!-- likethisplugin-cpac-settings -->
|
3142 |
+
|
3143 |
+
<div id="side-cpac-settings" class="postbox">
|
3144 |
+
<div title="Click to toggle" class="handlediv"><br></div>
|
3145 |
+
<h3 class="hndle">
|
3146 |
+
<span><?php _e('Need support?', $this->textdomain) ?></span>
|
3147 |
+
</h3>
|
3148 |
+
<div class="inside">
|
3149 |
+
<?php echo $help_text ?>
|
3150 |
+
<p><?php printf(__('If you are having problems with this plugin, please talk about them in the <a href="%s">Support forums</a> or send me an email %s.', $this->textdomain), 'http://wordpress.org/tags/codepress-admin-columns', '<a href="mailto:info@codepress.nl">info@codepress.nl</a>' );?></p>
|
3151 |
+
<p><?php printf(__("If you're sure you've found a bug, or have a feature request, please <a href='%s'>submit your feedback</a>.", $this->textdomain), "{$this->codepress_url}/feedback");?></p>
|
3152 |
+
</div>
|
3153 |
+
</div><!-- side-cpac-settings -->
|
3154 |
+
|
3155 |
+
</div>
|
3156 |
+
</div>
|
3157 |
+
</div><!-- .postbox-container -->
|
3158 |
+
|
3159 |
+
<div class="postbox-container cpac-col-left">
|
3160 |
+
<div class="metabox-holder">
|
3161 |
+
<div class="meta-box-sortables">
|
3162 |
+
|
3163 |
+
<div id="general-cpac-settings" class="postbox">
|
3164 |
+
<div title="Click to toggle" class="handlediv"><br></div>
|
3165 |
+
<h3 class="hndle">
|
3166 |
+
<span><?php _e('Admin Columns', $this->textdomain ); ?></span>
|
3167 |
+
</h3>
|
3168 |
+
<div class="inside">
|
3169 |
+
<form method="post" action="options.php">
|
3170 |
+
|
3171 |
+
<?php settings_fields( 'cpac-settings-group' ); ?>
|
3172 |
+
|
3173 |
+
<table class="form-table">
|
3174 |
+
<!-- columns -->
|
3175 |
+
<?php echo $rows; ?>
|
3176 |
+
|
3177 |
+
<!-- activation -->
|
3178 |
+
<?php echo $activation_settings; ?>
|
3179 |
+
|
3180 |
+
<tr class="bottom" valign="top">
|
3181 |
+
<th scope="row"></th>
|
3182 |
+
<td>
|
3183 |
+
<p class="submit">
|
3184 |
+
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
3185 |
+
</p>
|
3186 |
+
</td>
|
3187 |
+
</tr>
|
3188 |
+
</table>
|
3189 |
+
</form>
|
3190 |
+
</div>
|
3191 |
+
</div><!-- general-settings -->
|
3192 |
+
|
3193 |
+
<div id="restore-cpac-settings" class="postbox">
|
3194 |
+
<div title="Click to toggle" class="handlediv"><br></div>
|
3195 |
+
<h3 class="hndle">
|
3196 |
+
<span><?php _e('Restore defaults', $this->textdomain) ?></span>
|
3197 |
+
</h3>
|
3198 |
+
<div class="inside">
|
3199 |
+
<form method="post" action="">
|
3200 |
+
<input type="submit" class="button" name="cpac-restore-defaults" value="<?php _e('Restore default settings', $this->textdomain ) ?>" onclick="return confirm('<?php _e("Warning! ALL saved admin columns data will be deleted. This cannot be undone. \'OK\' to delete, \'Cancel\' to stop", $this->textdomain); ?>');" />
|
3201 |
+
</form>
|
3202 |
+
<p class="description"><?php _e('This will delete all column settings and restore the default settings.', $this->textdomain); ?></p>
|
3203 |
+
</div>
|
3204 |
+
</div><!-- restore-cpac-settings -->
|
3205 |
+
|
3206 |
+
</div>
|
3207 |
+
</div>
|
3208 |
+
</div><!-- .postbox-container -->
|
3209 |
+
</div>
|
3210 |
+
<?php
|
3211 |
+
}
|
3212 |
}
|
3213 |
+
|
3214 |
+
/**
|
3215 |
+
* Init Class Codepress_Admin_Columns
|
3216 |
+
*
|
3217 |
+
* @since 1.0
|
3218 |
+
*/
|
3219 |
+
new Codepress_Admin_Columns();
|
3220 |
+
|
3221 |
+
|
3222 |
+
/**
|
3223 |
+
* Init Class Codepress_Sortable_Columns
|
3224 |
+
*
|
3225 |
+
* @since 1.3
|
3226 |
+
*/
|
3227 |
+
new Codepress_Sortable_Columns();
|
3228 |
+
|
3229 |
?>
|
languages/codepress-admin-columns-nl_NL.mo
CHANGED
Binary file
|
languages/codepress-admin-columns-nl_NL.po
CHANGED
@@ -2,9 +2,9 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Codepress Admin Columns\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2011-
|
6 |
-
"PO-Revision-Date:
|
7 |
-
"Last-Translator:
|
8 |
"Language-Team: Codepress <info@codepress.nl>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
@@ -17,292 +17,342 @@ msgstr ""
|
|
17 |
"X-Poedit-SearchPath-0: .\n"
|
18 |
"X-Poedit-SearchPath-1: ..\n"
|
19 |
|
20 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
21 |
msgid "Settings"
|
22 |
msgstr "Instellingen"
|
23 |
|
24 |
-
#: ../codepress-admin-columns.php:
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
#: ../codepress-admin-columns.php:234
|
29 |
-
msgid "Admin Columns"
|
30 |
-
msgstr ""
|
31 |
-
|
32 |
-
#: ../codepress-admin-columns.php:249
|
33 |
-
msgid "Save Changes"
|
34 |
-
msgstr "Wijzigingen opslaan"
|
35 |
-
|
36 |
-
#: ../codepress-admin-columns.php:261
|
37 |
-
msgid "Restore defaults"
|
38 |
-
msgstr "Herstel instellingen"
|
39 |
-
|
40 |
-
#: ../codepress-admin-columns.php:265
|
41 |
-
msgid "Restore default settings"
|
42 |
-
msgstr "Herstel standaard instellingen"
|
43 |
-
|
44 |
-
#: ../codepress-admin-columns.php:265
|
45 |
-
msgid "Warning! ALL saved admin columns data will be deleted. This cannot be undone. \\'OK\\' to delete, \\'Cancel\\' to stop"
|
46 |
-
msgstr "Waarschuwing! ALLE bewaarde instellingen worden verwijderd. Dit kan niet worden ongedaan. \\'OK\\' om te verwijderen, \\'Annuleren\\' om te stoppen"
|
47 |
-
|
48 |
-
#: ../codepress-admin-columns.php:267
|
49 |
-
msgid "This will delete all column settings and restore the default settings."
|
50 |
-
msgstr "Hiermee worden alle kolommen instellingen verwijderd en de standaardinstellingen hersteld."
|
51 |
-
|
52 |
-
#: ../codepress-admin-columns.php:282
|
53 |
-
msgid "Need support?"
|
54 |
-
msgstr "Hulp nodig?"
|
55 |
-
|
56 |
-
#: ../codepress-admin-columns.php:285
|
57 |
-
#, php-format
|
58 |
-
msgid "If you are having problems with this plugin, please talk about them in the <a href=\"%s\">Support forums</a>."
|
59 |
-
msgstr "Als je problem hebt met deze plugin, stel je vragen dan in de <a href=\"%s\">Support forums</a>."
|
60 |
-
|
61 |
-
#: ../codepress-admin-columns.php:286
|
62 |
-
#, php-format
|
63 |
-
msgid "If you're sure you've found a bug, or have a feature request, please <a href='%s'>submit your feedback</a>."
|
64 |
-
msgstr "Als een bug bent tegen gekomen, of een feature wil aanvragen, stuur ons dan <a href='%s'>je feedback</a>."
|
65 |
-
|
66 |
-
#: ../codepress-admin-columns.php:324
|
67 |
msgid "Add Custom Field Column"
|
68 |
msgstr "Voeg custom field kolom toe"
|
69 |
|
70 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
msgid "Default"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: ../codepress-admin-columns.php:
|
75 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
|
|
|
|
76 |
msgid "Image"
|
77 |
msgstr "Afbeelding"
|
78 |
|
79 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
80 |
msgid "Media Library Icon"
|
81 |
msgstr "Media bibliotheek Icoon"
|
82 |
|
83 |
-
#: ../codepress-admin-columns.php:
|
84 |
-
#: ../codepress-admin-columns.php:
|
85 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
msgid "Excerpt"
|
87 |
msgstr "Samenvatting"
|
88 |
|
89 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
90 |
msgid "Multiple Values"
|
91 |
msgstr "Meerdere waarden"
|
92 |
|
93 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
msgid "This field can not be removed"
|
95 |
msgstr "Dit veld kan niet worden verwijderd"
|
96 |
|
97 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
98 |
msgid "Remove"
|
99 |
msgstr "Verwijder"
|
100 |
|
101 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
102 |
msgid "Standard"
|
103 |
msgstr "Standaard"
|
104 |
|
105 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
106 |
msgid "Comments"
|
107 |
msgstr "Reacties"
|
108 |
|
109 |
-
#: ../codepress-admin-columns.php:
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
#: ../codepress-admin-columns.php:1077
|
114 |
msgid "Featured Image"
|
115 |
msgstr "Uitgelichte afbeelding"
|
116 |
|
117 |
-
#: ../codepress-admin-columns.php:
|
118 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
|
|
|
|
119 |
msgid "Sticky"
|
120 |
msgstr "Sticky"
|
121 |
|
122 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
123 |
msgid "Page Order"
|
124 |
msgstr "Pagina Volgorde"
|
125 |
|
126 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
127 |
msgid "Order"
|
128 |
msgstr "Volgorde"
|
129 |
|
130 |
-
#: ../codepress-admin-columns.php:
|
131 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
|
|
|
|
132 |
msgid "Page Template"
|
133 |
msgstr "Pagina Template"
|
134 |
|
135 |
-
#: ../codepress-admin-columns.php:
|
136 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
|
|
|
|
137 |
msgid "Post Format"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
141 |
msgid "Taxonomy"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: ../codepress-admin-columns.php:
|
145 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
|
|
|
|
146 |
msgid "Slug"
|
147 |
msgstr ""
|
148 |
|
149 |
-
#: ../codepress-admin-columns.php:
|
150 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
msgid "Attachment"
|
152 |
msgstr ""
|
153 |
|
154 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
msgid "Custom Field"
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: ../codepress-admin-columns.php:
|
|
|
|
|
|
|
159 |
msgid "Field"
|
160 |
msgstr "Veld"
|
161 |
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
#~ msgid "Longitude"
|
172 |
-
#~ msgstr "Lengtegraad"
|
173 |
-
|
174 |
-
#~ msgid "Width"
|
175 |
-
#~ msgstr "Breedte"
|
176 |
-
|
177 |
-
#~ msgid "Height"
|
178 |
-
#~ msgstr "Hoogte"
|
179 |
-
|
180 |
-
#~ msgid "Dynamic"
|
181 |
-
#~ msgstr "Dynamisch"
|
182 |
-
|
183 |
-
#~ msgid "Geocoder - Pronamic Google Maps"
|
184 |
-
#~ msgstr "Geocoder - Pronamic Google Maps"
|
185 |
-
|
186 |
-
#~ msgid "Number posts to geocode: %s"
|
187 |
-
#~ msgstr "Aantel berichten te geocoderen: %s"
|
188 |
-
|
189 |
-
#~ msgid "ID"
|
190 |
-
#~ msgstr "ID"
|
191 |
-
|
192 |
-
#~ msgid "Address"
|
193 |
-
#~ msgstr "Adres"
|
194 |
-
|
195 |
-
#~ msgid "Status"
|
196 |
-
#~ msgstr "Status"
|
197 |
-
|
198 |
-
#~ msgid "Location"
|
199 |
-
#~ msgstr "Locatie"
|
200 |
-
|
201 |
-
#~ msgid "Geocode"
|
202 |
-
#~ msgstr "Geocodeer"
|
203 |
-
|
204 |
-
#~ msgid "Zero results"
|
205 |
-
#~ msgstr "Geen resultaten"
|
206 |
-
|
207 |
-
#~ msgid ""
|
208 |
-
#~ "We found no geocoding results for the following %s posts, adjust them "
|
209 |
-
#~ "manually if needed."
|
210 |
-
#~ msgstr ""
|
211 |
-
#~ "We konden geen gecode resultaten vinden voor de volgende%s berichten, pas "
|
212 |
-
#~ "deze handmatig aan wanneer nodig."
|
213 |
-
|
214 |
-
#~ msgid "Configuration - Pronamic Google Maps"
|
215 |
-
#~ msgstr "Configuratie - Pronamic Google Maps"
|
216 |
-
|
217 |
-
#~ msgid "Active"
|
218 |
-
#~ msgstr "Actief"
|
219 |
-
|
220 |
-
#~ msgid "Activate Google Maps"
|
221 |
-
#~ msgstr "Activeer Google Maps"
|
222 |
-
|
223 |
-
#~ msgid "Show Google Maps"
|
224 |
-
#~ msgstr "Google Maps weergeven"
|
225 |
-
|
226 |
-
#~ msgid "Geocoder"
|
227 |
-
#~ msgstr "Geocoder"
|
228 |
-
|
229 |
-
#~ msgid "Geocode ↓"
|
230 |
-
#~ msgstr "Geocoderen ↓"
|
231 |
-
|
232 |
-
#~ msgid "Reverse Geocode ↑"
|
233 |
-
#~ msgstr "Omgekeerd geocoderen ↑"
|
234 |
-
|
235 |
-
#~ msgid "Tip: Change the zoom level and map type to your own wishes."
|
236 |
-
#~ msgstr "Tip: wijzig het zoomniveau en map type naar je eigen wens."
|
237 |
-
|
238 |
-
#~ msgid "Delete plugin"
|
239 |
-
#~ msgstr "Verwijder plugin"
|
240 |
-
|
241 |
-
#~ msgid "Warning! This will delete all Pronamic Google Maps data and options."
|
242 |
-
#~ msgstr ""
|
243 |
-
#~ "Waarschuwing! Dit zal alle Pronamic Google Maps data en opties "
|
244 |
-
#~ "verwijderen."
|
245 |
-
|
246 |
-
#~ msgid "Uninstall"
|
247 |
-
#~ msgstr "Verwijderen"
|
248 |
-
|
249 |
-
#~ msgid "Google Maps"
|
250 |
-
#~ msgstr "Google Maps"
|
251 |
-
|
252 |
-
#~ msgid "General"
|
253 |
-
#~ msgstr "Algemeen"
|
254 |
-
|
255 |
-
#~ msgid "Use this widget to add an Google Maps as a widget."
|
256 |
-
#~ msgstr "Gebruik deze widget om Google Maps toe te voegen."
|
257 |
-
|
258 |
-
#~ msgid "pixels"
|
259 |
-
#~ msgstr "pixels"
|
260 |
-
|
261 |
-
#~ msgid "percent"
|
262 |
-
#~ msgstr "procent"
|
263 |
|
264 |
-
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
|
267 |
-
|
268 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
|
270 |
-
|
271 |
-
|
|
|
|
|
|
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
#~ "gebruikt, doneer a.u.b. voor je waardering!"
|
279 |
|
280 |
-
|
281 |
-
|
|
|
|
|
|
|
282 |
|
283 |
-
|
284 |
-
|
|
|
|
|
|
|
285 |
|
286 |
-
|
287 |
-
|
|
|
|
|
|
|
288 |
|
289 |
-
|
290 |
-
|
|
|
|
|
|
|
291 |
|
292 |
-
|
293 |
-
|
|
|
|
|
|
|
294 |
|
295 |
-
|
296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
|
298 |
-
|
299 |
-
|
|
|
|
|
|
|
|
|
300 |
|
301 |
-
|
302 |
-
|
|
|
|
|
|
|
|
|
303 |
|
304 |
-
|
305 |
-
|
|
|
|
|
306 |
|
307 |
-
#~ msgid "Configuration"
|
308 |
-
#~ msgstr "Configuratie"
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Codepress Admin Columns\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-12-08 22:01+0100\n"
|
6 |
+
"PO-Revision-Date: 2012-04-20 21:13+0100\n"
|
7 |
+
"Last-Translator: Codepress <info@codepress.nl>\n"
|
8 |
"Language-Team: Codepress <info@codepress.nl>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
17 |
"X-Poedit-SearchPath-0: .\n"
|
18 |
"X-Poedit-SearchPath-1: ..\n"
|
19 |
|
20 |
+
#: ../codepress-admin-columns.php:135
|
21 |
+
#: ../_codepress-admin-columns.php:135
|
22 |
+
#: ../__codepress-admin-columns.php:135
|
23 |
msgid "Settings"
|
24 |
msgstr "Instellingen"
|
25 |
|
26 |
+
#: ../codepress-admin-columns.php:283
|
27 |
+
#: ../_codepress-admin-columns.php:284
|
28 |
+
#: ../__codepress-admin-columns.php:284
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
msgid "Add Custom Field Column"
|
30 |
msgstr "Voeg custom field kolom toe"
|
31 |
|
32 |
+
#: ../codepress-admin-columns.php:291
|
33 |
+
msgid "drag and drop to reorder"
|
34 |
+
msgstr "sleep om de volgorde te veranderen"
|
35 |
+
|
36 |
+
#: ../codepress-admin-columns.php:477
|
37 |
+
#: ../_codepress-admin-columns.php:476
|
38 |
+
#: ../__codepress-admin-columns.php:476
|
39 |
msgid "Default"
|
40 |
msgstr ""
|
41 |
|
42 |
+
#: ../codepress-admin-columns.php:478
|
43 |
+
#: ../codepress-admin-columns.php:1273
|
44 |
+
#: ../_codepress-admin-columns.php:477
|
45 |
+
#: ../_codepress-admin-columns.php:1177
|
46 |
+
#: ../__codepress-admin-columns.php:477
|
47 |
+
#: ../__codepress-admin-columns.php:1186
|
48 |
msgid "Image"
|
49 |
msgstr "Afbeelding"
|
50 |
|
51 |
+
#: ../codepress-admin-columns.php:479
|
52 |
+
#: ../_codepress-admin-columns.php:478
|
53 |
+
#: ../__codepress-admin-columns.php:478
|
54 |
msgid "Media Library Icon"
|
55 |
msgstr "Media bibliotheek Icoon"
|
56 |
|
57 |
+
#: ../codepress-admin-columns.php:480
|
58 |
+
#: ../codepress-admin-columns.php:1281
|
59 |
+
#: ../codepress-admin-columns.php:1283
|
60 |
+
#: ../_codepress-admin-columns.php:479
|
61 |
+
#: ../_codepress-admin-columns.php:1185
|
62 |
+
#: ../_codepress-admin-columns.php:1187
|
63 |
+
#: ../__codepress-admin-columns.php:479
|
64 |
+
#: ../__codepress-admin-columns.php:1194
|
65 |
+
#: ../__codepress-admin-columns.php:1196
|
66 |
msgid "Excerpt"
|
67 |
msgstr "Samenvatting"
|
68 |
|
69 |
+
#: ../codepress-admin-columns.php:481
|
70 |
+
#: ../_codepress-admin-columns.php:480
|
71 |
+
#: ../__codepress-admin-columns.php:480
|
72 |
msgid "Multiple Values"
|
73 |
msgstr "Meerdere waarden"
|
74 |
|
75 |
+
#: ../codepress-admin-columns.php:482
|
76 |
+
#: ../_codepress-admin-columns.php:481
|
77 |
+
#: ../__codepress-admin-columns.php:481
|
78 |
+
msgid "Numeric"
|
79 |
+
msgstr "Numerieke"
|
80 |
+
|
81 |
+
#: ../codepress-admin-columns.php:507
|
82 |
+
#: ../_codepress-admin-columns.php:506
|
83 |
+
#: ../__codepress-admin-columns.php:506
|
84 |
msgid "This field can not be removed"
|
85 |
msgstr "Dit veld kan niet worden verwijderd"
|
86 |
|
87 |
+
#: ../codepress-admin-columns.php:511
|
88 |
+
#: ../_codepress-admin-columns.php:510
|
89 |
+
#: ../__codepress-admin-columns.php:510
|
90 |
msgid "Remove"
|
91 |
msgstr "Verwijder"
|
92 |
|
93 |
+
#: ../codepress-admin-columns.php:845
|
94 |
+
#: ../_codepress-admin-columns.php:845
|
95 |
+
#: ../__codepress-admin-columns.php:845
|
96 |
msgid "Standard"
|
97 |
msgstr "Standaard"
|
98 |
|
99 |
+
#: ../codepress-admin-columns.php:1242
|
100 |
+
#: ../_codepress-admin-columns.php:1146
|
101 |
+
#: ../__codepress-admin-columns.php:1155
|
102 |
msgid "Comments"
|
103 |
msgstr "Reacties"
|
104 |
|
105 |
+
#: ../codepress-admin-columns.php:1271
|
106 |
+
#: ../_codepress-admin-columns.php:1175
|
107 |
+
#: ../__codepress-admin-columns.php:1184
|
|
|
|
|
108 |
msgid "Featured Image"
|
109 |
msgstr "Uitgelichte afbeelding"
|
110 |
|
111 |
+
#: ../codepress-admin-columns.php:1291
|
112 |
+
#: ../codepress-admin-columns.php:1293
|
113 |
+
#: ../_codepress-admin-columns.php:1195
|
114 |
+
#: ../_codepress-admin-columns.php:1197
|
115 |
+
#: ../__codepress-admin-columns.php:1204
|
116 |
+
#: ../__codepress-admin-columns.php:1206
|
117 |
msgid "Sticky"
|
118 |
msgstr "Sticky"
|
119 |
|
120 |
+
#: ../codepress-admin-columns.php:1301
|
121 |
+
#: ../_codepress-admin-columns.php:1205
|
122 |
+
#: ../__codepress-admin-columns.php:1214
|
123 |
msgid "Page Order"
|
124 |
msgstr "Pagina Volgorde"
|
125 |
|
126 |
+
#: ../codepress-admin-columns.php:1303
|
127 |
+
#: ../_codepress-admin-columns.php:1207
|
128 |
+
#: ../__codepress-admin-columns.php:1216
|
129 |
msgid "Order"
|
130 |
msgstr "Volgorde"
|
131 |
|
132 |
+
#: ../codepress-admin-columns.php:1312
|
133 |
+
#: ../codepress-admin-columns.php:1314
|
134 |
+
#: ../_codepress-admin-columns.php:1216
|
135 |
+
#: ../_codepress-admin-columns.php:1218
|
136 |
+
#: ../__codepress-admin-columns.php:1225
|
137 |
+
#: ../__codepress-admin-columns.php:1227
|
138 |
msgid "Page Template"
|
139 |
msgstr "Pagina Template"
|
140 |
|
141 |
+
#: ../codepress-admin-columns.php:1323
|
142 |
+
#: ../codepress-admin-columns.php:1325
|
143 |
+
#: ../_codepress-admin-columns.php:1227
|
144 |
+
#: ../_codepress-admin-columns.php:1229
|
145 |
+
#: ../__codepress-admin-columns.php:1236
|
146 |
+
#: ../__codepress-admin-columns.php:1238
|
147 |
msgid "Post Format"
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: ../codepress-admin-columns.php:1338
|
151 |
+
#: ../_codepress-admin-columns.php:1242
|
152 |
+
#: ../__codepress-admin-columns.php:1251
|
153 |
msgid "Taxonomy"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: ../codepress-admin-columns.php:1356
|
157 |
+
#: ../codepress-admin-columns.php:1358
|
158 |
+
#: ../_codepress-admin-columns.php:1260
|
159 |
+
#: ../_codepress-admin-columns.php:1262
|
160 |
+
#: ../__codepress-admin-columns.php:1269
|
161 |
+
#: ../__codepress-admin-columns.php:1271
|
162 |
msgid "Slug"
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: ../codepress-admin-columns.php:1365
|
166 |
+
#: ../codepress-admin-columns.php:1367
|
167 |
+
#: ../_codepress-admin-columns.php:1269
|
168 |
+
#: ../_codepress-admin-columns.php:1271
|
169 |
+
#: ../__codepress-admin-columns.php:1278
|
170 |
+
#: ../__codepress-admin-columns.php:1280
|
171 |
+
msgid "Word count"
|
172 |
+
msgstr "Aantal woorden"
|
173 |
+
|
174 |
+
#: ../codepress-admin-columns.php:1374
|
175 |
+
#: ../codepress-admin-columns.php:1376
|
176 |
+
#: ../_codepress-admin-columns.php:1277
|
177 |
+
#: ../_codepress-admin-columns.php:1279
|
178 |
+
#: ../__codepress-admin-columns.php:1286
|
179 |
+
#: ../__codepress-admin-columns.php:1288
|
180 |
msgid "Attachment"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: ../codepress-admin-columns.php:1383
|
184 |
+
#: ../codepress-admin-columns.php:1385
|
185 |
+
msgid "No. of Attachments"
|
186 |
+
msgstr "Aantal attachments"
|
187 |
+
|
188 |
+
#: ../codepress-admin-columns.php:1393
|
189 |
+
#: ../codepress-admin-columns.php:1472
|
190 |
+
#: ../_codepress-admin-columns.php:1287
|
191 |
+
#: ../__codepress-admin-columns.php:1296
|
192 |
msgid "Custom Field"
|
193 |
msgstr ""
|
194 |
|
195 |
+
#: ../codepress-admin-columns.php:1399
|
196 |
+
#: ../codepress-admin-columns.php:1478
|
197 |
+
#: ../_codepress-admin-columns.php:1293
|
198 |
+
#: ../__codepress-admin-columns.php:1302
|
199 |
msgid "Field"
|
200 |
msgstr "Veld"
|
201 |
|
202 |
+
#: ../codepress-admin-columns.php:1423
|
203 |
+
#: ../codepress-admin-columns.php:1425
|
204 |
+
#: ../_codepress-admin-columns.php:1317
|
205 |
+
#: ../_codepress-admin-columns.php:1319
|
206 |
+
#: ../__codepress-admin-columns.php:1326
|
207 |
+
#: ../__codepress-admin-columns.php:1328
|
208 |
+
msgid "User ID"
|
209 |
+
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
|
211 |
+
#: ../codepress-admin-columns.php:1432
|
212 |
+
#: ../codepress-admin-columns.php:1434
|
213 |
+
#: ../_codepress-admin-columns.php:1326
|
214 |
+
#: ../_codepress-admin-columns.php:1328
|
215 |
+
#: ../__codepress-admin-columns.php:1335
|
216 |
+
#: ../__codepress-admin-columns.php:1337
|
217 |
+
msgid "First name"
|
218 |
+
msgstr "Voornaam"
|
219 |
+
|
220 |
+
#: ../codepress-admin-columns.php:1440
|
221 |
+
#: ../codepress-admin-columns.php:1442
|
222 |
+
#: ../_codepress-admin-columns.php:1334
|
223 |
+
#: ../_codepress-admin-columns.php:1336
|
224 |
+
#: ../__codepress-admin-columns.php:1343
|
225 |
+
#: ../__codepress-admin-columns.php:1345
|
226 |
+
msgid "Last name"
|
227 |
+
msgstr "Achternaam"
|
228 |
+
|
229 |
+
#: ../codepress-admin-columns.php:1448
|
230 |
+
#: ../codepress-admin-columns.php:1450
|
231 |
+
#: ../_codepress-admin-columns.php:1342
|
232 |
+
#: ../_codepress-admin-columns.php:1344
|
233 |
+
#: ../__codepress-admin-columns.php:1351
|
234 |
+
#: ../__codepress-admin-columns.php:1353
|
235 |
+
msgid "Url"
|
236 |
+
msgstr ""
|
237 |
|
238 |
+
#: ../codepress-admin-columns.php:1456
|
239 |
+
#: ../codepress-admin-columns.php:1458
|
240 |
+
#: ../_codepress-admin-columns.php:1350
|
241 |
+
#: ../_codepress-admin-columns.php:1352
|
242 |
+
#: ../__codepress-admin-columns.php:1359
|
243 |
+
#: ../__codepress-admin-columns.php:1361
|
244 |
+
msgid "Registered"
|
245 |
+
msgstr "Registratie"
|
246 |
+
|
247 |
+
#: ../codepress-admin-columns.php:1464
|
248 |
+
#: ../codepress-admin-columns.php:1466
|
249 |
+
#: ../_codepress-admin-columns.php:1358
|
250 |
+
#: ../_codepress-admin-columns.php:1360
|
251 |
+
#: ../__codepress-admin-columns.php:1367
|
252 |
+
#: ../__codepress-admin-columns.php:1369
|
253 |
+
msgid "Description"
|
254 |
+
msgstr "Beschrijving"
|
255 |
+
|
256 |
+
#: ../codepress-admin-columns.php:1506
|
257 |
+
#: ../_codepress-admin-columns.php:1386
|
258 |
+
#: ../__codepress-admin-columns.php:1409
|
259 |
+
msgid "Custom"
|
260 |
+
msgstr ""
|
261 |
|
262 |
+
#: ../codepress-admin-columns.php:1930
|
263 |
+
#: ../_codepress-admin-columns.php:1676
|
264 |
+
#: ../__codepress-admin-columns.php:1699
|
265 |
+
msgid "Codepress Admin Columns"
|
266 |
+
msgstr ""
|
267 |
|
268 |
+
#: ../codepress-admin-columns.php:1939
|
269 |
+
#: ../_codepress-admin-columns.php:1685
|
270 |
+
#: ../__codepress-admin-columns.php:1708
|
271 |
+
msgid "Admin Columns"
|
272 |
+
msgstr ""
|
|
|
273 |
|
274 |
+
#: ../codepress-admin-columns.php:1954
|
275 |
+
#: ../_codepress-admin-columns.php:1700
|
276 |
+
#: ../__codepress-admin-columns.php:1723
|
277 |
+
msgid "Save Changes"
|
278 |
+
msgstr "Wijzigingen opslaan"
|
279 |
|
280 |
+
#: ../codepress-admin-columns.php:1966
|
281 |
+
#: ../_codepress-admin-columns.php:1712
|
282 |
+
#: ../__codepress-admin-columns.php:1735
|
283 |
+
msgid "Restore defaults"
|
284 |
+
msgstr "Herstel instellingen"
|
285 |
|
286 |
+
#: ../codepress-admin-columns.php:1970
|
287 |
+
#: ../_codepress-admin-columns.php:1716
|
288 |
+
#: ../__codepress-admin-columns.php:1739
|
289 |
+
msgid "Restore default settings"
|
290 |
+
msgstr "Herstel standaard instellingen"
|
291 |
|
292 |
+
#: ../codepress-admin-columns.php:1970
|
293 |
+
#: ../_codepress-admin-columns.php:1716
|
294 |
+
#: ../__codepress-admin-columns.php:1739
|
295 |
+
msgid "Warning! ALL saved admin columns data will be deleted. This cannot be undone. \\'OK\\' to delete, \\'Cancel\\' to stop"
|
296 |
+
msgstr "Waarschuwing! ALLE bewaarde instellingen worden verwijderd. Dit kan niet worden ongedaan. \\'OK\\' om te verwijderen, \\'Annuleren\\' om te stoppen"
|
297 |
|
298 |
+
#: ../codepress-admin-columns.php:1972
|
299 |
+
#: ../_codepress-admin-columns.php:1718
|
300 |
+
#: ../__codepress-admin-columns.php:1741
|
301 |
+
msgid "This will delete all column settings and restore the default settings."
|
302 |
+
msgstr "Hiermee worden alle kolommen instellingen verwijderd en de standaardinstellingen hersteld."
|
303 |
|
304 |
+
#: ../codepress-admin-columns.php:1987
|
305 |
+
#: ../_codepress-admin-columns.php:1733
|
306 |
+
#: ../__codepress-admin-columns.php:1756
|
307 |
+
msgid "Like this plugin?"
|
308 |
+
msgstr "Leuke plugin?"
|
309 |
+
|
310 |
+
#: ../codepress-admin-columns.php:1990
|
311 |
+
#: ../_codepress-admin-columns.php:1736
|
312 |
+
#: ../__codepress-admin-columns.php:1759
|
313 |
+
msgid "Why not do any or all of the following"
|
314 |
+
msgstr "Waarom doe je niet één van de volgende dingen:"
|
315 |
+
|
316 |
+
#: ../codepress-admin-columns.php:1992
|
317 |
+
#: ../_codepress-admin-columns.php:1738
|
318 |
+
#: ../__codepress-admin-columns.php:1761
|
319 |
+
msgid "Link to it so other folks can find out about it."
|
320 |
+
msgstr "Link naar ons zodat anderen deze plugin ook ontdekken."
|
321 |
+
|
322 |
+
#: ../codepress-admin-columns.php:1993
|
323 |
+
#: ../_codepress-admin-columns.php:1739
|
324 |
+
#: ../__codepress-admin-columns.php:1762
|
325 |
+
msgid "Give it a 5 star rating on WordPress.org."
|
326 |
+
msgstr "Geef het een goede score op WordPress.org."
|
327 |
+
|
328 |
+
#: ../codepress-admin-columns.php:1994
|
329 |
+
#: ../_codepress-admin-columns.php:1740
|
330 |
+
#: ../__codepress-admin-columns.php:1763
|
331 |
+
msgid "Donate a token of your appreciation."
|
332 |
+
msgstr "Doneer een blijk van uw waardering."
|
333 |
+
|
334 |
+
#: ../codepress-admin-columns.php:2002
|
335 |
+
#: ../_codepress-admin-columns.php:1748
|
336 |
+
#: ../__codepress-admin-columns.php:1771
|
337 |
+
msgid "Need support?"
|
338 |
+
msgstr "Hulp nodig?"
|
339 |
|
340 |
+
#: ../codepress-admin-columns.php:2005
|
341 |
+
#: ../_codepress-admin-columns.php:1751
|
342 |
+
#: ../__codepress-admin-columns.php:1774
|
343 |
+
#, php-format
|
344 |
+
msgid "If you are having problems with this plugin, please talk about them in the <a href=\"%s\">Support forums</a> or send me an email %s."
|
345 |
+
msgstr "Als je problem hebt met deze plugin, stel je vragen dan in de <a href=\"%s\">Support forums</a> of stuur me een email %s."
|
346 |
|
347 |
+
#: ../codepress-admin-columns.php:2006
|
348 |
+
#: ../_codepress-admin-columns.php:1752
|
349 |
+
#: ../__codepress-admin-columns.php:1775
|
350 |
+
#, php-format
|
351 |
+
msgid "If you're sure you've found a bug, or have a feature request, please <a href='%s'>submit your feedback</a>."
|
352 |
+
msgstr "Als een bug bent tegen gekomen, of een feature wil aanvragen, stuur ons dan <a href='%s'>je feedback</a>."
|
353 |
|
354 |
+
#: ../__codepress-admin-columns.php:1375
|
355 |
+
#: ../__codepress-admin-columns.php:1381
|
356 |
+
msgid "User Field"
|
357 |
+
msgstr "Veld"
|
358 |
|
|
|
|
readme.txt
CHANGED
@@ -1,21 +1,19 @@
|
|
1 |
=== Codepress Admin Columns ===
|
2 |
Contributors: codepress, tschutter
|
3 |
-
Tags: plugins, wordpress, admin, column, columns, dashboard, sortable, filters, wp-admin
|
4 |
Requires at least: 3.1
|
5 |
-
Tested up to: 3.
|
6 |
-
Stable tag: 1.
|
7 |
|
8 |
== Description ==
|
9 |
|
10 |
-
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
The following custom columns are supported:
|
19 |
|
20 |
* Featured Image
|
21 |
* Excerpt
|
@@ -27,27 +25,87 @@ The following custom columns are supported:
|
|
27 |
* ID
|
28 |
* Slug
|
29 |
* Sticky
|
|
|
|
|
|
|
|
|
30 |
* Custom Fields
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
= Custom Fields =
|
33 |
|
34 |
-
With the custom field column you can display custom field values. It
|
35 |
|
36 |
-
* Icons for Media Library items
|
37 |
* Image thumbnails
|
|
|
38 |
* Excerpt
|
39 |
* Multiple Values
|
|
|
40 |
|
41 |
-
= Sortable
|
42 |
|
43 |
-
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
* page template
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
**Related Links:**
|
53 |
|
@@ -59,25 +117,89 @@ I will be adding more in coming releases. You can leave any <a href='http://www.
|
|
59 |
2. Activate Codepress Admin Columns through the 'Plugins' menu in WordPress
|
60 |
3. Configure the plugin by going to the Admin Column settings that appears under the Settings menu.
|
61 |
|
62 |
-
|
63 |
== Frequently Asked Questions ==
|
64 |
|
65 |
= I have an idea for a great way to improve this plugin =
|
66 |
|
67 |
Great! I'd love to hear from you.
|
68 |
-
Leave your feedback at http://www.codepress.nl/plugins/codepress-admin-columns
|
69 |
|
70 |
== Screenshots ==
|
71 |
|
72 |
-
1. Settings page
|
73 |
-
2.
|
74 |
-
3.
|
|
|
|
|
|
|
|
|
75 |
|
76 |
== Changelog ==
|
77 |
|
78 |
-
= 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
= 1.0 =
|
83 |
|
1 |
=== Codepress Admin Columns ===
|
2 |
Contributors: codepress, tschutter
|
3 |
+
Tags: plugins, wordpress, admin, column, columns, custom columns, custom fields, image, dashboard, sortable, filters, posts, media, users, pages, posttypes, manage columns, wp-admin
|
4 |
Requires at least: 3.1
|
5 |
+
Tested up to: 3.3.1
|
6 |
+
Stable tag: 1.4
|
7 |
|
8 |
== Description ==
|
9 |
|
10 |
+
Completely customise the columns on the administration screens with a nice drag and drop interface.
|
11 |
|
12 |
+
By default, WordPress only shows a few built-in columns. This plugin will give you many additional columns and you will have full control over all custom columns for pages, posts, posttypes, media and users. You can add or remove columns, change their label, change their width and reorder them..
|
13 |
|
14 |
+
= Post Types Columns =
|
15 |
|
16 |
+
The following custom columns are added:
|
|
|
|
|
17 |
|
18 |
* Featured Image
|
19 |
* Excerpt
|
25 |
* ID
|
26 |
* Slug
|
27 |
* Sticky
|
28 |
+
* Word count
|
29 |
+
* Roles
|
30 |
+
* Status
|
31 |
+
* Number of Attachments
|
32 |
* Custom Fields
|
33 |
|
34 |
+
= User Columns =
|
35 |
+
|
36 |
+
You can also change the User Columns. The following user columns are added:
|
37 |
+
|
38 |
+
* User ID
|
39 |
+
* First name
|
40 |
+
* Last name
|
41 |
+
* Url
|
42 |
+
* Register date
|
43 |
+
* Biographical Info ( description )
|
44 |
+
* User Custom Fields
|
45 |
+
* Number of Posts Types
|
46 |
+
|
47 |
+
Some of the user custom fields that are included: user level, capabilities, admin color, nickname... many more.
|
48 |
+
|
49 |
+
= Media Columns =
|
50 |
+
|
51 |
+
Customise the Media Library Columns. The following media columns are added:
|
52 |
+
|
53 |
+
* Media ID
|
54 |
+
* File name
|
55 |
+
* Height
|
56 |
+
* Width
|
57 |
+
* Dimensions ( width x height )
|
58 |
+
* Description, Caption and Alternate tekst
|
59 |
+
* Mime-Type
|
60 |
+
|
61 |
+
= Comment Columns =
|
62 |
+
|
63 |
+
A lot more comment colums are added, here are a few examples:
|
64 |
+
|
65 |
+
* Avatar
|
66 |
+
* Author IP
|
67 |
+
* Agent
|
68 |
+
* ID
|
69 |
+
* Comment excerpt
|
70 |
+
* Comment Meta data
|
71 |
+
|
72 |
+
= Link Columns =
|
73 |
+
|
74 |
+
A few examples of added Link columns:
|
75 |
+
|
76 |
+
* ID
|
77 |
+
* Target
|
78 |
+
* Description
|
79 |
+
* Notes
|
80 |
+
* Owner
|
81 |
+
|
82 |
= Custom Fields =
|
83 |
|
84 |
+
With the custom field column you can display any custom field values. It can show its default value but also handle it as an image or icon. Thsese types are added:
|
85 |
|
|
|
86 |
* Image thumbnails
|
87 |
+
* Icons for Media Library items
|
88 |
* Excerpt
|
89 |
* Multiple Values
|
90 |
+
* Numeric value ( this also works for sorting by meta_value_num )
|
91 |
|
92 |
+
= Sortable Custom Columns for all Screens =
|
93 |
|
94 |
+
All of the new columns will have support for sorting with the <a href="http://www.codepress.nl/plugins/codepress-admin-columns/sortorder-addon/">sorting addon</a>.
|
95 |
|
96 |
+
By default WordPress let's you only sort by Title, Date, Comments and Author. This will make you be able to <strong>sort by ALL columns of ANY type</strong>.
|
97 |
+
|
98 |
+
= Third party plugin support =
|
|
|
99 |
|
100 |
+
It will work nice with other plugins and support their additional custom columns. A few examples of plugins that are supported: WordPress SEO by Yoast (Robots Meta), Post Admin Shortcuts (Pin), WP Show IDs (ID) and User Access Manager (Access), Co-Authors Plus and Advanced Custom Fields.
|
101 |
+
|
102 |
+
= Upcoming releases =
|
103 |
+
|
104 |
+
The next upcoming release will have the option to set default sorting per screen.
|
105 |
+
|
106 |
+
**Feedback**
|
107 |
+
|
108 |
+
You can leave any <a href='http://www.codepress.nl/plugins/codepress-admin-columns/feedback'>requests or feedback</a>.
|
109 |
|
110 |
**Related Links:**
|
111 |
|
117 |
2. Activate Codepress Admin Columns through the 'Plugins' menu in WordPress
|
118 |
3. Configure the plugin by going to the Admin Column settings that appears under the Settings menu.
|
119 |
|
|
|
120 |
== Frequently Asked Questions ==
|
121 |
|
122 |
= I have an idea for a great way to improve this plugin =
|
123 |
|
124 |
Great! I'd love to hear from you.
|
125 |
+
Leave your feedback at http://www.codepress.nl/plugins/codepress-admin-columns/feedback.
|
126 |
|
127 |
== Screenshots ==
|
128 |
|
129 |
+
1. Settings page for Post(type) columns.
|
130 |
+
2. Posts Screen with the customized sortable columns.
|
131 |
+
3. Settings page for the Media Library columns.
|
132 |
+
4. Media Screen with the customized sortable columns.
|
133 |
+
5. Settings page for Users columns.
|
134 |
+
6. Users Screen with the customized sortable columns.
|
135 |
+
7. Settings page showing the different displaying types for custom field.
|
136 |
|
137 |
== Changelog ==
|
138 |
|
139 |
+
= 1.4 =
|
140 |
+
|
141 |
+
* added support for comment columns
|
142 |
+
* added support for link columns
|
143 |
+
* added links to taxonomies
|
144 |
+
* added sorting user custom fields
|
145 |
+
* added sorting to links columns
|
146 |
+
* added user columns so you can see how many articles an author has published of a certain post type
|
147 |
+
* added Textual help
|
148 |
+
* added the option to specify column width
|
149 |
+
* added role column to all posts screens
|
150 |
+
* added posts status column to all posts screens
|
151 |
+
* added image path to media library
|
152 |
+
* added added apply_filters('cpac-get-post-types', $post_types) to filter out certain post types
|
153 |
+
* added option to enter license key for activating sorting on ALL columns
|
154 |
+
* fixed a php5 warning
|
155 |
+
* fixed a conflict with the Co-Authors plugin
|
156 |
+
|
157 |
+
= 1.3 =
|
158 |
+
|
159 |
+
* added support for Media columns
|
160 |
+
* added Media columns: filename, width, height, dimensions, description, alt, caption and mime-type
|
161 |
+
* added date type to posts custom fields
|
162 |
+
* added title type to posts custom fields
|
163 |
+
* sorting has changed. when sorting; only results are shown which contain a value
|
164 |
+
* str_word_count is used for excerpts
|
165 |
+
|
166 |
+
= 1.2.1 =
|
167 |
+
|
168 |
+
* added word count sorting
|
169 |
+
* added attachment count sorting
|
170 |
+
* added template name sorting
|
171 |
+
* minor styling changes
|
172 |
+
* bug fix with sorting by slug
|
173 |
+
* bug fix with sorting by attachment
|
174 |
+
|
175 |
+
= 1.2 =
|
176 |
+
|
177 |
+
* added support for third party plugins
|
178 |
+
* added user custom fields
|
179 |
+
* added extra image check
|
180 |
+
* bug fix with javascript (jquery) enqueue
|
181 |
+
|
182 |
+
= 1.1.3 =
|
183 |
+
|
184 |
+
* added bug fix for WP3.3beta ( thanks to raonip and ronbme for pointing this out )
|
185 |
+
|
186 |
+
= 1.1.2 =
|
187 |
+
|
188 |
+
* added dutch translation
|
189 |
+
|
190 |
+
= 1.1.1 =
|
191 |
+
|
192 |
+
* Bug fix: path separator for require_once
|
193 |
+
* Added word count
|
194 |
+
|
195 |
+
= 1.1 =
|
196 |
|
197 |
+
* Added User Columns.
|
198 |
+
* Added before / after text for custom fields
|
199 |
+
* Added custom field type 'Numeric'.
|
200 |
+
* Added custom field sortables.
|
201 |
+
* Fixed domain path
|
202 |
+
* Fixed settings link
|
203 |
|
204 |
= 1.0 =
|
205 |
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|
screenshot-3.png
CHANGED
Binary file
|
screenshot-4.png
ADDED
Binary file
|
screenshot-5.png
ADDED
Binary file
|
screenshot-6.png
ADDED
Binary file
|
screenshot-7.png
ADDED
Binary file
|