@@ -23,11 +23,11 @@ |
||
| 23 | 23 | * @param string $class_name Storage class name. |
| 24 | 24 | * @return RWMB_Storage_Interface |
| 25 | 25 | */ |
| 26 | - public function get( $class_name ) { |
|
| 27 | - if ( empty( $this->storages[ $class_name ] ) ) { |
|
| 28 | - $this->storages[ $class_name ] = new $class_name(); |
|
| 26 | + public function get($class_name) { |
|
| 27 | + if (empty($this->storages[$class_name])) { |
|
| 28 | + $this->storages[$class_name] = new $class_name(); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - return $this->storages[ $class_name ]; |
|
| 31 | + return $this->storages[$class_name]; |
|
| 32 | 32 | } |
| 33 | 33 | } |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @return array |
| 24 | 24 | */ |
| 25 | - public static function normalize( $field ) { |
|
| 26 | - $field = parent::normalize( $field ); |
|
| 25 | + public static function normalize($field) { |
|
| 26 | + $field = parent::normalize($field); |
|
| 27 | 27 | $field['multiple'] = true; |
| 28 | 28 | $field['field_name'] = $field['id']; |
| 29 | - if ( ! $field['clone'] ) { |
|
| 29 | + if (!$field['clone']) { |
|
| 30 | 30 | $field['field_name'] .= '[]'; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return string |
| 45 | 45 | */ |
| 46 | - public static function format_single_value( $field, $value, $args, $post_id ) { |
|
| 47 | - return $field['options'][ $value ]; |
|
| 46 | + public static function format_single_value($field, $value, $args, $post_id) { |
|
| 47 | + return $field['options'][$value]; |
|
| 48 | 48 | } |
| 49 | 49 | } |
@@ -15,9 +15,9 @@ |
||
| 15 | 15 | * @param array $field Field parameters. |
| 16 | 16 | * @return array |
| 17 | 17 | */ |
| 18 | - public static function normalize( $field ) { |
|
| 18 | + public static function normalize($field) { |
|
| 19 | 19 | $field['multiple'] = true; |
| 20 | - $field = parent::normalize( $field ); |
|
| 20 | + $field = parent::normalize($field); |
|
| 21 | 21 | |
| 22 | 22 | return $field; |
| 23 | 23 | } |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | * @param array $field The field parameters. |
| 19 | 19 | * @return string |
| 20 | 20 | */ |
| 21 | - public static function value( $new, $old, $post_id, $field ) { |
|
| 22 | - $new = $new !== $old ? wp_hash_password( $new ) : $new; |
|
| 21 | + public static function value($new, $old, $post_id, $field) { |
|
| 22 | + $new = $new !== $old ? wp_hash_password($new) : $new; |
|
| 23 | 23 | return $new; |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -31,14 +31,14 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @see get_metadata() |
| 33 | 33 | */ |
| 34 | - public function get( $object_id, $meta_key, $args = false ) { |
|
| 35 | - if ( is_array( $args ) ) { |
|
| 36 | - $single = ! empty( $args['single'] ); |
|
| 34 | + public function get($object_id, $meta_key, $args = false) { |
|
| 35 | + if (is_array($args)) { |
|
| 36 | + $single = !empty($args['single']); |
|
| 37 | 37 | } else { |
| 38 | 38 | $single = (bool) $args; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - return get_metadata( $this->object_type, $object_id, $meta_key, $single ); |
|
| 41 | + return get_metadata($this->object_type, $object_id, $meta_key, $single); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @see add_metadata() |
| 57 | 57 | */ |
| 58 | - public function add( $object_id, $meta_key, $meta_value, $unique = false ) { |
|
| 59 | - return add_metadata( $this->object_type, $object_id, $meta_key, $meta_value, $unique ); |
|
| 58 | + public function add($object_id, $meta_key, $meta_value, $unique = false) { |
|
| 59 | + return add_metadata($this->object_type, $object_id, $meta_key, $meta_value, $unique); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @see update_metadata() |
| 73 | 73 | */ |
| 74 | - public function update( $object_id, $meta_key, $meta_value, $prev_value = '' ) { |
|
| 75 | - return update_metadata( $this->object_type, $object_id, $meta_key, $meta_value, $prev_value ); |
|
| 74 | + public function update($object_id, $meta_key, $meta_value, $prev_value = '') { |
|
| 75 | + return update_metadata($this->object_type, $object_id, $meta_key, $meta_value, $prev_value); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @see delete_metadata() |
| 94 | 94 | */ |
| 95 | - public function delete( $object_id, $meta_key, $meta_value = '', $delete_all = false ) { |
|
| 96 | - return delete_metadata( $this->object_type, $object_id, $meta_key, $meta_value, $delete_all ); |
|
| 95 | + public function delete($object_id, $meta_key, $meta_value = '', $delete_all = false) { |
|
| 96 | + return delete_metadata($this->object_type, $object_id, $meta_key, $meta_value, $delete_all); |
|
| 97 | 97 | } |
| 98 | 98 | } |
@@ -9,28 +9,28 @@ |
||
| 9 | 9 | <div id="getting-started" class="gt-tab-pane gt-is-active"> |
| 10 | 10 | <div class="two"> |
| 11 | 11 | <div class="col"> |
| 12 | - <h3><?php esc_html_e( 'Getting Started With Online Generator', 'meta-box' ); ?></h3> |
|
| 13 | - <p><?php esc_html_e( 'Online Generator is a free tool to help you create and set up custom fields using a simple, friendly user interface. With it, you can add fields, set options and generate needed code that\'s ready to copy and paste.', 'meta-box' ); ?></p> |
|
| 12 | + <h3><?php esc_html_e('Getting Started With Online Generator', 'meta-box'); ?></h3> |
|
| 13 | + <p><?php esc_html_e('Online Generator is a free tool to help you create and set up custom fields using a simple, friendly user interface. With it, you can add fields, set options and generate needed code that\'s ready to copy and paste.', 'meta-box'); ?></p> |
|
| 14 | 14 | |
| 15 | - <a target="_blank" class="screenshot" href="https://metabox.io/online-generator/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><img src="<?php echo esc_url( RWMB_URL . 'inc/about/images/online-generator.png' ); ?>" alt="<?php esc_attr_e( 'online generator', 'meta-box' ); ?>"></a> |
|
| 15 | + <a target="_blank" class="screenshot" href="https://metabox.io/online-generator/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><img src="<?php echo esc_url(RWMB_URL . 'inc/about/images/online-generator.png'); ?>" alt="<?php esc_attr_e('online generator', 'meta-box'); ?>"></a> |
|
| 16 | 16 | |
| 17 | - <p><a class="button" target="_blank" href="https://metabox.io/online-generator/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Go to Online Generator', 'meta-box' ); ?></a></p> |
|
| 17 | + <p><a class="button" target="_blank" href="https://metabox.io/online-generator/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e('Go to Online Generator', 'meta-box'); ?></a></p> |
|
| 18 | 18 | </div> |
| 19 | 19 | |
| 20 | 20 | <div class="col"> |
| 21 | - <h3><?php esc_html_e( 'Extensions', 'meta-box' ); ?></h3> |
|
| 22 | - <p><?php esc_html_e( 'Wanna see more features that transform your WordPress website into a powerful CMS? Check out some extensions below:', 'meta-box' ); ?><p> |
|
| 21 | + <h3><?php esc_html_e('Extensions', 'meta-box'); ?></h3> |
|
| 22 | + <p><?php esc_html_e('Wanna see more features that transform your WordPress website into a powerful CMS? Check out some extensions below:', 'meta-box'); ?><p> |
|
| 23 | 23 | <ul> |
| 24 | - <li><a target="_blank" href="https://metabox.io/plugins/meta-box-builder/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Meta Box Builder', 'meta-box' ); ?></a> - <?php esc_html_e( 'Build meta boxes and fields with UI.', 'meta-box' ); ?></li> |
|
| 25 | - <li><a target="_blank" href="https://metabox.io/plugins/meta-box-group/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Meta Box Group', 'meta-box' ); ?></a> - <?php esc_html_e( 'Organize fields into repeatable groups.', 'meta-box' ); ?></li> |
|
| 26 | - <li><a target="_blank" href="https://metabox.io/plugins/meta-box-conditional-logic/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Meta Box Conditional Logic', 'meta-box' ); ?></a> - <?php esc_html_e( 'Control the visibility of fields.', 'meta-box' ); ?></li> |
|
| 27 | - <li><a target="_blank" href="https://metabox.io/plugins/mb-settings-page/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'MB Settings Page', 'meta-box' ); ?></a> - <?php esc_html_e( 'Create settings pages/Customizer options.', 'meta-box' ); ?></li> |
|
| 24 | + <li><a target="_blank" href="https://metabox.io/plugins/meta-box-builder/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e('Meta Box Builder', 'meta-box'); ?></a> - <?php esc_html_e('Build meta boxes and fields with UI.', 'meta-box'); ?></li> |
|
| 25 | + <li><a target="_blank" href="https://metabox.io/plugins/meta-box-group/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e('Meta Box Group', 'meta-box'); ?></a> - <?php esc_html_e('Organize fields into repeatable groups.', 'meta-box'); ?></li> |
|
| 26 | + <li><a target="_blank" href="https://metabox.io/plugins/meta-box-conditional-logic/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e('Meta Box Conditional Logic', 'meta-box'); ?></a> - <?php esc_html_e('Control the visibility of fields.', 'meta-box'); ?></li> |
|
| 27 | + <li><a target="_blank" href="https://metabox.io/plugins/mb-settings-page/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e('MB Settings Page', 'meta-box'); ?></a> - <?php esc_html_e('Create settings pages/Customizer options.', 'meta-box'); ?></li> |
|
| 28 | 28 | </ul> |
| 29 | 29 | |
| 30 | 30 | <div class="youtube-video-container"> |
| 31 | 31 | <iframe width="560" height="315" src="https://www.youtube.com/embed/M0nEF7b0woU" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> |
| 32 | 32 | </div> |
| 33 | - <p><a class="button" target="_blank" href="https://metabox.io/plugins/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'More Extensions', 'meta-box' ); ?></a></p> |
|
| 33 | + <p><a class="button" target="_blank" href="https://metabox.io/plugins/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e('More Extensions', 'meta-box'); ?></a></p> |
|
| 34 | 34 | </div> |
| 35 | 35 | </div> |
| 36 | 36 | </div> |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | * @param string $lock_type A string to identify different lock types. |
| 24 | 24 | * @bool True if lock value has changed, false if not or if set failed. |
| 25 | 25 | */ |
| 26 | - public function set( $lock_type ) { |
|
| 27 | - return update_option( $this->get_key( $lock_type ), time() + $this->get_duration( $lock_type ) ); |
|
| 26 | + public function set($lock_type) { |
|
| 27 | + return update_option($this->get_key($lock_type), time() + $this->get_duration($lock_type)); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | * @param string $lock_type A string to identify different lock types. |
| 34 | 34 | * @return bool|int False if no lock is set, otherwise the timestamp for when the lock is set to expire. |
| 35 | 35 | */ |
| 36 | - public function get_expiration( $lock_type ) { |
|
| 37 | - return get_option( $this->get_key( $lock_type ) ); |
|
| 36 | + public function get_expiration($lock_type) { |
|
| 37 | + return get_option($this->get_key($lock_type)); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @param string $lock_type A string to identify different lock types. |
| 44 | 44 | * @return string |
| 45 | 45 | */ |
| 46 | - protected function get_key( $lock_type ) { |
|
| 47 | - return sprintf( 'action_scheduler_lock_%s', $lock_type ); |
|
| 46 | + protected function get_key($lock_type) { |
|
| 47 | + return sprintf('action_scheduler_lock_%s', $lock_type); |
|
| 48 | 48 | } |
| 49 | 49 | } |
@@ -24,33 +24,33 @@ discard block |
||
| 24 | 24 | * @param ActionScheduler_Store $store The store instance. |
| 25 | 25 | * @param int $batch_size The batch size. |
| 26 | 26 | */ |
| 27 | - public function __construct( ActionScheduler_Store $store = null, $batch_size = 20 ) { |
|
| 27 | + public function __construct(ActionScheduler_Store $store = null, $batch_size = 20) { |
|
| 28 | 28 | $this->store = $store ? $store : ActionScheduler_Store::instance(); |
| 29 | 29 | $this->batch_size = $batch_size; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function delete_old_actions() { |
| 33 | - $lifespan = apply_filters( 'action_scheduler_retention_period', $this->month_in_seconds ); |
|
| 34 | - $cutoff = as_get_datetime_object($lifespan.' seconds ago'); |
|
| 33 | + $lifespan = apply_filters('action_scheduler_retention_period', $this->month_in_seconds); |
|
| 34 | + $cutoff = as_get_datetime_object($lifespan . ' seconds ago'); |
|
| 35 | 35 | |
| 36 | 36 | $statuses_to_purge = array( |
| 37 | 37 | ActionScheduler_Store::STATUS_COMPLETE, |
| 38 | 38 | ActionScheduler_Store::STATUS_CANCELED, |
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | - foreach ( $statuses_to_purge as $status ) { |
|
| 42 | - $actions_to_delete = $this->store->query_actions( array( |
|
| 41 | + foreach ($statuses_to_purge as $status) { |
|
| 42 | + $actions_to_delete = $this->store->query_actions(array( |
|
| 43 | 43 | 'status' => $status, |
| 44 | 44 | 'modified' => $cutoff, |
| 45 | 45 | 'modified_compare' => '<=', |
| 46 | 46 | 'per_page' => $this->get_batch_size(), |
| 47 | 47 | 'orderby' => 'none', |
| 48 | - ) ); |
|
| 48 | + )); |
|
| 49 | 49 | |
| 50 | - foreach ( $actions_to_delete as $action_id ) { |
|
| 50 | + foreach ($actions_to_delete as $action_id) { |
|
| 51 | 51 | try { |
| 52 | - $this->store->delete_action( $action_id ); |
|
| 53 | - } catch ( Exception $e ) { |
|
| 52 | + $this->store->delete_action($action_id); |
|
| 53 | + } catch (Exception $e) { |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * Notify 3rd party code of exceptions when deleting a completed action older than the retention period |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param int $lifespan The retention period, in seconds, for old actions |
| 66 | 66 | * @param int $count_of_actions_to_delete The number of old actions being deleted in this batch |
| 67 | 67 | */ |
| 68 | - do_action( 'action_scheduler_failed_old_action_deletion', $action_id, $e, $lifespan, count( $actions_to_delete ) ); |
|
| 68 | + do_action('action_scheduler_failed_old_action_deletion', $action_id, $e, $lifespan, count($actions_to_delete)); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -79,24 +79,24 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @param int $time_limit The number of seconds to allow a queue to run before unclaiming its pending actions. Default 300 (5 minutes). |
| 81 | 81 | */ |
| 82 | - public function reset_timeouts( $time_limit = 300 ) { |
|
| 83 | - $timeout = apply_filters( 'action_scheduler_timeout_period', $time_limit ); |
|
| 84 | - if ( $timeout < 0 ) { |
|
| 82 | + public function reset_timeouts($time_limit = 300) { |
|
| 83 | + $timeout = apply_filters('action_scheduler_timeout_period', $time_limit); |
|
| 84 | + if ($timeout < 0) { |
|
| 85 | 85 | return; |
| 86 | 86 | } |
| 87 | - $cutoff = as_get_datetime_object($timeout.' seconds ago'); |
|
| 88 | - $actions_to_reset = $this->store->query_actions( array( |
|
| 87 | + $cutoff = as_get_datetime_object($timeout . ' seconds ago'); |
|
| 88 | + $actions_to_reset = $this->store->query_actions(array( |
|
| 89 | 89 | 'status' => ActionScheduler_Store::STATUS_PENDING, |
| 90 | 90 | 'modified' => $cutoff, |
| 91 | 91 | 'modified_compare' => '<=', |
| 92 | 92 | 'claimed' => true, |
| 93 | 93 | 'per_page' => $this->get_batch_size(), |
| 94 | 94 | 'orderby' => 'none', |
| 95 | - ) ); |
|
| 95 | + )); |
|
| 96 | 96 | |
| 97 | - foreach ( $actions_to_reset as $action_id ) { |
|
| 98 | - $this->store->unclaim_action( $action_id ); |
|
| 99 | - do_action( 'action_scheduler_reset_action', $action_id ); |
|
| 97 | + foreach ($actions_to_reset as $action_id) { |
|
| 98 | + $this->store->unclaim_action($action_id); |
|
| 99 | + do_action('action_scheduler_reset_action', $action_id); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -109,23 +109,23 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @param int $time_limit The number of seconds to allow an action to run before it is considered to have failed. Default 300 (5 minutes). |
| 111 | 111 | */ |
| 112 | - public function mark_failures( $time_limit = 300 ) { |
|
| 113 | - $timeout = apply_filters( 'action_scheduler_failure_period', $time_limit ); |
|
| 114 | - if ( $timeout < 0 ) { |
|
| 112 | + public function mark_failures($time_limit = 300) { |
|
| 113 | + $timeout = apply_filters('action_scheduler_failure_period', $time_limit); |
|
| 114 | + if ($timeout < 0) { |
|
| 115 | 115 | return; |
| 116 | 116 | } |
| 117 | - $cutoff = as_get_datetime_object($timeout.' seconds ago'); |
|
| 118 | - $actions_to_reset = $this->store->query_actions( array( |
|
| 117 | + $cutoff = as_get_datetime_object($timeout . ' seconds ago'); |
|
| 118 | + $actions_to_reset = $this->store->query_actions(array( |
|
| 119 | 119 | 'status' => ActionScheduler_Store::STATUS_RUNNING, |
| 120 | 120 | 'modified' => $cutoff, |
| 121 | 121 | 'modified_compare' => '<=', |
| 122 | 122 | 'per_page' => $this->get_batch_size(), |
| 123 | 123 | 'orderby' => 'none', |
| 124 | - ) ); |
|
| 124 | + )); |
|
| 125 | 125 | |
| 126 | - foreach ( $actions_to_reset as $action_id ) { |
|
| 127 | - $this->store->mark_failure( $action_id ); |
|
| 128 | - do_action( 'action_scheduler_failed_action', $action_id, $timeout ); |
|
| 126 | + foreach ($actions_to_reset as $action_id) { |
|
| 127 | + $this->store->mark_failure($action_id); |
|
| 128 | + do_action('action_scheduler_failed_action', $action_id, $timeout); |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | * @param int $time_limit The number of seconds to use as the timeout and failure period. Default 300 (5 minutes). |
| 136 | 136 | * @author Jeremy Pry |
| 137 | 137 | */ |
| 138 | - public function clean( $time_limit = 300 ) { |
|
| 138 | + public function clean($time_limit = 300) { |
|
| 139 | 139 | $this->delete_old_actions(); |
| 140 | - $this->reset_timeouts( $time_limit ); |
|
| 141 | - $this->mark_failures( $time_limit ); |
|
| 140 | + $this->reset_timeouts($time_limit); |
|
| 141 | + $this->mark_failures($time_limit); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -153,6 +153,6 @@ discard block |
||
| 153 | 153 | * |
| 154 | 154 | * @param int $batch_size The number of actions to clean in one batch. |
| 155 | 155 | */ |
| 156 | - return absint( apply_filters( 'action_scheduler_cleanup_batch_size', $this->batch_size ) ); |
|
| 156 | + return absint(apply_filters('action_scheduler_cleanup_batch_size', $this->batch_size)); |
|
| 157 | 157 | } |
| 158 | 158 | } |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | * @return bool |
| 45 | 45 | */ |
| 46 | 46 | public static function dependencies_met() { |
| 47 | - $php_support = version_compare( PHP_VERSION, self::MIN_PHP_VERSION, '>=' ); |
|
| 48 | - return $php_support && apply_filters( 'action_scheduler_migration_dependencies_met', true ); |
|
| 47 | + $php_support = version_compare(PHP_VERSION, self::MIN_PHP_VERSION, '>='); |
|
| 48 | + return $php_support && apply_filters('action_scheduler_migration_dependencies_met', true); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -54,14 +54,14 @@ discard block |
||
| 54 | 54 | * @return bool Whether the flag has been set marking the migration as complete |
| 55 | 55 | */ |
| 56 | 56 | public static function is_migration_complete() { |
| 57 | - return get_option( self::STATUS_FLAG ) === self::STATUS_COMPLETE; |
|
| 57 | + return get_option(self::STATUS_FLAG) === self::STATUS_COMPLETE; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Mark the migration as complete. |
| 62 | 62 | */ |
| 63 | 63 | public static function mark_migration_complete() { |
| 64 | - update_option( self::STATUS_FLAG, self::STATUS_COMPLETE ); |
|
| 64 | + update_option(self::STATUS_FLAG, self::STATUS_COMPLETE); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * deactivated and the site was running on AS 2.x again. |
| 71 | 71 | */ |
| 72 | 72 | public static function mark_migration_incomplete() { |
| 73 | - delete_option( self::STATUS_FLAG ); |
|
| 73 | + delete_option(self::STATUS_FLAG); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return string |
| 82 | 82 | */ |
| 83 | - public static function set_store_class( $class ) { |
|
| 83 | + public static function set_store_class($class) { |
|
| 84 | 84 | return self::DATASTORE_CLASS; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @return string |
| 93 | 93 | */ |
| 94 | - public static function set_logger_class( $class ) { |
|
| 94 | + public static function set_logger_class($class) { |
|
| 95 | 95 | return self::LOGGER_CLASS; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @param integer $sleep_time The number of seconds to pause before resuming operation. |
| 102 | 102 | */ |
| 103 | - public static function set_sleep_time( $sleep_time ) { |
|
| 103 | + public static function set_sleep_time($sleep_time) { |
|
| 104 | 104 | self::$sleep_time = (int) $sleep_time; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @param integer $free_ticks The number of ticks to free memory on. |
| 111 | 111 | */ |
| 112 | - public static function set_free_ticks( $free_ticks ) { |
|
| 112 | + public static function set_free_ticks($free_ticks) { |
|
| 113 | 113 | self::$free_ticks = (int) $free_ticks; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @param int $ticks Current tick count. |
| 120 | 120 | */ |
| 121 | - public static function maybe_free_memory( $ticks ) { |
|
| 122 | - if ( self::$free_ticks && 0 === $ticks % self::$free_ticks ) { |
|
| 121 | + public static function maybe_free_memory($ticks) { |
|
| 122 | + if (self::$free_ticks && 0 === $ticks % self::$free_ticks) { |
|
| 123 | 123 | self::free_memory(); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -128,13 +128,13 @@ discard block |
||
| 128 | 128 | * Reduce memory footprint by clearing the database query and object caches. |
| 129 | 129 | */ |
| 130 | 130 | public static function free_memory() { |
| 131 | - if ( 0 < self::$sleep_time ) { |
|
| 131 | + if (0 < self::$sleep_time) { |
|
| 132 | 132 | /* translators: %d: amount of time */ |
| 133 | - \WP_CLI::warning( sprintf( _n( 'Stopped the insanity for %d second', 'Stopped the insanity for %d seconds', self::$sleep_time, 'woocommerce' ), self::$sleep_time ) ); |
|
| 134 | - sleep( self::$sleep_time ); |
|
| 133 | + \WP_CLI::warning(sprintf(_n('Stopped the insanity for %d second', 'Stopped the insanity for %d seconds', self::$sleep_time, 'woocommerce'), self::$sleep_time)); |
|
| 134 | + sleep(self::$sleep_time); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - \WP_CLI::warning( __( 'Attempting to reduce used memory...', 'woocommerce' ) ); |
|
| 137 | + \WP_CLI::warning(__('Attempting to reduce used memory...', 'woocommerce')); |
|
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * @var $wpdb \wpdb |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $wpdb->queries = array(); |
| 146 | 146 | |
| 147 | - if ( ! is_a( $wp_object_cache, 'WP_Object_Cache' ) ) { |
|
| 147 | + if (!is_a($wp_object_cache, 'WP_Object_Cache')) { |
|
| 148 | 148 | return; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | $wp_object_cache->memcache_debug = array(); |
| 154 | 154 | $wp_object_cache->cache = array(); |
| 155 | 155 | |
| 156 | - if ( is_callable( array( $wp_object_cache, '__remoteset' ) ) ) { |
|
| 157 | - call_user_func( array( $wp_object_cache, '__remoteset' ) ); // important |
|
| 156 | + if (is_callable(array($wp_object_cache, '__remoteset'))) { |
|
| 157 | + call_user_func(array($wp_object_cache, '__remoteset')); // important |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
@@ -163,22 +163,22 @@ discard block |
||
| 163 | 163 | * Otherwise, proceed with the migration if the dependencies have been met. |
| 164 | 164 | */ |
| 165 | 165 | public static function init() { |
| 166 | - if ( self::is_migration_complete() ) { |
|
| 167 | - add_filter( 'action_scheduler_store_class', array( 'ActionScheduler_DataController', 'set_store_class' ), 100 ); |
|
| 168 | - add_filter( 'action_scheduler_logger_class', array( 'ActionScheduler_DataController', 'set_logger_class' ), 100 ); |
|
| 169 | - add_action( 'deactivate_plugin', array( 'ActionScheduler_DataController', 'mark_migration_incomplete' ) ); |
|
| 170 | - } elseif ( self::dependencies_met() ) { |
|
| 166 | + if (self::is_migration_complete()) { |
|
| 167 | + add_filter('action_scheduler_store_class', array('ActionScheduler_DataController', 'set_store_class'), 100); |
|
| 168 | + add_filter('action_scheduler_logger_class', array('ActionScheduler_DataController', 'set_logger_class'), 100); |
|
| 169 | + add_action('deactivate_plugin', array('ActionScheduler_DataController', 'mark_migration_incomplete')); |
|
| 170 | + } elseif (self::dependencies_met()) { |
|
| 171 | 171 | Controller::init(); |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - add_action( 'action_scheduler/progress_tick', array( 'ActionScheduler_DataController', 'maybe_free_memory' ) ); |
|
| 174 | + add_action('action_scheduler/progress_tick', array('ActionScheduler_DataController', 'maybe_free_memory')); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | 178 | * Singleton factory. |
| 179 | 179 | */ |
| 180 | 180 | public static function instance() { |
| 181 | - if ( ! isset( self::$instance ) ) { |
|
| 181 | + if (!isset(self::$instance)) { |
|
| 182 | 182 | self::$instance = new static(); |
| 183 | 183 | } |
| 184 | 184 | |