diff --git wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
index 2aa264c4..f2af213e 100644
|
|
class Plugin_Directory { |
340 | 340 | 'label_count' => _n_noop( 'Rejected <span class="count">(%s)</span>', 'Rejected <span class="count">(%s)</span>', 'wporg-plugins' ), |
341 | 341 | ) ); |
342 | 342 | |
| 343 | add_action( 'transition_post_status', array( $this, 'plugin_close_date' ), 10, 3 ); |
| 344 | |
343 | 345 | /** |
344 | 346 | * TODO |
345 | 347 | * Use register_rest_field() to add array and object meta data to the API: |
… |
… |
class Plugin_Directory { |
1302 | 1304 | |
1303 | 1305 | return $result; |
1304 | 1306 | } |
| 1307 | |
| 1308 | /** |
| 1309 | * Save the date a plugin was closed and delete that date when it's reopened. |
| 1310 | * |
| 1311 | * @param string $new_status The new plugin status. |
| 1312 | * @param string $old_status The old plugin status. |
| 1313 | * @param WP_Post $post Post data. |
| 1314 | */ |
| 1315 | public function plugin_close_date( $new_status, $old_status, $post ) { |
| 1316 | if ( in_array( $new_status, array( 'closed', 'disabled' ) ) ) { |
| 1317 | update_post_meta( $post->ID, 'plugin_closed_date', current_time( 'mysql' ) ); |
| 1318 | } |
| 1319 | if ( 'publish' === $new_status && in_array( $old_status, array( 'closed', 'disabled' ) ) ) { |
| 1320 | delete_post_meta( $post->ID, 'plugin_closed_date' ); |
| 1321 | } |
| 1322 | } |
1305 | 1323 | } |