@@ -12,11 +12,11 @@ discard block |
||
| 12 | 12 | * @param string $group The group to assign this job to. |
| 13 | 13 | * @return int The action ID. |
| 14 | 14 | */ |
| 15 | -function as_enqueue_async_action( $hook, $args = array(), $group = '' ) { |
|
| 16 | - if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { |
|
| 15 | +function as_enqueue_async_action($hook, $args = array(), $group = '') { |
|
| 16 | + if (!ActionScheduler::is_initialized(__FUNCTION__)) { |
|
| 17 | 17 | return 0; |
| 18 | 18 | } |
| 19 | - return ActionScheduler::factory()->async( $hook, $args, $group ); |
|
| 19 | + return ActionScheduler::factory()->async($hook, $args, $group); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @return int The action ID. |
| 31 | 31 | */ |
| 32 | -function as_schedule_single_action( $timestamp, $hook, $args = array(), $group = '' ) { |
|
| 33 | - if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { |
|
| 32 | +function as_schedule_single_action($timestamp, $hook, $args = array(), $group = '') { |
|
| 33 | + if (!ActionScheduler::is_initialized(__FUNCTION__)) { |
|
| 34 | 34 | return 0; |
| 35 | 35 | } |
| 36 | - return ActionScheduler::factory()->single( $hook, $args, $timestamp, $group ); |
|
| 36 | + return ActionScheduler::factory()->single($hook, $args, $timestamp, $group); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @return int The action ID. |
| 49 | 49 | */ |
| 50 | -function as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { |
|
| 51 | - if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { |
|
| 50 | +function as_schedule_recurring_action($timestamp, $interval_in_seconds, $hook, $args = array(), $group = '') { |
|
| 51 | + if (!ActionScheduler::is_initialized(__FUNCTION__)) { |
|
| 52 | 52 | return 0; |
| 53 | 53 | } |
| 54 | - return ActionScheduler::factory()->recurring( $hook, $args, $timestamp, $interval_in_seconds, $group ); |
|
| 54 | + return ActionScheduler::factory()->recurring($hook, $args, $timestamp, $interval_in_seconds, $group); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @return int The action ID. |
| 79 | 79 | */ |
| 80 | -function as_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) { |
|
| 81 | - if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { |
|
| 80 | +function as_schedule_cron_action($timestamp, $schedule, $hook, $args = array(), $group = '') { |
|
| 81 | + if (!ActionScheduler::is_initialized(__FUNCTION__)) { |
|
| 82 | 82 | return 0; |
| 83 | 83 | } |
| 84 | - return ActionScheduler::factory()->cron( $hook, $args, $timestamp, $schedule, $group ); |
|
| 84 | + return ActionScheduler::factory()->cron($hook, $args, $timestamp, $schedule, $group); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @return int|null The scheduled action ID if a scheduled action was found, or null if no matching action found. |
| 102 | 102 | */ |
| 103 | -function as_unschedule_action( $hook, $args = array(), $group = '' ) { |
|
| 104 | - if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { |
|
| 103 | +function as_unschedule_action($hook, $args = array(), $group = '') { |
|
| 104 | + if (!ActionScheduler::is_initialized(__FUNCTION__)) { |
|
| 105 | 105 | return 0; |
| 106 | 106 | } |
| 107 | 107 | $params = array( |
@@ -111,22 +111,22 @@ discard block |
||
| 111 | 111 | 'order' => 'ASC', |
| 112 | 112 | 'group' => $group, |
| 113 | 113 | ); |
| 114 | - if ( is_array( $args ) ) { |
|
| 114 | + if (is_array($args)) { |
|
| 115 | 115 | $params['args'] = $args; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - $action_id = ActionScheduler::store()->query_action( $params ); |
|
| 118 | + $action_id = ActionScheduler::store()->query_action($params); |
|
| 119 | 119 | |
| 120 | - if ( $action_id ) { |
|
| 120 | + if ($action_id) { |
|
| 121 | 121 | try { |
| 122 | - ActionScheduler::store()->cancel_action( $action_id ); |
|
| 123 | - } catch ( Exception $exception ) { |
|
| 122 | + ActionScheduler::store()->cancel_action($action_id); |
|
| 123 | + } catch (Exception $exception) { |
|
| 124 | 124 | ActionScheduler::logger()->log( |
| 125 | 125 | $action_id, |
| 126 | 126 | sprintf( |
| 127 | 127 | /* translators: %s is the name of the hook to be cancelled. */ |
| 128 | - __( 'Caught exception while cancelling action: %s', 'woocommerce' ), |
|
| 129 | - esc_attr( $hook ) |
|
| 128 | + __('Caught exception while cancelling action: %s', 'woocommerce'), |
|
| 129 | + esc_attr($hook) |
|
| 130 | 130 | ) |
| 131 | 131 | ); |
| 132 | 132 | |
@@ -144,23 +144,23 @@ discard block |
||
| 144 | 144 | * @param array $args Args that would have been passed to the job. |
| 145 | 145 | * @param string $group The group the job is assigned to. |
| 146 | 146 | */ |
| 147 | -function as_unschedule_all_actions( $hook, $args = array(), $group = '' ) { |
|
| 148 | - if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { |
|
| 147 | +function as_unschedule_all_actions($hook, $args = array(), $group = '') { |
|
| 148 | + if (!ActionScheduler::is_initialized(__FUNCTION__)) { |
|
| 149 | 149 | return; |
| 150 | 150 | } |
| 151 | - if ( empty( $args ) ) { |
|
| 152 | - if ( ! empty( $hook ) && empty( $group ) ) { |
|
| 153 | - ActionScheduler_Store::instance()->cancel_actions_by_hook( $hook ); |
|
| 151 | + if (empty($args)) { |
|
| 152 | + if (!empty($hook) && empty($group)) { |
|
| 153 | + ActionScheduler_Store::instance()->cancel_actions_by_hook($hook); |
|
| 154 | 154 | return; |
| 155 | 155 | } |
| 156 | - if ( ! empty( $group ) && empty( $hook ) ) { |
|
| 157 | - ActionScheduler_Store::instance()->cancel_actions_by_group( $group ); |
|
| 156 | + if (!empty($group) && empty($hook)) { |
|
| 157 | + ActionScheduler_Store::instance()->cancel_actions_by_group($group); |
|
| 158 | 158 | return; |
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | do { |
| 162 | - $unscheduled_action = as_unschedule_action( $hook, $args, $group ); |
|
| 163 | - } while ( ! empty( $unscheduled_action ) ); |
|
| 162 | + $unscheduled_action = as_unschedule_action($hook, $args, $group); |
|
| 163 | + } while (!empty($unscheduled_action)); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @return int|bool The timestamp for the next occurrence of a pending scheduled action, true for an async or in-progress action or false if there is no matching action. |
| 180 | 180 | */ |
| 181 | -function as_next_scheduled_action( $hook, $args = null, $group = '' ) { |
|
| 182 | - if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { |
|
| 181 | +function as_next_scheduled_action($hook, $args = null, $group = '') { |
|
| 182 | + if (!ActionScheduler::is_initialized(__FUNCTION__)) { |
|
| 183 | 183 | return false; |
| 184 | 184 | } |
| 185 | 185 | |
@@ -190,27 +190,27 @@ discard block |
||
| 190 | 190 | 'group' => $group, |
| 191 | 191 | ); |
| 192 | 192 | |
| 193 | - if ( is_array( $args ) ) { |
|
| 193 | + if (is_array($args)) { |
|
| 194 | 194 | $params['args'] = $args; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | $params['status'] = ActionScheduler_Store::STATUS_RUNNING; |
| 198 | - $action_id = ActionScheduler::store()->query_action( $params ); |
|
| 199 | - if ( $action_id ) { |
|
| 198 | + $action_id = ActionScheduler::store()->query_action($params); |
|
| 199 | + if ($action_id) { |
|
| 200 | 200 | return true; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | $params['status'] = ActionScheduler_Store::STATUS_PENDING; |
| 204 | - $action_id = ActionScheduler::store()->query_action( $params ); |
|
| 205 | - if ( null === $action_id ) { |
|
| 204 | + $action_id = ActionScheduler::store()->query_action($params); |
|
| 205 | + if (null === $action_id) { |
|
| 206 | 206 | return false; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - $action = ActionScheduler::store()->fetch_action( $action_id ); |
|
| 209 | + $action = ActionScheduler::store()->fetch_action($action_id); |
|
| 210 | 210 | $scheduled_date = $action->get_schedule()->get_date(); |
| 211 | - if ( $scheduled_date ) { |
|
| 212 | - return (int) $scheduled_date->format( 'U' ); |
|
| 213 | - } elseif ( null === $scheduled_date ) { // pending async action with NullSchedule |
|
| 211 | + if ($scheduled_date) { |
|
| 212 | + return (int) $scheduled_date->format('U'); |
|
| 213 | + } elseif (null === $scheduled_date) { // pending async action with NullSchedule |
|
| 214 | 214 | return true; |
| 215 | 215 | } |
| 216 | 216 | |
@@ -231,23 +231,23 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return bool True if a matching action is pending or in-progress, false otherwise. |
| 233 | 233 | */ |
| 234 | -function as_has_scheduled_action( $hook, $args = null, $group = '' ) { |
|
| 235 | - if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { |
|
| 234 | +function as_has_scheduled_action($hook, $args = null, $group = '') { |
|
| 235 | + if (!ActionScheduler::is_initialized(__FUNCTION__)) { |
|
| 236 | 236 | return false; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | $query_args = array( |
| 240 | 240 | 'hook' => $hook, |
| 241 | - 'status' => array( ActionScheduler_Store::STATUS_RUNNING, ActionScheduler_Store::STATUS_PENDING ), |
|
| 241 | + 'status' => array(ActionScheduler_Store::STATUS_RUNNING, ActionScheduler_Store::STATUS_PENDING), |
|
| 242 | 242 | 'group' => $group, |
| 243 | 243 | 'orderby' => 'none', |
| 244 | 244 | ); |
| 245 | 245 | |
| 246 | - if ( null !== $args ) { |
|
| 246 | + if (null !== $args) { |
|
| 247 | 247 | $query_args['args'] = $args; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - $action_id = ActionScheduler::store()->query_action( $query_args ); |
|
| 250 | + $action_id = ActionScheduler::store()->query_action($query_args); |
|
| 251 | 251 | |
| 252 | 252 | return $action_id !== null; |
| 253 | 253 | } |
@@ -274,29 +274,29 @@ discard block |
||
| 274 | 274 | * |
| 275 | 275 | * @return array |
| 276 | 276 | */ |
| 277 | -function as_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { |
|
| 278 | - if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) { |
|
| 277 | +function as_get_scheduled_actions($args = array(), $return_format = OBJECT) { |
|
| 278 | + if (!ActionScheduler::is_initialized(__FUNCTION__)) { |
|
| 279 | 279 | return array(); |
| 280 | 280 | } |
| 281 | 281 | $store = ActionScheduler::store(); |
| 282 | - foreach ( array('date', 'modified') as $key ) { |
|
| 283 | - if ( isset($args[$key]) ) { |
|
| 282 | + foreach (array('date', 'modified') as $key) { |
|
| 283 | + if (isset($args[$key])) { |
|
| 284 | 284 | $args[$key] = as_get_datetime_object($args[$key]); |
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | - $ids = $store->query_actions( $args ); |
|
| 287 | + $ids = $store->query_actions($args); |
|
| 288 | 288 | |
| 289 | - if ( $return_format == 'ids' || $return_format == 'int' ) { |
|
| 289 | + if ($return_format == 'ids' || $return_format == 'int') { |
|
| 290 | 290 | return $ids; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | $actions = array(); |
| 294 | - foreach ( $ids as $action_id ) { |
|
| 295 | - $actions[$action_id] = $store->fetch_action( $action_id ); |
|
| 294 | + foreach ($ids as $action_id) { |
|
| 295 | + $actions[$action_id] = $store->fetch_action($action_id); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - if ( $return_format == ARRAY_A ) { |
|
| 299 | - foreach ( $actions as $action_id => $action_object ) { |
|
| 298 | + if ($return_format == ARRAY_A) { |
|
| 299 | + foreach ($actions as $action_id => $action_object) { |
|
| 300 | 300 | $actions[$action_id] = get_object_vars($action_object); |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -321,13 +321,13 @@ discard block |
||
| 321 | 321 | * |
| 322 | 322 | * @return ActionScheduler_DateTime |
| 323 | 323 | */ |
| 324 | -function as_get_datetime_object( $date_string = null, $timezone = 'UTC' ) { |
|
| 325 | - if ( is_object( $date_string ) && $date_string instanceof DateTime ) { |
|
| 326 | - $date = new ActionScheduler_DateTime( $date_string->format( 'Y-m-d H:i:s' ), new DateTimeZone( $timezone ) ); |
|
| 327 | - } elseif ( is_numeric( $date_string ) ) { |
|
| 328 | - $date = new ActionScheduler_DateTime( '@' . $date_string, new DateTimeZone( $timezone ) ); |
|
| 324 | +function as_get_datetime_object($date_string = null, $timezone = 'UTC') { |
|
| 325 | + if (is_object($date_string) && $date_string instanceof DateTime) { |
|
| 326 | + $date = new ActionScheduler_DateTime($date_string->format('Y-m-d H:i:s'), new DateTimeZone($timezone)); |
|
| 327 | + } elseif (is_numeric($date_string)) { |
|
| 328 | + $date = new ActionScheduler_DateTime('@' . $date_string, new DateTimeZone($timezone)); |
|
| 329 | 329 | } else { |
| 330 | - $date = new ActionScheduler_DateTime( null === $date_string ? 'now' : $date_string, new DateTimeZone( $timezone ) ); |
|
| 330 | + $date = new ActionScheduler_DateTime(null === $date_string ? 'now' : $date_string, new DateTimeZone($timezone)); |
|
| 331 | 331 | } |
| 332 | 332 | return $date; |
| 333 | 333 | } |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @return string The job ID |
| 20 | 20 | */ |
| 21 | -function wc_schedule_single_action( $timestamp, $hook, $args = array(), $group = '' ) { |
|
| 22 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_single_action()' ); |
|
| 23 | - return as_schedule_single_action( $timestamp, $hook, $args, $group ); |
|
| 21 | +function wc_schedule_single_action($timestamp, $hook, $args = array(), $group = '') { |
|
| 22 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_schedule_single_action()'); |
|
| 23 | + return as_schedule_single_action($timestamp, $hook, $args, $group); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @return string The job ID |
| 38 | 38 | */ |
| 39 | -function wc_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { |
|
| 40 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_recurring_action()' ); |
|
| 41 | - return as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group ); |
|
| 39 | +function wc_schedule_recurring_action($timestamp, $interval_in_seconds, $hook, $args = array(), $group = '') { |
|
| 40 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_schedule_recurring_action()'); |
|
| 41 | + return as_schedule_recurring_action($timestamp, $interval_in_seconds, $hook, $args, $group); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string The job ID |
| 66 | 66 | */ |
| 67 | -function wc_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) { |
|
| 68 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_cron_action()' ); |
|
| 69 | - return as_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group ); |
|
| 67 | +function wc_schedule_cron_action($timestamp, $schedule, $hook, $args = array(), $group = '') { |
|
| 68 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_schedule_cron_action()'); |
|
| 69 | + return as_schedule_cron_action($timestamp, $schedule, $hook, $args, $group); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @deprecated 2.1.0 |
| 80 | 80 | */ |
| 81 | -function wc_unschedule_action( $hook, $args = array(), $group = '' ) { |
|
| 82 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_unschedule_action()' ); |
|
| 83 | - as_unschedule_action( $hook, $args, $group ); |
|
| 81 | +function wc_unschedule_action($hook, $args = array(), $group = '') { |
|
| 82 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_unschedule_action()'); |
|
| 83 | + as_unschedule_action($hook, $args, $group); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @return int|bool The timestamp for the next occurrence, or false if nothing was found |
| 94 | 94 | */ |
| 95 | -function wc_next_scheduled_action( $hook, $args = NULL, $group = '' ) { |
|
| 96 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_next_scheduled_action()' ); |
|
| 97 | - return as_next_scheduled_action( $hook, $args, $group ); |
|
| 95 | +function wc_next_scheduled_action($hook, $args = NULL, $group = '') { |
|
| 96 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_next_scheduled_action()'); |
|
| 97 | + return as_next_scheduled_action($hook, $args, $group); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @return array |
| 122 | 122 | */ |
| 123 | -function wc_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { |
|
| 124 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_get_scheduled_actions()' ); |
|
| 125 | - return as_get_scheduled_actions( $args, $return_format ); |
|
| 123 | +function wc_get_scheduled_actions($args = array(), $return_format = OBJECT) { |
|
| 124 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_get_scheduled_actions()'); |
|
| 125 | + return as_get_scheduled_actions($args, $return_format); |
|
| 126 | 126 | } |
@@ -13,16 +13,16 @@ |
||
| 13 | 13 | * |
| 14 | 14 | * @return DateTime|null |
| 15 | 15 | */ |
| 16 | - public function next( DateTime $after = null ) { |
|
| 17 | - if ( empty( $after ) ) { |
|
| 16 | + public function next(DateTime $after = null) { |
|
| 17 | + if (empty($after)) { |
|
| 18 | 18 | $return_value = $this->get_date(); |
| 19 | 19 | $replacement_method = 'get_date()'; |
| 20 | 20 | } else { |
| 21 | - $return_value = $this->get_next( $after ); |
|
| 21 | + $return_value = $this->get_next($after); |
|
| 22 | 22 | $replacement_method = 'get_next( $after )'; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - _deprecated_function( __METHOD__, '3.0.0', __CLASS__ . '::' . $replacement_method ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 25 | + _deprecated_function(__METHOD__, '3.0.0', __CLASS__ . '::' . $replacement_method); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 26 | 26 | |
| 27 | 27 | return $return_value; |
| 28 | 28 | } |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | class ActionScheduler_AdminView_Deprecated { |
| 12 | 12 | |
| 13 | - public function action_scheduler_post_type_args( $args ) { |
|
| 14 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
| 13 | + public function action_scheduler_post_type_args($args) { |
|
| 14 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
| 15 | 15 | return $args; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | * @param array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
| 22 | 22 | * @return array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
| 23 | 23 | */ |
| 24 | - public function list_table_views( $views ) { |
|
| 25 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
| 24 | + public function list_table_views($views) { |
|
| 25 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
| 26 | 26 | return $views; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
| 35 | 35 | * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
| 36 | 36 | */ |
| 37 | - public function bulk_actions( $actions ) { |
|
| 38 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
| 37 | + public function bulk_actions($actions) { |
|
| 38 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
| 39 | 39 | return $actions; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | * @param array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
| 49 | 49 | * @return array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
| 50 | 50 | */ |
| 51 | - public function list_table_columns( $columns ) { |
|
| 52 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
| 51 | + public function list_table_columns($columns) { |
|
| 52 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
| 53 | 53 | return $columns; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | * @param array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
| 60 | 60 | * @return array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
| 61 | 61 | */ |
| 62 | - public static function list_table_sortable_columns( $columns ) { |
|
| 63 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
| 62 | + public static function list_table_sortable_columns($columns) { |
|
| 63 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
| 64 | 64 | return $columns; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | * @param string $column_name The key for the column for which we should output our content. |
| 71 | 71 | * @param int $post_id The ID of the 'scheduled-action' post for which this row relates. |
| 72 | 72 | */ |
| 73 | - public static function list_table_column_content( $column_name, $post_id ) { |
|
| 74 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
| 73 | + public static function list_table_column_content($column_name, $post_id) { |
|
| 74 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
| 83 | 83 | * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
| 84 | 84 | */ |
| 85 | - public static function row_actions( $actions, $post ) { |
|
| 86 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
| 85 | + public static function row_actions($actions, $post) { |
|
| 86 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
| 87 | 87 | return $actions; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @codeCoverageIgnore |
| 94 | 94 | */ |
| 95 | 95 | public static function maybe_execute_action() { |
| 96 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
| 96 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @return string A human friendly string representation of the interval. |
| 110 | 110 | */ |
| 111 | 111 | public static function admin_notices() { |
| 112 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
| 112 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | * @param WP_Query $query Instance of a WP_Query object |
| 120 | 120 | * @return string MySQL orderby string. |
| 121 | 121 | */ |
| 122 | - public function custom_orderby( $orderby, $query ){ |
|
| 123 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
| 122 | + public function custom_orderby($orderby, $query) { |
|
| 123 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | * @param WP_Query $query Instance of a WP_Query object |
| 131 | 131 | * @return string MySQL search string. |
| 132 | 132 | */ |
| 133 | - public function search_post_password( $search, $query ) { |
|
| 134 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
| 133 | + public function search_post_password($search, $query) { |
|
| 134 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | * @param array $messages |
| 141 | 141 | * @return array |
| 142 | 142 | */ |
| 143 | - public function post_updated_messages( $messages ) { |
|
| 144 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
| 143 | + public function post_updated_messages($messages) { |
|
| 144 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
| 145 | 145 | return $messages; |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | \ No newline at end of file |
@@ -13,9 +13,9 @@ discard block |
||
| 13 | 13 | * |
| 14 | 14 | * @param int $action_id The ID of the action. |
| 15 | 15 | */ |
| 16 | - public function mark_failed_fetch_action( $action_id ) { |
|
| 17 | - _deprecated_function( __METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()' ); |
|
| 18 | - self::$store->mark_failure( $action_id ); |
|
| 16 | + public function mark_failed_fetch_action($action_id) { |
|
| 17 | + _deprecated_function(__METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()'); |
|
| 18 | + self::$store->mark_failure($action_id); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @since 2.2.6 |
| 25 | 25 | */ |
| 26 | 26 | protected static function hook() { |
| 27 | - _deprecated_function( __METHOD__, '3.0.0' ); |
|
| 27 | + _deprecated_function(__METHOD__, '3.0.0'); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @since 2.2.6 |
| 34 | 34 | */ |
| 35 | 35 | protected static function unhook() { |
| 36 | - _deprecated_function( __METHOD__, '3.0.0' ); |
|
| 36 | + _deprecated_function(__METHOD__, '3.0.0'); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @return DateTimeZone |
| 44 | 44 | */ |
| 45 | 45 | protected function get_local_timezone() { |
| 46 | - _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); |
|
| 46 | + _deprecated_function(__FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()'); |
|
| 47 | 47 | return ActionScheduler_TimezoneHelper::get_local_timezone(); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -12,16 +12,16 @@ |
||
| 12 | 12 | * @return int The number of seconds. |
| 13 | 13 | */ |
| 14 | 14 | protected function get_maximum_execution_time() { |
| 15 | - _deprecated_function( __METHOD__, '2.1.1', 'ActionScheduler_Abstract_QueueRunner::get_time_limit()' ); |
|
| 15 | + _deprecated_function(__METHOD__, '2.1.1', 'ActionScheduler_Abstract_QueueRunner::get_time_limit()'); |
|
| 16 | 16 | |
| 17 | 17 | $maximum_execution_time = 30; |
| 18 | 18 | |
| 19 | 19 | // Apply deprecated filter |
| 20 | - if ( has_filter( 'action_scheduler_maximum_execution_time' ) ) { |
|
| 21 | - _deprecated_function( 'action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit' ); |
|
| 22 | - $maximum_execution_time = apply_filters( 'action_scheduler_maximum_execution_time', $maximum_execution_time ); |
|
| 20 | + if (has_filter('action_scheduler_maximum_execution_time')) { |
|
| 21 | + _deprecated_function('action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit'); |
|
| 22 | + $maximum_execution_time = apply_filters('action_scheduler_maximum_execution_time', $maximum_execution_time); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - return absint( $maximum_execution_time ); |
|
| 25 | + return absint($maximum_execution_time); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -26,21 +26,21 @@ discard block |
||
| 26 | 26 | * @package ActionScheduler |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -if ( ! function_exists( 'action_scheduler_register_3_dot_4_dot_0' ) && function_exists( 'add_action' ) ) { |
|
| 29 | +if (!function_exists('action_scheduler_register_3_dot_4_dot_0') && function_exists('add_action')) { |
|
| 30 | 30 | |
| 31 | - if ( ! class_exists( 'ActionScheduler_Versions', false ) ) { |
|
| 31 | + if (!class_exists('ActionScheduler_Versions', false)) { |
|
| 32 | 32 | require_once __DIR__ . '/classes/ActionScheduler_Versions.php'; |
| 33 | - add_action( 'plugins_loaded', array( 'ActionScheduler_Versions', 'initialize_latest_version' ), 1, 0 ); |
|
| 33 | + add_action('plugins_loaded', array('ActionScheduler_Versions', 'initialize_latest_version'), 1, 0); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_4_dot_0', 0, 0 ); |
|
| 36 | + add_action('plugins_loaded', 'action_scheduler_register_3_dot_4_dot_0', 0, 0); |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Registers this version of Action Scheduler. |
| 40 | 40 | */ |
| 41 | 41 | function action_scheduler_register_3_dot_4_dot_0() { |
| 42 | 42 | $versions = ActionScheduler_Versions::instance(); |
| 43 | - $versions->register( '3.4.0', 'action_scheduler_initialize_3_dot_4_dot_0' ); |
|
| 43 | + $versions->register('3.4.0', 'action_scheduler_initialize_3_dot_4_dot_0'); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -50,16 +50,16 @@ discard block |
||
| 50 | 50 | // A final safety check is required even here, because historic versions of Action Scheduler |
| 51 | 51 | // followed a different pattern (in some unusual cases, we could reach this point and the |
| 52 | 52 | // ActionScheduler class is already defined—so we need to guard against that). |
| 53 | - if ( ! class_exists( 'ActionScheduler', false ) ) { |
|
| 53 | + if (!class_exists('ActionScheduler', false)) { |
|
| 54 | 54 | require_once __DIR__ . '/classes/abstracts/ActionScheduler.php'; |
| 55 | - ActionScheduler::init( __FILE__ ); |
|
| 55 | + ActionScheduler::init(__FILE__); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Support usage in themes - load this version if no plugin has loaded a version yet. |
| 60 | - if ( did_action( 'plugins_loaded' ) && ! doing_action( 'plugins_loaded' ) && ! class_exists( 'ActionScheduler', false ) ) { |
|
| 60 | + if (did_action('plugins_loaded') && !doing_action('plugins_loaded') && !class_exists('ActionScheduler', false)) { |
|
| 61 | 61 | action_scheduler_initialize_3_dot_4_dot_0(); |
| 62 | - do_action( 'action_scheduler_pre_theme_init' ); |
|
| 62 | + do_action('action_scheduler_pre_theme_init'); |
|
| 63 | 63 | ActionScheduler_Versions::initialize_latest_version(); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | * @internal This file is only used when running as a feature plugin. |
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | -defined( 'ABSPATH' ) || exit; |
|
| 19 | +defined('ABSPATH') || exit; |
|
| 20 | 20 | |
| 21 | 21 | $minimum_wp_version = '5.9'; |
| 22 | 22 | |
| 23 | -if ( ! defined( 'WC_BLOCKS_IS_FEATURE_PLUGIN' ) ) { |
|
| 24 | - define( 'WC_BLOCKS_IS_FEATURE_PLUGIN', true ); |
|
| 23 | +if (!defined('WC_BLOCKS_IS_FEATURE_PLUGIN')) { |
|
| 24 | + define('WC_BLOCKS_IS_FEATURE_PLUGIN', true); |
|
| 25 | 25 | } |
| 26 | 26 | /** |
| 27 | 27 | * Whether notices must be displayed in the current page (plugins and WooCommerce pages). |
@@ -31,36 +31,36 @@ discard block |
||
| 31 | 31 | function should_display_compatibility_notices() { |
| 32 | 32 | $current_screen = get_current_screen(); |
| 33 | 33 | |
| 34 | - if ( ! isset( $current_screen ) ) { |
|
| 34 | + if (!isset($current_screen)) { |
|
| 35 | 35 | return false; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $is_plugins_page = |
| 39 | - property_exists( $current_screen, 'id' ) && |
|
| 39 | + property_exists($current_screen, 'id') && |
|
| 40 | 40 | 'plugins' === $current_screen->id; |
| 41 | 41 | $is_woocommerce_page = |
| 42 | - property_exists( $current_screen, 'parent_base' ) && |
|
| 42 | + property_exists($current_screen, 'parent_base') && |
|
| 43 | 43 | 'woocommerce' === $current_screen->parent_base; |
| 44 | 44 | |
| 45 | 45 | return $is_plugins_page || $is_woocommerce_page; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | -if ( version_compare( $GLOBALS['wp_version'], $minimum_wp_version, '<' ) ) { |
|
| 48 | +if (version_compare($GLOBALS['wp_version'], $minimum_wp_version, '<')) { |
|
| 49 | 49 | /** |
| 50 | 50 | * Outputs for an admin notice about running WooCommerce Blocks on outdated WordPress. |
| 51 | 51 | * |
| 52 | 52 | * @since 2.5.0 |
| 53 | 53 | */ |
| 54 | 54 | function woocommerce_blocks_admin_unsupported_wp_notice() { |
| 55 | - if ( should_display_compatibility_notices() ) { |
|
| 55 | + if (should_display_compatibility_notices()) { |
|
| 56 | 56 | ?> |
| 57 | 57 | <div class="notice notice-error"> |
| 58 | - <p><?php esc_html_e( 'The WooCommerce Blocks feature plugin requires a more recent version of WordPress and has been paused. Please update WordPress to continue enjoying WooCommerce Blocks.', 'woocommerce' ); ?></p> |
|
| 58 | + <p><?php esc_html_e('The WooCommerce Blocks feature plugin requires a more recent version of WordPress and has been paused. Please update WordPress to continue enjoying WooCommerce Blocks.', 'woocommerce'); ?></p> |
|
| 59 | 59 | </div> |
| 60 | 60 | <?php |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | - add_action( 'admin_notices', 'woocommerce_blocks_admin_unsupported_wp_notice' ); |
|
| 63 | + add_action('admin_notices', 'woocommerce_blocks_admin_unsupported_wp_notice'); |
|
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -74,25 +74,25 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | function woocommerce_blocks_is_development_version() { |
| 76 | 76 | $composer_file = __DIR__ . '/composer.json'; |
| 77 | - if ( ! is_readable( $composer_file ) ) { |
|
| 77 | + if (!is_readable($composer_file)) { |
|
| 78 | 78 | return false; |
| 79 | 79 | } |
| 80 | 80 | // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- including local file |
| 81 | - $composer_config = json_decode( file_get_contents( $composer_file ), true ); |
|
| 82 | - return ! isset( $composer_config['version'] ); |
|
| 81 | + $composer_config = json_decode(file_get_contents($composer_file), true); |
|
| 82 | + return !isset($composer_config['version']); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * If development version is detected and the Jetpack constant is not defined, show a notice. |
| 87 | 87 | */ |
| 88 | -if ( woocommerce_blocks_is_development_version() && ! defined( 'JETPACK_AUTOLOAD_DEV' ) ) { |
|
| 88 | +if (woocommerce_blocks_is_development_version() && !defined('JETPACK_AUTOLOAD_DEV')) { |
|
| 89 | 89 | add_action( |
| 90 | 90 | 'admin_notices', |
| 91 | 91 | function() { |
| 92 | 92 | echo '<div class="error"><p>'; |
| 93 | 93 | printf( |
| 94 | 94 | /* translators: %1$s is referring to a php constant name, %2$s is referring to the wp-config.php file. */ |
| 95 | - esc_html__( 'WooCommerce Blocks development mode requires the %1$s constant to be defined and true in your %2$s file. Otherwise you are loading the blocks package from WooCommerce core.', 'woocommerce' ), |
|
| 95 | + esc_html__('WooCommerce Blocks development mode requires the %1$s constant to be defined and true in your %2$s file. Otherwise you are loading the blocks package from WooCommerce core.', 'woocommerce'), |
|
| 96 | 96 | 'JETPACK_AUTOLOAD_DEV', |
| 97 | 97 | 'wp-config.php' |
| 98 | 98 | ); |
@@ -112,16 +112,16 @@ discard block |
||
| 112 | 112 | * If the autoloader is not present, let's log the failure and display a nice admin notice. |
| 113 | 113 | */ |
| 114 | 114 | $autoloader = __DIR__ . '/vendor/autoload_packages.php'; |
| 115 | -if ( is_readable( $autoloader ) ) { |
|
| 115 | +if (is_readable($autoloader)) { |
|
| 116 | 116 | require $autoloader; |
| 117 | 117 | } else { |
| 118 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 118 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 119 | 119 | error_log( // phpcs:ignore |
| 120 | 120 | sprintf( |
| 121 | 121 | /* translators: 1: composer command. 2: plugin directory */ |
| 122 | - esc_html__( 'Your installation of the WooCommerce Blocks feature plugin is incomplete. Please run %1$s within the %2$s directory.', 'woocommerce' ), |
|
| 122 | + esc_html__('Your installation of the WooCommerce Blocks feature plugin is incomplete. Please run %1$s within the %2$s directory.', 'woocommerce'), |
|
| 123 | 123 | '`composer install`', |
| 124 | - '`' . esc_html( str_replace( ABSPATH, '', __DIR__ ) ) . '`' |
|
| 124 | + '`' . esc_html(str_replace(ABSPATH, '', __DIR__)) . '`' |
|
| 125 | 125 | ) |
| 126 | 126 | ); |
| 127 | 127 | } |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | <?php |
| 138 | 138 | printf( |
| 139 | 139 | /* translators: 1: composer command. 2: plugin directory */ |
| 140 | - esc_html__( 'Your installation of the WooCommerce Blocks feature plugin is incomplete. Please run %1$s within the %2$s directory.', 'woocommerce' ), |
|
| 140 | + esc_html__('Your installation of the WooCommerce Blocks feature plugin is incomplete. Please run %1$s within the %2$s directory.', 'woocommerce'), |
|
| 141 | 141 | '<code>composer install</code>', |
| 142 | - '<code>' . esc_html( str_replace( ABSPATH, '', __DIR__ ) ) . '</code>' |
|
| 142 | + '<code>' . esc_html(str_replace(ABSPATH, '', __DIR__)) . '</code>' |
|
| 143 | 143 | ); |
| 144 | 144 | ?> |
| 145 | 145 | </p> |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | return; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | -add_action( 'plugins_loaded', array( '\Automattic\WooCommerce\Blocks\Package', 'init' ) ); |
|
| 153 | +add_action('plugins_loaded', array('\Automattic\WooCommerce\Blocks\Package', 'init')); |
|
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | 156 | * WordPress will look for translation in the following order: |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | * |
| 168 | 168 | * @return string|false Path to the translation file to load. False if there isn't one. |
| 169 | 169 | */ |
| 170 | -function load_woocommerce_core_json_translation( $file, $handle, $domain ) { |
|
| 171 | - if ( 'woo-gutenberg-products-block' !== $domain ) { |
|
| 170 | +function load_woocommerce_core_json_translation($file, $handle, $domain) { |
|
| 171 | + if ('woo-gutenberg-products-block' !== $domain) { |
|
| 172 | 172 | return $file; |
| 173 | 173 | } |
| 174 | 174 | |
@@ -178,32 +178,32 @@ discard block |
||
| 178 | 178 | * We only care about the translation file of the feature plugin in the |
| 179 | 179 | * wp-content/languages folder. |
| 180 | 180 | */ |
| 181 | - if ( false === strpos( $file, $lang_dir ) ) { |
|
| 181 | + if (false === strpos($file, $lang_dir)) { |
|
| 182 | 182 | return $file; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // If the translation file for feature plugin exist, use it. |
| 186 | - if ( is_readable( $file ) ) { |
|
| 186 | + if (is_readable($file)) { |
|
| 187 | 187 | return $file; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | global $wp_scripts; |
| 191 | 191 | |
| 192 | - if ( ! isset( $wp_scripts->registered[ $handle ], $wp_scripts->registered[ $handle ]->src ) ) { |
|
| 192 | + if (!isset($wp_scripts->registered[$handle], $wp_scripts->registered[$handle]->src)) { |
|
| 193 | 193 | return $file; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - $handle_src = explode( '/build/', $wp_scripts->registered[ $handle ]->src ); |
|
| 196 | + $handle_src = explode('/build/', $wp_scripts->registered[$handle]->src); |
|
| 197 | 197 | $handle_filename = $handle_src[1]; |
| 198 | 198 | $locale = determine_locale(); |
| 199 | 199 | $lang_dir = WP_LANG_DIR . '/plugins'; |
| 200 | 200 | |
| 201 | 201 | // Translations are always based on the unminified filename. |
| 202 | - if ( substr( $handle_filename, -7 ) === '.min.js' ) { |
|
| 203 | - $handle_filename = substr( $handle_filename, 0, -7 ) . '.js'; |
|
| 202 | + if (substr($handle_filename, -7) === '.min.js') { |
|
| 203 | + $handle_filename = substr($handle_filename, 0, -7) . '.js'; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - $core_path_md5 = md5( 'packages/woocommerce-blocks/build/' . $handle_filename ); |
|
| 206 | + $core_path_md5 = md5('packages/woocommerce-blocks/build/' . $handle_filename); |
|
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | 209 | * Return file path of the corresponding translation file in the WC Core is |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | return $lang_dir . '/woocommerce-' . $locale . '-' . $core_path_md5 . '.json'; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | -add_filter( 'load_script_translation_file', 'load_woocommerce_core_json_translation', 10, 3 ); |
|
| 216 | +add_filter('load_script_translation_file', 'load_woocommerce_core_json_translation', 10, 3); |
|
| 217 | 217 | |
| 218 | 218 | /** |
| 219 | 219 | * Filter translations so we can retrieve translations from Core when the original and the translated |
@@ -224,20 +224,20 @@ discard block |
||
| 224 | 224 | * @param string $domain The text domain. |
| 225 | 225 | * @return string WC Blocks translation. In case it's the same as $text, Core translation. |
| 226 | 226 | */ |
| 227 | -function woocommerce_blocks_get_php_translation_from_core( $translation, $text, $domain ) { |
|
| 228 | - if ( 'woo-gutenberg-products-block' !== $domain ) { |
|
| 227 | +function woocommerce_blocks_get_php_translation_from_core($translation, $text, $domain) { |
|
| 228 | + if ('woo-gutenberg-products-block' !== $domain) { |
|
| 229 | 229 | return $translation; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // When translation is the same, that could mean the string is not translated. |
| 233 | 233 | // In that case, load it from core. |
| 234 | - if ( $translation === $text ) { |
|
| 235 | - return translate( $text, 'woocommerce' ); // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction, WordPress.WP.I18n.NonSingularStringLiteralText, WordPress.WP.I18n.TextDomainMismatch |
|
| 234 | + if ($translation === $text) { |
|
| 235 | + return translate($text, 'woocommerce'); // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction, WordPress.WP.I18n.NonSingularStringLiteralText, WordPress.WP.I18n.TextDomainMismatch |
|
| 236 | 236 | } |
| 237 | 237 | return $translation; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | -add_filter( 'gettext', 'woocommerce_blocks_get_php_translation_from_core', 10, 3 ); |
|
| 240 | +add_filter('gettext', 'woocommerce_blocks_get_php_translation_from_core', 10, 3); |
|
| 241 | 241 | |
| 242 | 242 | /** |
| 243 | 243 | * Add notice to the admin dashboard if the plugin is outdated. |
@@ -246,11 +246,11 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | function woocommerce_blocks_plugin_outdated_notice() { |
| 248 | 248 | $is_active = |
| 249 | - is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) || |
|
| 250 | - is_plugin_active( 'woocommerce-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) || |
|
| 251 | - is_plugin_active( 'woocommerce-blocks/woocommerce-gutenberg-products-block.php' ); |
|
| 249 | + is_plugin_active('woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php') || |
|
| 250 | + is_plugin_active('woocommerce-gutenberg-products-block/woocommerce-gutenberg-products-block.php') || |
|
| 251 | + is_plugin_active('woocommerce-blocks/woocommerce-gutenberg-products-block.php'); |
|
| 252 | 252 | |
| 253 | - if ( ! $is_active ) { |
|
| 253 | + if (!$is_active) { |
|
| 254 | 254 | return; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -261,17 +261,17 @@ discard block |
||
| 261 | 261 | * the current path is from the WC Core, we can consider the plugin is |
| 262 | 262 | * outdated because Jetpack Autoloader always loads the newer package. |
| 263 | 263 | */ |
| 264 | - if ( ! strpos( $woocommerce_blocks_path, 'packages/woocommerce-blocks' ) ) { |
|
| 264 | + if (!strpos($woocommerce_blocks_path, 'packages/woocommerce-blocks')) { |
|
| 265 | 265 | return; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - if ( should_display_compatibility_notices() ) { |
|
| 268 | + if (should_display_compatibility_notices()) { |
|
| 269 | 269 | ?> |
| 270 | 270 | <div class="notice notice-warning"> |
| 271 | - <p><?php esc_html_e( 'You have WooCommerce Blocks installed, but the WooCommerce bundled version is running because it is more up-to-date. This may cause unexpected compatibility issues. Please update the WooCommerce Blocks plugin.', 'woocommerce' ); ?></p> |
|
| 271 | + <p><?php esc_html_e('You have WooCommerce Blocks installed, but the WooCommerce bundled version is running because it is more up-to-date. This may cause unexpected compatibility issues. Please update the WooCommerce Blocks plugin.', 'woocommerce'); ?></p> |
|
| 272 | 272 | </div> |
| 273 | 273 | <?php |
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | -add_action( 'admin_notices', 'woocommerce_blocks_plugin_outdated_notice' ); |
|
| 277 | +add_action('admin_notices', 'woocommerce_blocks_plugin_outdated_notice'); |
|
@@ -1,54 +1,54 @@ |
||
| 1 | -<?php return array ( |
|
| 1 | +<?php return array( |
|
| 2 | 2 | 'root' => |
| 3 | - array ( |
|
| 3 | + array( |
|
| 4 | 4 | 'pretty_version' => 'dev-trunk', |
| 5 | 5 | 'version' => 'dev-trunk', |
| 6 | 6 | 'aliases' => |
| 7 | - array ( |
|
| 7 | + array( |
|
| 8 | 8 | ), |
| 9 | 9 | 'reference' => '5cc9182a7c1e8991839ea1600607c242e6738991', |
| 10 | 10 | 'name' => 'woocommerce/woocommerce-blocks', |
| 11 | 11 | ), |
| 12 | 12 | 'versions' => |
| 13 | - array ( |
|
| 13 | + array( |
|
| 14 | 14 | 'automattic/jetpack-autoloader' => |
| 15 | - array ( |
|
| 15 | + array( |
|
| 16 | 16 | 'pretty_version' => 'v2.10.7', |
| 17 | 17 | 'version' => '2.10.7.0', |
| 18 | 18 | 'aliases' => |
| 19 | - array ( |
|
| 19 | + array( |
|
| 20 | 20 | ), |
| 21 | 21 | 'reference' => 'e3dfa1a2679e4b8e380bc37b722081875c84a381', |
| 22 | 22 | ), |
| 23 | 23 | 'composer/installers' => |
| 24 | - array ( |
|
| 24 | + array( |
|
| 25 | 25 | 'pretty_version' => 'v1.12.0', |
| 26 | 26 | 'version' => '1.12.0.0', |
| 27 | 27 | 'aliases' => |
| 28 | - array ( |
|
| 28 | + array( |
|
| 29 | 29 | ), |
| 30 | 30 | 'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19', |
| 31 | 31 | ), |
| 32 | 32 | 'roundcube/plugin-installer' => |
| 33 | - array ( |
|
| 33 | + array( |
|
| 34 | 34 | 'replaced' => |
| 35 | - array ( |
|
| 35 | + array( |
|
| 36 | 36 | 0 => '*', |
| 37 | 37 | ), |
| 38 | 38 | ), |
| 39 | 39 | 'shama/baton' => |
| 40 | - array ( |
|
| 40 | + array( |
|
| 41 | 41 | 'replaced' => |
| 42 | - array ( |
|
| 42 | + array( |
|
| 43 | 43 | 0 => '*', |
| 44 | 44 | ), |
| 45 | 45 | ), |
| 46 | 46 | 'woocommerce/woocommerce-blocks' => |
| 47 | - array ( |
|
| 47 | + array( |
|
| 48 | 48 | 'pretty_version' => 'dev-trunk', |
| 49 | 49 | 'version' => 'dev-trunk', |
| 50 | 50 | 'aliases' => |
| 51 | - array ( |
|
| 51 | + array( |
|
| 52 | 52 | ), |
| 53 | 53 | 'reference' => '5cc9182a7c1e8991839ea1600607c242e6738991', |
| 54 | 54 | ), |