Completed
Push — master ( 63c971...dbb080 )
by Brian
19s queued 16s
created
includes/libraries/action-scheduler/classes/ActionScheduler_ActionClaim.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 	private $id = '';
8 8
 	private $action_ids = array();
9 9
 
10
-	public function __construct( $id, array $action_ids ) {
10
+	public function __construct($id, array $action_ids) {
11 11
 		$this->id = $id;
12 12
 		$this->action_ids = $action_ids;
13 13
 	}
Please login to merge, or discard this patch.
includes/libraries/action-scheduler/classes/ActionScheduler_QueueRunner.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * @codeCoverageIgnore
20 20
 	 */
21 21
 	public static function instance() {
22
-		if ( empty(self::$runner) ) {
22
+		if (empty(self::$runner)) {
23 23
 			$class = apply_filters('action_scheduler_queue_runner_class', 'ActionScheduler_QueueRunner');
24 24
 			self::$runner = new $class();
25 25
 		}
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 	 * @param ActionScheduler_FatalErrorMonitor $monitor
34 34
 	 * @param ActionScheduler_QueueCleaner      $cleaner
35 35
 	 */
36
-	public function __construct( ActionScheduler_Store $store = null, ActionScheduler_FatalErrorMonitor $monitor = null, ActionScheduler_QueueCleaner $cleaner = null, ActionScheduler_AsyncRequest_QueueRunner $async_request = null ) {
37
-		parent::__construct( $store, $monitor, $cleaner );
36
+	public function __construct(ActionScheduler_Store $store = null, ActionScheduler_FatalErrorMonitor $monitor = null, ActionScheduler_QueueCleaner $cleaner = null, ActionScheduler_AsyncRequest_QueueRunner $async_request = null) {
37
+		parent::__construct($store, $monitor, $cleaner);
38 38
 
39
-		if ( is_null( $async_request ) ) {
40
-			$async_request = new ActionScheduler_AsyncRequest_QueueRunner( $this->store );
39
+		if (is_null($async_request)) {
40
+			$async_request = new ActionScheduler_AsyncRequest_QueueRunner($this->store);
41 41
 		}
42 42
 
43 43
 		$this->async_request = $async_request;
@@ -48,23 +48,23 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function init() {
50 50
 
51
-		add_filter( 'cron_schedules', array( self::instance(), 'add_wp_cron_schedule' ) );
51
+		add_filter('cron_schedules', array(self::instance(), 'add_wp_cron_schedule'));
52 52
 
53
-		$cron_context = array( 'WP Cron' );
53
+		$cron_context = array('WP Cron');
54 54
 
55
-		if ( ! wp_next_scheduled( self::WP_CRON_HOOK, $cron_context ) ) {
55
+		if (!wp_next_scheduled(self::WP_CRON_HOOK, $cron_context)) {
56 56
 
57 57
 			// Check for and remove any WP Cron hook scheduled by Action Scheduler < 3.0.0, which didn't include the $context param
58
-			$next_timestamp = wp_next_scheduled( self::WP_CRON_HOOK );
59
-			if ( $next_timestamp ) {
60
-				wp_unschedule_event( $next_timestamp, self::WP_CRON_HOOK );
58
+			$next_timestamp = wp_next_scheduled(self::WP_CRON_HOOK);
59
+			if ($next_timestamp) {
60
+				wp_unschedule_event($next_timestamp, self::WP_CRON_HOOK);
61 61
 			}
62 62
 
63
-			$schedule = apply_filters( 'action_scheduler_run_schedule', self::WP_CRON_SCHEDULE );
64
-			wp_schedule_event( time(), $schedule, self::WP_CRON_HOOK, $cron_context );
63
+			$schedule = apply_filters('action_scheduler_run_schedule', self::WP_CRON_SCHEDULE);
64
+			wp_schedule_event(time(), $schedule, self::WP_CRON_HOOK, $cron_context);
65 65
 		}
66 66
 
67
-		add_action( self::WP_CRON_HOOK, array( self::instance(), 'run' ) );
67
+		add_action(self::WP_CRON_HOOK, array(self::instance(), 'run'));
68 68
 		$this->hook_dispatch_async_request();
69 69
 	}
70 70
 
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
 	 * Hook check for dispatching an async request.
73 73
 	 */
74 74
 	public function hook_dispatch_async_request() {
75
-		add_action( 'shutdown', array( $this, 'maybe_dispatch_async_request' ) );
75
+		add_action('shutdown', array($this, 'maybe_dispatch_async_request'));
76 76
 	}
77 77
 
78 78
 	/**
79 79
 	 * Unhook check for dispatching an async request.
80 80
 	 */
81 81
 	public function unhook_dispatch_async_request() {
82
-		remove_action( 'shutdown', array( $this, 'maybe_dispatch_async_request' ) );
82
+		remove_action('shutdown', array($this, 'maybe_dispatch_async_request'));
83 83
 	}
84 84
 
85 85
 	/**
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * should dispatch a request to process pending actions.
102 102
 	 */
103 103
 	public function maybe_dispatch_async_request() {
104
-		if ( is_admin() && ! ActionScheduler::lock()->is_locked( 'async-request-runner' ) ) {
104
+		if (is_admin() && !ActionScheduler::lock()->is_locked('async-request-runner')) {
105 105
 			// Only start an async queue at most once every 60 seconds
106
-			ActionScheduler::lock()->set( 'async-request-runner' );
106
+			ActionScheduler::lock()->set('async-request-runner');
107 107
 			$this->async_request->maybe_dispatch();
108 108
 		}
109 109
 	}
@@ -121,21 +121,21 @@  discard block
 block discarded – undo
121 121
 	 *        Generally, this should be capitalised and not localised as it's a proper noun.
122 122
 	 * @return int The number of actions processed.
123 123
 	 */
124
-	public function run( $context = 'WP Cron' ) {
124
+	public function run($context = 'WP Cron') {
125 125
 		ActionScheduler_Compatibility::raise_memory_limit();
126
-		ActionScheduler_Compatibility::raise_time_limit( $this->get_time_limit() );
127
-		do_action( 'action_scheduler_before_process_queue' );
126
+		ActionScheduler_Compatibility::raise_time_limit($this->get_time_limit());
127
+		do_action('action_scheduler_before_process_queue');
128 128
 		$this->run_cleanup();
129 129
 		$processed_actions = 0;
130
-		if ( false === $this->has_maximum_concurrent_batches() ) {
131
-			$batch_size = apply_filters( 'action_scheduler_queue_runner_batch_size', 25 );
130
+		if (false === $this->has_maximum_concurrent_batches()) {
131
+			$batch_size = apply_filters('action_scheduler_queue_runner_batch_size', 25);
132 132
 			do {
133
-				$processed_actions_in_batch = $this->do_batch( $batch_size, $context );
133
+				$processed_actions_in_batch = $this->do_batch($batch_size, $context);
134 134
 				$processed_actions         += $processed_actions_in_batch;
135
-			} while ( $processed_actions_in_batch > 0 && ! $this->batch_limits_exceeded( $processed_actions ) ); // keep going until we run out of actions, time, or memory
135
+			} while ($processed_actions_in_batch > 0 && !$this->batch_limits_exceeded($processed_actions)); // keep going until we run out of actions, time, or memory
136 136
 		}
137 137
 
138
-		do_action( 'action_scheduler_after_process_queue' );
138
+		do_action('action_scheduler_after_process_queue');
139 139
 		return $processed_actions;
140 140
 	}
141 141
 
@@ -150,20 +150,20 @@  discard block
 block discarded – undo
150 150
 	 *        Generally, this should be capitalised and not localised as it's a proper noun.
151 151
 	 * @return int The number of actions processed.
152 152
 	 */
153
-	protected function do_batch( $size = 100, $context = '' ) {
153
+	protected function do_batch($size = 100, $context = '') {
154 154
 		$claim = $this->store->stake_claim($size);
155 155
 		$this->monitor->attach($claim);
156 156
 		$processed_actions = 0;
157 157
 
158
-		foreach ( $claim->get_actions() as $action_id ) {
158
+		foreach ($claim->get_actions() as $action_id) {
159 159
 			// bail if we lost the claim
160
-			if ( ! in_array( $action_id, $this->store->find_actions_by_claim_id( $claim->get_id() ) ) ) {
160
+			if (!in_array($action_id, $this->store->find_actions_by_claim_id($claim->get_id()))) {
161 161
 				break;
162 162
 			}
163
-			$this->process_action( $action_id, $context );
163
+			$this->process_action($action_id, $context);
164 164
 			$processed_actions++;
165 165
 
166
-			if ( $this->batch_limits_exceeded( $processed_actions ) ) {
166
+			if ($this->batch_limits_exceeded($processed_actions)) {
167 167
 				break;
168 168
 			}
169 169
 		}
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
 	 * add_filter( 'action_scheduler_queue_runner_flush_cache', '__return_true' );
183 183
 	 */
184 184
 	protected function clear_caches() {
185
-		if ( ! wp_using_ext_object_cache() || apply_filters( 'action_scheduler_queue_runner_flush_cache', false ) ) {
185
+		if (!wp_using_ext_object_cache() || apply_filters('action_scheduler_queue_runner_flush_cache', false)) {
186 186
 			wp_cache_flush();
187 187
 		}
188 188
 	}
189 189
 
190
-	public function add_wp_cron_schedule( $schedules ) {
190
+	public function add_wp_cron_schedule($schedules) {
191 191
 		$schedules['every_minute'] = array(
192 192
 			'interval' => 60, // in seconds
193
-			'display'  => __( 'Every minute', 'action-scheduler' ),
193
+			'display'  => __('Every minute', 'action-scheduler'),
194 194
 		);
195 195
 
196 196
 		return $schedules;
Please login to merge, or discard this patch.
action-scheduler/classes/ActionScheduler_AsyncRequest_QueueRunner.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * ActionScheduler_AsyncRequest_QueueRunner
4 4
  */
5 5
 
6
-defined( 'ABSPATH' ) || exit;
6
+defined('ABSPATH') || exit;
7 7
 
8 8
 /**
9 9
  * ActionScheduler_AsyncRequest_QueueRunner class.
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * Initiate new async request
39 39
 	 */
40
-	public function __construct( ActionScheduler_Store $store ) {
40
+	public function __construct(ActionScheduler_Store $store) {
41 41
 		parent::__construct();
42 42
 		$this->store = $store;
43 43
 	}
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
 	 * if there are still pending actions after completing a queue in this request.
50 50
 	 */
51 51
 	protected function handle() {
52
-		do_action( 'action_scheduler_run_queue', 'Async Request' ); // run a queue in the same way as WP Cron, but declare the Async Request context
52
+		do_action('action_scheduler_run_queue', 'Async Request'); // run a queue in the same way as WP Cron, but declare the Async Request context
53 53
 
54 54
 		$sleep_seconds = $this->get_sleep_seconds();
55 55
 
56
-		if ( $sleep_seconds ) {
57
-			sleep( $sleep_seconds );
56
+		if ($sleep_seconds) {
57
+			sleep($sleep_seconds);
58 58
 		}
59 59
 
60 60
 		$this->maybe_dispatch();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * If the async request runner is needed and allowed to run, dispatch a request.
65 65
 	 */
66 66
 	public function maybe_dispatch() {
67
-		if ( ! $this->allow() ) {
67
+		if (!$this->allow()) {
68 68
 			return;
69 69
 		}
70 70
 
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	protected function allow() {
81 81
 
82
-		if ( ! has_action( 'action_scheduler_run_queue' ) || ActionScheduler::runner()->has_maximum_concurrent_batches() || ! $this->store->has_pending_actions_due() ) {
82
+		if (!has_action('action_scheduler_run_queue') || ActionScheduler::runner()->has_maximum_concurrent_batches() || !$this->store->has_pending_actions_due()) {
83 83
 			$allow = false;
84 84
 		} else {
85 85
 			$allow = true;
86 86
 		}
87 87
 
88
-		return apply_filters( 'action_scheduler_allow_async_request_runner', $allow );
88
+		return apply_filters('action_scheduler_allow_async_request_runner', $allow);
89 89
 	}
90 90
 
91 91
 	/**
92 92
 	 * Chaining async requests can crash MySQL. A brief sleep call in PHP prevents that.
93 93
 	 */
94 94
 	protected function get_sleep_seconds() {
95
-		return apply_filters( 'action_scheduler_async_request_sleep_seconds', 5, $this );
95
+		return apply_filters('action_scheduler_async_request_sleep_seconds', 5, $this);
96 96
 	}
97 97
 }
Please login to merge, or discard this patch.
libraries/action-scheduler/classes/ActionScheduler_WPCommentCleaner.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -34,20 +34,20 @@  discard block
 block discarded – undo
34 34
 	 * Initialize the class and attach callbacks.
35 35
 	 */
36 36
 	public static function init() {
37
-		if ( empty( self::$wp_comment_logger ) ) {
37
+		if (empty(self::$wp_comment_logger)) {
38 38
 			self::$wp_comment_logger = new ActionScheduler_wpCommentLogger();
39 39
 		}
40 40
 
41
-		add_action( self::$cleanup_hook, array( __CLASS__, 'delete_all_action_comments' ) );
41
+		add_action(self::$cleanup_hook, array(__CLASS__, 'delete_all_action_comments'));
42 42
 
43 43
 		// While there are orphaned logs left in the comments table, we need to attach the callbacks which filter comment counts.
44
-		add_action( 'pre_get_comments', array( self::$wp_comment_logger, 'filter_comment_queries' ), 10, 1 );
45
-		add_action( 'wp_count_comments', array( self::$wp_comment_logger, 'filter_comment_count' ), 20, 2 ); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs
46
-		add_action( 'comment_feed_where', array( self::$wp_comment_logger, 'filter_comment_feed' ), 10, 2 );
44
+		add_action('pre_get_comments', array(self::$wp_comment_logger, 'filter_comment_queries'), 10, 1);
45
+		add_action('wp_count_comments', array(self::$wp_comment_logger, 'filter_comment_count'), 20, 2); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs
46
+		add_action('comment_feed_where', array(self::$wp_comment_logger, 'filter_comment_feed'), 10, 2);
47 47
 
48 48
 		// Action Scheduler may be displayed as a Tools screen or WooCommerce > Status administration screen
49
-		add_action( 'load-tools_page_action-scheduler', array( __CLASS__, 'register_admin_notice' ) );
50
-		add_action( 'load-woocommerce_page_wc-status', array( __CLASS__, 'register_admin_notice' ) );
49
+		add_action('load-tools_page_action-scheduler', array(__CLASS__, 'register_admin_notice'));
50
+		add_action('load-woocommerce_page_wc-status', array(__CLASS__, 'register_admin_notice'));
51 51
 	}
52 52
 
53 53
 	/**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @return boolean Whether there are scheduled action comments in the comments table.
59 59
 	 */
60 60
 	public static function has_logs() {
61
-		return 'yes' === get_option( self::$has_logs_option_key );
61
+		return 'yes' === get_option(self::$has_logs_option_key);
62 62
 	}
63 63
 
64 64
 	/**
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 	 * Attached to the migration complete hook 'action_scheduler/migration_complete'.
67 67
 	 */
68 68
 	public static function maybe_schedule_cleanup() {
69
-		if ( (bool) get_comments( array( 'type' => ActionScheduler_wpCommentLogger::TYPE, 'number' => 1, 'fields' => 'ids' ) ) ) {
70
-			update_option( self::$has_logs_option_key, 'yes' );
69
+		if ((bool) get_comments(array('type' => ActionScheduler_wpCommentLogger::TYPE, 'number' => 1, 'fields' => 'ids'))) {
70
+			update_option(self::$has_logs_option_key, 'yes');
71 71
 
72
-			if ( ! as_next_scheduled_action( self::$cleanup_hook ) ) {
73
-				as_schedule_single_action( gmdate( 'U' ) + ( 6 * MONTH_IN_SECONDS ), self::$cleanup_hook );
72
+			if (!as_next_scheduled_action(self::$cleanup_hook)) {
73
+				as_schedule_single_action(gmdate('U') + (6 * MONTH_IN_SECONDS), self::$cleanup_hook);
74 74
 			}
75 75
 		}
76 76
 	}
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public static function delete_all_action_comments() {
82 82
 		global $wpdb;
83
-		$wpdb->delete( $wpdb->comments, array( 'comment_type' => ActionScheduler_wpCommentLogger::TYPE, 'comment_agent' => ActionScheduler_wpCommentLogger::AGENT ) );
84
-		delete_option( self::$has_logs_option_key );
83
+		$wpdb->delete($wpdb->comments, array('comment_type' => ActionScheduler_wpCommentLogger::TYPE, 'comment_agent' => ActionScheduler_wpCommentLogger::AGENT));
84
+		delete_option(self::$has_logs_option_key);
85 85
 	}
86 86
 
87 87
 	/**
88 88
 	 * Registers admin notices about the orphaned action logs.
89 89
 	 */
90 90
 	public static function register_admin_notice() {
91
-		add_action( 'admin_notices', array( __CLASS__, 'print_admin_notice' ) );
91
+		add_action('admin_notices', array(__CLASS__, 'print_admin_notice'));
92 92
 	}
93 93
 	
94 94
 	/**
@@ -96,20 +96,20 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public static function print_admin_notice() {
98 98
 		$next_cleanup_message        = '';
99
-		$next_scheduled_cleanup_hook = as_next_scheduled_action( self::$cleanup_hook );
99
+		$next_scheduled_cleanup_hook = as_next_scheduled_action(self::$cleanup_hook);
100 100
 
101
-		if ( $next_scheduled_cleanup_hook ) {
101
+		if ($next_scheduled_cleanup_hook) {
102 102
 			/* translators: %s: date interval */
103
-			$next_cleanup_message = sprintf( __( 'This data will be deleted in %s.', 'action-scheduler' ), human_time_diff( gmdate( 'U' ), $next_scheduled_cleanup_hook ) );
103
+			$next_cleanup_message = sprintf(__('This data will be deleted in %s.', 'action-scheduler'), human_time_diff(gmdate('U'), $next_scheduled_cleanup_hook));
104 104
 		}
105 105
 
106 106
 		$notice = sprintf(
107 107
 			/* translators: 1: next cleanup message 2: github issue URL */
108
-			__( 'Action Scheduler has migrated data to custom tables; however, orphaned log entries exist in the WordPress Comments table. %1$s <a href="%2$s">Learn more &raquo;</a>', 'action-scheduler' ),
108
+			__('Action Scheduler has migrated data to custom tables; however, orphaned log entries exist in the WordPress Comments table. %1$s <a href="%2$s">Learn more &raquo;</a>', 'action-scheduler'),
109 109
 			$next_cleanup_message,
110 110
 			'https://github.com/woocommerce/action-scheduler/issues/368'
111 111
 		);
112 112
 
113
-		echo '<div class="notice notice-warning"><p>' . wp_kses_post( $notice ) . '</p></div>';
113
+		echo '<div class="notice notice-warning"><p>' . wp_kses_post($notice) . '</p></div>';
114 114
 	}
115 115
 }
Please login to merge, or discard this patch.
action-scheduler/classes/actions/ActionScheduler_CanceledAction.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@
 block discarded – undo
14 14
 	 * @param ActionScheduler_Schedule $schedule
15 15
 	 * @param string $group
16 16
 	 */
17
-	public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) {
18
-		parent::__construct( $hook, $args, $schedule, $group );
19
-		if ( is_null( $schedule ) ) {
20
-			$this->set_schedule( new ActionScheduler_NullSchedule() );
17
+	public function __construct($hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '') {
18
+		parent::__construct($hook, $args, $schedule, $group);
19
+		if (is_null($schedule)) {
20
+			$this->set_schedule(new ActionScheduler_NullSchedule());
21 21
 		}
22 22
 	}
23 23
 }
Please login to merge, or discard this patch.
libraries/action-scheduler/classes/actions/ActionScheduler_Action.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 	protected $schedule = NULL;
11 11
 	protected $group = '';
12 12
 
13
-	public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = NULL, $group = '' ) {
14
-		$schedule = empty( $schedule ) ? new ActionScheduler_NullSchedule() : $schedule;
13
+	public function __construct($hook, array $args = array(), ActionScheduler_Schedule $schedule = NULL, $group = '') {
14
+		$schedule = empty($schedule) ? new ActionScheduler_NullSchedule() : $schedule;
15 15
 		$this->set_hook($hook);
16 16
 		$this->set_schedule($schedule);
17 17
 		$this->set_args($args);
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	/**
26 26
 	 * @param string $hook
27 27
 	 */
28
-	protected function set_hook( $hook ) {
28
+	protected function set_hook($hook) {
29 29
 		$this->hook = $hook;
30 30
 	}
31 31
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		return $this->hook;
34 34
 	}
35 35
 
36
-	protected function set_schedule( ActionScheduler_Schedule $schedule ) {
36
+	protected function set_schedule(ActionScheduler_Schedule $schedule) {
37 37
 		$this->schedule = $schedule;
38 38
 	}
39 39
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		return $this->schedule;
45 45
 	}
46 46
 
47
-	protected function set_args( array $args ) {
47
+	protected function set_args(array $args) {
48 48
 		$this->args = $args;
49 49
 	}
50 50
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	/**
56 56
 	 * @param string $group
57 57
 	 */
58
-	protected function set_group( $group ) {
58
+	protected function set_group($group) {
59 59
 		$this->group = $group;
60 60
 	}
61 61
 
Please login to merge, or discard this patch.
libraries/action-scheduler/classes/actions/ActionScheduler_NullAction.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
  */
6 6
 class ActionScheduler_NullAction extends ActionScheduler_Action {
7 7
 
8
-	public function __construct( $hook = '', array $args = array(), ActionScheduler_Schedule $schedule = NULL ) {
9
-		$this->set_schedule( new ActionScheduler_NullSchedule() );
8
+	public function __construct($hook = '', array $args = array(), ActionScheduler_Schedule $schedule = NULL) {
9
+		$this->set_schedule(new ActionScheduler_NullSchedule());
10 10
 	}
11 11
 
12 12
 	public function execute() {
Please login to merge, or discard this patch.
includes/libraries/action-scheduler/classes/ActionScheduler_AdminView.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	public static function instance() {
21 21
 
22
-		if ( empty( self::$admin_view ) ) {
22
+		if (empty(self::$admin_view)) {
23 23
 			$class = apply_filters('action_scheduler_admin_view_class', 'ActionScheduler_AdminView');
24 24
 			self::$admin_view = new $class();
25 25
 		}
@@ -31,22 +31,22 @@  discard block
 block discarded – undo
31 31
 	 * @codeCoverageIgnore
32 32
 	 */
33 33
 	public function init() {
34
-		if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || false == DOING_AJAX ) ) {
34
+		if (is_admin() && (!defined('DOING_AJAX') || false == DOING_AJAX)) {
35 35
 
36
-			if ( class_exists( 'WooCommerce' ) ) {
37
-				add_action( 'woocommerce_admin_status_content_action-scheduler', array( $this, 'render_admin_ui' ) );
38
-				add_action( 'woocommerce_system_status_report', array( $this, 'system_status_report' ) );
39
-				add_filter( 'woocommerce_admin_status_tabs', array( $this, 'register_system_status_tab' ) );
36
+			if (class_exists('WooCommerce')) {
37
+				add_action('woocommerce_admin_status_content_action-scheduler', array($this, 'render_admin_ui'));
38
+				add_action('woocommerce_system_status_report', array($this, 'system_status_report'));
39
+				add_filter('woocommerce_admin_status_tabs', array($this, 'register_system_status_tab'));
40 40
 			}
41 41
 
42
-			add_action( 'admin_menu', array( $this, 'register_menu' ) );
42
+			add_action('admin_menu', array($this, 'register_menu'));
43 43
 
44
-			add_action( 'current_screen', array( $this, 'add_help_tabs' ) );
44
+			add_action('current_screen', array($this, 'add_help_tabs'));
45 45
 		}
46 46
 	}
47 47
 
48 48
 	public function system_status_report() {
49
-		$table = new ActionScheduler_wcSystemStatus( ActionScheduler::store() );
49
+		$table = new ActionScheduler_wcSystemStatus(ActionScheduler::store());
50 50
 		$table->render();
51 51
 	}
52 52
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @param array $tabs An associative array of tab key => label.
57 57
 	 * @return array $tabs An associative array of tab key => label, including Action Scheduler's tabs
58 58
 	 */
59
-	public function register_system_status_tab( array $tabs ) {
60
-		$tabs['action-scheduler'] = __( 'Scheduled Actions', 'action-scheduler' );
59
+	public function register_system_status_tab(array $tabs) {
60
+		$tabs['action-scheduler'] = __('Scheduled Actions', 'action-scheduler');
61 61
 
62 62
 		return $tabs;
63 63
 	}
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 	public function register_menu() {
73 73
 		$hook_suffix = add_submenu_page(
74 74
 			'tools.php',
75
-			__( 'Scheduled Actions', 'action-scheduler' ),
76
-			__( 'Scheduled Actions', 'action-scheduler' ),
75
+			__('Scheduled Actions', 'action-scheduler'),
76
+			__('Scheduled Actions', 'action-scheduler'),
77 77
 			'manage_options',
78 78
 			'action-scheduler',
79
-			array( $this, 'render_admin_ui' )
79
+			array($this, 'render_admin_ui')
80 80
 		);
81
-		add_action( 'load-' . $hook_suffix , array( $this, 'process_admin_ui' ) );
81
+		add_action('load-' . $hook_suffix, array($this, 'process_admin_ui'));
82 82
 	}
83 83
 
84 84
 	/**
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @return ActionScheduler_ListTable
103 103
 	 */
104 104
 	protected function get_list_table() {
105
-		if ( null === $this->list_table ) {
106
-			$this->list_table = new ActionScheduler_ListTable( ActionScheduler::store(), ActionScheduler::logger(), ActionScheduler::runner() );
105
+		if (null === $this->list_table) {
106
+			$this->list_table = new ActionScheduler_ListTable(ActionScheduler::store(), ActionScheduler::logger(), ActionScheduler::runner());
107 107
 			$this->list_table->process_actions();
108 108
 		}
109 109
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	public function add_help_tabs() {
117 117
 		$screen = get_current_screen();
118 118
 
119
-		if ( ! $screen || self::$screen_id != $screen->id ) {
119
+		if (!$screen || self::$screen_id != $screen->id) {
120 120
 			return;
121 121
 		}
122 122
 
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 		$screen->add_help_tab(
125 125
 			array(
126 126
 				'id'      => 'action_scheduler_about',
127
-				'title'   => __( 'About', 'action-scheduler' ),
127
+				'title'   => __('About', 'action-scheduler'),
128 128
 				'content' =>
129
-					'<h2>' . sprintf( __( 'About Action Scheduler %s', 'action-scheduler' ), $as_version ) . '</h2>' .
129
+					'<h2>' . sprintf(__('About Action Scheduler %s', 'action-scheduler'), $as_version) . '</h2>' .
130 130
 					'<p>' .
131
-						__( 'Action Scheduler is a scalable, traceable job queue for background processing large sets of actions. Action Scheduler works by triggering an action hook to run at some time in the future. Scheduled actions can also be scheduled to run on a recurring schedule.', 'action-scheduler' ) .
131
+						__('Action Scheduler is a scalable, traceable job queue for background processing large sets of actions. Action Scheduler works by triggering an action hook to run at some time in the future. Scheduled actions can also be scheduled to run on a recurring schedule.', 'action-scheduler') .
132 132
 					'</p>',
133 133
 			)
134 134
 		);
@@ -136,17 +136,17 @@  discard block
 block discarded – undo
136 136
 		$screen->add_help_tab(
137 137
 			array(
138 138
 				'id'      => 'action_scheduler_columns',
139
-				'title'   => __( 'Columns', 'action-scheduler' ),
139
+				'title'   => __('Columns', 'action-scheduler'),
140 140
 				'content' =>
141
-					'<h2>' . __( 'Scheduled Action Columns', 'action-scheduler' ) . '</h2>' .
141
+					'<h2>' . __('Scheduled Action Columns', 'action-scheduler') . '</h2>' .
142 142
 					'<ul>' .
143
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Hook', 'action-scheduler' ), __( 'Name of the action hook that will be triggered.', 'action-scheduler' ) ) .
144
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Status', 'action-scheduler' ), __( 'Action statuses are Pending, Complete, Canceled, Failed', 'action-scheduler' ) ) .
145
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Arguments', 'action-scheduler' ), __( 'Optional data array passed to the action hook.', 'action-scheduler' ) ) .
146
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Group', 'action-scheduler' ), __( 'Optional action group.', 'action-scheduler' ) ) .
147
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Recurrence', 'action-scheduler' ), __( 'The action\'s schedule frequency.', 'action-scheduler' ) ) .
148
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Scheduled', 'action-scheduler' ), __( 'The date/time the action is/was scheduled to run.', 'action-scheduler' ) ) .
149
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Log', 'action-scheduler' ), __( 'Activity log for the action.', 'action-scheduler' ) ) .
143
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Hook', 'action-scheduler'), __('Name of the action hook that will be triggered.', 'action-scheduler')) .
144
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Status', 'action-scheduler'), __('Action statuses are Pending, Complete, Canceled, Failed', 'action-scheduler')) .
145
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Arguments', 'action-scheduler'), __('Optional data array passed to the action hook.', 'action-scheduler')) .
146
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Group', 'action-scheduler'), __('Optional action group.', 'action-scheduler')) .
147
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Recurrence', 'action-scheduler'), __('The action\'s schedule frequency.', 'action-scheduler')) .
148
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Scheduled', 'action-scheduler'), __('The date/time the action is/was scheduled to run.', 'action-scheduler')) .
149
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Log', 'action-scheduler'), __('Activity log for the action.', 'action-scheduler')) .
150 150
 					'</ul>',
151 151
 			)
152 152
 		);
Please login to merge, or discard this patch.
libraries/action-scheduler/classes/ActionScheduler_ActionFactory.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@  discard block
 block discarded – undo
14 14
 	 *
15 15
 	 * @return ActionScheduler_Action An instance of the stored action
16 16
 	 */
17
-	public function get_stored_action( $status, $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) {
17
+	public function get_stored_action($status, $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '') {
18 18
 
19
-		switch ( $status ) {
19
+		switch ($status) {
20 20
 			case ActionScheduler_Store::STATUS_PENDING :
21 21
 				$action_class = 'ActionScheduler_Action';
22 22
 				break;
23 23
 			case ActionScheduler_Store::STATUS_CANCELED :
24 24
 				$action_class = 'ActionScheduler_CanceledAction';
25
-				if ( ! is_null( $schedule ) && ! is_a( $schedule, 'ActionScheduler_CanceledSchedule' ) ) {
26
-					$schedule = new ActionScheduler_CanceledSchedule( $schedule->get_date() );
25
+				if (!is_null($schedule) && !is_a($schedule, 'ActionScheduler_CanceledSchedule')) {
26
+					$schedule = new ActionScheduler_CanceledSchedule($schedule->get_date());
27 27
 				}
28 28
 				break;
29 29
 			default :
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 				break;
32 32
 		}
33 33
 
34
-		$action_class = apply_filters( 'action_scheduler_stored_action_class', $action_class, $status, $hook, $args, $schedule, $group );
34
+		$action_class = apply_filters('action_scheduler_stored_action_class', $action_class, $status, $hook, $args, $schedule, $group);
35 35
 
36
-		$action = new $action_class( $hook, $args, $schedule, $group );
36
+		$action = new $action_class($hook, $args, $schedule, $group);
37 37
 
38 38
 		/**
39 39
 		 * Allow 3rd party code to change the instantiated action for a given hook, args, schedule and group.
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		 * @param ActionScheduler_Schedule $schedule The instantiated action's schedule.
45 45
 		 * @param string $group The instantiated action's group.
46 46
 		 */
47
-		return apply_filters( 'action_scheduler_stored_action_instance', $action, $hook, $args, $schedule, $group );
47
+		return apply_filters('action_scheduler_stored_action_instance', $action, $hook, $args, $schedule, $group);
48 48
 	}
49 49
 
50 50
 	/**
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return string The ID of the stored action
65 65
 	 */
66
-	public function async( $hook, $args = array(), $group = '' ) {
66
+	public function async($hook, $args = array(), $group = '') {
67 67
 		$schedule = new ActionScheduler_NullSchedule();
68
-		$action = new ActionScheduler_Action( $hook, $args, $schedule, $group );
69
-		return $this->store( $action );
68
+		$action = new ActionScheduler_Action($hook, $args, $schedule, $group);
69
+		return $this->store($action);
70 70
 	}
71 71
 
72 72
 	/**
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @return string The ID of the stored action
79 79
 	 */
80
-	public function single( $hook, $args = array(), $when = null, $group = '' ) {
81
-		$date = as_get_datetime_object( $when );
82
-		$schedule = new ActionScheduler_SimpleSchedule( $date );
83
-		$action = new ActionScheduler_Action( $hook, $args, $schedule, $group );
84
-		return $this->store( $action );
80
+	public function single($hook, $args = array(), $when = null, $group = '') {
81
+		$date = as_get_datetime_object($when);
82
+		$schedule = new ActionScheduler_SimpleSchedule($date);
83
+		$action = new ActionScheduler_Action($hook, $args, $schedule, $group);
84
+		return $this->store($action);
85 85
 	}
86 86
 
87 87
 	/**
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return string The ID of the stored action
97 97
 	 */
98
-	public function recurring( $hook, $args = array(), $first = null, $interval = null, $group = '' ) {
99
-		if ( empty($interval) ) {
100
-			return $this->single( $hook, $args, $first, $group );
98
+	public function recurring($hook, $args = array(), $first = null, $interval = null, $group = '') {
99
+		if (empty($interval)) {
100
+			return $this->single($hook, $args, $first, $group);
101 101
 		}
102
-		$date = as_get_datetime_object( $first );
103
-		$schedule = new ActionScheduler_IntervalSchedule( $date, $interval );
104
-		$action = new ActionScheduler_Action( $hook, $args, $schedule, $group );
105
-		return $this->store( $action );
102
+		$date = as_get_datetime_object($first);
103
+		$schedule = new ActionScheduler_IntervalSchedule($date, $interval);
104
+		$action = new ActionScheduler_Action($hook, $args, $schedule, $group);
105
+		return $this->store($action);
106 106
 	}
107 107
 
108 108
 	/**
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return string The ID of the stored action
120 120
 	 */
121
-	public function cron( $hook, $args = array(), $base_timestamp = null, $schedule = null, $group = '' ) {
122
-		if ( empty($schedule) ) {
123
-			return $this->single( $hook, $args, $base_timestamp, $group );
121
+	public function cron($hook, $args = array(), $base_timestamp = null, $schedule = null, $group = '') {
122
+		if (empty($schedule)) {
123
+			return $this->single($hook, $args, $base_timestamp, $group);
124 124
 		}
125
-		$date = as_get_datetime_object( $base_timestamp );
126
-		$cron = CronExpression::factory( $schedule );
127
-		$schedule = new ActionScheduler_CronSchedule( $date, $cron );
128
-		$action = new ActionScheduler_Action( $hook, $args, $schedule, $group );
129
-		return $this->store( $action );
125
+		$date = as_get_datetime_object($base_timestamp);
126
+		$cron = CronExpression::factory($schedule);
127
+		$schedule = new ActionScheduler_CronSchedule($date, $cron);
128
+		$action = new ActionScheduler_Action($hook, $args, $schedule, $group);
129
+		return $this->store($action);
130 130
 	}
131 131
 
132 132
 	/**
@@ -153,18 +153,18 @@  discard block
 block discarded – undo
153 153
 	 * @return string The ID of the stored action
154 154
 	 * @throws InvalidArgumentException If $action is not a recurring action.
155 155
 	 */
156
-	public function repeat( $action ) {
156
+	public function repeat($action) {
157 157
 		$schedule = $action->get_schedule();
158
-		$next     = $schedule->get_next( as_get_datetime_object() );
158
+		$next     = $schedule->get_next(as_get_datetime_object());
159 159
 
160
-		if ( is_null( $next ) || ! $schedule->is_recurring() ) {
161
-			throw new InvalidArgumentException( __( 'Invalid action - must be a recurring action.', 'action-scheduler' ) );
160
+		if (is_null($next) || !$schedule->is_recurring()) {
161
+			throw new InvalidArgumentException(__('Invalid action - must be a recurring action.', 'action-scheduler'));
162 162
 		}
163 163
 
164
-		$schedule_class = get_class( $schedule );
165
-		$new_schedule = new $schedule( $next, $schedule->get_recurrence(), $schedule->get_first_date() );
166
-		$new_action = new ActionScheduler_Action( $action->get_hook(), $action->get_args(), $new_schedule, $action->get_group() );
167
-		return $this->store( $new_action );
164
+		$schedule_class = get_class($schedule);
165
+		$new_schedule = new $schedule($next, $schedule->get_recurrence(), $schedule->get_first_date());
166
+		$new_action = new ActionScheduler_Action($action->get_hook(), $action->get_args(), $new_schedule, $action->get_group());
167
+		return $this->store($new_action);
168 168
 	}
169 169
 
170 170
 	/**
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return string The ID of the stored action
174 174
 	 */
175
-	protected function store( ActionScheduler_Action $action ) {
175
+	protected function store(ActionScheduler_Action $action) {
176 176
 		$store = ActionScheduler_Store::instance();
177
-		return $store->save_action( $action );
177
+		return $store->save_action($action);
178 178
 	}
179 179
 }
Please login to merge, or discard this patch.