Admin Columns - Version 1.1

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 Icon 128x128 Admin Columns
Version 1.1
Comparing to
See all releases

Code changes from version 1.0 to 1.1

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,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.0.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
- // 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
  }
@@ -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, '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 "
@@ -339,60 +295,62 @@ 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,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, $key, $values);
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}][{$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'>
@@ -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}][{$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 +396,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,7 +412,7 @@ 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);
@@ -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 filters
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 ( $key != 'column-meta-1') {
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}][{$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
 
@@ -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->get_wp_default_columns($post_type);
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 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 = '';
@@ -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-','',$key);
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, $key);
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, $key, true );
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, $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);
@@ -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
- 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
 
@@ -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[$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));
@@ -967,44 +996,19 @@ 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 +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 $key => $label ) {
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[$key] = array(
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
- * 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 +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] = 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 +1323,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 +1340,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 +1352,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 +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( $post_type )
1296
  {
1297
- $posttype_obj = get_post_type_object($post_type);
1298
- $label = $posttype_obj->labels->singular_name;
 
 
 
 
 
 
 
 
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
- // 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
  *
@@ -1339,7 +1506,7 @@ class Codepress_Admin_Columns
1339
  }
1340
 
1341
  /**
1342
- * Get a url to a file in this plugin.
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 = '&nbsp;';
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: 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"
@@ -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 &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"
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -3,11 +3,11 @@ 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
 
@@ -33,12 +33,13 @@ The following custom columns are supported:
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 +47,19 @@ 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
 
@@ -69,15 +81,25 @@ 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
 
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.1.1
7
 
8
  == Description ==
9
 
10
+ This plugin makes it easy to Manage Custom Columns for your Posts, Pages and Custom Post Type Screens.
11
 
12
  = Intro =
13
 
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
  * Image thumbnails
37
+ * Icons for Media Library items
38
  * Excerpt
39
  * Multiple Values
40
+ * Numeric
41
 
42
+ = Sortable Custom Columns =
43
 
44
  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:
45
 
47
  * page order
48
  * slug
49
  * page template
50
+ * custom fields
51
+
52
+ = User Columns =
53
+
54
+ You can also change the User Columns. I have added a few additional custom columns:
55
 
56
+ * User ID
57
+ * First name
58
+ * Last name
59
+ * Url
60
+ * Register date
61
+
62
+ 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>.
63
 
64
  **Related Links:**
65
 
81
 
82
  == Screenshots ==
83
 
84
+ 1. Posts Screen with custom columns.
85
+ 2. Settings page of the Codepress Admin columns plugin.
86
+ 3. Options for the Custom Field Column.
87
 
88
  == Changelog ==
89
 
90
+ = 1.1.1 =
91
+
92
+ * Bug fix: path separator for require_once
93
+ * Added word count
94
+
95
+ = 1.1 =
96
 
97
+ * Added User Columns.
98
+ * Added before / after text for custom fields
99
+ * Added custom field type 'Numeric'.
100
+ * Added custom field sortables.
101
+ * Fixed domain path
102
+ * Fixed settings link
103
 
104
  = 1.0 =
105
 
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file