@@ -24,15 +24,15 @@ |
||
24 | 24 | /** |
25 | 25 | * @since 1.0.0 |
26 | 26 | */ |
27 | - public function validate_action_type_settings( $settings ) { |
|
27 | + public function validate_action_type_settings($settings) { |
|
28 | 28 | return (bool) $settings; |
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | 32 | * @since 1.0.0 |
33 | 33 | */ |
34 | - public function should_hit( WordPoints_Hook_Fire $fire ) { |
|
35 | - return ! $this->get_settings_from_fire( $fire ); |
|
34 | + public function should_hit(WordPoints_Hook_Fire $fire) { |
|
35 | + return ! $this->get_settings_from_fire($fire); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | |
43 | 43 | $conditions_data = array(); |
44 | 44 | |
45 | - foreach ( $this->conditions->get_all() as $data_type => $conditions ) { |
|
46 | - foreach ( $conditions as $slug => $condition ) { |
|
45 | + foreach ($this->conditions->get_all() as $data_type => $conditions) { |
|
46 | + foreach ($conditions as $slug => $condition) { |
|
47 | 47 | |
48 | - if ( ! ( $condition instanceof WordPoints_Hook_Condition ) ) { |
|
48 | + if ( ! ($condition instanceof WordPoints_Hook_Condition)) { |
|
49 | 49 | continue; |
50 | 50 | } |
51 | 51 | |
52 | - $conditions_data[ $data_type ][ $slug ] = array( |
|
52 | + $conditions_data[$data_type][$slug] = array( |
|
53 | 53 | 'slug' => $slug, |
54 | 54 | 'data_type' => $data_type, |
55 | 55 | 'title' => $condition->get_title(), |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | - return array( 'conditions' => $conditions_data ); |
|
61 | + return array('conditions' => $conditions_data); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
65 | 65 | * @since 1.0.0 |
66 | 66 | */ |
67 | - protected function validate_action_type_settings( $settings ) { |
|
68 | - return $this->validate_conditions( $settings ); |
|
67 | + protected function validate_action_type_settings($settings) { |
|
68 | + return $this->validate_conditions($settings); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -78,36 +78,36 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return array The validated settings. |
80 | 80 | */ |
81 | - public function validate_conditions( $conditions, WordPoints_Hook_Event_Args $event_args = null ) { |
|
81 | + public function validate_conditions($conditions, WordPoints_Hook_Event_Args $event_args = null) { |
|
82 | 82 | |
83 | - if ( $event_args ) { |
|
83 | + if ($event_args) { |
|
84 | 84 | $this->event_args = $event_args; |
85 | 85 | $this->validator = $event_args->get_validator(); |
86 | 86 | } |
87 | 87 | |
88 | - if ( ! is_array( $conditions ) ) { |
|
88 | + if ( ! is_array($conditions)) { |
|
89 | 89 | |
90 | 90 | $this->validator->add_error( |
91 | - __( 'Conditions do not match expected format.', 'wordpoints' ) |
|
91 | + __('Conditions do not match expected format.', 'wordpoints') |
|
92 | 92 | ); |
93 | 93 | |
94 | 94 | return array(); |
95 | 95 | } |
96 | 96 | |
97 | - foreach ( $conditions as $arg_slug => $sub_args ) { |
|
97 | + foreach ($conditions as $arg_slug => $sub_args) { |
|
98 | 98 | |
99 | - if ( '_conditions' === $arg_slug ) { |
|
99 | + if ('_conditions' === $arg_slug) { |
|
100 | 100 | |
101 | - $this->validator->push_field( $arg_slug ); |
|
101 | + $this->validator->push_field($arg_slug); |
|
102 | 102 | |
103 | - foreach ( $sub_args as $index => $settings ) { |
|
103 | + foreach ($sub_args as $index => $settings) { |
|
104 | 104 | |
105 | - $this->validator->push_field( $index ); |
|
105 | + $this->validator->push_field($index); |
|
106 | 106 | |
107 | - $condition = $this->validate_condition( $settings ); |
|
107 | + $condition = $this->validate_condition($settings); |
|
108 | 108 | |
109 | - if ( $condition ) { |
|
110 | - $sub_args[ $index ] = $condition; |
|
109 | + if ($condition) { |
|
110 | + $sub_args[$index] = $condition; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $this->validator->pop_field(); |
@@ -117,18 +117,18 @@ discard block |
||
117 | 117 | |
118 | 118 | } else { |
119 | 119 | |
120 | - if ( ! $this->event_args->descend( $arg_slug ) ) { |
|
120 | + if ( ! $this->event_args->descend($arg_slug)) { |
|
121 | 121 | continue; |
122 | 122 | } |
123 | 123 | |
124 | - $sub_args = $this->validate_action_type_settings( $sub_args ); |
|
124 | + $sub_args = $this->validate_action_type_settings($sub_args); |
|
125 | 125 | |
126 | - $conditions[ $arg_slug ] = $sub_args; |
|
126 | + $conditions[$arg_slug] = $sub_args; |
|
127 | 127 | |
128 | 128 | $this->event_args->ascend(); |
129 | 129 | } |
130 | 130 | |
131 | - $conditions[ $arg_slug ] = $sub_args; |
|
131 | + $conditions[$arg_slug] = $sub_args; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | return $conditions; |
@@ -144,32 +144,32 @@ discard block |
||
144 | 144 | * @return array|false The validated conditions settings, or false if unable to |
145 | 145 | * validate. |
146 | 146 | */ |
147 | - protected function validate_condition( $settings ) { |
|
147 | + protected function validate_condition($settings) { |
|
148 | 148 | |
149 | - if ( ! isset( $settings['type'] ) ) { |
|
150 | - $this->validator->add_error( __( 'Condition type is missing.', 'wordpoints' ) ); |
|
149 | + if ( ! isset($settings['type'])) { |
|
150 | + $this->validator->add_error(__('Condition type is missing.', 'wordpoints')); |
|
151 | 151 | return false; |
152 | 152 | } |
153 | 153 | |
154 | 154 | $arg = $this->event_args->get_current(); |
155 | 155 | |
156 | - $data_type = $this->get_data_type( $arg ); |
|
156 | + $data_type = $this->get_data_type($arg); |
|
157 | 157 | |
158 | - if ( ! $data_type ) { |
|
158 | + if ( ! $data_type) { |
|
159 | 159 | $this->validator->add_error( |
160 | - __( 'This type of condition does not work for the selected attribute.', 'wordpoints' ) |
|
160 | + __('This type of condition does not work for the selected attribute.', 'wordpoints') |
|
161 | 161 | ); |
162 | 162 | |
163 | 163 | return false; |
164 | 164 | } |
165 | 165 | |
166 | - $condition = wordpoints_hooks()->conditions->get( $data_type, $settings['type'] ); |
|
166 | + $condition = wordpoints_hooks()->conditions->get($data_type, $settings['type']); |
|
167 | 167 | |
168 | - if ( ! $condition ) { |
|
168 | + if ( ! $condition) { |
|
169 | 169 | |
170 | 170 | $this->validator->add_error( |
171 | 171 | sprintf( |
172 | - __( 'Unknown condition type “%s”.', 'wordpoints' ) |
|
172 | + __('Unknown condition type “%s”.', 'wordpoints') |
|
173 | 173 | , $settings['type'] |
174 | 174 | ) |
175 | 175 | , 'type' |
@@ -178,17 +178,17 @@ discard block |
||
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | |
181 | - if ( ! isset( $settings['settings'] ) ) { |
|
182 | - $this->validator->add_error( __( 'Condition settings are missing.', 'wordpoints' ) ); |
|
181 | + if ( ! isset($settings['settings'])) { |
|
182 | + $this->validator->add_error(__('Condition settings are missing.', 'wordpoints')); |
|
183 | 183 | return false; |
184 | 184 | } |
185 | 185 | |
186 | - $this->validator->push_field( 'settings' ); |
|
186 | + $this->validator->push_field('settings'); |
|
187 | 187 | |
188 | 188 | // The condition may call this object's validate_settings() method to |
189 | 189 | // validate some sub-conditions. When that happens, these properties will be |
190 | 190 | // reset, so we need to back up their values and then restore them below. |
191 | - $backup = array( $this->validator, $this->event_args ); |
|
191 | + $backup = array($this->validator, $this->event_args); |
|
192 | 192 | |
193 | 193 | $settings['settings'] = $condition->validate_settings( |
194 | 194 | $arg |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | , $this->validator |
197 | 197 | ); |
198 | 198 | |
199 | - list( $this->validator, $this->event_args ) = $backup; |
|
199 | + list($this->validator, $this->event_args) = $backup; |
|
200 | 200 | |
201 | 201 | $this->validator->pop_field(); |
202 | 202 | |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * @since 1.0.0 |
208 | 208 | */ |
209 | - public function should_hit( WordPoints_Hook_Fire $fire ) { |
|
209 | + public function should_hit(WordPoints_Hook_Fire $fire) { |
|
210 | 210 | |
211 | - $conditions = $this->get_settings_from_fire( $fire ); |
|
211 | + $conditions = $this->get_settings_from_fire($fire); |
|
212 | 212 | |
213 | - if ( $conditions && ! $this->conditions_are_met( $conditions, $fire->event_args ) ) { |
|
213 | + if ($conditions && ! $this->conditions_are_met($conditions, $fire->event_args)) { |
|
214 | 214 | return false; |
215 | 215 | } |
216 | 216 | |
@@ -232,35 +232,35 @@ discard block |
||
232 | 232 | WordPoints_Hook_Event_Args $event_args |
233 | 233 | ) { |
234 | 234 | |
235 | - foreach ( $conditions as $arg_slug => $sub_args ) { |
|
235 | + foreach ($conditions as $arg_slug => $sub_args) { |
|
236 | 236 | |
237 | - $event_args->descend( $arg_slug ); |
|
237 | + $event_args->descend($arg_slug); |
|
238 | 238 | |
239 | - if ( isset( $sub_args['_conditions'] ) ) { |
|
239 | + if (isset($sub_args['_conditions'])) { |
|
240 | 240 | |
241 | - foreach ( $sub_args['_conditions'] as $settings ) { |
|
241 | + foreach ($sub_args['_conditions'] as $settings) { |
|
242 | 242 | |
243 | 243 | $condition = $this->conditions->get( |
244 | - $this->get_data_type( $event_args->get_current() ) |
|
244 | + $this->get_data_type($event_args->get_current()) |
|
245 | 245 | , $settings['type'] |
246 | 246 | ); |
247 | 247 | |
248 | - $is_met = $condition->is_met( $settings['settings'], $event_args ); |
|
248 | + $is_met = $condition->is_met($settings['settings'], $event_args); |
|
249 | 249 | |
250 | - if ( ! $is_met ) { |
|
250 | + if ( ! $is_met) { |
|
251 | 251 | $event_args->ascend(); |
252 | 252 | return false; |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - unset( $sub_args['_conditions'] ); |
|
256 | + unset($sub_args['_conditions']); |
|
257 | 257 | } |
258 | 258 | |
259 | - $are_met = $this->conditions_are_met( $sub_args, $event_args ); |
|
259 | + $are_met = $this->conditions_are_met($sub_args, $event_args); |
|
260 | 260 | |
261 | 261 | $event_args->ascend(); |
262 | 262 | |
263 | - if ( ! $are_met ) { |
|
263 | + if ( ! $are_met) { |
|
264 | 264 | return false; |
265 | 265 | } |
266 | 266 | } |
@@ -277,13 +277,13 @@ discard block |
||
277 | 277 | * |
278 | 278 | * @return string|false The data type, or false. |
279 | 279 | */ |
280 | - protected function get_data_type( $arg ) { |
|
280 | + protected function get_data_type($arg) { |
|
281 | 281 | |
282 | - if ( $arg instanceof WordPoints_Entity_Attr ) { |
|
282 | + if ($arg instanceof WordPoints_Entity_Attr) { |
|
283 | 283 | $data_type = $arg->get_data_type(); |
284 | - } elseif ( $arg instanceof WordPoints_Entity_Array ) { |
|
284 | + } elseif ($arg instanceof WordPoints_Entity_Array) { |
|
285 | 285 | $data_type = 'entity_array'; |
286 | - } elseif ( $arg instanceof WordPoints_Entity ) { |
|
286 | + } elseif ($arg instanceof WordPoints_Entity) { |
|
287 | 287 | $data_type = 'entity'; |
288 | 288 | } else { |
289 | 289 | $data_type = false; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @since 1.0.0 |
57 | 57 | */ |
58 | 58 | public function get_title() { |
59 | - return __( 'Contains', 'wordpoints' ); |
|
59 | + return __('Contains', 'wordpoints'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | return array( |
67 | 67 | 'min' => array( |
68 | 68 | 'slug' => 'min', |
69 | - 'label' => __( 'Minimum number of items', 'wordpoints' ), |
|
69 | + 'label' => __('Minimum number of items', 'wordpoints'), |
|
70 | 70 | 'type' => 'number', |
71 | 71 | 'default' => 1, |
72 | 72 | ), |
73 | 73 | 'max' => array( |
74 | 74 | 'slug' => 'max', |
75 | - 'label' => __( 'Maximum number of items', 'wordpoints' ), |
|
75 | + 'label' => __('Maximum number of items', 'wordpoints'), |
|
76 | 76 | 'type' => 'number', |
77 | 77 | ), |
78 | 78 | ); |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | |
93 | 93 | $this->validate_count(); |
94 | 94 | |
95 | - if ( isset( $settings['conditions'] ) ) { |
|
96 | - $this->validate_conditions( $arg ); |
|
95 | + if (isset($settings['conditions'])) { |
|
96 | + $this->validate_conditions($arg); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $this->settings; |
@@ -107,31 +107,31 @@ 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 | - __( 'The maximum must be a positive integer.', 'wordpoints' ) |
|
114 | + __('The maximum must be a positive integer.', 'wordpoints') |
|
115 | 115 | , 'max' |
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 | - __( 'The minimum must be a positive integer.', 'wordpoints' ) |
|
124 | + __('The minimum must be a positive integer.', 'wordpoints') |
|
125 | 125 | , 'min' |
126 | 126 | ); |
127 | 127 | |
128 | 128 | } elseif ( |
129 | - ! empty( $this->settings['max'] ) |
|
129 | + ! empty($this->settings['max']) |
|
130 | 130 | && $this->settings['max'] < $this->settings['min'] |
131 | 131 | ) { |
132 | 132 | |
133 | 133 | $this->validator->add_error( |
134 | - __( 'The minimum must be less than the maximum.', 'wordpoints' ) |
|
134 | + __('The minimum must be less than the maximum.', 'wordpoints') |
|
135 | 135 | , 'min' |
136 | 136 | ); |
137 | 137 | } |
@@ -145,24 +145,24 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @param WordPoints_EntityishI $current_arg The current arg. |
147 | 147 | */ |
148 | - protected function validate_conditions( $current_arg ) { |
|
148 | + protected function validate_conditions($current_arg) { |
|
149 | 149 | |
150 | - $args = new WordPoints_Hook_Event_Args( array() ); |
|
150 | + $args = new WordPoints_Hook_Event_Args(array()); |
|
151 | 151 | |
152 | - if ( $current_arg instanceof WordPoints_Entity_Array ) { |
|
152 | + if ($current_arg instanceof WordPoints_Entity_Array) { |
|
153 | 153 | |
154 | 154 | $entity = wordpoints_entities()->get( |
155 | 155 | $current_arg->get_entity_slug() |
156 | 156 | ); |
157 | 157 | |
158 | - if ( $entity instanceof WordPoints_Entity ) { |
|
159 | - $args->add_entity( $entity ); |
|
158 | + if ($entity instanceof WordPoints_Entity) { |
|
159 | + $args->add_entity($entity); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | - $args->set_validator( $this->validator ); |
|
163 | + $args->set_validator($this->validator); |
|
164 | 164 | |
165 | - $this->validator->push_field( 'conditions' ); |
|
165 | + $this->validator->push_field('conditions'); |
|
166 | 166 | |
167 | 167 | $this->settings['conditions'] = $this->conditions_extension->validate_conditions( |
168 | 168 | $this->settings['conditions'] |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | /** |
176 | 176 | * @since 1.0.0 |
177 | 177 | */ |
178 | - public function is_met( array $settings, WordPoints_Hook_Event_Args $args ) { |
|
178 | + public function is_met(array $settings, WordPoints_Hook_Event_Args $args) { |
|
179 | 179 | |
180 | 180 | $this->settings = $settings; |
181 | 181 | |
@@ -183,16 +183,16 @@ discard block |
||
183 | 183 | |
184 | 184 | $entities = array(); |
185 | 185 | |
186 | - if ( $arg instanceof WordPoints_Entity_Array ) { |
|
186 | + if ($arg instanceof WordPoints_Entity_Array) { |
|
187 | 187 | |
188 | 188 | $entities = $arg->get_the_entities(); |
189 | 189 | |
190 | - if ( isset( $this->settings['conditions'] ) ) { |
|
191 | - $entities = $this->filter_entities( $entities ); |
|
190 | + if (isset($this->settings['conditions'])) { |
|
191 | + $entities = $this->filter_entities($entities); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - return $this->check_count( count( $entities ) ); |
|
195 | + return $this->check_count(count($entities)); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -204,20 +204,20 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return WordPoints_Entity[] The entities that matched the sub-conditions. |
206 | 206 | */ |
207 | - protected function filter_entities( $entities ) { |
|
207 | + protected function filter_entities($entities) { |
|
208 | 208 | |
209 | - foreach ( $entities as $index => $entity ) { |
|
209 | + foreach ($entities as $index => $entity) { |
|
210 | 210 | |
211 | - $event_args = new WordPoints_Hook_Event_Args( array() ); |
|
212 | - $event_args->add_entity( $entity ); |
|
211 | + $event_args = new WordPoints_Hook_Event_Args(array()); |
|
212 | + $event_args->add_entity($entity); |
|
213 | 213 | |
214 | 214 | $matches = $this->conditions_extension->conditions_are_met( |
215 | 215 | $this->settings['conditions'] |
216 | 216 | , $event_args |
217 | 217 | ); |
218 | 218 | |
219 | - if ( ! $matches ) { |
|
220 | - unset( $entities[ $index ] ); |
|
219 | + if ( ! $matches) { |
|
220 | + unset($entities[$index]); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
@@ -233,13 +233,13 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @return bool Whether the count met the requirements. |
235 | 235 | */ |
236 | - protected function check_count( $count ) { |
|
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 |
@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | * @since 1.0.0 |
19 | 19 | */ |
20 | 20 | protected $columns = array( |
21 | - 'id' => array( 'format' => '%d', 'unsigned' => true ), |
|
22 | - 'action_type' => array( 'format' => '%s' ), |
|
23 | - 'primary_arg_guid' => array( 'format' => '%s' ), |
|
24 | - 'event' => array( 'format' => '%s' ), |
|
25 | - 'reactor' => array( 'format' => '%s' ), |
|
26 | - 'reaction_store' => array( 'format' => '%s' ), |
|
27 | - 'reaction_context_id' => array( 'format' => '%s' ), |
|
28 | - 'reaction_id' => array( 'format' => '%d', 'unsigned' => true ), |
|
29 | - 'date' => array( 'format' => '%s', 'is_date' => true ), |
|
21 | + 'id' => array('format' => '%d', 'unsigned' => true), |
|
22 | + 'action_type' => array('format' => '%s'), |
|
23 | + 'primary_arg_guid' => array('format' => '%s'), |
|
24 | + 'event' => array('format' => '%s'), |
|
25 | + 'reactor' => array('format' => '%s'), |
|
26 | + 'reaction_store' => array('format' => '%s'), |
|
27 | + 'reaction_context_id' => array('format' => '%s'), |
|
28 | + 'reaction_id' => array('format' => '%d', 'unsigned' => true), |
|
29 | + 'date' => array('format' => '%s', 'is_date' => true), |
|
30 | 30 | ); |
31 | 31 | |
32 | 32 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @type array $meta_query See WP_Meta_Query. |
103 | 103 | * } |
104 | 104 | */ |
105 | - public function __construct( $args = array() ) { |
|
105 | + public function __construct($args = array()) { |
|
106 | 106 | |
107 | 107 | global $wpdb; |
108 | 108 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $this->defaults['order_by'] = 'date'; |
112 | 112 | |
113 | - parent::__construct( $args ); |
|
113 | + parent::__construct($args); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 |
@@ -7,25 +7,25 @@ |
||
7 | 7 | * @since 1.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -add_action( 'wordpoints_init_app-apps', 'wordpoints_apps_init' ); |
|
11 | -add_action( 'wordpoints_init_app-entities', 'wordpoints_entities_app_init' ); |
|
10 | +add_action('wordpoints_init_app-apps', 'wordpoints_apps_init'); |
|
11 | +add_action('wordpoints_init_app-entities', 'wordpoints_entities_app_init'); |
|
12 | 12 | |
13 | -add_action( 'wordpoints_init_app_registry-apps-entities', 'wordpoints_entities_init' ); |
|
14 | -add_action( 'wordpoints_init_app_registry-entities-contexts', 'wordpoints_entity_contexts_init' ); |
|
13 | +add_action('wordpoints_init_app_registry-apps-entities', 'wordpoints_entities_init'); |
|
14 | +add_action('wordpoints_init_app_registry-entities-contexts', 'wordpoints_entity_contexts_init'); |
|
15 | 15 | |
16 | -add_action( 'wordpoints_init_app_registry-apps-data_types', 'wordpoints_data_types_init' ); |
|
16 | +add_action('wordpoints_init_app_registry-apps-data_types', 'wordpoints_data_types_init'); |
|
17 | 17 | |
18 | -add_action( 'wordpoints_init_app_registry-hooks-events', 'wordpoints_hook_events_init' ); |
|
19 | -add_action( 'wordpoints_init_app_registry-hooks-actions', 'wordpoints_hook_actions_init' ); |
|
20 | -add_action( 'wordpoints_init_app_registry-hooks-reactors', 'wordpoints_hook_reactors_init' ); |
|
21 | -add_action( 'wordpoints_init_app_registry-hooks-reaction_stores', 'wordpoints_hook_reaction_stores_init' ); |
|
22 | -add_action( 'wordpoints_init_app_registry-hooks-extensions', 'wordpoints_hook_extension_init' ); |
|
23 | -add_action( 'wordpoints_init_app_registry-hooks-conditions', 'wordpoints_hook_conditions_init' ); |
|
18 | +add_action('wordpoints_init_app_registry-hooks-events', 'wordpoints_hook_events_init'); |
|
19 | +add_action('wordpoints_init_app_registry-hooks-actions', 'wordpoints_hook_actions_init'); |
|
20 | +add_action('wordpoints_init_app_registry-hooks-reactors', 'wordpoints_hook_reactors_init'); |
|
21 | +add_action('wordpoints_init_app_registry-hooks-reaction_stores', 'wordpoints_hook_reaction_stores_init'); |
|
22 | +add_action('wordpoints_init_app_registry-hooks-extensions', 'wordpoints_hook_extension_init'); |
|
23 | +add_action('wordpoints_init_app_registry-hooks-conditions', 'wordpoints_hook_conditions_init'); |
|
24 | 24 | |
25 | -add_action( 'wordpoints_modules_loaded', 'wordpoints_init_hooks' ); |
|
25 | +add_action('wordpoints_modules_loaded', 'wordpoints_init_hooks'); |
|
26 | 26 | |
27 | -add_action( 'init', 'wordpoints_hooks_api_add_global_cache_groups', 5 ); |
|
27 | +add_action('init', 'wordpoints_hooks_api_add_global_cache_groups', 5); |
|
28 | 28 | |
29 | -add_filter( 'wordpoints_user_can_view_points_log', 'wordpoints_hooks_user_can_view_points_log' ); |
|
29 | +add_filter('wordpoints_user_can_view_points_log', 'wordpoints_hooks_user_can_view_points_log'); |
|
30 | 30 | |
31 | 31 | // EOF |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | ) { |
101 | 101 | |
102 | 102 | return 'wordpoints_create_hook_reaction|' . $reaction_store->get_slug() |
103 | - . '|' . wordpoints_hooks()->get_current_mode() |
|
104 | - . '|' . wp_json_encode( $reaction_store->get_context_id() ); |
|
103 | + . '|' . wordpoints_hooks()->get_current_mode() |
|
104 | + . '|' . wp_json_encode( $reaction_store->get_context_id() ); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | WordPoints_Hook_ReactionI $reaction |
132 | 132 | ) { |
133 | 133 | return 'wordpoints_update_hook_reaction|' |
134 | - . wp_json_encode( $reaction->get_guid() ); |
|
134 | + . wp_json_encode( $reaction->get_guid() ); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | WordPoints_Hook_ReactionI $reaction |
162 | 162 | ) { |
163 | 163 | return 'wordpoints_delete_hook_reaction|' |
164 | - . wp_json_encode( $reaction->get_guid() ); |
|
164 | + . wp_json_encode( $reaction->get_guid() ); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return array The hook reaction data extracted into an array. |
54 | 54 | */ |
55 | - public static function prepare_hook_reaction( WordPoints_Hook_ReactionI $reaction ) { |
|
55 | + public static function prepare_hook_reaction(WordPoints_Hook_ReactionI $reaction) { |
|
56 | 56 | |
57 | 57 | return array_merge( |
58 | 58 | $reaction->get_all_meta() |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | 'id' => $reaction->ID, |
61 | 61 | 'event' => $reaction->get_event_slug(), |
62 | 62 | 'reaction_store' => $reaction->get_store_slug(), |
63 | - 'nonce' => self::get_update_nonce( $reaction ), |
|
64 | - 'delete_nonce' => self::get_delete_nonce( $reaction ), |
|
63 | + 'nonce' => self::get_update_nonce($reaction), |
|
64 | + 'delete_nonce' => self::get_delete_nonce($reaction), |
|
65 | 65 | ) |
66 | 66 | ); |
67 | 67 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | WordPoints_Hook_Reaction_StoreI $reaction_store |
82 | 82 | ) { |
83 | 83 | |
84 | - return wp_create_nonce( self::get_create_nonce_action( $reaction_store ) ); |
|
84 | + return wp_create_nonce(self::get_create_nonce_action($reaction_store)); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | WordPoints_Hook_Reaction_StoreI $reaction_store |
100 | 100 | ) { |
101 | 101 | |
102 | - return 'wordpoints_create_hook_reaction|' . $reaction_store->get_slug() |
|
103 | - . '|' . wordpoints_hooks()->get_current_mode() |
|
104 | - . '|' . wp_json_encode( $reaction_store->get_context_id() ); |
|
102 | + return 'wordpoints_create_hook_reaction|'.$reaction_store->get_slug() |
|
103 | + . '|'.wordpoints_hooks()->get_current_mode() |
|
104 | + . '|'.wp_json_encode($reaction_store->get_context_id()); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return string A nonce for updating this reaction. |
115 | 115 | */ |
116 | - public static function get_update_nonce( WordPoints_Hook_ReactionI $reaction ) { |
|
116 | + public static function get_update_nonce(WordPoints_Hook_ReactionI $reaction) { |
|
117 | 117 | |
118 | - return wp_create_nonce( self::get_update_nonce_action( $reaction ) ); |
|
118 | + return wp_create_nonce(self::get_update_nonce_action($reaction)); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | WordPoints_Hook_ReactionI $reaction |
132 | 132 | ) { |
133 | 133 | return 'wordpoints_update_hook_reaction|' |
134 | - . wp_json_encode( $reaction->get_guid() ); |
|
134 | + . wp_json_encode($reaction->get_guid()); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return string A nonce for deleting this reaction. |
145 | 145 | */ |
146 | - public static function get_delete_nonce( WordPoints_Hook_ReactionI $reaction ) { |
|
146 | + public static function get_delete_nonce(WordPoints_Hook_ReactionI $reaction) { |
|
147 | 147 | |
148 | - return wp_create_nonce( self::get_delete_nonce_action( $reaction ) ); |
|
148 | + return wp_create_nonce(self::get_delete_nonce_action($reaction)); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | WordPoints_Hook_ReactionI $reaction |
162 | 162 | ) { |
163 | 163 | return 'wordpoints_delete_hook_reaction|' |
164 | - . wp_json_encode( $reaction->get_guid() ); |
|
164 | + . wp_json_encode($reaction->get_guid()); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // |
@@ -187,17 +187,17 @@ discard block |
||
187 | 187 | |
188 | 188 | add_action( |
189 | 189 | 'wp_ajax_wordpoints_admin_create_hook_reaction' |
190 | - , array( $this, 'create_hook_reaction' ) |
|
190 | + , array($this, 'create_hook_reaction') |
|
191 | 191 | ); |
192 | 192 | |
193 | 193 | add_action( |
194 | 194 | 'wp_ajax_wordpoints_admin_update_hook_reaction' |
195 | - , array( $this, 'update_hook_reaction' ) |
|
195 | + , array($this, 'update_hook_reaction') |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | add_action( |
199 | 199 | 'wp_ajax_wordpoints_admin_delete_hook_reaction' |
200 | - , array( $this, 'delete_hook_reaction' ) |
|
200 | + , array($this, 'delete_hook_reaction') |
|
201 | 201 | ); |
202 | 202 | } |
203 | 203 | |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | |
213 | 213 | $reaction_store = $this->get_reaction_store(); |
214 | 214 | |
215 | - $this->verify_request( $this->get_create_nonce_action( $reaction_store ) ); |
|
215 | + $this->verify_request($this->get_create_nonce_action($reaction_store)); |
|
216 | 216 | |
217 | - $reaction = $reaction_store->create_reaction( $this->get_data() ); |
|
217 | + $reaction = $reaction_store->create_reaction($this->get_data()); |
|
218 | 218 | |
219 | - $this->send_json_result( $reaction, 'create' ); |
|
219 | + $this->send_json_result($reaction, 'create'); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -231,14 +231,14 @@ discard block |
||
231 | 231 | $reaction_store = $this->get_reaction_store(); |
232 | 232 | $reaction = $this->get_reaction(); |
233 | 233 | |
234 | - $this->verify_request( $this->get_update_nonce_action( $reaction ) ); |
|
234 | + $this->verify_request($this->get_update_nonce_action($reaction)); |
|
235 | 235 | |
236 | 236 | $reaction = $reaction_store->update_reaction( |
237 | 237 | $reaction->ID |
238 | 238 | , $this->get_data() |
239 | 239 | ); |
240 | 240 | |
241 | - $this->send_json_result( $reaction, 'update' ); |
|
241 | + $this->send_json_result($reaction, 'update'); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | $reaction_store = $this->get_reaction_store(); |
254 | 254 | $reaction = $this->get_reaction(); |
255 | 255 | |
256 | - $this->verify_request( $this->get_delete_nonce_action( $reaction ) ); |
|
256 | + $this->verify_request($this->get_delete_nonce_action($reaction)); |
|
257 | 257 | |
258 | - $result = $reaction_store->delete_reaction( $reaction->ID ); |
|
258 | + $result = $reaction_store->delete_reaction($reaction->ID); |
|
259 | 259 | |
260 | - if ( ! $result ) { |
|
261 | - wp_send_json_error( array( 'message' => __( 'There was an error deleting the reaction. Please try again.', 'wordpoints' ) ) ); |
|
260 | + if ( ! $result) { |
|
261 | + wp_send_json_error(array('message' => __('There was an error deleting the reaction. Please try again.', 'wordpoints'))); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | wp_send_json_success(); |
@@ -279,11 +279,11 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @param string $debug_context Context sent with the message (for debugging). |
281 | 281 | */ |
282 | - private function unexpected_error( $debug_context ) { |
|
282 | + private function unexpected_error($debug_context) { |
|
283 | 283 | |
284 | 284 | wp_send_json_error( |
285 | 285 | array( |
286 | - 'message' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ), |
|
286 | + 'message' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'), |
|
287 | 287 | 'debug' => $debug_context, |
288 | 288 | ) |
289 | 289 | ); |
@@ -299,8 +299,8 @@ discard block |
||
299 | 299 | */ |
300 | 300 | private function verify_user_can() { |
301 | 301 | |
302 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
303 | - wp_send_json_error( array( 'message' => __( 'You do not have permission to perform this action. Maybe you have been logged out?', 'wordpoints' ) ) ); |
|
302 | + if ( ! current_user_can('manage_options')) { |
|
303 | + wp_send_json_error(array('message' => __('You do not have permission to perform this action. Maybe you have been logged out?', 'wordpoints'))); |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @param string $action The action the nonce should be for. |
315 | 315 | */ |
316 | - private function verify_request( $action ) { |
|
316 | + private function verify_request($action) { |
|
317 | 317 | |
318 | 318 | if ( |
319 | - empty( $_POST['nonce'] ) |
|
320 | - || ! wordpoints_verify_nonce( 'nonce', $action, null, 'post' ) |
|
319 | + empty($_POST['nonce']) |
|
320 | + || ! wordpoints_verify_nonce('nonce', $action, null, 'post') |
|
321 | 321 | ) { |
322 | 322 | wp_send_json_error( |
323 | - array( 'message' => __( 'Your security token for this action has expired. Refresh the page and try again.', 'wordpoints' ) ) |
|
323 | + array('message' => __('Your security token for this action has expired. Refresh the page and try again.', 'wordpoints')) |
|
324 | 324 | ); |
325 | 325 | } |
326 | 326 | } |
@@ -334,16 +334,16 @@ discard block |
||
334 | 334 | */ |
335 | 335 | protected function get_reaction_store() { |
336 | 336 | |
337 | - if ( ! isset( $_POST['reaction_store'] ) ) { // WPCS: CSRF OK. |
|
338 | - $this->unexpected_error( 'reaction_store' ); |
|
337 | + if ( ! isset($_POST['reaction_store'])) { // WPCS: CSRF OK. |
|
338 | + $this->unexpected_error('reaction_store'); |
|
339 | 339 | } |
340 | 340 | |
341 | - $reactor_slug = sanitize_key( $_POST['reaction_store'] ); // WPCS: CSRF OK. |
|
341 | + $reactor_slug = sanitize_key($_POST['reaction_store']); // WPCS: CSRF OK. |
|
342 | 342 | |
343 | - $reaction_store = wordpoints_hooks()->get_reaction_store( $reactor_slug ); |
|
343 | + $reaction_store = wordpoints_hooks()->get_reaction_store($reactor_slug); |
|
344 | 344 | |
345 | - if ( ! $reaction_store instanceof WordPoints_Hook_Reaction_StoreI ) { |
|
346 | - $this->unexpected_error( 'reaction_store_invalid' ); |
|
345 | + if ( ! $reaction_store instanceof WordPoints_Hook_Reaction_StoreI) { |
|
346 | + $this->unexpected_error('reaction_store_invalid'); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | $this->reaction_store_slug = $reactor_slug; |
@@ -361,16 +361,16 @@ discard block |
||
361 | 361 | */ |
362 | 362 | protected function get_reaction() { |
363 | 363 | |
364 | - if ( ! isset( $_POST['id'] ) ) { // WPCS: CSRF OK. |
|
365 | - $this->unexpected_error( 'id' ); |
|
364 | + if ( ! isset($_POST['id'])) { // WPCS: CSRF OK. |
|
365 | + $this->unexpected_error('id'); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | $reaction = $this->reaction_store->get_reaction( |
369 | - wordpoints_int( $_POST['id'] ) // WPCS: CSRF OK. |
|
369 | + wordpoints_int($_POST['id']) // WPCS: CSRF OK. |
|
370 | 370 | ); |
371 | 371 | |
372 | - if ( ! $reaction ) { |
|
373 | - wp_send_json_error( array( 'message' => __( 'The reaction ID passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints' ) ) ); |
|
372 | + if ( ! $reaction) { |
|
373 | + wp_send_json_error(array('message' => __('The reaction ID passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints'))); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | return $reaction; |
@@ -385,9 +385,9 @@ discard block |
||
385 | 385 | */ |
386 | 386 | protected function get_data() { |
387 | 387 | |
388 | - $data = wp_unslash( $_POST ); // WPCS: CSRF OK. |
|
388 | + $data = wp_unslash($_POST); // WPCS: CSRF OK. |
|
389 | 389 | |
390 | - unset( $data['id'], $data['action'], $data['nonce'], $data['reaction_store'] ); |
|
390 | + unset($data['id'], $data['action'], $data['nonce'], $data['reaction_store']); |
|
391 | 391 | |
392 | 392 | return $data; |
393 | 393 | } |
@@ -400,30 +400,30 @@ discard block |
||
400 | 400 | * @param mixed $result The result of the action. |
401 | 401 | * @param string $action The action being performed: 'create' or 'update'. |
402 | 402 | */ |
403 | - private function send_json_result( $result, $action ) { |
|
403 | + private function send_json_result($result, $action) { |
|
404 | 404 | |
405 | - if ( ! $result ) { |
|
405 | + if ( ! $result) { |
|
406 | 406 | |
407 | - if ( 'create' === $action ) { |
|
408 | - $message = __( 'There was an error adding the reaction. Please try again.', 'wordpoints' ); |
|
407 | + if ('create' === $action) { |
|
408 | + $message = __('There was an error adding the reaction. Please try again.', 'wordpoints'); |
|
409 | 409 | } else { |
410 | - $message = __( 'There was an error updating the reaction. Please try again.', 'wordpoints' ); |
|
410 | + $message = __('There was an error updating the reaction. Please try again.', 'wordpoints'); |
|
411 | 411 | } |
412 | 412 | |
413 | - wp_send_json_error( array( 'message' => $message ) ); |
|
413 | + wp_send_json_error(array('message' => $message)); |
|
414 | 414 | |
415 | - } elseif ( $result instanceof WordPoints_Hook_Reaction_Validator ) { |
|
415 | + } elseif ($result instanceof WordPoints_Hook_Reaction_Validator) { |
|
416 | 416 | |
417 | - wp_send_json_error( array( 'errors' => $result->get_errors() ) ); |
|
417 | + wp_send_json_error(array('errors' => $result->get_errors())); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | $data = null; |
421 | 421 | |
422 | - if ( 'create' === $action ) { |
|
423 | - $data = self::prepare_hook_reaction( $result ); |
|
422 | + if ('create' === $action) { |
|
423 | + $data = self::prepare_hook_reaction($result); |
|
424 | 424 | } |
425 | 425 | |
426 | - wp_send_json_success( $data ); |
|
426 | + wp_send_json_success($data); |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @since 1.0.0 |
57 | 57 | */ |
58 | 58 | protected function get_title() { |
59 | - return _x( 'Points Types', 'page title', 'wordpoints' ); |
|
59 | + return _x('Points Types', 'page title', 'wordpoints'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | |
67 | 67 | parent::hooks(); |
68 | 68 | |
69 | - add_action( 'add_meta_boxes', array( $this, 'add_points_settings_meta_box' ) ); |
|
70 | - add_action( 'add_meta_boxes', array( $this, 'add_event_meta_boxes' ) ); |
|
69 | + add_action('add_meta_boxes', array($this, 'add_points_settings_meta_box')); |
|
70 | + add_action('add_meta_boxes', array($this, 'add_event_meta_boxes')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function enqueue_scripts() { |
77 | 77 | |
78 | - wp_enqueue_style( 'wordpoints-hooks-admin' ); |
|
78 | + wp_enqueue_style('wordpoints-hooks-admin'); |
|
79 | 79 | |
80 | - wp_enqueue_script( 'postbox' ); |
|
80 | + wp_enqueue_script('postbox'); |
|
81 | 81 | |
82 | 82 | wordpoints_hooks_ui_setup_script_data(); |
83 | 83 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | .addClass( 'closed' ); |
98 | 98 | |
99 | 99 | postboxes.add_postbox_toggles( |
100 | - <?php echo wp_json_encode( $this->id ); ?> |
|
100 | + <?php echo wp_json_encode($this->id); ?> |
|
101 | 101 | ); |
102 | 102 | } ); |
103 | 103 | </script> |
@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function add_points_settings_meta_box() { |
114 | 114 | |
115 | - if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) { |
|
115 | + if ( ! current_user_can('manage_wordpoints_points_types')) { |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | |
119 | 119 | add_meta_box( |
120 | 120 | 'settings' |
121 | - , __( 'Settings', 'wordpoints' ) |
|
122 | - , array( $this, 'display_points_settings_meta_box' ) |
|
121 | + , __('Settings', 'wordpoints') |
|
122 | + , array($this, 'display_points_settings_meta_box') |
|
123 | 123 | , $this->id |
124 | 124 | , 'side' |
125 | 125 | , 'default' |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function display_points_settings_meta_box() { |
135 | 135 | |
136 | - if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) { |
|
136 | + if ( ! current_user_can('manage_wordpoints_points_types')) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | |
142 | 142 | $add_new = 0; |
143 | 143 | |
144 | - $points_type = wordpoints_get_points_type( $slug ); |
|
144 | + $points_type = wordpoints_get_points_type($slug); |
|
145 | 145 | |
146 | - if ( ! $points_type ) { |
|
146 | + if ( ! $points_type) { |
|
147 | 147 | |
148 | 148 | $points_type = array(); |
149 | - $add_new = wp_create_nonce( 'wordpoints_add_new_points_type' ); |
|
149 | + $add_new = wp_create_nonce('wordpoints_add_new_points_type'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | $points_type = array_merge( |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | ?> |
162 | 162 | |
163 | 163 | <form method="post"> |
164 | - <?php if ( $slug ) : ?> |
|
164 | + <?php if ($slug) : ?> |
|
165 | 165 | <p> |
166 | 166 | <span class="wordpoints-points-slug"> |
167 | 167 | <em> |
168 | - <?php echo esc_html( sprintf( __( 'Slug: %s', 'wordpoints' ), $slug ) ); ?> |
|
168 | + <?php echo esc_html(sprintf(__('Slug: %s', 'wordpoints'), $slug)); ?> |
|
169 | 169 | </em> |
170 | 170 | </span> |
171 | 171 | </p> |
172 | - <?php wp_nonce_field( "wordpoints_update_points_type-$slug", 'update_points_type' ); ?> |
|
172 | + <?php wp_nonce_field("wordpoints_update_points_type-$slug", 'update_points_type'); ?> |
|
173 | 173 | <?php endif; ?> |
174 | 174 | |
175 | 175 | <?php |
@@ -183,45 +183,45 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @param string $points_type The slug of the points type. |
185 | 185 | */ |
186 | - do_action( 'wordpoints_points_type_form_top', $slug ); |
|
186 | + do_action('wordpoints_points_type_form_top', $slug); |
|
187 | 187 | |
188 | - if ( $add_new ) { |
|
188 | + if ($add_new) { |
|
189 | 189 | |
190 | 190 | // Mark the prefix and suffix optional on the add new form. |
191 | - $prefix = _x( 'Prefix (optional):', 'points type', 'wordpoints' ); |
|
192 | - $suffix = _x( 'Suffix (optional):', 'points type', 'wordpoints' ); |
|
191 | + $prefix = _x('Prefix (optional):', 'points type', 'wordpoints'); |
|
192 | + $suffix = _x('Suffix (optional):', 'points type', 'wordpoints'); |
|
193 | 193 | |
194 | 194 | } else { |
195 | 195 | |
196 | - $prefix = _x( 'Prefix:', 'points type', 'wordpoints' ); |
|
197 | - $suffix = _x( 'Suffix:', 'points type', 'wordpoints' ); |
|
196 | + $prefix = _x('Prefix:', 'points type', 'wordpoints'); |
|
197 | + $suffix = _x('Suffix:', 'points type', 'wordpoints'); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | ?> |
201 | 201 | |
202 | 202 | <p> |
203 | 203 | <label |
204 | - for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label> |
|
204 | + for="points-name-<?php echo esc_attr($slug); ?>"><?php echo esc_html_x('Name:', 'points type', 'wordpoints'); ?></label> |
|
205 | 205 | <input class="widefat" type="text" |
206 | - id="points-name-<?php echo esc_attr( $slug ); ?>" |
|
206 | + id="points-name-<?php echo esc_attr($slug); ?>" |
|
207 | 207 | name="points-name" |
208 | - value="<?php echo esc_attr( $points_type['name'] ); ?>"/> |
|
208 | + value="<?php echo esc_attr($points_type['name']); ?>"/> |
|
209 | 209 | </p> |
210 | 210 | <p> |
211 | 211 | <label |
212 | - for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label> |
|
212 | + for="points-prefix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($prefix); ?></label> |
|
213 | 213 | <input class="widefat" type="text" |
214 | - id="points-prefix-<?php echo esc_attr( $slug ); ?>" |
|
214 | + id="points-prefix-<?php echo esc_attr($slug); ?>" |
|
215 | 215 | name="points-prefix" |
216 | - value="<?php echo esc_attr( $points_type['prefix'] ); ?>"/> |
|
216 | + value="<?php echo esc_attr($points_type['prefix']); ?>"/> |
|
217 | 217 | </p> |
218 | 218 | <p> |
219 | 219 | <label |
220 | - for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label> |
|
220 | + for="points-suffix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($suffix); ?></label> |
|
221 | 221 | <input class="widefat" type="text" |
222 | - id="points-suffix-<?php echo esc_attr( $slug ); ?>" |
|
222 | + id="points-suffix-<?php echo esc_attr($slug); ?>" |
|
223 | 223 | name="points-suffix" |
224 | - value="<?php echo esc_attr( $points_type['suffix'] ); ?>"/> |
|
224 | + value="<?php echo esc_attr($points_type['suffix']); ?>"/> |
|
225 | 225 | </p> |
226 | 226 | |
227 | 227 | <?php |
@@ -235,28 +235,28 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @param string $points_type The slug of the points type. |
237 | 237 | */ |
238 | - do_action( 'wordpoints_points_type_form_bottom', $slug ); |
|
238 | + do_action('wordpoints_points_type_form_bottom', $slug); |
|
239 | 239 | |
240 | 240 | ?> |
241 | 241 | |
242 | 242 | <input type="hidden" name="points-slug" |
243 | - value="<?php echo esc_attr( $slug ); ?>"/> |
|
243 | + value="<?php echo esc_attr($slug); ?>"/> |
|
244 | 244 | <input type="hidden" name="add_new" class="add_new" |
245 | - value="<?php echo esc_attr( $add_new ); ?>"/> |
|
245 | + value="<?php echo esc_attr($add_new); ?>"/> |
|
246 | 246 | |
247 | 247 | <div class="hook-control-actions"> |
248 | 248 | <div class="alignleft"> |
249 | 249 | <?php |
250 | 250 | |
251 | - if ( ! $add_new ) { |
|
252 | - wp_nonce_field( "wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce' ); |
|
253 | - submit_button( _x( 'Delete', 'points type', 'wordpoints' ), 'delete', 'delete-points-type', false, array( 'id' => "delete_points_type-{$slug}" ) ); |
|
251 | + if ( ! $add_new) { |
|
252 | + wp_nonce_field("wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce'); |
|
253 | + submit_button(_x('Delete', 'points type', 'wordpoints'), 'delete', 'delete-points-type', false, array('id' => "delete_points_type-{$slug}")); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | ?> |
257 | 257 | </div> |
258 | 258 | <div class="alignright"> |
259 | - <?php submit_button( _x( 'Save', 'points type', 'wordpoints' ), 'button-primary hook-control-save right', 'save-points-type', false, array( 'id' => "points-{$slug}-save" ) ); ?> |
|
259 | + <?php submit_button(_x('Save', 'points type', 'wordpoints'), 'button-primary hook-control-save right', 'save-points-type', false, array('id' => "points-{$slug}-save")); ?> |
|
260 | 260 | <span class="spinner"></span> |
261 | 261 | </div> |
262 | 262 | <br class="clear"/> |
@@ -273,17 +273,17 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function add_event_meta_boxes() { |
275 | 275 | |
276 | - if ( ! $this->current_points_type ) { |
|
276 | + if ( ! $this->current_points_type) { |
|
277 | 277 | return; |
278 | 278 | } |
279 | 279 | |
280 | 280 | /** @var WordPoints_Hook_EventI $event */ |
281 | - foreach ( $this->hooks->events->get_all() as $slug => $event ) { |
|
281 | + foreach ($this->hooks->events->get_all() as $slug => $event) { |
|
282 | 282 | |
283 | 283 | add_meta_box( |
284 | 284 | "{$this->current_points_type}-{$slug}" |
285 | 285 | , $event->get_title() |
286 | - , array( $this, 'display_event_meta_box' ) |
|
286 | + , array($this, 'display_event_meta_box') |
|
287 | 287 | , $this->id |
288 | 288 | , 'events' |
289 | 289 | , 'default' |
@@ -304,54 +304,54 @@ discard block |
||
304 | 304 | * @param array $points_type The points type this meta-box relates to. |
305 | 305 | * @param array $meta_box The data the meta-box was created with. |
306 | 306 | */ |
307 | - public function display_event_meta_box( $points_type, $meta_box ) { |
|
307 | + public function display_event_meta_box($points_type, $meta_box) { |
|
308 | 308 | |
309 | 309 | $event_slug = $meta_box['args']['slug']; |
310 | 310 | |
311 | 311 | $data = array(); |
312 | 312 | |
313 | - $reaction_store = wordpoints_hooks()->get_reaction_store( 'points' ); |
|
313 | + $reaction_store = wordpoints_hooks()->get_reaction_store('points'); |
|
314 | 314 | |
315 | - foreach ( $reaction_store->get_reactions_to_event( $event_slug ) as $id => $reaction ) { |
|
316 | - if ( $reaction->get_meta( 'points_type' ) === $this->current_points_type ) { |
|
315 | + foreach ($reaction_store->get_reactions_to_event($event_slug) as $id => $reaction) { |
|
316 | + if ($reaction->get_meta('points_type') === $this->current_points_type) { |
|
317 | 317 | $data[] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction( |
318 | 318 | $reaction |
319 | 319 | ); |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | - $args = $this->hooks->events->args->get_children( $event_slug ); |
|
323 | + $args = $this->hooks->events->args->get_children($event_slug); |
|
324 | 324 | |
325 | - $event_data = array( 'args' => array() ); |
|
325 | + $event_data = array('args' => array()); |
|
326 | 326 | |
327 | - foreach ( $args as $slug => $arg ) { |
|
327 | + foreach ($args as $slug => $arg) { |
|
328 | 328 | |
329 | - $event_data['args'][ $slug ] = array( |
|
329 | + $event_data['args'][$slug] = array( |
|
330 | 330 | 'slug' => $slug, |
331 | 331 | ); |
332 | 332 | |
333 | - if ( $arg instanceof WordPoints_Hook_Arg ) { |
|
334 | - $event_data['args'][ $slug ]['title'] = $arg->get_title(); |
|
335 | - $event_data['args'][ $slug ]['is_stateful'] = $arg->is_stateful(); |
|
333 | + if ($arg instanceof WordPoints_Hook_Arg) { |
|
334 | + $event_data['args'][$slug]['title'] = $arg->get_title(); |
|
335 | + $event_data['args'][$slug]['is_stateful'] = $arg->is_stateful(); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
339 | 339 | ?> |
340 | 340 | |
341 | 341 | <script> |
342 | - WordPointsHooksAdminData.events[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $event_data ); ?>; |
|
343 | - WordPointsHooksAdminData.reactions[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $data ); ?>; |
|
342 | + WordPointsHooksAdminData.events[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($event_data); ?>; |
|
343 | + WordPointsHooksAdminData.reactions[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($data); ?>; |
|
344 | 344 | </script> |
345 | 345 | |
346 | 346 | <div class="wordpoints-hook-reaction-group-container"> |
347 | 347 | <p class="description wordpoints-hook-reaction-group-description"> |
348 | - <?php echo esc_html( $meta_box['args']['event']->get_description() ); ?> |
|
348 | + <?php echo esc_html($meta_box['args']['event']->get_description()); ?> |
|
349 | 349 | </p> |
350 | 350 | |
351 | 351 | <div class="wordpoints-hook-reaction-group" |
352 | - data-wordpoints-hooks-hook-event="<?php echo esc_attr( $event_slug ); ?>" |
|
353 | - data-wordpoints-hooks-points-type="<?php echo esc_attr( $this->current_points_type ); ?>" |
|
354 | - data-wordpoints-hooks-create-nonce="<?php echo esc_attr( WordPoints_Admin_Ajax_Hooks::get_create_nonce( $reaction_store ) ); ?>" |
|
352 | + data-wordpoints-hooks-hook-event="<?php echo esc_attr($event_slug); ?>" |
|
353 | + data-wordpoints-hooks-points-type="<?php echo esc_attr($this->current_points_type); ?>" |
|
354 | + data-wordpoints-hooks-create-nonce="<?php echo esc_attr(WordPoints_Admin_Ajax_Hooks::get_create_nonce($reaction_store)); ?>" |
|
355 | 355 | data-wordpoints-hooks-reaction-store="points" |
356 | 356 | data-wordpoints-hooks-reactor="points"> |
357 | 357 | </div> |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | |
367 | 367 | <div class="controls"> |
368 | 368 | <button type="button" class="button-primary add-reaction"> |
369 | - <?php esc_html_e( 'Add New', 'wordpoints' ); ?> |
|
369 | + <?php esc_html_e('Add New', 'wordpoints'); ?> |
|
370 | 370 | </button> |
371 | 371 | </div> |
372 | 372 | </div> |
@@ -386,19 +386,19 @@ discard block |
||
386 | 386 | // Show a tab for each points type. |
387 | 387 | $tabs = array(); |
388 | 388 | |
389 | - foreach ( $points_types as $slug => $settings ) { |
|
390 | - $tabs[ $slug ] = $settings['name']; |
|
389 | + foreach ($points_types as $slug => $settings) { |
|
390 | + $tabs[$slug] = $settings['name']; |
|
391 | 391 | } |
392 | 392 | |
393 | - $tabs['add-new'] = __( 'Add New', 'wordpoints' ); |
|
393 | + $tabs['add-new'] = __('Add New', 'wordpoints'); |
|
394 | 394 | |
395 | - $tab = wordpoints_admin_get_current_tab( $tabs ); |
|
395 | + $tab = wordpoints_admin_get_current_tab($tabs); |
|
396 | 396 | |
397 | - if ( 'add-new' !== $tab ) { |
|
397 | + if ('add-new' !== $tab) { |
|
398 | 398 | $this->current_points_type = $tab; |
399 | 399 | } |
400 | 400 | |
401 | - do_action( 'add_meta_boxes', $this->id ); |
|
401 | + do_action('add_meta_boxes', $this->id); |
|
402 | 402 | |
403 | 403 | $this->tabs = $tabs; |
404 | 404 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | */ |
411 | 411 | public function save_points_type() { |
412 | 412 | |
413 | - if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) { |
|
413 | + if ( ! current_user_can('manage_wordpoints_points_types')) { |
|
414 | 414 | return; |
415 | 415 | } |
416 | 416 | |
@@ -425,43 +425,43 @@ discard block |
||
425 | 425 | |
426 | 426 | $settings = array(); |
427 | 427 | |
428 | - $settings['name'] = trim( sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) ); // WPCS: CSRF OK |
|
429 | - $settings['prefix'] = ltrim( sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) ); // WPCS: CSRF OK |
|
430 | - $settings['suffix'] = rtrim( sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) ); // WPCS: CSRF OK |
|
428 | + $settings['name'] = trim(sanitize_text_field(wp_unslash($_POST['points-name']))); // WPCS: CSRF OK |
|
429 | + $settings['prefix'] = ltrim(sanitize_text_field(wp_unslash($_POST['points-prefix']))); // WPCS: CSRF OK |
|
430 | + $settings['suffix'] = rtrim(sanitize_text_field(wp_unslash($_POST['points-suffix']))); // WPCS: CSRF OK |
|
431 | 431 | |
432 | 432 | if ( |
433 | - isset( $_POST['points-slug'] ) |
|
434 | - && wordpoints_verify_nonce( 'update_points_type', 'wordpoints_update_points_type-%s', array( 'points-slug' ), 'post' ) |
|
433 | + isset($_POST['points-slug']) |
|
434 | + && wordpoints_verify_nonce('update_points_type', 'wordpoints_update_points_type-%s', array('points-slug'), 'post') |
|
435 | 435 | ) { |
436 | 436 | |
437 | 437 | // - We are updating an existing points type. |
438 | 438 | |
439 | - $points_type = sanitize_key( $_POST['points-slug'] ); |
|
439 | + $points_type = sanitize_key($_POST['points-slug']); |
|
440 | 440 | |
441 | - $old_settings = wordpoints_get_points_type( $points_type ); |
|
441 | + $old_settings = wordpoints_get_points_type($points_type); |
|
442 | 442 | |
443 | - if ( false === $old_settings ) { |
|
443 | + if (false === $old_settings) { |
|
444 | 444 | |
445 | 445 | add_settings_error( |
446 | 446 | '' |
447 | 447 | , 'wordpoints_points_type_update' |
448 | - , __( 'Error: failed updating points type.', 'wordpoints' ) |
|
448 | + , __('Error: failed updating points type.', 'wordpoints') |
|
449 | 449 | , 'updated' |
450 | 450 | ); |
451 | 451 | |
452 | 452 | return; |
453 | 453 | } |
454 | 454 | |
455 | - if ( is_array( $old_settings ) ) { |
|
456 | - $settings = array_merge( $old_settings, $settings ); |
|
455 | + if (is_array($old_settings)) { |
|
456 | + $settings = array_merge($old_settings, $settings); |
|
457 | 457 | } |
458 | 458 | |
459 | - if ( ! wordpoints_update_points_type( $points_type, $settings ) ) { |
|
459 | + if ( ! wordpoints_update_points_type($points_type, $settings)) { |
|
460 | 460 | |
461 | 461 | add_settings_error( |
462 | 462 | '' |
463 | 463 | , 'wordpoints_points_type_update' |
464 | - , __( 'Error: failed updating points type.', 'wordpoints' ) |
|
464 | + , __('Error: failed updating points type.', 'wordpoints') |
|
465 | 465 | , 'updated' |
466 | 466 | ); |
467 | 467 | |
@@ -470,23 +470,23 @@ discard block |
||
470 | 470 | add_settings_error( |
471 | 471 | '' |
472 | 472 | , 'wordpoints_points_type_update' |
473 | - , __( 'Points type updated.', 'wordpoints' ) |
|
473 | + , __('Points type updated.', 'wordpoints') |
|
474 | 474 | , 'updated' |
475 | 475 | ); |
476 | 476 | } |
477 | 477 | |
478 | - } elseif ( wordpoints_verify_nonce( 'add_new', 'wordpoints_add_new_points_type', null, 'post' ) ) { |
|
478 | + } elseif (wordpoints_verify_nonce('add_new', 'wordpoints_add_new_points_type', null, 'post')) { |
|
479 | 479 | |
480 | 480 | // - We are creating a new points type. |
481 | 481 | |
482 | - $slug = wordpoints_add_points_type( $settings ); |
|
482 | + $slug = wordpoints_add_points_type($settings); |
|
483 | 483 | |
484 | - if ( ! $slug ) { |
|
484 | + if ( ! $slug) { |
|
485 | 485 | |
486 | 486 | add_settings_error( |
487 | 487 | '' |
488 | 488 | , 'wordpoints_points_type_create' |
489 | - , __( 'Please choose a unique name for this points type.', 'wordpoints' ) |
|
489 | + , __('Please choose a unique name for this points type.', 'wordpoints') |
|
490 | 490 | ); |
491 | 491 | |
492 | 492 | } else { |
@@ -496,26 +496,26 @@ discard block |
||
496 | 496 | add_settings_error( |
497 | 497 | '' |
498 | 498 | , 'wordpoints_points_type_create' |
499 | - , __( 'Points type created.', 'wordpoints' ) |
|
499 | + , __('Points type created.', 'wordpoints') |
|
500 | 500 | , 'updated' |
501 | 501 | ); |
502 | 502 | } |
503 | 503 | } |
504 | 504 | |
505 | 505 | } elseif ( |
506 | - ! empty( $_POST['delete-points-type'] ) |
|
507 | - && isset( $_POST['points-slug'] ) |
|
508 | - && wordpoints_verify_nonce( 'delete-points-type-nonce', 'wordpoints_delete_points_type-%s', array( 'points-slug' ), 'post' ) |
|
506 | + ! empty($_POST['delete-points-type']) |
|
507 | + && isset($_POST['points-slug']) |
|
508 | + && wordpoints_verify_nonce('delete-points-type-nonce', 'wordpoints_delete_points_type-%s', array('points-slug'), 'post') |
|
509 | 509 | ) { |
510 | 510 | |
511 | 511 | // - We are deleting a points type. |
512 | 512 | |
513 | - if ( wordpoints_delete_points_type( sanitize_key( $_POST['points-slug'] ) ) ) { |
|
513 | + if (wordpoints_delete_points_type(sanitize_key($_POST['points-slug']))) { |
|
514 | 514 | |
515 | 515 | add_settings_error( |
516 | 516 | '' |
517 | 517 | , 'wordpoints_points_type_delete' |
518 | - , __( 'Points type deleted.', 'wordpoints' ) |
|
518 | + , __('Points type deleted.', 'wordpoints') |
|
519 | 519 | , 'updated' |
520 | 520 | ); |
521 | 521 | |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | add_settings_error( |
525 | 525 | '' |
526 | 526 | , 'wordpoints_points_type_delete' |
527 | - , __( 'Error while deleting.', 'wordpoints' ) |
|
527 | + , __('Error while deleting.', 'wordpoints') |
|
528 | 528 | ); |
529 | 529 | } |
530 | 530 | } |
@@ -540,25 +540,25 @@ discard block |
||
540 | 540 | * |
541 | 541 | * @since 1.0.0 |
542 | 542 | */ |
543 | - do_action( 'wordpoints_admin_points_events_head' ); |
|
543 | + do_action('wordpoints_admin_points_events_head'); |
|
544 | 544 | |
545 | - if ( is_network_admin() ) { |
|
546 | - $title = __( 'Network Events', 'wordpoints' ); |
|
547 | - $description = __( 'Award points when various events happen on this network.', 'wordpoints' ); |
|
545 | + if (is_network_admin()) { |
|
546 | + $title = __('Network Events', 'wordpoints'); |
|
547 | + $description = __('Award points when various events happen on this network.', 'wordpoints'); |
|
548 | 548 | } else { |
549 | - $title = __( 'Events', 'wordpoints' ); |
|
550 | - $description = __( 'Award points when various events happen on this site.', 'wordpoints' ); |
|
549 | + $title = __('Events', 'wordpoints'); |
|
550 | + $description = __('Award points when various events happen on this site.', 'wordpoints'); |
|
551 | 551 | } |
552 | 552 | |
553 | - $points_type = wordpoints_get_points_type( $this->current_points_type ); |
|
553 | + $points_type = wordpoints_get_points_type($this->current_points_type); |
|
554 | 554 | |
555 | 555 | ?> |
556 | 556 | |
557 | 557 | <div class="wordpoints-points-type-meta-box-wrap"> |
558 | 558 | |
559 | 559 | <form> |
560 | - <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> |
|
561 | - <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> |
|
560 | + <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?> |
|
561 | + <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?> |
|
562 | 562 | </form> |
563 | 563 | |
564 | 564 | <div id="poststuff"> |
@@ -566,17 +566,17 @@ discard block |
||
566 | 566 | <div id="post-body" class="metabox-holder columns-<?php echo 1 === (int) get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
567 | 567 | |
568 | 568 | <div id="postbox-container-1" class="postbox-container"> |
569 | - <?php do_meta_boxes( $this->id, 'side', $points_type ); ?> |
|
569 | + <?php do_meta_boxes($this->id, 'side', $points_type); ?> |
|
570 | 570 | </div> |
571 | 571 | |
572 | - <?php if ( isset( $this->current_points_type ) ) : ?> |
|
572 | + <?php if (isset($this->current_points_type)) : ?> |
|
573 | 573 | <div class="wordpoints-hook-events-heading"> |
574 | - <h2><?php echo esc_html( $title ); ?></h2> |
|
575 | - <p class="description"><?php echo esc_html( $description ); ?></p> |
|
574 | + <h2><?php echo esc_html($title); ?></h2> |
|
575 | + <p class="description"><?php echo esc_html($description); ?></p> |
|
576 | 576 | </div> |
577 | 577 | |
578 | 578 | <div id="postbox-container-2" class="postbox-container"> |
579 | - <?php do_meta_boxes( $this->id, 'events', $points_type ); ?> |
|
579 | + <?php do_meta_boxes($this->id, 'events', $points_type); ?> |
|
580 | 580 | </div> |
581 | 581 | <?php endif; ?> |
582 | 582 | |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | * |
596 | 596 | * @since 1.0.0 |
597 | 597 | */ |
598 | - do_action( 'wordpoints_admin_points_events_foot' ); |
|
598 | + do_action('wordpoints_admin_points_events_foot'); |
|
599 | 599 | } |
600 | 600 | } |
601 | 601 |
@@ -37,8 +37,8 @@ |
||
37 | 37 | /** |
38 | 38 | * @since 1.0.0 |
39 | 39 | */ |
40 | - protected function get_attr_value_from_entity( WordPoints_Entity $entity ) { |
|
41 | - return $entity->get_the_attr_value( $this->field ); |
|
40 | + protected function get_attr_value_from_entity(WordPoints_Entity $entity) { |
|
41 | + return $entity->get_the_attr_value($this->field); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -31,7 +31,7 @@ |
||
31 | 31 | public function get_storage_info() { |
32 | 32 | return array( |
33 | 33 | 'type' => 'array', |
34 | - 'info' => array( 'type' => 'method' ), |
|
34 | + 'info' => array('type' => 'method'), |
|
35 | 35 | ); |
36 | 36 | } |
37 | 37 | } |