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
status.php
63 lines
| 1 | <?php |
| 2 | /** |
| 3 | * CPAC_Column_Post_Status |
| 4 | * |
| 5 | * @since 2.0 |
| 6 | */ |
| 7 | class CPAC_Column_Post_Status extends CPAC_Column { |
| 8 | |
| 9 | private $statuses; |
| 10 | |
| 11 | /** |
| 12 | * @see CPAC_Column::init() |
| 13 | * @since 2.2.1 |
| 14 | */ |
| 15 | public function init() { |
| 16 | |
| 17 | parent::init(); |
| 18 | |
| 19 | // Properties |
| 20 | $this->properties['type'] = 'column-status'; |
| 21 | $this->properties['label'] = __( 'Status', 'codepress-admin-columns' ); |
| 22 | } |
| 23 | |
| 24 | public function get_status( $name ) { |
| 25 | $stati = $this->get_statuses(); |
| 26 | return isset( $stati[ $name ] ) ? $stati[ $name ] : false; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Get Statuses |
| 31 | */ |
| 32 | public function get_statuses() { |
| 33 | if ( empty( $this->statuses ) ) { |
| 34 | global $wp_post_statuses; |
| 35 | foreach ( $wp_post_statuses as $k => $status ) { |
| 36 | $this->statuses[ $k ] = $status->label; |
| 37 | } |
| 38 | } |
| 39 | return $this->statuses; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * @see CPAC_Column::get_value() |
| 44 | * @since 2.0 |
| 45 | */ |
| 46 | public function get_value( $post_id ) { |
| 47 | |
| 48 | $statuses = $this->get_statuses(); |
| 49 | if ( isset( $statuses['future'] ) ) { |
| 50 | $statuses['future'] .= " <p class='description'>" . date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) , strtotime( get_post_field( 'post_date', $post_id ) ) ) . "</p>"; |
| 51 | } |
| 52 | $post_status = $this->get_raw_value( $post_id ); |
| 53 | return isset( $statuses[ $post_status ] ) ? $statuses[ $post_status ] : ''; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * @see CPAC_Column::get_raw_value() |
| 58 | * @since 2.0.3 |
| 59 | */ |
| 60 | public function get_raw_value( $post_id ) { |
| 61 | return get_post_field( 'post_status', $post_id ); |
| 62 | } |
| 63 | } |