imagify
/
inc
/
Dependencies
/
ActionScheduler
/
classes
/
data-stores
/
ActionScheduler_wpPostStore_PostStatusRegistrar.php
ActionScheduler_wpPostStore_PostStatusRegistrar.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF trunk, at inc/Dependencies/ActionScheduler/classes/data-stores/ActionScheduler_wpPostStore_PostStatusRegistrar.php
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Class ActionScheduler_wpPostStore_PostStatusRegistrar |
| 5 | * |
| 6 | * @codeCoverageIgnore |
| 7 | */ |
| 8 | class ActionScheduler_wpPostStore_PostStatusRegistrar { |
| 9 | |
| 10 | /** |
| 11 | * Registrar. |
| 12 | */ |
| 13 | public function register() { |
| 14 | register_post_status( ActionScheduler_Store::STATUS_RUNNING, array_merge( $this->post_status_args(), $this->post_status_running_labels() ) ); |
| 15 | register_post_status( ActionScheduler_Store::STATUS_FAILED, array_merge( $this->post_status_args(), $this->post_status_failed_labels() ) ); |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Build the args array for the post type definition |
| 20 | * |
| 21 | * @return array |
| 22 | */ |
| 23 | protected function post_status_args() { |
| 24 | $args = array( |
| 25 | 'public' => false, |
| 26 | 'exclude_from_search' => false, |
| 27 | 'show_in_admin_all_list' => true, |
| 28 | 'show_in_admin_status_list' => true, |
| 29 | ); |
| 30 | |
| 31 | return apply_filters( 'action_scheduler_post_status_args', $args ); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Build the args array for the post type definition |
| 36 | * |
| 37 | * @return array |
| 38 | */ |
| 39 | protected function post_status_failed_labels() { |
| 40 | $labels = array( |
| 41 | 'label' => _x( 'Failed', 'post', 'action-scheduler' ), |
| 42 | /* translators: %s: count */ |
| 43 | 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'action-scheduler' ), |
| 44 | ); |
| 45 | |
| 46 | return apply_filters( 'action_scheduler_post_status_failed_labels', $labels ); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Build the args array for the post type definition |
| 51 | * |
| 52 | * @return array |
| 53 | */ |
| 54 | protected function post_status_running_labels() { |
| 55 | $labels = array( |
| 56 | 'label' => _x( 'In-Progress', 'post', 'action-scheduler' ), |
| 57 | /* translators: %s: count */ |
| 58 | 'label_count' => _n_noop( 'In-Progress <span class="count">(%s)</span>', 'In-Progress <span class="count">(%s)</span>', 'action-scheduler' ), |
| 59 | ); |
| 60 | |
| 61 | return apply_filters( 'action_scheduler_post_status_running_labels', $labels ); |
| 62 | } |
| 63 | } |
| 64 |