Version Description
- Added User Columns.
- Added before / after text for custom fields
- Added custom field type 'Numeric'.
- Added custom field sortables.
- Fixed domain path
- Fixed settings link
Download this release
Release Info
Developer | codepress |
Plugin | ![]() |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.1
- codepress-admin-columns.php +638 -339
- languages/codepress-admin-columns-nl_NL.mo +0 -0
- languages/codepress-admin-columns-nl_NL.po +2 -149
- readme.txt +32 -10
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
codepress-admin-columns.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
Â
<?php
|
2 |
Â
/*
|
3 |
Â
Plugin Name: Codepress Admin Columns
|
4 |
-
Version: 1.
|
5 |
-
Description: This plugin makes it easy to
|
6 |
-
Author:
|
7 |
Â
Author URI: http://www.codepress.nl
|
8 |
Â
Plugin URI: http://www.codepress.nl/plugins/codepress-admin-columns/
|
9 |
Â
Text Domain: codepress-admin-columns
|
@@ -26,7 +26,7 @@ along with this program; if not, write to the Free Software
|
|
26 |
Â
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
Â
*/
|
28 |
Â
|
29 |
-
define( 'CPAC_VERSION', '1.
|
30 |
Â
|
31 |
Â
/**
|
32 |
Â
* Init Class
|
@@ -73,7 +73,7 @@ class Codepress_Admin_Columns
|
|
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';
|
@@ -81,14 +81,15 @@ class Codepress_Admin_Columns
|
|
81 |
Â
// translations
|
82 |
Â
load_plugin_textdomain( $this->textdomain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
83 |
Â
|
84 |
-
//
|
85 |
Â
add_action( 'admin_menu', array( &$this, 'settings_menu') );
|
86 |
Â
add_action( 'admin_init', array( &$this, 'register_settings') );
|
87 |
Â
add_action( 'admin_init', array( &$this, 'register_columns' ) );
|
88 |
Â
add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts') );
|
89 |
-
add_action( 'manage_pages_custom_column', array( &$this, '
|
90 |
-
add_action( 'manage_posts_custom_column', array( &$this, '
|
91 |
-
add_action( '
|
Â
|
|
92 |
Â
add_filter( 'request', array( &$this, 'handle_requests_orderby_column') );
|
93 |
Â
add_filter( 'plugin_action_links', array( &$this, 'add_settings_link'), 10, 2);
|
94 |
Â
}
|
@@ -140,187 +141,142 @@ 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, '
|
147 |
Â
|
148 |
Â
// register column as sortable
|
149 |
-
add_filter( "manage_edit-{$post_type}_sortable_columns", array(&$this, '
|
150 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
151 |
Â
}
|
152 |
Â
|
153 |
Â
/**
|
154 |
-
* Callback
|
155 |
Â
*
|
156 |
Â
* @since 1.0
|
157 |
Â
*/
|
158 |
-
public function
|
159 |
Â
{
|
160 |
Â
global $post_type;
|
161 |
-
$columns = $this->set_column($columns, $post_type);
|
162 |
Â
|
163 |
-
return $columns;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
164 |
Â
}
|
165 |
Â
|
166 |
Â
/**
|
167 |
-
*
|
168 |
Â
*
|
169 |
-
* @since 1.
|
170 |
Â
*/
|
171 |
-
|
172 |
Â
{
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
177 |
Â
}
|
178 |
Â
|
179 |
Â
/**
|
180 |
-
*
|
181 |
Â
*
|
182 |
-
*
|
183 |
-
|
184 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
185 |
Â
*
|
186 |
-
*
|
187 |
Â
*/
|
188 |
-
public function
|
189 |
Â
{
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
$boxes = $this->get_column_options($post_type);
|
202 |
-
|
203 |
-
// class
|
204 |
-
$class = $this->is_menu_type_current($post_type) ? ' current' : ' hidden';
|
205 |
Â
|
206 |
-
|
207 |
-
|
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 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
<div id="general-cpac-settings" class="postbox">
|
232 |
-
<div title="Click to toggle" class="handlediv"><br></div>
|
233 |
-
<h3 class="hndle">
|
234 |
-
<span><?php _e('Admin Columns', $this->textdomain ); ?></span>
|
235 |
-
</h3>
|
236 |
-
<div class="inside">
|
237 |
-
<form method="post" action="options.php">
|
238 |
-
|
239 |
-
<?php settings_fields( 'cpac-settings-group' ); ?>
|
240 |
-
|
241 |
-
<table class="form-table">
|
242 |
-
|
243 |
-
<?php echo $rows ?>
|
244 |
-
|
245 |
-
<tr class="bottom" valign="top">
|
246 |
-
<th scope="row"></th>
|
247 |
-
<td>
|
248 |
-
<p class="submit">
|
249 |
-
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
250 |
-
</p>
|
251 |
-
</td>
|
252 |
-
</tr>
|
253 |
-
</table>
|
254 |
-
</form>
|
255 |
-
</div>
|
256 |
-
</div><!-- general-settings -->
|
257 |
-
|
258 |
-
<div id="restore-cpac-settings" class="postbox">
|
259 |
-
<div title="Click to toggle" class="handlediv"><br></div>
|
260 |
-
<h3 class="hndle">
|
261 |
-
<span><?php _e('Restore defaults', $this->textdomain) ?></span>
|
262 |
-
</h3>
|
263 |
-
<div class="inside">
|
264 |
-
<form method="post" action="">
|
265 |
-
<input type="submit" class="button" name="cpac-restore-defaults" value="<?php _e('Restore default settings', $this->textdomain ) ?>" onclick="return confirm('<?php _e("Warning! ALL saved admin columns data will be deleted. This cannot be undone. \'OK\' to delete, \'Cancel\' to stop", $this->textdomain); ?>');" />
|
266 |
-
</form>
|
267 |
-
<p class="description"><?php _e('This will delete all column settings and restore the default settings.', $this->textdomain); ?></p>
|
268 |
-
</div>
|
269 |
-
</div><!-- restore-cpac-settings -->
|
270 |
-
|
271 |
-
</div>
|
272 |
-
</div>
|
273 |
-
</div><!-- .postbox-container -->
|
274 |
-
|
275 |
-
<div class="postbox-container" style="width:20%;">
|
276 |
-
<div class="metabox-holder">
|
277 |
-
<div class="meta-box-sortables">
|
278 |
-
|
279 |
-
<div id="side-cpac-settings" class="postbox">
|
280 |
-
<div title="Click to toggle" class="handlediv"><br></div>
|
281 |
-
<h3 class="hndle">
|
282 |
-
<span><?php _e('Need support?', $this->textdomain) ?></span>
|
283 |
-
</h3>
|
284 |
-
<div class="inside">
|
285 |
-
<p><?php printf(__('If you are having problems with this plugin, please talk about them in the <a href="%s">Support forums</a>.', $this->textdomain), 'http://wordpress.org/tags/codepress-admin-columns' );?></p>
|
286 |
-
<p><?php printf(__("If you're sure you've found a bug, or have a feature request, please <a href='%s'>submit your feedback</a>.", $this->textdomain), 'http://www.codepress.nl/plugins/codepress-admin-columns#feedback');?></p>
|
287 |
-
</div>
|
288 |
-
</div><!-- side-cpac-settings -->
|
289 |
-
|
290 |
-
</div>
|
291 |
-
</div>
|
292 |
-
</div><!-- .postbox-container -->
|
293 |
-
|
294 |
-
</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
|
304 |
Â
{
|
305 |
Â
// merge all columns
|
306 |
-
$display_columns = $this->get_merged_columns($
|
307 |
Â
|
308 |
Â
// define
|
309 |
Â
$list = '';
|
310 |
Â
|
311 |
Â
// loop throught the active columns
|
312 |
Â
if ( $display_columns ) {
|
313 |
-
foreach ( $display_columns as $
|
314 |
Â
|
315 |
Â
// add items to the list
|
316 |
-
$list .= $this->get_box($
|
317 |
Â
|
318 |
Â
}
|
319 |
Â
}
|
320 |
Â
|
321 |
Â
// custom field button
|
322 |
Â
$button_add_column = '';
|
323 |
-
if ( $this->get_postmeta_by_posttype($
|
324 |
Â
$button_add_column = "<a href='javacript:;' class='cpac-add-customfield-column button'>+ " . __('Add Custom Field Column') . "</a>";
|
325 |
Â
|
326 |
Â
return "
|
@@ -339,60 +295,62 @@ class Codepress_Admin_Columns
|
|
339 |
Â
*
|
340 |
Â
* @since 1.0
|
341 |
Â
*/
|
342 |
-
private function get_merged_columns($
|
343 |
Â
{
|
344 |
Â
//get saved database columns
|
345 |
-
$db_columns = $this->
|
346 |
-
|
347 |
-
// get wp default columns
|
348 |
-
$wp_default_columns = $this->get_wp_default_columns($post_type);
|
349 |
Â
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
356 |
Â
// loop throught the active columns
|
357 |
Â
if ( $db_columns ) {
|
358 |
-
foreach ( $db_columns as $
|
359 |
Â
|
360 |
Â
// get column meta options from custom columns
|
361 |
-
if (
|
362 |
-
$db_columns[$
|
363 |
Â
|
364 |
Â
// add static options
|
365 |
Â
else
|
366 |
-
$db_columns[$
|
367 |
Â
|
368 |
-
unset($
|
369 |
Â
}
|
370 |
Â
}
|
371 |
Â
|
372 |
Â
// merge all
|
373 |
-
$display_columns = wp_parse_args($db_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, $
|
385 |
Â
{
|
386 |
Â
$classes = array();
|
387 |
Â
|
388 |
Â
// set state
|
389 |
Â
$state = isset($values['state']) ? $values['state'] : '';
|
390 |
Â
|
391 |
-
// set sortorder
|
392 |
-
$sortorder = isset($values['sortorder']) && $values['sortorder'] == 'on' ? 'on' : '';
|
393 |
-
|
394 |
Â
// class
|
395 |
-
$classes[] = "cpac-box-{$
|
396 |
Â
if ( $state )
|
397 |
Â
$classes[] = 'active';
|
398 |
Â
if ( ! empty($values['options']['class']) )
|
@@ -400,7 +358,7 @@ class Codepress_Admin_Columns
|
|
400 |
Â
$class = implode(' ', $classes);
|
401 |
Â
|
402 |
Â
// more box options
|
403 |
-
$more_options = $this->get_additional_box_options($post_type, $
|
404 |
Â
$action = "<a class='cpac-action' href='#open'>open</a>";
|
405 |
Â
|
406 |
Â
// hide box options
|
@@ -414,8 +372,7 @@ 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}][{$
|
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'>
|
@@ -423,8 +380,8 @@ class Codepress_Admin_Columns
|
|
423 |
Â
<span>{$values['options']['type_label']}</span>
|
424 |
Â
</div>
|
425 |
Â
<div class='cpac-type-inside'>
|
426 |
-
<label for='cpac_options[columns][{$post_type}][{$
|
427 |
-
<input type='text' name='cpac_options[columns][{$post_type}][{$
|
428 |
Â
<br/>
|
429 |
Â
{$more_options}
|
430 |
Â
</div>
|
@@ -439,13 +396,13 @@ class Codepress_Admin_Columns
|
|
439 |
Â
*
|
440 |
Â
* @since 1.0
|
441 |
Â
*/
|
442 |
-
private function get_additional_box_options($post_type, $
|
443 |
Â
{
|
444 |
Â
$fields = '';
|
445 |
Â
|
446 |
Â
// Custom Fields
|
447 |
-
if (
|
448 |
-
$fields .= $this->get_box_options_customfields($post_type, $
|
449 |
Â
|
450 |
Â
return $fields;
|
451 |
Â
}
|
@@ -455,7 +412,7 @@ class Codepress_Admin_Columns
|
|
455 |
Â
*
|
456 |
Â
* @since 1.0
|
457 |
Â
*/
|
458 |
-
private function get_box_options_customfields($post_type, $
|
459 |
Â
{
|
460 |
Â
// get post meta fields
|
461 |
Â
$fields = $this->get_postmeta_by_posttype($post_type);
|
@@ -485,10 +442,13 @@ class Codepress_Admin_Columns
|
|
485 |
Â
'library_id' => __('Media Library Icon', $this->textdomain),
|
486 |
Â
'excerpt' => __('Excerpt'),
|
487 |
Â
'array' => __('Multiple Values', $this->textdomain),
|
Â
|
|
488 |
Â
);
|
489 |
Â
|
490 |
-
// add
|
491 |
-
$fieldtypes = apply_filters('cpac-field-types', $fieldtypes );
|
Â
|
|
Â
|
|
492 |
Â
foreach ( $fieldtypes as $fkey => $fieldtype ) {
|
493 |
Â
$fieldtype_options .= sprintf
|
494 |
Â
(
|
@@ -499,12 +459,16 @@ class Codepress_Admin_Columns
|
|
499 |
Â
);
|
500 |
Â
}
|
501 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
502 |
Â
if ( empty($field_options) )
|
503 |
Â
return false;
|
504 |
Â
|
505 |
Â
// add remove button
|
506 |
Â
$remove = '<p class="remove-description description">'.__('This field can not be removed', $this->textdomain).'</p>';
|
507 |
-
if ( $
|
508 |
Â
$remove = "
|
509 |
Â
<p>
|
510 |
Â
<a href='javascript:;' class='cpac-delete-custom-field-box'>".__('Remove')."</a>
|
@@ -513,12 +477,18 @@ class Codepress_Admin_Columns
|
|
513 |
Â
}
|
514 |
Â
|
515 |
Â
$inside = "
|
516 |
-
<label for='cpac_options[columns][{$post_type}][{$
|
517 |
-
<select name='cpac_options[columns][{$post_type}][{$
|
518 |
Â
<br/>
|
519 |
-
<label for='cpac_options[columns][{$post_type}][{$
|
520 |
-
<select name='cpac_options[columns][{$post_type}][{$
|
521 |
Â
<br/>
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
522 |
Â
{$remove}
|
523 |
Â
";
|
524 |
Â
|
@@ -564,7 +534,20 @@ class Codepress_Admin_Columns
|
|
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 |
Â
*
|
@@ -651,9 +634,15 @@ class Codepress_Admin_Columns
|
|
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->
|
656 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
657 |
Â
update_option( 'cpac_options_default', $wp_default_columns );
|
658 |
Â
}
|
659 |
Â
|
@@ -720,20 +709,20 @@ class Codepress_Admin_Columns
|
|
720 |
Â
*
|
721 |
Â
* @since 1.0
|
722 |
Â
*/
|
723 |
-
public function
|
724 |
Â
{
|
725 |
-
$type = $
|
726 |
Â
|
727 |
Â
// Check for taxonomies, such as column-taxonomy-[taxname]
|
728 |
Â
if ( strpos($type, 'column-taxonomy-') !== false )
|
729 |
Â
$type = 'column-taxonomy';
|
730 |
Â
|
731 |
Â
// Check for custom fields, such as column-meta-[customfieldname]
|
732 |
-
if (
|
733 |
Â
$type = 'column-meta';
|
734 |
Â
|
735 |
Â
// Hook
|
736 |
-
do_action('cpac-manage-column', $type, $
|
737 |
Â
|
738 |
Â
// Switch Types
|
739 |
Â
$result = '';
|
@@ -787,9 +776,14 @@ class Codepress_Admin_Columns
|
|
787 |
Â
$result = get_post($post_id)->post_name;
|
788 |
Â
break;
|
789 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
790 |
Â
// Taxonomy
|
791 |
Â
case "column-taxonomy" :
|
792 |
-
$tax = str_replace('column-taxonomy-',''
|
793 |
Â
$tags = get_the_terms($post_id, $tax);
|
794 |
Â
$tarr = array();
|
795 |
Â
if ( $tax == 'post_format' && empty($tags) ) {
|
@@ -805,7 +799,7 @@ class Codepress_Admin_Columns
|
|
805 |
Â
|
806 |
Â
// Custom Field
|
807 |
Â
case "column-meta" :
|
808 |
-
$result = $this->get_column_value_custom_field($post_id, $
|
809 |
Â
break;
|
810 |
Â
|
811 |
Â
// Attachment
|
@@ -814,7 +808,7 @@ class Codepress_Admin_Columns
|
|
814 |
Â
break;
|
815 |
Â
|
816 |
Â
default :
|
817 |
-
$result = get_post_meta( $post_id, $
|
818 |
Â
|
819 |
Â
endswitch;
|
820 |
Â
|
@@ -823,13 +817,66 @@ 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(
|
@@ -851,11 +898,15 @@ class Codepress_Admin_Columns
|
|
851 |
Â
*
|
852 |
Â
* @since 1.0
|
853 |
Â
*/
|
854 |
-
private function get_column_value_custom_field($post_id, $
|
855 |
Â
{
|
856 |
-
$columns = $this->
|
857 |
-
|
858 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
859 |
Â
|
860 |
Â
// Get meta field value
|
861 |
Â
$meta = get_post_meta($post_id, $field, true);
|
@@ -891,6 +942,9 @@ class Codepress_Admin_Columns
|
|
891 |
Â
|
892 |
Â
endswitch;
|
893 |
Â
|
Â
|
|
Â
|
|
Â
|
|
894 |
Â
return $meta;
|
895 |
Â
}
|
896 |
Â
|
@@ -909,43 +963,18 @@ class Codepress_Admin_Columns
|
|
909 |
Â
$retVal[] = $r_pieces;
|
910 |
Â
}
|
911 |
Â
}
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
/**
|
916 |
-
* Set Columns for Registering
|
917 |
-
*
|
918 |
-
* @since 1.0
|
919 |
-
*/
|
920 |
-
private function set_column($columns, $post_type)
|
921 |
-
{
|
922 |
-
$db_columns = $this->get_db_columns($post_type);
|
923 |
Â
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
// set already loaded columns by plugins
|
928 |
-
$set_columns = $this->filter_preset_columns($columns, $post_type);
|
929 |
-
|
930 |
-
// loop through columns
|
931 |
-
foreach ( $db_columns as $key => $values ) {
|
932 |
-
|
933 |
-
// is active
|
934 |
-
if ( isset($values['state']) && $values['state'] == 'on' ){
|
935 |
-
|
936 |
-
// register format
|
937 |
-
$set_columns[$key] = $values['label'];
|
938 |
-
}
|
939 |
-
}
|
940 |
-
return $set_columns;
|
941 |
-
}
|
942 |
Â
|
943 |
Â
/**
|
944 |
Â
* Set columns. These columns apply either for every post or set by a plugin.
|
945 |
Â
*
|
946 |
Â
* @since 1.0
|
947 |
Â
*/
|
948 |
-
private function filter_preset_columns($columns, $
|
949 |
Â
{
|
950 |
Â
$options = $this->options_default;
|
951 |
Â
|
@@ -953,7 +982,7 @@ class Codepress_Admin_Columns
|
|
953 |
Â
return $columns;
|
954 |
Â
|
955 |
Â
// we use the wp default columns for filtering...
|
956 |
-
$db_columns = $options[$
|
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));
|
@@ -967,44 +996,19 @@ class Codepress_Admin_Columns
|
|
967 |
Â
}
|
968 |
Â
|
969 |
Â
return $pre_columns;
|
970 |
-
}
|
971 |
Â
|
972 |
Â
/**
|
973 |
-
*
|
974 |
Â
*
|
975 |
Â
* @since 1.0
|
976 |
Â
*/
|
977 |
-
private function
|
978 |
Â
{
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
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 +1020,53 @@ 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 $
|
1025 |
Â
$hide_options = false;
|
1026 |
Â
$type_label = $label;
|
1027 |
Â
|
@@ -1030,8 +1075,8 @@ class Codepress_Admin_Columns
|
|
1030 |
Â
$type_label = __('Comments', $this->textdomain);
|
1031 |
Â
$hide_options = true;
|
1032 |
Â
}
|
1033 |
-
|
1034 |
-
$uniform_colums[$
|
1035 |
Â
'label' => $label,
|
1036 |
Â
'state' => 'on',
|
1037 |
Â
'options' => array(
|
@@ -1041,96 +1086,78 @@ class Codepress_Admin_Columns
|
|
1041 |
Â
)
|
1042 |
Â
);
|
1043 |
Â
}
|
1044 |
-
|
1045 |
-
// reset current screen
|
1046 |
-
$current_screen = $org_current_screen;
|
1047 |
-
|
1048 |
Â
return $uniform_colums;
|
1049 |
Â
}
|
1050 |
-
|
1051 |
Â
/**
|
1052 |
-
*
|
1053 |
Â
*
|
1054 |
Â
* @since 1.0
|
1055 |
Â
*/
|
1056 |
-
private function
|
1057 |
Â
{
|
1058 |
Â
$custom_columns = array();
|
1059 |
Â
|
1060 |
-
// default arguments
|
1061 |
-
$defaults = array(
|
1062 |
-
'label' => '',
|
1063 |
-
'sortorder' => '',
|
1064 |
-
'state' => '',
|
1065 |
-
|
1066 |
-
// options are static
|
1067 |
-
'options' => array(
|
1068 |
-
'type_label' => __('Custom', $this->textdomain),
|
1069 |
-
'hide_options' => false,
|
1070 |
-
'class' => 'cpac-box-custom',
|
1071 |
-
)
|
1072 |
-
);
|
1073 |
-
|
1074 |
Â
// Thumbnail support
|
1075 |
Â
if ( post_type_supports($post_type, 'thumbnail') ) {
|
1076 |
-
$custom_columns['column-featured_image'] =
|
1077 |
Â
'label' => __('Featured Image', $this->textdomain),
|
1078 |
Â
'options' => array(
|
1079 |
Â
'type_label' => __('Image', $this->textdomain)
|
1080 |
Â
)
|
1081 |
-
)
|
1082 |
Â
}
|
1083 |
Â
|
1084 |
Â
// Excerpt support
|
1085 |
Â
if ( post_type_supports($post_type, 'editor') ) {
|
1086 |
-
$custom_columns['column-excerpt'] =
|
1087 |
Â
'label' => __('Excerpt', $this->textdomain),
|
1088 |
Â
'options' => array(
|
1089 |
Â
'type_label' => __('Excerpt', $this->textdomain)
|
1090 |
Â
)
|
1091 |
-
)
|
1092 |
Â
}
|
1093 |
Â
|
1094 |
Â
// Sticky support
|
1095 |
Â
if ( $post_type == 'post' ) {
|
1096 |
-
$custom_columns['column-sticky'] =
|
1097 |
Â
'label' => __('Sticky', $this->textdomain),
|
1098 |
Â
'options' => array(
|
1099 |
Â
'type_label' => __('Sticky', $this->textdomain)
|
1100 |
Â
)
|
1101 |
-
)
|
1102 |
Â
}
|
1103 |
Â
|
1104 |
Â
// Order support
|
1105 |
Â
if ( post_type_supports($post_type, 'page-attributes') ) {
|
1106 |
-
$custom_columns['column-order'] =
|
1107 |
-
'label' => __('Page Order', $this->textdomain),
|
1108 |
-
'sortorder' => 'on',
|
1109 |
Â
'options' => array(
|
1110 |
-
'type_label' => __('Order', $this->textdomain)
|
Â
|
|
1111 |
Â
)
|
1112 |
-
)
|
1113 |
Â
}
|
1114 |
Â
|
1115 |
Â
// Page Template
|
1116 |
Â
if ( $post_type == 'page' ) {
|
1117 |
-
$custom_columns['column-page-template'] =
|
1118 |
Â
'label' => __('Page Template', $this->textdomain),
|
1119 |
-
'sortorder' => 'on',
|
1120 |
Â
'options' => array(
|
1121 |
-
'type_label' => __('Page Template', $this->textdomain)
|
Â
|
|
1122 |
Â
)
|
1123 |
-
)
|
1124 |
Â
}
|
1125 |
Â
|
1126 |
Â
// Post Formats
|
1127 |
Â
if ( post_type_supports($post_type, 'post-formats') ) {
|
1128 |
-
$custom_columns['column-post_formats'] =
|
1129 |
Â
'label' => __('Post Format', $this->textdomain),
|
1130 |
Â
'options' => array(
|
1131 |
Â
'type_label' => __('Post Format', $this->textdomain)
|
1132 |
Â
)
|
1133 |
-
)
|
1134 |
Â
}
|
1135 |
Â
|
1136 |
Â
// Taxonomy support
|
@@ -1138,57 +1165,157 @@ 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] =
|
1142 |
Â
'label' => $tax->label,
|
1143 |
Â
'options' => array(
|
1144 |
Â
'type_label' => __('Taxonomy', $this->textdomain)
|
1145 |
Â
)
|
1146 |
-
)
|
1147 |
Â
}
|
1148 |
Â
}
|
1149 |
Â
}
|
1150 |
Â
|
1151 |
Â
// Post ID support
|
1152 |
-
$custom_columns['column-postid'] =
|
1153 |
-
'label' => 'ID',
|
1154 |
-
'sortorder' => 'on',
|
1155 |
Â
'options' => array(
|
1156 |
Â
'type_label' => 'ID',
|
Â
|
|
1157 |
Â
)
|
1158 |
-
)
|
1159 |
Â
|
1160 |
Â
// Slug support
|
1161 |
-
$custom_columns['column-page-slug'] =
|
1162 |
Â
'label' => __('Slug', $this->textdomain),
|
1163 |
-
'sortorder' => 'on',
|
1164 |
Â
'options' => array(
|
1165 |
Â
'type_label' => __('Slug', $this->textdomain),
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1166 |
Â
)
|
1167 |
-
)
|
1168 |
Â
|
1169 |
Â
// Attachment support
|
1170 |
-
$custom_columns['column-attachment'] =
|
1171 |
Â
'label' => __('Attachment', $this->textdomain),
|
1172 |
-
'sortorder' => 'on',
|
1173 |
Â
'options' => array(
|
1174 |
-
'type_label' => __('Attachment', $this->textdomain)
|
Â
|
|
1175 |
Â
)
|
1176 |
-
)
|
1177 |
Â
|
1178 |
Â
// Custom Field support
|
1179 |
Â
if ( $this->get_postmeta_by_posttype($post_type) ) {
|
1180 |
-
$custom_columns['column-meta-1'] =
|
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 |
-
)
|
1189 |
Â
}
|
1190 |
Â
|
1191 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1192 |
Â
}
|
1193 |
Â
|
1194 |
Â
/**
|
@@ -1196,14 +1323,14 @@ class Codepress_Admin_Columns
|
|
1196 |
Â
*
|
1197 |
Â
* @since 1.0
|
1198 |
Â
*/
|
1199 |
-
private function
|
1200 |
Â
{
|
1201 |
Â
// get plugin options
|
1202 |
Â
$options = $this->options;
|
1203 |
Â
|
1204 |
Â
// get saved columns
|
1205 |
-
if ( isset($options['columns'][$
|
1206 |
-
return $options['columns'][$
|
1207 |
Â
|
1208 |
Â
return false;
|
1209 |
Â
}
|
@@ -1213,7 +1340,7 @@ class Codepress_Admin_Columns
|
|
1213 |
Â
*
|
1214 |
Â
* @since 1.0
|
1215 |
Â
*/
|
1216 |
-
private function
|
1217 |
Â
{
|
1218 |
Â
// set
|
1219 |
Â
$menu = '';
|
@@ -1225,16 +1352,16 @@ class Codepress_Admin_Columns
|
|
1225 |
Â
$referer = $_REQUEST['cpac_type'];
|
1226 |
Â
|
1227 |
Â
// loop
|
1228 |
-
foreach ( $this->
|
1229 |
-
$label = $this->get_singular_name($
|
1230 |
-
$clean_label = $this->sanitize_string($
|
1231 |
Â
|
1232 |
Â
// divider
|
1233 |
Â
$divider = $count++ == 1 ? '' : ' | ';
|
1234 |
Â
|
1235 |
Â
// current
|
1236 |
Â
$current = '';
|
1237 |
-
if ( $this->is_menu_type_current($
|
1238 |
Â
$current = ' class="current"';
|
1239 |
Â
|
1240 |
Â
// menu list
|
@@ -1258,9 +1385,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,10 +1417,18 @@ class Codepress_Admin_Columns
|
|
1292 |
Â
*
|
1293 |
Â
* @since 1.0
|
1294 |
Â
*/
|
1295 |
-
private function get_singular_name( $
|
1296 |
Â
{
|
1297 |
-
|
1298 |
-
$
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1299 |
Â
return $label;
|
1300 |
Â
}
|
1301 |
Â
|
@@ -1306,25 +1439,59 @@ class Codepress_Admin_Columns
|
|
1306 |
Â
*/
|
1307 |
Â
public function handle_requests_orderby_column( $vars )
|
1308 |
Â
{
|
1309 |
-
if ( isset( $vars['orderby'] ) ) {
|
1310 |
-
|
1311 |
-
$db_columns = $this->get_db_columns($vars['post_type']);
|
1312 |
Â
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
// sanitizing label
|
1317 |
-
$label = $this->sanitize_string($db_columns['column-order']['label']);
|
1318 |
Â
|
1319 |
-
//
|
1320 |
-
if ( $
|
1321 |
Â
$vars['orderby'] = 'menu_order';
|
1322 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1323 |
Â
}
|
1324 |
Â
}
|
1325 |
Â
return $vars;
|
1326 |
Â
}
|
1327 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1328 |
Â
/**
|
1329 |
Â
* Sanitize label
|
1330 |
Â
*
|
@@ -1339,7 +1506,7 @@ class Codepress_Admin_Columns
|
|
1339 |
Â
}
|
1340 |
Â
|
1341 |
Â
/**
|
1342 |
-
* Get
|
1343 |
Â
*
|
1344 |
Â
* @since 1.0
|
1345 |
Â
*/
|
@@ -1348,6 +1515,19 @@ class Codepress_Admin_Columns
|
|
1348 |
Â
return plugins_url($file, __FILE__);
|
1349 |
Â
}
|
1350 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1351 |
Â
/**
|
1352 |
Â
* Get a thumbnail
|
1353 |
Â
*
|
@@ -1365,6 +1545,125 @@ class Codepress_Admin_Columns
|
|
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.1.1
|
5 |
+
Description: This plugin makes it easy to Manage Custom Columns for your Posts, Pages and Custom Post Type Screens.
|
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.1.1' );
|
30 |
Â
|
31 |
Â
/**
|
32 |
Â
* Init Class
|
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';
|
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_posts_column_value'), 10, 2 );
|
90 |
+
add_action( 'manage_posts_custom_column', array( &$this, 'manage_posts_column_value'), 10, 2 );
|
91 |
+
add_action( 'manage_users_custom_column', array( &$this, 'manage_users_column_value'), 10, 3 );
|
92 |
+
add_action( 'admin_print_styles' , array( &$this, 'column_styles') );
|
93 |
Â
add_filter( 'request', array( &$this, 'handle_requests_orderby_column') );
|
94 |
Â
add_filter( 'plugin_action_links', array( &$this, 'add_settings_link'), 10, 2);
|
95 |
Â
}
|
141 |
Â
*/
|
142 |
Â
public function register_columns()
|
143 |
Â
{
|
144 |
+
/** Posts */
|
145 |
Â
foreach ( $this->post_types as $post_type ) {
|
146 |
Â
|
147 |
Â
// register column per post type
|
148 |
+
add_filter("manage_edit-{$post_type}_columns", array(&$this, 'callback_add_posts_column'));
|
149 |
Â
|
150 |
Â
// register column as sortable
|
151 |
+
add_filter( "manage_edit-{$post_type}_sortable_columns", array(&$this, 'callback_add_sortable_posts_column'));
|
152 |
Â
}
|
153 |
+
|
154 |
+
/** Users */
|
155 |
+
add_filter( "manage_users_columns", array(&$this, 'callback_add_users_column'));
|
156 |
+
add_filter( "manage_users_sortable_columns", array(&$this, 'callback_add_sortable_users_column') );
|
157 |
Â
}
|
158 |
Â
|
159 |
Â
/**
|
160 |
+
* Callback add Posts Column
|
161 |
Â
*
|
162 |
Â
* @since 1.0
|
163 |
Â
*/
|
164 |
+
public function callback_add_posts_column($columns)
|
165 |
Â
{
|
166 |
Â
global $post_type;
|
Â
|
|
167 |
Â
|
168 |
+
return $this->add_managed_columns($post_type, $columns);
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Callback add Users column
|
173 |
+
*
|
174 |
+
* @since 1.1
|
175 |
+
*/
|
176 |
+
public function callback_add_users_column($columns)
|
177 |
+
{
|
178 |
+
return $this->add_managed_columns('wp-users', $columns);
|
179 |
Â
}
|
180 |
Â
|
181 |
Â
/**
|
182 |
+
* Add managed columns by Type
|
183 |
Â
*
|
184 |
+
* @since 1.1
|
185 |
Â
*/
|
186 |
+
private function add_managed_columns( $type = 'post', $columns )
|
187 |
Â
{
|
188 |
+
$db_columns = $this->get_stored_columns($type);
|
189 |
+
|
190 |
+
if ( !$db_columns )
|
191 |
+
return $columns;
|
192 |
+
|
193 |
+
// set already loaded columns by plugins
|
194 |
+
$set_columns = $this->filter_preset_columns($columns, $type);
|
195 |
+
|
196 |
+
// loop through columns
|
197 |
+
foreach ( $db_columns as $id => $values ) {
|
198 |
+
|
199 |
+
// is active
|
200 |
+
if ( isset($values['state']) && $values['state'] == 'on' ){
|
201 |
+
|
202 |
+
// register format
|
203 |
+
$set_columns[$id] = $values['label'];
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
return $set_columns;
|
208 |
Â
}
|
209 |
Â
|
210 |
Â
/**
|
211 |
+
* Callback add Posts sortable column
|
212 |
Â
*
|
213 |
+
* @since 1.0
|
214 |
+
*/
|
215 |
+
public function callback_add_sortable_posts_column($columns)
|
216 |
+
{
|
217 |
+
global $post_type;
|
218 |
+
|
219 |
+
return $this->add_managed_sortable_columns($post_type, $columns);
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Callback add Users sortable column
|
224 |
Â
*
|
225 |
+
* @since 1.1
|
226 |
Â
*/
|
227 |
+
public function callback_add_sortable_users_column($columns)
|
228 |
Â
{
|
229 |
+
return $this->add_managed_sortable_columns('wp-users', $columns);
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Add managed sortable columns by Type
|
234 |
+
*
|
235 |
+
* @since 1.1
|
236 |
+
*/
|
237 |
+
private function add_managed_sortable_columns( $type = 'post', $columns )
|
238 |
+
{
|
239 |
+
$display_columns = $this->get_merged_columns($type);
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
240 |
Â
|
241 |
+
if ( ! $display_columns )
|
242 |
+
return $columns;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
243 |
Â
|
244 |
+
foreach ( $display_columns as $id => $vars ) {
|
245 |
+
if ( isset($vars['options']['sortorder']) && $vars['options']['sortorder'] == 'on' ){
|
246 |
+
|
247 |
+
// register format
|
248 |
+
$columns[$id] = $this->sanitize_string($vars['label']);
|
249 |
+
}
|
250 |
+
}
|
251 |
+
return $columns;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
252 |
Â
}
|
253 |
+
|
254 |
Â
/**
|
255 |
Â
* Get a list of Column options per post type
|
256 |
Â
*
|
257 |
Â
* @since 1.0
|
258 |
Â
*/
|
259 |
+
private function get_column_boxes($type)
|
260 |
Â
{
|
261 |
Â
// merge all columns
|
262 |
+
$display_columns = $this->get_merged_columns($type);
|
263 |
Â
|
264 |
Â
// define
|
265 |
Â
$list = '';
|
266 |
Â
|
267 |
Â
// loop throught the active columns
|
268 |
Â
if ( $display_columns ) {
|
269 |
+
foreach ( $display_columns as $id => $values ) {
|
270 |
Â
|
271 |
Â
// add items to the list
|
272 |
+
$list .= $this->get_box($type, $id, $values);
|
273 |
Â
|
274 |
Â
}
|
275 |
Â
}
|
276 |
Â
|
277 |
Â
// custom field button
|
278 |
Â
$button_add_column = '';
|
279 |
+
if ( $this->get_postmeta_by_posttype($type) )
|
280 |
Â
$button_add_column = "<a href='javacript:;' class='cpac-add-customfield-column button'>+ " . __('Add Custom Field Column') . "</a>";
|
281 |
Â
|
282 |
Â
return "
|
295 |
Â
*
|
296 |
Â
* @since 1.0
|
297 |
Â
*/
|
298 |
+
private function get_merged_columns( $type )
|
299 |
Â
{
|
300 |
Â
//get saved database columns
|
301 |
+
$db_columns = $this->get_stored_columns($type);
|
Â
|
|
Â
|
|
Â
|
|
302 |
Â
|
303 |
+
/** Users */
|
304 |
+
if ( $type == 'wp-users' ) {
|
305 |
+
$wp_default_columns = $this->get_wp_default_users_columns();
|
306 |
+
$wp_custom_columns = $this->get_custom_users_columns();
|
307 |
+
}
|
308 |
Â
|
309 |
+
/** Posts */
|
310 |
+
else {
|
311 |
+
$wp_default_columns = $this->get_wp_default_posts_columns($type);
|
312 |
+
$wp_custom_columns = $this->get_custom_posts_columns($type);
|
313 |
+
}
|
314 |
+
|
315 |
+
// merge columns
|
316 |
+
$posts_columns = wp_parse_args($wp_custom_columns, $wp_default_columns);
|
317 |
+
|
318 |
Â
// loop throught the active columns
|
319 |
Â
if ( $db_columns ) {
|
320 |
+
foreach ( $db_columns as $id => $values ) {
|
321 |
Â
|
322 |
Â
// get column meta options from custom columns
|
323 |
+
if ( $this->is_column_meta($id) )
|
324 |
+
$db_columns[$id]['options'] = $wp_custom_columns['column-meta-1']['options'];
|
325 |
Â
|
326 |
Â
// add static options
|
327 |
Â
else
|
328 |
+
$db_columns[$id]['options'] = $posts_columns[$id]['options'];
|
329 |
Â
|
330 |
+
unset($posts_columns[$id]);
|
331 |
Â
}
|
332 |
Â
}
|
333 |
Â
|
334 |
Â
// merge all
|
335 |
+
$display_columns = wp_parse_args($db_columns, $posts_columns);
|
336 |
+
|
337 |
Â
return $display_columns;
|
338 |
Â
}
|
339 |
+
|
Â
|
|
340 |
Â
/**
|
341 |
Â
* Get checkbox
|
342 |
Â
*
|
343 |
Â
* @since 1.0
|
344 |
Â
*/
|
345 |
+
private function get_box($post_type, $id, $values)
|
346 |
Â
{
|
347 |
Â
$classes = array();
|
348 |
Â
|
349 |
Â
// set state
|
350 |
Â
$state = isset($values['state']) ? $values['state'] : '';
|
351 |
Â
|
Â
|
|
Â
|
|
Â
|
|
352 |
Â
// class
|
353 |
+
$classes[] = "cpac-box-{$id}";
|
354 |
Â
if ( $state )
|
355 |
Â
$classes[] = 'active';
|
356 |
Â
if ( ! empty($values['options']['class']) )
|
358 |
Â
$class = implode(' ', $classes);
|
359 |
Â
|
360 |
Â
// more box options
|
361 |
+
$more_options = $this->get_additional_box_options($post_type, $id, $values);
|
362 |
Â
$action = "<a class='cpac-action' href='#open'>open</a>";
|
363 |
Â
|
364 |
Â
// hide box options
|
372 |
Â
<div class='cpac-type-options'>
|
373 |
Â
|
374 |
Â
<div class='cpac-checkbox'></div>
|
375 |
+
<input type='hidden' class='cpac-state' name='cpac_options[columns][{$post_type}][{$id}][state]' value='{$state}'/>
|
Â
|
|
376 |
Â
<label class='main-label'>{$values['label']}</label>
|
377 |
Â
</div>
|
378 |
Â
<div class='cpac-meta-title'>
|
380 |
Â
<span>{$values['options']['type_label']}</span>
|
381 |
Â
</div>
|
382 |
Â
<div class='cpac-type-inside'>
|
383 |
+
<label for='cpac_options[columns][{$post_type}][{$id}][label]'>Label: </label>
|
384 |
+
<input type='text' name='cpac_options[columns][{$post_type}][{$id}][label]' value='{$values['label']}' class='text'/>
|
385 |
Â
<br/>
|
386 |
Â
{$more_options}
|
387 |
Â
</div>
|
396 |
Â
*
|
397 |
Â
* @since 1.0
|
398 |
Â
*/
|
399 |
+
private function get_additional_box_options($post_type, $id, $values)
|
400 |
Â
{
|
401 |
Â
$fields = '';
|
402 |
Â
|
403 |
Â
// Custom Fields
|
404 |
+
if ( $this->is_column_meta($id) )
|
405 |
+
$fields .= $this->get_box_options_customfields($post_type, $id, $values);
|
406 |
Â
|
407 |
Â
return $fields;
|
408 |
Â
}
|
412 |
Â
*
|
413 |
Â
* @since 1.0
|
414 |
Â
*/
|
415 |
+
private function get_box_options_customfields($post_type, $id, $values)
|
416 |
Â
{
|
417 |
Â
// get post meta fields
|
418 |
Â
$fields = $this->get_postmeta_by_posttype($post_type);
|
442 |
Â
'library_id' => __('Media Library Icon', $this->textdomain),
|
443 |
Â
'excerpt' => __('Excerpt'),
|
444 |
Â
'array' => __('Multiple Values', $this->textdomain),
|
445 |
+
'numeric' => __('Numeric', $this->textdomain),
|
446 |
Â
);
|
447 |
Â
|
448 |
+
// add filter
|
449 |
+
$fieldtypes = apply_filters('cpac-field-types', $fieldtypes );
|
450 |
+
|
451 |
+
// set select options
|
452 |
Â
foreach ( $fieldtypes as $fkey => $fieldtype ) {
|
453 |
Â
$fieldtype_options .= sprintf
|
454 |
Â
(
|
459 |
Â
);
|
460 |
Â
}
|
461 |
Â
|
462 |
+
// before and after string
|
463 |
+
$before = ! empty($values['before']) ? $values['before'] : '' ;
|
464 |
+
$after = ! empty($values['after']) ? $values['after'] : '' ;
|
465 |
+
|
466 |
Â
if ( empty($field_options) )
|
467 |
Â
return false;
|
468 |
Â
|
469 |
Â
// add remove button
|
470 |
Â
$remove = '<p class="remove-description description">'.__('This field can not be removed', $this->textdomain).'</p>';
|
471 |
+
if ( $id != 'column-meta-1') {
|
472 |
Â
$remove = "
|
473 |
Â
<p>
|
474 |
Â
<a href='javascript:;' class='cpac-delete-custom-field-box'>".__('Remove')."</a>
|
477 |
Â
}
|
478 |
Â
|
479 |
Â
$inside = "
|
480 |
+
<label for='cpac_options[columns][{$post_type}][{$id}][field]'>Custom Field: </label>
|
481 |
+
<select name='cpac_options[columns][{$post_type}][{$id}][field]'>{$field_options}</select>
|
482 |
Â
<br/>
|
483 |
+
<label for='cpac_options[columns][{$post_type}][{$id}][field_type]'>Field Type: </label>
|
484 |
+
<select name='cpac_options[columns][{$post_type}][{$id}][field_type]'>{$fieldtype_options}</select>
|
485 |
Â
<br/>
|
486 |
+
<label for='cpac_options[columns][{$post_type}][{$id}][before]'>Before: </label>
|
487 |
+
<input type='text' class='cpac-before' name='cpac_options[columns][{$post_type}][{$id}][before]' value='{$before}'/>
|
488 |
+
<br/>
|
489 |
+
<label for='cpac_options[columns][{$post_type}][{$id}][before]'>After: </label>
|
490 |
+
<input type='text' class='cpac-after' name='cpac_options[columns][{$post_type}][{$id}][after]' value='{$after}'/>
|
491 |
+
<br/>
|
492 |
Â
{$remove}
|
493 |
Â
";
|
494 |
Â
|
534 |
Â
wp_enqueue_script( 'jquery-ui-sortable' );
|
535 |
Â
wp_enqueue_script( 'cpac-admin', $this->plugin_url('/assets/js/admin-column.js'), array('jquery', 'jquery-ui-sortable'), CPAC_VERSION );
|
536 |
Â
}
|
537 |
+
|
538 |
+
/**
|
539 |
+
* Get column types
|
540 |
+
*
|
541 |
+
* @since 1.1
|
542 |
+
*/
|
543 |
+
private function get_types()
|
544 |
+
{
|
545 |
+
$types = $this->post_types;
|
546 |
+
$types['wp-users'] = 'wp-users';
|
547 |
+
|
548 |
+
return $types;
|
549 |
+
}
|
550 |
+
|
551 |
Â
/**
|
552 |
Â
* Get post types
|
553 |
Â
*
|
634 |
Â
|
635 |
Â
// stores the default columns that are set by WP or set in the theme.
|
636 |
Â
$wp_default_columns = array();
|
637 |
+
|
638 |
+
// Posts
|
639 |
Â
foreach ( $this->post_types as $post_type ) {
|
640 |
+
$wp_default_columns[$post_type] = $this->get_wp_default_posts_columns($post_type);
|
641 |
Â
}
|
642 |
+
|
643 |
+
// Users
|
644 |
+
$wp_default_columns['wp-users'] = $this->get_wp_default_users_columns();
|
645 |
+
|
646 |
Â
update_option( 'cpac_options_default', $wp_default_columns );
|
647 |
Â
}
|
648 |
Â
|
709 |
Â
*
|
710 |
Â
* @since 1.0
|
711 |
Â
*/
|
712 |
+
public function manage_posts_column_value($column_name, $post_id)
|
713 |
Â
{
|
714 |
+
$type = $column_name;
|
715 |
Â
|
716 |
Â
// Check for taxonomies, such as column-taxonomy-[taxname]
|
717 |
Â
if ( strpos($type, 'column-taxonomy-') !== false )
|
718 |
Â
$type = 'column-taxonomy';
|
719 |
Â
|
720 |
Â
// Check for custom fields, such as column-meta-[customfieldname]
|
721 |
+
if ( $this->is_column_meta($type) )
|
722 |
Â
$type = 'column-meta';
|
723 |
Â
|
724 |
Â
// Hook
|
725 |
+
do_action('cpac-manage-column', $type, $column_name, $post_id);
|
726 |
Â
|
727 |
Â
// Switch Types
|
728 |
Â
$result = '';
|
776 |
Â
$result = get_post($post_id)->post_name;
|
777 |
Â
break;
|
778 |
Â
|
779 |
+
// Slug
|
780 |
+
case "column-word-count" :
|
781 |
+
$result = str_word_count( strip_tags( get_post($post_id)->post_content ) );
|
782 |
+
break;
|
783 |
+
|
784 |
Â
// Taxonomy
|
785 |
Â
case "column-taxonomy" :
|
786 |
+
$tax = str_replace('column-taxonomy-', '', $column_name);
|
787 |
Â
$tags = get_the_terms($post_id, $tax);
|
788 |
Â
$tarr = array();
|
789 |
Â
if ( $tax == 'post_format' && empty($tags) ) {
|
799 |
Â
|
800 |
Â
// Custom Field
|
801 |
Â
case "column-meta" :
|
802 |
+
$result = $this->get_column_value_custom_field($post_id, $column_name);
|
803 |
Â
break;
|
804 |
Â
|
805 |
Â
// Attachment
|
808 |
Â
break;
|
809 |
Â
|
810 |
Â
default :
|
811 |
+
$result = get_post_meta( $post_id, $column_name, true );
|
812 |
Â
|
813 |
Â
endswitch;
|
814 |
Â
|
817 |
Â
|
818 |
Â
echo $result;
|
819 |
Â
}
|
820 |
+
|
821 |
+
/**
|
822 |
+
* Manage custom column for Users.
|
823 |
+
*
|
824 |
+
* @since 1.1
|
825 |
+
*/
|
826 |
+
public function manage_users_column_value( $val, $column_name, $user_id )
|
827 |
+
{
|
828 |
+
$type = $column_name;
|
829 |
+
|
830 |
+
$userdata = get_userdata( $user_id );
|
831 |
+
|
832 |
+
if ( ! $userdata )
|
833 |
+
return false;
|
834 |
+
|
835 |
+
$result = '';
|
836 |
+
switch ($type) :
|
837 |
+
|
838 |
+
// user id
|
839 |
+
case "column-user_id" :
|
840 |
+
$result = $user_id;
|
841 |
+
break;
|
842 |
+
|
843 |
+
// first name
|
844 |
+
case "column-first_name" :
|
845 |
+
$result = $userdata->first_name;
|
846 |
+
break;
|
847 |
+
|
848 |
+
// last name
|
849 |
+
case "column-last_name" :
|
850 |
+
$result = $userdata->last_name;
|
851 |
+
break;
|
852 |
+
|
853 |
+
// user url
|
854 |
+
case "column-user_url" :
|
855 |
+
$result = $userdata->user_url;
|
856 |
+
break;
|
857 |
+
|
858 |
+
// user url
|
859 |
+
case "column-user_registered" :
|
860 |
+
$result = $userdata->user_registered;
|
861 |
+
break;
|
862 |
+
|
863 |
+
default :
|
864 |
+
$result = get_user_meta( $user_id, $column_name, true );
|
865 |
+
|
866 |
+
endswitch;
|
867 |
+
|
868 |
+
if ( empty($result) )
|
869 |
+
$result = ' ';
|
870 |
+
|
871 |
+
return $result;
|
872 |
+
}
|
873 |
Â
|
874 |
Â
/**
|
875 |
Â
* Get column value of post attachments
|
876 |
Â
*
|
877 |
Â
* @since 1.0
|
878 |
Â
*/
|
879 |
+
private function get_column_value_attachments( $post_id )
|
880 |
Â
{
|
881 |
Â
$result = '';
|
882 |
Â
$attachments = get_posts(array(
|
898 |
Â
*
|
899 |
Â
* @since 1.0
|
900 |
Â
*/
|
901 |
+
private function get_column_value_custom_field($post_id, $id)
|
902 |
Â
{
|
903 |
+
$columns = $this->get_stored_columns( get_post_type($post_id) );
|
904 |
+
|
905 |
+
// inputs
|
906 |
+
$field = isset($columns[$id]['field']) ? $columns[$id]['field'] : '';
|
907 |
+
$fieldtype = isset($columns[$id]['field_type']) ? $columns[$id]['field_type'] : '';
|
908 |
+
$before = isset($columns[$id]['before']) ? $columns[$id]['before'] : '';
|
909 |
+
$after = isset($columns[$id]['after']) ? $columns[$id]['after'] : '';
|
910 |
Â
|
911 |
Â
// Get meta field value
|
912 |
Â
$meta = get_post_meta($post_id, $field, true);
|
942 |
Â
|
943 |
Â
endswitch;
|
944 |
Â
|
945 |
+
// add before and after string
|
946 |
+
$meta = "{$before}{$meta}{$after}";
|
947 |
+
|
948 |
Â
return $meta;
|
949 |
Â
}
|
950 |
Â
|
963 |
Â
$retVal[] = $r_pieces;
|
964 |
Â
}
|
965 |
Â
}
|
966 |
+
if ( isset($retVal) && is_array($retVal) )
|
967 |
+
return implode( $glue, $retVal );
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
968 |
Â
|
969 |
+
return false;
|
970 |
+
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
971 |
Â
|
972 |
Â
/**
|
973 |
Â
* Set columns. These columns apply either for every post or set by a plugin.
|
974 |
Â
*
|
975 |
Â
* @since 1.0
|
976 |
Â
*/
|
977 |
+
private function filter_preset_columns($columns, $type = 'post')
|
978 |
Â
{
|
979 |
Â
$options = $this->options_default;
|
980 |
Â
|
982 |
Â
return $columns;
|
983 |
Â
|
984 |
Â
// we use the wp default columns for filtering...
|
985 |
+
$db_columns = $options[$type];
|
986 |
Â
|
987 |
Â
// ... the ones that are set by plugins, theme functions and such.
|
988 |
Â
$dif_columns = array_diff(array_keys($columns), array_keys($db_columns));
|
996 |
Â
}
|
997 |
Â
|
998 |
Â
return $pre_columns;
|
999 |
+
}
|
1000 |
Â
|
1001 |
Â
/**
|
1002 |
+
* Get WP default supported admin columns per post type.
|
1003 |
Â
*
|
1004 |
Â
* @since 1.0
|
1005 |
Â
*/
|
1006 |
+
private function get_wp_default_posts_columns($post_type = 'post')
|
1007 |
Â
{
|
1008 |
+
// load some dependencies
|
1009 |
+
require_once(ABSPATH . 'wp-admin/includes/template.php');
|
1010 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1011 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-posts-list-table.php');
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1012 |
Â
|
1013 |
Â
// we need to change the current screen
|
1014 |
Â
global $current_screen;
|
1020 |
Â
// ...so we can get its columns
|
1021 |
Â
$columns = WP_Posts_List_Table::get_columns();
|
1022 |
Â
|
1023 |
+
if ( empty ( $columns ) )
|
1024 |
+
return false;
|
1025 |
+
|
1026 |
+
// change to uniform format
|
1027 |
+
$posts_columns = $this->get_uniform_format($columns);
|
1028 |
+
|
1029 |
+
// reset current screen
|
1030 |
+
$current_screen = $org_current_screen;
|
1031 |
+
|
1032 |
+
return $posts_columns;
|
1033 |
+
}
|
1034 |
+
|
1035 |
+
/**
|
1036 |
+
* Get WP default users columns per post type.
|
1037 |
+
*
|
1038 |
+
* @since 1.0
|
1039 |
+
*/
|
1040 |
+
private function get_wp_default_users_columns()
|
1041 |
+
{
|
1042 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1043 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-users-list-table.php');
|
1044 |
+
|
1045 |
+
// turn off site users
|
1046 |
+
$this->is_site_users = false;
|
1047 |
+
|
1048 |
+
// get users columns
|
1049 |
+
$columns = WP_Users_List_Table::get_columns();
|
1050 |
+
|
1051 |
+
// change to uniform format
|
1052 |
+
$users_columns = $this->get_uniform_format($columns);
|
1053 |
+
|
1054 |
+
return $users_columns;
|
1055 |
+
}
|
1056 |
+
|
1057 |
+
/**
|
1058 |
+
* Build uniform format for all columns
|
1059 |
+
*
|
1060 |
+
* @since 1.0
|
1061 |
+
*/
|
1062 |
+
private function get_uniform_format($columns)
|
1063 |
+
{
|
1064 |
Â
// we remove the checkbox column as an option...
|
1065 |
Â
unset($columns['cb']);
|
1066 |
Â
|
1067 |
Â
// change to uniform format
|
1068 |
Â
$uniform_columns = array();
|
1069 |
+
foreach ( (array) $columns as $id => $label ) {
|
1070 |
Â
$hide_options = false;
|
1071 |
Â
$type_label = $label;
|
1072 |
Â
|
1075 |
Â
$type_label = __('Comments', $this->textdomain);
|
1076 |
Â
$hide_options = true;
|
1077 |
Â
}
|
1078 |
+
|
1079 |
+
$uniform_colums[$id] = array(
|
1080 |
Â
'label' => $label,
|
1081 |
Â
'state' => 'on',
|
1082 |
Â
'options' => array(
|
1086 |
Â
)
|
1087 |
Â
);
|
1088 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1089 |
Â
return $uniform_colums;
|
1090 |
Â
}
|
1091 |
+
|
1092 |
Â
/**
|
1093 |
+
* Custom posts columns
|
1094 |
Â
*
|
1095 |
Â
* @since 1.0
|
1096 |
Â
*/
|
1097 |
+
private function get_custom_posts_columns($post_type)
|
1098 |
Â
{
|
1099 |
Â
$custom_columns = array();
|
1100 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1101 |
Â
// Thumbnail support
|
1102 |
Â
if ( post_type_supports($post_type, 'thumbnail') ) {
|
1103 |
+
$custom_columns['column-featured_image'] = array(
|
1104 |
Â
'label' => __('Featured Image', $this->textdomain),
|
1105 |
Â
'options' => array(
|
1106 |
Â
'type_label' => __('Image', $this->textdomain)
|
1107 |
Â
)
|
1108 |
+
);
|
1109 |
Â
}
|
1110 |
Â
|
1111 |
Â
// Excerpt support
|
1112 |
Â
if ( post_type_supports($post_type, 'editor') ) {
|
1113 |
+
$custom_columns['column-excerpt'] = array(
|
1114 |
Â
'label' => __('Excerpt', $this->textdomain),
|
1115 |
Â
'options' => array(
|
1116 |
Â
'type_label' => __('Excerpt', $this->textdomain)
|
1117 |
Â
)
|
1118 |
+
);
|
1119 |
Â
}
|
1120 |
Â
|
1121 |
Â
// Sticky support
|
1122 |
Â
if ( $post_type == 'post' ) {
|
1123 |
+
$custom_columns['column-sticky'] = array(
|
1124 |
Â
'label' => __('Sticky', $this->textdomain),
|
1125 |
Â
'options' => array(
|
1126 |
Â
'type_label' => __('Sticky', $this->textdomain)
|
1127 |
Â
)
|
1128 |
+
);
|
1129 |
Â
}
|
1130 |
Â
|
1131 |
Â
// Order support
|
1132 |
Â
if ( post_type_supports($post_type, 'page-attributes') ) {
|
1133 |
+
$custom_columns['column-order'] = array(
|
1134 |
+
'label' => __('Page Order', $this->textdomain),
|
Â
|
|
1135 |
Â
'options' => array(
|
1136 |
+
'type_label' => __('Order', $this->textdomain),
|
1137 |
+
'sortorder' => 'on',
|
1138 |
Â
)
|
1139 |
+
);
|
1140 |
Â
}
|
1141 |
Â
|
1142 |
Â
// Page Template
|
1143 |
Â
if ( $post_type == 'page' ) {
|
1144 |
+
$custom_columns['column-page-template'] = array(
|
1145 |
Â
'label' => __('Page Template', $this->textdomain),
|
Â
|
|
1146 |
Â
'options' => array(
|
1147 |
+
'type_label' => __('Page Template', $this->textdomain),
|
1148 |
+
'sortorder' => 'on',
|
1149 |
Â
)
|
1150 |
+
);
|
1151 |
Â
}
|
1152 |
Â
|
1153 |
Â
// Post Formats
|
1154 |
Â
if ( post_type_supports($post_type, 'post-formats') ) {
|
1155 |
+
$custom_columns['column-post_formats'] = array(
|
1156 |
Â
'label' => __('Post Format', $this->textdomain),
|
1157 |
Â
'options' => array(
|
1158 |
Â
'type_label' => __('Post Format', $this->textdomain)
|
1159 |
Â
)
|
1160 |
+
);
|
1161 |
Â
}
|
1162 |
Â
|
1163 |
Â
// Taxonomy support
|
1165 |
Â
if ( $taxonomies ) {
|
1166 |
Â
foreach ( $taxonomies as $tax_slug => $tax ) {
|
1167 |
Â
if ( $tax_slug != 'post_tag' && $tax_slug != 'category' && $tax_slug != 'post_format' ) {
|
1168 |
+
$custom_columns['column-taxonomy-'.$tax->name] = array(
|
1169 |
Â
'label' => $tax->label,
|
1170 |
Â
'options' => array(
|
1171 |
Â
'type_label' => __('Taxonomy', $this->textdomain)
|
1172 |
Â
)
|
1173 |
+
);
|
1174 |
Â
}
|
1175 |
Â
}
|
1176 |
Â
}
|
1177 |
Â
|
1178 |
Â
// Post ID support
|
1179 |
+
$custom_columns['column-postid'] = array(
|
1180 |
+
'label' => 'ID',
|
Â
|
|
1181 |
Â
'options' => array(
|
1182 |
Â
'type_label' => 'ID',
|
1183 |
+
'sortorder' => 'on',
|
1184 |
Â
)
|
1185 |
+
);
|
1186 |
Â
|
1187 |
Â
// Slug support
|
1188 |
+
$custom_columns['column-page-slug'] = array(
|
1189 |
Â
'label' => __('Slug', $this->textdomain),
|
Â
|
|
1190 |
Â
'options' => array(
|
1191 |
Â
'type_label' => __('Slug', $this->textdomain),
|
1192 |
+
'sortorder' => 'on',
|
1193 |
+
)
|
1194 |
+
);
|
1195 |
+
|
1196 |
+
// Word count support
|
1197 |
+
$custom_columns['column-word-count'] = array(
|
1198 |
+
'label' => __('Word count', $this->textdomain),
|
1199 |
+
'options' => array(
|
1200 |
+
'type_label' => __('Word count', $this->textdomain),
|
1201 |
Â
)
|
1202 |
+
);
|
1203 |
Â
|
1204 |
Â
// Attachment support
|
1205 |
+
$custom_columns['column-attachment'] = array(
|
1206 |
Â
'label' => __('Attachment', $this->textdomain),
|
Â
|
|
1207 |
Â
'options' => array(
|
1208 |
+
'type_label' => __('Attachment', $this->textdomain),
|
1209 |
+
'sortorder' => 'on',
|
1210 |
Â
)
|
1211 |
+
);
|
1212 |
Â
|
1213 |
Â
// Custom Field support
|
1214 |
Â
if ( $this->get_postmeta_by_posttype($post_type) ) {
|
1215 |
+
$custom_columns['column-meta-1'] = array(
|
1216 |
Â
'label' => __('Custom Field', $this->textdomain),
|
1217 |
Â
'field' => '',
|
1218 |
Â
'field_type' => '',
|
1219 |
+
'before' => '',
|
1220 |
+
'after' => '',
|
1221 |
Â
'options' => array(
|
1222 |
Â
'type_label' => __('Field', $this->textdomain),
|
1223 |
+
'class' => 'cpac-box-metafield',
|
1224 |
+
'sortorder' => 'on',
|
1225 |
Â
)
|
1226 |
+
);
|
1227 |
Â
}
|
1228 |
Â
|
1229 |
+
// merge with defaults
|
1230 |
+
$custom_columns = $this->parse_defaults($custom_columns);
|
1231 |
+
|
1232 |
+
return apply_filters('cpac-custom-posts-columns', $custom_columns);
|
1233 |
+
}
|
1234 |
+
|
1235 |
+
/**
|
1236 |
+
* Custom users columns
|
1237 |
+
*
|
1238 |
+
* @since 1.1
|
1239 |
+
*/
|
1240 |
+
private function get_custom_users_columns()
|
1241 |
+
{
|
1242 |
+
$custom_columns = array();
|
1243 |
+
|
1244 |
+
// User ID
|
1245 |
+
$custom_columns['column-user_id'] = array(
|
1246 |
+
'label' => __('User ID', $this->textdomain),
|
1247 |
+
'options' => array(
|
1248 |
+
'type_label' => __('User ID', $this->textdomain),
|
1249 |
+
'sortorder' => 'on'
|
1250 |
+
)
|
1251 |
+
);
|
1252 |
+
|
1253 |
+
// First name
|
1254 |
+
$custom_columns['column-first_name'] = array(
|
1255 |
+
'label' => __('First name', $this->textdomain),
|
1256 |
+
'options' => array(
|
1257 |
+
'type_label' => __('First name', $this->textdomain),
|
1258 |
+
)
|
1259 |
+
);
|
1260 |
+
|
1261 |
+
// Last name
|
1262 |
+
$custom_columns['column-last_name'] = array(
|
1263 |
+
'label' => __('Last name', $this->textdomain),
|
1264 |
+
'options' => array(
|
1265 |
+
'type_label' => __('Last name', $this->textdomain),
|
1266 |
+
)
|
1267 |
+
);
|
1268 |
+
|
1269 |
+
// User url
|
1270 |
+
$custom_columns['column-user_url'] = array(
|
1271 |
+
'label' => __('Url', $this->textdomain),
|
1272 |
+
'options' => array(
|
1273 |
+
'type_label' => __('Url', $this->textdomain),
|
1274 |
+
)
|
1275 |
+
);
|
1276 |
+
|
1277 |
+
// User url
|
1278 |
+
$custom_columns['column-user_registered'] = array(
|
1279 |
+
'label' => __('Registered', $this->textdomain),
|
1280 |
+
'options' => array(
|
1281 |
+
'type_label' => __('Registered', $this->textdomain),
|
1282 |
+
)
|
1283 |
+
);
|
1284 |
+
|
1285 |
+
// merge with defaults
|
1286 |
+
$custom_columns = $this->parse_defaults($custom_columns);
|
1287 |
+
|
1288 |
+
return apply_filters('cpac-custom-users-columns', $custom_columns);
|
1289 |
+
}
|
1290 |
+
|
1291 |
+
/**
|
1292 |
+
* Parse defaults
|
1293 |
+
*
|
1294 |
+
* @since 1.1
|
1295 |
+
*/
|
1296 |
+
private function parse_defaults($columns)
|
1297 |
+
{
|
1298 |
+
// default arguments
|
1299 |
+
$defaults = array(
|
1300 |
+
|
1301 |
+
// stored values
|
1302 |
+
'label' => '',
|
1303 |
+
'state' => '',
|
1304 |
+
|
1305 |
+
// static values
|
1306 |
+
'options' => array(
|
1307 |
+
'type_label' => __('Custom', $this->textdomain),
|
1308 |
+
'hide_options' => false,
|
1309 |
+
'class' => 'cpac-box-custom',
|
1310 |
+
'sortorder' => '',
|
1311 |
+
)
|
1312 |
+
);
|
1313 |
+
|
1314 |
+
foreach ( $columns as $k => $column ) {
|
1315 |
+
$c[$k] = wp_parse_args( $column, $defaults);
|
1316 |
+
}
|
1317 |
+
|
1318 |
+
return $c;
|
1319 |
Â
}
|
1320 |
Â
|
1321 |
Â
/**
|
1323 |
Â
*
|
1324 |
Â
* @since 1.0
|
1325 |
Â
*/
|
1326 |
+
private function get_stored_columns($type)
|
1327 |
Â
{
|
1328 |
Â
// get plugin options
|
1329 |
Â
$options = $this->options;
|
1330 |
Â
|
1331 |
Â
// get saved columns
|
1332 |
+
if ( isset($options['columns'][$type]) )
|
1333 |
+
return $options['columns'][$type];
|
1334 |
Â
|
1335 |
Â
return false;
|
1336 |
Â
}
|
1340 |
Â
*
|
1341 |
Â
* @since 1.0
|
1342 |
Â
*/
|
1343 |
+
private function get_menu()
|
1344 |
Â
{
|
1345 |
Â
// set
|
1346 |
Â
$menu = '';
|
1352 |
Â
$referer = $_REQUEST['cpac_type'];
|
1353 |
Â
|
1354 |
Â
// loop
|
1355 |
+
foreach ( $this->get_types() as $type ) {
|
1356 |
+
$label = $this->get_singular_name($type);
|
1357 |
+
$clean_label = $this->sanitize_string($type);
|
1358 |
Â
|
1359 |
Â
// divider
|
1360 |
Â
$divider = $count++ == 1 ? '' : ' | ';
|
1361 |
Â
|
1362 |
Â
// current
|
1363 |
Â
$current = '';
|
1364 |
+
if ( $this->is_menu_type_current($type) )
|
1365 |
Â
$current = ' class="current"';
|
1366 |
Â
|
1367 |
Â
// menu list
|
1385 |
Â
* @since 1.0
|
1386 |
Â
*/
|
1387 |
Â
private function is_menu_type_current( $post_type )
|
1388 |
+
{
|
Â
|
|
Â
|
|
1389 |
Â
// referer
|
1390 |
Â
$referer = '';
|
1391 |
Â
if ( ! empty($_REQUEST['cpac_type']) )
|
1417 |
Â
*
|
1418 |
Â
* @since 1.0
|
1419 |
Â
*/
|
1420 |
+
private function get_singular_name( $type )
|
1421 |
Â
{
|
1422 |
+
// Users
|
1423 |
+
if ( $type == 'wp-users' )
|
1424 |
+
$label = 'Users';
|
1425 |
+
|
1426 |
+
// Posts
|
1427 |
+
else {
|
1428 |
+
$posttype_obj = get_post_type_object($type);
|
1429 |
+
$label = $posttype_obj->labels->singular_name;
|
1430 |
+
}
|
1431 |
+
|
1432 |
Â
return $label;
|
1433 |
Â
}
|
1434 |
Â
|
1439 |
Â
*/
|
1440 |
Â
public function handle_requests_orderby_column( $vars )
|
1441 |
Â
{
|
1442 |
+
if ( isset( $vars['orderby'] ) ) {
|
1443 |
+
$column = $this->get_orderby_type( $vars['orderby'], $vars['post_type'] );
|
Â
|
|
1444 |
Â
|
1445 |
+
if ( $column ) {
|
1446 |
+
$id = key($column);
|
Â
|
|
Â
|
|
Â
|
|
1447 |
Â
|
1448 |
+
// Page Order
|
1449 |
+
if ( $id == 'column-order' ) {
|
1450 |
Â
$vars['orderby'] = 'menu_order';
|
1451 |
Â
}
|
1452 |
+
|
1453 |
+
// Custom Fields
|
1454 |
+
if ( $this->is_column_meta($id) ) {
|
1455 |
+
$field = $column[$id]['field'];
|
1456 |
+
|
1457 |
+
// orderby type
|
1458 |
+
$field_type = 'meta_value';
|
1459 |
+
if ( $column[$id]['field_type'] == 'numeric' || $column[$id]['field_type'] == 'library_id' )
|
1460 |
+
$field_type = 'meta_value_num';
|
1461 |
+
|
1462 |
+
// set vars
|
1463 |
+
$vars = array_merge( $vars, array(
|
1464 |
+
'meta_key' => $field,
|
1465 |
+
'orderby' => $field_type
|
1466 |
+
) );
|
1467 |
+
}
|
1468 |
Â
}
|
1469 |
Â
}
|
1470 |
Â
return $vars;
|
1471 |
Â
}
|
1472 |
Â
|
1473 |
+
/**
|
1474 |
+
* Get orderby type
|
1475 |
+
*
|
1476 |
+
* @since 1.1
|
1477 |
+
*/
|
1478 |
+
private function get_orderby_type($orderby, $post_type)
|
1479 |
+
{
|
1480 |
+
$db_columns = $this->get_stored_columns($post_type);
|
1481 |
+
|
1482 |
+
if ( $db_columns ) {
|
1483 |
+
foreach ( $db_columns as $id => $vars ) {
|
1484 |
+
|
1485 |
+
// check which custom column was clicked
|
1486 |
+
if ( isset( $vars['label'] ) && $orderby == $this->sanitize_string( $vars['label'] ) ) {
|
1487 |
+
$column[$id] = $vars;
|
1488 |
+
return $column;
|
1489 |
+
}
|
1490 |
+
}
|
1491 |
+
}
|
1492 |
+
return false;
|
1493 |
+
}
|
1494 |
+
|
1495 |
Â
/**
|
1496 |
Â
* Sanitize label
|
1497 |
Â
*
|
1506 |
Â
}
|
1507 |
Â
|
1508 |
Â
/**
|
1509 |
+
* Get plugin url.
|
1510 |
Â
*
|
1511 |
Â
* @since 1.0
|
1512 |
Â
*/
|
1515 |
Â
return plugins_url($file, __FILE__);
|
1516 |
Â
}
|
1517 |
Â
|
1518 |
+
/**
|
1519 |
+
* Checks if column-meta key exists
|
1520 |
+
*
|
1521 |
+
* @since 1.0
|
1522 |
+
*/
|
1523 |
+
private function is_column_meta( $id = '' )
|
1524 |
+
{
|
1525 |
+
if ( strpos($id, 'column-meta-') !== false )
|
1526 |
+
return true;
|
1527 |
+
|
1528 |
+
return false;
|
1529 |
+
}
|
1530 |
+
|
1531 |
Â
/**
|
1532 |
Â
* Get a thumbnail
|
1533 |
Â
*
|
1545 |
Â
$image = str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, $new);
|
1546 |
Â
|
1547 |
Â
return "<img src='{$image}' alt='' width='120' height='80' />";
|
1548 |
+
}
|
1549 |
+
|
1550 |
+
/**
|
1551 |
+
* Settings Page Template.
|
1552 |
+
*
|
1553 |
+
* This function in conjunction with others usei the WordPress
|
1554 |
+
* Settings API to create a settings page where users can adjust
|
1555 |
+
* the behaviour of this plugin.
|
1556 |
+
*
|
1557 |
+
* @since 1.0
|
1558 |
+
*/
|
1559 |
+
public function plugin_settings_page()
|
1560 |
+
{
|
1561 |
+
// loop through post types
|
1562 |
+
$rows = '';
|
1563 |
+
foreach ( $this->get_types() as $type ) {
|
1564 |
+
|
1565 |
+
// post type label
|
1566 |
+
$label = $this->get_singular_name($type);
|
1567 |
+
|
1568 |
+
// id
|
1569 |
+
$id = $this->sanitize_string($type);
|
1570 |
+
|
1571 |
+
// build draggable boxes
|
1572 |
+
$boxes = $this->get_column_boxes($type);
|
1573 |
+
|
1574 |
+
// class
|
1575 |
+
$class = $this->is_menu_type_current($type) ? ' current' : ' hidden';
|
1576 |
+
|
1577 |
+
$rows .= "
|
1578 |
+
<tr id='cpac-box-{$id}' valign='top' class='cpac-box-row{$class}'>
|
1579 |
+
<th class='cpac_post_type' scope='row'>
|
1580 |
+
{$label}
|
1581 |
+
</th>
|
1582 |
+
<td>
|
1583 |
+
<h3 class='cpac_post_type hidden'>{$label}</h3>
|
1584 |
+
{$boxes}
|
1585 |
+
</td>
|
1586 |
+
</tr>
|
1587 |
+
";
|
1588 |
+
}
|
1589 |
+
|
1590 |
+
// Post Type Menu
|
1591 |
+
$menu = $this->get_menu();
|
1592 |
+
|
1593 |
+
?>
|
1594 |
+
<div id="cpac" class="wrap">
|
1595 |
+
<?php screen_icon($this->slug) ?>
|
1596 |
+
<h2><?php _e('Codepress Admin Columns', $this->textdomain); ?></h2>
|
1597 |
+
<?php echo $menu ?>
|
1598 |
+
<div class="postbox-container" style="width:70%;">
|
1599 |
+
<div class="metabox-holder">
|
1600 |
+
<div class="meta-box-sortables">
|
1601 |
+
|
1602 |
+
<div id="general-cpac-settings" class="postbox">
|
1603 |
+
<div title="Click to toggle" class="handlediv"><br></div>
|
1604 |
+
<h3 class="hndle">
|
1605 |
+
<span><?php _e('Admin Columns', $this->textdomain ); ?></span>
|
1606 |
+
</h3>
|
1607 |
+
<div class="inside">
|
1608 |
+
<form method="post" action="options.php">
|
1609 |
+
|
1610 |
+
<?php settings_fields( 'cpac-settings-group' ); ?>
|
1611 |
+
|
1612 |
+
<table class="form-table">
|
1613 |
+
|
1614 |
+
<?php echo $rows ?>
|
1615 |
+
|
1616 |
+
<tr class="bottom" valign="top">
|
1617 |
+
<th scope="row"></th>
|
1618 |
+
<td>
|
1619 |
+
<p class="submit">
|
1620 |
+
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
1621 |
+
</p>
|
1622 |
+
</td>
|
1623 |
+
</tr>
|
1624 |
+
</table>
|
1625 |
+
</form>
|
1626 |
+
</div>
|
1627 |
+
</div><!-- general-settings -->
|
1628 |
+
|
1629 |
+
<div id="restore-cpac-settings" class="postbox">
|
1630 |
+
<div title="Click to toggle" class="handlediv"><br></div>
|
1631 |
+
<h3 class="hndle">
|
1632 |
+
<span><?php _e('Restore defaults', $this->textdomain) ?></span>
|
1633 |
+
</h3>
|
1634 |
+
<div class="inside">
|
1635 |
+
<form method="post" action="">
|
1636 |
+
<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); ?>');" />
|
1637 |
+
</form>
|
1638 |
+
<p class="description"><?php _e('This will delete all column settings and restore the default settings.', $this->textdomain); ?></p>
|
1639 |
+
</div>
|
1640 |
+
</div><!-- restore-cpac-settings -->
|
1641 |
+
|
1642 |
+
</div>
|
1643 |
+
</div>
|
1644 |
+
</div><!-- .postbox-container -->
|
1645 |
+
|
1646 |
+
<div class="postbox-container" style="width:20%;">
|
1647 |
+
<div class="metabox-holder">
|
1648 |
+
<div class="meta-box-sortables">
|
1649 |
+
|
1650 |
+
<div id="side-cpac-settings" class="postbox">
|
1651 |
+
<div title="Click to toggle" class="handlediv"><br></div>
|
1652 |
+
<h3 class="hndle">
|
1653 |
+
<span><?php _e('Need support?', $this->textdomain) ?></span>
|
1654 |
+
</h3>
|
1655 |
+
<div class="inside">
|
1656 |
+
<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>
|
1657 |
+
<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>
|
1658 |
+
</div>
|
1659 |
+
</div><!-- side-cpac-settings -->
|
1660 |
+
|
1661 |
+
</div>
|
1662 |
+
</div>
|
1663 |
+
</div><!-- .postbox-container -->
|
1664 |
+
|
1665 |
+
</div>
|
1666 |
+
<?php
|
1667 |
+
}
|
1668 |
Â
}
|
1669 |
Â
?>
|
languages/codepress-admin-columns-nl_NL.mo
CHANGED
Binary file
|
languages/codepress-admin-columns-nl_NL.po
CHANGED
@@ -3,8 +3,8 @@ 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:
|
7 |
-
"Last-Translator:
|
8 |
Â
"Language-Team: Codepress <info@codepress.nl>\n"
|
9 |
Â
"MIME-Version: 1.0\n"
|
10 |
Â
"Content-Type: text/plain; charset=UTF-8\n"
|
@@ -159,150 +159,3 @@ msgstr ""
|
|
159 |
Â
msgid "Field"
|
160 |
Â
msgstr "Veld"
|
161 |
Â
|
162 |
-
#~ msgid "Title"
|
163 |
-
#~ msgstr "Titel"
|
164 |
-
|
165 |
-
#~ msgid "Description"
|
166 |
-
#~ msgstr "Beschrijving"
|
167 |
-
|
168 |
-
#~ msgid "Latitude"
|
169 |
-
#~ msgstr "Breedtegraad"
|
170 |
-
|
171 |
-
#~ msgid "Longitude"
|
172 |
-
#~ msgstr "Lengtegraad"
|
173 |
-
|
174 |
-
#~ msgid "Width"
|
175 |
-
#~ msgstr "Breedte"
|
176 |
-
|
177 |
-
#~ msgid "Height"
|
178 |
-
#~ msgstr "Hoogte"
|
179 |
-
|
180 |
-
#~ msgid "Dynamic"
|
181 |
-
#~ msgstr "Dynamisch"
|
182 |
-
|
183 |
-
#~ msgid "Geocoder - Pronamic Google Maps"
|
184 |
-
#~ msgstr "Geocoder - Pronamic Google Maps"
|
185 |
-
|
186 |
-
#~ msgid "Number posts to geocode: %s"
|
187 |
-
#~ msgstr "Aantel berichten te geocoderen: %s"
|
188 |
-
|
189 |
-
#~ msgid "ID"
|
190 |
-
#~ msgstr "ID"
|
191 |
-
|
192 |
-
#~ msgid "Address"
|
193 |
-
#~ msgstr "Adres"
|
194 |
-
|
195 |
-
#~ msgid "Status"
|
196 |
-
#~ msgstr "Status"
|
197 |
-
|
198 |
-
#~ msgid "Location"
|
199 |
-
#~ msgstr "Locatie"
|
200 |
-
|
201 |
-
#~ msgid "Geocode"
|
202 |
-
#~ msgstr "Geocodeer"
|
203 |
-
|
204 |
-
#~ msgid "Zero results"
|
205 |
-
#~ msgstr "Geen resultaten"
|
206 |
-
|
207 |
-
#~ msgid ""
|
208 |
-
#~ "We found no geocoding results for the following %s posts, adjust them "
|
209 |
-
#~ "manually if needed."
|
210 |
-
#~ msgstr ""
|
211 |
-
#~ "We konden geen gecode resultaten vinden voor de volgende%s berichten, pas "
|
212 |
-
#~ "deze handmatig aan wanneer nodig."
|
213 |
-
|
214 |
-
#~ msgid "Configuration - Pronamic Google Maps"
|
215 |
-
#~ msgstr "Configuratie - Pronamic Google Maps"
|
216 |
-
|
217 |
-
#~ msgid "Active"
|
218 |
-
#~ msgstr "Actief"
|
219 |
-
|
220 |
-
#~ msgid "Activate Google Maps"
|
221 |
-
#~ msgstr "Activeer Google Maps"
|
222 |
-
|
223 |
-
#~ msgid "Show Google Maps"
|
224 |
-
#~ msgstr "Google Maps weergeven"
|
225 |
-
|
226 |
-
#~ msgid "Geocoder"
|
227 |
-
#~ msgstr "Geocoder"
|
228 |
-
|
229 |
-
#~ msgid "Geocode ↓"
|
230 |
-
#~ msgstr "Geocoderen ↓"
|
231 |
-
|
232 |
-
#~ msgid "Reverse Geocode ↑"
|
233 |
-
#~ msgstr "Omgekeerd geocoderen ↑"
|
234 |
-
|
235 |
-
#~ msgid "Tip: Change the zoom level and map type to your own wishes."
|
236 |
-
#~ msgstr "Tip: wijzig het zoomniveau en map type naar je eigen wens."
|
237 |
-
|
238 |
-
#~ msgid "Delete plugin"
|
239 |
-
#~ msgstr "Verwijder plugin"
|
240 |
-
|
241 |
-
#~ msgid "Warning! This will delete all Pronamic Google Maps data and options."
|
242 |
-
#~ msgstr ""
|
243 |
-
#~ "Waarschuwing! Dit zal alle Pronamic Google Maps data en opties "
|
244 |
-
#~ "verwijderen."
|
245 |
-
|
246 |
-
#~ msgid "Uninstall"
|
247 |
-
#~ msgstr "Verwijderen"
|
248 |
-
|
249 |
-
#~ msgid "Google Maps"
|
250 |
-
#~ msgstr "Google Maps"
|
251 |
-
|
252 |
-
#~ msgid "General"
|
253 |
-
#~ msgstr "Algemeen"
|
254 |
-
|
255 |
-
#~ msgid "Use this widget to add an Google Maps as a widget."
|
256 |
-
#~ msgstr "Gebruik deze widget om Google Maps toe te voegen."
|
257 |
-
|
258 |
-
#~ msgid "pixels"
|
259 |
-
#~ msgstr "pixels"
|
260 |
-
|
261 |
-
#~ msgid "percent"
|
262 |
-
#~ msgstr "procent"
|
263 |
-
|
264 |
-
#~ msgid "Search"
|
265 |
-
#~ msgstr "Zoeken"
|
266 |
-
|
267 |
-
#~ msgid "Click to toggle"
|
268 |
-
#~ msgstr "Klik om te wisselen"
|
269 |
-
|
270 |
-
#~ msgid "Donate $10, $20 or $50!"
|
271 |
-
#~ msgstr "Doneer $10, $20 of $50!"
|
272 |
-
|
273 |
-
#~ msgid ""
|
274 |
-
#~ "This plugin has cost us countless hours of work, if you use it, please "
|
275 |
-
#~ "donate a token of your appreciation!"
|
276 |
-
#~ msgstr ""
|
277 |
-
#~ "Het ons veel uren werken gekost om deze plugin te ontwikkelen, als je het "
|
278 |
-
#~ "gebruikt, doneer a.u.b. voor je waardering!"
|
279 |
-
|
280 |
-
#~ msgid "Latest news from Pronamic"
|
281 |
-
#~ msgstr "Laatste nieuws van Pronamic"
|
282 |
-
|
283 |
-
#~ msgid "no news items, feed might be broken..."
|
284 |
-
#~ msgstr "geen nieuws items, feed is waarschijnlijk niet bereikbaar..."
|
285 |
-
|
286 |
-
#~ msgid "Subscribe with RSS"
|
287 |
-
#~ msgstr "Aanmelden voor RSS"
|
288 |
-
|
289 |
-
#~ msgid "Subscribe by e-mail"
|
290 |
-
#~ msgstr "Aanmelden via e-mail"
|
291 |
-
|
292 |
-
#~ msgid "Why not do any or all of the following:"
|
293 |
-
#~ msgstr "Waarom doe je niet één van de volgende dingen:"
|
294 |
-
|
295 |
-
#~ msgid "Link to it so other folks can find out about it."
|
296 |
-
#~ msgstr "Link naar ons zodat anderen deze plugin ook ontdekken."
|
297 |
-
|
298 |
-
#~ msgid "Give it a good rating on WordPress.org."
|
299 |
-
#~ msgstr "Geef het een goede score op WordPress.org."
|
300 |
-
|
301 |
-
#~ msgid "Let other people know that it works with your WordPress setup."
|
302 |
-
#~ msgstr "Laat anderen weten dat het werk op je WordPress installatie."
|
303 |
-
|
304 |
-
#~ msgid "Found a bug?"
|
305 |
-
#~ msgstr "Bug gevonden?"
|
306 |
-
|
307 |
-
#~ msgid "Configuration"
|
308 |
-
#~ msgstr "Configuratie"
|
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: 2012-04-20 21:11+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"
|
159 |
Â
msgid "Field"
|
160 |
Â
msgstr "Veld"
|
161 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
 |