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