@@ -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' ); |
@@ -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 __( 'Comment on a Post', 'wordpoints' ); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
57 | 57 | |
58 | - switch ( $parsed['dynamic'] ) { |
|
58 | + switch ( $parsed[ 'dynamic' ] ) { |
|
59 | 59 | |
60 | 60 | case 'post': |
61 | 61 | return __( 'When a user leaves a comment on a Post.', 'wordpoints' ); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | WordPoints_Hook_Reaction_Validator $validator |
24 | 24 | ) { |
25 | 25 | |
26 | - if ( ! isset( $settings['value'] ) || '' === $settings['value'] ) { |
|
26 | + if ( ! isset( $settings[ 'value' ] ) || '' === $settings[ 'value' ] ) { |
|
27 | 27 | |
28 | 28 | $settings_fields = $this->get_settings_fields(); |
29 | 29 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | sprintf( |
32 | 32 | // translators: Form field name. |
33 | 33 | __( '%s is required.', 'wordpoints' ) |
34 | - , $settings_fields['value']['label'] |
|
34 | + , $settings_fields[ 'value' ][ 'label' ] |
|
35 | 35 | ) |
36 | 36 | , 'value' |
37 | 37 | ); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | return $settings; |
49 | 49 | } |
50 | 50 | |
51 | - $validated_value = $data_type->validate_value( $settings['value'] ); |
|
51 | + $validated_value = $data_type->validate_value( $settings[ 'value' ] ); |
|
52 | 52 | |
53 | 53 | if ( is_wp_error( $validated_value ) ) { |
54 | 54 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $validator->add_error( |
58 | 58 | sprintf( |
59 | 59 | $validated_value->get_error_message() |
60 | - , $settings_fields['value']['label'] |
|
60 | + , $settings_fields[ 'value' ][ 'label' ] |
|
61 | 61 | ) |
62 | 62 | , 'value' |
63 | 63 | ); |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | return $settings; |
66 | 66 | } |
67 | 67 | |
68 | - $settings['value'] = $validated_value; |
|
68 | + $settings[ 'value' ] = $validated_value; |
|
69 | 69 | |
70 | 70 | } elseif ( $arg instanceof WordPoints_Entity ) { |
71 | 71 | |
72 | - if ( ! $arg->exists( $settings['value'] ) ) { |
|
72 | + if ( ! $arg->exists( $settings[ 'value' ] ) ) { |
|
73 | 73 | $validator->add_error( |
74 | 74 | sprintf( |
75 | 75 | // translators: 1. Singular item type name; 2. Item ID/slug. |
76 | 76 | __( '%1$s “%2$s” not found.', 'wordpoints' ) |
77 | 77 | , $arg->get_title() |
78 | - , $settings['value'] |
|
78 | + , $settings[ 'value' ] |
|
79 | 79 | ) |
80 | 80 | , 'value' |
81 | 81 | ); |