@@ -33,7 +33,7 @@ |
||
33 | 33 | * @since 1.0.0 |
34 | 34 | */ |
35 | 35 | public function get_title() { |
36 | - return __( 'Author', 'wordpoints' ); |
|
36 | + return __('Author', 'wordpoints'); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 |
@@ -19,11 +19,11 @@ |
||
19 | 19 | */ |
20 | 20 | public function should_fire() { |
21 | 21 | |
22 | - if ( ! isset( $this->args[1]->comment_approved ) ) { |
|
22 | + if ( ! isset($this->args[1]->comment_approved)) { |
|
23 | 23 | return false; |
24 | 24 | } |
25 | 25 | |
26 | - if ( 1 !== (int) $this->args[1]->comment_approved ) { |
|
26 | + if (1 !== (int) $this->args[1]->comment_approved) { |
|
27 | 27 | return false; |
28 | 28 | } |
29 | 29 |
@@ -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 | ); |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | , array( |
142 | 142 | 'action' => 'transition_post_status', |
143 | 143 | 'data' => array( |
144 | - 'arg_index' => array( 'post' => 2 ), |
|
145 | - 'requirements' => array( 0 => 'publish' ), |
|
144 | + 'arg_index' => array('post' => 2), |
|
145 | + 'requirements' => array(0 => 'publish'), |
|
146 | 146 | ), |
147 | 147 | ) |
148 | 148 | ); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | , array( |
154 | 154 | 'action' => 'post_delete', |
155 | 155 | 'data' => array( |
156 | - 'arg_index' => array( 'post' => 0 ), |
|
156 | + 'arg_index' => array('post' => 0), |
|
157 | 157 | ), |
158 | 158 | ) |
159 | 159 | ); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | , array( |
165 | 165 | 'action' => 'user_register', |
166 | 166 | 'data' => array( |
167 | - 'arg_index' => array( 'user' => 0 ), |
|
167 | + 'arg_index' => array('user' => 0), |
|
168 | 168 | ), |
169 | 169 | ) |
170 | 170 | ); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | , array( |
176 | 176 | 'action' => is_multisite() ? 'wpmu_delete_user' : 'delete_user', |
177 | 177 | 'data' => array( |
178 | - 'arg_index' => array( 'user' => 0 ), |
|
178 | + 'arg_index' => array('user' => 0), |
|
179 | 179 | ), |
180 | 180 | ) |
181 | 181 | ); |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @param WordPoints_Hook_Events $events The event registry. |
200 | 200 | */ |
201 | -function wordpoints_hook_events_init( $events ) { |
|
201 | +function wordpoints_hook_events_init($events) { |
|
202 | 202 | |
203 | 203 | $events->register( |
204 | 204 | 'comment_leave' |
205 | 205 | , 'WordPoints_Hook_Event_Comment_Leave' |
206 | 206 | , array( |
207 | 207 | 'actions' => array( |
208 | - 'fire' => array( 'comment_approve', 'comment_new' ), |
|
208 | + 'fire' => array('comment_approve', 'comment_new'), |
|
209 | 209 | 'reverse' => 'comment_deapprove', |
210 | 210 | 'spam' => 'comment_spam', |
211 | 211 | ), |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | ) |
257 | 257 | ); |
258 | 258 | |
259 | - if ( is_multisite() ) { |
|
259 | + if (is_multisite()) { |
|
260 | 260 | |
261 | 261 | // TODO network hooks |
262 | 262 | $events->args->register( |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | * |
277 | 277 | * @param WordPoints_Class_Registry_Persistent $firers The firer registry. |
278 | 278 | */ |
279 | -function wordpoints_hook_firers_init( $firers ) { |
|
279 | +function wordpoints_hook_firers_init($firers) { |
|
280 | 280 | |
281 | - $firers->register( 'fire', 'WordPoints_Hook_Firer' ); |
|
282 | - $firers->register( 'reverse', 'WordPoints_Hook_Firer_Reverse' ); |
|
283 | - $firers->register( 'spam', 'WordPoints_Hook_Firer_Spam' ); |
|
281 | + $firers->register('fire', 'WordPoints_Hook_Firer'); |
|
282 | + $firers->register('reverse', 'WordPoints_Hook_Firer_Reverse'); |
|
283 | + $firers->register('spam', 'WordPoints_Hook_Firer_Spam'); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | * |
293 | 293 | * @param WordPoints_App_Registry $entities The entities app. |
294 | 294 | */ |
295 | -function wordpoints_entities_app_init( $entities ) { |
|
295 | +function wordpoints_entities_app_init($entities) { |
|
296 | 296 | |
297 | - $entities->sub_apps->register( 'children', 'WordPoints_Class_Registry_Children' ); |
|
297 | + $entities->sub_apps->register('children', 'WordPoints_Class_Registry_Children'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
@@ -306,18 +306,18 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @param WordPoints_App_Registry $entities The entities app. |
308 | 308 | */ |
309 | -function wordpoints_entities_init( $entities ) { |
|
309 | +function wordpoints_entities_init($entities) { |
|
310 | 310 | |
311 | 311 | // |
312 | 312 | // Entities. |
313 | 313 | // |
314 | 314 | |
315 | - $entities->register( 'post', 'WordPoints_Entity_Post' ); |
|
316 | - $entities->register( 'post_type', 'WordPoints_Entity_Post_Type' ); |
|
317 | - $entities->register( 'comment', 'WordPoints_Entity_Comment' ); |
|
318 | - $entities->register( 'user', 'WordPoints_Entity_User' ); |
|
319 | - $entities->register( 'user_role', 'WordPoints_Entity_User_Role' ); |
|
320 | - $entities->register( 'term', 'WordPoints_Entity_Term' ); |
|
315 | + $entities->register('post', 'WordPoints_Entity_Post'); |
|
316 | + $entities->register('post_type', 'WordPoints_Entity_Post_Type'); |
|
317 | + $entities->register('comment', 'WordPoints_Entity_Comment'); |
|
318 | + $entities->register('user', 'WordPoints_Entity_User'); |
|
319 | + $entities->register('user_role', 'WordPoints_Entity_User_Role'); |
|
320 | + $entities->register('term', 'WordPoints_Entity_Term'); |
|
321 | 321 | |
322 | 322 | // |
323 | 323 | // Attributes. |
@@ -325,10 +325,10 @@ discard block |
||
325 | 325 | |
326 | 326 | $atts = $entities->children; |
327 | 327 | |
328 | - $atts->register( 'post', 'content', 'WordPoints_Entity_Post_Content' ); |
|
329 | - $atts->register( 'post_type', 'name', 'WordPoints_Entity_Post_Type_Name' ); |
|
330 | - $atts->register( 'term', 'id', 'WordPoints_Entity_Term_Id' ); |
|
331 | - $atts->register( 'user_role', 'name', 'WordPoints_Entity_User_Role_Name' ); |
|
328 | + $atts->register('post', 'content', 'WordPoints_Entity_Post_Content'); |
|
329 | + $atts->register('post_type', 'name', 'WordPoints_Entity_Post_Type_Name'); |
|
330 | + $atts->register('term', 'id', 'WordPoints_Entity_Term_Id'); |
|
331 | + $atts->register('user_role', 'name', 'WordPoints_Entity_User_Role_Name'); |
|
332 | 332 | |
333 | 333 | // |
334 | 334 | // Relationships. |
@@ -336,15 +336,15 @@ discard block |
||
336 | 336 | |
337 | 337 | $children = $entities->children; |
338 | 338 | |
339 | - $children->register( 'post', 'author', 'WordPoints_Entity_Post_Author' ); |
|
340 | - $children->register( 'post', 'type', 'WordPoints_Entity_Post_Type_Relationship' ); |
|
341 | - $children->register( 'post', 'terms', 'WordPoints_Entity_Post_Terms' ); |
|
342 | - $children->register( 'user', 'roles', 'WordPoints_Entity_User_Roles' ); |
|
343 | - $children->register( 'comment', 'post', 'WordPoints_Entity_Comment_Post' ); |
|
344 | - $children->register( 'comment', 'author', 'WordPoints_Entity_Comment_Author' ); |
|
339 | + $children->register('post', 'author', 'WordPoints_Entity_Post_Author'); |
|
340 | + $children->register('post', 'type', 'WordPoints_Entity_Post_Type_Relationship'); |
|
341 | + $children->register('post', 'terms', 'WordPoints_Entity_Post_Terms'); |
|
342 | + $children->register('user', 'roles', 'WordPoints_Entity_User_Roles'); |
|
343 | + $children->register('comment', 'post', 'WordPoints_Entity_Comment_Post'); |
|
344 | + $children->register('comment', 'author', 'WordPoints_Entity_Comment_Author'); |
|
345 | 345 | |
346 | - foreach ( get_post_types( array( 'public' => true ), false ) as $slug => $post_type ) { |
|
347 | - unset( $post_type ); // TODO |
|
346 | + foreach (get_post_types(array('public' => true), false) as $slug => $post_type) { |
|
347 | + unset($post_type); // TODO |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | * |
358 | 358 | * @param WordPoints_Class_RegistryI $data_types The data types registry. |
359 | 359 | */ |
360 | -function wordpoints_data_types_init( $data_types ) { |
|
360 | +function wordpoints_data_types_init($data_types) { |
|
361 | 361 | |
362 | - $data_types->register( 'integer', 'WordPoints_Data_Type_Integer' ); |
|
363 | - $data_types->register( 'text', 'WordPoints_Data_Type_Text' ); |
|
362 | + $data_types->register('integer', 'WordPoints_Data_Type_Integer'); |
|
363 | + $data_types->register('text', 'WordPoints_Data_Type_Text'); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
@@ -375,9 +375,9 @@ discard block |
||
375 | 375 | * |
376 | 376 | * @return bool Whether the user can view the points log. |
377 | 377 | */ |
378 | -function wordpoints_hooks_user_can_view_points_log( $can_view, $log ) { |
|
378 | +function wordpoints_hooks_user_can_view_points_log($can_view, $log) { |
|
379 | 379 | |
380 | - if ( ! $can_view ) { |
|
380 | + if ( ! $can_view) { |
|
381 | 381 | return $can_view; |
382 | 382 | } |
383 | 383 | |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | $event_slug = $log->log_type; |
387 | 387 | |
388 | 388 | /** @var WordPoints_Hook_Arg $arg */ |
389 | - foreach ( wordpoints_hooks()->events->args->get_children( $event_slug ) as $slug => $arg ) { |
|
389 | + foreach (wordpoints_hooks()->events->args->get_children($event_slug) as $slug => $arg) { |
|
390 | 390 | |
391 | - $value = wordpoints_get_points_log_meta( $log->id, $slug, true ); |
|
391 | + $value = wordpoints_get_points_log_meta($log->id, $slug, true); |
|
392 | 392 | |
393 | - if ( ! $value ) { |
|
393 | + if ( ! $value) { |
|
394 | 394 | continue; |
395 | 395 | } |
396 | 396 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | , $value |
401 | 401 | ); |
402 | 402 | |
403 | - if ( ! $can_view ) { |
|
403 | + if ( ! $can_view) { |
|
404 | 404 | break; |
405 | 405 | } |
406 | 406 | } |
@@ -419,20 +419,20 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @return bool Whether the user can view this entity. |
421 | 421 | */ |
422 | -function wordpoints_entity_user_can_view( $user_id, $entity_slug, $entity_id ) { |
|
422 | +function wordpoints_entity_user_can_view($user_id, $entity_slug, $entity_id) { |
|
423 | 423 | |
424 | - $entity = wordpoints_entities()->get( $entity_slug ); |
|
424 | + $entity = wordpoints_entities()->get($entity_slug); |
|
425 | 425 | |
426 | 426 | // If this entity type is not found, we have no way of determining whether it is |
427 | 427 | // safe for the user to view it. |
428 | - if ( ! ( $entity instanceof WordPoints_Entity ) ) { |
|
428 | + if ( ! ($entity instanceof WordPoints_Entity)) { |
|
429 | 429 | return false; |
430 | 430 | } |
431 | 431 | |
432 | 432 | $can_view = true; |
433 | 433 | |
434 | - if ( $entity instanceof WordPoints_Entity_Restricted_VisibilityI ) { |
|
435 | - $can_view = $entity->user_can_view( $user_id, $entity_id ); |
|
434 | + if ($entity instanceof WordPoints_Entity_Restricted_VisibilityI) { |
|
435 | + $can_view = $entity->user_can_view($user_id, $entity_id); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | /** |
@@ -463,8 +463,8 @@ discard block |
||
463 | 463 | */ |
464 | 464 | function wordpoints_apps() { |
465 | 465 | |
466 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
467 | - WordPoints_App::$main = new WordPoints_App( 'apps' ); |
|
466 | + if ( ! isset(WordPoints_App::$main)) { |
|
467 | + WordPoints_App::$main = new WordPoints_App('apps'); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | return WordPoints_App::$main; |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | */ |
480 | 480 | function wordpoints_hooks() { |
481 | 481 | |
482 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
482 | + if ( ! isset(WordPoints_App::$main)) { |
|
483 | 483 | wordpoints_apps(); |
484 | 484 | } |
485 | 485 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | */ |
496 | 496 | function wordpoints_entities() { |
497 | 497 | |
498 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
498 | + if ( ! isset(WordPoints_App::$main)) { |
|
499 | 499 | wordpoints_apps(); |
500 | 500 | } |
501 | 501 | |
@@ -511,13 +511,13 @@ discard block |
||
511 | 511 | * |
512 | 512 | * @param WordPoints_App $app The main apps app. |
513 | 513 | */ |
514 | -function wordpoints_apps_init( $app ) { |
|
514 | +function wordpoints_apps_init($app) { |
|
515 | 515 | |
516 | 516 | $apps = $app->sub_apps; |
517 | 517 | |
518 | - $apps->register( 'hooks', 'WordPoints_Hooks' ); |
|
519 | - $apps->register( 'entities', 'WordPoints_App_Registry' ); |
|
520 | - $apps->register( 'data_types', 'WordPoints_Class_Registry' ); |
|
518 | + $apps->register('hooks', 'WordPoints_Hooks'); |
|
519 | + $apps->register('entities', 'WordPoints_App_Registry'); |
|
520 | + $apps->register('data_types', 'WordPoints_Class_Registry'); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | /** |
@@ -530,19 +530,19 @@ discard block |
||
530 | 530 | * |
531 | 531 | * @return object|false The constructed object, or false if to many args were passed. |
532 | 532 | */ |
533 | -function wordpoints_construct_class_with_args( $class_name, array $args ) { |
|
533 | +function wordpoints_construct_class_with_args($class_name, array $args) { |
|
534 | 534 | |
535 | - switch ( count( $args ) ) { |
|
535 | + switch (count($args)) { |
|
536 | 536 | case 0: |
537 | 537 | return new $class_name(); |
538 | 538 | case 1: |
539 | - return new $class_name( $args[0] ); |
|
539 | + return new $class_name($args[0]); |
|
540 | 540 | case 2: |
541 | - return new $class_name( $args[0], $args[1] ); |
|
541 | + return new $class_name($args[0], $args[1]); |
|
542 | 542 | case 3: |
543 | - return new $class_name( $args[0], $args[1], $args[2] ); |
|
543 | + return new $class_name($args[0], $args[1], $args[2]); |
|
544 | 544 | case 4: |
545 | - return new $class_name( $args[0], $args[1], $args[2], $args[3] ); |
|
545 | + return new $class_name($args[0], $args[1], $args[2], $args[3]); |
|
546 | 546 | default: |
547 | 547 | return false; |
548 | 548 | } |