@@ -7,23 +7,23 @@ |
||
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-firers', 'wordpoints_hook_firers_init' ); |
|
19 | -add_action( 'wordpoints_init_app_registry-hooks-events', 'wordpoints_hook_events_init' ); |
|
20 | -add_action( 'wordpoints_init_app_registry-hooks-actions', 'wordpoints_hook_actions_init' ); |
|
21 | -add_action( 'wordpoints_init_app_registry-hooks-reactors', 'wordpoints_hook_reactors_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-firers', 'wordpoints_hook_firers_init'); |
|
19 | +add_action('wordpoints_init_app_registry-hooks-events', 'wordpoints_hook_events_init'); |
|
20 | +add_action('wordpoints_init_app_registry-hooks-actions', 'wordpoints_hook_actions_init'); |
|
21 | +add_action('wordpoints_init_app_registry-hooks-reactors', 'wordpoints_hook_reactors_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_filter( 'wordpoints_user_can_view_points_log', 'wordpoints_hooks_user_can_view_points_log' ); |
|
27 | +add_filter('wordpoints_user_can_view_points_log', 'wordpoints_hooks_user_can_view_points_log'); |
|
28 | 28 | |
29 | 29 | // EOF |
@@ -10,111 +10,111 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // auto-generated { |
13 | -require_once( dirname( __FILE__ ) . 'app.php' ); |
|
14 | -require_once( dirname( __FILE__ ) . 'app/registry.php' ); |
|
15 | -require_once( dirname( __FILE__ ) . 'class/autoloader.php' ); |
|
16 | -require_once( dirname( __FILE__ ) . 'class/registry.php' ); |
|
17 | -require_once( dirname( __FILE__ ) . 'class/registry/children.php' ); |
|
18 | -require_once( dirname( __FILE__ ) . 'class/registry/childreni.php' ); |
|
19 | -require_once( dirname( __FILE__ ) . 'class/registry/persistent.php' ); |
|
20 | -require_once( dirname( __FILE__ ) . 'class/registryi.php' ); |
|
21 | -require_once( dirname( __FILE__ ) . 'data/type.php' ); |
|
22 | -require_once( dirname( __FILE__ ) . 'data/type/integer.php' ); |
|
23 | -require_once( dirname( __FILE__ ) . 'data/type/text.php' ); |
|
24 | -require_once( dirname( __FILE__ ) . 'data/typei.php' ); |
|
25 | -require_once( dirname( __FILE__ ) . 'entity.php' ); |
|
26 | -require_once( dirname( __FILE__ ) . 'entity/array.php' ); |
|
27 | -require_once( dirname( __FILE__ ) . 'entity/attr.php' ); |
|
28 | -require_once( dirname( __FILE__ ) . 'entity/childi.php' ); |
|
29 | -require_once( dirname( __FILE__ ) . 'entity/comment.php' ); |
|
30 | -require_once( dirname( __FILE__ ) . 'entity/comment/author.php' ); |
|
31 | -require_once( dirname( __FILE__ ) . 'entity/comment/post.php' ); |
|
32 | -require_once( dirname( __FILE__ ) . 'entity/context.php' ); |
|
33 | -require_once( dirname( __FILE__ ) . 'entity/context/network.php' ); |
|
34 | -require_once( dirname( __FILE__ ) . 'entity/context/site.php' ); |
|
35 | -require_once( dirname( __FILE__ ) . 'entity/enumerablei.php' ); |
|
36 | -require_once( dirname( __FILE__ ) . 'entity/hierarchy.php' ); |
|
37 | -require_once( dirname( __FILE__ ) . 'entity/hierarchyi.php' ); |
|
38 | -require_once( dirname( __FILE__ ) . 'entity/parenti.php' ); |
|
39 | -require_once( dirname( __FILE__ ) . 'entity/post.php' ); |
|
40 | -require_once( dirname( __FILE__ ) . 'entity/post/author.php' ); |
|
41 | -require_once( dirname( __FILE__ ) . 'entity/post/content.php' ); |
|
42 | -require_once( dirname( __FILE__ ) . 'entity/post/terms.php' ); |
|
43 | -require_once( dirname( __FILE__ ) . 'entity/post/type.php' ); |
|
44 | -require_once( dirname( __FILE__ ) . 'entity/post/type/name.php' ); |
|
45 | -require_once( dirname( __FILE__ ) . 'entity/post/type/relationship.php' ); |
|
46 | -require_once( dirname( __FILE__ ) . 'entity/relationship.php' ); |
|
47 | -require_once( dirname( __FILE__ ) . 'entity/relationship/dynamic.php' ); |
|
48 | -require_once( dirname( __FILE__ ) . 'entity/restricted/visibilityi.php' ); |
|
49 | -require_once( dirname( __FILE__ ) . 'entity/site.php' ); |
|
50 | -require_once( dirname( __FILE__ ) . 'entity/term.php' ); |
|
51 | -require_once( dirname( __FILE__ ) . 'entity/term/id.php' ); |
|
52 | -require_once( dirname( __FILE__ ) . 'entity/user.php' ); |
|
53 | -require_once( dirname( __FILE__ ) . 'entity/user/role.php' ); |
|
54 | -require_once( dirname( __FILE__ ) . 'entity/user/role/name.php' ); |
|
55 | -require_once( dirname( __FILE__ ) . 'entity/user/roles.php' ); |
|
56 | -require_once( dirname( __FILE__ ) . 'entityish.php' ); |
|
57 | -require_once( dirname( __FILE__ ) . 'entityishi.php' ); |
|
58 | -require_once( dirname( __FILE__ ) . 'hierarchy.php' ); |
|
59 | -require_once( dirname( __FILE__ ) . 'hook/action.php' ); |
|
60 | -require_once( dirname( __FILE__ ) . 'hook/action/comment/new.php' ); |
|
61 | -require_once( dirname( __FILE__ ) . 'hook/action/post/publish.php' ); |
|
62 | -require_once( dirname( __FILE__ ) . 'hook/actioni.php' ); |
|
63 | -require_once( dirname( __FILE__ ) . 'hook/actions.php' ); |
|
64 | -require_once( dirname( __FILE__ ) . 'hook/arg.php' ); |
|
65 | -require_once( dirname( __FILE__ ) . 'hook/arg/current/post.php' ); |
|
66 | -require_once( dirname( __FILE__ ) . 'hook/arg/current/site.php' ); |
|
67 | -require_once( dirname( __FILE__ ) . 'hook/arg/current/user.php' ); |
|
68 | -require_once( dirname( __FILE__ ) . 'hook/arg/dynamic.php' ); |
|
69 | -require_once( dirname( __FILE__ ) . 'hook/condition.php' ); |
|
70 | -require_once( dirname( __FILE__ ) . 'hook/condition/entity/array/contains.php' ); |
|
71 | -require_once( dirname( __FILE__ ) . 'hook/condition/equals.php' ); |
|
72 | -require_once( dirname( __FILE__ ) . 'hook/condition/string/contains.php' ); |
|
73 | -require_once( dirname( __FILE__ ) . 'hook/conditioni.php' ); |
|
74 | -require_once( dirname( __FILE__ ) . 'hook/event.php' ); |
|
75 | -require_once( dirname( __FILE__ ) . 'hook/event/args.php' ); |
|
76 | -require_once( dirname( __FILE__ ) . 'hook/event/comment/leave.php' ); |
|
77 | -require_once( dirname( __FILE__ ) . 'hook/event/dynamic.php' ); |
|
78 | -require_once( dirname( __FILE__ ) . 'hook/event/media/upload.php' ); |
|
79 | -require_once( dirname( __FILE__ ) . 'hook/event/post/publish.php' ); |
|
80 | -require_once( dirname( __FILE__ ) . 'hook/event/user/register.php' ); |
|
81 | -require_once( dirname( __FILE__ ) . 'hook/event/user/visit.php' ); |
|
82 | -require_once( dirname( __FILE__ ) . 'hook/eventi.php' ); |
|
83 | -require_once( dirname( __FILE__ ) . 'hook/events.php' ); |
|
84 | -require_once( dirname( __FILE__ ) . 'hook/extension.php' ); |
|
85 | -require_once( dirname( __FILE__ ) . 'hook/extension/conditions.php' ); |
|
86 | -require_once( dirname( __FILE__ ) . 'hook/extension/periods.php' ); |
|
87 | -require_once( dirname( __FILE__ ) . 'hook/extension/reversei.php' ); |
|
88 | -require_once( dirname( __FILE__ ) . 'hook/extension/spami.php' ); |
|
89 | -require_once( dirname( __FILE__ ) . 'hook/firer.php' ); |
|
90 | -require_once( dirname( __FILE__ ) . 'hook/firer/reverse.php' ); |
|
91 | -require_once( dirname( __FILE__ ) . 'hook/firer/spam.php' ); |
|
92 | -require_once( dirname( __FILE__ ) . 'hook/fireri.php' ); |
|
93 | -require_once( dirname( __FILE__ ) . 'hook/reaction.php' ); |
|
94 | -require_once( dirname( __FILE__ ) . 'hook/reaction/options.php' ); |
|
95 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storage.php' ); |
|
96 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storage/options.php' ); |
|
97 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storage/options/network.php' ); |
|
98 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storagei.php' ); |
|
99 | -require_once( dirname( __FILE__ ) . 'hook/reaction/validator.php' ); |
|
100 | -require_once( dirname( __FILE__ ) . 'hook/reactioni.php' ); |
|
101 | -require_once( dirname( __FILE__ ) . 'hook/reactor.php' ); |
|
102 | -require_once( dirname( __FILE__ ) . 'hook/reactor/points.php' ); |
|
103 | -require_once( dirname( __FILE__ ) . 'hook/reactor/reversei.php' ); |
|
104 | -require_once( dirname( __FILE__ ) . 'hook/reactor/spami.php' ); |
|
105 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/conditions.php' ); |
|
106 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/query.php' ); |
|
107 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/query/modifieri.php' ); |
|
108 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/queryable.php' ); |
|
109 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/queryi.php' ); |
|
110 | -require_once( dirname( __FILE__ ) . 'hook/router.php' ); |
|
111 | -require_once( dirname( __FILE__ ) . 'hook/settings.php' ); |
|
112 | -require_once( dirname( __FILE__ ) . 'hook/settingsi.php' ); |
|
113 | -require_once( dirname( __FILE__ ) . 'hook/validator/exception.php' ); |
|
114 | -require_once( dirname( __FILE__ ) . 'hooks.php' ); |
|
115 | -require_once( dirname( __FILE__ ) . 'query/builder/db/mysql.php' ); |
|
116 | -require_once( dirname( __FILE__ ) . 'spec.php' ); |
|
117 | -require_once( dirname( __FILE__ ) . 'specedi.php' ); |
|
13 | +require_once(dirname(__FILE__).'app.php'); |
|
14 | +require_once(dirname(__FILE__).'app/registry.php'); |
|
15 | +require_once(dirname(__FILE__).'class/autoloader.php'); |
|
16 | +require_once(dirname(__FILE__).'class/registry.php'); |
|
17 | +require_once(dirname(__FILE__).'class/registry/children.php'); |
|
18 | +require_once(dirname(__FILE__).'class/registry/childreni.php'); |
|
19 | +require_once(dirname(__FILE__).'class/registry/persistent.php'); |
|
20 | +require_once(dirname(__FILE__).'class/registryi.php'); |
|
21 | +require_once(dirname(__FILE__).'data/type.php'); |
|
22 | +require_once(dirname(__FILE__).'data/type/integer.php'); |
|
23 | +require_once(dirname(__FILE__).'data/type/text.php'); |
|
24 | +require_once(dirname(__FILE__).'data/typei.php'); |
|
25 | +require_once(dirname(__FILE__).'entity.php'); |
|
26 | +require_once(dirname(__FILE__).'entity/array.php'); |
|
27 | +require_once(dirname(__FILE__).'entity/attr.php'); |
|
28 | +require_once(dirname(__FILE__).'entity/childi.php'); |
|
29 | +require_once(dirname(__FILE__).'entity/comment.php'); |
|
30 | +require_once(dirname(__FILE__).'entity/comment/author.php'); |
|
31 | +require_once(dirname(__FILE__).'entity/comment/post.php'); |
|
32 | +require_once(dirname(__FILE__).'entity/context.php'); |
|
33 | +require_once(dirname(__FILE__).'entity/context/network.php'); |
|
34 | +require_once(dirname(__FILE__).'entity/context/site.php'); |
|
35 | +require_once(dirname(__FILE__).'entity/enumerablei.php'); |
|
36 | +require_once(dirname(__FILE__).'entity/hierarchy.php'); |
|
37 | +require_once(dirname(__FILE__).'entity/hierarchyi.php'); |
|
38 | +require_once(dirname(__FILE__).'entity/parenti.php'); |
|
39 | +require_once(dirname(__FILE__).'entity/post.php'); |
|
40 | +require_once(dirname(__FILE__).'entity/post/author.php'); |
|
41 | +require_once(dirname(__FILE__).'entity/post/content.php'); |
|
42 | +require_once(dirname(__FILE__).'entity/post/terms.php'); |
|
43 | +require_once(dirname(__FILE__).'entity/post/type.php'); |
|
44 | +require_once(dirname(__FILE__).'entity/post/type/name.php'); |
|
45 | +require_once(dirname(__FILE__).'entity/post/type/relationship.php'); |
|
46 | +require_once(dirname(__FILE__).'entity/relationship.php'); |
|
47 | +require_once(dirname(__FILE__).'entity/relationship/dynamic.php'); |
|
48 | +require_once(dirname(__FILE__).'entity/restricted/visibilityi.php'); |
|
49 | +require_once(dirname(__FILE__).'entity/site.php'); |
|
50 | +require_once(dirname(__FILE__).'entity/term.php'); |
|
51 | +require_once(dirname(__FILE__).'entity/term/id.php'); |
|
52 | +require_once(dirname(__FILE__).'entity/user.php'); |
|
53 | +require_once(dirname(__FILE__).'entity/user/role.php'); |
|
54 | +require_once(dirname(__FILE__).'entity/user/role/name.php'); |
|
55 | +require_once(dirname(__FILE__).'entity/user/roles.php'); |
|
56 | +require_once(dirname(__FILE__).'entityish.php'); |
|
57 | +require_once(dirname(__FILE__).'entityishi.php'); |
|
58 | +require_once(dirname(__FILE__).'hierarchy.php'); |
|
59 | +require_once(dirname(__FILE__).'hook/action.php'); |
|
60 | +require_once(dirname(__FILE__).'hook/action/comment/new.php'); |
|
61 | +require_once(dirname(__FILE__).'hook/action/post/publish.php'); |
|
62 | +require_once(dirname(__FILE__).'hook/actioni.php'); |
|
63 | +require_once(dirname(__FILE__).'hook/actions.php'); |
|
64 | +require_once(dirname(__FILE__).'hook/arg.php'); |
|
65 | +require_once(dirname(__FILE__).'hook/arg/current/post.php'); |
|
66 | +require_once(dirname(__FILE__).'hook/arg/current/site.php'); |
|
67 | +require_once(dirname(__FILE__).'hook/arg/current/user.php'); |
|
68 | +require_once(dirname(__FILE__).'hook/arg/dynamic.php'); |
|
69 | +require_once(dirname(__FILE__).'hook/condition.php'); |
|
70 | +require_once(dirname(__FILE__).'hook/condition/entity/array/contains.php'); |
|
71 | +require_once(dirname(__FILE__).'hook/condition/equals.php'); |
|
72 | +require_once(dirname(__FILE__).'hook/condition/string/contains.php'); |
|
73 | +require_once(dirname(__FILE__).'hook/conditioni.php'); |
|
74 | +require_once(dirname(__FILE__).'hook/event.php'); |
|
75 | +require_once(dirname(__FILE__).'hook/event/args.php'); |
|
76 | +require_once(dirname(__FILE__).'hook/event/comment/leave.php'); |
|
77 | +require_once(dirname(__FILE__).'hook/event/dynamic.php'); |
|
78 | +require_once(dirname(__FILE__).'hook/event/media/upload.php'); |
|
79 | +require_once(dirname(__FILE__).'hook/event/post/publish.php'); |
|
80 | +require_once(dirname(__FILE__).'hook/event/user/register.php'); |
|
81 | +require_once(dirname(__FILE__).'hook/event/user/visit.php'); |
|
82 | +require_once(dirname(__FILE__).'hook/eventi.php'); |
|
83 | +require_once(dirname(__FILE__).'hook/events.php'); |
|
84 | +require_once(dirname(__FILE__).'hook/extension.php'); |
|
85 | +require_once(dirname(__FILE__).'hook/extension/conditions.php'); |
|
86 | +require_once(dirname(__FILE__).'hook/extension/periods.php'); |
|
87 | +require_once(dirname(__FILE__).'hook/extension/reversei.php'); |
|
88 | +require_once(dirname(__FILE__).'hook/extension/spami.php'); |
|
89 | +require_once(dirname(__FILE__).'hook/firer.php'); |
|
90 | +require_once(dirname(__FILE__).'hook/firer/reverse.php'); |
|
91 | +require_once(dirname(__FILE__).'hook/firer/spam.php'); |
|
92 | +require_once(dirname(__FILE__).'hook/fireri.php'); |
|
93 | +require_once(dirname(__FILE__).'hook/reaction.php'); |
|
94 | +require_once(dirname(__FILE__).'hook/reaction/options.php'); |
|
95 | +require_once(dirname(__FILE__).'hook/reaction/storage.php'); |
|
96 | +require_once(dirname(__FILE__).'hook/reaction/storage/options.php'); |
|
97 | +require_once(dirname(__FILE__).'hook/reaction/storage/options/network.php'); |
|
98 | +require_once(dirname(__FILE__).'hook/reaction/storagei.php'); |
|
99 | +require_once(dirname(__FILE__).'hook/reaction/validator.php'); |
|
100 | +require_once(dirname(__FILE__).'hook/reactioni.php'); |
|
101 | +require_once(dirname(__FILE__).'hook/reactor.php'); |
|
102 | +require_once(dirname(__FILE__).'hook/reactor/points.php'); |
|
103 | +require_once(dirname(__FILE__).'hook/reactor/reversei.php'); |
|
104 | +require_once(dirname(__FILE__).'hook/reactor/spami.php'); |
|
105 | +require_once(dirname(__FILE__).'hook/retroactive/conditions.php'); |
|
106 | +require_once(dirname(__FILE__).'hook/retroactive/query.php'); |
|
107 | +require_once(dirname(__FILE__).'hook/retroactive/query/modifieri.php'); |
|
108 | +require_once(dirname(__FILE__).'hook/retroactive/queryable.php'); |
|
109 | +require_once(dirname(__FILE__).'hook/retroactive/queryi.php'); |
|
110 | +require_once(dirname(__FILE__).'hook/router.php'); |
|
111 | +require_once(dirname(__FILE__).'hook/settings.php'); |
|
112 | +require_once(dirname(__FILE__).'hook/settingsi.php'); |
|
113 | +require_once(dirname(__FILE__).'hook/validator/exception.php'); |
|
114 | +require_once(dirname(__FILE__).'hooks.php'); |
|
115 | +require_once(dirname(__FILE__).'query/builder/db/mysql.php'); |
|
116 | +require_once(dirname(__FILE__).'spec.php'); |
|
117 | +require_once(dirname(__FILE__).'specedi.php'); |
|
118 | 118 | // } |
119 | 119 | |
120 | 120 | // EOF |
@@ -65,21 +65,21 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @param WordPoints_Hook_Arg[] $args The hook args. |
67 | 67 | */ |
68 | - public function __construct( array $args ) { |
|
68 | + public function __construct(array $args) { |
|
69 | 69 | |
70 | 70 | parent::__construct(); |
71 | 71 | |
72 | - foreach ( $args as $arg ) { |
|
72 | + foreach ($args as $arg) { |
|
73 | 73 | |
74 | 74 | $entity = $arg->get_entity(); |
75 | 75 | $slug = $arg->get_slug(); |
76 | 76 | |
77 | - if ( $entity instanceof WordPoints_Entity ) { |
|
78 | - $this->entities[ $slug ] = $entity; |
|
77 | + if ($entity instanceof WordPoints_Entity) { |
|
78 | + $this->entities[$slug] = $entity; |
|
79 | 79 | } |
80 | 80 | |
81 | - if ( $arg->is_stateful() ) { |
|
82 | - $this->stateful_args[ $slug ] = $slug; |
|
81 | + if ($arg->is_stateful()) { |
|
82 | + $this->stateful_args[$slug] = $slug; |
|
83 | 83 | } else { |
84 | 84 | // If any of the args aren't stateful the event isn't repeatable. |
85 | 85 | $this->is_repeatable = false; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @return WordPoints_Entity[] The entity objects for the stateful args. |
115 | 115 | */ |
116 | 116 | public function get_stateful_args() { |
117 | - return array_intersect_key( $this->entities, $this->stateful_args ); |
|
117 | + return array_intersect_key($this->entities, $this->stateful_args); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @return WordPoints_Entity[] The entity objects for the non-stateful args. |
126 | 126 | */ |
127 | 127 | public function get_non_stateful_args() { |
128 | - return array_diff_key( $this->entities, $this->stateful_args ); |
|
128 | + return array_diff_key($this->entities, $this->stateful_args); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -135,54 +135,54 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @param WordPoints_Hook_Reaction_Validator $validator The validator. |
137 | 137 | */ |
138 | - public function set_validator( WordPoints_Hook_Reaction_Validator $validator ) { |
|
138 | + public function set_validator(WordPoints_Hook_Reaction_Validator $validator) { |
|
139 | 139 | $this->validator = $validator; |
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | 143 | * @since 1.0.0 |
144 | 144 | */ |
145 | - public function descend( $child_slug ) { |
|
145 | + public function descend($child_slug) { |
|
146 | 146 | |
147 | - $result = parent::descend( $child_slug ); |
|
147 | + $result = parent::descend($child_slug); |
|
148 | 148 | |
149 | 149 | // Just in case no validator has been set. |
150 | - if ( ! $this->validator ) { |
|
150 | + if ( ! $this->validator) { |
|
151 | 151 | return $result; |
152 | 152 | } |
153 | 153 | |
154 | - if ( ! $result ) { |
|
154 | + if ( ! $result) { |
|
155 | 155 | |
156 | - if ( ! isset( $this->current ) ) { |
|
156 | + if ( ! isset($this->current)) { |
|
157 | 157 | |
158 | 158 | $this->validator->add_error( |
159 | 159 | sprintf( |
160 | - __( 'The %s arg is not registered for this event.', 'wordpoints' ) // TODO message |
|
160 | + __('The %s arg is not registered for this event.', 'wordpoints') // TODO message |
|
161 | 161 | , $child_slug |
162 | 162 | ) |
163 | 163 | ); |
164 | 164 | |
165 | - } elseif ( ! ( $this->current instanceof WordPoints_Entity_ParentI ) ) { |
|
165 | + } elseif ( ! ($this->current instanceof WordPoints_Entity_ParentI)) { |
|
166 | 166 | |
167 | 167 | $this->validator->add_error( |
168 | - __( 'Cannot get descendant of %s: not a parent.', 'wordpoints' ) // TODO message |
|
168 | + __('Cannot get descendant of %s: not a parent.', 'wordpoints') // TODO message |
|
169 | 169 | ); |
170 | 170 | |
171 | 171 | } else { |
172 | 172 | |
173 | - $child_arg = $this->current->get_child( $child_slug ); |
|
173 | + $child_arg = $this->current->get_child($child_slug); |
|
174 | 174 | |
175 | - if ( ! $child_arg ) { |
|
175 | + if ( ! $child_arg) { |
|
176 | 176 | $this->validator->add_error( |
177 | - __( '%s does not have a child "%s".', 'wordpoints' ) // TODO message |
|
177 | + __('%s does not have a child "%s".', 'wordpoints') // TODO message |
|
178 | 178 | , $this->push_on_descend ? $child_slug : null |
179 | 179 | ); |
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
183 | - } elseif ( $this->push_on_descend ) { |
|
183 | + } elseif ($this->push_on_descend) { |
|
184 | 184 | |
185 | - $this->validator->push_field( $child_slug ); |
|
185 | + $this->validator->push_field($child_slug); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | return $result; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | $ascended = parent::ascend(); |
197 | 197 | |
198 | - if ( $ascended && $this->validator ) { |
|
198 | + if ($ascended && $this->validator) { |
|
199 | 199 | $this->validator->pop_field(); |
200 | 200 | } |
201 | 201 | |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | /** |
206 | 206 | * @since 1.0.0 |
207 | 207 | */ |
208 | - public function get_from_hierarchy( array $hierarchy ) { |
|
208 | + public function get_from_hierarchy(array $hierarchy) { |
|
209 | 209 | |
210 | 210 | $this->push_on_descend = false; |
211 | - $entityish = parent::get_from_hierarchy( $hierarchy ); |
|
211 | + $entityish = parent::get_from_hierarchy($hierarchy); |
|
212 | 212 | $this->push_on_descend = true; |
213 | 213 | |
214 | 214 | return $entityish; |
@@ -21,12 +21,12 @@ |
||
21 | 21 | */ |
22 | 22 | public function get_current_id() { |
23 | 23 | |
24 | - if ( ! is_multisite() ) { |
|
24 | + if ( ! is_multisite()) { |
|
25 | 25 | return 1; |
26 | 26 | } |
27 | 27 | |
28 | 28 | // Todo special handling for Ajax, ect. |
29 | - if ( is_network_admin() ) { |
|
29 | + if (is_network_admin()) { |
|
30 | 30 | return false; |
31 | 31 | } |
32 | 32 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | public function get_current_id() { |
23 | 23 | |
24 | - if ( ! is_multisite() ) { |
|
24 | + if ( ! is_multisite()) { |
|
25 | 25 | return 1; |
26 | 26 | } |
27 | 27 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @since 1.0.0 |
21 | 21 | */ |
22 | - protected $context = array( 'network' ); |
|
22 | + protected $context = array('network'); |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * @since 1.0.0 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @since 1.0.0 |
41 | 41 | */ |
42 | 42 | public function get_title() { |
43 | - return __( 'Site', 'wordpoints' ); |
|
43 | + return __('Site', 'wordpoints'); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | /** |
27 | 27 | * @since 1.0.0 |
28 | 28 | */ |
29 | - public function __construct( $slug ) { |
|
29 | + public function __construct($slug) { |
|
30 | 30 | |
31 | 31 | $this->slug = $slug; |
32 | 32 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @var string[] |
42 | 42 | */ |
43 | - protected $context = array( 'network', 'site' ); |
|
43 | + protected $context = array('network', 'site'); |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * The field the entity is identified by. |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return mixed The entity, or false if not found. |
108 | 108 | */ |
109 | - protected function get_entity( $id ) { |
|
109 | + protected function get_entity($id) { |
|
110 | 110 | |
111 | - $entity = call_user_func( $this->getter, $id ); |
|
111 | + $entity = call_user_func($this->getter, $id); |
|
112 | 112 | |
113 | - if ( ! $this->is_entity( $entity ) ) { |
|
113 | + if ( ! $this->is_entity($entity)) { |
|
114 | 114 | return false; |
115 | 115 | } |
116 | 116 | |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return bool Whether the passed value is an entity. |
128 | 128 | */ |
129 | - protected function is_entity( $entity ) { |
|
129 | + protected function is_entity($entity) { |
|
130 | 130 | |
131 | - if ( ! is_object( $entity ) && ! is_array( $entity ) ) { |
|
131 | + if ( ! is_object($entity) && ! is_array($entity)) { |
|
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | |
135 | - return (bool) $this->get_entity_id( $entity ); |
|
135 | + return (bool) $this->get_entity_id($entity); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @return mixed The value of the attribute of the entity. |
147 | 147 | */ |
148 | - protected function get_attr_value( $entity, $attr ) { |
|
148 | + protected function get_attr_value($entity, $attr) { |
|
149 | 149 | |
150 | - if ( is_array( $entity ) ) { |
|
151 | - if ( isset( $entity[ $attr ] ) ) { |
|
152 | - return $entity[ $attr ]; |
|
150 | + if (is_array($entity)) { |
|
151 | + if (isset($entity[$attr])) { |
|
152 | + return $entity[$attr]; |
|
153 | 153 | } |
154 | 154 | } else { |
155 | - if ( isset( $entity->{$attr} ) ) { |
|
155 | + if (isset($entity->{$attr} )) { |
|
156 | 156 | return $entity->{$attr}; |
157 | 157 | } |
158 | 158 | } |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @return mixed The ID of the entity. |
171 | 171 | */ |
172 | - protected function get_entity_id( $entity ) { |
|
173 | - return $this->get_attr_value( $entity, $this->get_id_field() ); |
|
172 | + protected function get_entity_id($entity) { |
|
173 | + return $this->get_attr_value($entity, $this->get_id_field()); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * |
187 | 187 | * @return mixed The human ID of the entity. |
188 | 188 | */ |
189 | - protected function get_entity_human_id( $entity ) { |
|
190 | - return $this->get_attr_value( $entity, $this->human_id_field ); |
|
189 | + protected function get_entity_human_id($entity) { |
|
190 | + return $this->get_attr_value($entity, $this->human_id_field); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | // |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @return string|int|float|false The human identifier for the entity, or false. |
234 | 234 | */ |
235 | - public function get_human_id( $id ) { |
|
235 | + public function get_human_id($id) { |
|
236 | 236 | |
237 | - $entity = $this->get_entity( $id ); |
|
237 | + $entity = $this->get_entity($id); |
|
238 | 238 | |
239 | - if ( ! $entity ) { |
|
239 | + if ( ! $entity) { |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | |
243 | - return $this->get_entity_human_id( $entity ); |
|
243 | + return $this->get_entity_human_id($entity); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return bool Whether or not an entity with that ID exists. |
254 | 254 | */ |
255 | - public function exists( $id ) { |
|
256 | - return (bool) $this->get_entity( $id ); |
|
255 | + public function exists($id) { |
|
256 | + return (bool) $this->get_entity($id); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -268,17 +268,17 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return WordPoints_Entityish|false The child's object, or false if not found. |
270 | 270 | */ |
271 | - public function get_child( $child_slug ) { |
|
271 | + public function get_child($child_slug) { |
|
272 | 272 | |
273 | 273 | $children = wordpoints_entities()->children; |
274 | 274 | |
275 | - $child = $children->get( $this->slug, $child_slug ); |
|
275 | + $child = $children->get($this->slug, $child_slug); |
|
276 | 276 | |
277 | 277 | if ( |
278 | - isset( $this->the_value ) |
|
278 | + isset($this->the_value) |
|
279 | 279 | && $child instanceof WordPoints_Entity_ChildI |
280 | 280 | ) { |
281 | - $child->set_the_value_from_entity( $this ); |
|
281 | + $child->set_the_value_from_entity($this); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | return $child; |
@@ -300,20 +300,20 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @return bool Whether the value was set. |
302 | 302 | */ |
303 | - public function set_the_value( $value ) { |
|
303 | + public function set_the_value($value) { |
|
304 | 304 | |
305 | 305 | $this->the_value = $this->the_entity = $this->the_context = null; |
306 | 306 | |
307 | - if ( $this->is_entity( $value ) ) { |
|
307 | + if ($this->is_entity($value)) { |
|
308 | 308 | |
309 | 309 | $entity = $value; |
310 | - $value = $this->get_entity_id( $value ); |
|
310 | + $value = $this->get_entity_id($value); |
|
311 | 311 | |
312 | 312 | } else { |
313 | 313 | |
314 | - $entity = $this->get_entity( $value ); |
|
314 | + $entity = $this->get_entity($value); |
|
315 | 315 | |
316 | - if ( ! $entity ) { |
|
316 | + if ( ! $entity) { |
|
317 | 317 | return false; |
318 | 318 | } |
319 | 319 | } |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @return mixed The value of the attribute. |
338 | 338 | */ |
339 | - public function get_the_attr_value( $attr ) { |
|
340 | - return $this->get_attr_value( $this->the_entity, $attr ); |
|
339 | + public function get_the_attr_value($attr) { |
|
340 | + return $this->get_attr_value($this->the_entity, $attr); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @return string|int|float|null The human identifier for the entity, or null. |
362 | 362 | */ |
363 | 363 | public function get_the_human_id() { |
364 | - return $this->get_entity_human_id( $this->the_entity ); |
|
364 | + return $this->get_entity_human_id($this->the_entity); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | /** |
@@ -392,11 +392,11 @@ discard block |
||
392 | 392 | |
393 | 393 | $guid = $this->get_the_context(); |
394 | 394 | |
395 | - if ( ! is_array( $guid ) ) { |
|
395 | + if ( ! is_array($guid)) { |
|
396 | 396 | return $guid; |
397 | 397 | } |
398 | 398 | |
399 | - $guid[ $this->slug ] = $this->get_the_id(); |
|
399 | + $guid[$this->slug] = $this->get_the_id(); |
|
400 | 400 | |
401 | 401 | return $guid; |
402 | 402 | } |
@@ -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,10 +298,10 @@ 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' ); |
|
304 | - $entities->sub_apps->register( 'contexts', 'WordPoints_Class_Registry' ); |
|
303 | + $entities->sub_apps->register('children', 'WordPoints_Class_Registry_Children'); |
|
304 | + $entities->sub_apps->register('contexts', 'WordPoints_Class_Registry'); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -313,10 +313,10 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @param WordPoints_Class_Registry $contexts The entity context registry. |
315 | 315 | */ |
316 | -function wordpoints_entity_contexts_init( $contexts ) { |
|
316 | +function wordpoints_entity_contexts_init($contexts) { |
|
317 | 317 | |
318 | - $contexts->register( 'network', 'WordPoints_Entity_Context_Network' ); |
|
319 | - $contexts->register( 'site', 'WordPoints_Entity_Context_Site' ); |
|
318 | + $contexts->register('network', 'WordPoints_Entity_Context_Network'); |
|
319 | + $contexts->register('site', 'WordPoints_Entity_Context_Site'); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -328,18 +328,18 @@ discard block |
||
328 | 328 | * |
329 | 329 | * @param WordPoints_App_Registry $entities The entities app. |
330 | 330 | */ |
331 | -function wordpoints_entities_init( $entities ) { |
|
331 | +function wordpoints_entities_init($entities) { |
|
332 | 332 | |
333 | 333 | $children = $entities->children; |
334 | 334 | |
335 | - $entities->register( 'user', 'WordPoints_Entity_User' ); |
|
336 | - $children->register( 'user', 'roles', 'WordPoints_Entity_User_Roles' ); |
|
335 | + $entities->register('user', 'WordPoints_Entity_User'); |
|
336 | + $children->register('user', 'roles', 'WordPoints_Entity_User_Roles'); |
|
337 | 337 | |
338 | - $entities->register( 'user_role', 'WordPoints_Entity_User_Role' ); |
|
339 | - $children->register( 'user_role', 'name', 'WordPoints_Entity_User_Role_Name' ); |
|
338 | + $entities->register('user_role', 'WordPoints_Entity_User_Role'); |
|
339 | + $children->register('user_role', 'name', 'WordPoints_Entity_User_Role_Name'); |
|
340 | 340 | |
341 | 341 | // Register entities for all of the public post types. |
342 | - $post_types = get_post_types( array( 'public' => true ) ); |
|
342 | + $post_types = get_post_types(array('public' => true)); |
|
343 | 343 | |
344 | 344 | /** |
345 | 345 | * Filter which post types to register entities for. |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @param string[] The post type slugs ("names"). |
350 | 350 | */ |
351 | - $post_types = apply_filters( 'wordpoints_register_entities_for_post_types', $post_types ); |
|
351 | + $post_types = apply_filters('wordpoints_register_entities_for_post_types', $post_types); |
|
352 | 352 | |
353 | - foreach ( $post_types as $slug ) { |
|
354 | - wordpoints_register_post_type_entities( $slug ); |
|
353 | + foreach ($post_types as $slug) { |
|
354 | + wordpoints_register_post_type_entities($slug); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | // Register entities for all of the public taxonomies. |
358 | - $taxonomies = get_taxonomies( array( 'public' => true ) ); |
|
358 | + $taxonomies = get_taxonomies(array('public' => true)); |
|
359 | 359 | |
360 | 360 | /** |
361 | 361 | * Filter which taxonomies to register entities for. |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | * |
365 | 365 | * @param string[] The taxonomy slugs. |
366 | 366 | */ |
367 | - $taxonomies = apply_filters( 'wordpoints_register_entities_for_taxonomies', $taxonomies ); |
|
367 | + $taxonomies = apply_filters('wordpoints_register_entities_for_taxonomies', $taxonomies); |
|
368 | 368 | |
369 | - foreach ( $taxonomies as $slug ) { |
|
370 | - wordpoints_register_taxonomy_entities( $slug ); |
|
369 | + foreach ($taxonomies as $slug) { |
|
370 | + wordpoints_register_taxonomy_entities($slug); |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
@@ -378,28 +378,28 @@ discard block |
||
378 | 378 | * |
379 | 379 | * @param string $slug The slug of the post type. |
380 | 380 | */ |
381 | -function wordpoints_register_post_type_entities( $slug ) { |
|
381 | +function wordpoints_register_post_type_entities($slug) { |
|
382 | 382 | |
383 | 383 | $entities = wordpoints_entities(); |
384 | 384 | $children = $entities->children; |
385 | 385 | |
386 | - $entities->register( "post\\{$slug}", 'WordPoints_Entity_Post' ); |
|
387 | - $children->register( "post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author' ); |
|
386 | + $entities->register("post\\{$slug}", 'WordPoints_Entity_Post'); |
|
387 | + $children->register("post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author'); |
|
388 | 388 | |
389 | - $supports = get_all_post_type_supports( $slug ); |
|
389 | + $supports = get_all_post_type_supports($slug); |
|
390 | 390 | |
391 | - if ( isset( $supports['editor'] ) ) { |
|
392 | - $children->register( "post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content' ); |
|
391 | + if (isset($supports['editor'])) { |
|
392 | + $children->register("post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content'); |
|
393 | 393 | } |
394 | 394 | |
395 | - if ( isset( $supports['comments'] ) ) { |
|
396 | - $entities->register( "comment\\{$slug}", 'WordPoints_Entity_Comment' ); |
|
397 | - $children->register( "comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post' ); |
|
398 | - $children->register( "comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author' ); |
|
395 | + if (isset($supports['comments'])) { |
|
396 | + $entities->register("comment\\{$slug}", 'WordPoints_Entity_Comment'); |
|
397 | + $children->register("comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post'); |
|
398 | + $children->register("comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author'); |
|
399 | 399 | } |
400 | 400 | |
401 | - foreach ( get_object_taxonomies( $slug ) as $taxonomy_slug ) { |
|
402 | - $children->register( "post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms' ); |
|
401 | + foreach (get_object_taxonomies($slug) as $taxonomy_slug) { |
|
402 | + $children->register("post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms'); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | /** |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | * |
410 | 410 | * @param string $slug The slug ("name") of the post type. |
411 | 411 | */ |
412 | - do_action( 'wordpoints_register_post_type_entities', $slug ); |
|
412 | + do_action('wordpoints_register_post_type_entities', $slug); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | /** |
@@ -419,13 +419,13 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @param string $slug The slug of the post type. |
421 | 421 | */ |
422 | -function wordpoints_register_post_type_hook_events( $slug ) { |
|
422 | +function wordpoints_register_post_type_hook_events($slug) { |
|
423 | 423 | |
424 | 424 | $event_slugs = array(); |
425 | 425 | |
426 | 426 | $events = wordpoints_hooks()->events; |
427 | 427 | |
428 | - if ( 'attachment' === $slug ) { |
|
428 | + if ('attachment' === $slug) { |
|
429 | 429 | |
430 | 430 | $event_slugs[] = 'media_upload'; |
431 | 431 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | ); |
463 | 463 | } |
464 | 464 | |
465 | - if ( post_type_supports( $slug, 'comments' ) ) { |
|
465 | + if (post_type_supports($slug, 'comments')) { |
|
466 | 466 | |
467 | 467 | $event_slugs[] = "comment_leave\\{$slug}"; |
468 | 468 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | , 'WordPoints_Hook_Event_Comment_Leave' |
472 | 472 | , array( |
473 | 473 | 'actions' => array( |
474 | - 'fire' => array( 'comment_approve', 'comment_new' ), |
|
474 | + 'fire' => array('comment_approve', 'comment_new'), |
|
475 | 475 | 'reverse' => 'comment_deapprove', |
476 | 476 | 'spam' => 'comment_spam', |
477 | 477 | ), |
@@ -482,8 +482,8 @@ discard block |
||
482 | 482 | ); |
483 | 483 | } |
484 | 484 | |
485 | - if ( is_multisite() ) { |
|
486 | - foreach ( $event_slugs as $event_slug ) { |
|
485 | + if (is_multisite()) { |
|
486 | + foreach ($event_slugs as $event_slug) { |
|
487 | 487 | $events->args->register( |
488 | 488 | $event_slug |
489 | 489 | , 'current:site' |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @param string $slug The slug ("name") of the post type. |
501 | 501 | */ |
502 | - do_action( 'wordpoints_register_post_type_hook_events', $slug ); |
|
502 | + do_action('wordpoints_register_post_type_hook_events', $slug); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
@@ -509,13 +509,13 @@ discard block |
||
509 | 509 | * |
510 | 510 | * @param string $slug The slug of the taxonomy. |
511 | 511 | */ |
512 | -function wordpoints_register_taxonomy_entities( $slug ) { |
|
512 | +function wordpoints_register_taxonomy_entities($slug) { |
|
513 | 513 | |
514 | 514 | $entities = wordpoints_entities(); |
515 | 515 | $children = $entities->children; |
516 | 516 | |
517 | - $entities->register( "term\\{$slug}", 'WordPoints_Entity_Term' ); |
|
518 | - $children->register( "term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id' ); |
|
517 | + $entities->register("term\\{$slug}", 'WordPoints_Entity_Term'); |
|
518 | + $children->register("term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id'); |
|
519 | 519 | |
520 | 520 | /** |
521 | 521 | * Fired when registering the entities for a taxonomy. |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | * |
525 | 525 | * @param string $slug The taxonomy's slug. |
526 | 526 | */ |
527 | - do_action( 'wordpoints_register_taxonomy_entities', $slug ); |
|
527 | + do_action('wordpoints_register_taxonomy_entities', $slug); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | /** |
@@ -536,10 +536,10 @@ discard block |
||
536 | 536 | * |
537 | 537 | * @param WordPoints_Class_RegistryI $data_types The data types registry. |
538 | 538 | */ |
539 | -function wordpoints_data_types_init( $data_types ) { |
|
539 | +function wordpoints_data_types_init($data_types) { |
|
540 | 540 | |
541 | - $data_types->register( 'integer', 'WordPoints_Data_Type_Integer' ); |
|
542 | - $data_types->register( 'text', 'WordPoints_Data_Type_Text' ); |
|
541 | + $data_types->register('integer', 'WordPoints_Data_Type_Integer'); |
|
542 | + $data_types->register('text', 'WordPoints_Data_Type_Text'); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | /** |
@@ -554,9 +554,9 @@ discard block |
||
554 | 554 | * |
555 | 555 | * @return bool Whether the user can view the points log. |
556 | 556 | */ |
557 | -function wordpoints_hooks_user_can_view_points_log( $can_view, $log ) { |
|
557 | +function wordpoints_hooks_user_can_view_points_log($can_view, $log) { |
|
558 | 558 | |
559 | - if ( ! $can_view ) { |
|
559 | + if ( ! $can_view) { |
|
560 | 560 | return $can_view; |
561 | 561 | } |
562 | 562 | |
@@ -565,11 +565,11 @@ discard block |
||
565 | 565 | $event_slug = $log->log_type; |
566 | 566 | |
567 | 567 | /** @var WordPoints_Hook_Arg $arg */ |
568 | - foreach ( wordpoints_hooks()->events->args->get_children( $event_slug ) as $slug => $arg ) { |
|
568 | + foreach (wordpoints_hooks()->events->args->get_children($event_slug) as $slug => $arg) { |
|
569 | 569 | |
570 | - $value = wordpoints_get_points_log_meta( $log->id, $slug, true ); |
|
570 | + $value = wordpoints_get_points_log_meta($log->id, $slug, true); |
|
571 | 571 | |
572 | - if ( ! $value ) { |
|
572 | + if ( ! $value) { |
|
573 | 573 | continue; |
574 | 574 | } |
575 | 575 | |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | , $value |
580 | 580 | ); |
581 | 581 | |
582 | - if ( ! $can_view ) { |
|
582 | + if ( ! $can_view) { |
|
583 | 583 | break; |
584 | 584 | } |
585 | 585 | } |
@@ -598,20 +598,20 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @return bool Whether the user can view this entity. |
600 | 600 | */ |
601 | -function wordpoints_entity_user_can_view( $user_id, $entity_slug, $entity_id ) { |
|
601 | +function wordpoints_entity_user_can_view($user_id, $entity_slug, $entity_id) { |
|
602 | 602 | |
603 | - $entity = wordpoints_entities()->get( $entity_slug ); |
|
603 | + $entity = wordpoints_entities()->get($entity_slug); |
|
604 | 604 | |
605 | 605 | // If this entity type is not found, we have no way of determining whether it is |
606 | 606 | // safe for the user to view it. |
607 | - if ( ! ( $entity instanceof WordPoints_Entity ) ) { |
|
607 | + if ( ! ($entity instanceof WordPoints_Entity)) { |
|
608 | 608 | return false; |
609 | 609 | } |
610 | 610 | |
611 | 611 | $can_view = true; |
612 | 612 | |
613 | - if ( $entity instanceof WordPoints_Entity_Restricted_VisibilityI ) { |
|
614 | - $can_view = $entity->user_can_view( $user_id, $entity_id ); |
|
613 | + if ($entity instanceof WordPoints_Entity_Restricted_VisibilityI) { |
|
614 | + $can_view = $entity->user_can_view($user_id, $entity_id); |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | /** |
@@ -642,8 +642,8 @@ discard block |
||
642 | 642 | */ |
643 | 643 | function wordpoints_apps() { |
644 | 644 | |
645 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
646 | - WordPoints_App::$main = new WordPoints_App( 'apps' ); |
|
645 | + if ( ! isset(WordPoints_App::$main)) { |
|
646 | + WordPoints_App::$main = new WordPoints_App('apps'); |
|
647 | 647 | } |
648 | 648 | |
649 | 649 | return WordPoints_App::$main; |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | */ |
659 | 659 | function wordpoints_hooks() { |
660 | 660 | |
661 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
661 | + if ( ! isset(WordPoints_App::$main)) { |
|
662 | 662 | wordpoints_apps(); |
663 | 663 | } |
664 | 664 | |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | */ |
675 | 675 | function wordpoints_entities() { |
676 | 676 | |
677 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
677 | + if ( ! isset(WordPoints_App::$main)) { |
|
678 | 678 | wordpoints_apps(); |
679 | 679 | } |
680 | 680 | |
@@ -690,13 +690,13 @@ discard block |
||
690 | 690 | * |
691 | 691 | * @param WordPoints_App $app The main apps app. |
692 | 692 | */ |
693 | -function wordpoints_apps_init( $app ) { |
|
693 | +function wordpoints_apps_init($app) { |
|
694 | 694 | |
695 | 695 | $apps = $app->sub_apps; |
696 | 696 | |
697 | - $apps->register( 'hooks', 'WordPoints_Hooks' ); |
|
698 | - $apps->register( 'entities', 'WordPoints_App_Registry' ); |
|
699 | - $apps->register( 'data_types', 'WordPoints_Class_Registry' ); |
|
697 | + $apps->register('hooks', 'WordPoints_Hooks'); |
|
698 | + $apps->register('entities', 'WordPoints_App_Registry'); |
|
699 | + $apps->register('data_types', 'WordPoints_Class_Registry'); |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | /** |
@@ -709,19 +709,19 @@ discard block |
||
709 | 709 | * |
710 | 710 | * @return object|false The constructed object, or false if to many args were passed. |
711 | 711 | */ |
712 | -function wordpoints_construct_class_with_args( $class_name, array $args ) { |
|
712 | +function wordpoints_construct_class_with_args($class_name, array $args) { |
|
713 | 713 | |
714 | - switch ( count( $args ) ) { |
|
714 | + switch (count($args)) { |
|
715 | 715 | case 0: |
716 | 716 | return new $class_name(); |
717 | 717 | case 1: |
718 | - return new $class_name( $args[0] ); |
|
718 | + return new $class_name($args[0]); |
|
719 | 719 | case 2: |
720 | - return new $class_name( $args[0], $args[1] ); |
|
720 | + return new $class_name($args[0], $args[1]); |
|
721 | 721 | case 3: |
722 | - return new $class_name( $args[0], $args[1], $args[2] ); |
|
722 | + return new $class_name($args[0], $args[1], $args[2]); |
|
723 | 723 | case 4: |
724 | - return new $class_name( $args[0], $args[1], $args[2], $args[3] ); |
|
724 | + return new $class_name($args[0], $args[1], $args[2], $args[3]); |
|
725 | 725 | default: |
726 | 726 | return false; |
727 | 727 | } |
@@ -743,13 +743,13 @@ discard block |
||
743 | 743 | * @return array The slug parsed into the 'generic' and 'dynamic' portions. If the |
744 | 744 | * slug is not dynamic, the value of each of those keys will be false. |
745 | 745 | */ |
746 | -function wordpoints_parse_dynamic_slug( $slug ) { |
|
746 | +function wordpoints_parse_dynamic_slug($slug) { |
|
747 | 747 | |
748 | - $parsed = array( 'dynamic' => false, 'generic' => false ); |
|
748 | + $parsed = array('dynamic' => false, 'generic' => false); |
|
749 | 749 | |
750 | - $parts = explode( '\\', $slug, 2 ); |
|
750 | + $parts = explode('\\', $slug, 2); |
|
751 | 751 | |
752 | - if ( isset( $parts[1] ) ) { |
|
752 | + if (isset($parts[1])) { |
|
753 | 753 | $parsed['dynamic'] = $parts[1]; |
754 | 754 | $parsed['generic'] = $parts[0]; |
755 | 755 | } |
@@ -786,28 +786,28 @@ discard block |
||
786 | 786 | * @return array|false The IDs of the context(s) you passed in, indexed by context |
787 | 787 | * slug, or false if any of the contexts isn't current. |
788 | 788 | */ |
789 | -function wordpoints_entities_get_current_context_id( array $slugs ) { |
|
789 | +function wordpoints_entities_get_current_context_id(array $slugs) { |
|
790 | 790 | |
791 | 791 | $current_context = array(); |
792 | 792 | |
793 | 793 | /** @var WordPoints_Class_Registry $contexts */ |
794 | 794 | $contexts = wordpoints_entities()->contexts; |
795 | 795 | |
796 | - foreach ( $slugs as $slug ) { |
|
796 | + foreach ($slugs as $slug) { |
|
797 | 797 | |
798 | - $context = $contexts->get( $slug ); |
|
798 | + $context = $contexts->get($slug); |
|
799 | 799 | |
800 | - if ( ! $context instanceof WordPoints_Entity_Context ) { |
|
800 | + if ( ! $context instanceof WordPoints_Entity_Context) { |
|
801 | 801 | return false; |
802 | 802 | } |
803 | 803 | |
804 | 804 | $id = $context->get_current_id(); |
805 | 805 | |
806 | - if ( false === $id ) { |
|
806 | + if (false === $id) { |
|
807 | 807 | return false; |
808 | 808 | } |
809 | 809 | |
810 | - $current_context[ $slug ] = $id; |
|
810 | + $current_context[$slug] = $id; |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | return $current_context; |