PluginProbe
WP Crontrol / trunk
WP Crontrol vtrunk
1.21.2 trunk 0.1 0.2 0.3 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.1 1.10.0 1.11.0 1.12.0 1.12.1 1.13.0 1.13.1 1.13.2 1.14.0 1.15.0 1.15.1 1.15.2 1.15.3 1.16.0 1.16.1 1.16.2 All 57 releases
wp-crontrol / src / Event / StandardEvent.php

StandardEvent.php in WP Crontrol trunk, at src/Event/StandardEvent.php

52 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Represents a standard WordPress cron event.
4 */
5
6 namespace Crontrol\Event;
7
8 use Crontrol\Context\UserContext;
9 use Crontrol\Context\FeatureContext;
10
11 use function Crontrol\json_output;
12
13 /**
14 * Represents a standard WordPress cron event.
15 */
16 final class StandardEvent extends Event {
17 #[\Override]
18 public function editable( UserContext $user, FeatureContext $features ): bool {
19 return $user->can_edit_standard_cron_events();
20 }
21
22 #[\Override]
23 public function runnable( UserContext $user, FeatureContext $features ): bool {
24 return $user->can_run_standard_cron_events()
25 && ! $this->has_error()
26 && ! $this->is_paused();
27 }
28
29 #[\Override]
30 public function deletable( UserContext $user, FeatureContext $features ): bool {
31 return $user->can_delete_standard_cron_events();
32 }
33
34 #[\Override]
35 public function pausable(): bool {
36 return true;
37 }
38
39 #[\Override]
40 public function get_args_display(): string {
41 if ( empty( $this->args ) ) {
42 return '';
43 }
44 return json_output( $this->args, false );
45 }
46
47 #[\Override]
48 public function is_enabled( FeatureContext $features ): bool {
49 return true;
50 }
51 }
52