ID.php
12 years ago
actions.php
12 years ago
attachment-count.php
12 years ago
attachment.php
12 years ago
author-name.php
12 years ago
before-moretag.php
12 years ago
comment-count.php
12 years ago
comment-status.php
12 years ago
excerpt.php
12 years ago
featured-image.php
12 years ago
formats.php
12 years ago
modified.php
12 years ago
order.php
12 years ago
page-template.php
12 years ago
parent.php
12 years ago
permalink.php
12 years ago
ping-status.php
12 years ago
roles.php
12 years ago
slug.php
12 years ago
status.php
12 years ago
sticky.php
12 years ago
word-count.php
12 years ago
comment-status.php
52 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * CPAC_Column_Post_Comment_Status |
| 5 | * |
| 6 | * @since 2.0.0 |
| 7 | */ |
| 8 | class CPAC_Column_Post_Comment_Status extends CPAC_Column { |
| 9 | |
| 10 | function __construct( $storage_model ) { |
| 11 | |
| 12 | // define properties |
| 13 | $this->properties['type'] = 'column-comment_status'; |
| 14 | $this->properties['label'] = __( 'Comment status', 'cpac' ); |
| 15 | $this->properties['object_property'] = 'comment_status'; |
| 16 | |
| 17 | parent::__construct( $storage_model ); |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * @see CPAC_Column::apply_conditional() |
| 22 | * @since 2.2 |
| 23 | */ |
| 24 | function apply_conditional() { |
| 25 | |
| 26 | return post_type_supports( $this->storage_model->key, 'comments' ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * @see CPAC_Column::get_value() |
| 31 | * @since 2.0.0 |
| 32 | */ |
| 33 | function get_value( $post_id ) { |
| 34 | |
| 35 | $comment_status = $this->get_raw_value( $post_id ); |
| 36 | |
| 37 | $value = $this->get_asset_image( 'no.png', $comment_status ); |
| 38 | if ( 'open' == $comment_status ) |
| 39 | $value = $this->get_asset_image( 'checkmark.png', $comment_status ); |
| 40 | |
| 41 | return $value; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * @see CPAC_Column::get_raw_value() |
| 46 | * @since 2.0.3 |
| 47 | */ |
| 48 | function get_raw_value( $post_id ) { |
| 49 | |
| 50 | return get_post_field( 'comment_status', $post_id, 'raw' ); |
| 51 | } |
| 52 | } |