PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.1
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.1
3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / vendor / woocommerce / action-scheduler / classes / abstracts / ActionScheduler_WPCLI_Command.php
jetformbuilder / vendor / woocommerce / action-scheduler / classes / abstracts Last commit date
ActionScheduler.php 2 months ago ActionScheduler_Abstract_ListTable.php 1 year ago ActionScheduler_Abstract_QueueRunner.php 2 months ago ActionScheduler_Abstract_RecurringSchedule.php 1 year ago ActionScheduler_Abstract_Schedule.php 1 year ago ActionScheduler_Abstract_Schema.php 1 year ago ActionScheduler_Lock.php 1 year ago ActionScheduler_Logger.php 1 year ago ActionScheduler_Store.php 1 year ago ActionScheduler_TimezoneHelper.php 1 year ago ActionScheduler_WPCLI_Command.php 1 year ago
ActionScheduler_WPCLI_Command.php
84 lines
1 <?php
2
3 /**
4 * Abstract for WP-CLI commands.
5 */
6 abstract class ActionScheduler_WPCLI_Command extends \WP_CLI_Command {
7
8 const DATE_FORMAT = 'Y-m-d H:i:s O';
9
10 /**
11 * Keyed arguments.
12 *
13 * @var string[]
14 */
15 protected $args;
16
17 /**
18 * Positional arguments.
19 *
20 * @var array<string, string>
21 */
22 protected $assoc_args;
23
24 /**
25 * Construct.
26 *
27 * @param string[] $args Positional arguments.
28 * @param array<string, string> $assoc_args Keyed arguments.
29 * @throws \Exception When loading a CLI command file outside of WP CLI context.
30 */
31 public function __construct( array $args, array $assoc_args ) {
32 if ( ! defined( 'WP_CLI' ) || ! constant( 'WP_CLI' ) ) {
33 /* translators: %s php class name */
34 throw new \Exception( sprintf( __( 'The %s class can only be run within WP CLI.', 'action-scheduler' ), get_class( $this ) ) );
35 }
36
37 $this->args = $args;
38 $this->assoc_args = $assoc_args;
39 }
40
41 /**
42 * Execute command.
43 */
44 abstract public function execute();
45
46 /**
47 * Get the scheduled date in a human friendly format.
48 *
49 * @see ActionScheduler_ListTable::get_schedule_display_string()
50 * @param ActionScheduler_Schedule $schedule Schedule.
51 * @return string
52 */
53 protected function get_schedule_display_string( ActionScheduler_Schedule $schedule ) {
54
55 $schedule_display_string = '';
56
57 if ( ! $schedule->get_date() ) {
58 return '0000-00-00 00:00:00';
59 }
60
61 $next_timestamp = $schedule->get_date()->getTimestamp();
62
63 $schedule_display_string .= $schedule->get_date()->format( static::DATE_FORMAT );
64
65 return $schedule_display_string;
66 }
67
68 /**
69 * Transforms arguments with '__' from CSV into expected arrays.
70 *
71 * @see \WP_CLI\CommandWithDBObject::process_csv_arguments_to_arrays()
72 * @link https://github.com/wp-cli/entity-command/blob/c270cc9a2367cb8f5845f26a6b5e203397c91392/src/WP_CLI/CommandWithDBObject.php#L99
73 * @return void
74 */
75 protected function process_csv_arguments_to_arrays() {
76 foreach ( $this->assoc_args as $k => $v ) {
77 if ( false !== strpos( $k, '__' ) ) {
78 $this->assoc_args[ $k ] = explode( ',', $v );
79 }
80 }
81 }
82
83 }
84