@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Object Sync for Salesforce Queue |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; // Exit if accessed directly. |
8 | 8 | } |
9 | 9 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | protected $slug; |
21 | 21 | protected $schedulable_classes; |
22 | 22 | |
23 | - public function __construct( $wpdb, $version, $slug, $schedulable_classes ) { |
|
23 | + public function __construct($wpdb, $version, $slug, $schedulable_classes) { |
|
24 | 24 | $this->wpdb = $wpdb; |
25 | 25 | $this->version = $version; |
26 | 26 | $this->slug = $slug; |
@@ -34,18 +34,18 @@ discard block |
||
34 | 34 | * @param string $sort Which direction to sort |
35 | 35 | * @return array $this->schedulable_classes |
36 | 36 | */ |
37 | - public function get_frequencies( $unit = 'seconds', $sort = 'asc' ) { |
|
37 | + public function get_frequencies($unit = 'seconds', $sort = 'asc') { |
|
38 | 38 | |
39 | - foreach ( $this->schedulable_classes as $key => $schedule ) { |
|
40 | - $this->schedulable_classes[ $key ]['frequency'] = $this->get_frequency( $key, 'seconds' ); |
|
39 | + foreach ($this->schedulable_classes as $key => $schedule) { |
|
40 | + $this->schedulable_classes[$key]['frequency'] = $this->get_frequency($key, 'seconds'); |
|
41 | 41 | } |
42 | 42 | |
43 | - if ( 'asc' === $sort ) { |
|
44 | - uasort( $this->schedulable_classes, function( $a, $b ) { |
|
43 | + if ('asc' === $sort) { |
|
44 | + uasort($this->schedulable_classes, function($a, $b) { |
|
45 | 45 | return $a['frequency'] - $b['frequency']; |
46 | 46 | }); |
47 | 47 | } else { |
48 | - uasort( $this->schedulable_classes, function( $a, $b ) { |
|
48 | + uasort($this->schedulable_classes, function($a, $b) { |
|
49 | 49 | return $b['frequency'] - $a['frequency']; |
50 | 50 | }); |
51 | 51 | } |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | * @param string $unit The unit of time |
62 | 62 | * @return int How often it runs in that unit of time |
63 | 63 | */ |
64 | - public function get_frequency( $name, $unit ) { |
|
65 | - $schedule_number = get_option( 'object_sync_for_salesforce_' . $name . '_schedule_number', '' ); |
|
66 | - $schedule_unit = get_option( 'object_sync_for_salesforce_' . $name . '_schedule_unit', '' ); |
|
64 | + public function get_frequency($name, $unit) { |
|
65 | + $schedule_number = get_option('object_sync_for_salesforce_' . $name . '_schedule_number', ''); |
|
66 | + $schedule_unit = get_option('object_sync_for_salesforce_' . $name . '_schedule_unit', ''); |
|
67 | 67 | |
68 | - switch ( $schedule_unit ) { |
|
68 | + switch ($schedule_unit) { |
|
69 | 69 | case 'minutes': |
70 | 70 | $seconds = 60; |
71 | 71 | $minutes = 1; |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | * @param string $group The group to assign this job to. |
97 | 97 | * @return string The action ID. |
98 | 98 | */ |
99 | - public function add( $hook, $args = array(), $group = '' ) { |
|
100 | - return $this->schedule_single( time(), $hook, $args, $group ); |
|
99 | + public function add($hook, $args = array(), $group = '') { |
|
100 | + return $this->schedule_single(time(), $hook, $args, $group); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @param string $group The group to assign this job to. |
110 | 110 | * @return string The action ID. |
111 | 111 | */ |
112 | - public function schedule_single( $timestamp, $hook, $args = array(), $group = '' ) { |
|
113 | - return as_schedule_single_action( $timestamp, $hook, $args, $group ); |
|
112 | + public function schedule_single($timestamp, $hook, $args = array(), $group = '') { |
|
113 | + return as_schedule_single_action($timestamp, $hook, $args, $group); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | * @param string $group The group to assign this job to. |
124 | 124 | * @return string The action ID. |
125 | 125 | */ |
126 | - public function schedule_recurring( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { |
|
127 | - return as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group ); |
|
126 | + public function schedule_recurring($timestamp, $interval_in_seconds, $hook, $args = array(), $group = '') { |
|
127 | + return as_schedule_recurring_action($timestamp, $interval_in_seconds, $hook, $args, $group); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param string $group The group to assign this job to. |
148 | 148 | * @return string The action ID |
149 | 149 | */ |
150 | - public function schedule_cron( $timestamp, $cron_schedule, $hook, $args = array(), $group = '' ) { |
|
151 | - return as_schedule_cron_action( $timestamp, $cron_schedule, $hook, $args, $group ); |
|
150 | + public function schedule_cron($timestamp, $cron_schedule, $hook, $args = array(), $group = '') { |
|
151 | + return as_schedule_cron_action($timestamp, $cron_schedule, $hook, $args, $group); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | * @param array $args Args that would have been passed to the job. |
165 | 165 | * @param string $group Group name. |
166 | 166 | */ |
167 | - public function cancel( $hook, $args = array(), $group = '' ) { |
|
168 | - as_unschedule_action( $hook, $args, $group ); |
|
167 | + public function cancel($hook, $args = array(), $group = '') { |
|
168 | + as_unschedule_action($hook, $args, $group); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | * @param string $group Group name. |
178 | 178 | * @return time|null The date and time for the next occurrence, or null if there is no pending, scheduled action for the given hook. |
179 | 179 | */ |
180 | - public function get_next( $hook, $args = null, $group = '' ) { |
|
180 | + public function get_next($hook, $args = null, $group = '') { |
|
181 | 181 | |
182 | - $next_timestamp = as_next_scheduled_action( $hook, $args, $group ); |
|
182 | + $next_timestamp = as_next_scheduled_action($hook, $args, $group); |
|
183 | 183 | |
184 | - if ( $next_timestamp ) { |
|
184 | + if ($next_timestamp) { |
|
185 | 185 | return $next_timestamp; |
186 | 186 | } |
187 | 187 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @param string $return_format OBJECT, ARRAY_A, or ids. |
210 | 210 | * @return array |
211 | 211 | */ |
212 | - public function search( $args = array(), $return_format = OBJECT ) { |
|
213 | - return as_get_scheduled_actions( $args, $return_format ); |
|
212 | + public function search($args = array(), $return_format = OBJECT) { |
|
213 | + return as_get_scheduled_actions($args, $return_format); |
|
214 | 214 | } |
215 | 215 | } |