@@ -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 | ); |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | return false !== strpos( |
43 | 43 | $args->get_current()->get_the_value() |
44 | - , $settings['value'] |
|
44 | + , $settings[ 'value' ] |
|
45 | 45 | ); |
46 | 46 | } |
47 | 47 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | $this->validate_count(); |
94 | 94 | |
95 | - if ( isset( $settings['conditions'] ) ) { |
|
95 | + if ( isset( $settings[ 'conditions' ] ) ) { |
|
96 | 96 | $this->validate_conditions( $arg ); |
97 | 97 | } |
98 | 98 | |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | protected function validate_count() { |
108 | 108 | |
109 | 109 | if ( |
110 | - ! empty( $this->settings['max'] ) |
|
111 | - && ! wordpoints_posint( $this->settings['max'] ) |
|
110 | + ! empty( $this->settings[ 'max' ] ) |
|
111 | + && ! wordpoints_posint( $this->settings[ 'max' ] ) |
|
112 | 112 | ) { |
113 | 113 | $this->validator->add_error( |
114 | 114 | __( 'The maximum must be a positive integer.', 'wordpoints' ) |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | ); |
117 | 117 | } |
118 | 118 | |
119 | - if ( ! empty( $this->settings['min'] ) ) { |
|
119 | + if ( ! empty( $this->settings[ 'min' ] ) ) { |
|
120 | 120 | |
121 | - if ( ! wordpoints_posint( $this->settings['min'] ) ) { |
|
121 | + if ( ! wordpoints_posint( $this->settings[ 'min' ] ) ) { |
|
122 | 122 | |
123 | 123 | $this->validator->add_error( |
124 | 124 | __( 'The minimum must be a positive integer.', 'wordpoints' ) |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | ); |
127 | 127 | |
128 | 128 | } elseif ( |
129 | - ! empty( $this->settings['max'] ) |
|
130 | - && $this->settings['max'] < $this->settings['min'] |
|
129 | + ! empty( $this->settings[ 'max' ] ) |
|
130 | + && $this->settings[ 'max' ] < $this->settings[ 'min' ] |
|
131 | 131 | ) { |
132 | 132 | |
133 | 133 | $this->validator->add_error( |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | |
165 | 165 | $this->validator->push_field( 'conditions' ); |
166 | 166 | |
167 | - $this->settings['conditions'] = $this->conditions_extension->validate_conditions( |
|
168 | - $this->settings['conditions'] |
|
167 | + $this->settings[ 'conditions' ] = $this->conditions_extension->validate_conditions( |
|
168 | + $this->settings[ 'conditions' ] |
|
169 | 169 | , $args |
170 | 170 | ); |
171 | 171 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | $entities = $arg->get_the_entities(); |
189 | 189 | |
190 | - if ( isset( $this->settings['conditions'] ) ) { |
|
190 | + if ( isset( $this->settings[ 'conditions' ] ) ) { |
|
191 | 191 | $entities = $this->filter_entities( $entities ); |
192 | 192 | } |
193 | 193 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $event_args->add_entity( $entity ); |
213 | 213 | |
214 | 214 | $matches = $this->conditions_extension->conditions_are_met( |
215 | - $this->settings['conditions'] |
|
215 | + $this->settings[ 'conditions' ] |
|
216 | 216 | , $event_args |
217 | 217 | ); |
218 | 218 | |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | */ |
236 | 236 | protected function check_count( $count ) { |
237 | 237 | |
238 | - if ( isset( $this->settings['max'] ) && $count > $this->settings['max'] ) { |
|
238 | + if ( isset( $this->settings[ 'max' ] ) && $count > $this->settings[ 'max' ] ) { |
|
239 | 239 | return false; |
240 | 240 | } |
241 | 241 | |
242 | - if ( isset( $this->settings['min'] ) && $count < $this->settings['min'] ) { |
|
242 | + if ( isset( $this->settings[ 'min' ] ) && $count < $this->settings[ 'min' ] ) { |
|
243 | 243 | return false; |
244 | 244 | } |
245 | 245 |
@@ -39,7 +39,7 @@ |
||
39 | 39 | */ |
40 | 40 | public function is_met( array $settings, WordPoints_Hook_Event_Args $args ) { |
41 | 41 | |
42 | - return $settings['value'] === $args->get_current()->get_the_value(); |
|
42 | + return $settings[ 'value' ] === $args->get_current()->get_the_value(); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 |