@@ -77,8 +77,8 @@ |
||
77 | 77 | |
78 | 78 | $parts = explode( ':', $slug, 2 ); |
79 | 79 | |
80 | - if ( isset( $parts[1] ) ) { |
|
81 | - $this->entity_slug = $parts[1]; |
|
80 | + if ( isset( $parts[ 1 ] ) ) { |
|
81 | + $this->entity_slug = $parts[ 1 ]; |
|
82 | 82 | } else { |
83 | 83 | $this->entity_slug = $slug; |
84 | 84 | } |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | $period_units = array( |
42 | 42 | 1 => __( 'Seconds', 'wordpoints' ), |
43 | 43 | MINUTE_IN_SECONDS => __( 'Minutes', 'wordpoints' ), |
44 | - HOUR_IN_SECONDS => __( 'Hours', 'wordpoints' ), |
|
45 | - DAY_IN_SECONDS => __( 'Days', 'wordpoints' ), |
|
46 | - WEEK_IN_SECONDS => __( 'Weeks', 'wordpoints' ), |
|
47 | - 30 * DAY_IN_SECONDS => __( 'Months', 'wordpoints' ), |
|
44 | + HOUR_IN_SECONDS => __( 'Hours', 'wordpoints' ), |
|
45 | + DAY_IN_SECONDS => __( 'Days', 'wordpoints' ), |
|
46 | + WEEK_IN_SECONDS => __( 'Weeks', 'wordpoints' ), |
|
47 | + 30 * DAY_IN_SECONDS => __( 'Months', 'wordpoints' ), |
|
48 | 48 | ); |
49 | 49 | |
50 | 50 | /** |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | return false; |
123 | 123 | } |
124 | 124 | |
125 | - if ( isset( $period['args'] ) ) { |
|
126 | - $this->validate_period_args( $period['args'] ); |
|
125 | + if ( isset( $period[ 'args' ] ) ) { |
|
126 | + $this->validate_period_args( $period[ 'args' ] ); |
|
127 | 127 | } |
128 | 128 | |
129 | - if ( ! isset( $period['length'] ) ) { |
|
129 | + if ( ! isset( $period[ 'length' ] ) ) { |
|
130 | 130 | |
131 | 131 | $this->validator->add_error( |
132 | 132 | __( 'Period length setting is missing.', 'wordpoints' ) |
133 | 133 | ); |
134 | 134 | |
135 | - } elseif ( false === wordpoints_posint( $period['length'] ) ) { |
|
135 | + } elseif ( false === wordpoints_posint( $period[ 'length' ] ) ) { |
|
136 | 136 | |
137 | 137 | $this->validator->add_error( |
138 | 138 | __( 'Period length must be a positive integer.', 'wordpoints' ) |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | $now = current_time( 'timestamp', true ); |
238 | 238 | $hit_time = strtotime( $period->date, $now ); |
239 | 239 | |
240 | - if ( ! empty( $settings['relative'] ) ) { |
|
240 | + if ( ! empty( $settings[ 'relative' ] ) ) { |
|
241 | 241 | |
242 | - return ( $now > $hit_time + $settings['length'] ); |
|
242 | + return ( $now > $hit_time + $settings[ 'length' ] ); |
|
243 | 243 | |
244 | 244 | } else { |
245 | 245 | |
246 | 246 | $offset = get_option( 'gmt_offset' ) * HOUR_IN_SECONDS; |
247 | 247 | |
248 | 248 | return ( |
249 | - (int) ( ( $hit_time + $offset ) / $settings['length'] ) |
|
250 | - < (int) ( ( $now + $offset ) / $settings['length'] ) |
|
249 | + (int) ( ( $hit_time + $offset ) / $settings[ 'length' ] ) |
|
250 | + < (int) ( ( $now + $offset ) / $settings[ 'length' ] ) |
|
251 | 251 | ); |
252 | 252 | } |
253 | 253 | } |
@@ -371,10 +371,10 @@ discard block |
||
371 | 371 | LIMIT 1 |
372 | 372 | " |
373 | 373 | , $signature |
374 | - , $reaction_guid['mode'] |
|
375 | - , $reaction_guid['store'] |
|
376 | - , wp_json_encode( $reaction_guid['context_id'] ) |
|
377 | - , $reaction_guid['id'] |
|
374 | + , $reaction_guid[ 'mode' ] |
|
375 | + , $reaction_guid[ 'store' ] |
|
376 | + , wp_json_encode( $reaction_guid[ 'context_id' ] ) |
|
377 | + , $reaction_guid[ 'id' ] |
|
378 | 378 | , $this->action_type |
379 | 379 | ) |
380 | 380 | ); |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | WordPoints_Hook_ReactionI $reaction |
432 | 432 | ) { |
433 | 433 | |
434 | - if ( isset( $settings['args'] ) ) { |
|
435 | - $period_args = $settings['args']; |
|
434 | + if ( isset( $settings[ 'args' ] ) ) { |
|
435 | + $period_args = $settings[ 'args' ]; |
|
436 | 436 | } else { |
437 | 437 | $period_args = array( $reaction->get_meta( 'target' ) ); |
438 | 438 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | protected function validate_condition( $settings ) { |
157 | 157 | |
158 | - if ( ! isset( $settings['type'] ) ) { |
|
158 | + if ( ! isset( $settings[ 'type' ] ) ) { |
|
159 | 159 | $this->validator->add_error( __( 'Condition type is missing.', 'wordpoints' ) ); |
160 | 160 | return false; |
161 | 161 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | return false; |
173 | 173 | } |
174 | 174 | |
175 | - $condition = $this->conditions->get( $data_type, $settings['type'] ); |
|
175 | + $condition = $this->conditions->get( $data_type, $settings[ 'type' ] ); |
|
176 | 176 | |
177 | 177 | if ( ! $condition ) { |
178 | 178 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | sprintf( |
181 | 181 | // translators: Condition type slug. |
182 | 182 | __( 'Unknown condition type “%s”.', 'wordpoints' ) |
183 | - , $settings['type'] |
|
183 | + , $settings[ 'type' ] |
|
184 | 184 | ) |
185 | 185 | , 'type' |
186 | 186 | ); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | |
191 | - if ( ! isset( $settings['settings'] ) ) { |
|
191 | + if ( ! isset( $settings[ 'settings' ] ) ) { |
|
192 | 192 | $this->validator->add_error( __( 'Condition settings are missing.', 'wordpoints' ) ); |
193 | 193 | return false; |
194 | 194 | } |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | // reset, so we need to back up their values and then restore them below. |
201 | 201 | $backup = array( $this->validator, $this->event_args ); |
202 | 202 | |
203 | - $settings['settings'] = $condition->validate_settings( |
|
203 | + $settings[ 'settings' ] = $condition->validate_settings( |
|
204 | 204 | $arg |
205 | - , $settings['settings'] |
|
205 | + , $settings[ 'settings' ] |
|
206 | 206 | , $this->validator |
207 | 207 | ); |
208 | 208 | |
@@ -246,16 +246,16 @@ discard block |
||
246 | 246 | |
247 | 247 | $event_args->descend( $arg_slug ); |
248 | 248 | |
249 | - if ( isset( $sub_args['_conditions'] ) ) { |
|
249 | + if ( isset( $sub_args[ '_conditions' ] ) ) { |
|
250 | 250 | |
251 | - foreach ( $sub_args['_conditions'] as $settings ) { |
|
251 | + foreach ( $sub_args[ '_conditions' ] as $settings ) { |
|
252 | 252 | |
253 | 253 | $condition = $this->conditions->get( |
254 | 254 | $this->get_data_type( $event_args->get_current() ) |
255 | - , $settings['type'] |
|
255 | + , $settings[ 'type' ] |
|
256 | 256 | ); |
257 | 257 | |
258 | - $is_met = $condition->is_met( $settings['settings'], $event_args ); |
|
258 | + $is_met = $condition->is_met( $settings[ 'settings' ], $event_args ); |
|
259 | 259 | |
260 | 260 | if ( ! $is_met ) { |
261 | 261 | $event_args->ascend(); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | - unset( $sub_args['_conditions'] ); |
|
266 | + unset( $sub_args[ '_conditions' ] ); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | $are_met = $this->conditions_are_met( $sub_args, $event_args ); |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | |
78 | 78 | // We cache these so that we don't run the query both before and after the |
79 | 79 | // fire. |
80 | - if ( isset( $fire->data[ $this->slug ]['hit_ids'] ) ) { |
|
81 | - return $fire->data[ $this->slug ]['hit_ids']; |
|
80 | + if ( isset( $fire->data[ $this->slug ][ 'hit_ids' ] ) ) { |
|
81 | + return $fire->data[ $this->slug ][ 'hit_ids' ]; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | $query = $fire->get_matching_hits_query(); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $ids = array(); |
99 | 99 | } |
100 | 100 | |
101 | - $fire->data[ $this->slug ]['hit_ids'] = $ids; |
|
101 | + $fire->data[ $this->slug ][ 'hit_ids' ] = $ids; |
|
102 | 102 | |
103 | 103 | return $ids; |
104 | 104 | } |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | |
78 | 78 | parent::register( $slug, $class, $args ); |
79 | 79 | |
80 | - if ( isset( $args['actions'] ) ) { |
|
81 | - foreach ( $args['actions'] as $type => $actions ) { |
|
80 | + if ( isset( $args[ 'actions' ] ) ) { |
|
81 | + foreach ( $args[ 'actions' ] as $type => $actions ) { |
|
82 | 82 | foreach ( (array) $actions as $action_slug ) { |
83 | 83 | $this->router->add_event_to_action( $slug, $action_slug, $type ); |
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - if ( isset( $args['args'] ) ) { |
|
88 | + if ( isset( $args[ 'args' ] ) ) { |
|
89 | 89 | $args_registry = $this->get_sub_app( 'args' ); |
90 | 90 | |
91 | - foreach ( $args['args'] as $arg_slug => $class ) { |
|
91 | + foreach ( $args[ 'args' ] as $arg_slug => $class ) { |
|
92 | 92 | $args_registry->register( $slug, $arg_slug, $class ); |
93 | 93 | } |
94 | 94 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | parent::deregister( $slug ); |
111 | 111 | |
112 | - foreach ( (array) $this->event_data[ $slug ]['actions'] as $type => $actions ) { |
|
112 | + foreach ( (array) $this->event_data[ $slug ][ 'actions' ] as $type => $actions ) { |
|
113 | 113 | foreach ( (array) $actions as $action_slug ) { |
114 | 114 | $this->router->remove_event_from_action( $slug, $action_slug, $type ); |
115 | 115 | } |
@@ -127,7 +127,7 @@ |
||
127 | 127 | |
128 | 128 | $this->table_name = $wpdb->wordpoints_hook_hits; |
129 | 129 | |
130 | - $this->defaults['order_by'] = 'date'; |
|
130 | + $this->defaults[ 'order_by' ] = 'date'; |
|
131 | 131 | |
132 | 132 | parent::__construct( $args ); |
133 | 133 | } |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | ) { |
112 | 112 | |
113 | 113 | if ( |
114 | - empty( $settings['target'] ) |
|
115 | - || ! is_array( $settings['target'] ) |
|
114 | + empty( $settings[ 'target' ] ) |
|
115 | + || ! is_array( $settings[ 'target' ] ) |
|
116 | 116 | ) { |
117 | 117 | |
118 | 118 | $validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' ); |
119 | 119 | |
120 | 120 | } else { |
121 | 121 | |
122 | - $target = $event_args->get_from_hierarchy( $settings['target'] ); |
|
122 | + $target = $event_args->get_from_hierarchy( $settings[ 'target' ] ); |
|
123 | 123 | |
124 | 124 | if ( |
125 | 125 | ! $target instanceof WordPoints_Entity |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @since 2.1.0 |
137 | 137 | */ |
138 | 138 | public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) { |
139 | - $reaction->update_meta( 'target', $settings['target'] ); |
|
139 | + $reaction->update_meta( 'target', $settings[ 'target' ] ); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 |
@@ -48,8 +48,8 @@ |
||
48 | 48 | |
49 | 49 | $parts = wordpoints_parse_dynamic_slug( $this->slug ); |
50 | 50 | |
51 | - if ( $parts['dynamic'] ) { |
|
52 | - $entity_slug = "{$this->generic_entity_slug}\\{$parts['dynamic']}"; |
|
51 | + if ( $parts[ 'dynamic' ] ) { |
|
52 | + $entity_slug = "{$this->generic_entity_slug}\\{$parts[ 'dynamic' ]}"; |
|
53 | 53 | } else { |
54 | 54 | $entity_slug = $this->generic_entity_slug; |
55 | 55 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
30 | 30 | |
31 | - switch ( $parsed['dynamic'] ) { |
|
31 | + switch ( $parsed[ 'dynamic' ] ) { |
|
32 | 32 | |
33 | 33 | case 'post': |
34 | 34 | return __( 'Publish Post', 'wordpoints' ); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
54 | 54 | |
55 | - switch ( $parsed['dynamic'] ) { |
|
55 | + switch ( $parsed[ 'dynamic' ] ) { |
|
56 | 56 | |
57 | 57 | case 'post': |
58 | 58 | return __( 'When a Post is published.', 'wordpoints' ); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
78 | 78 | |
79 | - switch ( $parsed['dynamic'] ) { |
|
79 | + switch ( $parsed[ 'dynamic' ] ) { |
|
80 | 80 | |
81 | 81 | case 'post': |
82 | 82 | return __( 'Post removed.', 'wordpoints' ); |