Version Description
- Initial release.
Download this release
Release Info
Developer | codepress |
Plugin | Admin Columns |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- assets/css/admin-column.css +209 -0
- assets/css/column.css +4 -0
- assets/images/arrows.png +0 -0
- assets/images/checkbox.png +0 -0
- assets/images/checkmark.png +0 -0
- assets/images/checkmark_single.png +0 -0
- assets/images/icon.png +0 -0
- assets/images/reorder.png +0 -0
- assets/images/sort.png +0 -0
- assets/js/admin-column.js +192 -0
- codepress-admin-columns.php +1370 -0
- languages/codepress-admin-columns-nl_NL.mo +0 -0
- languages/codepress-admin-columns-nl_NL.po +308 -0
- readme.txt +84 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
assets/css/admin-column.css
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#general-cpac-settings {}
|
2 |
+
#cpac .postbox {
|
3 |
+
margin: 0 10px 10px 0;
|
4 |
+
}
|
5 |
+
#cpac .cpac-menu {
|
6 |
+
clear: both;
|
7 |
+
float: left;
|
8 |
+
width: 100%;
|
9 |
+
}
|
10 |
+
#icon-codepress-admin-columns {
|
11 |
+
background: transparent url('../images/icon.png') no-repeat 0 0;
|
12 |
+
}
|
13 |
+
#general-cpac-settings > .inside {
|
14 |
+
padding: 0;
|
15 |
+
margin: 0;
|
16 |
+
}
|
17 |
+
#general-cpac-settings table.form-table {
|
18 |
+
margin: 0;
|
19 |
+
padding: 0;
|
20 |
+
border-collapse: separate;
|
21 |
+
border-spacing: 0;
|
22 |
+
}
|
23 |
+
#general-cpac-settings table th,
|
24 |
+
#general-cpac-settings table td {
|
25 |
+
vertical-align: top;
|
26 |
+
border-bottom: 1px solid #DFDFDF;
|
27 |
+
border-top: 1px solid #FFFFFF;
|
28 |
+
}
|
29 |
+
#general-cpac-settings table th.cpac_post_type {
|
30 |
+
width: 18%;
|
31 |
+
font-weight: bold;
|
32 |
+
}
|
33 |
+
#general-cpac-settings table.form-table tr.bottom th,
|
34 |
+
#general-cpac-settings table.form-table tr.bottom td {
|
35 |
+
border-bottom: none;
|
36 |
+
}
|
37 |
+
#general-cpac-settings .cpac-box {
|
38 |
+
position: relative;
|
39 |
+
}
|
40 |
+
#general-cpac-settings .cpac-option-list {
|
41 |
+
overflow: hidden;
|
42 |
+
width: 360px;
|
43 |
+
}
|
44 |
+
#general-cpac-settings .cpac-reorder-msg {
|
45 |
+
background: transparent url('../images/reorder.png') no-repeat scroll 0 0;
|
46 |
+
margin-left: 5px;
|
47 |
+
height: 23px;
|
48 |
+
width: 171px;
|
49 |
+
clear: both;
|
50 |
+
}
|
51 |
+
#general-cpac-settings .cpac-option-list li {
|
52 |
+
margin: 5px 0;
|
53 |
+
position: relative;
|
54 |
+
overflow: hidden;
|
55 |
+
width: 320px;
|
56 |
+
box-shadow: 1px #FFFFFF;
|
57 |
+
text-shadow: 0 1px 0 #FFFFFF;
|
58 |
+
background-color: #F1F1F1;
|
59 |
+
background-image: -ms-linear-gradient(top, #f9f9f9, #ececec);
|
60 |
+
background-image: -moz-linear-gradient(top, #f9f9f9, #ececec);
|
61 |
+
background-image: -o-linear-gradient(top, #f9f9f9, #ececec);
|
62 |
+
background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec));
|
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 #DFDFDF;
|
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;
|
82 |
+
height: 26px;
|
83 |
+
float: left;
|
84 |
+
cursor: move;
|
85 |
+
position: relative; z-index: 10;
|
86 |
+
}
|
87 |
+
#general-cpac-settings .cpac-option-list li .cpac-checkbox {
|
88 |
+
margin-top: 5px;
|
89 |
+
width: 16px;
|
90 |
+
height: 15px;
|
91 |
+
cursor: pointer;
|
92 |
+
background: transparent url('../images/checkbox.png') no-repeat 0 0;
|
93 |
+
}
|
94 |
+
#general-cpac-settings .cpac-option-list li.active .cpac-checkbox {
|
95 |
+
background-position: 0 -15px;
|
96 |
+
}
|
97 |
+
#general-cpac-settings .cpac-option-list li .cpac-type-options {
|
98 |
+
float: left;
|
99 |
+
padding: 0;
|
100 |
+
position: relative;
|
101 |
+
width: 222px;
|
102 |
+
overflow: hidden;
|
103 |
+
height: 26px;
|
104 |
+
}
|
105 |
+
#general-cpac-settings .cpac-option-list li .cpac-type-options label {
|
106 |
+
position: absolute;
|
107 |
+
left: 22px;
|
108 |
+
top: 5px;
|
109 |
+
display: block;
|
110 |
+
margin-right: 30px;
|
111 |
+
overflow: hidden;
|
112 |
+
height: 15px;
|
113 |
+
}
|
114 |
+
#general-cpac-settings .cpac-option-list li .cpac-type-options input {
|
115 |
+
margin-top: 6px;
|
116 |
+
cursor: pointer;
|
117 |
+
}
|
118 |
+
#general-cpac-settings .cpac-option-list li div.cpac-meta-title {
|
119 |
+
position: absolute;
|
120 |
+
right: 0;
|
121 |
+
top: 0;
|
122 |
+
color: #999999;
|
123 |
+
}
|
124 |
+
#general-cpac-settings .cpac-option-list li a.cpac-action {
|
125 |
+
background: transparent url('../images/arrows.png') no-repeat scroll 50% 5px;
|
126 |
+
height: 26px;
|
127 |
+
width: 24px;
|
128 |
+
float: right;
|
129 |
+
display: block;
|
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;
|
136 |
+
float: right;
|
137 |
+
}
|
138 |
+
#general-cpac-settings .cpac-option-list li .cpac-type-inside {
|
139 |
+
display: none;
|
140 |
+
float: none;
|
141 |
+
clear: both;
|
142 |
+
background: #fbfbfb;
|
143 |
+
border-top: 1px solid #DFDFDF;
|
144 |
+
padding: 5px 10px;
|
145 |
+
}
|
146 |
+
#general-cpac-settings .cpac-option-list li a.cpac-delete-custom-field-box {
|
147 |
+
display: inline-block;
|
148 |
+
border-bottom: 1px solid #FF0000;
|
149 |
+
color: #FF0000;
|
150 |
+
text-decoration: none;
|
151 |
+
text-shadow: none;
|
152 |
+
padding: 0 3px;
|
153 |
+
}
|
154 |
+
#general-cpac-settings .cpac-option-list li a.cpac-delete-custom-field-box:hover {
|
155 |
+
background-color: #FF0000;
|
156 |
+
border-bottom-color: #FF0000;
|
157 |
+
color: #FFFFFF;
|
158 |
+
text-decoration: none;
|
159 |
+
}
|
160 |
+
#general-cpac-settings .cpac-option-list li .cpac-type-inside label {
|
161 |
+
width: 100px;
|
162 |
+
display: inline-block;
|
163 |
+
}
|
164 |
+
#general-cpac-settings .cpac-option-list li .cpac-type-inside input,
|
165 |
+
#general-cpac-settings .cpac-option-list li .cpac-type-inside select {
|
166 |
+
min-width: 184px;
|
167 |
+
}
|
168 |
+
#general-cpac-settings .cpac-add-column a {
|
169 |
+
display: block;
|
170 |
+
}
|
171 |
+
#general-cpac-settings .cpac-option-list li.cpac-placeholder {
|
172 |
+
border: 1px dashed #666;
|
173 |
+
-webkit-border-radius: 0;
|
174 |
+
-moz-border-radius: 0;
|
175 |
+
border-radius: 0;
|
176 |
+
width: 320px;
|
177 |
+
background: transparent;
|
178 |
+
}
|
179 |
+
#general-cpac-settings .cpac-add-customfield-column {
|
180 |
+
position: absolute;
|
181 |
+
bottom: 30px;
|
182 |
+
left: 360px;
|
183 |
+
}
|
184 |
+
#general-cpac-settings .cpac-option-list li.deleting {
|
185 |
+
background: #CFADB3;
|
186 |
+
border: 1px solid #CFADB3;
|
187 |
+
color: #832525;
|
188 |
+
text-shadow: none;
|
189 |
+
}
|
190 |
+
#restore-cpac-settings .inside {
|
191 |
+
padding: 10px;
|
192 |
+
}
|
193 |
+
#restore-cpac-settings.postbox {
|
194 |
+
background: #FAF2F5;
|
195 |
+
border: 1px solid #CFADB3;
|
196 |
+
color: #832525;
|
197 |
+
}
|
198 |
+
#restore-cpac-settings.postbox h3 {
|
199 |
+
color: #832525;
|
200 |
+
background: #FAF2F5;
|
201 |
+
}
|
202 |
+
#restore-cpac-settings .inside .button {
|
203 |
+
margin: 0 0 10px;
|
204 |
+
border: 1px solid #CFADB3;
|
205 |
+
color: #832525;
|
206 |
+
}
|
207 |
+
#restore-cpac-settings .inside .description {
|
208 |
+
color: #832525;
|
209 |
+
}
|
assets/css/column.css
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
.column-column-attachment img {
|
2 |
+
padding-right: 5px;
|
3 |
+
padding-bottom: 4px;
|
4 |
+
}
|
assets/images/arrows.png
ADDED
Binary file
|
assets/images/checkbox.png
ADDED
Binary file
|
assets/images/checkmark.png
ADDED
Binary file
|
assets/images/checkmark_single.png
ADDED
Binary file
|
assets/images/icon.png
ADDED
Binary file
|
assets/images/reorder.png
ADDED
Binary file
|
assets/images/sort.png
ADDED
Binary file
|
assets/js/admin-column.js
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* fires when the dom is ready
|
3 |
+
*
|
4 |
+
*/
|
5 |
+
jQuery(document).ready(function(){
|
6 |
+
cpac_sortable();
|
7 |
+
cpac_checked();
|
8 |
+
cpac_box_events();
|
9 |
+
cpac_menu();
|
10 |
+
cpac_add_custom_column();
|
11 |
+
});
|
12 |
+
|
13 |
+
/**
|
14 |
+
* sortable
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
function cpac_sortable()
|
18 |
+
{
|
19 |
+
jQuery('ul.cpac-option-list').sortable({
|
20 |
+
handle: 'div.cpac-sort-handle',
|
21 |
+
placeholder: 'cpac-placeholder',
|
22 |
+
forcePlaceholderSize: true
|
23 |
+
});
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* checked
|
28 |
+
*
|
29 |
+
*/
|
30 |
+
function cpac_checked()
|
31 |
+
{
|
32 |
+
jQuery('#cpac .cpac-option-list li .cpac-type-options').live({
|
33 |
+
click: function() {
|
34 |
+
var li = jQuery(this).closest('li');
|
35 |
+
var state = jQuery('.cpac-state', li);
|
36 |
+
var value = state.attr('value');
|
37 |
+
|
38 |
+
// toggle on
|
39 |
+
if ( value != 'on') {
|
40 |
+
li.addClass('active');
|
41 |
+
state.attr('value', 'on');
|
42 |
+
}
|
43 |
+
|
44 |
+
// toggle off
|
45 |
+
else {
|
46 |
+
li.removeClass('active');
|
47 |
+
state.attr('value', '');
|
48 |
+
}
|
49 |
+
}
|
50 |
+
});
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Open and close box
|
55 |
+
*
|
56 |
+
*/
|
57 |
+
function cpac_box_events()
|
58 |
+
{
|
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').find('.cpac-type-inside').slideToggle(150);
|
63 |
+
});
|
64 |
+
|
65 |
+
// remove custom field box
|
66 |
+
jQuery('#cpac .cpac-delete-custom-field-box').unbind('click').click(function(e){
|
67 |
+
e.preventDefault();
|
68 |
+
var el = jQuery(this).closest('li');
|
69 |
+
|
70 |
+
el.addClass('deleting').animate({
|
71 |
+
opacity : 0,
|
72 |
+
height: 0
|
73 |
+
}, 350, function() {
|
74 |
+
el.remove();
|
75 |
+
});
|
76 |
+
|
77 |
+
});
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Menu
|
82 |
+
*
|
83 |
+
*/
|
84 |
+
function cpac_menu()
|
85 |
+
{
|
86 |
+
// referer
|
87 |
+
var referer = jQuery("input[type='hidden'][name='_wp_http_referer']");
|
88 |
+
var referer_value = referer.attr('value');
|
89 |
+
|
90 |
+
// click
|
91 |
+
jQuery('#cpac .cpac-menu a').click( function(e, el) {
|
92 |
+
e.preventDefault();
|
93 |
+
var id = jQuery(this).attr('href');
|
94 |
+
|
95 |
+
if ( id ) {
|
96 |
+
// remove current
|
97 |
+
jQuery('#cpac .cpac-menu a').removeClass('current');
|
98 |
+
jQuery('#cpac .cpac-box-row').hide().removeClass('current');
|
99 |
+
|
100 |
+
// set current
|
101 |
+
jQuery(this).addClass('current');
|
102 |
+
jQuery(id).show().addClass('current');
|
103 |
+
|
104 |
+
// set refere
|
105 |
+
var querystring = '&cpac_type=' + id.replace('#','');
|
106 |
+
referer.attr('value', referer_value + querystring );
|
107 |
+
}
|
108 |
+
});
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* add custom columns
|
113 |
+
*
|
114 |
+
*/
|
115 |
+
function cpac_add_custom_column()
|
116 |
+
{
|
117 |
+
jQuery('.cpac-add-customfield-column').click(function(e){
|
118 |
+
e.preventDefault();
|
119 |
+
|
120 |
+
var list = jQuery(this).closest('td').find('ul.cpac-option-list');
|
121 |
+
var metafields = jQuery('li.cpac-box-metafield', list);
|
122 |
+
|
123 |
+
// get unique ID number...
|
124 |
+
var ids = [];
|
125 |
+
metafields.each(function(k,v) {
|
126 |
+
var _class = jQuery(v).attr('class');
|
127 |
+
var classes = _class.split(' ');
|
128 |
+
jQuery.each(classes, function(kc,vc){
|
129 |
+
if ( vc.indexOf('cpac-box-column-meta-') === 0 ) {
|
130 |
+
var id = vc.replace('cpac-box-column-meta-','');
|
131 |
+
if ( id )
|
132 |
+
ids.push(id);
|
133 |
+
}
|
134 |
+
});
|
135 |
+
});
|
136 |
+
|
137 |
+
// ...and sort them
|
138 |
+
ids.sort(sortNumber);
|
139 |
+
|
140 |
+
if ( !ids )
|
141 |
+
return;
|
142 |
+
|
143 |
+
function sortNumber(a,b) {
|
144 |
+
return b - a;
|
145 |
+
}
|
146 |
+
|
147 |
+
// ID's
|
148 |
+
var id = parseFloat(ids[0]);
|
149 |
+
var new_id = id + 1;
|
150 |
+
|
151 |
+
// Clone
|
152 |
+
var clone = jQuery( '.cpac-box-column-meta-' + id, list ).clone();
|
153 |
+
|
154 |
+
// Toggle class
|
155 |
+
jQuery(clone).removeClass('cpac-box-column-meta-' + id );
|
156 |
+
jQuery(clone).addClass('cpac-box-column-meta-' + new_id );
|
157 |
+
|
158 |
+
// Replace inputs ID's
|
159 |
+
var inputs = jQuery(clone).find('input, select');
|
160 |
+
jQuery(inputs).each(function(ik, iv){
|
161 |
+
jQuery(iv).attr('name', jQuery(iv).attr('name').replace(id, new_id) );
|
162 |
+
});
|
163 |
+
|
164 |
+
// Replace label ID's
|
165 |
+
var labels = jQuery(clone).find('label');
|
166 |
+
jQuery(labels).each(function(ik, iv){
|
167 |
+
var attr_for = jQuery(iv).attr('for');
|
168 |
+
if ( attr_for ) {
|
169 |
+
jQuery(iv).attr('for', attr_for.replace(id, new_id) );
|
170 |
+
}
|
171 |
+
});
|
172 |
+
|
173 |
+
// remove description
|
174 |
+
clone.find('.remove-description').remove();
|
175 |
+
|
176 |
+
// change label text
|
177 |
+
clone.find('label.main-label, .cpac-type-inside input.text').text('Custom Field');
|
178 |
+
clone.find('.cpac-type-inside input.text').val('Custom Field');
|
179 |
+
|
180 |
+
// add remove button
|
181 |
+
if ( clone.find('.cpac-delete-custom-field-box').length == 0 ) {
|
182 |
+
var remove = '<p><a href="javascript:;" class="cpac-delete-custom-field-box">Remove</a>';
|
183 |
+
clone.find('.cpac-type-inside').append(remove);
|
184 |
+
}
|
185 |
+
|
186 |
+
// add cloned box to the list
|
187 |
+
list.append(clone);
|
188 |
+
|
189 |
+
// retrigger click events
|
190 |
+
cpac_box_events();
|
191 |
+
});
|
192 |
+
}
|
codepress-admin-columns.php
ADDED
@@ -0,0 +1,1370 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Codepress Admin Columns
|
4 |
+
Version: 1.0.1
|
5 |
+
Description: This plugin makes it easy to customize Admin Columns for your Posts, Pages and Custom Post Type Screens.
|
6 |
+
Author: Tobias Schutter
|
7 |
+
Author URI: http://www.codepress.nl
|
8 |
+
Plugin URI: http://www.codepress.nl/plugins/codepress-admin-columns/
|
9 |
+
Text Domain: codepress-admin-columns
|
10 |
+
Domain Path: /languages
|
11 |
+
License: GPLv2
|
12 |
+
|
13 |
+
Copyright 2011 Codepress info@codepress.nl
|
14 |
+
|
15 |
+
This program is free software; you can redistribute it and/or modify
|
16 |
+
it under the terms of the GNU General Public License version 2 as published by
|
17 |
+
the Free Software Foundation.
|
18 |
+
|
19 |
+
This program is distributed in the hope that it will be useful,
|
20 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
GNU General Public License for more details.
|
23 |
+
|
24 |
+
You should have received a copy of the GNU General Public License
|
25 |
+
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.0.1' );
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Init Class
|
33 |
+
*
|
34 |
+
* @since 1.0
|
35 |
+
*/
|
36 |
+
$cpac = new Codepress_Admin_Columns;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Advanced Admin Columns Class
|
40 |
+
*
|
41 |
+
* @since 1.0
|
42 |
+
*
|
43 |
+
*/
|
44 |
+
class Codepress_Admin_Columns
|
45 |
+
{
|
46 |
+
private $post_types,
|
47 |
+
$options,
|
48 |
+
$options_default,
|
49 |
+
$slug,
|
50 |
+
$textdomain;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Construct
|
54 |
+
*
|
55 |
+
* @since 1.0
|
56 |
+
*/
|
57 |
+
function __construct()
|
58 |
+
{
|
59 |
+
add_action( 'wp_loaded', array( &$this, 'init') );
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Initilize plugin.
|
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 |
+
$this->handle_requests();
|
74 |
+
$this->options = get_option('cpac_options');
|
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 |
+
// Actions and hooks
|
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( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts') );
|
89 |
+
add_action( 'manage_pages_custom_column', array( &$this, 'manage_column_value'), 10, 2 );
|
90 |
+
add_action( 'manage_posts_custom_column', array( &$this, 'manage_column_value'), 10, 2 );
|
91 |
+
add_action( 'admin_print_styles' , array( &$this, 'column_styles') );
|
92 |
+
add_filter( 'request', array( &$this, 'handle_requests_orderby_column') );
|
93 |
+
add_filter( 'plugin_action_links', array( &$this, 'add_settings_link'), 10, 2);
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Admin Menu.
|
98 |
+
*
|
99 |
+
* Create the admin menu link for the settings page.
|
100 |
+
*
|
101 |
+
* @since 1.0
|
102 |
+
*/
|
103 |
+
public function settings_menu()
|
104 |
+
{
|
105 |
+
$page = add_options_page(
|
106 |
+
// Page title
|
107 |
+
esc_html__( 'Admin Columns Settings', $this->textdomain ),
|
108 |
+
// Menu Title
|
109 |
+
esc_html__( 'Admin Columns', $this->textdomain ),
|
110 |
+
// Capability
|
111 |
+
'manage_options',
|
112 |
+
// Menu slug
|
113 |
+
$this->slug,
|
114 |
+
// Callback
|
115 |
+
array( &$this, 'plugin_settings_page')
|
116 |
+
);
|
117 |
+
|
118 |
+
// css scripts
|
119 |
+
add_action( "admin_print_styles-$page", array( &$this, 'admin_styles') );
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Add Settings link to plugin page
|
124 |
+
*
|
125 |
+
* @since 1.0
|
126 |
+
*/
|
127 |
+
function add_settings_link( $links, $file )
|
128 |
+
{
|
129 |
+
if ( $file != plugin_basename( __FILE__ ))
|
130 |
+
return $links;
|
131 |
+
|
132 |
+
array_unshift($links, '<a href="' . admin_url("admin.php") . '?page=' . $this->slug . '">' . __( 'Settings' ) . '</a>');
|
133 |
+
return $links;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Register Columns
|
138 |
+
*
|
139 |
+
* @since 1.0
|
140 |
+
*/
|
141 |
+
public function register_columns()
|
142 |
+
{
|
143 |
+
foreach ( $this->post_types as $post_type ) {
|
144 |
+
|
145 |
+
// register column per post type
|
146 |
+
add_filter("manage_edit-{$post_type}_columns", array(&$this, 'callback_set_column'));
|
147 |
+
|
148 |
+
// register column as sortable
|
149 |
+
add_filter( "manage_edit-{$post_type}_sortable_columns", array(&$this, 'callback_set_sortable_column'));
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Callback Set Column
|
155 |
+
*
|
156 |
+
* @since 1.0
|
157 |
+
*/
|
158 |
+
public function callback_set_column($columns)
|
159 |
+
{
|
160 |
+
global $post_type;
|
161 |
+
$columns = $this->set_column($columns, $post_type);
|
162 |
+
|
163 |
+
return $columns;
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Callback Set Sortable Column
|
168 |
+
*
|
169 |
+
* @since 1.0
|
170 |
+
*/
|
171 |
+
public function callback_set_sortable_column($columns)
|
172 |
+
{
|
173 |
+
global $post_type;
|
174 |
+
$columns = $this->set_sortable_filter($columns, $post_type);
|
175 |
+
|
176 |
+
return $columns;
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Settings Page Template.
|
181 |
+
*
|
182 |
+
* This function in conjunction with others usei the WordPress
|
183 |
+
* Settings API to create a settings page where users can adjust
|
184 |
+
* the behaviour of this plugin.
|
185 |
+
*
|
186 |
+
* @since 1.0
|
187 |
+
*/
|
188 |
+
public function plugin_settings_page()
|
189 |
+
{
|
190 |
+
// loop through post types
|
191 |
+
$rows = '';
|
192 |
+
foreach ( $this->post_types as $post_type ) {
|
193 |
+
|
194 |
+
// post type label
|
195 |
+
$label = $this->get_singular_name($post_type);
|
196 |
+
|
197 |
+
// id
|
198 |
+
$id = $this->sanitize_string($post_type);
|
199 |
+
|
200 |
+
// build draggable boxes
|
201 |
+
$boxes = $this->get_column_options($post_type);
|
202 |
+
|
203 |
+
// class
|
204 |
+
$class = $this->is_menu_type_current($post_type) ? ' current' : ' hidden';
|
205 |
+
|
206 |
+
$rows .= "
|
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 |
+
// Post Type Menu
|
220 |
+
$menu = $this->get_post_type_menu();
|
221 |
+
|
222 |
+
?>
|
223 |
+
<div id="cpac" class="wrap">
|
224 |
+
<?php screen_icon($this->slug) ?>
|
225 |
+
<h2><?php _e('Codepress Admin Columns', $this->textdomain); ?></h2>
|
226 |
+
<?php echo $menu ?>
|
227 |
+
<div class="postbox-container" style="width:70%;">
|
228 |
+
<div class="metabox-holder">
|
229 |
+
<div class="meta-box-sortables">
|
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 |
+
</div>
|
295 |
+
<?php
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Get a list of Column options per post type
|
300 |
+
*
|
301 |
+
* @since 1.0
|
302 |
+
*/
|
303 |
+
private function get_column_options($post_type)
|
304 |
+
{
|
305 |
+
// merge all columns
|
306 |
+
$display_columns = $this->get_merged_columns($post_type);
|
307 |
+
|
308 |
+
// define
|
309 |
+
$list = '';
|
310 |
+
|
311 |
+
// loop throught the active columns
|
312 |
+
if ( $display_columns ) {
|
313 |
+
foreach ( $display_columns as $key => $values ) {
|
314 |
+
|
315 |
+
// add items to the list
|
316 |
+
$list .= $this->get_box($post_type, $key, $values);
|
317 |
+
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
// custom field button
|
322 |
+
$button_add_column = '';
|
323 |
+
if ( $this->get_postmeta_by_posttype($post_type) )
|
324 |
+
$button_add_column = "<a href='javacript:;' class='cpac-add-customfield-column button'>+ " . __('Add Custom Field Column') . "</a>";
|
325 |
+
|
326 |
+
return "
|
327 |
+
<div class='cpac-box'>
|
328 |
+
<ul class='cpac-option-list'>
|
329 |
+
{$list}
|
330 |
+
</ul>
|
331 |
+
{$button_add_column}
|
332 |
+
<div class='cpac-reorder-msg'></div>
|
333 |
+
</div>
|
334 |
+
";
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Get merged columns
|
339 |
+
*
|
340 |
+
* @since 1.0
|
341 |
+
*/
|
342 |
+
private function get_merged_columns($post_type)
|
343 |
+
{
|
344 |
+
//get saved database columns
|
345 |
+
$db_columns = $this->get_db_columns($post_type);
|
346 |
+
|
347 |
+
// get wp default columns
|
348 |
+
$wp_default_columns = $this->get_wp_default_columns($post_type);
|
349 |
+
|
350 |
+
// get custom columns
|
351 |
+
$wp_custom_columns = $this->get_custom_columns($post_type);
|
352 |
+
|
353 |
+
// merge wp default and custom columns
|
354 |
+
$default_columns = wp_parse_args($wp_custom_columns, $wp_default_columns);
|
355 |
+
|
356 |
+
// loop throught the active columns
|
357 |
+
if ( $db_columns ) {
|
358 |
+
foreach ( $db_columns as $key => $values ) {
|
359 |
+
|
360 |
+
// get column meta options from custom columns
|
361 |
+
if ( strpos($key, 'column-meta-') !== false )
|
362 |
+
$db_columns[$key]['options'] = $wp_custom_columns['column-meta-1']['options'];
|
363 |
+
|
364 |
+
// add static options
|
365 |
+
else
|
366 |
+
$db_columns[$key]['options'] = $default_columns[$key]['options'];
|
367 |
+
|
368 |
+
unset($default_columns[$key]);
|
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($post_type, $key, $values)
|
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-{$key}";
|
396 |
+
if ( $state )
|
397 |
+
$classes[] = 'active';
|
398 |
+
if ( ! empty($values['options']['class']) )
|
399 |
+
$classes[] = $values['options']['class'];
|
400 |
+
$class = implode(' ', $classes);
|
401 |
+
|
402 |
+
// more box options
|
403 |
+
$more_options = $this->get_additional_box_options($post_type, $key, $values);
|
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 |
+
|
411 |
+
$list = "
|
412 |
+
<li class='{$class}'>
|
413 |
+
<div class='cpac-sort-handle'></div>
|
414 |
+
<div class='cpac-type-options'>
|
415 |
+
|
416 |
+
<div class='cpac-checkbox'></div>
|
417 |
+
<input type='hidden' class='cpac-state' name='cpac_options[columns][{$post_type}][{$key}][state]' value='{$state}'/>
|
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>{$values['options']['type_label']}</span>
|
424 |
+
</div>
|
425 |
+
<div class='cpac-type-inside'>
|
426 |
+
<label for='cpac_options[columns][{$post_type}][{$key}][label]'>Label: </label>
|
427 |
+
<input type='text' name='cpac_options[columns][{$post_type}][{$key}][label]' value='{$values['label']}' class='text'/>
|
428 |
+
<br/>
|
429 |
+
{$more_options}
|
430 |
+
</div>
|
431 |
+
</li>
|
432 |
+
";
|
433 |
+
|
434 |
+
return $list;
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Get additional box option fields
|
439 |
+
*
|
440 |
+
* @since 1.0
|
441 |
+
*/
|
442 |
+
private function get_additional_box_options($post_type, $key, $values)
|
443 |
+
{
|
444 |
+
$fields = '';
|
445 |
+
|
446 |
+
// Custom Fields
|
447 |
+
if ( strpos($key, 'column-meta-') !== false )
|
448 |
+
$fields .= $this->get_box_options_customfields($post_type, $key, $values);
|
449 |
+
|
450 |
+
return $fields;
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Box Options: Custom Fields
|
455 |
+
*
|
456 |
+
* @since 1.0
|
457 |
+
*/
|
458 |
+
private function get_box_options_customfields($post_type, $key, $values)
|
459 |
+
{
|
460 |
+
// get post meta fields
|
461 |
+
$fields = $this->get_postmeta_by_posttype($post_type);
|
462 |
+
|
463 |
+
if ( empty($fields) )
|
464 |
+
return false;
|
465 |
+
|
466 |
+
// set meta field options
|
467 |
+
$current = ! empty($values['field']) ? $values['field'] : '' ;
|
468 |
+
$field_options = '';
|
469 |
+
foreach ($fields as $field) {
|
470 |
+
$field_options .= sprintf
|
471 |
+
(
|
472 |
+
'<option value="%s"%s>%s</option>',
|
473 |
+
$field,
|
474 |
+
$field == $current? ' selected="selected"':'',
|
475 |
+
$field
|
476 |
+
);
|
477 |
+
}
|
478 |
+
|
479 |
+
// set meta fieldtype options
|
480 |
+
$currenttype = ! empty($values['field_type']) ? $values['field_type'] : '' ;
|
481 |
+
$fieldtype_options = '';
|
482 |
+
$fieldtypes = array(
|
483 |
+
'' => __('Default'),
|
484 |
+
'image' => __('Image'),
|
485 |
+
'library_id' => __('Media Library Icon', $this->textdomain),
|
486 |
+
'excerpt' => __('Excerpt'),
|
487 |
+
'array' => __('Multiple Values', $this->textdomain),
|
488 |
+
);
|
489 |
+
|
490 |
+
// add filters
|
491 |
+
$fieldtypes = apply_filters('cpac-field-types', $fieldtypes );
|
492 |
+
foreach ( $fieldtypes as $fkey => $fieldtype ) {
|
493 |
+
$fieldtype_options .= sprintf
|
494 |
+
(
|
495 |
+
'<option value="%s"%s>%s</option>',
|
496 |
+
$fkey,
|
497 |
+
$fkey == $currenttype? ' selected="selected"':'',
|
498 |
+
$fieldtype
|
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 ( $key != 'column-meta-1') {
|
508 |
+
$remove = "
|
509 |
+
<p>
|
510 |
+
<a href='javascript:;' class='cpac-delete-custom-field-box'>".__('Remove')."</a>
|
511 |
+
</p>
|
512 |
+
";
|
513 |
+
}
|
514 |
+
|
515 |
+
$inside = "
|
516 |
+
<label for='cpac_options[columns][{$post_type}][{$key}][field]'>Custom Field: </label>
|
517 |
+
<select name='cpac_options[columns][{$post_type}][{$key}][field]'>{$field_options}</select>
|
518 |
+
<br/>
|
519 |
+
<label for='cpac_options[columns][{$post_type}][{$key}][field_type]'>Field Type: </label>
|
520 |
+
<select name='cpac_options[columns][{$post_type}][{$key}][field_type]'>{$fieldtype_options}</select>
|
521 |
+
<br/>
|
522 |
+
{$remove}
|
523 |
+
";
|
524 |
+
|
525 |
+
return $inside;
|
526 |
+
}
|
527 |
+
|
528 |
+
/**
|
529 |
+
* Get post meta fields by post type
|
530 |
+
*
|
531 |
+
* @since 1.0
|
532 |
+
*/
|
533 |
+
private function get_postmeta_by_posttype($post_type)
|
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();
|
543 |
+
foreach ($fields as $field) {
|
544 |
+
// filter out hidden meta fields
|
545 |
+
if (substr($field[0],0,1) != "_") {
|
546 |
+
$meta_fields[] = $field[0];
|
547 |
+
}
|
548 |
+
}
|
549 |
+
|
550 |
+
return $meta_fields;
|
551 |
+
}
|
552 |
+
|
553 |
+
return false;
|
554 |
+
}
|
555 |
+
|
556 |
+
/**
|
557 |
+
* Register admin scripts
|
558 |
+
*
|
559 |
+
* @since 1.0
|
560 |
+
*/
|
561 |
+
public function admin_enqueue_scripts()
|
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 |
+
private function get_post_types()
|
574 |
+
{
|
575 |
+
$post_types = get_post_types(array(
|
576 |
+
'_builtin' => false
|
577 |
+
));
|
578 |
+
$post_types['post'] = 'post';
|
579 |
+
$post_types['page'] = 'page';
|
580 |
+
|
581 |
+
return $post_types;
|
582 |
+
}
|
583 |
+
|
584 |
+
/**
|
585 |
+
* Register admin css
|
586 |
+
*
|
587 |
+
* @since 1.0
|
588 |
+
*/
|
589 |
+
public function admin_styles()
|
590 |
+
{
|
591 |
+
wp_enqueue_style( 'cpac-admin', $this->plugin_url('/assets/css/admin-column.css'), array(), CPAC_VERSION, 'all' );
|
592 |
+
}
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Register column css
|
596 |
+
*
|
597 |
+
* @since 1.0
|
598 |
+
*/
|
599 |
+
public function column_styles()
|
600 |
+
{
|
601 |
+
wp_enqueue_style( 'cpac-columns', $this->plugin_url('/assets/css/column.css'), array(), CPAC_VERSION, 'all' );
|
602 |
+
}
|
603 |
+
|
604 |
+
/**
|
605 |
+
* Register plugin options
|
606 |
+
*
|
607 |
+
* @since 1.0
|
608 |
+
*/
|
609 |
+
public function register_settings()
|
610 |
+
{
|
611 |
+
// If we have no options in the database, let's add them now.
|
612 |
+
if ( false === $this->options )
|
613 |
+
add_option( 'cpac_options', array(&$this, 'get_default_plugin_options') );
|
614 |
+
|
615 |
+
register_setting( 'cpac-settings-group', 'cpac_options', array(&$this, 'options_callback') );
|
616 |
+
}
|
617 |
+
|
618 |
+
/**
|
619 |
+
* Returns the default plugin options.
|
620 |
+
*
|
621 |
+
* @since 1.0
|
622 |
+
*/
|
623 |
+
public function get_default_plugin_options()
|
624 |
+
{
|
625 |
+
$default_plugin_options = array(
|
626 |
+
'post' => '',
|
627 |
+
'page' => ''
|
628 |
+
);
|
629 |
+
return apply_filters( 'cpac_default_plugin_options', $default_plugin_options );
|
630 |
+
}
|
631 |
+
|
632 |
+
/**
|
633 |
+
* Save geocode coordinates of focus location.
|
634 |
+
*
|
635 |
+
* @since 1.0
|
636 |
+
*/
|
637 |
+
public function options_callback($options)
|
638 |
+
{
|
639 |
+
return $options;
|
640 |
+
}
|
641 |
+
|
642 |
+
/**
|
643 |
+
* Handle requests.
|
644 |
+
*
|
645 |
+
* @since 1.0
|
646 |
+
*/
|
647 |
+
private function handle_requests()
|
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 |
+
/**
|
667 |
+
* Restore defaults
|
668 |
+
*
|
669 |
+
* @since 1.0
|
670 |
+
*/
|
671 |
+
private function restore_defaults()
|
672 |
+
{
|
673 |
+
delete_option( 'cpac_options' );
|
674 |
+
delete_option( 'cpac_options_default' );
|
675 |
+
}
|
676 |
+
|
677 |
+
/**
|
678 |
+
* Returns excerpt
|
679 |
+
*
|
680 |
+
* @since 1.0
|
681 |
+
*/
|
682 |
+
private function get_post_excerpt($post_id, $charlength = 100)
|
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, $charlength );
|
691 |
+
|
692 |
+
return $output;
|
693 |
+
}
|
694 |
+
|
695 |
+
/**
|
696 |
+
* Returns shortened string
|
697 |
+
*
|
698 |
+
* @since 1.0
|
699 |
+
*/
|
700 |
+
private function get_shortened_string($string = '', $charlength = 100)
|
701 |
+
{
|
702 |
+
if (!$string)
|
703 |
+
return false;
|
704 |
+
|
705 |
+
$output = '';
|
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 |
+
/**
|
719 |
+
* Manage custom column for Post Types.
|
720 |
+
*
|
721 |
+
* @since 1.0
|
722 |
+
*/
|
723 |
+
public function manage_column_value($key, $post_id)
|
724 |
+
{
|
725 |
+
$type = $key;
|
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 ( strpos($type, 'column-meta-') !== false )
|
733 |
+
$type = 'column-meta';
|
734 |
+
|
735 |
+
// Hook
|
736 |
+
do_action('cpac-manage-column', $type, $key, $post_id);
|
737 |
+
|
738 |
+
// Switch Types
|
739 |
+
$result = '';
|
740 |
+
switch ($type) :
|
741 |
+
|
742 |
+
// Post ID
|
743 |
+
case "column-postid" :
|
744 |
+
$result = $post_id;
|
745 |
+
break;
|
746 |
+
|
747 |
+
// Excerpt
|
748 |
+
case "column-excerpt" :
|
749 |
+
$result = $this->get_post_excerpt($post_id);
|
750 |
+
break;
|
751 |
+
|
752 |
+
// Featured Image
|
753 |
+
case "column-featured_image" :
|
754 |
+
$result = get_the_post_thumbnail($post_id, array(80,80));
|
755 |
+
break;
|
756 |
+
|
757 |
+
// Sticky Post
|
758 |
+
case "column-sticky" :
|
759 |
+
if ( is_sticky($post_id) ) {
|
760 |
+
$src = $this->plugin_url('assets/images/checkmark.png');
|
761 |
+
$result = "<img alt='sticky' src='{$src}' />";
|
762 |
+
}
|
763 |
+
break;
|
764 |
+
|
765 |
+
// Order
|
766 |
+
case "column-order" :
|
767 |
+
$result = get_post_field('menu_order', $post_id);
|
768 |
+
break;
|
769 |
+
|
770 |
+
// Post Formats
|
771 |
+
case "column-post_formats" :
|
772 |
+
$result = get_post_format($post_id);
|
773 |
+
break;
|
774 |
+
|
775 |
+
// Page template
|
776 |
+
case "column-page-template" :
|
777 |
+
// file name
|
778 |
+
$page_template = get_post_meta($post_id, '_wp_page_template', true);
|
779 |
+
// all page templates
|
780 |
+
$templates = get_page_templates();
|
781 |
+
// template name
|
782 |
+
$result = array_search($page_template, $templates);
|
783 |
+
break;
|
784 |
+
|
785 |
+
// Slug
|
786 |
+
case "column-page-slug" :
|
787 |
+
$result = get_post($post_id)->post_name;
|
788 |
+
break;
|
789 |
+
|
790 |
+
// Taxonomy
|
791 |
+
case "column-taxonomy" :
|
792 |
+
$tax = str_replace('column-taxonomy-','',$key);
|
793 |
+
$tags = get_the_terms($post_id, $tax);
|
794 |
+
$tarr = array();
|
795 |
+
if ( $tax == 'post_format' && empty($tags) ) {
|
796 |
+
$result = __('Standard');
|
797 |
+
}
|
798 |
+
elseif ( !empty($tags) ) {
|
799 |
+
foreach($tags as $tag) {
|
800 |
+
$tarr[] = $tag->name;
|
801 |
+
}
|
802 |
+
$result = implode(', ', $tarr);
|
803 |
+
}
|
804 |
+
break;
|
805 |
+
|
806 |
+
// Custom Field
|
807 |
+
case "column-meta" :
|
808 |
+
$result = $this->get_column_value_custom_field($post_id, $key);
|
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, $key, true );
|
818 |
+
|
819 |
+
endswitch;
|
820 |
+
|
821 |
+
if ( empty($result) )
|
822 |
+
echo ' ';
|
823 |
+
|
824 |
+
echo $result;
|
825 |
+
}
|
826 |
+
|
827 |
+
/**
|
828 |
+
* Get column value of post attachments
|
829 |
+
*
|
830 |
+
* @since 1.0
|
831 |
+
*/
|
832 |
+
private function get_column_value_attachments($post_id)
|
833 |
+
{
|
834 |
+
$result = '';
|
835 |
+
$attachments = get_posts(array(
|
836 |
+
'post_type' => 'attachment',
|
837 |
+
'numberposts' => -1,
|
838 |
+
'post_status' => null,
|
839 |
+
'post_parent' => $post_id
|
840 |
+
));
|
841 |
+
if ( $attachments ) {
|
842 |
+
foreach ( $attachments as $attach ) {
|
843 |
+
$result .= wp_get_attachment_image( $attach->ID, array(80,80), true );
|
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($post_id, $key)
|
855 |
+
{
|
856 |
+
$columns = $this->get_db_columns( get_post_type($post_id) );
|
857 |
+
$field = isset($columns[$key]['field']) ? $columns[$key]['field'] : '';
|
858 |
+
$fieldtype = isset($columns[$key]['field_type']) ? $columns[$key]['field_type'] : '';
|
859 |
+
|
860 |
+
// Get meta field value
|
861 |
+
$meta = get_post_meta($post_id, $field, true);
|
862 |
+
|
863 |
+
// multiple meta values
|
864 |
+
if ( ( $fieldtype == 'array' && is_array($meta) ) || is_array($meta) ) {
|
865 |
+
$meta = get_post_meta($post_id, $field);
|
866 |
+
$meta = $this->recursive_implode(', ', $meta);
|
867 |
+
}
|
868 |
+
|
869 |
+
// make sure there are no serialized arrays or empty meta data
|
870 |
+
if ( empty($meta) || !is_string($meta) )
|
871 |
+
return false;
|
872 |
+
|
873 |
+
// handles each field type differently..
|
874 |
+
switch ($fieldtype) :
|
875 |
+
|
876 |
+
// Image
|
877 |
+
case "image" :
|
878 |
+
$meta = $this->get_thumbnail($meta);
|
879 |
+
break;
|
880 |
+
|
881 |
+
// Media Library ID
|
882 |
+
case "library_id" :
|
883 |
+
// check if media exists
|
884 |
+
$meta = wp_get_attachment_url($meta) ? wp_get_attachment_image( $meta, array(80,80), true ) : '';
|
885 |
+
break;
|
886 |
+
|
887 |
+
// Excerpt
|
888 |
+
case "excerpt" :
|
889 |
+
$meta = $this->get_shortened_string($meta, 100);
|
890 |
+
break;
|
891 |
+
|
892 |
+
endswitch;
|
893 |
+
|
894 |
+
return $meta;
|
895 |
+
}
|
896 |
+
|
897 |
+
/**
|
898 |
+
* Implode for multi dimensional array
|
899 |
+
*
|
900 |
+
* @since 1.0
|
901 |
+
*/
|
902 |
+
private function recursive_implode( $glue, $pieces )
|
903 |
+
{
|
904 |
+
foreach( $pieces as $r_pieces ) {
|
905 |
+
if( is_array( $r_pieces ) ) {
|
906 |
+
$retVal[] = $this->recursive_implode( $glue, $r_pieces );
|
907 |
+
}
|
908 |
+
else {
|
909 |
+
$retVal[] = $r_pieces;
|
910 |
+
}
|
911 |
+
}
|
912 |
+
return implode( $glue, $retVal );
|
913 |
+
}
|
914 |
+
|
915 |
+
/**
|
916 |
+
* 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 |
+
if ( !$db_columns )
|
925 |
+
return $columns;
|
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($columns, $post_type = 'post')
|
949 |
+
{
|
950 |
+
$options = $this->options_default;
|
951 |
+
|
952 |
+
if ( !$options )
|
953 |
+
return $columns;
|
954 |
+
|
955 |
+
// we use the wp default columns for filtering...
|
956 |
+
$db_columns = $options[$post_type];
|
957 |
+
|
958 |
+
// ... the ones that are set by plugins, theme functions and such.
|
959 |
+
$dif_columns = array_diff(array_keys($columns), array_keys($db_columns));
|
960 |
+
|
961 |
+
// we add those to the columns
|
962 |
+
$pre_columns = array();
|
963 |
+
if ( $dif_columns ) {
|
964 |
+
foreach ( $dif_columns as $column ) {
|
965 |
+
$pre_columns[$column] = $columns[$column];
|
966 |
+
}
|
967 |
+
}
|
968 |
+
|
969 |
+
return $pre_columns;
|
970 |
+
}
|
971 |
+
|
972 |
+
/**
|
973 |
+
* Set sortable columns
|
974 |
+
*
|
975 |
+
* @since 1.0
|
976 |
+
*/
|
977 |
+
private function set_sortable_filter($columns, $post_type)
|
978 |
+
{
|
979 |
+
$db_columns = $this->get_db_columns($post_type);
|
980 |
+
|
981 |
+
if ( !$db_columns )
|
982 |
+
return $columns;
|
983 |
+
|
984 |
+
// loop through columns
|
985 |
+
foreach ( $db_columns as $key => $values ) {
|
986 |
+
|
987 |
+
// is active
|
988 |
+
if ( isset($values['sortorder']) && $values['sortorder'] == 'on' ){
|
989 |
+
|
990 |
+
// register format
|
991 |
+
$columns[$key] = $this->sanitize_string($values['label']);
|
992 |
+
}
|
993 |
+
}
|
994 |
+
return $columns;
|
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;
|
1011 |
+
$org_current_screen = $current_screen;
|
1012 |
+
|
1013 |
+
// overwrite current_screen global with our post type of choose...
|
1014 |
+
$current_screen->post_type = $post_type;
|
1015 |
+
|
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 |
+
unset($columns['cb']);
|
1021 |
+
|
1022 |
+
// change to uniform format
|
1023 |
+
$uniform_columns = array();
|
1024 |
+
foreach ( $columns as $key => $label ) {
|
1025 |
+
$hide_options = false;
|
1026 |
+
$type_label = $label;
|
1027 |
+
|
1028 |
+
// comment exception
|
1029 |
+
if ( strpos( $label, 'comment-grey-bubble.png') ) {
|
1030 |
+
$type_label = __('Comments', $this->textdomain);
|
1031 |
+
$hide_options = true;
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
$uniform_colums[$key] = array(
|
1035 |
+
'label' => $label,
|
1036 |
+
'state' => 'on',
|
1037 |
+
'options' => array(
|
1038 |
+
'type_label' => $type_label,
|
1039 |
+
'hide_options' => $hide_options,
|
1040 |
+
'class' => 'cpac-box-wp-native',
|
1041 |
+
)
|
1042 |
+
);
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
// reset current screen
|
1046 |
+
$current_screen = $org_current_screen;
|
1047 |
+
|
1048 |
+
return $uniform_colums;
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
/**
|
1052 |
+
* Add extra columns
|
1053 |
+
*
|
1054 |
+
* @since 1.0
|
1055 |
+
*/
|
1056 |
+
private function get_custom_columns($post_type)
|
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'] = wp_parse_args( array(
|
1077 |
+
'label' => __('Featured Image', $this->textdomain),
|
1078 |
+
'options' => array(
|
1079 |
+
'type_label' => __('Image', $this->textdomain)
|
1080 |
+
)
|
1081 |
+
), $defaults);
|
1082 |
+
}
|
1083 |
+
|
1084 |
+
// Excerpt support
|
1085 |
+
if ( post_type_supports($post_type, 'editor') ) {
|
1086 |
+
$custom_columns['column-excerpt'] = wp_parse_args( array(
|
1087 |
+
'label' => __('Excerpt', $this->textdomain),
|
1088 |
+
'options' => array(
|
1089 |
+
'type_label' => __('Excerpt', $this->textdomain)
|
1090 |
+
)
|
1091 |
+
), $defaults);
|
1092 |
+
}
|
1093 |
+
|
1094 |
+
// Sticky support
|
1095 |
+
if ( $post_type == 'post' ) {
|
1096 |
+
$custom_columns['column-sticky'] = wp_parse_args( array(
|
1097 |
+
'label' => __('Sticky', $this->textdomain),
|
1098 |
+
'options' => array(
|
1099 |
+
'type_label' => __('Sticky', $this->textdomain)
|
1100 |
+
)
|
1101 |
+
), $defaults);
|
1102 |
+
}
|
1103 |
+
|
1104 |
+
// Order support
|
1105 |
+
if ( post_type_supports($post_type, 'page-attributes') ) {
|
1106 |
+
$custom_columns['column-order'] = wp_parse_args( array(
|
1107 |
+
'label' => __('Page Order', $this->textdomain),
|
1108 |
+
'sortorder' => 'on',
|
1109 |
+
'options' => array(
|
1110 |
+
'type_label' => __('Order', $this->textdomain)
|
1111 |
+
)
|
1112 |
+
), $defaults);
|
1113 |
+
}
|
1114 |
+
|
1115 |
+
// Page Template
|
1116 |
+
if ( $post_type == 'page' ) {
|
1117 |
+
$custom_columns['column-page-template'] = wp_parse_args( array(
|
1118 |
+
'label' => __('Page Template', $this->textdomain),
|
1119 |
+
'sortorder' => 'on',
|
1120 |
+
'options' => array(
|
1121 |
+
'type_label' => __('Page Template', $this->textdomain)
|
1122 |
+
)
|
1123 |
+
), $defaults);
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
// Post Formats
|
1127 |
+
if ( post_type_supports($post_type, 'post-formats') ) {
|
1128 |
+
$custom_columns['column-post_formats'] = wp_parse_args( array(
|
1129 |
+
'label' => __('Post Format', $this->textdomain),
|
1130 |
+
'options' => array(
|
1131 |
+
'type_label' => __('Post Format', $this->textdomain)
|
1132 |
+
)
|
1133 |
+
), $defaults);
|
1134 |
+
}
|
1135 |
+
|
1136 |
+
// Taxonomy support
|
1137 |
+
$taxonomies = get_object_taxonomies($post_type, 'objects');
|
1138 |
+
if ( $taxonomies ) {
|
1139 |
+
foreach ( $taxonomies as $tax_slug => $tax ) {
|
1140 |
+
if ( $tax_slug != 'post_tag' && $tax_slug != 'category' && $tax_slug != 'post_format' ) {
|
1141 |
+
$custom_columns['column-taxonomy-'.$tax->name] = wp_parse_args( array(
|
1142 |
+
'label' => $tax->label,
|
1143 |
+
'options' => array(
|
1144 |
+
'type_label' => __('Taxonomy', $this->textdomain)
|
1145 |
+
)
|
1146 |
+
), $defaults);
|
1147 |
+
}
|
1148 |
+
}
|
1149 |
+
}
|
1150 |
+
|
1151 |
+
// Post ID support
|
1152 |
+
$custom_columns['column-postid'] = wp_parse_args( array(
|
1153 |
+
'label' => 'ID',
|
1154 |
+
'sortorder' => 'on',
|
1155 |
+
'options' => array(
|
1156 |
+
'type_label' => 'ID',
|
1157 |
+
)
|
1158 |
+
), $defaults);
|
1159 |
+
|
1160 |
+
// Slug support
|
1161 |
+
$custom_columns['column-page-slug'] = wp_parse_args( array(
|
1162 |
+
'label' => __('Slug', $this->textdomain),
|
1163 |
+
'sortorder' => 'on',
|
1164 |
+
'options' => array(
|
1165 |
+
'type_label' => __('Slug', $this->textdomain),
|
1166 |
+
)
|
1167 |
+
), $defaults);
|
1168 |
+
|
1169 |
+
// Attachment support
|
1170 |
+
$custom_columns['column-attachment'] = wp_parse_args( array(
|
1171 |
+
'label' => __('Attachment', $this->textdomain),
|
1172 |
+
'sortorder' => 'on',
|
1173 |
+
'options' => array(
|
1174 |
+
'type_label' => __('Attachment', $this->textdomain)
|
1175 |
+
)
|
1176 |
+
), $defaults);
|
1177 |
+
|
1178 |
+
// Custom Field support
|
1179 |
+
if ( $this->get_postmeta_by_posttype($post_type) ) {
|
1180 |
+
$custom_columns['column-meta-1'] = wp_parse_args( array(
|
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 apply_filters('cpac-custom-columns', $custom_columns);
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
/**
|
1195 |
+
* Admin requests for orderby column
|
1196 |
+
*
|
1197 |
+
* @since 1.0
|
1198 |
+
*/
|
1199 |
+
private function get_db_columns($post_type)
|
1200 |
+
{
|
1201 |
+
// get plugin options
|
1202 |
+
$options = $this->options;
|
1203 |
+
|
1204 |
+
// get saved columns
|
1205 |
+
if ( isset($options['columns'][$post_type]) )
|
1206 |
+
return $options['columns'][$post_type];
|
1207 |
+
|
1208 |
+
return false;
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
/**
|
1212 |
+
* Post Type Menu
|
1213 |
+
*
|
1214 |
+
* @since 1.0
|
1215 |
+
*/
|
1216 |
+
private function get_post_type_menu()
|
1217 |
+
{
|
1218 |
+
// set
|
1219 |
+
$menu = '';
|
1220 |
+
$count = 1;
|
1221 |
+
|
1222 |
+
// referer
|
1223 |
+
$referer = '';
|
1224 |
+
if ( isset($_REQUEST['cpac_type']) && $_REQUEST['cpac_type'] )
|
1225 |
+
$referer = $_REQUEST['cpac_type'];
|
1226 |
+
|
1227 |
+
// loop
|
1228 |
+
foreach ( $this->post_types as $post_type ) {
|
1229 |
+
$label = $this->get_singular_name($post_type);
|
1230 |
+
$clean_label = $this->sanitize_string($post_type);
|
1231 |
+
|
1232 |
+
// divider
|
1233 |
+
$divider = $count++ == 1 ? '' : ' | ';
|
1234 |
+
|
1235 |
+
// current
|
1236 |
+
$current = '';
|
1237 |
+
if ( $this->is_menu_type_current($post_type) )
|
1238 |
+
$current = ' class="current"';
|
1239 |
+
|
1240 |
+
// menu list
|
1241 |
+
$menu .= "
|
1242 |
+
<li>{$divider}<a{$current} href='#cpac-box-{$clean_label}'>{$label}</a></li>
|
1243 |
+
";
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
return "
|
1247 |
+
<div class='cpac-menu'>
|
1248 |
+
<ul class='subsubsub'>
|
1249 |
+
{$menu}
|
1250 |
+
</ul>
|
1251 |
+
</div>
|
1252 |
+
";
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
/**
|
1256 |
+
* Checks if menu type is currently viewed
|
1257 |
+
*
|
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']) )
|
1267 |
+
$referer = $_REQUEST['cpac_type'];
|
1268 |
+
|
1269 |
+
// get label
|
1270 |
+
$label = $this->get_singular_name($post_type);
|
1271 |
+
$clean_label = $this->sanitize_string($post_type);
|
1272 |
+
|
1273 |
+
// get first element from post-types
|
1274 |
+
$first = array_shift(array_values($this->post_types));
|
1275 |
+
|
1276 |
+
// display the page that was being viewed before saving
|
1277 |
+
if ( $referer ) {
|
1278 |
+
if ( $referer == 'cpac-box-'.$clean_label ) {
|
1279 |
+
return true;
|
1280 |
+
}
|
1281 |
+
|
1282 |
+
// settings page has not yet been saved
|
1283 |
+
} elseif ( $first == $post_type ) {
|
1284 |
+
return true;
|
1285 |
+
}
|
1286 |
+
|
1287 |
+
return false;
|
1288 |
+
}
|
1289 |
+
|
1290 |
+
/**
|
1291 |
+
* Get singular name of post type
|
1292 |
+
*
|
1293 |
+
* @since 1.0
|
1294 |
+
*/
|
1295 |
+
private function get_singular_name( $post_type )
|
1296 |
+
{
|
1297 |
+
$posttype_obj = get_post_type_object($post_type);
|
1298 |
+
$label = $posttype_obj->labels->singular_name;
|
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 |
+
*
|
1331 |
+
* Uses intern wordpress function esc_url so it matches the label sorting url.
|
1332 |
+
*
|
1333 |
+
* @since 1.0
|
1334 |
+
*/
|
1335 |
+
private function sanitize_string($string)
|
1336 |
+
{
|
1337 |
+
$string = esc_url($string);
|
1338 |
+
return str_replace('http://','', $string);
|
1339 |
+
}
|
1340 |
+
|
1341 |
+
/**
|
1342 |
+
* Get a url to a file in this plugin.
|
1343 |
+
*
|
1344 |
+
* @since 1.0
|
1345 |
+
*/
|
1346 |
+
private function plugin_url( $file = '' )
|
1347 |
+
{
|
1348 |
+
return plugins_url($file, __FILE__);
|
1349 |
+
}
|
1350 |
+
|
1351 |
+
/**
|
1352 |
+
* Get a thumbnail
|
1353 |
+
*
|
1354 |
+
* @since 1.0
|
1355 |
+
*/
|
1356 |
+
private function get_thumbnail( $image = '' )
|
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 |
+
if ( ! is_wp_error( $new ) )
|
1365 |
+
$image = str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, $new);
|
1366 |
+
|
1367 |
+
return "<img src='{$image}' alt='' width='120' height='80' />";
|
1368 |
+
}
|
1369 |
+
}
|
1370 |
+
?>
|
languages/codepress-admin-columns-nl_NL.mo
ADDED
Binary file
|
languages/codepress-admin-columns-nl_NL.po
ADDED
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Codepress Admin Columns\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-11-26 23:47+0100\n"
|
6 |
+
"PO-Revision-Date: 2011-11-26 23:47+0100\n"
|
7 |
+
"Last-Translator: Tobias <tschutter@gmail.com>\n"
|
8 |
+
"Language-Team: Codepress <info@codepress.nl>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-Language: Dutch\n"
|
15 |
+
"X-Poedit-Country: NETHERLANDS\n"
|
16 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
17 |
+
"X-Poedit-SearchPath-0: .\n"
|
18 |
+
"X-Poedit-SearchPath-1: ..\n"
|
19 |
+
|
20 |
+
#: ../codepress-admin-columns.php:132
|
21 |
+
msgid "Settings"
|
22 |
+
msgstr "Instellingen"
|
23 |
+
|
24 |
+
#: ../codepress-admin-columns.php:225
|
25 |
+
msgid "Codepress Admin Columns"
|
26 |
+
msgstr ""
|
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:483
|
71 |
+
msgid "Default"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: ../codepress-admin-columns.php:484
|
75 |
+
#: ../codepress-admin-columns.php:1079
|
76 |
+
msgid "Image"
|
77 |
+
msgstr "Afbeelding"
|
78 |
+
|
79 |
+
#: ../codepress-admin-columns.php:485
|
80 |
+
msgid "Media Library Icon"
|
81 |
+
msgstr "Media bibliotheek Icoon"
|
82 |
+
|
83 |
+
#: ../codepress-admin-columns.php:486
|
84 |
+
#: ../codepress-admin-columns.php:1087
|
85 |
+
#: ../codepress-admin-columns.php:1089
|
86 |
+
msgid "Excerpt"
|
87 |
+
msgstr "Samenvatting"
|
88 |
+
|
89 |
+
#: ../codepress-admin-columns.php:487
|
90 |
+
msgid "Multiple Values"
|
91 |
+
msgstr "Meerdere waarden"
|
92 |
+
|
93 |
+
#: ../codepress-admin-columns.php:506
|
94 |
+
msgid "This field can not be removed"
|
95 |
+
msgstr "Dit veld kan niet worden verwijderd"
|
96 |
+
|
97 |
+
#: ../codepress-admin-columns.php:510
|
98 |
+
msgid "Remove"
|
99 |
+
msgstr "Verwijder"
|
100 |
+
|
101 |
+
#: ../codepress-admin-columns.php:796
|
102 |
+
msgid "Standard"
|
103 |
+
msgstr "Standaard"
|
104 |
+
|
105 |
+
#: ../codepress-admin-columns.php:1030
|
106 |
+
msgid "Comments"
|
107 |
+
msgstr "Reacties"
|
108 |
+
|
109 |
+
#: ../codepress-admin-columns.php:1068
|
110 |
+
msgid "Custom"
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#: ../codepress-admin-columns.php:1077
|
114 |
+
msgid "Featured Image"
|
115 |
+
msgstr "Uitgelichte afbeelding"
|
116 |
+
|
117 |
+
#: ../codepress-admin-columns.php:1097
|
118 |
+
#: ../codepress-admin-columns.php:1099
|
119 |
+
msgid "Sticky"
|
120 |
+
msgstr "Sticky"
|
121 |
+
|
122 |
+
#: ../codepress-admin-columns.php:1107
|
123 |
+
msgid "Page Order"
|
124 |
+
msgstr "Pagina Volgorde"
|
125 |
+
|
126 |
+
#: ../codepress-admin-columns.php:1110
|
127 |
+
msgid "Order"
|
128 |
+
msgstr "Volgorde"
|
129 |
+
|
130 |
+
#: ../codepress-admin-columns.php:1118
|
131 |
+
#: ../codepress-admin-columns.php:1121
|
132 |
+
msgid "Page Template"
|
133 |
+
msgstr "Pagina Template"
|
134 |
+
|
135 |
+
#: ../codepress-admin-columns.php:1129
|
136 |
+
#: ../codepress-admin-columns.php:1131
|
137 |
+
msgid "Post Format"
|
138 |
+
msgstr ""
|
139 |
+
|
140 |
+
#: ../codepress-admin-columns.php:1144
|
141 |
+
msgid "Taxonomy"
|
142 |
+
msgstr ""
|
143 |
+
|
144 |
+
#: ../codepress-admin-columns.php:1162
|
145 |
+
#: ../codepress-admin-columns.php:1165
|
146 |
+
msgid "Slug"
|
147 |
+
msgstr ""
|
148 |
+
|
149 |
+
#: ../codepress-admin-columns.php:1171
|
150 |
+
#: ../codepress-admin-columns.php:1174
|
151 |
+
msgid "Attachment"
|
152 |
+
msgstr ""
|
153 |
+
|
154 |
+
#: ../codepress-admin-columns.php:1181
|
155 |
+
msgid "Custom Field"
|
156 |
+
msgstr ""
|
157 |
+
|
158 |
+
#: ../codepress-admin-columns.php:1185
|
159 |
+
msgid "Field"
|
160 |
+
msgstr "Veld"
|
161 |
+
|
162 |
+
#~ msgid "Title"
|
163 |
+
#~ msgstr "Titel"
|
164 |
+
|
165 |
+
#~ msgid "Description"
|
166 |
+
#~ msgstr "Beschrijving"
|
167 |
+
|
168 |
+
#~ msgid "Latitude"
|
169 |
+
#~ msgstr "Breedtegraad"
|
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 |
+
#~ msgid "Search"
|
265 |
+
#~ msgstr "Zoeken"
|
266 |
+
|
267 |
+
#~ msgid "Click to toggle"
|
268 |
+
#~ msgstr "Klik om te wisselen"
|
269 |
+
|
270 |
+
#~ msgid "Donate $10, $20 or $50!"
|
271 |
+
#~ msgstr "Doneer $10, $20 of $50!"
|
272 |
+
|
273 |
+
#~ msgid ""
|
274 |
+
#~ "This plugin has cost us countless hours of work, if you use it, please "
|
275 |
+
#~ "donate a token of your appreciation!"
|
276 |
+
#~ msgstr ""
|
277 |
+
#~ "Het ons veel uren werken gekost om deze plugin te ontwikkelen, als je het "
|
278 |
+
#~ "gebruikt, doneer a.u.b. voor je waardering!"
|
279 |
+
|
280 |
+
#~ msgid "Latest news from Pronamic"
|
281 |
+
#~ msgstr "Laatste nieuws van Pronamic"
|
282 |
+
|
283 |
+
#~ msgid "no news items, feed might be broken..."
|
284 |
+
#~ msgstr "geen nieuws items, feed is waarschijnlijk niet bereikbaar..."
|
285 |
+
|
286 |
+
#~ msgid "Subscribe with RSS"
|
287 |
+
#~ msgstr "Aanmelden voor RSS"
|
288 |
+
|
289 |
+
#~ msgid "Subscribe by e-mail"
|
290 |
+
#~ msgstr "Aanmelden via e-mail"
|
291 |
+
|
292 |
+
#~ msgid "Why not do any or all of the following:"
|
293 |
+
#~ msgstr "Waarom doe je niet één van de volgende dingen:"
|
294 |
+
|
295 |
+
#~ msgid "Link to it so other folks can find out about it."
|
296 |
+
#~ msgstr "Link naar ons zodat anderen deze plugin ook ontdekken."
|
297 |
+
|
298 |
+
#~ msgid "Give it a good rating on WordPress.org."
|
299 |
+
#~ msgstr "Geef het een goede score op WordPress.org."
|
300 |
+
|
301 |
+
#~ msgid "Let other people know that it works with your WordPress setup."
|
302 |
+
#~ msgstr "Laat anderen weten dat het werk op je WordPress installatie."
|
303 |
+
|
304 |
+
#~ msgid "Found a bug?"
|
305 |
+
#~ msgstr "Bug gevonden?"
|
306 |
+
|
307 |
+
#~ msgid "Configuration"
|
308 |
+
#~ msgstr "Configuratie"
|
readme.txt
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.2.1
|
6 |
+
Stable tag: 1.0.1
|
7 |
+
|
8 |
+
== Description ==
|
9 |
+
|
10 |
+
This plugin makes it easy to customize Admin Columns for your Posts, Pages and Custom Post Type Screens.
|
11 |
+
|
12 |
+
= Intro =
|
13 |
+
|
14 |
+
This plugin let's you visually customize the Admin Columns. You can add or remove columns, change their label and reorder them.
|
15 |
+
|
16 |
+
= Custom Columns =
|
17 |
+
|
18 |
+
The following custom columns are supported:
|
19 |
+
|
20 |
+
* Featured Image
|
21 |
+
* Excerpt
|
22 |
+
* Post Attachments
|
23 |
+
* Page Order
|
24 |
+
* Page Templates
|
25 |
+
* Post Formats
|
26 |
+
* Taxonomies
|
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 will show the value as a default. You can also set your own type:
|
35 |
+
|
36 |
+
* Icons for Media Library items
|
37 |
+
* Image thumbnails
|
38 |
+
* Excerpt
|
39 |
+
* Multiple Values
|
40 |
+
|
41 |
+
= Sortable Admin Columns =
|
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 |
+
|
45 |
+
* ID
|
46 |
+
* page order
|
47 |
+
* slug
|
48 |
+
* page template
|
49 |
+
|
50 |
+
I will be adding more in coming releases. You can leave any <a href='http://www.codepress.nl/plugins/codepress-admin-columns/#feedback'>requests or feedback</a>.
|
51 |
+
|
52 |
+
**Related Links:**
|
53 |
+
|
54 |
+
* http://www.codepress.nl/plugins/codepress-admin-columns/
|
55 |
+
|
56 |
+
== Installation ==
|
57 |
+
|
58 |
+
1. Upload codepress-admin-columns to the /wp-content/plugins/ directory
|
59 |
+
2. Activate Codepress Admin Columns through the 'Plugins' menu in WordPress
|
60 |
+
3. Configure the plugin by going to the Admin Column settings that appears under the Settings menu.
|
61 |
+
|
62 |
+
|
63 |
+
== Frequently Asked Questions ==
|
64 |
+
|
65 |
+
= I have an idea for a great way to improve this plugin =
|
66 |
+
|
67 |
+
Great! I'd love to hear from you.
|
68 |
+
Leave your feedback at http://www.codepress.nl/plugins/codepress-admin-columns#feedback.
|
69 |
+
|
70 |
+
== Screenshots ==
|
71 |
+
|
72 |
+
1. Settings page of the Codepress Admin columns plugin.
|
73 |
+
2. Options for the Custom Field Column.
|
74 |
+
3. Posts Screen with custom columns.
|
75 |
+
|
76 |
+
== Changelog ==
|
77 |
+
|
78 |
+
= 1.0.1 =
|
79 |
+
|
80 |
+
Settings link corrected
|
81 |
+
|
82 |
+
= 1.0 =
|
83 |
+
|
84 |
+
* Initial release.
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|
screenshot-3.png
ADDED
Binary file
|