Version Description
- added support for Media columns
- added Media columns: filename, width, height, dimensions, description, alt, caption and mime-type
- added date type to posts custom fields
- added title type to posts custom fields
- sorting has changed. when sorting; only results are shown which contain a value
- str_word_count is used for excerpts
Download this release
Release Info
Developer | codepress |
Plugin | Admin Columns |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.3
- assets/css/admin-column.css +69 -17
- assets/css/column.css +7 -0
- assets/images/arrows.png +0 -0
- assets/images/reorder_arrow.png +0 -0
- assets/images/sort.png +0 -0
- assets/images/square.png +0 -0
- assets/js/admin-column.js +12 -6
- classes/sortable.php +594 -0
- codepress-admin-columns.php +1366 -492
- languages/codepress-admin-columns-nl_NL.mo +0 -0
- languages/codepress-admin-columns-nl_NL.po +262 -212
- readme.txt +105 -19
- 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,11 +1,22 @@
|
|
1 |
-
#
|
|
|
|
|
2 |
#cpac .postbox {
|
3 |
margin: 0 10px 10px 0;
|
4 |
}
|
5 |
#cpac .cpac-menu {
|
6 |
clear: both;
|
7 |
float: left;
|
8 |
-
width:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
}
|
10 |
#icon-codepress-admin-columns {
|
11 |
background: transparent url('../images/icon.png') no-repeat 0 0;
|
@@ -39,13 +50,19 @@
|
|
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 +80,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 +116,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 +138,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;
|
@@ -187,6 +200,25 @@
|
|
187 |
color: #832525;
|
188 |
text-shadow: none;
|
189 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
#restore-cpac-settings .inside {
|
191 |
padding: 10px;
|
192 |
}
|
@@ -206,4 +238,24 @@
|
|
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 |
float: left;
|
10 |
+
width: 90%;
|
11 |
+
}
|
12 |
+
#cpac .cpac-col-left {
|
13 |
+
width: 70%;
|
14 |
+
}
|
15 |
+
#cpac .cpac-col-right {
|
16 |
+
width: 20%;
|
17 |
+
}
|
18 |
+
#cpac .cpac-col-right .inside {
|
19 |
+
padding: 0 10px;
|
20 |
}
|
21 |
#icon-codepress-admin-columns {
|
22 |
background: transparent url('../images/icon.png') no-repeat 0 0;
|
50 |
}
|
51 |
#general-cpac-settings .cpac-option-list {
|
52 |
overflow: hidden;
|
53 |
+
width: 360px;
|
54 |
+
margin-bottom: 5px;
|
55 |
}
|
56 |
#general-cpac-settings .cpac-reorder-msg {
|
57 |
+
background: transparent url('../images/reorder_arrow.png') no-repeat scroll 0 0;
|
58 |
margin-left: 5px;
|
59 |
height: 23px;
|
60 |
+
line-height: 25px;
|
61 |
+
padding-left: 25px;
|
62 |
+
color: #727272;
|
63 |
+
font-size: 12px;
|
64 |
+
font-family: 'Trebuchet MS', Arial, Verdana;
|
65 |
+
font-style: italic;
|
66 |
clear: both;
|
67 |
}
|
68 |
#general-cpac-settings .cpac-option-list li {
|
80 |
background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec);
|
81 |
background-image: linear-gradient(top, #f9f9f9, #ececec);
|
82 |
border-radius: 3px 3px 3px 3px;
|
83 |
+
border: 1px solid #cbcbcb;
|
84 |
margin-top: 1px;
|
85 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
#general-cpac-settings .cpac-option-list li .cpac-sort-handle {
|
87 |
background: transparent url('../images/sort.png') no-repeat 5px 5px;
|
88 |
width: 20px;
|
116 |
display: block;
|
117 |
margin-right: 30px;
|
118 |
overflow: hidden;
|
119 |
+
height: 17px;
|
120 |
+
line-height: 17px;
|
121 |
}
|
122 |
#general-cpac-settings .cpac-option-list li .cpac-type-options input {
|
123 |
margin-top: 6px;
|
138 |
text-indent: -999em;
|
139 |
overflow: hidden;
|
140 |
}
|
141 |
+
#general-cpac-settings .cpac-option-list li.opened a.cpac-action {}
|
142 |
+
#general-cpac-settings .cpac-option-list li.active a.cpac-action {
|
143 |
+
background-position: 50% -66px;
|
144 |
+
}
|
145 |
+
#general-cpac-settings .cpac-option-list li.active.opened a.cpac-action {}
|
146 |
#general-cpac-settings .cpac-option-list li div.cpac-meta-title span {
|
147 |
display: inline-block;
|
148 |
margin: 5px 5px 0 0;
|
200 |
color: #832525;
|
201 |
text-shadow: none;
|
202 |
}
|
203 |
+
#general-cpac-settings .cpac-option-list li.active {
|
204 |
+
background-color: #c7c7c7;
|
205 |
+
background-image: -ms-linear-gradient(top, #e9e9e9, #c7c7c7);
|
206 |
+
background-image: -moz-linear-gradient(top, #e9e9e9, #c7c7c7);
|
207 |
+
background-image: -o-linear-gradient(top, #e9e9e9, #c7c7c7);
|
208 |
+
background-image: -webkit-gradient(linear, left top, left bottom, from(#e9e9e9), to(#c7c7c7));
|
209 |
+
background-image: -webkit-linear-gradient(top, #e9e9e9, #c7c7c7);
|
210 |
+
background-image: linear-gradient(top, #e9e9e9, #c7c7c7);
|
211 |
+
border-color: #aeaeae;
|
212 |
+
}
|
213 |
+
#general-cpac-settings .cpac-option-list li.active .cpac-sort-handle {
|
214 |
+
background-position: 5px -19px;
|
215 |
+
}
|
216 |
+
#general-cpac-settings .cpac-option-list li.active div.cpac-meta-title {
|
217 |
+
color: #151515;
|
218 |
+
}
|
219 |
+
#general-cpac-settings .cpac-option-list li.active div.cpac-meta-title span {
|
220 |
+
color: #5c5c5c
|
221 |
+
}
|
222 |
#restore-cpac-settings .inside {
|
223 |
padding: 10px;
|
224 |
}
|
238 |
}
|
239 |
#restore-cpac-settings .inside .description {
|
240 |
color: #832525;
|
241 |
+
}
|
242 |
+
#likethisplugin-cpac-settings {
|
243 |
+
padding: 0;
|
244 |
+
}
|
245 |
+
#likethisplugin-cpac-settings ul {
|
246 |
+
margin-left: 20px;
|
247 |
+
}
|
248 |
+
#likethisplugin-cpac-settings li {
|
249 |
+
list-style: square;
|
250 |
+
line-height: 16px;
|
251 |
+
}
|
252 |
+
#likethisplugin-cpac-settings li a {
|
253 |
+
text-decoration: none;
|
254 |
+
}
|
255 |
+
#likethisplugin-cpac-settings li.donate_link a {
|
256 |
+
color: green;
|
257 |
+
text-decoration: underline;
|
258 |
+
}
|
259 |
+
#likethisplugin-cpac-settings li.donate_link a:hover {
|
260 |
+
color: darkgreen;
|
261 |
}
|
assets/css/column.css
CHANGED
@@ -1,4 +1,11 @@
|
|
1 |
.column-column-attachment img {
|
2 |
padding-right: 5px;
|
3 |
padding-bottom: 4px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
}
|
1 |
.column-column-attachment img {
|
2 |
padding-right: 5px;
|
3 |
padding-bottom: 4px;
|
4 |
+
}
|
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/arrows.png
CHANGED
Binary file
|
assets/images/reorder_arrow.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,7 +2,11 @@
|
|
2 |
* fires when the dom is ready
|
3 |
*
|
4 |
*/
|
5 |
-
jQuery(document).ready(function()
|
|
|
|
|
|
|
|
|
6 |
cpac_sortable();
|
7 |
cpac_checked();
|
8 |
cpac_box_events();
|
@@ -15,7 +19,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 +42,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 +63,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 +79,7 @@ function cpac_box_events()
|
|
72 |
height: 0
|
73 |
}, 350, function() {
|
74 |
el.remove();
|
75 |
-
});
|
76 |
-
|
77 |
});
|
78 |
}
|
79 |
|
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();
|
19 |
*
|
20 |
*/
|
21 |
function cpac_sortable()
|
22 |
+
{
|
23 |
jQuery('ul.cpac-option-list').sortable({
|
24 |
handle: 'div.cpac-sort-handle',
|
25 |
placeholder: 'cpac-placeholder',
|
42 |
// toggle on
|
43 |
if ( value != 'on') {
|
44 |
li.addClass('active');
|
45 |
+
state.attr('value', 'on');
|
46 |
}
|
47 |
|
48 |
// toggle off
|
63 |
// fold in/out
|
64 |
jQuery('#cpac .cpac-option-list .cpac-action').unbind('click').click(function(e){
|
65 |
e.preventDefault();
|
66 |
+
var li = jQuery(this).closest('li');
|
67 |
+
li.find('.cpac-type-inside').slideToggle(150, function() {
|
68 |
+
li.toggleClass('opened');
|
69 |
+
});
|
70 |
});
|
71 |
|
72 |
// remove custom field box
|
79 |
height: 0
|
80 |
}, 350, function() {
|
81 |
el.remove();
|
82 |
+
});
|
|
|
83 |
});
|
84 |
}
|
85 |
|
classes/sortable.php
ADDED
@@ -0,0 +1,594 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Init Class
|
4 |
+
*
|
5 |
+
* @since 1.3
|
6 |
+
*/
|
7 |
+
new Codepress_Sortable_Columns();
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Coderess Sortable Columns Class
|
11 |
+
*
|
12 |
+
* @since 1.3
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
class Codepress_Sortable_Columns extends Codepress_Admin_Columns
|
16 |
+
{
|
17 |
+
private $post_types,
|
18 |
+
$is_unlocked,
|
19 |
+
$show_all_results;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Constructor
|
23 |
+
*
|
24 |
+
* @since 1.0
|
25 |
+
*/
|
26 |
+
function __construct()
|
27 |
+
{
|
28 |
+
add_action( 'wp_loaded', array( &$this, 'init') );
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Initialize
|
33 |
+
*
|
34 |
+
* @since 1.0
|
35 |
+
*/
|
36 |
+
public function init()
|
37 |
+
{
|
38 |
+
// vars
|
39 |
+
$this->is_unlocked = $this->is_unlocked('sortable');
|
40 |
+
$this->post_types = $this->get_post_types();
|
41 |
+
$this->show_all_results = false;
|
42 |
+
|
43 |
+
add_action( 'admin_init', array( &$this, 'register_sortable_columns' ) );
|
44 |
+
|
45 |
+
// handle requests for sorting columns
|
46 |
+
add_filter( 'request', array( &$this, 'handle_requests_orderby_column'), 1 );
|
47 |
+
add_action( 'pre_user_query', array( &$this, 'handle_requests_orderby_users_column'), 1 );
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Register sortable columns
|
52 |
+
*
|
53 |
+
* @since 1.0
|
54 |
+
*/
|
55 |
+
function register_sortable_columns()
|
56 |
+
{
|
57 |
+
/** Posts */
|
58 |
+
foreach ( $this->post_types as $post_type )
|
59 |
+
add_filter( "manage_edit-{$post_type}_sortable_columns", array(&$this, 'callback_add_sortable_posts_column'));
|
60 |
+
|
61 |
+
if ( ! $this->is_unlocked )
|
62 |
+
return false;
|
63 |
+
|
64 |
+
/** Users */
|
65 |
+
add_filter( "manage_users_sortable_columns", array(&$this, 'callback_add_sortable_users_column'));
|
66 |
+
|
67 |
+
/** Media */
|
68 |
+
add_filter( "manage_upload_sortable_columns", array(&$this, 'callback_add_sortable_media_column'));
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Callback add Posts sortable column
|
73 |
+
*
|
74 |
+
* @since 1.0
|
75 |
+
*/
|
76 |
+
public function callback_add_sortable_posts_column($columns)
|
77 |
+
{
|
78 |
+
global $post_type;
|
79 |
+
|
80 |
+
return $this->add_managed_sortable_columns($post_type, $columns);
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Callback add Users sortable column
|
85 |
+
*
|
86 |
+
* @since 1.1
|
87 |
+
*/
|
88 |
+
public function callback_add_sortable_users_column($columns)
|
89 |
+
{
|
90 |
+
return $this->add_managed_sortable_columns('wp-users', $columns);
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Callback add Media sortable column
|
95 |
+
*
|
96 |
+
* @since 1.3
|
97 |
+
*/
|
98 |
+
public function callback_add_sortable_media_column($columns)
|
99 |
+
{
|
100 |
+
return $this->add_managed_sortable_columns('wp-media', $columns);
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Add managed sortable columns by Type
|
105 |
+
*
|
106 |
+
* @since 1.1
|
107 |
+
*/
|
108 |
+
private function add_managed_sortable_columns( $type = 'post', $columns )
|
109 |
+
{
|
110 |
+
$display_columns = $this->get_merged_columns($type);
|
111 |
+
|
112 |
+
if ( ! $display_columns )
|
113 |
+
return $columns;
|
114 |
+
|
115 |
+
foreach ( $display_columns as $id => $vars ) {
|
116 |
+
if ( isset($vars['options']['sortorder']) && $vars['options']['sortorder'] == 'on' ){
|
117 |
+
|
118 |
+
// register format
|
119 |
+
$columns[$id] = $this->sanitize_string($vars['label']);
|
120 |
+
}
|
121 |
+
}
|
122 |
+
return $columns;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Admin requests for orderby column
|
127 |
+
*
|
128 |
+
* @since 1.0
|
129 |
+
*/
|
130 |
+
public function handle_requests_orderby_column( $vars )
|
131 |
+
{
|
132 |
+
if ( ! isset( $vars['orderby'] ) )
|
133 |
+
return $vars;
|
134 |
+
|
135 |
+
/** Users */
|
136 |
+
// You would expect to see get_orderby_users_vars(), but sorting for
|
137 |
+
// users is handled through a different filter. Not 'request', but 'pre_user_query'.
|
138 |
+
// See handle_requests_orderby_users_column().
|
139 |
+
|
140 |
+
/** Media */
|
141 |
+
elseif ( $this->request_uri_is_media() )
|
142 |
+
$vars = $this->get_orderby_media_vars($vars);
|
143 |
+
|
144 |
+
/** Posts */
|
145 |
+
elseif ( !empty($vars['post_type']) )
|
146 |
+
$vars = $this->get_orderby_posts_vars($vars);
|
147 |
+
|
148 |
+
return $vars;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Orderby Users column
|
153 |
+
*
|
154 |
+
* @since 1.3
|
155 |
+
*/
|
156 |
+
public function handle_requests_orderby_users_column($user_query)
|
157 |
+
{
|
158 |
+
// query vars
|
159 |
+
$vars = $user_query->query_vars;
|
160 |
+
|
161 |
+
// Column
|
162 |
+
$column = $this->get_orderby_type( $vars['orderby'], 'wp-users' );
|
163 |
+
|
164 |
+
if ( empty($column) )
|
165 |
+
return $vars;
|
166 |
+
|
167 |
+
// var
|
168 |
+
$cusers = array();
|
169 |
+
switch( key($column) ) :
|
170 |
+
|
171 |
+
case 'column-user_id':
|
172 |
+
$user_query->query_vars['orderby'] = 'ID';
|
173 |
+
break;
|
174 |
+
|
175 |
+
case 'column-user_registered':
|
176 |
+
$user_query->query_vars['orderby'] = 'registered';
|
177 |
+
break;
|
178 |
+
|
179 |
+
case 'column-nickname':
|
180 |
+
$user_query->query_vars['orderby'] = 'nickname';
|
181 |
+
break;
|
182 |
+
|
183 |
+
case 'column-first_name':
|
184 |
+
foreach ( $this->get_users_data() as $u )
|
185 |
+
if ($u->first_name || $this->show_all_results )
|
186 |
+
$cusers[$u->ID] = $this->prepare_sort_string_value($u->first_name);
|
187 |
+
$this->set_users_query_vars( &$user_query, $cusers, SORT_REGULAR );
|
188 |
+
break;
|
189 |
+
|
190 |
+
case 'column-last_name':
|
191 |
+
foreach ( $this->get_users_data() as $u )
|
192 |
+
if ($u->last_name || $this->show_all_results )
|
193 |
+
$cusers[$u->ID] = $this->prepare_sort_string_value($u->last_name);
|
194 |
+
$this->set_users_query_vars( &$user_query, $cusers, SORT_REGULAR );
|
195 |
+
break;
|
196 |
+
|
197 |
+
case 'column-user_url':
|
198 |
+
foreach ( $this->get_users_data() as $u )
|
199 |
+
if ($u->user_url || $this->show_all_results )
|
200 |
+
$cusers[$u->ID] = $this->prepare_sort_string_value($u->user_url);
|
201 |
+
$this->set_users_query_vars( &$user_query, $cusers, SORT_REGULAR );
|
202 |
+
break;
|
203 |
+
|
204 |
+
case 'column-user_description':
|
205 |
+
foreach ( $this->get_users_data() as $u )
|
206 |
+
if ($u->user_description || $this->show_all_results )
|
207 |
+
$cusers[$u->ID] = $this->prepare_sort_string_value($u->user_description);
|
208 |
+
$this->set_users_query_vars( &$user_query, $cusers, SORT_REGULAR );
|
209 |
+
break;
|
210 |
+
|
211 |
+
endswitch;
|
212 |
+
|
213 |
+
return $user_query;
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Set sorting vars in User Query Object
|
218 |
+
*
|
219 |
+
* @since 1.3
|
220 |
+
*/
|
221 |
+
private function set_users_query_vars(&$user_query, $sortusers, $sort_flags = SORT_REGULAR )
|
222 |
+
{
|
223 |
+
global $wpdb;
|
224 |
+
|
225 |
+
// vars
|
226 |
+
$vars = $user_query->query_vars;
|
227 |
+
|
228 |
+
// sorting
|
229 |
+
if ( $vars['order'] == 'ASC' )
|
230 |
+
asort($sortusers, $sort_flags);
|
231 |
+
else
|
232 |
+
arsort($sortusers, $sort_flags);
|
233 |
+
|
234 |
+
// alter orderby SQL
|
235 |
+
if ( ! empty ( $sortusers ) ) {
|
236 |
+
$ids = implode(',', array_keys($sortusers));
|
237 |
+
$user_query->query_where .= " AND {$wpdb->prefix}users.ID IN ({$ids})";
|
238 |
+
$user_query->query_orderby = "ORDER BY FIELD ({$wpdb->prefix}users.ID,{$ids})";
|
239 |
+
}
|
240 |
+
|
241 |
+
// cleanup the vars we dont need
|
242 |
+
$vars['order'] = '';
|
243 |
+
$vars['orderby'] = '';
|
244 |
+
|
245 |
+
$user_query->query_vars = $vars;
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Orderby Media column
|
250 |
+
*
|
251 |
+
* @since 1.3
|
252 |
+
*/
|
253 |
+
private function get_orderby_media_vars($vars)
|
254 |
+
{
|
255 |
+
// Column
|
256 |
+
$column = $this->get_orderby_type( $vars['orderby'], 'wp-media' );
|
257 |
+
|
258 |
+
if ( empty($column) )
|
259 |
+
return $vars;
|
260 |
+
|
261 |
+
// var
|
262 |
+
$cposts = array();
|
263 |
+
switch( key($column) ) :
|
264 |
+
|
265 |
+
case 'column-mediaid' :
|
266 |
+
$vars['orderby'] = 'ID';
|
267 |
+
break;
|
268 |
+
|
269 |
+
case 'column-width' :
|
270 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p ) {
|
271 |
+
$meta = wp_get_attachment_metadata($p->ID);
|
272 |
+
$width = !empty($meta['width']) ? $meta['width'] : 0;
|
273 |
+
if ( $width || $this->show_all_results )
|
274 |
+
$cposts[$p->ID] = $width;
|
275 |
+
}
|
276 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_NUMERIC );
|
277 |
+
break;
|
278 |
+
|
279 |
+
case 'column-height' :
|
280 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p ) {
|
281 |
+
$meta = wp_get_attachment_metadata($p->ID);
|
282 |
+
$height = !empty($meta['height']) ? $meta['height'] : 0;
|
283 |
+
if ( $height || $this->show_all_results )
|
284 |
+
$cposts[$p->ID] = $height;
|
285 |
+
}
|
286 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_NUMERIC );
|
287 |
+
break;
|
288 |
+
|
289 |
+
case 'column-dimensions' :
|
290 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p ) {
|
291 |
+
$meta = wp_get_attachment_metadata($p->ID);
|
292 |
+
$height = !empty($meta['height']) ? $meta['height'] : 0;
|
293 |
+
$width = !empty($meta['width']) ? $meta['width'] : 0;
|
294 |
+
$surface = $height*$width;
|
295 |
+
|
296 |
+
if ( $surface || $this->show_all_results )
|
297 |
+
$cposts[$p->ID] = $surface;
|
298 |
+
}
|
299 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_NUMERIC );
|
300 |
+
break;
|
301 |
+
|
302 |
+
case 'column-caption' :
|
303 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p )
|
304 |
+
if ( $p->post_excerpt || $this->show_all_results )
|
305 |
+
$cposts[$p->ID] = $this->prepare_sort_string_value($p->post_excerpt);
|
306 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING);
|
307 |
+
break;
|
308 |
+
|
309 |
+
case 'column-description' :
|
310 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p )
|
311 |
+
if ( $p->post_content || $this->show_all_results )
|
312 |
+
$cposts[$p->ID] = $this->prepare_sort_string_value( $p->post_content );
|
313 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING);
|
314 |
+
break;
|
315 |
+
|
316 |
+
case 'column-mime_type' :
|
317 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p )
|
318 |
+
if ( $p->post_mime_type || $this->show_all_results )
|
319 |
+
$cposts[$p->ID] = $this->prepare_sort_string_value( $p->post_mime_type );
|
320 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING);
|
321 |
+
break;
|
322 |
+
|
323 |
+
case 'column-file_name' :
|
324 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p ) {
|
325 |
+
$meta = get_post_meta($p->ID, '_wp_attached_file', true);
|
326 |
+
$file = !empty($meta) ? basename($meta) : '';
|
327 |
+
if ( $file || $this->show_all_results )
|
328 |
+
$cposts[$p->ID] = $file;
|
329 |
+
}
|
330 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING);
|
331 |
+
break;
|
332 |
+
|
333 |
+
case 'column-alternate_text' :
|
334 |
+
foreach ( (array) $this->get_any_posts_by_posttype('attachment') as $p ) {
|
335 |
+
$alt = get_post_meta($p->ID, '_wp_attachment_image_alt', true);
|
336 |
+
if ( $alt || $this->show_all_results ) {
|
337 |
+
$cposts[$p->ID] = $this->prepare_sort_string_value( $alt );
|
338 |
+
}
|
339 |
+
}
|
340 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING);
|
341 |
+
break;
|
342 |
+
|
343 |
+
endswitch;
|
344 |
+
|
345 |
+
return $vars;
|
346 |
+
}
|
347 |
+
|
348 |
+
/**
|
349 |
+
* Orderby Posts column
|
350 |
+
*
|
351 |
+
* @since 1.3
|
352 |
+
*/
|
353 |
+
private function get_orderby_posts_vars($vars)
|
354 |
+
{
|
355 |
+
$post_type = $vars['post_type'];
|
356 |
+
|
357 |
+
// Column
|
358 |
+
$column = $this->get_orderby_type( $vars['orderby'], $post_type );
|
359 |
+
|
360 |
+
if ( empty($column) )
|
361 |
+
return $vars;
|
362 |
+
|
363 |
+
// id
|
364 |
+
$id = key($column);
|
365 |
+
|
366 |
+
// type
|
367 |
+
$type = $id;
|
368 |
+
|
369 |
+
// custom fields
|
370 |
+
if ( $this->is_column_meta($type) )
|
371 |
+
$type = 'column-post-meta';
|
372 |
+
|
373 |
+
// attachments
|
374 |
+
if ( $type == 'column-attachment-count' )
|
375 |
+
$type = 'column-attachment';
|
376 |
+
|
377 |
+
// var
|
378 |
+
$cposts = array();
|
379 |
+
switch( $type ) :
|
380 |
+
|
381 |
+
case 'column-postid' :
|
382 |
+
$vars['orderby'] = 'ID';
|
383 |
+
break;
|
384 |
+
|
385 |
+
case 'column-order' :
|
386 |
+
$vars['orderby'] = 'menu_order';
|
387 |
+
break;
|
388 |
+
|
389 |
+
case 'column-post-meta' :
|
390 |
+
$field = $column[$id]['field'];
|
391 |
+
|
392 |
+
// orderby type
|
393 |
+
$field_type = 'meta_value';
|
394 |
+
if ( $column[$id]['field_type'] == 'numeric' || $column[$id]['field_type'] == 'library_id' )
|
395 |
+
$field_type = 'meta_value_num';
|
396 |
+
|
397 |
+
$vars = array_merge($vars, array(
|
398 |
+
'meta_key' => $field,
|
399 |
+
'orderby' => $field_type
|
400 |
+
));
|
401 |
+
break;
|
402 |
+
|
403 |
+
case 'column-excerpt' :
|
404 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p ) {
|
405 |
+
|
406 |
+
// add excerpt to the post ids
|
407 |
+
$cposts[$p->ID] = $this->prepare_sort_string_value($p->post_content);
|
408 |
+
}
|
409 |
+
// we will add the sorted post ids to vars['post__in'] and remove unused vars
|
410 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_STRING );
|
411 |
+
break;
|
412 |
+
|
413 |
+
case 'column-word-count' :
|
414 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p )
|
415 |
+
$cposts[$p->ID] = str_word_count( $this->strip_trim( $p->post_content ) );
|
416 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_NUMERIC );
|
417 |
+
break;
|
418 |
+
|
419 |
+
case 'column-page-template' :
|
420 |
+
$templates = get_page_templates();
|
421 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p ) {
|
422 |
+
$page_template = get_post_meta($p->ID, '_wp_page_template', true);
|
423 |
+
$cposts[$p->ID] = array_search($page_template, $templates);
|
424 |
+
}
|
425 |
+
$this->set_vars_post__in( &$vars, $cposts );
|
426 |
+
break;
|
427 |
+
|
428 |
+
case 'column-post_formats' :
|
429 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p ) {
|
430 |
+
$cposts[$p->ID] = get_post_format($p->ID);
|
431 |
+
}
|
432 |
+
$this->set_vars_post__in( &$vars, $cposts );
|
433 |
+
break;
|
434 |
+
|
435 |
+
case 'column-attachment' :
|
436 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p )
|
437 |
+
$cposts[$p->ID] = count( $this->get_attachment_ids($p->ID) );
|
438 |
+
$this->set_vars_post__in( &$vars, $cposts, SORT_NUMERIC );
|
439 |
+
break;
|
440 |
+
|
441 |
+
|
442 |
+
case 'column-page-slug' :
|
443 |
+
foreach ( (array) $this->get_any_posts_by_posttype($post_type) as $p )
|
444 |
+
$cposts[$p->ID] = $p->post_name;
|
445 |
+
$this->set_vars_post__in( &$vars, $cposts );
|
446 |
+
break;
|
447 |
+
|
448 |
+
endswitch;
|
449 |
+
|
450 |
+
return $vars;
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Set post__in for use in WP_Query
|
455 |
+
*
|
456 |
+
* This will order the ID's asc or desc and set the appropriate filters.
|
457 |
+
*
|
458 |
+
* @since 1.2.1
|
459 |
+
*/
|
460 |
+
private function set_vars_post__in( &$vars, $sortposts, $sort_flags = SORT_REGULAR )
|
461 |
+
{
|
462 |
+
// sort post ids by value
|
463 |
+
if ( $vars['order'] == 'asc' )
|
464 |
+
asort($sortposts, $sort_flags);
|
465 |
+
else
|
466 |
+
arsort($sortposts, $sort_flags);
|
467 |
+
|
468 |
+
// this will make sure WP_Query will use the order of the ids that we have just set in 'post__in'
|
469 |
+
add_filter('posts_orderby', array( &$this, 'filter_orderby_post__in'), 10, 2 );
|
470 |
+
|
471 |
+
// cleanup the vars we dont need
|
472 |
+
$vars['order'] = '';
|
473 |
+
$vars['orderby'] = '';
|
474 |
+
|
475 |
+
// add the sorted post ids to the query with the use of post__in
|
476 |
+
$vars['post__in'] = array_keys($sortposts);
|
477 |
+
}
|
478 |
+
|
479 |
+
/**
|
480 |
+
* Get orderby type
|
481 |
+
*
|
482 |
+
* @since 1.1
|
483 |
+
*/
|
484 |
+
private function get_orderby_type($orderby, $type)
|
485 |
+
{
|
486 |
+
$db_columns = $this->get_stored_columns($type);
|
487 |
+
|
488 |
+
if ( $db_columns ) {
|
489 |
+
foreach ( $db_columns as $id => $vars ) {
|
490 |
+
|
491 |
+
// check which custom column was clicked
|
492 |
+
if ( isset( $vars['label'] ) && $orderby == $this->sanitize_string( $vars['label'] ) ) {
|
493 |
+
$column[$id] = $vars;
|
494 |
+
return $column;
|
495 |
+
}
|
496 |
+
}
|
497 |
+
}
|
498 |
+
return false;
|
499 |
+
}
|
500 |
+
|
501 |
+
/**
|
502 |
+
* Maintain order of ids that are set in the post__in var.
|
503 |
+
*
|
504 |
+
* This will force the returned posts to use the order of the ID's that
|
505 |
+
* have been set in post__in. Without this the ID's will be set in numeric order.
|
506 |
+
* See the WP_Query object for more info about the use of post__in.
|
507 |
+
*
|
508 |
+
* @since 1.2.1
|
509 |
+
*/
|
510 |
+
public function filter_orderby_post__in($orderby, $wp)
|
511 |
+
{
|
512 |
+
global $wpdb;
|
513 |
+
|
514 |
+
// we need the query vars
|
515 |
+
$vars = $wp->query_vars;
|
516 |
+
if ( ! empty ( $vars['post__in'] ) ) {
|
517 |
+
// now we can get the ids
|
518 |
+
$ids = implode(',', $vars['post__in']);
|
519 |
+
|
520 |
+
// by adding FIELD to the SQL query we are forcing the order of the ID's
|
521 |
+
return "FIELD ({$wpdb->prefix}posts.ID,{$ids})";
|
522 |
+
}
|
523 |
+
}
|
524 |
+
|
525 |
+
/**
|
526 |
+
* Get any posts by post_type
|
527 |
+
*
|
528 |
+
* @since 1.2.1
|
529 |
+
*/
|
530 |
+
private function get_any_posts_by_posttype( $post_type )
|
531 |
+
{
|
532 |
+
$allposts = get_posts(array(
|
533 |
+
'numberposts' => -1,
|
534 |
+
'post_status' => 'any',
|
535 |
+
'post_type' => $post_type
|
536 |
+
));
|
537 |
+
return $allposts;
|
538 |
+
}
|
539 |
+
/**
|
540 |
+
* Request URI is Media
|
541 |
+
*
|
542 |
+
* @since 1.3
|
543 |
+
*/
|
544 |
+
private function request_uri_is_media()
|
545 |
+
{
|
546 |
+
if (strpos( $_SERVER['REQUEST_URI'], '/upload.php' ) !== false )
|
547 |
+
return true;
|
548 |
+
|
549 |
+
return false;
|
550 |
+
}
|
551 |
+
|
552 |
+
/**
|
553 |
+
* Request URI is Users
|
554 |
+
*
|
555 |
+
* @since 1.3
|
556 |
+
*/
|
557 |
+
private function request_uri_is_users()
|
558 |
+
{
|
559 |
+
if (strpos( $_SERVER['REQUEST_URI'], '/users.php' ) !== false )
|
560 |
+
return true;
|
561 |
+
|
562 |
+
return false;
|
563 |
+
}
|
564 |
+
|
565 |
+
/**
|
566 |
+
* Prepare the value for being by sorting
|
567 |
+
*
|
568 |
+
* @since 1.3
|
569 |
+
*/
|
570 |
+
private function prepare_sort_string_value($string)
|
571 |
+
{
|
572 |
+
// remove tags and only get the first 20 chars and force lowercase.
|
573 |
+
$string = strtolower( substr( $this->strip_trim($string),0 ,20 ) );
|
574 |
+
|
575 |
+
return $string;
|
576 |
+
}
|
577 |
+
|
578 |
+
/**
|
579 |
+
* Get users data
|
580 |
+
*
|
581 |
+
* @since 1.3
|
582 |
+
*/
|
583 |
+
function get_users_data()
|
584 |
+
{
|
585 |
+
$userdatas = array();
|
586 |
+
$wp_users = get_users( array(
|
587 |
+
'blog_id' => $GLOBALS['blog_id'],
|
588 |
+
));
|
589 |
+
foreach ( $wp_users as $u ) {
|
590 |
+
$userdatas[$u->ID] = get_userdata($u->ID);
|
591 |
+
}
|
592 |
+
return $userdatas;
|
593 |
+
}
|
594 |
+
}
|
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,24 @@ 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 |
* Init Class
|
33 |
*
|
34 |
* @since 1.0
|
35 |
*/
|
36 |
-
|
37 |
|
38 |
/**
|
39 |
-
*
|
40 |
*
|
41 |
* @since 1.0
|
42 |
*
|
@@ -44,55 +51,67 @@ $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 |
-
add_action( 'wp_loaded', array( &$this, 'init') );
|
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( &$this, 'settings_menu') );
|
86 |
add_action( 'admin_init', array( &$this, 'register_settings') );
|
87 |
-
add_action( 'admin_init', array( &$this, 'register_columns' ) );
|
88 |
-
add_action( '
|
89 |
-
add_action( '
|
90 |
-
|
|
|
91 |
add_action( 'admin_print_styles' , array( &$this, 'column_styles') );
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
/**
|
97 |
* Admin Menu.
|
98 |
*
|
@@ -115,9 +134,16 @@ class Codepress_Admin_Columns
|
|
115 |
array( &$this, 'plugin_settings_page')
|
116 |
);
|
117 |
|
118 |
-
//
|
|
|
|
|
|
|
119 |
add_action( "admin_print_styles-$page", array( &$this, 'admin_styles') );
|
120 |
-
|
|
|
|
|
|
|
|
|
121 |
|
122 |
/**
|
123 |
* Add Settings link to plugin page
|
@@ -140,187 +166,129 @@ class Codepress_Admin_Columns
|
|
140 |
*/
|
141 |
public function register_columns()
|
142 |
{
|
143 |
-
|
144 |
-
|
|
|
145 |
// register column per post type
|
146 |
-
add_filter("manage_edit-{$post_type}_columns", array(&$this, '
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
151 |
}
|
152 |
|
153 |
/**
|
154 |
-
* Callback
|
155 |
*
|
156 |
* @since 1.0
|
157 |
*/
|
158 |
-
public function
|
159 |
-
{
|
160 |
global $post_type;
|
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 |
-
|
189 |
{
|
190 |
-
//
|
191 |
-
$
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
<tr id='cpac-box-{$id}' valign='top' class='cpac-box-row{$class}'>
|
208 |
-
<th class='cpac_post_type' scope='row'>
|
209 |
-
{$label}
|
210 |
-
</th>
|
211 |
-
<td>
|
212 |
-
<h3 class='cpac_post_type hidden'>{$label}</h3>
|
213 |
-
{$boxes}
|
214 |
-
</td>
|
215 |
-
</tr>
|
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 |
-
<div class="postbox-container" style="width:20%;">
|
276 |
-
<div class="metabox-holder">
|
277 |
-
<div class="meta-box-sortables">
|
278 |
-
|
279 |
-
<div id="side-cpac-settings" class="postbox">
|
280 |
-
<div title="Click to toggle" class="handlediv"><br></div>
|
281 |
-
<h3 class="hndle">
|
282 |
-
<span><?php _e('Need support?', $this->textdomain) ?></span>
|
283 |
-
</h3>
|
284 |
-
<div class="inside">
|
285 |
-
<p><?php printf(__('If you are having problems with this plugin, please talk about them in the <a href="%s">Support forums</a>.', $this->textdomain), 'http://wordpress.org/tags/codepress-admin-columns' );?></p>
|
286 |
-
<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), 'http://www.codepress.nl/plugins/codepress-admin-columns#feedback');?></p>
|
287 |
-
</div>
|
288 |
-
</div><!-- side-cpac-settings -->
|
289 |
-
|
290 |
-
</div>
|
291 |
-
</div>
|
292 |
-
</div><!-- .postbox-container -->
|
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 "
|
@@ -329,7 +297,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 +307,97 @@ class Codepress_Admin_Columns
|
|
339 |
*
|
340 |
* @since 1.0
|
341 |
*/
|
342 |
-
|
343 |
{
|
344 |
//get saved database columns
|
345 |
-
$db_columns = $this->
|
346 |
-
|
347 |
-
|
348 |
-
$
|
|
|
|
|
|
|
349 |
|
350 |
-
|
351 |
-
|
|
|
|
|
|
|
352 |
|
353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
$default_columns = wp_parse_args($wp_custom_columns, $wp_default_columns);
|
355 |
-
|
356 |
// loop throught the active columns
|
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 |
-
$display_columns = wp_parse_args($db_columns, $default_columns);
|
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,11 +405,17 @@ 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 |
-
if ( ! empty($values['options']['hide_options']) ) {
|
408 |
$action = $more_options = '';
|
409 |
}
|
410 |
|
@@ -414,17 +425,16 @@ class Codepress_Admin_Columns
|
|
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 |
-
<input type='hidden' name='cpac_options[columns][{$post_type}][{$key}][sortorder]' value='{$sortorder}'/>
|
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[columns][{$
|
427 |
-
<input type='text' name='cpac_options[columns][{$
|
428 |
<br/>
|
429 |
{$more_options}
|
430 |
</div>
|
@@ -439,13 +449,13 @@ class Codepress_Admin_Columns
|
|
439 |
*
|
440 |
* @since 1.0
|
441 |
*/
|
442 |
-
private function get_additional_box_options($post_type, $
|
443 |
{
|
444 |
$fields = '';
|
445 |
|
446 |
// Custom Fields
|
447 |
-
if (
|
448 |
-
$fields .= $this->get_box_options_customfields($post_type, $
|
449 |
|
450 |
return $fields;
|
451 |
}
|
@@ -455,10 +465,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 +495,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 +514,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 +532,18 @@ class Codepress_Admin_Columns
|
|
513 |
}
|
514 |
|
515 |
$inside = "
|
516 |
-
<label for='cpac_options[columns][{$
|
517 |
-
<select name='cpac_options[columns][{$
|
518 |
<br/>
|
519 |
-
<label for='cpac_options[columns][{$
|
520 |
-
<select name='cpac_options[columns][{$
|
521 |
<br/>
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
{$remove}
|
523 |
";
|
524 |
|
@@ -526,17 +551,27 @@ 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 |
-
// get mata fields
|
537 |
-
$sql = 'SELECT DISTINCT meta_key FROM '.$wpdb->postmeta.' pm JOIN '.$wpdb->posts.' p ON pm.post_id = p.ID WHERE p.post_type = "' . mysql_real_escape_string($post_type) . '" ORDER BY 1';
|
538 |
-
$fields = $wpdb->get_results($sql, ARRAY_N);
|
539 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
540 |
// postmeta
|
541 |
if ( $fields ) {
|
542 |
$meta_fields = array();
|
@@ -546,9 +581,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 +592,31 @@ class Codepress_Admin_Columns
|
|
558 |
*
|
559 |
* @since 1.0
|
560 |
*/
|
561 |
-
public function
|
562 |
{
|
563 |
-
wp_enqueue_script( 'dashboard' );
|
564 |
-
wp_enqueue_script( 'jquery-ui-sortable' );
|
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
|
@@ -609,7 +655,7 @@ 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(&$this, 'get_default_plugin_options') );
|
614 |
|
615 |
register_setting( 'cpac-settings-group', 'cpac_options', array(&$this, 'options_callback') );
|
@@ -630,7 +676,7 @@ class Codepress_Admin_Columns
|
|
630 |
}
|
631 |
|
632 |
/**
|
633 |
-
*
|
634 |
*
|
635 |
* @since 1.0
|
636 |
*/
|
@@ -644,23 +690,43 @@ 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 +745,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 +764,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 +777,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 = '';
|
@@ -776,10 +833,9 @@ 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
|
@@ -787,9 +843,14 @@ class Codepress_Admin_Columns
|
|
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) ) {
|
@@ -804,17 +865,22 @@ class Codepress_Admin_Columns
|
|
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,46 +889,224 @@ 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 |
* Get column value of Custom Field
|
851 |
*
|
852 |
* @since 1.0
|
853 |
-
*/
|
854 |
-
private function get_column_value_custom_field($
|
855 |
{
|
856 |
-
|
857 |
-
|
858 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
859 |
|
860 |
// Get meta field value
|
861 |
-
$meta =
|
862 |
|
863 |
// multiple meta values
|
864 |
if ( ( $fieldtype == 'array' && is_array($meta) ) || is_array($meta) ) {
|
865 |
-
$meta =
|
866 |
$meta = $this->recursive_implode(', ', $meta);
|
867 |
}
|
868 |
|
@@ -886,11 +1130,115 @@ class Codepress_Admin_Columns
|
|
886 |
|
887 |
// Excerpt
|
888 |
case "excerpt" :
|
889 |
-
$meta = $this->get_shortened_string($meta,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
890 |
break;
|
891 |
|
892 |
endswitch;
|
893 |
|
|
|
|
|
|
|
894 |
return $meta;
|
895 |
}
|
896 |
|
@@ -909,55 +1257,30 @@ class Codepress_Admin_Columns
|
|
909 |
$retVal[] = $r_pieces;
|
910 |
}
|
911 |
}
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
/**
|
916 |
-
* Set Columns for Registering
|
917 |
-
*
|
918 |
-
* @since 1.0
|
919 |
-
*/
|
920 |
-
private function set_column($columns, $post_type)
|
921 |
-
{
|
922 |
-
$db_columns = $this->get_db_columns($post_type);
|
923 |
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
// set already loaded columns by plugins
|
928 |
-
$set_columns = $this->filter_preset_columns($columns, $post_type);
|
929 |
-
|
930 |
-
// loop through columns
|
931 |
-
foreach ( $db_columns as $key => $values ) {
|
932 |
-
|
933 |
-
// is active
|
934 |
-
if ( isset($values['state']) && $values['state'] == 'on' ){
|
935 |
-
|
936 |
-
// register format
|
937 |
-
$set_columns[$key] = $values['label'];
|
938 |
-
}
|
939 |
-
}
|
940 |
-
return $set_columns;
|
941 |
-
}
|
942 |
|
943 |
/**
|
944 |
* Set columns. These columns apply either for every post or set by a plugin.
|
945 |
*
|
946 |
* @since 1.0
|
947 |
*/
|
948 |
-
private function filter_preset_columns(
|
949 |
{
|
950 |
-
$options =
|
951 |
|
952 |
if ( !$options )
|
953 |
return $columns;
|
954 |
|
955 |
// we use the wp default columns for filtering...
|
956 |
-
$
|
957 |
-
|
958 |
// ... the ones that are set by plugins, theme functions and such.
|
959 |
-
$dif_columns = array_diff(array_keys($columns), array_keys($
|
960 |
-
|
961 |
// we add those to the columns
|
962 |
$pre_columns = array();
|
963 |
if ( $dif_columns ) {
|
@@ -967,44 +1290,30 @@ class Codepress_Admin_Columns
|
|
967 |
}
|
968 |
|
969 |
return $pre_columns;
|
970 |
-
}
|
971 |
|
972 |
/**
|
973 |
-
*
|
974 |
*
|
975 |
* @since 1.0
|
976 |
*/
|
977 |
-
private function
|
978 |
{
|
979 |
-
|
980 |
-
|
981 |
-
if ( !$db_columns )
|
982 |
-
return $columns;
|
983 |
|
984 |
-
//
|
985 |
-
|
|
|
986 |
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
/**
|
998 |
-
* Get WP default supported admin columns per post type.
|
999 |
-
*
|
1000 |
-
* @since 1.0
|
1001 |
-
*/
|
1002 |
-
private function get_wp_default_columns($post_type = 'post')
|
1003 |
-
{
|
1004 |
-
// load some dependencies
|
1005 |
-
require_once(ABSPATH . 'wp-admin\includes\template.php');
|
1006 |
-
require_once(ABSPATH . 'wp-admin\includes\class-wp-list-table.php');
|
1007 |
-
require_once(ABSPATH . 'wp-admin\includes\class-wp-posts-list-table.php');
|
1008 |
|
1009 |
// we need to change the current screen
|
1010 |
global $current_screen;
|
@@ -1016,12 +1325,96 @@ 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,8 +1423,13 @@ 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(
|
@@ -1041,154 +1439,380 @@ class Codepress_Admin_Columns
|
|
1041 |
)
|
1042 |
);
|
1043 |
}
|
1044 |
-
|
1045 |
-
// reset current screen
|
1046 |
-
$current_screen = $org_current_screen;
|
1047 |
-
|
1048 |
return $uniform_colums;
|
1049 |
}
|
1050 |
-
|
1051 |
/**
|
1052 |
-
*
|
1053 |
*
|
1054 |
* @since 1.0
|
1055 |
*/
|
1056 |
-
private function
|
1057 |
{
|
1058 |
$custom_columns = array();
|
1059 |
|
1060 |
-
// default arguments
|
1061 |
-
$defaults = array(
|
1062 |
-
'label' => '',
|
1063 |
-
'sortorder' => '',
|
1064 |
-
'state' => '',
|
1065 |
-
|
1066 |
-
// options are static
|
1067 |
-
'options' => array(
|
1068 |
-
'type_label' => __('Custom', $this->textdomain),
|
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'] =
|
1077 |
'label' => __('Featured Image', $this->textdomain),
|
1078 |
'options' => array(
|
1079 |
'type_label' => __('Image', $this->textdomain)
|
1080 |
)
|
1081 |
-
)
|
1082 |
}
|
1083 |
|
1084 |
// Excerpt support
|
1085 |
if ( post_type_supports($post_type, 'editor') ) {
|
1086 |
-
$custom_columns['column-excerpt'] =
|
1087 |
'label' => __('Excerpt', $this->textdomain),
|
1088 |
'options' => array(
|
1089 |
-
'type_label' => __('Excerpt', $this->textdomain)
|
|
|
1090 |
)
|
1091 |
-
)
|
1092 |
}
|
1093 |
|
1094 |
// Sticky support
|
1095 |
if ( $post_type == 'post' ) {
|
1096 |
-
$custom_columns['column-sticky'] =
|
1097 |
'label' => __('Sticky', $this->textdomain),
|
1098 |
'options' => array(
|
1099 |
'type_label' => __('Sticky', $this->textdomain)
|
1100 |
)
|
1101 |
-
)
|
1102 |
}
|
1103 |
|
1104 |
// Order support
|
1105 |
if ( post_type_supports($post_type, 'page-attributes') ) {
|
1106 |
-
$custom_columns['column-order'] =
|
1107 |
-
'label' => __('Page Order', $this->textdomain),
|
1108 |
-
'sortorder' => 'on',
|
1109 |
'options' => array(
|
1110 |
-
'type_label' => __('Order', $this->textdomain)
|
|
|
1111 |
)
|
1112 |
-
)
|
1113 |
}
|
1114 |
|
1115 |
// Page Template
|
1116 |
if ( $post_type == 'page' ) {
|
1117 |
-
$custom_columns['column-page-template'] =
|
1118 |
'label' => __('Page Template', $this->textdomain),
|
1119 |
-
'sortorder' => 'on',
|
1120 |
'options' => array(
|
1121 |
-
'type_label' => __('Page Template', $this->textdomain)
|
|
|
1122 |
)
|
1123 |
-
)
|
1124 |
}
|
1125 |
|
1126 |
// Post Formats
|
1127 |
if ( post_type_supports($post_type, 'post-formats') ) {
|
1128 |
-
$custom_columns['column-post_formats'] =
|
1129 |
'label' => __('Post Format', $this->textdomain),
|
1130 |
'options' => array(
|
1131 |
-
'type_label' => __('Post Format', $this->textdomain)
|
|
|
1132 |
)
|
1133 |
-
)
|
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] =
|
1142 |
-
'label' => $tax->label,
|
1143 |
-
'options' => array(
|
1144 |
-
'type_label' => __('Taxonomy', $this->textdomain)
|
1145 |
-
)
|
1146 |
-
)
|
1147 |
-
}
|
1148 |
-
}
|
1149 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1150 |
|
1151 |
-
//
|
1152 |
-
$custom_columns['column-
|
1153 |
-
'label' => '
|
1154 |
-
'sortorder' => 'on',
|
1155 |
'options' => array(
|
1156 |
-
'type_label'
|
1157 |
-
|
1158 |
-
|
|
|
1159 |
|
1160 |
-
//
|
1161 |
-
$custom_columns['column-
|
1162 |
-
'label' => __('
|
1163 |
-
'sortorder' => 'on',
|
1164 |
'options' => array(
|
1165 |
-
'type_label'
|
1166 |
-
|
1167 |
-
|
|
|
1168 |
|
1169 |
-
//
|
1170 |
-
$custom_columns['column-
|
1171 |
-
'label' => __('
|
1172 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1173 |
'options' => array(
|
1174 |
-
'type_label' => __('
|
|
|
|
|
|
|
1175 |
)
|
1176 |
-
)
|
1177 |
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
'label' => __('Custom Field', $this->textdomain),
|
1182 |
-
'field' => '',
|
1183 |
-
'field_type' => '',
|
1184 |
-
'options' => array(
|
1185 |
-
'type_label' => __('Field', $this->textdomain),
|
1186 |
-
'class' => 'cpac-box-metafield'
|
1187 |
-
)
|
1188 |
-
), $defaults);
|
1189 |
-
}
|
1190 |
|
1191 |
-
return
|
1192 |
}
|
1193 |
|
1194 |
/**
|
@@ -1196,14 +1820,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,7 +1837,7 @@ class Codepress_Admin_Columns
|
|
1213 |
*
|
1214 |
* @since 1.0
|
1215 |
*/
|
1216 |
-
private function
|
1217 |
{
|
1218 |
// set
|
1219 |
$menu = '';
|
@@ -1225,16 +1849,16 @@ class Codepress_Admin_Columns
|
|
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
|
@@ -1258,9 +1882,7 @@ class Codepress_Admin_Columns
|
|
1258 |
* @since 1.0
|
1259 |
*/
|
1260 |
private function is_menu_type_current( $post_type )
|
1261 |
-
{
|
1262 |
-
//print_r($post_type);
|
1263 |
-
|
1264 |
// referer
|
1265 |
$referer = '';
|
1266 |
if ( ! empty($_REQUEST['cpac_type']) )
|
@@ -1292,39 +1914,25 @@ class Codepress_Admin_Columns
|
|
1292 |
*
|
1293 |
* @since 1.0
|
1294 |
*/
|
1295 |
-
private function get_singular_name( $
|
1296 |
{
|
1297 |
-
|
1298 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1299 |
return $label;
|
1300 |
}
|
1301 |
|
1302 |
-
/**
|
1303 |
-
* Admin requests for orderby column
|
1304 |
-
*
|
1305 |
-
* @since 1.0
|
1306 |
-
*/
|
1307 |
-
public function handle_requests_orderby_column( $vars )
|
1308 |
-
{
|
1309 |
-
if ( isset( $vars['orderby'] ) ) {
|
1310 |
-
// get saved columns
|
1311 |
-
$db_columns = $this->get_db_columns($vars['post_type']);
|
1312 |
-
|
1313 |
-
// Column Page Order
|
1314 |
-
if ( isset($db_columns['column-order']) ) {
|
1315 |
-
|
1316 |
-
// sanitizing label
|
1317 |
-
$label = $this->sanitize_string($db_columns['column-order']['label']);
|
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 |
* Sanitize label
|
1330 |
*
|
@@ -1332,14 +1940,17 @@ class Codepress_Admin_Columns
|
|
1332 |
*
|
1333 |
* @since 1.0
|
1334 |
*/
|
1335 |
-
|
1336 |
{
|
1337 |
$string = esc_url($string);
|
1338 |
-
|
|
|
|
|
|
|
1339 |
}
|
1340 |
|
1341 |
/**
|
1342 |
-
* Get
|
1343 |
*
|
1344 |
* @since 1.0
|
1345 |
*/
|
@@ -1348,6 +1959,19 @@ class Codepress_Admin_Columns
|
|
1348 |
return plugins_url($file, __FILE__);
|
1349 |
}
|
1350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1351 |
/**
|
1352 |
* Get a thumbnail
|
1353 |
*
|
@@ -1357,14 +1981,264 @@ class Codepress_Admin_Columns
|
|
1357 |
{
|
1358 |
if ( empty($image) )
|
1359 |
return false;
|
1360 |
-
|
|
|
1361 |
$image_path = str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $image);
|
1362 |
-
$new = image_resize( $image_path, 120, 80, true);
|
1363 |
|
1364 |
-
|
1365 |
-
|
|
|
1366 |
|
1367 |
-
|
1368 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1369 |
}
|
1370 |
?>
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Codepress Admin Columns
|
4 |
+
Version: 1.3
|
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.3' );
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Dependencies
|
33 |
+
*
|
34 |
+
* @since 1.3
|
35 |
+
*/
|
36 |
+
require_once dirname( __FILE__ ) . '/classes/sortable.php';
|
37 |
|
38 |
/**
|
39 |
* Init Class
|
40 |
*
|
41 |
* @since 1.0
|
42 |
*/
|
43 |
+
new Codepress_Admin_Columns();
|
44 |
|
45 |
/**
|
46 |
+
* Codepress Admin Columns Class
|
47 |
*
|
48 |
* @since 1.0
|
49 |
*
|
51 |
class Codepress_Admin_Columns
|
52 |
{
|
53 |
private $post_types,
|
|
|
|
|
54 |
$slug,
|
55 |
+
$textdomain,
|
56 |
+
$codepress_url,
|
57 |
+
$wordpress_url,
|
58 |
+
$excerpt_length,
|
59 |
+
$admin_page;
|
60 |
|
61 |
/**
|
62 |
+
* Constructor
|
63 |
*
|
64 |
* @since 1.0
|
65 |
*/
|
66 |
function __construct()
|
67 |
{
|
68 |
+
add_action( 'wp_loaded', array( &$this, 'init') );
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
+
* Initialize plugin.
|
73 |
*
|
74 |
* Loading sequence is determined and intialized.
|
75 |
*
|
76 |
* @since 1.0
|
77 |
*/
|
78 |
+
public function init()
|
79 |
+
{
|
80 |
// vars
|
81 |
$this->post_types = $this->get_post_types();
|
82 |
+
|
83 |
+
// set
|
|
|
|
|
|
|
84 |
$this->slug = 'codepress-admin-columns';
|
85 |
$this->textdomain = 'codepress-admin-columns';
|
86 |
+
$this->codepress_url = 'http://www.codepress.nl/plugins/codepress-admin-columns';
|
87 |
+
$this->wordpress_url = 'http://wordpress.org/tags/codepress-admin-columns';
|
88 |
+
|
89 |
+
// number of words
|
90 |
+
$this->excerpt_length = 15;
|
91 |
|
92 |
// translations
|
93 |
load_plugin_textdomain( $this->textdomain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
94 |
|
95 |
+
// actions
|
96 |
+
add_action( 'admin_menu', array( &$this, 'settings_menu') );
|
97 |
add_action( 'admin_init', array( &$this, 'register_settings') );
|
98 |
+
add_action( 'admin_init', array( &$this, 'register_columns' ) );
|
99 |
+
add_action( 'manage_pages_custom_column', array( &$this, 'manage_posts_column_value'), 10, 2 );
|
100 |
+
add_action( 'manage_posts_custom_column', array( &$this, 'manage_posts_column_value'), 10, 2 );
|
101 |
+
add_filter( 'manage_users_custom_column', array( &$this, 'manage_users_column_value'), 10, 3 );
|
102 |
+
add_action( 'manage_media_custom_column', array( &$this, 'manage_media_column_value'), 10, 2 );
|
103 |
add_action( 'admin_print_styles' , array( &$this, 'column_styles') );
|
104 |
+
|
105 |
+
// handle requests gets a low priority so it will trigger when all other plugins have loaded their columns
|
106 |
+
add_action( 'admin_init', array( &$this, 'handle_requests' ), 1000 );
|
107 |
+
|
108 |
+
// filters
|
109 |
+
add_filter( 'plugin_action_links', array( &$this, 'add_settings_link'), 1, 2);
|
110 |
+
|
111 |
+
// dev
|
112 |
+
$this->set_license_key('sortable', 'empty');
|
113 |
+
}
|
114 |
+
|
115 |
/**
|
116 |
* Admin Menu.
|
117 |
*
|
134 |
array( &$this, 'plugin_settings_page')
|
135 |
);
|
136 |
|
137 |
+
// set admin page
|
138 |
+
$this->admin_page = $page;
|
139 |
+
|
140 |
+
// settings page specific styles and scripts
|
141 |
add_action( "admin_print_styles-$page", array( &$this, 'admin_styles') );
|
142 |
+
add_action( "admin_print_scripts-$page", array( &$this, 'admin_scripts') );
|
143 |
+
|
144 |
+
// add help tabs
|
145 |
+
// add_action("load-$page", array( &$this, 'help_tabs'));
|
146 |
+
}
|
147 |
|
148 |
/**
|
149 |
* Add Settings link to plugin page
|
166 |
*/
|
167 |
public function register_columns()
|
168 |
{
|
169 |
+
/** Posts */
|
170 |
+
foreach ( $this->post_types as $post_type ) {
|
171 |
+
|
172 |
// register column per post type
|
173 |
+
add_filter("manage_edit-{$post_type}_columns", array(&$this, 'callback_add_posts_column_headings'));
|
174 |
+
}
|
175 |
+
|
176 |
+
/** Users */
|
177 |
+
add_filter( "manage_users_columns", array(&$this, 'callback_add_users_column_headings'));
|
178 |
+
|
179 |
+
/** Media */
|
180 |
+
add_filter( "manage_upload_columns", array(&$this, 'callback_add_media_column_headings'), 10, 2);
|
181 |
}
|
182 |
|
183 |
/**
|
184 |
+
* Callback add Posts Column
|
185 |
*
|
186 |
* @since 1.0
|
187 |
*/
|
188 |
+
public function callback_add_posts_column_headings($columns)
|
189 |
+
{
|
190 |
global $post_type;
|
191 |
+
|
192 |
+
return $this->add_columns_headings($post_type, $columns);
|
|
|
193 |
}
|
194 |
|
195 |
/**
|
196 |
+
* Callback add Users column
|
197 |
*
|
198 |
+
* @since 1.1
|
199 |
*/
|
200 |
+
public function callback_add_users_column_headings($columns)
|
201 |
+
{
|
202 |
+
return $this->add_columns_headings('wp-users', $columns);
|
|
|
|
|
|
|
203 |
}
|
204 |
|
205 |
/**
|
206 |
+
* Callback add Media column
|
207 |
*
|
208 |
+
* @since 1.3
|
209 |
+
*/
|
210 |
+
public function callback_add_media_column_headings($columns)
|
211 |
+
{
|
212 |
+
return $this->add_columns_headings('wp-media', $columns);
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Add managed columns by Type
|
217 |
*
|
218 |
+
* @since 1.1
|
219 |
*/
|
220 |
+
private function add_columns_headings( $type = 'post', $columns )
|
221 |
{
|
222 |
+
// only get stored columns.. the rest we don't need
|
223 |
+
$db_columns = $this->get_stored_columns($type);
|
224 |
+
|
225 |
+
if ( !$db_columns )
|
226 |
+
return $columns;
|
227 |
+
|
228 |
+
// filter already loaded columns by plugins
|
229 |
+
$set_columns = $this->filter_preset_columns( $type, $columns );
|
230 |
+
|
231 |
+
// loop through columns
|
232 |
+
foreach ( $db_columns as $id => $values ) {
|
233 |
+
// is active
|
234 |
+
if ( isset($values['state']) && $values['state'] == 'on' ){
|
235 |
+
|
236 |
+
// register format
|
237 |
+
$set_columns[$id] = $values['label'];
|
238 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
}
|
240 |
|
241 |
+
return $set_columns;
|
242 |
+
}
|
243 |
|
244 |
+
/**
|
245 |
+
* Add managed sortable columns by Type
|
246 |
+
*
|
247 |
+
* @since 1.1
|
248 |
+
*/
|
249 |
+
private function add_managed_sortable_columns( $type = 'post', $columns )
|
250 |
+
{
|
251 |
+
$display_columns = $this->get_merged_columns($type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
|
253 |
+
if ( ! $display_columns )
|
254 |
+
return $columns;
|
255 |
+
|
256 |
+
foreach ( $display_columns as $id => $vars ) {
|
257 |
+
if ( isset($vars['options']['sortorder']) && $vars['options']['sortorder'] == 'on' ){
|
258 |
+
|
259 |
+
// register format
|
260 |
+
$columns[$id] = $this->sanitize_string($vars['label']);
|
261 |
+
}
|
262 |
+
}
|
263 |
+
return $columns;
|
264 |
}
|
265 |
+
|
266 |
/**
|
267 |
* Get a list of Column options per post type
|
268 |
*
|
269 |
* @since 1.0
|
270 |
*/
|
271 |
+
private function get_column_boxes($type)
|
272 |
{
|
273 |
// merge all columns
|
274 |
+
$display_columns = $this->get_merged_columns($type);
|
275 |
|
276 |
// define
|
277 |
$list = '';
|
278 |
|
279 |
// loop throught the active columns
|
280 |
if ( $display_columns ) {
|
281 |
+
foreach ( $display_columns as $id => $values ) {
|
282 |
|
283 |
// add items to the list
|
284 |
+
$list .= $this->get_box($type, $id, $values);
|
285 |
|
286 |
}
|
287 |
}
|
288 |
|
289 |
// custom field button
|
290 |
$button_add_column = '';
|
291 |
+
if ( $this->get_meta_by_type($type) )
|
292 |
$button_add_column = "<a href='javacript:;' class='cpac-add-customfield-column button'>+ " . __('Add Custom Field Column') . "</a>";
|
293 |
|
294 |
return "
|
297 |
{$list}
|
298 |
</ul>
|
299 |
{$button_add_column}
|
300 |
+
<div class='cpac-reorder-msg'>" . __('drag and drop to reorder', $this->textdomain) . "</div>
|
301 |
</div>
|
302 |
";
|
303 |
}
|
307 |
*
|
308 |
* @since 1.0
|
309 |
*/
|
310 |
+
protected function get_merged_columns( $type )
|
311 |
{
|
312 |
//get saved database columns
|
313 |
+
$db_columns = $this->get_stored_columns($type);
|
314 |
+
|
315 |
+
/** Users */
|
316 |
+
if ( $type == 'wp-users' ) {
|
317 |
+
$wp_default_columns = $this->get_wp_default_users_columns();
|
318 |
+
$wp_custom_columns = $this->get_custom_users_columns();
|
319 |
+
}
|
320 |
|
321 |
+
/** Media */
|
322 |
+
elseif ( $type == 'wp-media' ) {
|
323 |
+
$wp_default_columns = $this->get_wp_default_media_columns();
|
324 |
+
$wp_custom_columns = $this->get_custom_media_columns();
|
325 |
+
}
|
326 |
|
327 |
+
/** Posts */
|
328 |
+
else {
|
329 |
+
$wp_default_columns = $this->get_wp_default_posts_columns($type);
|
330 |
+
$wp_custom_columns = $this->get_custom_posts_columns($type);
|
331 |
+
}
|
332 |
+
|
333 |
+
// merge columns
|
334 |
$default_columns = wp_parse_args($wp_custom_columns, $wp_default_columns);
|
335 |
+
|
336 |
// loop throught the active columns
|
337 |
if ( $db_columns ) {
|
338 |
+
|
339 |
+
// let's remove any unavailable columns.. such as disabled plugins
|
340 |
+
$db_columns = $this->remove_unavailable_columns($db_columns, $default_columns);
|
341 |
+
|
342 |
+
foreach ( $db_columns as $id => $values ) {
|
343 |
|
344 |
// get column meta options from custom columns
|
345 |
+
if ( $this->is_column_meta($id) )
|
346 |
+
$db_columns[$id]['options'] = $wp_custom_columns['column-meta-1']['options'];
|
347 |
|
348 |
// add static options
|
349 |
+
elseif ( isset($default_columns[$id]['options']) )
|
350 |
+
$db_columns[$id]['options'] = $default_columns[$id]['options'];
|
351 |
|
352 |
+
unset($default_columns[$id]);
|
353 |
}
|
354 |
}
|
355 |
|
356 |
// merge all
|
357 |
+
$display_columns = wp_parse_args($db_columns, $default_columns);
|
358 |
+
|
359 |
return $display_columns;
|
360 |
}
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Remove deactivated (plugin) columns
|
364 |
+
*
|
365 |
+
* This will remove any columns that have been stored, but are no longer available. This happends
|
366 |
+
* when plugins are deactivated or when they are removed from the theme functions.
|
367 |
+
*
|
368 |
+
* @since 1.2
|
369 |
+
*/
|
370 |
+
private function remove_unavailable_columns( array $db_columns, array $default_columns)
|
371 |
+
{
|
372 |
+
// check or differences
|
373 |
+
$diff = array_diff( array_keys($db_columns), array_keys($default_columns) );
|
374 |
+
|
375 |
+
if ( ! empty($diff) && is_array($diff) ) {
|
376 |
+
foreach ( $diff as $column_name ){
|
377 |
+
// make an exception for column-meta-xxx
|
378 |
+
if ( ! $this->is_column_meta($column_name) ) {
|
379 |
+
unset($db_columns[$column_name]);
|
380 |
+
}
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
+
return $db_columns;
|
385 |
+
}
|
386 |
+
|
387 |
/**
|
388 |
* Get checkbox
|
389 |
*
|
390 |
* @since 1.0
|
391 |
*/
|
392 |
+
private function get_box($type, $id, $values)
|
393 |
{
|
394 |
$classes = array();
|
395 |
|
396 |
// set state
|
397 |
$state = isset($values['state']) ? $values['state'] : '';
|
398 |
|
|
|
|
|
|
|
399 |
// class
|
400 |
+
$classes[] = "cpac-box-{$id}";
|
401 |
if ( $state )
|
402 |
$classes[] = 'active';
|
403 |
if ( ! empty($values['options']['class']) )
|
405 |
$class = implode(' ', $classes);
|
406 |
|
407 |
// more box options
|
408 |
+
$more_options = $this->get_additional_box_options($type, $id, $values);
|
409 |
$action = "<a class='cpac-action' href='#open'>open</a>";
|
410 |
+
|
411 |
+
// type label
|
412 |
+
$type_label = isset($values['options']['type_label']) ? $values['options']['type_label'] : '';
|
413 |
+
|
414 |
+
// label
|
415 |
+
$label = isset($values['label']) ? str_replace("'", '"', $values['label']) : '';
|
416 |
|
417 |
// hide box options
|
418 |
+
if ( ! empty($values['options']['hide_options']) || strpos($label, '<img') !== false ) {
|
419 |
$action = $more_options = '';
|
420 |
}
|
421 |
|
425 |
<div class='cpac-type-options'>
|
426 |
|
427 |
<div class='cpac-checkbox'></div>
|
428 |
+
<input type='hidden' class='cpac-state' name='cpac_options[columns][{$type}][{$id}][state]' value='{$state}'/>
|
|
|
429 |
<label class='main-label'>{$values['label']}</label>
|
430 |
</div>
|
431 |
<div class='cpac-meta-title'>
|
432 |
{$action}
|
433 |
+
<span>{$type_label}</span>
|
434 |
</div>
|
435 |
<div class='cpac-type-inside'>
|
436 |
+
<label for='cpac_options[columns][{$type}][{$id}][label]'>Label: </label>
|
437 |
+
<input type='text' name='cpac_options[columns][{$type}][{$id}][label]' value='{$label}' class='text'/>
|
438 |
<br/>
|
439 |
{$more_options}
|
440 |
</div>
|
449 |
*
|
450 |
* @since 1.0
|
451 |
*/
|
452 |
+
private function get_additional_box_options($post_type, $id, $values)
|
453 |
{
|
454 |
$fields = '';
|
455 |
|
456 |
// Custom Fields
|
457 |
+
if ( $this->is_column_meta($id) )
|
458 |
+
$fields .= $this->get_box_options_customfields($post_type, $id, $values);
|
459 |
|
460 |
return $fields;
|
461 |
}
|
465 |
*
|
466 |
* @since 1.0
|
467 |
*/
|
468 |
+
private function get_box_options_customfields($type, $id, $values)
|
469 |
{
|
470 |
// get post meta fields
|
471 |
+
$fields = $this->get_meta_by_type($type);
|
472 |
|
473 |
if ( empty($fields) )
|
474 |
return false;
|
495 |
'library_id' => __('Media Library Icon', $this->textdomain),
|
496 |
'excerpt' => __('Excerpt'),
|
497 |
'array' => __('Multiple Values', $this->textdomain),
|
498 |
+
'numeric' => __('Numeric', $this->textdomain),
|
499 |
+
'date' => __('Date', $this->textdomain),
|
500 |
+
'title_by_id' => __('Post Title (Post ID\'s)', $this->textdomain),
|
501 |
);
|
502 |
|
503 |
+
// add filter
|
504 |
+
$fieldtypes = apply_filters('cpac-field-types', $fieldtypes );
|
505 |
+
|
506 |
+
// set select options
|
507 |
foreach ( $fieldtypes as $fkey => $fieldtype ) {
|
508 |
$fieldtype_options .= sprintf
|
509 |
(
|
514 |
);
|
515 |
}
|
516 |
|
517 |
+
// before and after string
|
518 |
+
$before = ! empty($values['before']) ? $values['before'] : '' ;
|
519 |
+
$after = ! empty($values['after']) ? $values['after'] : '' ;
|
520 |
+
|
521 |
if ( empty($field_options) )
|
522 |
return false;
|
523 |
|
524 |
// add remove button
|
525 |
$remove = '<p class="remove-description description">'.__('This field can not be removed', $this->textdomain).'</p>';
|
526 |
+
if ( $id != 'column-meta-1') {
|
527 |
$remove = "
|
528 |
<p>
|
529 |
<a href='javascript:;' class='cpac-delete-custom-field-box'>".__('Remove')."</a>
|
532 |
}
|
533 |
|
534 |
$inside = "
|
535 |
+
<label for='cpac_options[columns][{$type}][{$id}][field]'>Custom Field: </label>
|
536 |
+
<select name='cpac_options[columns][{$type}][{$id}][field]'>{$field_options}</select>
|
537 |
<br/>
|
538 |
+
<label for='cpac_options[columns][{$type}][{$id}][field_type]'>Field Type: </label>
|
539 |
+
<select name='cpac_options[columns][{$type}][{$id}][field_type]'>{$fieldtype_options}</select>
|
540 |
<br/>
|
541 |
+
<label for='cpac_options[columns][{$type}][{$id}][before]'>Before: </label>
|
542 |
+
<input type='text' class='cpac-before' name='cpac_options[columns][{$type}][{$id}][before]' value='{$before}'/>
|
543 |
+
<br/>
|
544 |
+
<label for='cpac_options[columns][{$type}][{$id}][before]'>After: </label>
|
545 |
+
<input type='text' class='cpac-after' name='cpac_options[columns][{$type}][{$id}][after]' value='{$after}'/>
|
546 |
+
<br/>
|
547 |
{$remove}
|
548 |
";
|
549 |
|
551 |
}
|
552 |
|
553 |
/**
|
554 |
+
* Get post meta fields by type; post(types) or users.
|
555 |
*
|
556 |
* @since 1.0
|
557 |
*/
|
558 |
+
private function get_meta_by_type($type = 'post')
|
559 |
{
|
560 |
global $wpdb;
|
|
|
|
|
|
|
561 |
|
562 |
+
/** Users */
|
563 |
+
if ( $type == 'wp-users') {
|
564 |
+
$sql = 'SELECT DISTINCT meta_key FROM '.$wpdb->usermeta.' ORDER BY 1';
|
565 |
+
}
|
566 |
+
|
567 |
+
/** Posts */
|
568 |
+
else {
|
569 |
+
$sql = 'SELECT DISTINCT meta_key FROM '.$wpdb->postmeta.' pm JOIN '.$wpdb->posts.' p ON pm.post_id = p.ID WHERE p.post_type = "' . mysql_real_escape_string($type) . '" ORDER BY 1';
|
570 |
+
}
|
571 |
+
|
572 |
+
// run sql
|
573 |
+
$fields = $wpdb->get_results($sql, ARRAY_N);
|
574 |
+
|
575 |
// postmeta
|
576 |
if ( $fields ) {
|
577 |
$meta_fields = array();
|
581 |
$meta_fields[] = $field[0];
|
582 |
}
|
583 |
}
|
|
|
584 |
return $meta_fields;
|
585 |
+
}
|
586 |
|
587 |
return false;
|
588 |
}
|
592 |
*
|
593 |
* @since 1.0
|
594 |
*/
|
595 |
+
public function admin_scripts()
|
596 |
{
|
597 |
+
wp_enqueue_script( 'cpac-admin', $this->plugin_url('/assets/js/admin-column.js'), array('jquery', 'dashboard', 'jquery-ui-sortable'), CPAC_VERSION );
|
|
|
|
|
598 |
}
|
599 |
+
|
600 |
+
/**
|
601 |
+
* Get column types
|
602 |
+
*
|
603 |
+
* @since 1.1
|
604 |
+
*/
|
605 |
+
private function get_types()
|
606 |
+
{
|
607 |
+
$types = $this->post_types;
|
608 |
+
$types['wp-users'] = 'wp-users';
|
609 |
+
$types['wp-media'] = 'wp-media';
|
610 |
+
|
611 |
+
return $types;
|
612 |
+
}
|
613 |
+
|
614 |
/**
|
615 |
* Get post types
|
616 |
*
|
617 |
* @since 1.0
|
618 |
*/
|
619 |
+
protected function get_post_types()
|
620 |
{
|
621 |
$post_types = get_post_types(array(
|
622 |
'_builtin' => false
|
655 |
public function register_settings()
|
656 |
{
|
657 |
// If we have no options in the database, let's add them now.
|
658 |
+
if ( false === get_option('cpac_options') )
|
659 |
add_option( 'cpac_options', array(&$this, 'get_default_plugin_options') );
|
660 |
|
661 |
register_setting( 'cpac-settings-group', 'cpac_options', array(&$this, 'options_callback') );
|
676 |
}
|
677 |
|
678 |
/**
|
679 |
+
* Optional callback.
|
680 |
*
|
681 |
* @since 1.0
|
682 |
*/
|
690 |
*
|
691 |
* @since 1.0
|
692 |
*/
|
693 |
+
public function handle_requests()
|
694 |
{
|
695 |
// settings updated
|
696 |
+
if ( ! empty($_REQUEST['settings-updated']) )
|
697 |
+
$this->store_wp_default_columns();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
698 |
|
699 |
// restore defaults
|
700 |
+
if ( ! empty($_REQUEST['cpac-restore-defaults']) )
|
701 |
$this->restore_defaults();
|
702 |
+
|
703 |
+
}
|
704 |
+
|
705 |
+
/**
|
706 |
+
* Stores WP default columns
|
707 |
+
*
|
708 |
+
* This will store columns that are set by WordPress core or
|
709 |
+
* set by the theme for page, post(types) and user columns
|
710 |
+
*
|
711 |
+
* @since 1.2
|
712 |
+
*/
|
713 |
+
private function store_wp_default_columns()
|
714 |
+
{
|
715 |
+
// stores the default columns that are set by WP or set in the theme.
|
716 |
+
$wp_default_columns = array();
|
717 |
+
|
718 |
+
// Posts
|
719 |
+
foreach ( $this->post_types as $post_type ) {
|
720 |
+
$wp_default_columns[$post_type] = $this->get_wp_default_posts_columns($post_type);
|
721 |
+
}
|
722 |
+
|
723 |
+
// Users
|
724 |
+
$wp_default_columns['wp-users'] = $this->get_wp_default_users_columns();
|
725 |
+
|
726 |
+
// Media
|
727 |
+
$wp_default_columns['wp-media'] = $this->get_wp_default_media_columns();
|
728 |
+
|
729 |
+
update_option( 'cpac_options_default', $wp_default_columns );
|
730 |
}
|
731 |
|
732 |
/**
|
745 |
*
|
746 |
* @since 1.0
|
747 |
*/
|
748 |
+
private function get_post_excerpt($post_id)
|
749 |
{
|
750 |
+
global $post;
|
751 |
+
|
752 |
$save_post = $post;
|
753 |
$post = get_post($post_id);
|
754 |
$excerpt = get_the_excerpt();
|
755 |
$post = $save_post;
|
756 |
|
757 |
+
$output = $this->get_shortened_string($excerpt, $this->excerpt_length );
|
758 |
|
759 |
return $output;
|
760 |
}
|
764 |
*
|
765 |
* @since 1.0
|
766 |
*/
|
767 |
+
private function get_shortened_string($string = '', $num_words = 55, $more = null)
|
768 |
{
|
769 |
if (!$string)
|
770 |
return false;
|
771 |
|
772 |
+
return wp_trim_words( $string, $num_words, $more );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
773 |
}
|
774 |
|
775 |
/**
|
777 |
*
|
778 |
* @since 1.0
|
779 |
*/
|
780 |
+
public function manage_posts_column_value($column_name, $post_id)
|
781 |
{
|
782 |
+
$type = $column_name;
|
783 |
|
784 |
// Check for taxonomies, such as column-taxonomy-[taxname]
|
785 |
if ( strpos($type, 'column-taxonomy-') !== false )
|
786 |
$type = 'column-taxonomy';
|
787 |
|
788 |
// Check for custom fields, such as column-meta-[customfieldname]
|
789 |
+
if ( $this->is_column_meta($type) )
|
790 |
+
$type = 'column-post-meta';
|
791 |
|
792 |
// Hook
|
793 |
+
do_action('cpac-manage-posts-column', $type, $column_name, $post_id);
|
794 |
|
795 |
// Switch Types
|
796 |
$result = '';
|
833 |
case "column-page-template" :
|
834 |
// file name
|
835 |
$page_template = get_post_meta($post_id, '_wp_page_template', true);
|
836 |
+
|
837 |
+
// get template nice name
|
838 |
+
$result = array_search($page_template, get_page_templates());
|
|
|
839 |
break;
|
840 |
|
841 |
// Slug
|
843 |
$result = get_post($post_id)->post_name;
|
844 |
break;
|
845 |
|
846 |
+
// Slug
|
847 |
+
case "column-word-count" :
|
848 |
+
$result = str_word_count( $this->strip_trim( get_post($post_id)->post_content ) );
|
849 |
+
break;
|
850 |
+
|
851 |
// Taxonomy
|
852 |
case "column-taxonomy" :
|
853 |
+
$tax = str_replace('column-taxonomy-', '', $column_name);
|
854 |
$tags = get_the_terms($post_id, $tax);
|
855 |
$tarr = array();
|
856 |
if ( $tax == 'post_format' && empty($tags) ) {
|
865 |
break;
|
866 |
|
867 |
// Custom Field
|
868 |
+
case "column-post-meta" :
|
869 |
+
$result = $this->get_column_value_custom_field($post_id, $column_name, 'post');
|
870 |
break;
|
871 |
|
872 |
// Attachment
|
873 |
case "column-attachment" :
|
874 |
$result = $this->get_column_value_attachments($post_id);
|
875 |
break;
|
876 |
+
|
877 |
+
// Attachment count
|
878 |
+
case "column-attachment-count" :
|
879 |
+
$result = count($this->get_attachment_ids($post_id));
|
880 |
+
break;
|
881 |
|
882 |
default :
|
883 |
+
$result = $this->strip_trim(get_post_meta( $post_id, $column_name, true ));
|
884 |
|
885 |
endswitch;
|
886 |
|
889 |
|
890 |
echo $result;
|
891 |
}
|
892 |
+
|
893 |
/**
|
894 |
+
* Manage custom column for Users.
|
895 |
*
|
896 |
+
* @since 1.1
|
897 |
*/
|
898 |
+
public function manage_users_column_value( $value, $column_name, $user_id )
|
899 |
{
|
900 |
+
$type = $column_name;
|
901 |
+
|
902 |
+
$userdata = get_userdata( $user_id );
|
903 |
+
|
904 |
+
if ( ! $userdata )
|
905 |
+
return false;
|
906 |
+
|
907 |
+
// Check for user custom fields, such as column-meta-[customfieldname]
|
908 |
+
if ( $this->is_column_meta($type) )
|
909 |
+
$type = 'column-user-meta';
|
910 |
+
|
911 |
+
// Hook
|
912 |
+
do_action('cpac-manage-users-column', $type, $column_name, $user_id);
|
913 |
+
|
914 |
$result = '';
|
915 |
+
switch ($type) :
|
916 |
+
|
917 |
+
// user id
|
918 |
+
case "column-user_id" :
|
919 |
+
$result = $user_id;
|
920 |
+
break;
|
921 |
+
|
922 |
+
// first name
|
923 |
+
case "column-nickname" :
|
924 |
+
$result = $userdata->nickname;
|
925 |
+
break;
|
926 |
+
|
927 |
+
// first name
|
928 |
+
case "column-first_name" :
|
929 |
+
$result = $userdata->first_name;
|
930 |
+
break;
|
931 |
+
|
932 |
+
// last name
|
933 |
+
case "column-last_name" :
|
934 |
+
$result = $userdata->last_name;
|
935 |
+
break;
|
936 |
+
|
937 |
+
// user url
|
938 |
+
case "column-user_url" :
|
939 |
+
$result = $userdata->user_url;
|
940 |
+
break;
|
941 |
+
|
942 |
+
// user registration date
|
943 |
+
case "column-user_registered" :
|
944 |
+
$result = $userdata->user_registered;
|
945 |
+
break;
|
946 |
+
|
947 |
+
// user description
|
948 |
+
case "column-user_description" :
|
949 |
+
$result = $this->get_shortened_string( get_the_author_meta('user_description', $user_id), $this->excerpt_length );
|
950 |
+
break;
|
951 |
+
|
952 |
+
// user meta data ( custom field )
|
953 |
+
case "column-user-meta" :
|
954 |
+
$result = $this->get_column_value_custom_field($user_id, $column_name, 'user');
|
955 |
+
break;
|
956 |
+
|
957 |
+
default :
|
958 |
+
$result = get_user_meta( $user_id, $column_name, true );
|
959 |
+
|
960 |
+
endswitch;
|
961 |
+
|
962 |
+
if ( empty($result) )
|
963 |
+
$result = ' ';
|
964 |
+
|
965 |
+
return $result;
|
966 |
+
}
|
967 |
+
|
968 |
+
/**
|
969 |
+
* Manage custom column for Media.
|
970 |
+
*
|
971 |
+
* @since 1.3
|
972 |
+
*/
|
973 |
+
public function manage_media_column_value( $column_name, $media_id )
|
974 |
+
{
|
975 |
+
$type = $column_name;
|
976 |
+
|
977 |
+
$meta = wp_get_attachment_metadata($media_id);
|
978 |
+
$p = get_post($media_id);
|
979 |
+
|
980 |
+
// Hook
|
981 |
+
do_action('cpac-manage-media-column', $type, $column_name, $media_id);
|
982 |
+
|
983 |
+
$result = '';
|
984 |
+
switch ($type) :
|
985 |
+
|
986 |
+
// media id
|
987 |
+
case "column-mediaid" :
|
988 |
+
$result = $media_id;
|
989 |
+
break;
|
990 |
+
|
991 |
+
// dimensions
|
992 |
+
case "column-dimensions" :
|
993 |
+
if ( !empty($meta['width']) && !empty($meta['height']) )
|
994 |
+
$result = "{$meta['width']} x {$meta['height']}";
|
995 |
+
break;
|
996 |
+
|
997 |
+
// width
|
998 |
+
case "column-width" :
|
999 |
+
$result = !empty($meta['width']) ? $meta['width'] : '';
|
1000 |
+
break;
|
1001 |
+
|
1002 |
+
// height
|
1003 |
+
case "column-height" :
|
1004 |
+
$result = !empty($meta['height']) ? $meta['height'] : '';
|
1005 |
+
break;
|
1006 |
+
|
1007 |
+
// description
|
1008 |
+
case "column-description" :
|
1009 |
+
$result = $p->post_content;
|
1010 |
+
break;
|
1011 |
+
|
1012 |
+
// caption
|
1013 |
+
case "column-caption" :
|
1014 |
+
$result = $p->post_excerpt;
|
1015 |
+
break;
|
1016 |
+
|
1017 |
+
// alternate text
|
1018 |
+
case "column-alternate_text" :
|
1019 |
+
$alt = get_post_meta($media_id, '_wp_attachment_image_alt', true);
|
1020 |
+
$result = $this->strip_trim($alt);
|
1021 |
+
break;
|
1022 |
+
|
1023 |
+
// mime type
|
1024 |
+
case "column-mime_type" :
|
1025 |
+
$result = $p->post_mime_type;
|
1026 |
+
break;
|
1027 |
+
|
1028 |
+
// file name
|
1029 |
+
case "column-file_name" :
|
1030 |
+
$file = get_post_meta($media_id, '_wp_attached_file', true);
|
1031 |
+
$result = basename($file);
|
1032 |
+
break;
|
1033 |
+
|
1034 |
+
default:
|
1035 |
+
$result = '';
|
1036 |
+
|
1037 |
+
endswitch;
|
1038 |
+
|
1039 |
+
if ( empty($result) )
|
1040 |
+
$result = ' ';
|
1041 |
+
|
1042 |
+
echo $result;
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
/**
|
1046 |
+
* Get column value of post attachments
|
1047 |
+
*
|
1048 |
+
* @since 1.0
|
1049 |
+
*/
|
1050 |
+
private function get_column_value_attachments( $post_id )
|
1051 |
+
{
|
1052 |
+
$result = '';
|
1053 |
+
$attachment_ids = $this->get_attachment_ids($post_id);
|
1054 |
+
if ( $attachment_ids ) {
|
1055 |
+
foreach ( $attachment_ids as $attach_id ) {
|
1056 |
+
$result .= wp_get_attachment_image( $attach_id, array(80,80), true );
|
1057 |
}
|
1058 |
}
|
1059 |
return $result;
|
1060 |
}
|
1061 |
|
1062 |
+
/**
|
1063 |
+
* Get column value of post attachments
|
1064 |
+
*
|
1065 |
+
* @since 1.2.1
|
1066 |
+
*/
|
1067 |
+
protected function get_attachment_ids( $post_id )
|
1068 |
+
{
|
1069 |
+
return get_posts(array(
|
1070 |
+
'post_type' => 'attachment',
|
1071 |
+
'numberposts' => -1,
|
1072 |
+
'post_status' => null,
|
1073 |
+
'post_parent' => $post_id,
|
1074 |
+
'fields' => 'ids'
|
1075 |
+
));
|
1076 |
+
}
|
1077 |
+
|
1078 |
/**
|
1079 |
* Get column value of Custom Field
|
1080 |
*
|
1081 |
* @since 1.0
|
1082 |
+
*/
|
1083 |
+
private function get_column_value_custom_field($object_id, $column_name, $meta_type = 'post')
|
1084 |
{
|
1085 |
+
/** Users */
|
1086 |
+
if ( $meta_type == 'user' ) {
|
1087 |
+
$type = 'wp-users';
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
/** Posts */
|
1091 |
+
else {
|
1092 |
+
$type = get_post_type($object_id);
|
1093 |
+
}
|
1094 |
+
|
1095 |
+
// get column
|
1096 |
+
$columns = $this->get_stored_columns($type);
|
1097 |
+
|
1098 |
+
// inputs
|
1099 |
+
$field = isset($columns[$column_name]['field']) ? $columns[$column_name]['field'] : '';
|
1100 |
+
$fieldtype = isset($columns[$column_name]['field_type']) ? $columns[$column_name]['field_type'] : '';
|
1101 |
+
$before = isset($columns[$column_name]['before']) ? $columns[$column_name]['before'] : '';
|
1102 |
+
$after = isset($columns[$column_name]['after']) ? $columns[$column_name]['after'] : '';
|
1103 |
|
1104 |
// Get meta field value
|
1105 |
+
$meta = get_metadata($meta_type, $object_id, $field, true);
|
1106 |
|
1107 |
// multiple meta values
|
1108 |
if ( ( $fieldtype == 'array' && is_array($meta) ) || is_array($meta) ) {
|
1109 |
+
$meta = get_metadata($meta_type, $object_id, $field, true);
|
1110 |
$meta = $this->recursive_implode(', ', $meta);
|
1111 |
}
|
1112 |
|
1130 |
|
1131 |
// Excerpt
|
1132 |
case "excerpt" :
|
1133 |
+
$meta = $this->get_shortened_string($meta, $this->excerpt_length);
|
1134 |
+
break;
|
1135 |
+
|
1136 |
+
// Date
|
1137 |
+
case "date" :
|
1138 |
+
if ($meta) {
|
1139 |
+
$date = !is_numeric($meta) ? strtotime($meta) : $meta;
|
1140 |
+
$meta = date_i18n( get_option('date_format'), $date );
|
1141 |
+
}
|
1142 |
+
break;
|
1143 |
+
|
1144 |
+
// Title
|
1145 |
+
case "title_by_id" :
|
1146 |
+
$titles = $this->get_custom_field_value_title($meta);
|
1147 |
+
if ( $titles )
|
1148 |
+
$meta = $titles;
|
1149 |
+
break;
|
1150 |
+
|
1151 |
+
endswitch;
|
1152 |
+
|
1153 |
+
// add before and after string
|
1154 |
+
$meta = "{$before}{$meta}{$after}";
|
1155 |
+
|
1156 |
+
return $meta;
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
/**
|
1160 |
+
* Get custom field value 'Title by ID'
|
1161 |
+
*
|
1162 |
+
* @since 1.3
|
1163 |
+
*/
|
1164 |
+
private function get_custom_field_value_title($meta)
|
1165 |
+
{
|
1166 |
+
//remove white spaces and strip tags
|
1167 |
+
$meta = $this->strip_trim( str_replace(' ','', $meta) );
|
1168 |
+
|
1169 |
+
// var
|
1170 |
+
$ids = $titles = array();
|
1171 |
+
|
1172 |
+
// check for multiple id's
|
1173 |
+
if ( strpos($meta, ',') !== false )
|
1174 |
+
$ids = explode(',',$meta);
|
1175 |
+
elseif ( is_numeric($meta) )
|
1176 |
+
$ids[] = $meta;
|
1177 |
+
|
1178 |
+
// display title with link
|
1179 |
+
if ( $ids && is_array($ids) ) {
|
1180 |
+
foreach ( $ids as $id ) {
|
1181 |
+
$title = is_numeric($id) ? get_the_title($id) : '';
|
1182 |
+
$link = get_edit_post_link($id);
|
1183 |
+
if ( $title )
|
1184 |
+
$titles[] = $link ? "<a href='{$link}'>{$title}</a>" : $title;
|
1185 |
+
}
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
return implode('<span class="cpac-divider"></span>', $titles);
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
/**
|
1192 |
+
* Get column value of Custom Field
|
1193 |
+
*
|
1194 |
+
* @since 1.2
|
1195 |
+
*/
|
1196 |
+
private function get_user_column_value_custom_field($user_id, $id)
|
1197 |
+
{
|
1198 |
+
$columns = $this->get_stored_columns('wp-users');
|
1199 |
+
|
1200 |
+
// inputs
|
1201 |
+
$field = isset($columns[$id]['field']) ? $columns[$id]['field'] : '';
|
1202 |
+
$fieldtype = isset($columns[$id]['field_type']) ? $columns[$id]['field_type'] : '';
|
1203 |
+
$before = isset($columns[$id]['before']) ? $columns[$id]['before'] : '';
|
1204 |
+
$after = isset($columns[$id]['after']) ? $columns[$id]['after'] : '';
|
1205 |
+
|
1206 |
+
// Get meta field value
|
1207 |
+
$meta = get_user_meta($user_id, $field, true);
|
1208 |
+
|
1209 |
+
// multiple meta values
|
1210 |
+
if ( ( $fieldtype == 'array' && is_array($meta) ) || is_array($meta) ) {
|
1211 |
+
$meta = get_user_meta($user_id, $field);
|
1212 |
+
$meta = $this->recursive_implode(', ', $meta);
|
1213 |
+
}
|
1214 |
+
|
1215 |
+
// make sure there are no serialized arrays or empty meta data
|
1216 |
+
if ( empty($meta) || !is_string($meta) )
|
1217 |
+
return false;
|
1218 |
+
|
1219 |
+
// handles each field type differently..
|
1220 |
+
switch ($fieldtype) :
|
1221 |
+
|
1222 |
+
// Image
|
1223 |
+
case "image" :
|
1224 |
+
$meta = $this->get_thumbnail($meta);
|
1225 |
+
break;
|
1226 |
+
|
1227 |
+
// Media Library ID
|
1228 |
+
case "library_id" :
|
1229 |
+
$meta = wp_get_attachment_url($meta) ? wp_get_attachment_image( $meta, array(80,80), true ) : '';
|
1230 |
+
break;
|
1231 |
+
|
1232 |
+
// Excerpt
|
1233 |
+
case "excerpt" :
|
1234 |
+
$meta = $this->get_shortened_string($meta, $this->excerpt_length);
|
1235 |
break;
|
1236 |
|
1237 |
endswitch;
|
1238 |
|
1239 |
+
// add before and after string
|
1240 |
+
$meta = "{$before}{$meta}{$after}";
|
1241 |
+
|
1242 |
return $meta;
|
1243 |
}
|
1244 |
|
1257 |
$retVal[] = $r_pieces;
|
1258 |
}
|
1259 |
}
|
1260 |
+
if ( isset($retVal) && is_array($retVal) )
|
1261 |
+
return implode( $glue, $retVal );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1262 |
|
1263 |
+
return false;
|
1264 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1265 |
|
1266 |
/**
|
1267 |
* Set columns. These columns apply either for every post or set by a plugin.
|
1268 |
*
|
1269 |
* @since 1.0
|
1270 |
*/
|
1271 |
+
private function filter_preset_columns( $type = 'post', $columns )
|
1272 |
{
|
1273 |
+
$options = get_option('cpac_options_default');
|
1274 |
|
1275 |
if ( !$options )
|
1276 |
return $columns;
|
1277 |
|
1278 |
// we use the wp default columns for filtering...
|
1279 |
+
$stored_wp_default_columns = $options[$type];
|
1280 |
+
|
1281 |
// ... the ones that are set by plugins, theme functions and such.
|
1282 |
+
$dif_columns = array_diff(array_keys($columns), array_keys($stored_wp_default_columns));
|
1283 |
+
|
1284 |
// we add those to the columns
|
1285 |
$pre_columns = array();
|
1286 |
if ( $dif_columns ) {
|
1290 |
}
|
1291 |
|
1292 |
return $pre_columns;
|
1293 |
+
}
|
1294 |
|
1295 |
/**
|
1296 |
+
* Get WP default supported admin columns per post type.
|
1297 |
*
|
1298 |
* @since 1.0
|
1299 |
*/
|
1300 |
+
private function get_wp_default_posts_columns($post_type = 'post')
|
1301 |
{
|
1302 |
+
// load dependencies
|
|
|
|
|
|
|
1303 |
|
1304 |
+
// deprecated as of wp3.3
|
1305 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/template.php') )
|
1306 |
+
require_once(ABSPATH . 'wp-admin/includes/template.php');
|
1307 |
|
1308 |
+
// introduced since wp3.3
|
1309 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/screen.php') )
|
1310 |
+
require_once(ABSPATH . 'wp-admin/includes/screen.php');
|
1311 |
+
|
1312 |
+
// used for getting columns
|
1313 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php') )
|
1314 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1315 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-posts-list-table.php') )
|
1316 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-posts-list-table.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1317 |
|
1318 |
// we need to change the current screen
|
1319 |
global $current_screen;
|
1325 |
// ...so we can get its columns
|
1326 |
$columns = WP_Posts_List_Table::get_columns();
|
1327 |
|
1328 |
+
if ( empty ( $columns ) )
|
1329 |
+
return false;
|
1330 |
+
|
1331 |
+
// change to uniform format
|
1332 |
+
$posts_columns = $this->get_uniform_format($columns);
|
1333 |
+
|
1334 |
+
// reset current screen
|
1335 |
+
$current_screen = $org_current_screen;
|
1336 |
+
|
1337 |
+
return $posts_columns;
|
1338 |
+
}
|
1339 |
+
|
1340 |
+
/**
|
1341 |
+
* Get WP default users columns per post type.
|
1342 |
+
*
|
1343 |
+
* @since 1.1
|
1344 |
+
*/
|
1345 |
+
private function get_wp_default_users_columns()
|
1346 |
+
{
|
1347 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php') )
|
1348 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1349 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-users-list-table.php') )
|
1350 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-users-list-table.php');
|
1351 |
+
|
1352 |
+
// turn off site users
|
1353 |
+
$this->is_site_users = false;
|
1354 |
+
|
1355 |
+
// get users columns
|
1356 |
+
$columns = WP_Users_List_Table::get_columns();
|
1357 |
+
|
1358 |
+
// change to uniform format
|
1359 |
+
return $this->get_uniform_format($columns);
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
/**
|
1363 |
+
* Get WP default users columns per post type.
|
1364 |
+
*
|
1365 |
+
* @since 1.2.1
|
1366 |
+
*/
|
1367 |
+
private function get_wp_default_media_columns()
|
1368 |
+
{
|
1369 |
+
// could use _get_list_table('WP_Media_List_Table') ?
|
1370 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php') )
|
1371 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1372 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php') )
|
1373 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php');
|
1374 |
+
|
1375 |
+
global $current_screen;
|
1376 |
+
$org_current_screen = $current_screen;
|
1377 |
+
|
1378 |
+
// overwrite current_screen global with our media id...
|
1379 |
+
$current_screen->id = 'upload';
|
1380 |
+
|
1381 |
+
// init media class
|
1382 |
+
$wp_media = new WP_Media_List_Table;
|
1383 |
+
|
1384 |
+
// get users columns
|
1385 |
+
$columns = $wp_media->get_columns();
|
1386 |
+
|
1387 |
+
// reset current screen
|
1388 |
+
$current_screen = $org_current_screen;
|
1389 |
+
|
1390 |
+
// change to uniform format
|
1391 |
+
return $this->get_uniform_format($columns);
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
/**
|
1395 |
+
* Ste current screen
|
1396 |
+
*
|
1397 |
+
* @since 1.3
|
1398 |
+
*/
|
1399 |
+
private function set_current_screen($screen)
|
1400 |
+
{
|
1401 |
+
|
1402 |
+
}
|
1403 |
+
|
1404 |
+
/**
|
1405 |
+
* Build uniform format for all columns
|
1406 |
+
*
|
1407 |
+
* @since 1.0
|
1408 |
+
*/
|
1409 |
+
private function get_uniform_format($columns)
|
1410 |
+
{
|
1411 |
// we remove the checkbox column as an option...
|
1412 |
+
if ( isset($columns['cb']) )
|
1413 |
+
unset($columns['cb']);
|
1414 |
|
1415 |
// change to uniform format
|
1416 |
$uniform_columns = array();
|
1417 |
+
foreach ( (array) $columns as $id => $label ) {
|
1418 |
$hide_options = false;
|
1419 |
$type_label = $label;
|
1420 |
|
1423 |
$type_label = __('Comments', $this->textdomain);
|
1424 |
$hide_options = true;
|
1425 |
}
|
1426 |
+
|
1427 |
+
// user icon excerption
|
1428 |
+
if ( $id == 'icon' ) {
|
1429 |
+
$type_label = __('Icon', $this->textdomain);
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
$uniform_colums[$id] = array(
|
1433 |
'label' => $label,
|
1434 |
'state' => 'on',
|
1435 |
'options' => array(
|
1439 |
)
|
1440 |
);
|
1441 |
}
|
|
|
|
|
|
|
|
|
1442 |
return $uniform_colums;
|
1443 |
}
|
1444 |
+
|
1445 |
/**
|
1446 |
+
* Custom posts columns
|
1447 |
*
|
1448 |
* @since 1.0
|
1449 |
*/
|
1450 |
+
private function get_custom_posts_columns($post_type)
|
1451 |
{
|
1452 |
$custom_columns = array();
|
1453 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1454 |
// Thumbnail support
|
1455 |
if ( post_type_supports($post_type, 'thumbnail') ) {
|
1456 |
+
$custom_columns['column-featured_image'] = array(
|
1457 |
'label' => __('Featured Image', $this->textdomain),
|
1458 |
'options' => array(
|
1459 |
'type_label' => __('Image', $this->textdomain)
|
1460 |
)
|
1461 |
+
);
|
1462 |
}
|
1463 |
|
1464 |
// Excerpt support
|
1465 |
if ( post_type_supports($post_type, 'editor') ) {
|
1466 |
+
$custom_columns['column-excerpt'] = array(
|
1467 |
'label' => __('Excerpt', $this->textdomain),
|
1468 |
'options' => array(
|
1469 |
+
'type_label' => __('Excerpt', $this->textdomain),
|
1470 |
+
'sortorder' => 'on'
|
1471 |
)
|
1472 |
+
);
|
1473 |
}
|
1474 |
|
1475 |
// Sticky support
|
1476 |
if ( $post_type == 'post' ) {
|
1477 |
+
$custom_columns['column-sticky'] = array(
|
1478 |
'label' => __('Sticky', $this->textdomain),
|
1479 |
'options' => array(
|
1480 |
'type_label' => __('Sticky', $this->textdomain)
|
1481 |
)
|
1482 |
+
);
|
1483 |
}
|
1484 |
|
1485 |
// Order support
|
1486 |
if ( post_type_supports($post_type, 'page-attributes') ) {
|
1487 |
+
$custom_columns['column-order'] = array(
|
1488 |
+
'label' => __('Page Order', $this->textdomain),
|
|
|
1489 |
'options' => array(
|
1490 |
+
'type_label' => __('Order', $this->textdomain),
|
1491 |
+
'sortorder' => 'on',
|
1492 |
)
|
1493 |
+
);
|
1494 |
}
|
1495 |
|
1496 |
// Page Template
|
1497 |
if ( $post_type == 'page' ) {
|
1498 |
+
$custom_columns['column-page-template'] = array(
|
1499 |
'label' => __('Page Template', $this->textdomain),
|
|
|
1500 |
'options' => array(
|
1501 |
+
'type_label' => __('Page Template', $this->textdomain),
|
1502 |
+
'sortorder' => 'on',
|
1503 |
)
|
1504 |
+
);
|
1505 |
}
|
1506 |
|
1507 |
// Post Formats
|
1508 |
if ( post_type_supports($post_type, 'post-formats') ) {
|
1509 |
+
$custom_columns['column-post_formats'] = array(
|
1510 |
'label' => __('Post Format', $this->textdomain),
|
1511 |
'options' => array(
|
1512 |
+
'type_label' => __('Post Format', $this->textdomain),
|
1513 |
+
'sortorder' => 'on'
|
1514 |
)
|
1515 |
+
);
|
1516 |
}
|
1517 |
|
1518 |
+
// Taxonomy support
|
1519 |
+
$taxonomies = get_object_taxonomies($post_type, 'objects');
|
1520 |
+
if ( $taxonomies ) {
|
1521 |
+
foreach ( $taxonomies as $tax_slug => $tax ) {
|
1522 |
+
if ( $tax_slug != 'post_tag' && $tax_slug != 'category' && $tax_slug != 'post_format' ) {
|
1523 |
+
$custom_columns['column-taxonomy-'.$tax->name] = array(
|
1524 |
+
'label' => $tax->label,
|
1525 |
+
'options' => array(
|
1526 |
+
'type_label' => __('Taxonomy', $this->textdomain)
|
1527 |
+
)
|
1528 |
+
);
|
1529 |
+
}
|
1530 |
+
}
|
1531 |
+
}
|
1532 |
+
|
1533 |
+
// Post ID support
|
1534 |
+
$custom_columns['column-postid'] = array(
|
1535 |
+
'label' => 'ID',
|
1536 |
+
'options' => array(
|
1537 |
+
'type_label' => 'ID',
|
1538 |
+
'sortorder' => 'on',
|
1539 |
+
)
|
1540 |
+
);
|
1541 |
+
|
1542 |
+
// Slug support
|
1543 |
+
$custom_columns['column-page-slug'] = array(
|
1544 |
+
'label' => __('Slug', $this->textdomain),
|
1545 |
+
'options' => array(
|
1546 |
+
'type_label' => __('Slug', $this->textdomain),
|
1547 |
+
'sortorder' => 'on',
|
1548 |
+
)
|
1549 |
+
);
|
1550 |
+
|
1551 |
+
// Word count support
|
1552 |
+
$custom_columns['column-word-count'] = array(
|
1553 |
+
'label' => __('Word count', $this->textdomain),
|
1554 |
+
'options' => array(
|
1555 |
+
'type_label' => __('Word count', $this->textdomain),
|
1556 |
+
'sortorder' => 'on'
|
1557 |
+
)
|
1558 |
+
);
|
1559 |
+
|
1560 |
+
// Attachment support
|
1561 |
+
$custom_columns['column-attachment'] = array(
|
1562 |
+
'label' => __('Attachment', $this->textdomain),
|
1563 |
+
'options' => array(
|
1564 |
+
'type_label' => __('Attachment', $this->textdomain),
|
1565 |
+
'sortorder' => 'on'
|
1566 |
+
)
|
1567 |
+
);
|
1568 |
+
|
1569 |
+
// Attachment count support
|
1570 |
+
$custom_columns['column-attachment-count'] = array(
|
1571 |
+
'label' => __('No. of Attachments', $this->textdomain),
|
1572 |
+
'options' => array(
|
1573 |
+
'type_label' => __('No. of Attachments', $this->textdomain),
|
1574 |
+
'sortorder' => 'on'
|
1575 |
+
)
|
1576 |
+
);
|
1577 |
+
|
1578 |
+
// Custom Field support
|
1579 |
+
if ( $this->get_meta_by_type($post_type) ) {
|
1580 |
+
$custom_columns['column-meta-1'] = array(
|
1581 |
+
'label' => __('Custom Field', $this->textdomain),
|
1582 |
+
'field' => '',
|
1583 |
+
'field_type' => '',
|
1584 |
+
'before' => '',
|
1585 |
+
'after' => '',
|
1586 |
+
'options' => array(
|
1587 |
+
'type_label' => __('Field', $this->textdomain),
|
1588 |
+
'class' => 'cpac-box-metafield',
|
1589 |
+
'sortorder' => 'on',
|
1590 |
+
)
|
1591 |
+
);
|
1592 |
+
}
|
1593 |
+
|
1594 |
+
// merge with defaults
|
1595 |
+
$custom_columns = $this->parse_defaults($custom_columns);
|
1596 |
+
|
1597 |
+
return apply_filters('cpac-custom-posts-columns', $custom_columns);
|
1598 |
+
}
|
1599 |
+
|
1600 |
+
/**
|
1601 |
+
* Custom users columns
|
1602 |
+
*
|
1603 |
+
* @since 1.1
|
1604 |
+
*/
|
1605 |
+
private function get_custom_users_columns()
|
1606 |
+
{
|
1607 |
+
$custom_columns = array();
|
1608 |
+
|
1609 |
+
// User ID
|
1610 |
+
$custom_columns['column-user_id'] = array(
|
1611 |
+
'label' => __('User ID', $this->textdomain),
|
1612 |
+
'options' => array(
|
1613 |
+
'type_label' => __('User ID', $this->textdomain),
|
1614 |
+
'sortorder' => 'on'
|
1615 |
+
)
|
1616 |
+
);
|
1617 |
+
|
1618 |
+
// Nickname
|
1619 |
+
$custom_columns['column-nickname'] = array(
|
1620 |
+
'label' => __('Nickname', $this->textdomain),
|
1621 |
+
'options' => array(
|
1622 |
+
'type_label' => __('Nickname', $this->textdomain),
|
1623 |
+
'sortorder' => 'on'
|
1624 |
+
)
|
1625 |
+
);
|
1626 |
+
|
1627 |
+
// First name
|
1628 |
+
$custom_columns['column-first_name'] = array(
|
1629 |
+
'label' => __('First name', $this->textdomain),
|
1630 |
+
'options' => array(
|
1631 |
+
'type_label' => __('First name', $this->textdomain),
|
1632 |
+
'sortorder' => 'on'
|
1633 |
+
)
|
1634 |
+
);
|
1635 |
+
|
1636 |
+
// Last name
|
1637 |
+
$custom_columns['column-last_name'] = array(
|
1638 |
+
'label' => __('Last name', $this->textdomain),
|
1639 |
+
'options' => array(
|
1640 |
+
'type_label' => __('Last name', $this->textdomain),
|
1641 |
+
'sortorder' => 'on'
|
1642 |
+
)
|
1643 |
+
);
|
1644 |
+
|
1645 |
+
// User url
|
1646 |
+
$custom_columns['column-user_url'] = array(
|
1647 |
+
'label' => __('Url', $this->textdomain),
|
1648 |
+
'options' => array(
|
1649 |
+
'type_label' => __('Url', $this->textdomain),
|
1650 |
+
'sortorder' => 'on'
|
1651 |
+
)
|
1652 |
+
);
|
1653 |
+
|
1654 |
+
// User registration date
|
1655 |
+
$custom_columns['column-user_registered'] = array(
|
1656 |
+
'label' => __('Registered', $this->textdomain),
|
1657 |
+
'options' => array(
|
1658 |
+
'type_label' => __('Registered', $this->textdomain),
|
1659 |
+
'sortorder' => 'on'
|
1660 |
+
)
|
1661 |
+
);
|
1662 |
+
|
1663 |
+
// User description
|
1664 |
+
$custom_columns['column-user_description'] = array(
|
1665 |
+
'label' => __('Description', $this->textdomain),
|
1666 |
+
'options' => array(
|
1667 |
+
'type_label' => __('Description', $this->textdomain),
|
1668 |
+
'sortorder' => 'on'
|
1669 |
+
)
|
1670 |
+
);
|
1671 |
+
|
1672 |
+
// Custom Field support
|
1673 |
+
$custom_columns['column-meta-1'] = array(
|
1674 |
+
'label' => __('Custom Field', $this->textdomain),
|
1675 |
+
'field' => '',
|
1676 |
+
'field_type' => '',
|
1677 |
+
'before' => '',
|
1678 |
+
'after' => '',
|
1679 |
+
'options' => array(
|
1680 |
+
'type_label' => __('Field', $this->textdomain),
|
1681 |
+
'class' => 'cpac-box-metafield',
|
1682 |
+
'sortorder' => '',
|
1683 |
+
)
|
1684 |
+
);
|
1685 |
+
|
1686 |
+
// merge with defaults
|
1687 |
+
$custom_columns = $this->parse_defaults($custom_columns);
|
1688 |
+
|
1689 |
+
return apply_filters('cpac-custom-users-columns', $custom_columns);
|
1690 |
+
}
|
1691 |
+
|
1692 |
+
/**
|
1693 |
+
* Custom users columns
|
1694 |
+
*
|
1695 |
+
* @since 1.3
|
1696 |
+
*/
|
1697 |
+
private function get_custom_media_columns()
|
1698 |
+
{
|
1699 |
+
$custom_columns = array();
|
1700 |
+
|
1701 |
+
// Media ID
|
1702 |
+
$custom_columns['column-mediaid'] = array(
|
1703 |
+
'label' => __('ID', $this->textdomain),
|
1704 |
+
'options' => array(
|
1705 |
+
'type_label' => __('ID', $this->textdomain),
|
1706 |
+
'sortorder' => 'on'
|
1707 |
+
)
|
1708 |
+
);
|
1709 |
+
|
1710 |
+
// File type
|
1711 |
+
$custom_columns['column-mime_type'] = array(
|
1712 |
+
'label' => __('Mime type', $this->textdomain),
|
1713 |
+
'options' => array(
|
1714 |
+
'type_label' => __('Mime type', $this->textdomain),
|
1715 |
+
'sortorder' => 'on'
|
1716 |
+
)
|
1717 |
+
);
|
1718 |
+
|
1719 |
+
// File name
|
1720 |
+
$custom_columns['column-file_name'] = array(
|
1721 |
+
'label' => __('File name', $this->textdomain),
|
1722 |
+
'options' => array(
|
1723 |
+
'type_label' => __('File name', $this->textdomain),
|
1724 |
+
'sortorder' => 'on'
|
1725 |
+
)
|
1726 |
+
);
|
1727 |
+
|
1728 |
+
// Dimensions
|
1729 |
+
$custom_columns['column-dimensions'] = array(
|
1730 |
+
'label' => __('Dimensions', $this->textdomain),
|
1731 |
+
'options' => array(
|
1732 |
+
'type_label' => __('Dimensions', $this->textdomain),
|
1733 |
+
'sortorder' => 'on'
|
1734 |
+
)
|
1735 |
+
);
|
1736 |
+
|
1737 |
+
// Height
|
1738 |
+
$custom_columns['column-height'] = array(
|
1739 |
+
'label' => __('Height', $this->textdomain),
|
1740 |
+
'options' => array(
|
1741 |
+
'type_label' => __('Height', $this->textdomain),
|
1742 |
+
'sortorder' => 'on'
|
1743 |
+
)
|
1744 |
+
);
|
1745 |
+
|
1746 |
+
// Width
|
1747 |
+
$custom_columns['column-width'] = array(
|
1748 |
+
'label' => __('Width', $this->textdomain),
|
1749 |
+
'options' => array(
|
1750 |
+
'type_label' => __('Width', $this->textdomain),
|
1751 |
+
'sortorder' => 'on'
|
1752 |
+
)
|
1753 |
+
);
|
1754 |
|
1755 |
+
// Caption
|
1756 |
+
$custom_columns['column-caption'] = array(
|
1757 |
+
'label' => __('Caption', $this->textdomain),
|
|
|
1758 |
'options' => array(
|
1759 |
+
'type_label' => __('Caption', $this->textdomain),
|
1760 |
+
'sortorder' => 'on'
|
1761 |
+
)
|
1762 |
+
);
|
1763 |
|
1764 |
+
// Description
|
1765 |
+
$custom_columns['column-description'] = array(
|
1766 |
+
'label' => __('Description', $this->textdomain),
|
|
|
1767 |
'options' => array(
|
1768 |
+
'type_label' => __('Description', $this->textdomain),
|
1769 |
+
'sortorder' => 'on'
|
1770 |
+
)
|
1771 |
+
);
|
1772 |
|
1773 |
+
// Alt
|
1774 |
+
$custom_columns['column-alternate_text'] = array(
|
1775 |
+
'label' => __('Alt', $this->textdomain),
|
1776 |
+
'options' => array(
|
1777 |
+
'type_label' => __('Alt', $this->textdomain),
|
1778 |
+
'sortorder' => 'on'
|
1779 |
+
)
|
1780 |
+
);
|
1781 |
+
|
1782 |
+
// merge with defaults
|
1783 |
+
$custom_columns = $this->parse_defaults($custom_columns);
|
1784 |
+
|
1785 |
+
return apply_filters('cpac-custom-media-columns', $custom_columns);
|
1786 |
+
}
|
1787 |
+
|
1788 |
+
/**
|
1789 |
+
* Parse defaults
|
1790 |
+
*
|
1791 |
+
* @since 1.1
|
1792 |
+
*/
|
1793 |
+
private function parse_defaults($columns)
|
1794 |
+
{
|
1795 |
+
// default arguments
|
1796 |
+
$defaults = array(
|
1797 |
+
|
1798 |
+
// stored values
|
1799 |
+
'label' => '',
|
1800 |
+
'state' => '',
|
1801 |
+
|
1802 |
+
// static values
|
1803 |
'options' => array(
|
1804 |
+
'type_label' => __('Custom', $this->textdomain),
|
1805 |
+
'hide_options' => false,
|
1806 |
+
'class' => 'cpac-box-custom',
|
1807 |
+
'sortorder' => '',
|
1808 |
)
|
1809 |
+
);
|
1810 |
|
1811 |
+
foreach ( $columns as $k => $column ) {
|
1812 |
+
$c[$k] = wp_parse_args( $column, $defaults);
|
1813 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1814 |
|
1815 |
+
return $c;
|
1816 |
}
|
1817 |
|
1818 |
/**
|
1820 |
*
|
1821 |
* @since 1.0
|
1822 |
*/
|
1823 |
+
protected function get_stored_columns($type)
|
1824 |
{
|
1825 |
// get plugin options
|
1826 |
+
$options = get_option('cpac_options');
|
1827 |
|
1828 |
// get saved columns
|
1829 |
+
if ( isset($options['columns'][$type]) )
|
1830 |
+
return $options['columns'][$type];
|
1831 |
|
1832 |
return false;
|
1833 |
}
|
1837 |
*
|
1838 |
* @since 1.0
|
1839 |
*/
|
1840 |
+
private function get_menu()
|
1841 |
{
|
1842 |
// set
|
1843 |
$menu = '';
|
1849 |
$referer = $_REQUEST['cpac_type'];
|
1850 |
|
1851 |
// loop
|
1852 |
+
foreach ( $this->get_types() as $type ) {
|
1853 |
+
$label = $this->get_singular_name($type);
|
1854 |
+
$clean_label = $this->sanitize_string($type);
|
1855 |
|
1856 |
// divider
|
1857 |
$divider = $count++ == 1 ? '' : ' | ';
|
1858 |
|
1859 |
// current
|
1860 |
$current = '';
|
1861 |
+
if ( $this->is_menu_type_current($type) )
|
1862 |
$current = ' class="current"';
|
1863 |
|
1864 |
// menu list
|
1882 |
* @since 1.0
|
1883 |
*/
|
1884 |
private function is_menu_type_current( $post_type )
|
1885 |
+
{
|
|
|
|
|
1886 |
// referer
|
1887 |
$referer = '';
|
1888 |
if ( ! empty($_REQUEST['cpac_type']) )
|
1914 |
*
|
1915 |
* @since 1.0
|
1916 |
*/
|
1917 |
+
private function get_singular_name( $type )
|
1918 |
{
|
1919 |
+
// Users
|
1920 |
+
if ( $type == 'wp-users' )
|
1921 |
+
$label = 'Users';
|
1922 |
+
|
1923 |
+
// Media
|
1924 |
+
elseif ( $type == 'wp-media' )
|
1925 |
+
$label = 'Media Library';
|
1926 |
+
|
1927 |
+
// Posts
|
1928 |
+
else {
|
1929 |
+
$posttype_obj = get_post_type_object($type);
|
1930 |
+
$label = $posttype_obj->labels->singular_name;
|
1931 |
+
}
|
1932 |
+
|
1933 |
return $label;
|
1934 |
}
|
1935 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1936 |
/**
|
1937 |
* Sanitize label
|
1938 |
*
|
1940 |
*
|
1941 |
* @since 1.0
|
1942 |
*/
|
1943 |
+
protected function sanitize_string($string)
|
1944 |
{
|
1945 |
$string = esc_url($string);
|
1946 |
+
$string = str_replace('http://','', $string);
|
1947 |
+
$string = str_replace('https://','', $string);
|
1948 |
+
|
1949 |
+
return $string;
|
1950 |
}
|
1951 |
|
1952 |
/**
|
1953 |
+
* Get plugin url.
|
1954 |
*
|
1955 |
* @since 1.0
|
1956 |
*/
|
1959 |
return plugins_url($file, __FILE__);
|
1960 |
}
|
1961 |
|
1962 |
+
/**
|
1963 |
+
* Checks if column-meta key exists
|
1964 |
+
*
|
1965 |
+
* @since 1.0
|
1966 |
+
*/
|
1967 |
+
protected function is_column_meta( $id = '' )
|
1968 |
+
{
|
1969 |
+
if ( strpos($id, 'column-meta-') !== false )
|
1970 |
+
return true;
|
1971 |
+
|
1972 |
+
return false;
|
1973 |
+
}
|
1974 |
+
|
1975 |
/**
|
1976 |
* Get a thumbnail
|
1977 |
*
|
1981 |
{
|
1982 |
if ( empty($image) )
|
1983 |
return false;
|
1984 |
+
|
1985 |
+
// get correct image path
|
1986 |
$image_path = str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $image);
|
|
|
1987 |
|
1988 |
+
// resize image
|
1989 |
+
if ( file_exists($image_path) && $this->is_image($image_path) ) {
|
1990 |
+
$resized = image_resize( $image_path, 120, 80, true);
|
1991 |
|
1992 |
+
if ( ! is_wp_error( $resized ) ) {
|
1993 |
+
$image = str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, $resized);
|
1994 |
+
|
1995 |
+
return "<img src='{$image}' alt='' width='120' height='80' />";
|
1996 |
+
}
|
1997 |
+
|
1998 |
+
return $resized->get_error_message();
|
1999 |
+
}
|
2000 |
+
|
2001 |
+
return false;
|
2002 |
+
}
|
2003 |
+
|
2004 |
+
/**
|
2005 |
+
* Checks an URL for image extension
|
2006 |
+
*
|
2007 |
+
* @since 1.2
|
2008 |
+
*/
|
2009 |
+
private function is_image($url)
|
2010 |
+
{
|
2011 |
+
$validExt = array('.jpg', '.jpeg', '.gif', '.png', '.bmp');
|
2012 |
+
$ext = strrchr($url, '.');
|
2013 |
+
|
2014 |
+
return in_array($ext, $validExt);
|
2015 |
+
}
|
2016 |
+
|
2017 |
+
/**
|
2018 |
+
* Unlocks
|
2019 |
+
*
|
2020 |
+
* @since 1.3
|
2021 |
+
*/
|
2022 |
+
protected function is_unlocked($type)
|
2023 |
+
{
|
2024 |
+
switch ($type) :
|
2025 |
+
case 'sortable':
|
2026 |
+
if( md5($this->get_license_key($type) ) == "6a8d49fe80f7509251ef9aeda37872cf")
|
2027 |
+
return true;
|
2028 |
+
break;
|
2029 |
+
|
2030 |
+
endswitch;
|
2031 |
+
|
2032 |
+
return false;
|
2033 |
+
}
|
2034 |
+
|
2035 |
+
/**
|
2036 |
+
* Get license key
|
2037 |
+
*
|
2038 |
+
* @since 1.3
|
2039 |
+
*/
|
2040 |
+
private function get_license_key($type)
|
2041 |
+
{
|
2042 |
+
return get_option('cpac_' . $type . '_ac');
|
2043 |
+
}
|
2044 |
+
|
2045 |
+
/**
|
2046 |
+
* Set license key
|
2047 |
+
*
|
2048 |
+
* @since 1.3
|
2049 |
+
*/
|
2050 |
+
private function set_license_key($type, $key)
|
2051 |
+
{
|
2052 |
+
update_option( "cpac_{$type}_ac", trim($key) );
|
2053 |
+
}
|
2054 |
+
|
2055 |
+
/**
|
2056 |
+
* Strip tags and trim
|
2057 |
+
*
|
2058 |
+
* @since 1.3
|
2059 |
+
*/
|
2060 |
+
protected function strip_trim($string)
|
2061 |
+
{
|
2062 |
+
return trim(strip_tags($string));
|
2063 |
+
}
|
2064 |
+
|
2065 |
+
/**
|
2066 |
+
* Add help tabs
|
2067 |
+
*
|
2068 |
+
* @since 1.3
|
2069 |
+
*/
|
2070 |
+
function help_tabs($page)
|
2071 |
+
{
|
2072 |
+
$screen = get_current_screen();
|
2073 |
+
|
2074 |
+
if ( $screen->id != $this->admin_page || ! method_exists($screen,'add_help_tab') )
|
2075 |
+
return;
|
2076 |
+
|
2077 |
+
// add help content
|
2078 |
+
$tabs = array(
|
2079 |
+
array(
|
2080 |
+
'title' => 'Instructions',
|
2081 |
+
'content' => "
|
2082 |
+
<p>
|
2083 |
+
You can customise the plugins.
|
2084 |
+
</p>
|
2085 |
+
<ul>
|
2086 |
+
<li><a href='{$this->codepress_url}#feedback'>Send your feedback here</a></li>
|
2087 |
+
</ul>
|
2088 |
+
"
|
2089 |
+
),
|
2090 |
+
array(
|
2091 |
+
'title' => 'Unlock sortable columns',
|
2092 |
+
'content' => "<p></p>"
|
2093 |
+
),
|
2094 |
+
array(
|
2095 |
+
'title' => 'Unlocks',
|
2096 |
+
'content' => 'my content 2'
|
2097 |
+
),
|
2098 |
+
);
|
2099 |
+
|
2100 |
+
foreach ( $tabs as $k => $tab ) {
|
2101 |
+
$screen->add_help_tab(array(
|
2102 |
+
'id' => 'cpac-tab-'.$k, // unique id
|
2103 |
+
'title' => $tab['title'], // label
|
2104 |
+
'content' => $tab['content'], // body
|
2105 |
+
));
|
2106 |
+
}
|
2107 |
+
}
|
2108 |
+
|
2109 |
+
/**
|
2110 |
+
* Settings Page Template.
|
2111 |
+
*
|
2112 |
+
* This function in conjunction with others usei the WordPress
|
2113 |
+
* Settings API to create a settings page where users can adjust
|
2114 |
+
* the behaviour of this plugin.
|
2115 |
+
*
|
2116 |
+
* @since 1.0
|
2117 |
+
*/
|
2118 |
+
public function plugin_settings_page()
|
2119 |
+
{
|
2120 |
+
|
2121 |
+
// loop through post types
|
2122 |
+
$rows = '';
|
2123 |
+
foreach ( $this->get_types() as $type ) {
|
2124 |
+
|
2125 |
+
// post type label
|
2126 |
+
$label = $this->get_singular_name($type);
|
2127 |
+
|
2128 |
+
// id
|
2129 |
+
$id = $this->sanitize_string($type);
|
2130 |
+
|
2131 |
+
// build draggable boxes
|
2132 |
+
$boxes = $this->get_column_boxes($type);
|
2133 |
+
|
2134 |
+
// class
|
2135 |
+
$class = $this->is_menu_type_current($type) ? ' current' : ' hidden';
|
2136 |
+
|
2137 |
+
$rows .= "
|
2138 |
+
<tr id='cpac-box-{$id}' valign='top' class='cpac-box-row{$class}'>
|
2139 |
+
<th class='cpac_post_type' scope='row'>
|
2140 |
+
{$label}
|
2141 |
+
</th>
|
2142 |
+
<td>
|
2143 |
+
<h3 class='cpac_post_type hidden'>{$label}</h3>
|
2144 |
+
{$boxes}
|
2145 |
+
</td>
|
2146 |
+
</tr>
|
2147 |
+
";
|
2148 |
+
}
|
2149 |
+
|
2150 |
+
// Post Type Menu
|
2151 |
+
$menu = $this->get_menu();
|
2152 |
+
|
2153 |
+
?>
|
2154 |
+
<div id="cpac" class="wrap">
|
2155 |
+
<?php screen_icon($this->slug) ?>
|
2156 |
+
<h2><?php _e('Codepress Admin Columns', $this->textdomain); ?></h2>
|
2157 |
+
<?php echo $menu ?>
|
2158 |
+
<div class="postbox-container cpac-col-left">
|
2159 |
+
<div class="metabox-holder">
|
2160 |
+
<div class="meta-box-sortables">
|
2161 |
+
|
2162 |
+
<div id="general-cpac-settings" class="postbox">
|
2163 |
+
<div title="Click to toggle" class="handlediv"><br></div>
|
2164 |
+
<h3 class="hndle">
|
2165 |
+
<span><?php _e('Admin Columns', $this->textdomain ); ?></span>
|
2166 |
+
</h3>
|
2167 |
+
<div class="inside">
|
2168 |
+
<form method="post" action="options.php">
|
2169 |
+
|
2170 |
+
<?php settings_fields( 'cpac-settings-group' ); ?>
|
2171 |
+
|
2172 |
+
<table class="form-table">
|
2173 |
+
|
2174 |
+
<?php echo $rows ?>
|
2175 |
+
|
2176 |
+
<tr class="bottom" valign="top">
|
2177 |
+
<th scope="row"></th>
|
2178 |
+
<td>
|
2179 |
+
<p class="submit">
|
2180 |
+
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
2181 |
+
</p>
|
2182 |
+
</td>
|
2183 |
+
</tr>
|
2184 |
+
</table>
|
2185 |
+
</form>
|
2186 |
+
</div>
|
2187 |
+
</div><!-- general-settings -->
|
2188 |
+
|
2189 |
+
<div id="restore-cpac-settings" class="postbox">
|
2190 |
+
<div title="Click to toggle" class="handlediv"><br></div>
|
2191 |
+
<h3 class="hndle">
|
2192 |
+
<span><?php _e('Restore defaults', $this->textdomain) ?></span>
|
2193 |
+
</h3>
|
2194 |
+
<div class="inside">
|
2195 |
+
<form method="post" action="">
|
2196 |
+
<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); ?>');" />
|
2197 |
+
</form>
|
2198 |
+
<p class="description"><?php _e('This will delete all column settings and restore the default settings.', $this->textdomain); ?></p>
|
2199 |
+
</div>
|
2200 |
+
</div><!-- restore-cpac-settings -->
|
2201 |
+
|
2202 |
+
</div>
|
2203 |
+
</div>
|
2204 |
+
</div><!-- .postbox-container -->
|
2205 |
+
|
2206 |
+
<div class="postbox-container cpac-col-right">
|
2207 |
+
<div class="metabox-holder">
|
2208 |
+
<div class="meta-box-sortables">
|
2209 |
+
|
2210 |
+
<div id="likethisplugin-cpac-settings" class="postbox">
|
2211 |
+
<div title="Click to toggle" class="handlediv"><br></div>
|
2212 |
+
<h3 class="hndle">
|
2213 |
+
<span><?php _e('Like this plugin?', $this->textdomain) ?></span>
|
2214 |
+
</h3>
|
2215 |
+
<div class="inside">
|
2216 |
+
<p><?php _e('Why not do any or all of the following', $this->textdomain) ?>:</p>
|
2217 |
+
<ul>
|
2218 |
+
<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>
|
2219 |
+
<li><a href="<?php echo $this->wordpress_url ?>"><?php _e('Give it a 5 star rating on WordPress.org.', $this->textdomain) ?></a></li>
|
2220 |
+
<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>
|
2221 |
+
</ul>
|
2222 |
+
</div>
|
2223 |
+
</div><!-- likethisplugin-cpac-settings -->
|
2224 |
+
|
2225 |
+
<div id="side-cpac-settings" class="postbox">
|
2226 |
+
<div title="Click to toggle" class="handlediv"><br></div>
|
2227 |
+
<h3 class="hndle">
|
2228 |
+
<span><?php _e('Need support?', $this->textdomain) ?></span>
|
2229 |
+
</h3>
|
2230 |
+
<div class="inside">
|
2231 |
+
<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>
|
2232 |
+
<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>
|
2233 |
+
</div>
|
2234 |
+
</div><!-- side-cpac-settings -->
|
2235 |
+
|
2236 |
+
</div>
|
2237 |
+
</div>
|
2238 |
+
</div><!-- .postbox-container -->
|
2239 |
+
|
2240 |
+
</div>
|
2241 |
+
<?php
|
2242 |
+
}
|
2243 |
}
|
2244 |
?>
|
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:12+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,18 +25,47 @@ 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 |
-
=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
A nice feature is that it will make some of the new columns support sorting. By default WordPress let's you sort by Title, Date, Comments and Author. This will make you be able to sort by:
|
44 |
|
@@ -46,8 +73,21 @@ A nice feature is that it will make some of the new columns support sorting. By
|
|
46 |
* page order
|
47 |
* slug
|
48 |
* page template
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
-
|
|
|
|
|
51 |
|
52 |
**Related Links:**
|
53 |
|
@@ -59,7 +99,6 @@ 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 =
|
@@ -69,15 +108,62 @@ Leave your feedback at http://www.codepress.nl/plugins/codepress-admin-columns#f
|
|
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
|
6 |
+
Stable tag: 1.3
|
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 and reorder them.
|
13 |
|
14 |
+
= Post 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 |
+
* Number of Attachments
|
30 |
* Custom Fields
|
31 |
|
32 |
= Custom Fields =
|
33 |
|
34 |
+
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:
|
35 |
|
|
|
36 |
* Image thumbnails
|
37 |
+
* Icons for Media Library items
|
38 |
* Excerpt
|
39 |
* Multiple Values
|
40 |
+
* Numeric value ( this also works for sorting by meta_value_num )
|
41 |
+
|
42 |
+
= User Columns =
|
43 |
+
|
44 |
+
You can also change the User Columns. The following user columns are added:
|
45 |
+
|
46 |
+
* User ID
|
47 |
+
* First name
|
48 |
+
* Last name
|
49 |
+
* Url
|
50 |
+
* Register date
|
51 |
+
* Biographical Info ( description )
|
52 |
+
* User Custom Fields
|
53 |
+
|
54 |
+
Some of the user custom fields that are included: user level, capabilities, admin color, nickname... many more.
|
55 |
|
56 |
+
= Media Columns =
|
57 |
+
|
58 |
+
Customise the Media Library Columns. The following media columns are added:
|
59 |
+
|
60 |
+
* Media ID
|
61 |
+
* File name
|
62 |
+
* Height
|
63 |
+
* Width
|
64 |
+
* Dimensions ( width x height )
|
65 |
+
* Description, Caption and Alternate tekst
|
66 |
+
* Mime-Type
|
67 |
+
|
68 |
+
= Sortable Custom Columns for Post and Pages =
|
69 |
|
70 |
A nice feature is that it will make some of the new columns support sorting. By default WordPress let's you sort by Title, Date, Comments and Author. This will make you be able to sort by:
|
71 |
|
73 |
* page order
|
74 |
* slug
|
75 |
* page template
|
76 |
+
* word count
|
77 |
+
* attachment count
|
78 |
+
* custom fields ( both meta_value and meta_value_num are supported )
|
79 |
+
|
80 |
+
= Third party plugin support =
|
81 |
+
|
82 |
+
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).
|
83 |
+
|
84 |
+
= Upcoming releases =
|
85 |
+
|
86 |
+
The next upcoming release will support sorting by Media and User columns.
|
87 |
|
88 |
+
**Feedback**
|
89 |
+
|
90 |
+
You can leave any <a href='http://www.codepress.nl/plugins/codepress-admin-columns#feedback'>requests or feedback</a>.
|
91 |
|
92 |
**Related Links:**
|
93 |
|
99 |
2. Activate Codepress Admin Columns through the 'Plugins' menu in WordPress
|
100 |
3. Configure the plugin by going to the Admin Column settings that appears under the Settings menu.
|
101 |
|
|
|
102 |
== Frequently Asked Questions ==
|
103 |
|
104 |
= I have an idea for a great way to improve this plugin =
|
108 |
|
109 |
== Screenshots ==
|
110 |
|
111 |
+
1. Settings page for Post(type) columns.
|
112 |
+
2. Posts Screen with the customized sortable columns.
|
113 |
+
3. Settings page for the Media Library columns.
|
114 |
+
4. Media Screen with the customized sortable columns.
|
115 |
+
5. Settings page for Users columns.
|
116 |
+
6. Users Screen with the customized sortable columns.
|
117 |
+
7. Settings page showing the different displaying types for custom field.
|
118 |
|
119 |
== Changelog ==
|
120 |
|
121 |
+
= 1.3 =
|
122 |
+
|
123 |
+
* added support for Media columns
|
124 |
+
* added Media columns: filename, width, height, dimensions, description, alt, caption and mime-type
|
125 |
+
* added date type to posts custom fields
|
126 |
+
* added title type to posts custom fields
|
127 |
+
* sorting has changed. when sorting; only results are shown which contain a value
|
128 |
+
* str_word_count is used for excerpts
|
129 |
+
|
130 |
+
= 1.2.1 =
|
131 |
+
|
132 |
+
* added word count sorting
|
133 |
+
* added attachment count sorting
|
134 |
+
* added template name sorting
|
135 |
+
* minor styling changes
|
136 |
+
* bug fix with sorting by slug
|
137 |
+
* bug fix with sorting by attachment
|
138 |
+
|
139 |
+
= 1.2 =
|
140 |
+
|
141 |
+
* added support for third party plugins
|
142 |
+
* added user custom fields
|
143 |
+
* added extra image check
|
144 |
+
* bug fix with javascript (jquery) enqueue
|
145 |
+
|
146 |
+
= 1.1.3 =
|
147 |
+
|
148 |
+
* added bug fix for WP3.3beta ( thanks to raonip and ronbme for pointing this out )
|
149 |
+
|
150 |
+
= 1.1.2 =
|
151 |
+
|
152 |
+
* added dutch translation
|
153 |
+
|
154 |
+
= 1.1.1 =
|
155 |
+
|
156 |
+
* Bug fix: path separator for require_once
|
157 |
+
* Added word count
|
158 |
+
|
159 |
+
= 1.1 =
|
160 |
|
161 |
+
* Added User Columns.
|
162 |
+
* Added before / after text for custom fields
|
163 |
+
* Added custom field type 'Numeric'.
|
164 |
+
* Added custom field sortables.
|
165 |
+
* Fixed domain path
|
166 |
+
* Fixed settings link
|
167 |
|
168 |
= 1.0 =
|
169 |
|
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
|