Admin Columns - Version 1.3.1

Version Description

  • bug fix which solved a fatal error in some cases
Download this release

Release Info

Developer codepress
Plugin Icon 128x128 Admin Columns
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.0 to 1.3.1

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