Admin Columns - Version 2.5.5

Version Description

  • [Improved] Columns with empty values will now display a dash symbol
  • [Fixed] Excerpt column: The label "Excerpt from content" will now only display when the post has content
Download this release

Release Info

Developer tschutter
Plugin Icon 128x128 Admin Columns
Version 2.5.5
Comparing to
See all releases

Code changes from version 2.5.4 to 2.5.5

assets/css/admin-column.css CHANGED
@@ -392,7 +392,6 @@
392
.cpac-column .column-form table tr td.label {
393
position: relative;
394
overflow: visible;
395
- background: #F9F9F9;
396
background: #f5f5f5;
397
border-right: 1px solid #E1E1E1;
398
vertical-align: top;
392
.cpac-column .column-form table tr td.label {
393
position: relative;
394
overflow: visible;
395
background: #f5f5f5;
396
border-right: 1px solid #E1E1E1;
397
vertical-align: top;
assets/css/column.css CHANGED
@@ -61,7 +61,7 @@ body.upload-php .tablenav.top .cpac-edit {
61
border-radius: 3px;
62
min-width: 8px;
63
padding: 0 6px;
64
- height: 20px;
65
background-color: #e9e9e9;
66
text-align: center;
67
margin-right: 7px;
61
border-radius: 3px;
62
min-width: 8px;
63
padding: 0 6px;
64
+ min-height: 20px;
65
background-color: #e9e9e9;
66
text-align: center;
67
margin-right: 7px;
assets/css/column.min.css CHANGED
@@ -1 +1 @@
1
- .actions #post-query-submit,.tablenav.top .cpac-edit{vertical-align:middle;float:left;margin-bottom:4px}.cpac-divider{display:inline-block;width:14px;height:12px;background:url(../images/square.png) 50% 7px no-repeat}.cpac-inline-info,.cpac-rounded{min-width:8px;padding:0 6px;height:20px;text-align:center}span.status-closed{color:red}.tablenav.top .cpac-edit{top:2px;display:inline-block}body.edit-tags-php .tablenav.top .cpac-edit{float:none}.cpac_status_yes{color:#46b450}.cpac_status_no{color:#dc3232}body.edit-php #delete_all{float:left;margin-right:3px}body.users-php .tablenav .actions a.add-new-h2{float:none;vertical-align:middle!important;top:2px!important}@media screen and (max-width:782px){.tablenav.top .actions{display:block!important;margin-bottom:4px}.tablenav.top .actions *{display:none}.tablenav.top .actions .cpac-edit{display:inline-block}}body.upload-php .tablenav.top .cpac-edit{float:none}.cpac-inline-info{display:inline-block;border-radius:3px;background-color:#e9e9e9;margin-right:7px;font-size:11px;font-weight:700}.cpac-rounded{display:inline-block;border-radius:10px;background-color:#e0e0e0;margin-left:7px;font-size:12px}.cpac-rounded.cpac-rounded-first{margin-left:0}.cpac-spacing{display:inline-block;margin-right:10px;margin-bottom:4px}.cpac-suffix{margin-left:8px;color:grey}.cpac-column-value-image{display:inline-block;background:0 0;margin-right:2px;overflow:hidden;max-width:100%}.rtl .cpac-column-value-image{margin-left:2px;margin-right:0}.cpac-column-value-image img{display:block;margin:0 auto}.column-column-attachment img{padding-right:5px;padding-bottom:4px}.rtl .column-column-attachment img{padding-left:5px;padding-right:0}div.cpac-color{line-height:26px}div.cpac-color span{display:block;-webkit-border-radius:3px;border-radius:3px;color:#fff;float:left;height:16px;line-height:16px;margin-right:12px;overflow:hidden;padding:4px 5px;font-size:10px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;min-width:47px;text-align:center}.rtl div.cpac-color span{float:right;margin-left:12px;margin-right:0}div.sizes span.not-available{color:#999}.button.cpac-button-action{position:relative;text-indent:9999px;margin-right:4px;padding:0 13px;overflow:hidden}.button.cpac-button-action:before{position:absolute;top:0;left:0;width:100%;height:100%;text-indent:0}.cpac-tip{display:inline-block}.qtip.qtip-tipsy{background:rgba(0,0,0,.75);font-weight:400;min-width:25px}
1
+ .actions #post-query-submit,.tablenav.top .cpac-edit{vertical-align:middle;float:left;margin-bottom:4px}.cpac-inline-info,.cpac-rounded{min-width:8px;padding:0 6px;text-align:center}.cpac-divider{display:inline-block;width:14px;height:12px;background:url(../images/square.png) 50% 7px no-repeat}span.status-closed{color:red}.tablenav.top .cpac-edit{top:2px;display:inline-block}body.edit-tags-php .tablenav.top .cpac-edit{float:none}.cpac_status_yes{color:#46b450}.cpac_status_no{color:#dc3232}body.edit-php #delete_all{float:left;margin-right:3px}body.users-php .tablenav .actions a.add-new-h2{float:none;vertical-align:middle!important;top:2px!important}@media screen and (max-width:782px){.tablenav.top .actions{display:block!important;margin-bottom:4px}.tablenav.top .actions *{display:none}.tablenav.top .actions .cpac-edit{display:inline-block}}body.upload-php .tablenav.top .cpac-edit{float:none}.cpac-inline-info{display:inline-block;border-radius:3px;min-height:20px;background-color:#e9e9e9;margin-right:7px;font-size:11px;font-weight:700}.cpac-rounded{display:inline-block;border-radius:10px;height:20px;background-color:#e0e0e0;margin-left:7px;font-size:12px}.cpac-rounded.cpac-rounded-first{margin-left:0}.cpac-spacing{display:inline-block;margin-right:10px;margin-bottom:4px}.cpac-suffix{margin-left:8px;color:grey}.cpac-column-value-image{display:inline-block;background:0 0;margin-right:2px;overflow:hidden;max-width:100%}.rtl .cpac-column-value-image{margin-left:2px;margin-right:0}.cpac-column-value-image img{display:block;margin:0 auto}.column-column-attachment img{padding-right:5px;padding-bottom:4px}.rtl .column-column-attachment img{padding-left:5px;padding-right:0}div.cpac-color{line-height:26px}div.cpac-color span{display:block;-webkit-border-radius:3px;border-radius:3px;color:#fff;float:left;height:16px;line-height:16px;margin-right:12px;overflow:hidden;padding:4px 5px;font-size:10px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;min-width:47px;text-align:center}.rtl div.cpac-color span{float:right;margin-left:12px;margin-right:0}div.sizes span.not-available{color:#999}.button.cpac-button-action{position:relative;text-indent:9999px;margin-right:4px;padding:0 13px;overflow:hidden}.button.cpac-button-action:before{position:absolute;top:0;left:0;width:100%;height:100%;text-indent:0}.cpac-tip{display:inline-block}.qtip.qtip-tipsy{background:rgba(0,0,0,.75);font-weight:400;min-width:25px}
assets/js/admin-columns.js CHANGED
@@ -1,5 +1,6 @@
1
jQuery( document ).ready( function( $ ) {
2
cpac_tooltips();
3
} );
4
5
/**
@@ -12,16 +13,30 @@ function cpac_tooltips() {
12
}
13
14
jQuery( '.cpac-tip' ).qtip( {
15
- content: {
16
- attr: 'data-tip'
17
},
18
- position: {
19
- my: 'top center',
20
- at: 'bottom center'
21
},
22
- style: {
23
- tip: true,
24
- classes: 'qtip-tipsy'
25
}
26
} );
27
}
1
jQuery( document ).ready( function( $ ) {
2
cpac_tooltips();
3
+ cpac_quickedit_events();
4
} );
5
6
/**
13
}
14
15
jQuery( '.cpac-tip' ).qtip( {
16
+ content : {
17
+ attr : 'data-tip'
18
},
19
+ position : {
20
+ my : 'top center',
21
+ at : 'bottom center'
22
},
23
+ style : {
24
+ tip : true,
25
+ classes : 'qtip-tipsy'
26
}
27
} );
28
+ }
29
+
30
+ function cpac_quickedit_events() {
31
+ var $ = jQuery;
32
+
33
+ $( document ).ajaxComplete( function( event, request, settings ) {
34
+ var $result = $( '<div>' ).append( request.responseText );
35
+ if ( $result.find( 'tr.iedit' ).length == 1 ) {
36
+ var id = $result.find( 'tr.iedit' ).attr( 'id' );
37
+ $( 'tr#' + id ).trigger( 'updated' );
38
+ }
39
+ ;
40
+
41
+ } );
42
}
assets/js/admin-columns.min.js CHANGED
@@ -1 +1 @@
1
- function cpac_tooltips(){"undefined"!=typeof jQuery.fn.qtip&&jQuery(".cpac-tip").qtip({content:{attr:"data-tip"},position:{my:"top center",at:"bottom center"},style:{tip:!0,classes:"qtip-tipsy"}})}jQuery(document).ready(function(t){cpac_tooltips()});
1
+ function cpac_tooltips(){"undefined"!=typeof jQuery.fn.qtip&&jQuery(".cpac-tip").qtip({content:{attr:"data-tip"},position:{my:"top center",at:"bottom center"},style:{tip:!0,classes:"qtip-tipsy"}})}function cpac_quickedit_events(){var t=jQuery;t(document).ajaxComplete(function(e,i,n){var c=t("<div>").append(i.responseText);if(1==c.find("tr.iedit").length){var p=c.find("tr.iedit").attr("id");t("tr#"+p).trigger("updated")}})}jQuery(document).ready(function(t){cpac_tooltips(),cpac_quickedit_events()});
classes/column.php CHANGED
@@ -103,7 +103,6 @@ class CPAC_Column {
103
* @return bool Whether the column type should be available
104
*/
105
public function apply_conditional() {
106
-
107
return true;
108
}
109
@@ -111,6 +110,10 @@ class CPAC_Column {
111
return isset( $this->properties->default ) && $this->properties->default;
112
}
113
114
/**
115
* Overwrite this function in child class.
116
* Adds (optional) scripts to the listings screen.
@@ -169,7 +172,8 @@ class CPAC_Column {
169
'hide_label' => false, // Should the Label be hidden?
170
'is_registered' => true, // Should the column be registered based on conditional logic, example usage see: 'post/page-template.php'
171
'is_cloneable' => true, // Should the column be cloneable
172
- 'default' => false, // Is this a WP default column,
173
'use_before_after' => false, // Should the column use before and after fields
174
'group' => __( 'Custom', 'codepress-admin-columns' ) // Group name
175
);
@@ -1099,15 +1103,16 @@ class CPAC_Column {
1099
* @return string Formatted date
1100
*/
1101
public function get_date( $date, $format = '' ) {
1102
-
1103
- if ( ! $date = $this->get_timestamp( $date ) ) {
1104
return false;
1105
}
1106
if ( ! $format ) {
1107
$format = get_option( 'date_format' );
1108
}
1109
1110
- return date_i18n( $format, $date );
1111
}
1112
1113
/**
@@ -1348,12 +1353,13 @@ class CPAC_Column {
1348
* @param array $options Select options
1349
* @param strong $description (optional) Description below the label
1350
*/
1351
- public function display_field_text( $name, $label, $description = '' ) {
1352
?>
1353
- <tr class="column-<?php echo $name; ?>">
1354
<?php $this->label_view( $label, $description, $name ); ?>
1355
<td class="input">
1356
- <input type="text" name="<?php $this->attr_name( $name ); ?>" id="<?php $this->attr_id( $name ); ?>" value="<?php echo esc_attr( stripslashes( $this->get_option( $name ) ) ); ?>"/>
1357
</td>
1358
</tr>
1359
<?php
103
* @return bool Whether the column type should be available
104
*/
105
public function apply_conditional() {
106
return true;
107
}
108
110
return isset( $this->properties->default ) && $this->properties->default;
111
}
112
113
+ public function is_original() {
114
+ return isset( $this->properties->original ) && $this->properties->original;
115
+ }
116
+
117
/**
118
* Overwrite this function in child class.
119
* Adds (optional) scripts to the listings screen.
172
'hide_label' => false, // Should the Label be hidden?
173
'is_registered' => true, // Should the column be registered based on conditional logic, example usage see: 'post/page-template.php'
174
'is_cloneable' => true, // Should the column be cloneable
175
+ 'default' => false, // Is this a WP default column, used for displaying values
176
+ 'original' => false, // When a default column has been replaced by custom column we mark it as 'original'
177
'use_before_after' => false, // Should the column use before and after fields
178
'group' => __( 'Custom', 'codepress-admin-columns' ) // Group name
179
);
1103
* @return string Formatted date
1104
*/
1105
public function get_date( $date, $format = '' ) {
1106
+ if ( ! $timestamp = $this->get_timestamp( $date ) ) {
1107
return false;
1108
}
1109
+
1110
+ // get general date format
1111
if ( ! $format ) {
1112
$format = get_option( 'date_format' );
1113
}
1114
1115
+ return date_i18n( $format, $timestamp );
1116
}
1117
1118
/**
1353
* @param array $options Select options
1354
* @param strong $description (optional) Description below the label
1355
*/
1356
+ public function display_field_text( $name, $label, $description = '', $placeholder = '', $optional_toggle_id = '' ) {
1357
+ $data_optional = $optional_toggle_id ? ' data-additional-option-id="' . $this->get_attr_id( $optional_toggle_id ) . '"' : '';
1358
?>
1359
+ <tr class="column-<?php echo $name; ?>"<?php echo $data_optional; ?>>
1360
<?php $this->label_view( $label, $description, $name ); ?>
1361
<td class="input">
1362
+ <input type="text" name="<?php $this->attr_name( $name ); ?>" id="<?php $this->attr_id( $name ); ?>" value="<?php echo esc_attr( stripslashes( $this->get_option( $name ) ) ); ?>"<?php echo $placeholder ? ' placeholder="' . esc_attr( $placeholder ) . '"' : ''; ?>/>
1363
</td>
1364
</tr>
1365
<?php
classes/column/default.php CHANGED
@@ -20,6 +20,7 @@ class CPAC_Column_Default extends CPAC_Column {
20
$this->properties['type'] = 'column-default';
21
$this->properties['handle'] = NULL;
22
$this->properties['group'] = __( 'Default', 'codepress-admin-columns' );
23
}
24
25
/**
20
$this->properties['type'] = 'column-default';
21
$this->properties['handle'] = NULL;
22
$this->properties['group'] = __( 'Default', 'codepress-admin-columns' );
23
+ $this->properties['original'] = true;
24
}
25
26
/**
classes/column/media/available-sizes.php CHANGED
@@ -7,44 +7,35 @@
7
*/
8
class CPAC_Column_Media_Available_Sizes extends CPAC_Column {
9
10
- /**
11
- * @see CPAC_Column::init()
12
- * @since 2.2.1
13
- */
14
public function init() {
15
-
16
parent::init();
17
18
- // Properties
19
- $this->properties['type'] = 'column-available_sizes';
20
- $this->properties['label'] = __( 'Available Sizes', 'codepress-admin-columns' );
21
}
22
23
- /**
24
- * @see CPAC_Column::get_value()
25
- * @since 2.0
26
- */
27
function get_value( $id ) {
28
$paths = array();
29
30
$meta = get_post_meta( $id, '_wp_attachment_metadata', true );
31
32
- if ( ! isset( $meta['sizes'] ) )
33
- return false;
34
35
// available sizes
36
if ( $intersect = array_intersect( array_keys( $meta['sizes'] ), get_intermediate_image_sizes() ) ) {
37
38
- $url = wp_get_attachment_url( $id );
39
- $filename = basename( $url );
40
- $paths[] = "<a title='{$filename}' href='{$url}'>" . __( 'full size', 'codepress-admin-columns' ) . "</a>";
41
42
foreach ( $intersect as $size ) {
43
$src = wp_get_attachment_image_src( $id, $size );
44
45
if ( ! empty( $src[0] ) ) {
46
- $filename = basename( $src[0] );
47
- $paths[] = "<a title='{$filename}' href='{$src[0]}' class='available'>{$size}</a>";
48
}
49
}
50
}
@@ -57,8 +48,8 @@ class CPAC_Column_Media_Available_Sizes extends CPAC_Column {
57
}
58
59
// image does not have these additional sizes rendered yet
60
- if ( $missing = array_diff( array_keys( $_wp_additional_image_sizes), array_keys( $meta['sizes'] ) ) ) {
61
- foreach ( $missing as $size ) {
62
$paths[] = "<span title='Missing size: Try regenerate thumbnails with the plugin: Force Regenerate Thumbnails' href='javascript:;' class='not-available'>{$size}</span>";
63
}
64
}
7
*/
8
class CPAC_Column_Media_Available_Sizes extends CPAC_Column {
9
10
public function init() {
11
parent::init();
12
13
+ $this->properties['type'] = 'column-available_sizes';
14
+ $this->properties['label'] = __( 'Available Sizes', 'codepress-admin-columns' );
15
}
16
17
function get_value( $id ) {
18
$paths = array();
19
20
$meta = get_post_meta( $id, '_wp_attachment_metadata', true );
21
22
+ if ( ! isset( $meta['sizes'] ) ) {
23
+ return $this->get_empty_char();
24
+ }
25
26
// available sizes
27
if ( $intersect = array_intersect( array_keys( $meta['sizes'] ), get_intermediate_image_sizes() ) ) {
28
29
+ $url = wp_get_attachment_url( $id );
30
+ $filename = basename( $url );
31
+ $paths[] = "<a title='{$filename}' href='{$url}'>" . __( 'full size', 'codepress-admin-columns' ) . "</a>";
32
33
foreach ( $intersect as $size ) {
34
$src = wp_get_attachment_image_src( $id, $size );
35
36
if ( ! empty( $src[0] ) ) {
37
+ $filename = basename( $src[0] );
38
+ $paths[] = "<a title='{$filename}' href='{$src[0]}' class='available'>{$size}</a>";
39
}
40
}
41
}
48
}
49
50
// image does not have these additional sizes rendered yet
51
+ if ( $missing = array_diff( array_keys( $_wp_additional_image_sizes ), array_keys( $meta['sizes'] ) ) ) {
52
+ foreach ( $missing as $size ) {
53
$paths[] = "<span title='Missing size: Try regenerate thumbnails with the plugin: Force Regenerate Thumbnails' href='javascript:;' class='not-available'>{$size}</span>";
54
}
55
}
classes/column/media/dimensions.php CHANGED
@@ -7,26 +7,15 @@
7
*/
8
class CPAC_Column_Media_Dimensions extends CPAC_Column {
9
10
- /**
11
- * @see CPAC_Column::init()
12
- * @since 2.2.1
13
- */
14
public function init() {
15
-
16
parent::init();
17
18
- // Properties
19
$this->properties['type'] = 'column-dimensions';
20
$this->properties['label'] = __( 'Dimensions', 'codepress-admin-columns' );
21
}
22
23
- /**
24
- * @see CPAC_Column::get_value()
25
- * @since 2.0
26
- */
27
public function get_value( $id ) {
28
-
29
- $value = '';
30
31
$meta = $this->get_raw_value( $id );
32
@@ -37,12 +26,7 @@ class CPAC_Column_Media_Dimensions extends CPAC_Column {
37
return $value;
38
}
39
40
- /**
41
- * @see CPAC_Column::get_raw_value()
42
- * @since 2.3.2
43
- */
44
public function get_raw_value( $id ) {
45
-
46
return get_post_meta( $id, '_wp_attachment_metadata', true );
47
}
48
}
7
*/
8
class CPAC_Column_Media_Dimensions extends CPAC_Column {
9
10
public function init() {
11
parent::init();
12
13
$this->properties['type'] = 'column-dimensions';
14
$this->properties['label'] = __( 'Dimensions', 'codepress-admin-columns' );
15
}
16
17
public function get_value( $id ) {
18
+ $value = $this->get_empty_char();
19
20
$meta = $this->get_raw_value( $id );
21
26
return $value;
27
}
28
29
public function get_raw_value( $id ) {
30
return get_post_meta( $id, '_wp_attachment_metadata', true );
31
}
32
}
classes/column/media/exif-data.php CHANGED
@@ -1,4 +1,5 @@
1
<?php
2
/**
3
* CPAC_Column_Media_File_Size
4
*
@@ -15,12 +16,12 @@ class CPAC_Column_Media_Exif_Data extends CPAC_Column {
15
parent::init();
16
17
// Properties
18
- $this->properties['type'] = 'column-exif_data';
19
- $this->properties['label'] = __( 'EXIF data', 'codepress-admin-columns' );
20
- $this->properties['is_cloneable'] = true;
21
22
// Options
23
- $this->options['exif_datatype'] = '';
24
}
25
26
/**
@@ -35,22 +36,21 @@ class CPAC_Column_Media_Exif_Data extends CPAC_Column {
35
private function get_exif_types() {
36
37
$exif_types = array(
38
- 'aperture' => __( 'Aperture', 'codepress-admin-columns' ),
39
- 'credit' => __( 'Credit', 'codepress-admin-columns' ),
40
- 'camera' => __( 'Camera', 'codepress-admin-columns' ),
41
- 'caption' => __( 'Caption', 'codepress-admin-columns' ),
42
- 'created_timestamp' => __( 'Timestamp', 'codepress-admin-columns' ),
43
- 'copyright' => __( 'Copyright EXIF', 'codepress-admin-columns' ),
44
- 'focal_length' => __( 'Focal Length', 'codepress-admin-columns' ),
45
- 'iso' => __( 'ISO', 'codepress-admin-columns' ),
46
- 'shutter_speed' => __( 'Shutter Speed', 'codepress-admin-columns' ),
47
- 'title' => __( 'Title', 'codepress-admin-columns' ),
48
);
49
50
return $exif_types;
51
}
52
53
-
54
/**
55
* @see CPAC_Column::get_value()
56
* @since 2.0
@@ -59,55 +59,39 @@ class CPAC_Column_Media_Exif_Data extends CPAC_Column {
59
60
$value = '';
61
62
- $data = $this->options->exif_datatype;
63
$meta = $this->get_raw_value( $id );
64
65
if ( isset( $meta['image_meta'][ $data ] ) ) {
66
$value = $meta['image_meta'][ $data ];
67
68
if ( 'created_timestamp' == $data ) {
69
- $value = date_i18n( get_option('date_format') . ' ' . get_option('time_format') , strtotime( $value ) );
70
}
71
}
72
73
return $value;
74
}
75
76
- /**
77
- * @see CPAC_Column::get_raw_value()
78
- * @since 2.0
79
- */
80
public function get_raw_value( $id ) {
81
-
82
return get_post_meta( $id, '_wp_attachment_metadata', true );
83
}
84
85
- /**
86
- * @see CPAC_Column::apply_conditional()
87
- * @since 2.0
88
- */
89
public function apply_conditional() {
90
-
91
return function_exists( 'exif_read_data' );
92
}
93
94
- /**
95
- * Display Settings
96
- *
97
- * @see CPAC_Column::display_settings()
98
- * @since 2.0
99
- */
100
- public function display_settings() {
101
-
102
- ?>
103
-
104
<tr class="column-exif-data">
105
<?php $this->label_view( $this->properties->label, '', 'exif_datatype' ); ?>
106
<td class="input">
107
<select name="<?php $this->attr_name( 'exif_datatype' ); ?>" id="<?php $this->attr_id( 'exif_datatype' ); ?>">
108
- <?php foreach ( $this->get_exif_types() as $key => $label ) : ?>
109
- <option value="<?php echo $key; ?>"<?php selected( $key, $this->options->exif_datatype ) ?>><?php echo $label; ?></option>
110
- <?php endforeach; ?>
111
</select>
112
</td>
113
</tr>
1
<?php
2
+
3
/**
4
* CPAC_Column_Media_File_Size
5
*
16
parent::init();
17
18
// Properties
19
+ $this->properties['type'] = 'column-exif_data';
20
+ $this->properties['label'] = __( 'EXIF data', 'codepress-admin-columns' );
21
+ $this->properties['is_cloneable'] = true;
22
23
// Options
24
+ $this->options['exif_datatype'] = '';
25
}
26
27
/**
36
private function get_exif_types() {
37
38
$exif_types = array(
39
+ 'aperture' => __( 'Aperture', 'codepress-admin-columns' ),
40
+ 'credit' => __( 'Credit', 'codepress-admin-columns' ),
41
+ 'camera' => __( 'Camera', 'codepress-admin-columns' ),
42
+ 'caption' => __( 'Caption', 'codepress-admin-columns' ),
43
+ 'created_timestamp' => __( 'Timestamp', 'codepress-admin-columns' ),
44
+ 'copyright' => __( 'Copyright EXIF', 'codepress-admin-columns' ),
45
+ 'focal_length' => __( 'Focal Length', 'codepress-admin-columns' ),
46
+ 'iso' => __( 'ISO', 'codepress-admin-columns' ),
47
+ 'shutter_speed' => __( 'Shutter Speed', 'codepress-admin-columns' ),
48
+ 'title' => __( 'Title', 'codepress-admin-columns' ),
49
);
50
51
return $exif_types;
52
}
53
54
/**
55
* @see CPAC_Column::get_value()
56
* @since 2.0
59
60
$value = '';
61
62
+ $data = $this->get_option( 'exif_datatype' );
63
$meta = $this->get_raw_value( $id );
64
65
if ( isset( $meta['image_meta'][ $data ] ) ) {
66
$value = $meta['image_meta'][ $data ];
67
68
if ( 'created_timestamp' == $data ) {
69
+ $value = date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $value ) );
70
}
71
}
72
+ if ( empty( $value ) ) {
73
+ $value = $this->get_empty_char();
74
+ }
75
76
return $value;
77
}
78
79
public function get_raw_value( $id ) {
80
return get_post_meta( $id, '_wp_attachment_metadata', true );
81
}
82
83
public function apply_conditional() {
84
return function_exists( 'exif_read_data' );
85
}
86
87
+ public function display_settings() { ?>
88
<tr class="column-exif-data">
89
<?php $this->label_view( $this->properties->label, '', 'exif_datatype' ); ?>
90
<td class="input">
91
<select name="<?php $this->attr_name( 'exif_datatype' ); ?>" id="<?php $this->attr_id( 'exif_datatype' ); ?>">
92
+ <?php foreach ( $this->get_exif_types() as $key => $label ) : ?>
93
+ <option value="<?php echo $key; ?>"<?php selected( $key, $this->get_option( 'exif_datatype' ) ); ?>><?php echo $label; ?></option>
94
+ <?php endforeach; ?>
95
</select>
96
</td>
97
</tr>
classes/column/post/content.php CHANGED
@@ -11,15 +11,12 @@ class CPAC_Column_Post_Content extends CPAC_Column {
11
* @since 2.4
12
*/
13
public function init() {
14
-
15
parent::init();
16
17
- // Properties
18
$this->properties['type'] = 'column-content';
19
$this->properties['label'] = __( 'Content', 'codepress-admin-columns' );
20
$this->properties['object_property'] = 'post_content';
21
22
- // Options
23
$this->options['excerpt_length'] = 30;
24
}
25
@@ -28,7 +25,6 @@ class CPAC_Column_Post_Content extends CPAC_Column {
28
* @since 2.4
29
*/
30
public function get_value( $post_id ) {
31
-
32
return $this->get_shortened_string( $this->get_raw_value( $post_id ), $this->options->excerpt_length );
33
}
34
@@ -37,7 +33,6 @@ class CPAC_Column_Post_Content extends CPAC_Column {
37
* @since 2.4
38
*/
39
public function get_raw_value( $post_id ) {
40
-
41
return get_post_field( 'post_content', $post_id, 'raw' );
42
}
43
@@ -46,7 +41,6 @@ class CPAC_Column_Post_Content extends CPAC_Column {
46
* @since 2.4
47
*/
48
public function display_settings() {
49
-
50
$this->display_field_excerpt_length();
51
}
52
}
11
* @since 2.4
12
*/
13
public function init() {
14
parent::init();
15
16
$this->properties['type'] = 'column-content';
17
$this->properties['label'] = __( 'Content', 'codepress-admin-columns' );
18
$this->properties['object_property'] = 'post_content';
19
20
$this->options['excerpt_length'] = 30;
21
}
22
25
* @since 2.4
26
*/
27
public function get_value( $post_id ) {
28
return $this->get_shortened_string( $this->get_raw_value( $post_id ), $this->options->excerpt_length );
29
}
30
33
* @since 2.4
34
*/
35
public function get_raw_value( $post_id ) {
36
return get_post_field( 'post_content', $post_id, 'raw' );
37
}
38
41
* @since 2.4
42
*/
43
public function display_settings() {
44
$this->display_field_excerpt_length();
45
}
46
}
classes/column/post/excerpt.php CHANGED
@@ -12,15 +12,12 @@ class CPAC_Column_Post_Excerpt extends CPAC_Column {
12
* @since 2.2.1
13
*/
14
public function init() {
15
-
16
parent::init();
17
18
- // Properties
19
$this->properties['type'] = 'column-excerpt';
20
$this->properties['label'] = __( 'Excerpt', 'codepress-admin-columns' );
21
$this->properties['object_property'] = 'post_excerpt';
22
23
- // Options
24
$this->options['excerpt_length'] = 30;
25
}
26
@@ -29,9 +26,8 @@ class CPAC_Column_Post_Excerpt extends CPAC_Column {
29
* @since 2.0
30
*/
31
public function get_value( $post_id ) {
32
-
33
$value = $this->get_post_excerpt( $post_id, $this->options->excerpt_length );
34
- if ( ! has_excerpt( $post_id ) ) {
35
$value = '<span class="cpac-inline-info">' . __( 'Excerpt from content', 'codepress-admin-columns' ) . '</span> ' . $value;
36
}
37
@@ -43,7 +39,6 @@ class CPAC_Column_Post_Excerpt extends CPAC_Column {
43
* @since 2.0.3
44
*/
45
public function get_raw_value( $post_id ) {
46
-
47
return get_post_field( 'post_excerpt', $post_id, 'raw' );
48
}
49
@@ -52,7 +47,6 @@ class CPAC_Column_Post_Excerpt extends CPAC_Column {
52
* @since 2.0
53
*/
54
public function display_settings() {
55
-
56
$this->display_field_excerpt_length();
57
}
58
}
12
* @since 2.2.1
13
*/
14
public function init() {
15
parent::init();
16
17
$this->properties['type'] = 'column-excerpt';
18
$this->properties['label'] = __( 'Excerpt', 'codepress-admin-columns' );
19
$this->properties['object_property'] = 'post_excerpt';
20
21
$this->options['excerpt_length'] = 30;
22
}
23
26
* @since 2.0
27
*/
28
public function get_value( $post_id ) {
29
$value = $this->get_post_excerpt( $post_id, $this->options->excerpt_length );
30
+ if ( ! has_excerpt( $post_id ) && $value ) {
31
$value = '<span class="cpac-inline-info">' . __( 'Excerpt from content', 'codepress-admin-columns' ) . '</span> ' . $value;
32
}
33
39
* @since 2.0.3
40
*/
41
public function get_raw_value( $post_id ) {
42
return get_post_field( 'post_excerpt', $post_id, 'raw' );
43
}
44
47
* @since 2.0
48
*/
49
public function display_settings() {
50
$this->display_field_excerpt_length();
51
}
52
}
classes/column/post/modified.php CHANGED
@@ -6,55 +6,34 @@
6
*/
7
class CPAC_Column_Post_Modified extends CPAC_Column {
8
9
- /**
10
- * @see CPAC_Column::init()
11
- * @since 2.2.1
12
- */
13
public function init() {
14
-
15
parent::init();
16
17
- // Properties
18
$this->properties['type'] = 'column-modified';
19
$this->properties['label'] = __( 'Last modified', 'codepress-admin-columns' );
20
21
- // Options
22
$this->options['date_format'] = '';
23
}
24
25
- /**
26
- * @see CPAC_Column::get_value()
27
- * @since 2.0
28
- */
29
public function get_value( $post_id ) {
30
-
31
$modified = $this->get_raw_value( $post_id );
32
33
- if ( ! $this->options->date_format ) {
34
- return $this->get_date( $modified ) . ' ' . $this->get_time( $modified );
35
}
36
37
- return date( $this->options->date_format, strtotime( $modified ) );
38
}
39
40
- /**
41
- * @see CPAC_Column::get_raw_value()
42
- * @since 2.0.3
43
- */
44
public function get_raw_value( $post_id ) {
45
-
46
- $p = get_post( $post_id );
47
-
48
- return $p->post_modified;
49
}
50
51
- /**
52
- * @see CPAC_Column::display_settings()
53
- * @since 2.2.7
54
- */
55
function display_settings() {
56
-
57
$this->display_field_date_format();
58
}
59
-
60
}
6
*/
7
class CPAC_Column_Post_Modified extends CPAC_Column {
8
9
public function init() {
10
parent::init();
11
12
$this->properties['type'] = 'column-modified';
13
$this->properties['label'] = __( 'Last modified', 'codepress-admin-columns' );
14
15
$this->options['date_format'] = '';
16
}
17
18
public function get_value( $post_id ) {
19
$modified = $this->get_raw_value( $post_id );
20
+ $date_format = $this->get_option( 'date_format' );
21
22
+ if ( ! $date_format ) {
23
+ $value = $this->get_date( $modified ) . ' ' . $this->get_time( $modified );
24
+ }
25
+ else {
26
+ $value = date_i18n( $date_format, strtotime( $modified ) );
27
}
28
29
+ return $value;
30
}
31
32
public function get_raw_value( $post_id ) {
33
+ return get_post_field( 'post_modified', $post_id );
34
}
35
36
function display_settings() {
37
$this->display_field_date_format();
38
}
39
}
classes/column/taxonomy.php CHANGED
@@ -1,4 +1,5 @@
1
<?php
2
/**
3
* Taxonomy column, displaying terms from a taxonomy for any object type (i.e. posts)
4
* supporting WordPress' native way of handling terms.
@@ -7,21 +8,16 @@
7
*/
8
class CPAC_Column_Taxonomy extends CPAC_Column {
9
10
- /**
11
- * @see CPAC_Column::init()
12
- * @since 2.2.1
13
- */
14
public function init() {
15
-
16
parent::init();
17
18
// Properties
19
- $this->properties['type'] = 'column-taxonomy';
20
- $this->properties['label'] = __( 'Taxonomy', 'codepress-admin-columns' );
21
- $this->properties['is_cloneable'] = true;
22
23
// Options
24
- $this->options['taxonomy'] = ''; // Taxonomy slug
25
}
26
27
/**
@@ -30,7 +26,8 @@ class CPAC_Column_Taxonomy extends CPAC_Column {
30
*/
31
public function get_value( $post_id ) {
32
$term_ids = $this->get_raw_value( $post_id );
33
- return $this->get_terms_for_display( $term_ids, $this->options->taxonomy );
34
}
35
36
/**
@@ -38,7 +35,7 @@ class CPAC_Column_Taxonomy extends CPAC_Column {
38
* @since 2.0.3
39
*/
40
public function get_raw_value( $post_id ) {
41
- return wp_get_post_terms( $post_id, $this->options->taxonomy, array( 'fields' => 'ids' ) );
42
}
43
44
/**
@@ -46,7 +43,7 @@ class CPAC_Column_Taxonomy extends CPAC_Column {
46
* @since 2.3.4
47
*/
48
public function get_taxonomy() {
49
- return $this->options->taxonomy;
50
}
51
52
/**
@@ -69,7 +66,6 @@ class CPAC_Column_Taxonomy extends CPAC_Column {
69
* @since 2.0
70
*/
71
public function display_settings() {
72
-
73
$taxonomies = get_object_taxonomies( $this->get_post_type(), 'objects' );
74
75
foreach ( $taxonomies as $index => $taxonomy ) {
@@ -83,9 +79,9 @@ class CPAC_Column_Taxonomy extends CPAC_Column {
83
<?php $this->label_view( __( "Taxonomy", 'codepress-admin-columns' ), '', 'taxonomy' ); ?>
84
<td class="input">
85
<select name="<?php $this->attr_name( 'taxonomy' ); ?>" id="<?php $this->attr_id( 'taxonomy' ); ?>">
86
- <?php foreach ( $taxonomies as $taxonomy ) : ?>
87
- <option value="<?php echo $taxonomy->name; ?>"<?php selected( $taxonomy->name, $this->options->taxonomy ) ?>><?php echo $taxonomy->label; ?></option>
88
- <?php endforeach; ?>
89
</select>
90
</td>
91
</tr>
1
<?php
2
+
3
/**
4
* Taxonomy column, displaying terms from a taxonomy for any object type (i.e. posts)
5
* supporting WordPress' native way of handling terms.
8
*/
9
class CPAC_Column_Taxonomy extends CPAC_Column {
10
11
public function init() {
12
parent::init();
13
14
// Properties
15
+ $this->properties['type'] = 'column-taxonomy';
16
+ $this->properties['label'] = __( 'Taxonomy', 'codepress-admin-columns' );
17
+ $this->properties['is_cloneable'] = true;
18
19
// Options
20
+ $this->options['taxonomy'] = ''; // Taxonomy slug
21
}
22
23
/**
26
*/
27
public function get_value( $post_id ) {
28
$term_ids = $this->get_raw_value( $post_id );
29
+
30
+ return $this->get_terms_for_display( $term_ids, $this->get_taxonomy() );
31
}
32
33
/**
35
* @since 2.0.3
36
*/
37
public function get_raw_value( $post_id ) {
38
+ return wp_get_post_terms( $post_id, $this->get_taxonomy(), array( 'fields' => 'ids' ) );
39
}
40
41
/**
43
* @since 2.3.4
44
*/
45
public function get_taxonomy() {
46
+ return $this->get_option( 'taxonomy' );
47
}
48
49
/**
66
* @since 2.0
67
*/
68
public function display_settings() {
69
$taxonomies = get_object_taxonomies( $this->get_post_type(), 'objects' );
70
71
foreach ( $taxonomies as $index => $taxonomy ) {
79
<?php $this->label_view( __( "Taxonomy", 'codepress-admin-columns' ), '', 'taxonomy' ); ?>
80
<td class="input">
81
<select name="<?php $this->attr_name( 'taxonomy' ); ?>" id="<?php $this->attr_id( 'taxonomy' ); ?>">
82
+ <?php foreach ( $taxonomies as $taxonomy ) : ?>
83
+ <option value="<?php echo $taxonomy->name; ?>"<?php selected( $taxonomy->name, $this->get_taxonomy() ) ?>><?php echo $taxonomy->label; ?></option>
84
+ <?php endforeach; ?>
85
</select>
86
</td>
87
</tr>
classes/storage_model.php CHANGED
@@ -175,18 +175,6 @@ abstract class CPAC_Storage_Model {
175
$default_columns = $this->get_default_column_headings();
176
}
177
178
- // Custom columns
179
- foreach ( $this->columns_filepath as $classname => $path ) {
180
- include_once $path;
181
- if ( class_exists( $classname, false ) ) {
182
- $column = new $classname( $this->key );
183
-
184
- if ( $column->is_registered() ) {
185
- $column_types[ $column->get_type() ] = $column;
186
- }
187
- }
188
- }
189
-
190
// Default columns
191
if ( $default_columns ) {
192
@@ -228,6 +216,18 @@ abstract class CPAC_Storage_Model {
228
}
229
}
230
231
$this->column_types = $column_types;
232
233
// @since 2.5
@@ -243,10 +243,9 @@ abstract class CPAC_Storage_Model {
243
*/
244
private function get_default_colummn_types() {
245
$defaults = array();
246
- $default_columns = $this->get_default_stored_columns();
247
248
foreach ( $this->get_column_types() as $type => $column ) {
249
- if ( $column->is_default() || ( $default_columns && in_array( $type, array_keys( $default_columns ) ) ) ) {
250
$defaults[ $type ] = $column;
251
}
252
}
175
$default_columns = $this->get_default_column_headings();
176
}
177
178
// Default columns
179
if ( $default_columns ) {
180
216
}
217
}
218
219
+ // Custom columns
220
+ foreach ( $this->columns_filepath as $classname => $path ) {
221
+ include_once $path;
222
+ if ( class_exists( $classname, false ) ) {
223
+ $column = new $classname( $this->key );
224
+
225
+ if ( $column->is_registered() ) {
226
+ $column_types[ $column->get_type() ] = $column;
227
+ }
228
+ }
229
+ }
230
+
231
$this->column_types = $column_types;
232
233
// @since 2.5
243
*/
244
private function get_default_colummn_types() {
245
$defaults = array();
246
247
foreach ( $this->get_column_types() as $type => $column ) {
248
+ if ( $column->is_default() || $column->is_original() ) {
249
$defaults[ $type ] = $column;
250
}
251
}
codepress-admin-columns.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/*
3
Plugin Name: Admin Columns
4
- Version: 2.5.4
5
Description: Customize columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
6
Author: AdminColumns.com
7
Author URI: https://www.admincolumns.com
@@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
32
}
33
34
// Plugin information
35
- define( 'CPAC_VERSION', '2.5.4' ); // Current plugin version
36
define( 'CPAC_UPGRADE_VERSION', '2.0.0' ); // Latest version which requires an upgrade
37
define( 'CPAC_URL', plugin_dir_url( __FILE__ ) );
38
define( 'CPAC_DIR', plugin_dir_path( __FILE__ ) );
@@ -127,6 +127,7 @@ class CPAC {
127
add_action( 'wp_loaded', array( $this, 'after_setup' ) ); // Setup callback, important to load after set_storage_models
128
add_action( 'admin_enqueue_scripts', array( $this, 'scripts' ) );
129
add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 1, 2 );
130
131
// Populating columns
132
add_action( 'admin_init', array( $this, 'set_columns' ) );
@@ -164,6 +165,11 @@ class CPAC {
164
* @param CPAC $cpac_instance Main Admin Columns plugin class instance
165
*/
166
do_action( 'cac/loaded', $this );
167
}
168
169
/**
@@ -186,7 +192,7 @@ class CPAC {
186
wp_register_style( 'jquery-qtip2', CPAC_URL . "external/qtip2/jquery.qtip{$minified}.css", array(), CPAC_VERSION, 'all' );
187
wp_register_style( 'cpac-columns', CPAC_URL . "assets/css/column{$minified}.css", array(), CPAC_VERSION, 'all' );
188
189
- if ( $this->is_columns_screen() ) {
190
add_filter( 'admin_body_class', array( $this, 'admin_class' ) );
191
add_action( 'admin_head', array( $this, 'admin_scripts' ) );
192
@@ -208,6 +214,19 @@ class CPAC {
208
}
209
}
210
211
/**
212
* Get registered storage models
213
*
1
<?php
2
/*
3
Plugin Name: Admin Columns
4
+ Version: 2.5.5
5
Description: Customize columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
6
Author: AdminColumns.com
7
Author URI: https://www.admincolumns.com
32
}
33
34
// Plugin information
35
+ define( 'CPAC_VERSION', '2.5.5' ); // Current plugin version
36
define( 'CPAC_UPGRADE_VERSION', '2.0.0' ); // Latest version which requires an upgrade
37
define( 'CPAC_URL', plugin_dir_url( __FILE__ ) );
38
define( 'CPAC_DIR', plugin_dir_path( __FILE__ ) );
127
add_action( 'wp_loaded', array( $this, 'after_setup' ) ); // Setup callback, important to load after set_storage_models
128
add_action( 'admin_enqueue_scripts', array( $this, 'scripts' ) );
129
add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 1, 2 );
130
+ add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ), 20, 1 );
131
132
// Populating columns
133
add_action( 'admin_init', array( $this, 'set_columns' ) );
165
* @param CPAC $cpac_instance Main Admin Columns plugin class instance
166
*/
167
do_action( 'cac/loaded', $this );
168
+
169
+ // Current listings page storage model
170
+ if ( $storage_model = $this->get_current_storage_model() ) {
171
+ do_action( 'cac/current_storage_model', $storage_model );
172
+ }
173
}
174
175
/**
192
wp_register_style( 'jquery-qtip2', CPAC_URL . "external/qtip2/jquery.qtip{$minified}.css", array(), CPAC_VERSION, 'all' );
193
wp_register_style( 'cpac-columns', CPAC_URL . "assets/css/column{$minified}.css", array(), CPAC_VERSION, 'all' );
194
195
+ if ( $this->get_current_storage_model() ) {
196
add_filter( 'admin_body_class', array( $this, 'admin_class' ) );
197
add_action( 'admin_head', array( $this, 'admin_scripts' ) );
198
214
}
215
}
216
217
+ /**
218
+ * Set the primary columns for the Admin Columns columns
219
+ *
220
+ * @since 2.5.5
221
+ */
222
+ public function set_primary_column( $default ) {
223
+ if ( $storage_model = $this->get_current_storage_model() ) {
224
+ $default = key( $storage_model->get_columns() );
225
+ }
226
+
227
+ return $default;
228
+ }
229
+
230
/**
231
* Get registered storage models
232
*
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
Tags: plugins, wordpress, admin, column, columns, custom columns, custom fields, image, dashboard, sortable, filters, posts, media, users, pages, posttypes, manage columns, wp-admin
5
Requires at least: 3.5
6
Tested up to: 4.4.2
7
- Stable tag: 2.5.4
8
9
Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
10
@@ -210,6 +210,13 @@ You can find a list of the available actions and filters (and examples on how to
210
211
== Changelog ==
212
213
= 2.5.4 =
214
* [Fixed] Edit columns button will be positioned correctly on the Trash page
215
* [Fixed] Obsolete images have been removed
4
Tags: plugins, wordpress, admin, column, columns, custom columns, custom fields, image, dashboard, sortable, filters, posts, media, users, pages, posttypes, manage columns, wp-admin
5
Requires at least: 3.5
6
Tested up to: 4.4.2
7
+ Stable tag: 2.5.5
8
9
Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
10
210
211
== Changelog ==
212
213
+ = 2.5.5 =
214
+ * [Improved] Columns with empty values will now display a dash symbol
215
+ * [Fixed] Excerpt column: The label "Excerpt from content" will now only display when the post has content
216
+
217
+ = 2.5.4.1 =
218
+ * [Fixed] Columns can be marked as original, in case the default has been replaced by an ac-column
219
+
220
= 2.5.4 =
221
* [Fixed] Edit columns button will be positioned correctly on the Trash page
222
* [Fixed] Obsolete images have been removed