ID.php
10 years ago
actions.php
10 years ago
attachment-count.php
10 years ago
attachment.php
10 years ago
author-name.php
10 years ago
before-moretag.php
10 years ago
comment-count.php
10 years ago
comment-status.php
10 years ago
content.php
10 years ago
date-published.php
10 years ago
depth.php
10 years ago
estimated-reading-time.php
10 years ago
excerpt.php
10 years ago
featured-image.php
10 years ago
formats.php
10 years ago
last-modified-author.php
10 years ago
modified.php
10 years ago
order.php
10 years ago
page-template.php
10 years ago
parent.php
10 years ago
path.php
10 years ago
permalink.php
10 years ago
ping-status.php
10 years ago
roles.php
10 years ago
shortcodes.php
10 years ago
slug.php
10 years ago
status.php
10 years ago
sticky.php
10 years ago
title-raw.php
10 years ago
word-count.php
10 years ago
comment-status.php
57 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Column displaying whether an item is open for comments, i.e. whether users can |
| 4 | * comment on this item. |
| 5 | * |
| 6 | * @since 2.0 |
| 7 | */ |
| 8 | class CPAC_Column_Post_Comment_Status 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-comment_status'; |
| 20 | $this->properties['label'] = __( 'Comment status', 'codepress-admin-columns' ); |
| 21 | $this->properties['object_property'] = 'comment_status'; |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * @see CPAC_Column::apply_conditional() |
| 26 | * @since 2.2 |
| 27 | */ |
| 28 | function apply_conditional() { |
| 29 | |
| 30 | return post_type_supports( $this->storage_model->key, 'comments' ); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * @see CPAC_Column::get_value() |
| 35 | * @since 2.0 |
| 36 | */ |
| 37 | function get_value( $post_id ) { |
| 38 | |
| 39 | $comment_status = $this->get_raw_value( $post_id ); |
| 40 | |
| 41 | $value = $this->get_asset_image( 'no.png', $comment_status ); |
| 42 | |
| 43 | if ( 'open' == $comment_status ) { |
| 44 | $value = $this->get_asset_image( 'checkmark.png', $comment_status ); |
| 45 | } |
| 46 | |
| 47 | return $value; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * @see CPAC_Column::get_raw_value() |
| 52 | * @since 2.0.3 |
| 53 | */ |
| 54 | function get_raw_value( $post_id ) { |
| 55 | return get_post_field( 'comment_status', $post_id, 'raw' ); |
| 56 | } |
| 57 | } |