@@ -24,23 +24,23 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function get_title() { |
26 | 26 | |
27 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
27 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
28 | 28 | |
29 | - switch ( $parsed['dynamic'] ) { |
|
29 | + switch ($parsed['dynamic']) { |
|
30 | 30 | |
31 | 31 | case 'post': |
32 | - return __( 'Comment on a Post', 'wordpoints' ); |
|
32 | + return __('Comment on a Post', 'wordpoints'); |
|
33 | 33 | |
34 | 34 | case 'page': |
35 | - return __( 'Comment on a Page', 'wordpoints' ); |
|
35 | + return __('Comment on a Page', 'wordpoints'); |
|
36 | 36 | |
37 | 37 | case 'attachment': |
38 | - return __( 'Comment on a Media Upload', 'wordpoints' ); |
|
38 | + return __('Comment on a Media Upload', 'wordpoints'); |
|
39 | 39 | |
40 | 40 | default: |
41 | 41 | return sprintf( |
42 | 42 | // translators: singular name of the post type |
43 | - __( 'Comment on a %s', 'wordpoints' ) |
|
43 | + __('Comment on a %s', 'wordpoints') |
|
44 | 44 | , $this->get_entity_title() |
45 | 45 | ); |
46 | 46 | } |
@@ -51,23 +51,23 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function get_description() { |
53 | 53 | |
54 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
54 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
55 | 55 | |
56 | - switch ( $parsed['dynamic'] ) { |
|
56 | + switch ($parsed['dynamic']) { |
|
57 | 57 | |
58 | 58 | case 'post': |
59 | - return __( 'When a user leaves a comment on a Post.', 'wordpoints' ); |
|
59 | + return __('When a user leaves a comment on a Post.', 'wordpoints'); |
|
60 | 60 | |
61 | 61 | case 'page': |
62 | - return __( 'When a user leaves a comment on a Page.', 'wordpoints' ); |
|
62 | + return __('When a user leaves a comment on a Page.', 'wordpoints'); |
|
63 | 63 | |
64 | 64 | case 'attachment': |
65 | - return __( 'When a user leaves a comment on a file uploaded to the Media Library.', 'wordpoints' ); |
|
65 | + return __('When a user leaves a comment on a file uploaded to the Media Library.', 'wordpoints'); |
|
66 | 66 | |
67 | 67 | default: |
68 | 68 | return sprintf( |
69 | 69 | // translators: singular name of the post type |
70 | - __( 'When a user leaves a comment on a %s.', 'wordpoints' ) |
|
70 | + __('When a user leaves a comment on a %s.', 'wordpoints') |
|
71 | 71 | , $this->get_entity_title() |
72 | 72 | ); |
73 | 73 | } |
@@ -17,20 +17,20 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @since 1.0.0 |
19 | 19 | */ |
20 | - public function __construct( $slug ) { |
|
20 | + public function __construct($slug) { |
|
21 | 21 | |
22 | - parent::__construct( $slug ); |
|
22 | + parent::__construct($slug); |
|
23 | 23 | |
24 | - $parts = wordpoints_parse_dynamic_slug( $this->slug ); |
|
24 | + $parts = wordpoints_parse_dynamic_slug($this->slug); |
|
25 | 25 | |
26 | - if ( $parts['dynamic'] ) { |
|
26 | + if ($parts['dynamic']) { |
|
27 | 27 | |
28 | - $parsed = $this->parse_slug( $this->related_entity_slug ); |
|
28 | + $parsed = $this->parse_slug($this->related_entity_slug); |
|
29 | 29 | |
30 | 30 | $this->primary_entity_slug = "{$this->primary_entity_slug}\\{$parts['dynamic']}"; |
31 | 31 | $this->related_entity_slug = "{$parsed['slug']}\\{$parts['dynamic']}"; |
32 | 32 | |
33 | - if ( $parsed['is_array'] ) { |
|
33 | + if ($parsed['is_array']) { |
|
34 | 34 | $this->related_entity_slug .= '{}'; |
35 | 35 | } |
36 | 36 | } |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function get_title() { |
43 | 43 | |
44 | - $parsed = $this->parse_slug( $this->related_entity_slug ); |
|
44 | + $parsed = $this->parse_slug($this->related_entity_slug); |
|
45 | 45 | |
46 | - $entity = wordpoints_entities()->get( $parsed['slug'] ); |
|
46 | + $entity = wordpoints_entities()->get($parsed['slug']); |
|
47 | 47 | |
48 | - if ( $entity instanceof WordPoints_Entity ) { |
|
48 | + if ($entity instanceof WordPoints_Entity) { |
|
49 | 49 | return $entity->get_title(); |
50 | 50 | } else { |
51 | 51 | return $this->related_entity_slug; |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @param WordPoints_Class_Registry_Persistent $reactors The reactors registry. |
35 | 35 | */ |
36 | -function wordpoints_hook_reactors_init( $reactors ) { |
|
36 | +function wordpoints_hook_reactors_init($reactors) { |
|
37 | 37 | |
38 | - $reactors->register( 'points', 'WordPoints_Hook_Reactor_Points' ); |
|
38 | + $reactors->register('points', 'WordPoints_Hook_Reactor_Points'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @param WordPoints_Class_Registry_Persistent $extensions The extension registry. |
49 | 49 | */ |
50 | -function wordpoints_hook_extension_init( $extensions ) { |
|
50 | +function wordpoints_hook_extension_init($extensions) { |
|
51 | 51 | |
52 | - $extensions->register( 'conditions', 'WordPoints_Hook_Extension_Conditions' ); |
|
53 | - $extensions->register( 'periods', 'WordPoints_Hook_Extension_Periods' ); |
|
52 | + $extensions->register('conditions', 'WordPoints_Hook_Extension_Conditions'); |
|
53 | + $extensions->register('periods', 'WordPoints_Hook_Extension_Periods'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @param WordPoints_Class_Registry_Children $conditions The conditions registry. |
64 | 64 | */ |
65 | -function wordpoints_hook_conditions_init( $conditions ) { |
|
65 | +function wordpoints_hook_conditions_init($conditions) { |
|
66 | 66 | |
67 | 67 | $conditions->register( |
68 | 68 | 'text' |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @param WordPoints_Hook_Actions $actions The action registry. |
100 | 100 | */ |
101 | -function wordpoints_hook_actions_init( $actions ) { |
|
101 | +function wordpoints_hook_actions_init($actions) { |
|
102 | 102 | |
103 | 103 | $actions->register( |
104 | 104 | 'comment_approve' |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | , array( |
107 | 107 | 'action' => 'transition_comment_status', |
108 | 108 | 'data' => array( |
109 | - 'arg_index' => array( 'comment' => 2 ), |
|
110 | - 'requirements' => array( 0 => 'approved' ), |
|
109 | + 'arg_index' => array('comment' => 2), |
|
110 | + 'requirements' => array(0 => 'approved'), |
|
111 | 111 | ), |
112 | 112 | ) |
113 | 113 | ); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | , array( |
119 | 119 | 'action' => 'wp_insert_comment', |
120 | 120 | 'data' => array( |
121 | - 'arg_index' => array( 'comment' => 1 ), |
|
121 | + 'arg_index' => array('comment' => 1), |
|
122 | 122 | ), |
123 | 123 | ) |
124 | 124 | ); |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | , array( |
130 | 130 | 'action' => 'transition_comment_status', |
131 | 131 | 'data' => array( |
132 | - 'arg_index' => array( 'comment' => 2 ), |
|
133 | - 'requirements' => array( 1 => 'approved' ), |
|
132 | + 'arg_index' => array('comment' => 2), |
|
133 | + 'requirements' => array(1 => 'approved'), |
|
134 | 134 | ), |
135 | 135 | ) |
136 | 136 | ); |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | , array( |
143 | 143 | 'action' => 'transition_post_status', |
144 | 144 | 'data' => array( |
145 | - 'arg_index' => array( 'post' => 2 ), |
|
146 | - 'requirements' => array( 0 => 'publish' ), |
|
145 | + 'arg_index' => array('post' => 2), |
|
146 | + 'requirements' => array(0 => 'publish'), |
|
147 | 147 | ), |
148 | 148 | ) |
149 | 149 | ); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | , array( |
155 | 155 | 'action' => 'add_attachment', |
156 | 156 | 'data' => array( |
157 | - 'arg_index' => array( 'post\attachment' => 0 ), |
|
157 | + 'arg_index' => array('post\attachment' => 0), |
|
158 | 158 | ), |
159 | 159 | ) |
160 | 160 | ); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | , array( |
166 | 166 | 'action' => 'post_delete', |
167 | 167 | 'data' => array( |
168 | - 'arg_index' => array( 'post' => 0 ), |
|
168 | + 'arg_index' => array('post' => 0), |
|
169 | 169 | ), |
170 | 170 | ) |
171 | 171 | ); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | , array( |
177 | 177 | 'action' => 'user_register', |
178 | 178 | 'data' => array( |
179 | - 'arg_index' => array( 'user' => 0 ), |
|
179 | + 'arg_index' => array('user' => 0), |
|
180 | 180 | ), |
181 | 181 | ) |
182 | 182 | ); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | , array( |
188 | 188 | 'action' => is_multisite() ? 'wpmu_delete_user' : 'delete_user', |
189 | 189 | 'data' => array( |
190 | - 'arg_index' => array( 'user' => 0 ), |
|
190 | + 'arg_index' => array('user' => 0), |
|
191 | 191 | ), |
192 | 192 | ) |
193 | 193 | ); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @param WordPoints_Hook_Events $events The event registry. |
212 | 212 | */ |
213 | -function wordpoints_hook_events_init( $events ) { |
|
213 | +function wordpoints_hook_events_init($events) { |
|
214 | 214 | |
215 | 215 | $events->register( |
216 | 216 | 'user_register' |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | ); |
241 | 241 | |
242 | 242 | // Register events for all of the public post types. |
243 | - $post_types = get_post_types( array( 'public' => true ) ); |
|
243 | + $post_types = get_post_types(array('public' => true)); |
|
244 | 244 | |
245 | 245 | /** |
246 | 246 | * Filter which post types to register hook events for. |
@@ -249,20 +249,20 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @param string[] The post type slugs ("names"). |
251 | 251 | */ |
252 | - $post_types = apply_filters( 'wordpoints_register_hook_events_for_post_types', $post_types ); |
|
252 | + $post_types = apply_filters('wordpoints_register_hook_events_for_post_types', $post_types); |
|
253 | 253 | |
254 | - foreach ( $post_types as $slug ) { |
|
255 | - wordpoints_register_post_type_hook_events( $slug ); |
|
254 | + foreach ($post_types as $slug) { |
|
255 | + wordpoints_register_post_type_hook_events($slug); |
|
256 | 256 | } |
257 | 257 | |
258 | - if ( is_multisite() ) { |
|
258 | + if (is_multisite()) { |
|
259 | 259 | |
260 | 260 | $event_slugs = array( |
261 | 261 | 'user_visit', |
262 | 262 | 'user_register', |
263 | 263 | ); |
264 | 264 | |
265 | - foreach ( $event_slugs as $event_slug ) { |
|
265 | + foreach ($event_slugs as $event_slug) { |
|
266 | 266 | // TODO network hooks |
267 | 267 | $events->args->register( |
268 | 268 | $event_slug |
@@ -282,11 +282,11 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @param WordPoints_Class_Registry_Persistent $firers The firer registry. |
284 | 284 | */ |
285 | -function wordpoints_hook_firers_init( $firers ) { |
|
285 | +function wordpoints_hook_firers_init($firers) { |
|
286 | 286 | |
287 | - $firers->register( 'fire', 'WordPoints_Hook_Firer' ); |
|
288 | - $firers->register( 'reverse', 'WordPoints_Hook_Firer_Reverse' ); |
|
289 | - $firers->register( 'spam', 'WordPoints_Hook_Firer_Spam' ); |
|
287 | + $firers->register('fire', 'WordPoints_Hook_Firer'); |
|
288 | + $firers->register('reverse', 'WordPoints_Hook_Firer_Reverse'); |
|
289 | + $firers->register('spam', 'WordPoints_Hook_Firer_Spam'); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @param WordPoints_App_Registry $entities The entities app. |
300 | 300 | */ |
301 | -function wordpoints_entities_app_init( $entities ) { |
|
301 | +function wordpoints_entities_app_init($entities) { |
|
302 | 302 | |
303 | - $entities->sub_apps->register( 'children', 'WordPoints_Class_Registry_Children' ); |
|
303 | + $entities->sub_apps->register('children', 'WordPoints_Class_Registry_Children'); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -312,18 +312,18 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @param WordPoints_App_Registry $entities The entities app. |
314 | 314 | */ |
315 | -function wordpoints_entities_init( $entities ) { |
|
315 | +function wordpoints_entities_init($entities) { |
|
316 | 316 | |
317 | 317 | $children = $entities->children; |
318 | 318 | |
319 | - $entities->register( 'user', 'WordPoints_Entity_User' ); |
|
320 | - $children->register( 'user', 'roles', 'WordPoints_Entity_User_Roles' ); |
|
319 | + $entities->register('user', 'WordPoints_Entity_User'); |
|
320 | + $children->register('user', 'roles', 'WordPoints_Entity_User_Roles'); |
|
321 | 321 | |
322 | - $entities->register( 'user_role', 'WordPoints_Entity_User_Role' ); |
|
323 | - $children->register( 'user_role', 'name', 'WordPoints_Entity_User_Role_Name' ); |
|
322 | + $entities->register('user_role', 'WordPoints_Entity_User_Role'); |
|
323 | + $children->register('user_role', 'name', 'WordPoints_Entity_User_Role_Name'); |
|
324 | 324 | |
325 | 325 | // Register entities for all of the public post types. |
326 | - $post_types = get_post_types( array( 'public' => true ) ); |
|
326 | + $post_types = get_post_types(array('public' => true)); |
|
327 | 327 | |
328 | 328 | /** |
329 | 329 | * Filter which post types to register entities for. |
@@ -332,14 +332,14 @@ discard block |
||
332 | 332 | * |
333 | 333 | * @param string[] The post type slugs ("names"). |
334 | 334 | */ |
335 | - $post_types = apply_filters( 'wordpoints_register_entities_for_post_types', $post_types ); |
|
335 | + $post_types = apply_filters('wordpoints_register_entities_for_post_types', $post_types); |
|
336 | 336 | |
337 | - foreach ( $post_types as $slug ) { |
|
338 | - wordpoints_register_post_type_entities( $slug ); |
|
337 | + foreach ($post_types as $slug) { |
|
338 | + wordpoints_register_post_type_entities($slug); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | // Register entities for all of the public taxonomies. |
342 | - $taxonomies = get_taxonomies( array( 'public' => true ) ); |
|
342 | + $taxonomies = get_taxonomies(array('public' => true)); |
|
343 | 343 | |
344 | 344 | /** |
345 | 345 | * Filter which taxonomies to register entities for. |
@@ -348,10 +348,10 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @param string[] The taxonomy slugs. |
350 | 350 | */ |
351 | - $taxonomies = apply_filters( 'wordpoints_register_entities_for_taxonomies', $taxonomies ); |
|
351 | + $taxonomies = apply_filters('wordpoints_register_entities_for_taxonomies', $taxonomies); |
|
352 | 352 | |
353 | - foreach ( $taxonomies as $slug ) { |
|
354 | - wordpoints_register_taxonomy_entities( $slug ); |
|
353 | + foreach ($taxonomies as $slug) { |
|
354 | + wordpoints_register_taxonomy_entities($slug); |
|
355 | 355 | } |
356 | 356 | } |
357 | 357 | |
@@ -362,28 +362,28 @@ discard block |
||
362 | 362 | * |
363 | 363 | * @param string $slug The slug of the post type. |
364 | 364 | */ |
365 | -function wordpoints_register_post_type_entities( $slug ) { |
|
365 | +function wordpoints_register_post_type_entities($slug) { |
|
366 | 366 | |
367 | 367 | $entities = wordpoints_entities(); |
368 | 368 | $children = $entities->children; |
369 | 369 | |
370 | - $entities->register( "post\\{$slug}", 'WordPoints_Entity_Post' ); |
|
371 | - $children->register( "post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author' ); |
|
370 | + $entities->register("post\\{$slug}", 'WordPoints_Entity_Post'); |
|
371 | + $children->register("post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author'); |
|
372 | 372 | |
373 | - $supports = get_all_post_type_supports( $slug ); |
|
373 | + $supports = get_all_post_type_supports($slug); |
|
374 | 374 | |
375 | - if ( isset( $supports['editor'] ) ) { |
|
376 | - $children->register( "post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content' ); |
|
375 | + if (isset($supports['editor'])) { |
|
376 | + $children->register("post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content'); |
|
377 | 377 | } |
378 | 378 | |
379 | - if ( isset( $supports['comments'] ) ) { |
|
380 | - $entities->register( "comment\\{$slug}", 'WordPoints_Entity_Comment' ); |
|
381 | - $children->register( "comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post' ); |
|
382 | - $children->register( "comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author' ); |
|
379 | + if (isset($supports['comments'])) { |
|
380 | + $entities->register("comment\\{$slug}", 'WordPoints_Entity_Comment'); |
|
381 | + $children->register("comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post'); |
|
382 | + $children->register("comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author'); |
|
383 | 383 | } |
384 | 384 | |
385 | - foreach ( get_object_taxonomies( $slug ) as $taxonomy_slug ) { |
|
386 | - $children->register( "post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms' ); |
|
385 | + foreach (get_object_taxonomies($slug) as $taxonomy_slug) { |
|
386 | + $children->register("post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms'); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @param string $slug The slug ("name") of the post type. |
395 | 395 | */ |
396 | - do_action( 'wordpoints_register_post_type_entities', $slug ); |
|
396 | + do_action('wordpoints_register_post_type_entities', $slug); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | /** |
@@ -403,13 +403,13 @@ discard block |
||
403 | 403 | * |
404 | 404 | * @param string $slug The slug of the post type. |
405 | 405 | */ |
406 | -function wordpoints_register_post_type_hook_events( $slug ) { |
|
406 | +function wordpoints_register_post_type_hook_events($slug) { |
|
407 | 407 | |
408 | 408 | $event_slugs = array(); |
409 | 409 | |
410 | 410 | $events = wordpoints_hooks()->events; |
411 | 411 | |
412 | - if ( 'attachment' === $slug ) { |
|
412 | + if ('attachment' === $slug) { |
|
413 | 413 | |
414 | 414 | $event_slugs[] = 'media_upload'; |
415 | 415 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | ); |
447 | 447 | } |
448 | 448 | |
449 | - if ( post_type_supports( $slug, 'comments' ) ) { |
|
449 | + if (post_type_supports($slug, 'comments')) { |
|
450 | 450 | |
451 | 451 | $event_slugs[] = "comment_leave\\{$slug}"; |
452 | 452 | |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | , 'WordPoints_Hook_Event_Comment_Leave' |
456 | 456 | , array( |
457 | 457 | 'actions' => array( |
458 | - 'fire' => array( 'comment_approve', 'comment_new' ), |
|
458 | + 'fire' => array('comment_approve', 'comment_new'), |
|
459 | 459 | 'reverse' => 'comment_deapprove', |
460 | 460 | 'spam' => 'comment_spam', |
461 | 461 | ), |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | ); |
467 | 467 | } |
468 | 468 | |
469 | - if ( is_multisite() ) { |
|
470 | - foreach ( $event_slugs as $event_slug ) { |
|
469 | + if (is_multisite()) { |
|
470 | + foreach ($event_slugs as $event_slug) { |
|
471 | 471 | $events->args->register( |
472 | 472 | $event_slug |
473 | 473 | , 'current:site' |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * |
484 | 484 | * @param string $slug The slug ("name") of the post type. |
485 | 485 | */ |
486 | - do_action( 'wordpoints_register_post_type_hook_events', $slug ); |
|
486 | + do_action('wordpoints_register_post_type_hook_events', $slug); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
@@ -493,13 +493,13 @@ discard block |
||
493 | 493 | * |
494 | 494 | * @param string $slug The slug of the taxonomy. |
495 | 495 | */ |
496 | -function wordpoints_register_taxonomy_entities( $slug ) { |
|
496 | +function wordpoints_register_taxonomy_entities($slug) { |
|
497 | 497 | |
498 | 498 | $entities = wordpoints_entities(); |
499 | 499 | $children = $entities->children; |
500 | 500 | |
501 | - $entities->register( "term\\{$slug}", 'WordPoints_Entity_Term' ); |
|
502 | - $children->register( "term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id' ); |
|
501 | + $entities->register("term\\{$slug}", 'WordPoints_Entity_Term'); |
|
502 | + $children->register("term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id'); |
|
503 | 503 | |
504 | 504 | /** |
505 | 505 | * Fired when registering the entities for a taxonomy. |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * |
509 | 509 | * @param string $slug The taxonomy's slug. |
510 | 510 | */ |
511 | - do_action( 'wordpoints_register_taxonomy_entities', $slug ); |
|
511 | + do_action('wordpoints_register_taxonomy_entities', $slug); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | /** |
@@ -520,10 +520,10 @@ discard block |
||
520 | 520 | * |
521 | 521 | * @param WordPoints_Class_RegistryI $data_types The data types registry. |
522 | 522 | */ |
523 | -function wordpoints_data_types_init( $data_types ) { |
|
523 | +function wordpoints_data_types_init($data_types) { |
|
524 | 524 | |
525 | - $data_types->register( 'integer', 'WordPoints_Data_Type_Integer' ); |
|
526 | - $data_types->register( 'text', 'WordPoints_Data_Type_Text' ); |
|
525 | + $data_types->register('integer', 'WordPoints_Data_Type_Integer'); |
|
526 | + $data_types->register('text', 'WordPoints_Data_Type_Text'); |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | /** |
@@ -538,9 +538,9 @@ discard block |
||
538 | 538 | * |
539 | 539 | * @return bool Whether the user can view the points log. |
540 | 540 | */ |
541 | -function wordpoints_hooks_user_can_view_points_log( $can_view, $log ) { |
|
541 | +function wordpoints_hooks_user_can_view_points_log($can_view, $log) { |
|
542 | 542 | |
543 | - if ( ! $can_view ) { |
|
543 | + if ( ! $can_view) { |
|
544 | 544 | return $can_view; |
545 | 545 | } |
546 | 546 | |
@@ -549,11 +549,11 @@ discard block |
||
549 | 549 | $event_slug = $log->log_type; |
550 | 550 | |
551 | 551 | /** @var WordPoints_Hook_Arg $arg */ |
552 | - foreach ( wordpoints_hooks()->events->args->get_children( $event_slug ) as $slug => $arg ) { |
|
552 | + foreach (wordpoints_hooks()->events->args->get_children($event_slug) as $slug => $arg) { |
|
553 | 553 | |
554 | - $value = wordpoints_get_points_log_meta( $log->id, $slug, true ); |
|
554 | + $value = wordpoints_get_points_log_meta($log->id, $slug, true); |
|
555 | 555 | |
556 | - if ( ! $value ) { |
|
556 | + if ( ! $value) { |
|
557 | 557 | continue; |
558 | 558 | } |
559 | 559 | |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | , $value |
564 | 564 | ); |
565 | 565 | |
566 | - if ( ! $can_view ) { |
|
566 | + if ( ! $can_view) { |
|
567 | 567 | break; |
568 | 568 | } |
569 | 569 | } |
@@ -582,20 +582,20 @@ discard block |
||
582 | 582 | * |
583 | 583 | * @return bool Whether the user can view this entity. |
584 | 584 | */ |
585 | -function wordpoints_entity_user_can_view( $user_id, $entity_slug, $entity_id ) { |
|
585 | +function wordpoints_entity_user_can_view($user_id, $entity_slug, $entity_id) { |
|
586 | 586 | |
587 | - $entity = wordpoints_entities()->get( $entity_slug ); |
|
587 | + $entity = wordpoints_entities()->get($entity_slug); |
|
588 | 588 | |
589 | 589 | // If this entity type is not found, we have no way of determining whether it is |
590 | 590 | // safe for the user to view it. |
591 | - if ( ! ( $entity instanceof WordPoints_Entity ) ) { |
|
591 | + if ( ! ($entity instanceof WordPoints_Entity)) { |
|
592 | 592 | return false; |
593 | 593 | } |
594 | 594 | |
595 | 595 | $can_view = true; |
596 | 596 | |
597 | - if ( $entity instanceof WordPoints_Entity_Restricted_VisibilityI ) { |
|
598 | - $can_view = $entity->user_can_view( $user_id, $entity_id ); |
|
597 | + if ($entity instanceof WordPoints_Entity_Restricted_VisibilityI) { |
|
598 | + $can_view = $entity->user_can_view($user_id, $entity_id); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | /** |
@@ -626,8 +626,8 @@ discard block |
||
626 | 626 | */ |
627 | 627 | function wordpoints_apps() { |
628 | 628 | |
629 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
630 | - WordPoints_App::$main = new WordPoints_App( 'apps' ); |
|
629 | + if ( ! isset(WordPoints_App::$main)) { |
|
630 | + WordPoints_App::$main = new WordPoints_App('apps'); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | return WordPoints_App::$main; |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | */ |
643 | 643 | function wordpoints_hooks() { |
644 | 644 | |
645 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
645 | + if ( ! isset(WordPoints_App::$main)) { |
|
646 | 646 | wordpoints_apps(); |
647 | 647 | } |
648 | 648 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | */ |
659 | 659 | function wordpoints_entities() { |
660 | 660 | |
661 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
661 | + if ( ! isset(WordPoints_App::$main)) { |
|
662 | 662 | wordpoints_apps(); |
663 | 663 | } |
664 | 664 | |
@@ -674,13 +674,13 @@ discard block |
||
674 | 674 | * |
675 | 675 | * @param WordPoints_App $app The main apps app. |
676 | 676 | */ |
677 | -function wordpoints_apps_init( $app ) { |
|
677 | +function wordpoints_apps_init($app) { |
|
678 | 678 | |
679 | 679 | $apps = $app->sub_apps; |
680 | 680 | |
681 | - $apps->register( 'hooks', 'WordPoints_Hooks' ); |
|
682 | - $apps->register( 'entities', 'WordPoints_App_Registry' ); |
|
683 | - $apps->register( 'data_types', 'WordPoints_Class_Registry' ); |
|
681 | + $apps->register('hooks', 'WordPoints_Hooks'); |
|
682 | + $apps->register('entities', 'WordPoints_App_Registry'); |
|
683 | + $apps->register('data_types', 'WordPoints_Class_Registry'); |
|
684 | 684 | } |
685 | 685 | |
686 | 686 | /** |
@@ -693,19 +693,19 @@ discard block |
||
693 | 693 | * |
694 | 694 | * @return object|false The constructed object, or false if to many args were passed. |
695 | 695 | */ |
696 | -function wordpoints_construct_class_with_args( $class_name, array $args ) { |
|
696 | +function wordpoints_construct_class_with_args($class_name, array $args) { |
|
697 | 697 | |
698 | - switch ( count( $args ) ) { |
|
698 | + switch (count($args)) { |
|
699 | 699 | case 0: |
700 | 700 | return new $class_name(); |
701 | 701 | case 1: |
702 | - return new $class_name( $args[0] ); |
|
702 | + return new $class_name($args[0]); |
|
703 | 703 | case 2: |
704 | - return new $class_name( $args[0], $args[1] ); |
|
704 | + return new $class_name($args[0], $args[1]); |
|
705 | 705 | case 3: |
706 | - return new $class_name( $args[0], $args[1], $args[2] ); |
|
706 | + return new $class_name($args[0], $args[1], $args[2]); |
|
707 | 707 | case 4: |
708 | - return new $class_name( $args[0], $args[1], $args[2], $args[3] ); |
|
708 | + return new $class_name($args[0], $args[1], $args[2], $args[3]); |
|
709 | 709 | default: |
710 | 710 | return false; |
711 | 711 | } |
@@ -727,13 +727,13 @@ discard block |
||
727 | 727 | * @return array The slug parsed into the 'generic' and 'dynamic' portions. If the |
728 | 728 | * slug is not dynamic, the value of each of those keys will be false. |
729 | 729 | */ |
730 | -function wordpoints_parse_dynamic_slug( $slug ) { |
|
730 | +function wordpoints_parse_dynamic_slug($slug) { |
|
731 | 731 | |
732 | - $parsed = array( 'dynamic' => false, 'generic' => false ); |
|
732 | + $parsed = array('dynamic' => false, 'generic' => false); |
|
733 | 733 | |
734 | - $parts = explode( '\\', $slug, 2 ); |
|
734 | + $parts = explode('\\', $slug, 2); |
|
735 | 735 | |
736 | - if ( isset( $parts[1] ) ) { |
|
736 | + if (isset($parts[1])) { |
|
737 | 737 | $parsed['dynamic'] = $parts[1]; |
738 | 738 | $parsed['generic'] = $parts[0]; |
739 | 739 | } |
@@ -97,30 +97,30 @@ discard block |
||
97 | 97 | /** |
98 | 98 | * @since 1.0.0 |
99 | 99 | */ |
100 | - public function __get( $var ) { |
|
100 | + public function __get($var) { |
|
101 | 101 | |
102 | 102 | $network_mode = wordpoints_hooks()->get_network_mode(); |
103 | 103 | |
104 | - switch ( $var ) { |
|
104 | + switch ($var) { |
|
105 | 105 | case 'reactions': |
106 | 106 | $var = $network_mode ? 'network_reactions' : 'standard_reactions'; |
107 | 107 | // fall through |
108 | 108 | |
109 | 109 | case 'standard_reactions': |
110 | 110 | case 'network_reactions': |
111 | - if ( $network_mode && 'standard_reactions' === $var ) { |
|
111 | + if ($network_mode && 'standard_reactions' === $var) { |
|
112 | 112 | return null; |
113 | 113 | } |
114 | 114 | |
115 | - if ( 'network_reactions' === $var && ! $this->is_network_wide() ) { |
|
115 | + if ('network_reactions' === $var && ! $this->is_network_wide()) { |
|
116 | 116 | return null; |
117 | 117 | } |
118 | 118 | |
119 | - if ( ! isset( $this->$var ) ) { |
|
120 | - if ( isset( $this->{"{$var}_class"} ) ) { |
|
119 | + if ( ! isset($this->$var)) { |
|
120 | + if (isset($this->{"{$var}_class"} )) { |
|
121 | 121 | $this->$var = new $this->{"{$var}_class"}( |
122 | 122 | $this->slug |
123 | - , ( 'network_reactions' === $var ) |
|
123 | + , ('network_reactions' === $var) |
|
124 | 124 | ); |
125 | 125 | } |
126 | 126 | } |
@@ -194,21 +194,21 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @return WordPoints_Hook_ReactionI[] All of the reaction objects. |
196 | 196 | */ |
197 | - public function get_all_reactions_to_event( $event_slug ) { |
|
197 | + public function get_all_reactions_to_event($event_slug) { |
|
198 | 198 | |
199 | 199 | $reactions = array(); |
200 | 200 | |
201 | - foreach ( array( 'standard', 'network' ) as $store ) { |
|
201 | + foreach (array('standard', 'network') as $store) { |
|
202 | 202 | |
203 | 203 | $storage = $this->{"{$store}_reactions"}; |
204 | 204 | |
205 | - if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI ) { |
|
205 | + if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI) { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | |
209 | 209 | $reactions = array_merge( |
210 | 210 | $reactions |
211 | - , $storage->get_reactions_to_event( $event_slug ) |
|
211 | + , $storage->get_reactions_to_event($event_slug) |
|
212 | 212 | ); |
213 | 213 | } |
214 | 214 | |
@@ -230,15 +230,15 @@ discard block |
||
230 | 230 | |
231 | 231 | $reactions = array(); |
232 | 232 | |
233 | - foreach ( array( 'standard', 'network' ) as $store ) { |
|
233 | + foreach (array('standard', 'network') as $store) { |
|
234 | 234 | |
235 | 235 | $storage = $this->{"{$store}_reactions"}; |
236 | 236 | |
237 | - if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI ) { |
|
237 | + if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI) { |
|
238 | 238 | continue; |
239 | 239 | } |
240 | 240 | |
241 | - $reactions = array_merge( $reactions, $storage->get_reactions() ); |
|
241 | + $reactions = array_merge($reactions, $storage->get_reactions()); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | return $reactions; |
@@ -254,21 +254,21 @@ discard block |
||
254 | 254 | ) { |
255 | 255 | |
256 | 256 | if ( |
257 | - empty( $settings['target'] ) |
|
258 | - || ! is_array( $settings['target'] ) |
|
257 | + empty($settings['target']) |
|
258 | + || ! is_array($settings['target']) |
|
259 | 259 | ) { |
260 | 260 | |
261 | - $validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' ); |
|
261 | + $validator->add_error(__('Invalid target.', 'wordpoints'), 'target'); |
|
262 | 262 | |
263 | 263 | } else { |
264 | 264 | |
265 | - $target = $event_args->get_from_hierarchy( $settings['target'] ); |
|
265 | + $target = $event_args->get_from_hierarchy($settings['target']); |
|
266 | 266 | |
267 | 267 | if ( |
268 | 268 | ! $target instanceof WordPoints_Entity |
269 | - || ! in_array( $target->get_slug(), (array) $this->arg_types ) |
|
269 | + || ! in_array($target->get_slug(), (array) $this->arg_types) |
|
270 | 270 | ) { |
271 | - $validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' ); |
|
271 | + $validator->add_error(__('Invalid target.', 'wordpoints'), 'target'); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | /** |
279 | 279 | * @since 1.0.0 |
280 | 280 | */ |
281 | - public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) { |
|
282 | - $reaction->update_meta( 'target', $settings['target'] ); |
|
281 | + public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) { |
|
282 | + $reaction->update_meta('target', $settings['target']); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * @param WordPoints_Hook_Event_Args $event_args The event args. |
291 | 291 | * @param WordPoints_Hook_Reaction_Validator $reaction The reaction. |
292 | 292 | */ |
293 | - abstract public function hit( WordPoints_Hook_Event_Args $event_args, WordPoints_Hook_Reaction_Validator $reaction ); |
|
293 | + abstract public function hit(WordPoints_Hook_Event_Args $event_args, WordPoints_Hook_Reaction_Validator $reaction); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | // EOF |
@@ -7,17 +7,17 @@ |
||
7 | 7 | * @since 1.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -add_action( 'wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps' ); |
|
10 | +add_action('wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps'); |
|
11 | 11 | |
12 | -add_action( 'admin_menu', 'wordpoints_hooks_api_admin_menu' ); |
|
12 | +add_action('admin_menu', 'wordpoints_hooks_api_admin_menu'); |
|
13 | 13 | |
14 | -if ( is_wordpoints_network_active() ) { |
|
15 | - add_action( 'network_admin_menu', 'wordpoints_hooks_api_admin_menu' ); |
|
14 | +if (is_wordpoints_network_active()) { |
|
15 | + add_action('network_admin_menu', 'wordpoints_hooks_api_admin_menu'); |
|
16 | 16 | } |
17 | 17 | |
18 | -add_action( 'admin_init', 'wordpoints_hooks_admin_register_scripts' ); |
|
19 | -add_action( 'admin_init', 'wordpoints_hooks_admin_ajax' ); |
|
18 | +add_action('admin_init', 'wordpoints_hooks_admin_register_scripts'); |
|
19 | +add_action('admin_init', 'wordpoints_hooks_admin_ajax'); |
|
20 | 20 | |
21 | -add_filter( 'script_loader_tag', 'wordpoints_script_templates_filter', 10, 2 ); |
|
21 | +add_filter('script_loader_tag', 'wordpoints_script_templates_filter', 10, 2); |
|
22 | 22 | |
23 | 23 | // EOF |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | public function hooks() { |
63 | 63 | |
64 | 64 | /* Load the JavaScript needed for the settings screen. */ |
65 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
66 | - add_action( "admin_footer-{$this->id}", array( $this, 'footer_scripts' ) ); |
|
65 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
66 | + add_action("admin_footer-{$this->id}", array($this, 'footer_scripts')); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | |
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | - <h1><?php echo esc_html( $this->get_title() ); ?></h1> |
|
101 | + <h1><?php echo esc_html($this->get_title()); ?></h1> |
|
102 | 102 | |
103 | 103 | <?php settings_errors(); ?> |
104 | 104 | |
105 | - <?php if ( ! empty( $this->tabs ) ) : ?> |
|
106 | - <?php wordpoints_admin_show_tabs( $this->tabs, false ); ?> |
|
105 | + <?php if ( ! empty($this->tabs)) : ?> |
|
106 | + <?php wordpoints_admin_show_tabs($this->tabs, false); ?> |
|
107 | 107 | <?php endif; ?> |
108 | 108 | |
109 | 109 | <?php $this->display_content(); ?> |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @since 1.0.0 |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - add_action( 'current_screen', array( $this, 'set_current_screen' ) ); |
|
30 | + add_action('current_screen', array($this, 'set_current_screen')); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,23 +37,23 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param WP_Screen $current_screen The WP_Screen object for the current screen. |
39 | 39 | */ |
40 | - public function set_current_screen( $current_screen ) { |
|
40 | + public function set_current_screen($current_screen) { |
|
41 | 41 | |
42 | 42 | $screen_id = $current_screen->id; |
43 | 43 | |
44 | - if ( is_network_admin() ) { |
|
45 | - $screen_id = substr( $screen_id, 0, -8 /* -network */ ); |
|
44 | + if (is_network_admin()) { |
|
45 | + $screen_id = substr($screen_id, 0, -8 /* -network */); |
|
46 | 46 | } |
47 | 47 | |
48 | - $screen = $this->get( $screen_id ); |
|
48 | + $screen = $this->get($screen_id); |
|
49 | 49 | |
50 | - if ( ! ( $screen instanceof WordPoints_Admin_Screen ) ) { |
|
50 | + if ( ! ($screen instanceof WordPoints_Admin_Screen)) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | 54 | $this->current_screen = $screen; |
55 | 55 | |
56 | - add_action( "load-{$screen_id}", array( $this->current_screen, 'load' ) ); |
|
56 | + add_action("load-{$screen_id}", array($this->current_screen, 'load')); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -16,16 +16,16 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param WordPoints_App $app The main WordPoints app. |
18 | 18 | */ |
19 | -function wordpoints_hooks_register_admin_apps( $app ) { |
|
19 | +function wordpoints_hooks_register_admin_apps($app) { |
|
20 | 20 | |
21 | 21 | $apps = $app->sub_apps; |
22 | 22 | |
23 | - $apps->register( 'admin', 'WordPoints_App' ); |
|
23 | + $apps->register('admin', 'WordPoints_App'); |
|
24 | 24 | |
25 | 25 | /** @var WordPoints_App $admin */ |
26 | - $admin = $apps->get( 'admin' ); |
|
26 | + $admin = $apps->get('admin'); |
|
27 | 27 | |
28 | - $admin->sub_apps->register( 'screen', 'WordPoints_Admin_Screens' ); |
|
28 | + $admin->sub_apps->register('screen', 'WordPoints_Admin_Screens'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | // Hooks page. |
47 | 47 | $id = add_submenu_page( |
48 | 48 | $wordpoints_menu |
49 | - , __( 'WordPoints — Points Types', 'wordpoints' ) |
|
50 | - , __( 'Points Types', 'wordpoints' ) |
|
49 | + , __('WordPoints — Points Types', 'wordpoints') |
|
50 | + , __('Points Types', 'wordpoints') |
|
51 | 51 | , 'manage_options' |
52 | 52 | , 'wordpoints_points_types' |
53 | - , array( $admin_screens, 'display' ) |
|
53 | + , array($admin_screens, 'display') |
|
54 | 54 | ); |
55 | 55 | |
56 | - if ( $id ) { |
|
57 | - $admin_screens->register( $id, 'WordPoints_Admin_Screen_Points_Types' ); |
|
56 | + if ($id) { |
|
57 | + $admin_screens->register($id, 'WordPoints_Admin_Screen_Points_Types'); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function wordpoints_hooks_admin_register_scripts() { |
69 | 69 | |
70 | - $assets_url = wordpoints_modules_url( '/assets', dirname( __FILE__ ) ); |
|
70 | + $assets_url = wordpoints_modules_url('/assets', dirname(__FILE__)); |
|
71 | 71 | |
72 | 72 | // CSS |
73 | 73 | |
74 | 74 | wp_register_style( |
75 | 75 | 'wordpoints-hooks-admin' |
76 | - , $assets_url . '/css/hooks.css' |
|
77 | - , array( 'dashicons', 'wp-jquery-ui-dialog' ) |
|
76 | + , $assets_url.'/css/hooks.css' |
|
77 | + , array('dashicons', 'wp-jquery-ui-dialog') |
|
78 | 78 | , WORDPOINTS_VERSION |
79 | 79 | ); |
80 | 80 | |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | |
83 | 83 | wp_register_script( |
84 | 84 | 'wordpoints-hooks-models' |
85 | - , $assets_url . '/js/hooks/models.js' |
|
86 | - , array( 'backbone', 'jquery-ui-dialog', 'wp-util' ) |
|
85 | + , $assets_url.'/js/hooks/models.js' |
|
86 | + , array('backbone', 'jquery-ui-dialog', 'wp-util') |
|
87 | 87 | , WORDPOINTS_VERSION |
88 | 88 | ); |
89 | 89 | |
90 | 90 | wp_register_script( |
91 | 91 | 'wordpoints-hooks-views' |
92 | - , $assets_url . '/js/hooks/views.js' |
|
93 | - , array( 'wordpoints-hooks-models' ) |
|
92 | + , $assets_url.'/js/hooks/views.js' |
|
93 | + , array('wordpoints-hooks-models') |
|
94 | 94 | , WORDPOINTS_VERSION |
95 | 95 | ); |
96 | 96 | |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | 'wordpoints-hooks-views' |
99 | 99 | , 'WordPointsHooksAdminL10n' |
100 | 100 | , array( |
101 | - 'unexpectedError' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ), |
|
102 | - 'changesSaved' => __( 'Your changes have been saved.', 'wordpoints' ), |
|
101 | + 'unexpectedError' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'), |
|
102 | + 'changesSaved' => __('Your changes have been saved.', 'wordpoints'), |
|
103 | 103 | /* translators: the name of the field that cannot be empty */ |
104 | - 'emptyField' => sprintf( __( '%s cannot be empty.', 'wordpoints' ), '{{ data.label }}' ), |
|
105 | - 'confirmDelete' => __( 'Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints' ), |
|
106 | - 'confirmTitle' => __( 'Are you sure?', 'wordpoints' ), |
|
107 | - 'deleteText' => __( 'Delete', 'wordpoints' ), |
|
108 | - 'cancelText' => __( 'Cancel', 'wordpoints' ), |
|
109 | - 'separator' => __( ' » ', 'wordpoints' ), |
|
104 | + 'emptyField' => sprintf(__('%s cannot be empty.', 'wordpoints'), '{{ data.label }}'), |
|
105 | + 'confirmDelete' => __('Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints'), |
|
106 | + 'confirmTitle' => __('Are you sure?', 'wordpoints'), |
|
107 | + 'deleteText' => __('Delete', 'wordpoints'), |
|
108 | + 'cancelText' => __('Cancel', 'wordpoints'), |
|
109 | + 'separator' => __(' » ', 'wordpoints'), |
|
110 | 110 | ) |
111 | 111 | ); |
112 | 112 | |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | <div class="view"> |
119 | 119 | <div class="title"></div> |
120 | 120 | <button type="button" class="edit button-secondary"> |
121 | - ' . esc_html__( 'Edit', 'wordpoints' ) . ' |
|
121 | + ' . esc_html__('Edit', 'wordpoints').' |
|
122 | 122 | </button> |
123 | 123 | <button type="button" class="close button-secondary"> |
124 | - ' . esc_html__( 'Close', 'wordpoints' ) . ' |
|
124 | + ' . esc_html__('Close', 'wordpoints').' |
|
125 | 125 | </button> |
126 | 126 | </div> |
127 | 127 | <div class="form"> |
@@ -140,16 +140,16 @@ discard block |
||
140 | 140 | </div> |
141 | 141 | <div class="action-buttons"> |
142 | 142 | <button type="button" class="save button-primary" disabled> |
143 | - ' . esc_html__( 'Save', 'wordpoints' ) . ' |
|
143 | + ' . esc_html__('Save', 'wordpoints').' |
|
144 | 144 | </button> |
145 | 145 | <button type="button" class="cancel button-secondary"> |
146 | - ' . esc_html__( 'Cancel', 'wordpoints' ) . ' |
|
146 | + ' . esc_html__('Cancel', 'wordpoints').' |
|
147 | 147 | </button> |
148 | 148 | <button type="button" class="close button-secondary"> |
149 | - ' . esc_html__( 'Close', 'wordpoints' ) . ' |
|
149 | + ' . esc_html__('Close', 'wordpoints').' |
|
150 | 150 | </button> |
151 | 151 | <button type="button" class="delete button-secondary"> |
152 | - ' . esc_html__( 'Delete', 'wordpoints' ) . ' |
|
152 | + ' . esc_html__('Delete', 'wordpoints').' |
|
153 | 153 | </button> |
154 | 154 | </div> |
155 | 155 | </div> |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | |
198 | 198 | wp_register_script( |
199 | 199 | 'wordpoints-hooks-reactor-points' |
200 | - , $assets_url . '/js/hooks/reactors/points.js' |
|
201 | - , array( 'wordpoints-hooks-views' ) |
|
200 | + , $assets_url.'/js/hooks/reactors/points.js' |
|
201 | + , array('wordpoints-hooks-views') |
|
202 | 202 | , WORDPOINTS_VERSION |
203 | 203 | ); |
204 | 204 | |
205 | 205 | wp_register_script( |
206 | 206 | 'wordpoints-hooks-extension-conditions' |
207 | - , $assets_url . '/js/hooks/extensions/conditions.js' |
|
208 | - , array( 'wordpoints-hooks-views' ) |
|
207 | + , $assets_url.'/js/hooks/extensions/conditions.js' |
|
208 | + , array('wordpoints-hooks-views') |
|
209 | 209 | , WORDPOINTS_VERSION |
210 | 210 | ); |
211 | 211 | |
@@ -215,25 +215,25 @@ discard block |
||
215 | 215 | , ' |
216 | 216 | <script type="text/template" id="tmpl-wordpoints-hook-condition-groups"> |
217 | 217 | <div class="conditions-title section-title"> |
218 | - <h4>' . esc_html__( 'Conditions', 'wordpoints' ) . '</h4> |
|
218 | + <h4>' . esc_html__('Conditions', 'wordpoints').'</h4> |
|
219 | 219 | <button type="button" class="add-new button-secondary button-link"> |
220 | - <span class="screen-reader-text">' . esc_html__( 'Add New Condition', 'wordpoints' ) . '</span> |
|
220 | + <span class="screen-reader-text">' . esc_html__('Add New Condition', 'wordpoints').'</span> |
|
221 | 221 | <span class="dashicons dashicons-plus"></span> |
222 | 222 | </button> |
223 | 223 | </div> |
224 | 224 | <div class="add-condition-form hidden"> |
225 | 225 | <div class="no-conditions hidden"> |
226 | - ' . esc_html__( 'No conditions available.', 'wordpoints' ) . ' |
|
226 | + ' . esc_html__('No conditions available.', 'wordpoints').' |
|
227 | 227 | </div> |
228 | 228 | <div class="condition-selectors"> |
229 | 229 | <div class="arg-selectors"></div> |
230 | 230 | <div class="condition-selector"></div> |
231 | 231 | </div> |
232 | - <button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__( 'Add Condition', 'wordpoints' ) . '"> |
|
233 | - ' . esc_html_x( 'Add', 'reaction condition', 'wordpoints' ) . ' |
|
232 | + <button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__('Add Condition', 'wordpoints').'"> |
|
233 | + ' . esc_html_x('Add', 'reaction condition', 'wordpoints').' |
|
234 | 234 | </button> |
235 | - <button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__( 'Cancel Adding New Condition', 'wordpoints' ) . '"> |
|
236 | - ' . esc_html_x( 'Cancel', 'reaction condition', 'wordpoints' ) . ' |
|
235 | + <button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__('Cancel Adding New Condition', 'wordpoints').'"> |
|
236 | + ' . esc_html_x('Cancel', 'reaction condition', 'wordpoints').' |
|
237 | 237 | </button> |
238 | 238 | </div> |
239 | 239 | <div class="condition-groups section-content"></div> |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | <div class="condition-controls"> |
248 | 248 | <div class="condition-title"></div> |
249 | 249 | <button type="button" class="delete button-secondary button-link"> |
250 | - <span class="screen-reader-text">' . esc_html__( 'Remove Condition', 'wordpoints' ) . '</span> |
|
250 | + <span class="screen-reader-text">' . esc_html__('Remove Condition', 'wordpoints').'</span> |
|
251 | 251 | <span class="dashicons dashicons-no"></span> |
252 | 252 | </button> |
253 | 253 | </div> |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | |
266 | 266 | wp_register_script( |
267 | 267 | 'wordpoints-hooks-extension-periods' |
268 | - , $assets_url . '/js/hooks/extensions/periods.js' |
|
269 | - , array( 'wordpoints-hooks-views' ) |
|
268 | + , $assets_url.'/js/hooks/extensions/periods.js' |
|
269 | + , array('wordpoints-hooks-views') |
|
270 | 270 | , WORDPOINTS_VERSION |
271 | 271 | ); |
272 | 272 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | , ' |
277 | 277 | <script type="text/template" id="tmpl-wordpoints-hook-periods"> |
278 | 278 | <div class="periods-title section-title"> |
279 | - <h4>' . esc_html__( 'Rate Limit', 'wordpoints' ) . '</h4> |
|
279 | + <h4>' . esc_html__('Rate Limit', 'wordpoints').'</h4> |
|
280 | 280 | </div> |
281 | 281 | <div class="periods section-content"></div> |
282 | 282 | </script> |
@@ -295,32 +295,32 @@ discard block |
||
295 | 295 | |
296 | 296 | $extensions_data = array(); |
297 | 297 | |
298 | - foreach ( $hooks->extensions->get_all() as $slug => $extension ) { |
|
298 | + foreach ($hooks->extensions->get_all() as $slug => $extension) { |
|
299 | 299 | |
300 | - if ( $extension instanceof WordPoints_Hook_Extension ) { |
|
301 | - $extensions_data[ $slug ] = $extension->get_ui_script_data(); |
|
300 | + if ($extension instanceof WordPoints_Hook_Extension) { |
|
301 | + $extensions_data[$slug] = $extension->get_ui_script_data(); |
|
302 | 302 | } |
303 | 303 | |
304 | - if ( wp_script_is( "wordpoints-hooks-extension-{$slug}", 'registered' ) ) { |
|
305 | - wp_enqueue_script( "wordpoints-hooks-extension-{$slug}" ); |
|
304 | + if (wp_script_is("wordpoints-hooks-extension-{$slug}", 'registered')) { |
|
305 | + wp_enqueue_script("wordpoints-hooks-extension-{$slug}"); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | |
309 | 309 | $reactor_data = array(); |
310 | 310 | |
311 | - foreach ( $hooks->reactors->get_all() as $slug => $reactor ) { |
|
311 | + foreach ($hooks->reactors->get_all() as $slug => $reactor) { |
|
312 | 312 | |
313 | - if ( $reactor instanceof WordPoints_Hook_Reactor ) { |
|
314 | - $reactor_data[ $slug ] = array( |
|
313 | + if ($reactor instanceof WordPoints_Hook_Reactor) { |
|
314 | + $reactor_data[$slug] = array( |
|
315 | 315 | 'slug' => $reactor->get_slug(), |
316 | 316 | 'fields' => $reactor->get_settings_fields(), |
317 | 317 | 'arg_types' => $reactor->get_arg_types(), |
318 | - 'target_label' => __( 'Award To', 'wordpoints' ), |
|
318 | + 'target_label' => __('Award To', 'wordpoints'), |
|
319 | 319 | ); |
320 | 320 | } |
321 | 321 | |
322 | - if ( wp_script_is( "wordpoints-hooks-reactor-{$slug}", 'registered' ) ) { |
|
323 | - wp_enqueue_script( "wordpoints-hooks-reactor-{$slug}" ); |
|
322 | + if (wp_script_is("wordpoints-hooks-reactor-{$slug}", 'registered')) { |
|
323 | + wp_enqueue_script("wordpoints-hooks-reactor-{$slug}"); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
@@ -332,28 +332,28 @@ discard block |
||
332 | 332 | $entity_children = $entities->children; |
333 | 333 | |
334 | 334 | /** @var WordPoints_Entity $entity */ |
335 | - foreach ( $entities->get_all() as $slug => $entity ) { |
|
335 | + foreach ($entities->get_all() as $slug => $entity) { |
|
336 | 336 | |
337 | 337 | $child_data = array(); |
338 | 338 | |
339 | 339 | /** @var WordPoints_EntityishI $child */ |
340 | - foreach ( $entity_children->get_children( $slug ) as $child_slug => $child ) { |
|
340 | + foreach ($entity_children->get_children($slug) as $child_slug => $child) { |
|
341 | 341 | |
342 | - $child_data[ $child_slug ] = array( |
|
342 | + $child_data[$child_slug] = array( |
|
343 | 343 | 'slug' => $child_slug, |
344 | 344 | 'title' => $child->get_title(), |
345 | 345 | ); |
346 | 346 | |
347 | - if ( $child instanceof WordPoints_Entity_Attr ) { |
|
347 | + if ($child instanceof WordPoints_Entity_Attr) { |
|
348 | 348 | |
349 | - $child_data[ $child_slug ]['_type'] = 'attr'; |
|
350 | - $child_data[ $child_slug ]['data_type'] = $child->get_data_type(); |
|
349 | + $child_data[$child_slug]['_type'] = 'attr'; |
|
350 | + $child_data[$child_slug]['data_type'] = $child->get_data_type(); |
|
351 | 351 | |
352 | - } elseif ( $child instanceof WordPoints_Entity_Relationship ) { |
|
352 | + } elseif ($child instanceof WordPoints_Entity_Relationship) { |
|
353 | 353 | |
354 | - $child_data[ $child_slug ]['_type'] = 'relationship'; |
|
355 | - $child_data[ $child_slug ]['primary'] = $child->get_primary_entity_slug(); |
|
356 | - $child_data[ $child_slug ]['secondary'] = $child->get_related_entity_slug(); |
|
354 | + $child_data[$child_slug]['_type'] = 'relationship'; |
|
355 | + $child_data[$child_slug]['primary'] = $child->get_primary_entity_slug(); |
|
356 | + $child_data[$child_slug]['secondary'] = $child->get_related_entity_slug(); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | * @param array $data The data for the entity child. |
365 | 365 | * @param WordPoints_Entityish $child The child's object. |
366 | 366 | */ |
367 | - $child_data[ $child_slug ] = apply_filters( 'wordpoints_hooks_ui_data_entity_child', $child_data[ $child_slug ], $child ); |
|
367 | + $child_data[$child_slug] = apply_filters('wordpoints_hooks_ui_data_entity_child', $child_data[$child_slug], $child); |
|
368 | 368 | } |
369 | 369 | |
370 | - $entities_data[ $slug ] = array( |
|
370 | + $entities_data[$slug] = array( |
|
371 | 371 | 'slug' => $slug, |
372 | 372 | 'title' => $entity->get_title(), |
373 | 373 | 'children' => $child_data, |
@@ -375,12 +375,12 @@ discard block |
||
375 | 375 | '_type' => 'entity', |
376 | 376 | ); |
377 | 377 | |
378 | - if ( $entity instanceof WordPoints_Entity_EnumerableI ) { |
|
378 | + if ($entity instanceof WordPoints_Entity_EnumerableI) { |
|
379 | 379 | |
380 | 380 | $values = array(); |
381 | 381 | |
382 | - foreach ( $entity->get_enumerated_values() as $value ) { |
|
383 | - if ( $entity->set_the_value( $value ) ) { |
|
382 | + foreach ($entity->get_enumerated_values() as $value) { |
|
383 | + if ($entity->set_the_value($value)) { |
|
384 | 384 | $values[] = array( |
385 | 385 | 'value' => $entity->get_the_id(), |
386 | 386 | 'label' => $entity->get_the_human_id(), |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | - $entities_data[ $slug ]['values'] = $values; |
|
391 | + $entities_data[$slug]['values'] = $values; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * @param array $data The data for the entity. |
398 | 398 | * @param WordPoints_Entity $entity The entity object. |
399 | 399 | */ |
400 | - $entities_data[ $slug ] = apply_filters( 'wordpoints_hooks_ui_data_entity', $entities_data[ $slug ], $entity ); |
|
400 | + $entities_data[$slug] = apply_filters('wordpoints_hooks_ui_data_entity', $entities_data[$slug], $entity); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | $data = array( |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @param array $data The data. |
420 | 420 | */ |
421 | - $data = apply_filters( 'wordpoints_hooks_ui_data', $data ); |
|
421 | + $data = apply_filters('wordpoints_hooks_ui_data', $data); |
|
422 | 422 | |
423 | 423 | wp_localize_script( |
424 | 424 | 'wordpoints-hooks-models' |
@@ -443,13 +443,13 @@ discard block |
||
443 | 443 | * |
444 | 444 | * @return string The HTML with templates appended. |
445 | 445 | */ |
446 | -function wordpoints_script_templates_filter( $html, $handle ) { |
|
446 | +function wordpoints_script_templates_filter($html, $handle) { |
|
447 | 447 | |
448 | 448 | global $wp_scripts; |
449 | 449 | |
450 | - $templates = $wp_scripts->get_data( $handle, 'wordpoints-templates' ); |
|
450 | + $templates = $wp_scripts->get_data($handle, 'wordpoints-templates'); |
|
451 | 451 | |
452 | - if ( $templates ) { |
|
452 | + if ($templates) { |
|
453 | 453 | $html .= $templates; |
454 | 454 | } |
455 | 455 | |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | */ |
466 | 466 | function wordpoints_hooks_admin_ajax() { |
467 | 467 | |
468 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
468 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
469 | 469 | new WordPoints_Admin_Ajax_Hooks; |
470 | 470 | } |
471 | 471 | } |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @since 1.0.0 |
19 | 19 | */ |
20 | - public function do_event( $event_slug, WordPoints_Hook_Event_Args $event_args ) { |
|
20 | + public function do_event($event_slug, WordPoints_Hook_Event_Args $event_args) { |
|
21 | 21 | |
22 | 22 | $hooks = wordpoints_hooks(); |
23 | 23 | |
24 | 24 | /** @var WordPoints_Hook_Reactor $reactor */ |
25 | - foreach ( $hooks->reactors->get_all() as $reactor ) { |
|
25 | + foreach ($hooks->reactors->get_all() as $reactor) { |
|
26 | 26 | |
27 | - foreach ( $reactor->get_all_reactions_to_event( $event_slug ) as $reaction ) { |
|
27 | + foreach ($reactor->get_all_reactions_to_event($event_slug) as $reaction) { |
|
28 | 28 | |
29 | 29 | $validator = new WordPoints_Hook_Reaction_Validator( |
30 | 30 | $reaction |
@@ -34,26 +34,26 @@ discard block |
||
34 | 34 | |
35 | 35 | $validator->validate(); |
36 | 36 | |
37 | - if ( $validator->had_errors() ) { |
|
37 | + if ($validator->had_errors()) { |
|
38 | 38 | continue; |
39 | 39 | } |
40 | 40 | |
41 | - $event_args->set_validator( $validator ); |
|
41 | + $event_args->set_validator($validator); |
|
42 | 42 | $reaction = $validator; |
43 | 43 | |
44 | 44 | /** @var WordPoints_Hook_Extension[] $extensions */ |
45 | 45 | $extensions = $hooks->extensions->get_all(); |
46 | 46 | |
47 | - foreach ( $extensions as $extension ) { |
|
48 | - if ( ! $extension->should_hit( $reaction, $event_args ) ) { |
|
47 | + foreach ($extensions as $extension) { |
|
48 | + if ( ! $extension->should_hit($reaction, $event_args)) { |
|
49 | 49 | continue 2; |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | - $reactor->hit( $event_args, $reaction ); |
|
53 | + $reactor->hit($event_args, $reaction); |
|
54 | 54 | |
55 | - foreach ( $extensions as $extension ) { |
|
56 | - $extension->after_hit( $reaction, $event_args ); |
|
55 | + foreach ($extensions as $extension) { |
|
56 | + $extension->after_hit($reaction, $event_args); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |