@@ -17,18 +17,18 @@ |
||
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 | - $reactor->reverse_hits( $event_slug, $event_args ); |
|
27 | + $reactor->reverse_hits($event_slug, $event_args); |
|
28 | 28 | |
29 | 29 | /** @var WordPoints_Hook_Extension $extension */ |
30 | - foreach ( $hooks->extensions->get_all() as $extension ) { |
|
31 | - $extension->after_reverse( $event_slug, $event_args, $reactor ); |
|
30 | + foreach ($hooks->extensions->get_all() as $extension) { |
|
31 | + $extension->after_reverse($event_slug, $event_args, $reactor); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function get_settings_fields() { |
55 | 55 | |
56 | - $this->settings_fields['points']['label'] = _x( 'Points', 'form label', 'wordpoints' ); |
|
57 | - $this->settings_fields['log_text']['label'] = _x( 'Log Text', 'form label', 'wordpoints' ); |
|
58 | - $this->settings_fields['description']['label'] = _x( 'Description', 'form label', 'wordpoints' ); |
|
56 | + $this->settings_fields['points']['label'] = _x('Points', 'form label', 'wordpoints'); |
|
57 | + $this->settings_fields['log_text']['label'] = _x('Log Text', 'form label', 'wordpoints'); |
|
58 | + $this->settings_fields['description']['label'] = _x('Description', 'form label', 'wordpoints'); |
|
59 | 59 | |
60 | 60 | return parent::get_settings_fields(); |
61 | 61 | } |
@@ -69,23 +69,23 @@ discard block |
||
69 | 69 | WordPoints_Hook_Event_Args $event_args |
70 | 70 | ) { |
71 | 71 | |
72 | - if ( ! isset( $settings['points'] ) || false === wordpoints_int( $settings['points'] ) ) { |
|
73 | - $validator->add_error( __( 'Points must be an integer.', 'wordpoints' ), 'points' ); |
|
72 | + if ( ! isset($settings['points']) || false === wordpoints_int($settings['points'])) { |
|
73 | + $validator->add_error(__('Points must be an integer.', 'wordpoints'), 'points'); |
|
74 | 74 | } |
75 | 75 | |
76 | - if ( ! isset( $settings['points_type'] ) || ! wordpoints_is_points_type( $settings['points_type'] ) ) { |
|
77 | - $validator->add_error( __( 'Invalid points type.', 'wordpoints' ), 'points_type' ); |
|
76 | + if ( ! isset($settings['points_type']) || ! wordpoints_is_points_type($settings['points_type'])) { |
|
77 | + $validator->add_error(__('Invalid points type.', 'wordpoints'), 'points_type'); |
|
78 | 78 | } |
79 | 79 | |
80 | - if ( ! isset( $settings['description'] ) ) { |
|
81 | - $validator->add_error( __( 'Description is required.', 'wordpoints' ), 'description' ); |
|
80 | + if ( ! isset($settings['description'])) { |
|
81 | + $validator->add_error(__('Description is required.', 'wordpoints'), 'description'); |
|
82 | 82 | } |
83 | 83 | |
84 | - if ( ! isset( $settings['log_text'] ) ) { |
|
85 | - $validator->add_error( __( 'Log Text is required.', 'wordpoints' ), 'log_text' ); |
|
84 | + if ( ! isset($settings['log_text'])) { |
|
85 | + $validator->add_error(__('Log Text is required.', 'wordpoints'), 'log_text'); |
|
86 | 86 | } |
87 | 87 | |
88 | - return parent::validate_settings( $settings, $validator, $event_args ); |
|
88 | + return parent::validate_settings($settings, $validator, $event_args); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | array $settings |
97 | 97 | ) { |
98 | 98 | |
99 | - parent::update_settings( $reaction, $settings ); |
|
99 | + parent::update_settings($reaction, $settings); |
|
100 | 100 | |
101 | - $reaction->update_meta( 'points', $settings['points'] ); |
|
102 | - $reaction->update_meta( 'points_type', $settings['points_type'] ); |
|
103 | - $reaction->update_meta( 'description', $settings['description'] ); |
|
104 | - $reaction->update_meta( 'log_text', $settings['log_text'] ); |
|
101 | + $reaction->update_meta('points', $settings['points']); |
|
102 | + $reaction->update_meta('points_type', $settings['points_type']); |
|
103 | + $reaction->update_meta('description', $settings['description']); |
|
104 | + $reaction->update_meta('log_text', $settings['log_text']); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -113,33 +113,33 @@ discard block |
||
113 | 113 | ) { |
114 | 114 | |
115 | 115 | $target = $event_args->get_from_hierarchy( |
116 | - $reaction->get_meta( 'target' ) |
|
116 | + $reaction->get_meta('target') |
|
117 | 117 | ); |
118 | 118 | |
119 | - if ( ! $target instanceof WordPoints_Entity ) { |
|
119 | + if ( ! $target instanceof WordPoints_Entity) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
123 | 123 | $meta = array(); |
124 | 124 | |
125 | - foreach ( $event_args->get_entities() as $entity ) { |
|
126 | - $meta[ $entity->get_slug() ] = $entity->get_the_id(); |
|
125 | + foreach ($event_args->get_entities() as $entity) { |
|
126 | + $meta[$entity->get_slug()] = $entity->get_the_id(); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | wordpoints_alter_points( |
130 | 130 | $target->get_the_id() |
131 | - , $reaction->get_meta( 'points' ) |
|
132 | - , $reaction->get_meta( 'points_type' ) |
|
131 | + , $reaction->get_meta('points') |
|
132 | + , $reaction->get_meta('points_type') |
|
133 | 133 | , $reaction->get_event_slug() |
134 | 134 | , $meta |
135 | - , $reaction->get_meta( 'log_text' ) |
|
135 | + , $reaction->get_meta('log_text') |
|
136 | 136 | ); |
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
140 | 140 | * @since 1.0.0 |
141 | 141 | */ |
142 | - public function reverse_hits( $event_slug, WordPoints_Hook_Event_Args $event_args ) { |
|
142 | + public function reverse_hits($event_slug, WordPoints_Hook_Event_Args $event_args) { |
|
143 | 143 | |
144 | 144 | $meta_queries = array( |
145 | 145 | array( |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | ), |
151 | 151 | ); |
152 | 152 | |
153 | - foreach ( $event_args->get_entities() as $slug => $entity ) { |
|
153 | + foreach ($event_args->get_entities() as $slug => $entity) { |
|
154 | 154 | |
155 | 155 | $meta_queries[] = array( |
156 | 156 | 'key' => $slug, |
@@ -167,35 +167,35 @@ discard block |
||
167 | 167 | |
168 | 168 | $logs = $query->get(); |
169 | 169 | |
170 | - if ( ! $logs ) { |
|
170 | + if ( ! $logs) { |
|
171 | 171 | return; |
172 | 172 | } |
173 | 173 | |
174 | 174 | global $wpdb; |
175 | 175 | |
176 | - add_filter( 'wordpoints_points_log', '__return_false' ); |
|
176 | + add_filter('wordpoints_points_log', '__return_false'); |
|
177 | 177 | |
178 | - foreach ( $logs as $log ) { |
|
178 | + foreach ($logs as $log) { |
|
179 | 179 | |
180 | 180 | wordpoints_alter_points( |
181 | 181 | $log->user_id |
182 | 182 | , -$log->points |
183 | 183 | , $log->points_type |
184 | 184 | , "reverse-{$log->log_type}" |
185 | - , array( 'original_log_id' => $log->id ) |
|
185 | + , array('original_log_id' => $log->id) |
|
186 | 186 | ); |
187 | 187 | |
188 | - wordpoints_points_log_delete_all_metadata( $log->id ); |
|
188 | + wordpoints_points_log_delete_all_metadata($log->id); |
|
189 | 189 | |
190 | 190 | // Now delete the log. |
191 | 191 | $wpdb->delete( |
192 | 192 | $wpdb->wordpoints_points_logs |
193 | - , array( 'id' => $log->id ) |
|
193 | + , array('id' => $log->id) |
|
194 | 194 | , '%d' |
195 | 195 | ); // WPCS: cache OK, cleaned by wordpoints_alter_points(). |
196 | 196 | } |
197 | 197 | |
198 | - remove_filter( 'wordpoints_points_log', '__return_false' ); |
|
198 | + remove_filter('wordpoints_points_log', '__return_false'); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 |
@@ -10,106 +10,106 @@ |
||
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/firer.php' ); |
|
88 | -require_once( dirname( __FILE__ ) . 'hook/firer/reverse.php' ); |
|
89 | -require_once( dirname( __FILE__ ) . 'hook/fireri.php' ); |
|
90 | -require_once( dirname( __FILE__ ) . 'hook/reaction.php' ); |
|
91 | -require_once( dirname( __FILE__ ) . 'hook/reaction/options.php' ); |
|
92 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storage.php' ); |
|
93 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storage/options.php' ); |
|
94 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storage/options/network.php' ); |
|
95 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storagei.php' ); |
|
96 | -require_once( dirname( __FILE__ ) . 'hook/reaction/validator.php' ); |
|
97 | -require_once( dirname( __FILE__ ) . 'hook/reactioni.php' ); |
|
98 | -require_once( dirname( __FILE__ ) . 'hook/reactor.php' ); |
|
99 | -require_once( dirname( __FILE__ ) . 'hook/reactor/points.php' ); |
|
100 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/conditions.php' ); |
|
101 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/query.php' ); |
|
102 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/query/modifieri.php' ); |
|
103 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/queryable.php' ); |
|
104 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/queryi.php' ); |
|
105 | -require_once( dirname( __FILE__ ) . 'hook/router.php' ); |
|
106 | -require_once( dirname( __FILE__ ) . 'hook/settings.php' ); |
|
107 | -require_once( dirname( __FILE__ ) . 'hook/settingsi.php' ); |
|
108 | -require_once( dirname( __FILE__ ) . 'hook/validator/exception.php' ); |
|
109 | -require_once( dirname( __FILE__ ) . 'hooks.php' ); |
|
110 | -require_once( dirname( __FILE__ ) . 'query/builder/db/mysql.php' ); |
|
111 | -require_once( dirname( __FILE__ ) . 'spec.php' ); |
|
112 | -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/firer.php'); |
|
88 | +require_once(dirname(__FILE__).'hook/firer/reverse.php'); |
|
89 | +require_once(dirname(__FILE__).'hook/fireri.php'); |
|
90 | +require_once(dirname(__FILE__).'hook/reaction.php'); |
|
91 | +require_once(dirname(__FILE__).'hook/reaction/options.php'); |
|
92 | +require_once(dirname(__FILE__).'hook/reaction/storage.php'); |
|
93 | +require_once(dirname(__FILE__).'hook/reaction/storage/options.php'); |
|
94 | +require_once(dirname(__FILE__).'hook/reaction/storage/options/network.php'); |
|
95 | +require_once(dirname(__FILE__).'hook/reaction/storagei.php'); |
|
96 | +require_once(dirname(__FILE__).'hook/reaction/validator.php'); |
|
97 | +require_once(dirname(__FILE__).'hook/reactioni.php'); |
|
98 | +require_once(dirname(__FILE__).'hook/reactor.php'); |
|
99 | +require_once(dirname(__FILE__).'hook/reactor/points.php'); |
|
100 | +require_once(dirname(__FILE__).'hook/retroactive/conditions.php'); |
|
101 | +require_once(dirname(__FILE__).'hook/retroactive/query.php'); |
|
102 | +require_once(dirname(__FILE__).'hook/retroactive/query/modifieri.php'); |
|
103 | +require_once(dirname(__FILE__).'hook/retroactive/queryable.php'); |
|
104 | +require_once(dirname(__FILE__).'hook/retroactive/queryi.php'); |
|
105 | +require_once(dirname(__FILE__).'hook/router.php'); |
|
106 | +require_once(dirname(__FILE__).'hook/settings.php'); |
|
107 | +require_once(dirname(__FILE__).'hook/settingsi.php'); |
|
108 | +require_once(dirname(__FILE__).'hook/validator/exception.php'); |
|
109 | +require_once(dirname(__FILE__).'hooks.php'); |
|
110 | +require_once(dirname(__FILE__).'query/builder/db/mysql.php'); |
|
111 | +require_once(dirname(__FILE__).'spec.php'); |
|
112 | +require_once(dirname(__FILE__).'specedi.php'); |
|
113 | 113 | // } |
114 | 114 | |
115 | 115 | // EOF |
@@ -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,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @param WordPoints_Class_Registry_Children $reaction_groups The group registry. |
49 | 49 | */ |
50 | -function wordpoints_hook_reaction_groups_init( $reaction_groups ) { |
|
50 | +function wordpoints_hook_reaction_groups_init($reaction_groups) { |
|
51 | 51 | |
52 | 52 | $reaction_groups->register( |
53 | 53 | 'points' |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | , 'WordPoints_Hook_Reaction_Storage_Options' |
56 | 56 | ); |
57 | 57 | |
58 | - if ( is_wordpoints_network_active() ) { |
|
58 | + if (is_wordpoints_network_active()) { |
|
59 | 59 | $reaction_groups->register( |
60 | 60 | 'points' |
61 | 61 | , 'network' |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @param WordPoints_Class_Registry_Persistent $extensions The extension registry. |
75 | 75 | */ |
76 | -function wordpoints_hook_extension_init( $extensions ) { |
|
76 | +function wordpoints_hook_extension_init($extensions) { |
|
77 | 77 | |
78 | - $extensions->register( 'conditions', 'WordPoints_Hook_Extension_Conditions' ); |
|
79 | - $extensions->register( 'periods', 'WordPoints_Hook_Extension_Periods' ); |
|
78 | + $extensions->register('conditions', 'WordPoints_Hook_Extension_Conditions'); |
|
79 | + $extensions->register('periods', 'WordPoints_Hook_Extension_Periods'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @param WordPoints_Class_Registry_Children $conditions The conditions registry. |
90 | 90 | */ |
91 | -function wordpoints_hook_conditions_init( $conditions ) { |
|
91 | +function wordpoints_hook_conditions_init($conditions) { |
|
92 | 92 | |
93 | 93 | $conditions->register( |
94 | 94 | 'text' |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param WordPoints_Hook_Actions $actions The action registry. |
126 | 126 | */ |
127 | -function wordpoints_hook_actions_init( $actions ) { |
|
127 | +function wordpoints_hook_actions_init($actions) { |
|
128 | 128 | |
129 | 129 | $actions->register( |
130 | 130 | 'comment_approve' |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | , array( |
133 | 133 | 'action' => 'transition_comment_status', |
134 | 134 | 'data' => array( |
135 | - 'arg_index' => array( 'comment' => 2 ), |
|
136 | - 'requirements' => array( 0 => 'approved' ), |
|
135 | + 'arg_index' => array('comment' => 2), |
|
136 | + 'requirements' => array(0 => 'approved'), |
|
137 | 137 | ), |
138 | 138 | ) |
139 | 139 | ); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | , array( |
145 | 145 | 'action' => 'wp_insert_comment', |
146 | 146 | 'data' => array( |
147 | - 'arg_index' => array( 'comment' => 1 ), |
|
147 | + 'arg_index' => array('comment' => 1), |
|
148 | 148 | ), |
149 | 149 | ) |
150 | 150 | ); |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | , array( |
156 | 156 | 'action' => 'transition_comment_status', |
157 | 157 | 'data' => array( |
158 | - 'arg_index' => array( 'comment' => 2 ), |
|
159 | - 'requirements' => array( 1 => 'approved' ), |
|
158 | + 'arg_index' => array('comment' => 2), |
|
159 | + 'requirements' => array(1 => 'approved'), |
|
160 | 160 | ), |
161 | 161 | ) |
162 | 162 | ); |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | , array( |
169 | 169 | 'action' => 'transition_post_status', |
170 | 170 | 'data' => array( |
171 | - 'arg_index' => array( 'post' => 2 ), |
|
172 | - 'requirements' => array( 0 => 'publish' ), |
|
171 | + 'arg_index' => array('post' => 2), |
|
172 | + 'requirements' => array(0 => 'publish'), |
|
173 | 173 | ), |
174 | 174 | ) |
175 | 175 | ); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | , array( |
181 | 181 | 'action' => 'add_attachment', |
182 | 182 | 'data' => array( |
183 | - 'arg_index' => array( 'post\attachment' => 0 ), |
|
183 | + 'arg_index' => array('post\attachment' => 0), |
|
184 | 184 | ), |
185 | 185 | ) |
186 | 186 | ); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | , array( |
192 | 192 | 'action' => 'post_delete', |
193 | 193 | 'data' => array( |
194 | - 'arg_index' => array( 'post' => 0 ), |
|
194 | + 'arg_index' => array('post' => 0), |
|
195 | 195 | ), |
196 | 196 | ) |
197 | 197 | ); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | , array( |
203 | 203 | 'action' => 'user_register', |
204 | 204 | 'data' => array( |
205 | - 'arg_index' => array( 'user' => 0 ), |
|
205 | + 'arg_index' => array('user' => 0), |
|
206 | 206 | ), |
207 | 207 | ) |
208 | 208 | ); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | , array( |
214 | 214 | 'action' => is_multisite() ? 'wpmu_delete_user' : 'delete_user', |
215 | 215 | 'data' => array( |
216 | - 'arg_index' => array( 'user' => 0 ), |
|
216 | + 'arg_index' => array('user' => 0), |
|
217 | 217 | ), |
218 | 218 | ) |
219 | 219 | ); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @param WordPoints_Hook_Events $events The event registry. |
238 | 238 | */ |
239 | -function wordpoints_hook_events_init( $events ) { |
|
239 | +function wordpoints_hook_events_init($events) { |
|
240 | 240 | |
241 | 241 | $events->register( |
242 | 242 | 'user_register' |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | ); |
267 | 267 | |
268 | 268 | // Register events for all of the public post types. |
269 | - $post_types = get_post_types( array( 'public' => true ) ); |
|
269 | + $post_types = get_post_types(array('public' => true)); |
|
270 | 270 | |
271 | 271 | /** |
272 | 272 | * Filter which post types to register hook events for. |
@@ -275,20 +275,20 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @param string[] The post type slugs ("names"). |
277 | 277 | */ |
278 | - $post_types = apply_filters( 'wordpoints_register_hook_events_for_post_types', $post_types ); |
|
278 | + $post_types = apply_filters('wordpoints_register_hook_events_for_post_types', $post_types); |
|
279 | 279 | |
280 | - foreach ( $post_types as $slug ) { |
|
281 | - wordpoints_register_post_type_hook_events( $slug ); |
|
280 | + foreach ($post_types as $slug) { |
|
281 | + wordpoints_register_post_type_hook_events($slug); |
|
282 | 282 | } |
283 | 283 | |
284 | - if ( is_multisite() ) { |
|
284 | + if (is_multisite()) { |
|
285 | 285 | |
286 | 286 | $event_slugs = array( |
287 | 287 | 'user_visit', |
288 | 288 | 'user_register', |
289 | 289 | ); |
290 | 290 | |
291 | - foreach ( $event_slugs as $event_slug ) { |
|
291 | + foreach ($event_slugs as $event_slug) { |
|
292 | 292 | // TODO network hooks |
293 | 293 | $events->args->register( |
294 | 294 | $event_slug |
@@ -308,10 +308,10 @@ discard block |
||
308 | 308 | * |
309 | 309 | * @param WordPoints_Class_Registry_Persistent $firers The firer registry. |
310 | 310 | */ |
311 | -function wordpoints_hook_firers_init( $firers ) { |
|
311 | +function wordpoints_hook_firers_init($firers) { |
|
312 | 312 | |
313 | - $firers->register( 'fire', 'WordPoints_Hook_Firer' ); |
|
314 | - $firers->register( 'reverse', 'WordPoints_Hook_Firer_Reverse' ); |
|
313 | + $firers->register('fire', 'WordPoints_Hook_Firer'); |
|
314 | + $firers->register('reverse', 'WordPoints_Hook_Firer_Reverse'); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -323,10 +323,10 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @param WordPoints_App_Registry $entities The entities app. |
325 | 325 | */ |
326 | -function wordpoints_entities_app_init( $entities ) { |
|
326 | +function wordpoints_entities_app_init($entities) { |
|
327 | 327 | |
328 | - $entities->sub_apps->register( 'children', 'WordPoints_Class_Registry_Children' ); |
|
329 | - $entities->sub_apps->register( 'contexts', 'WordPoints_Class_Registry' ); |
|
328 | + $entities->sub_apps->register('children', 'WordPoints_Class_Registry_Children'); |
|
329 | + $entities->sub_apps->register('contexts', 'WordPoints_Class_Registry'); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -338,10 +338,10 @@ discard block |
||
338 | 338 | * |
339 | 339 | * @param WordPoints_Class_Registry $contexts The entity context registry. |
340 | 340 | */ |
341 | -function wordpoints_entity_contexts_init( $contexts ) { |
|
341 | +function wordpoints_entity_contexts_init($contexts) { |
|
342 | 342 | |
343 | - $contexts->register( 'network', 'WordPoints_Entity_Context_Network' ); |
|
344 | - $contexts->register( 'site', 'WordPoints_Entity_Context_Site' ); |
|
343 | + $contexts->register('network', 'WordPoints_Entity_Context_Network'); |
|
344 | + $contexts->register('site', 'WordPoints_Entity_Context_Site'); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -353,18 +353,18 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @param WordPoints_App_Registry $entities The entities app. |
355 | 355 | */ |
356 | -function wordpoints_entities_init( $entities ) { |
|
356 | +function wordpoints_entities_init($entities) { |
|
357 | 357 | |
358 | 358 | $children = $entities->children; |
359 | 359 | |
360 | - $entities->register( 'user', 'WordPoints_Entity_User' ); |
|
361 | - $children->register( 'user', 'roles', 'WordPoints_Entity_User_Roles' ); |
|
360 | + $entities->register('user', 'WordPoints_Entity_User'); |
|
361 | + $children->register('user', 'roles', 'WordPoints_Entity_User_Roles'); |
|
362 | 362 | |
363 | - $entities->register( 'user_role', 'WordPoints_Entity_User_Role' ); |
|
364 | - $children->register( 'user_role', 'name', 'WordPoints_Entity_User_Role_Name' ); |
|
363 | + $entities->register('user_role', 'WordPoints_Entity_User_Role'); |
|
364 | + $children->register('user_role', 'name', 'WordPoints_Entity_User_Role_Name'); |
|
365 | 365 | |
366 | 366 | // Register entities for all of the public post types. |
367 | - $post_types = get_post_types( array( 'public' => true ) ); |
|
367 | + $post_types = get_post_types(array('public' => true)); |
|
368 | 368 | |
369 | 369 | /** |
370 | 370 | * Filter which post types to register entities for. |
@@ -373,14 +373,14 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @param string[] The post type slugs ("names"). |
375 | 375 | */ |
376 | - $post_types = apply_filters( 'wordpoints_register_entities_for_post_types', $post_types ); |
|
376 | + $post_types = apply_filters('wordpoints_register_entities_for_post_types', $post_types); |
|
377 | 377 | |
378 | - foreach ( $post_types as $slug ) { |
|
379 | - wordpoints_register_post_type_entities( $slug ); |
|
378 | + foreach ($post_types as $slug) { |
|
379 | + wordpoints_register_post_type_entities($slug); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | // Register entities for all of the public taxonomies. |
383 | - $taxonomies = get_taxonomies( array( 'public' => true ) ); |
|
383 | + $taxonomies = get_taxonomies(array('public' => true)); |
|
384 | 384 | |
385 | 385 | /** |
386 | 386 | * Filter which taxonomies to register entities for. |
@@ -389,10 +389,10 @@ discard block |
||
389 | 389 | * |
390 | 390 | * @param string[] The taxonomy slugs. |
391 | 391 | */ |
392 | - $taxonomies = apply_filters( 'wordpoints_register_entities_for_taxonomies', $taxonomies ); |
|
392 | + $taxonomies = apply_filters('wordpoints_register_entities_for_taxonomies', $taxonomies); |
|
393 | 393 | |
394 | - foreach ( $taxonomies as $slug ) { |
|
395 | - wordpoints_register_taxonomy_entities( $slug ); |
|
394 | + foreach ($taxonomies as $slug) { |
|
395 | + wordpoints_register_taxonomy_entities($slug); |
|
396 | 396 | } |
397 | 397 | } |
398 | 398 | |
@@ -403,28 +403,28 @@ discard block |
||
403 | 403 | * |
404 | 404 | * @param string $slug The slug of the post type. |
405 | 405 | */ |
406 | -function wordpoints_register_post_type_entities( $slug ) { |
|
406 | +function wordpoints_register_post_type_entities($slug) { |
|
407 | 407 | |
408 | 408 | $entities = wordpoints_entities(); |
409 | 409 | $children = $entities->children; |
410 | 410 | |
411 | - $entities->register( "post\\{$slug}", 'WordPoints_Entity_Post' ); |
|
412 | - $children->register( "post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author' ); |
|
411 | + $entities->register("post\\{$slug}", 'WordPoints_Entity_Post'); |
|
412 | + $children->register("post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author'); |
|
413 | 413 | |
414 | - $supports = get_all_post_type_supports( $slug ); |
|
414 | + $supports = get_all_post_type_supports($slug); |
|
415 | 415 | |
416 | - if ( isset( $supports['editor'] ) ) { |
|
417 | - $children->register( "post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content' ); |
|
416 | + if (isset($supports['editor'])) { |
|
417 | + $children->register("post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content'); |
|
418 | 418 | } |
419 | 419 | |
420 | - if ( isset( $supports['comments'] ) ) { |
|
421 | - $entities->register( "comment\\{$slug}", 'WordPoints_Entity_Comment' ); |
|
422 | - $children->register( "comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post' ); |
|
423 | - $children->register( "comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author' ); |
|
420 | + if (isset($supports['comments'])) { |
|
421 | + $entities->register("comment\\{$slug}", 'WordPoints_Entity_Comment'); |
|
422 | + $children->register("comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post'); |
|
423 | + $children->register("comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author'); |
|
424 | 424 | } |
425 | 425 | |
426 | - foreach ( get_object_taxonomies( $slug ) as $taxonomy_slug ) { |
|
427 | - $children->register( "post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms' ); |
|
426 | + foreach (get_object_taxonomies($slug) as $taxonomy_slug) { |
|
427 | + $children->register("post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms'); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * |
435 | 435 | * @param string $slug The slug ("name") of the post type. |
436 | 436 | */ |
437 | - do_action( 'wordpoints_register_post_type_entities', $slug ); |
|
437 | + do_action('wordpoints_register_post_type_entities', $slug); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | /** |
@@ -444,13 +444,13 @@ discard block |
||
444 | 444 | * |
445 | 445 | * @param string $slug The slug of the post type. |
446 | 446 | */ |
447 | -function wordpoints_register_post_type_hook_events( $slug ) { |
|
447 | +function wordpoints_register_post_type_hook_events($slug) { |
|
448 | 448 | |
449 | 449 | $event_slugs = array(); |
450 | 450 | |
451 | 451 | $events = wordpoints_hooks()->events; |
452 | 452 | |
453 | - if ( 'attachment' === $slug ) { |
|
453 | + if ('attachment' === $slug) { |
|
454 | 454 | |
455 | 455 | $event_slugs[] = 'media_upload'; |
456 | 456 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | ); |
488 | 488 | } |
489 | 489 | |
490 | - if ( post_type_supports( $slug, 'comments' ) ) { |
|
490 | + if (post_type_supports($slug, 'comments')) { |
|
491 | 491 | |
492 | 492 | $event_slugs[] = "comment_leave\\{$slug}"; |
493 | 493 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | , 'WordPoints_Hook_Event_Comment_Leave' |
497 | 497 | , array( |
498 | 498 | 'actions' => array( |
499 | - 'fire' => array( 'comment_approve', 'comment_new' ), |
|
499 | + 'fire' => array('comment_approve', 'comment_new'), |
|
500 | 500 | 'reverse' => 'comment_deapprove', |
501 | 501 | ), |
502 | 502 | 'args' => array( |
@@ -506,8 +506,8 @@ discard block |
||
506 | 506 | ); |
507 | 507 | } |
508 | 508 | |
509 | - if ( is_multisite() ) { |
|
510 | - foreach ( $event_slugs as $event_slug ) { |
|
509 | + if (is_multisite()) { |
|
510 | + foreach ($event_slugs as $event_slug) { |
|
511 | 511 | $events->args->register( |
512 | 512 | $event_slug |
513 | 513 | , 'current:site' |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | * |
524 | 524 | * @param string $slug The slug ("name") of the post type. |
525 | 525 | */ |
526 | - do_action( 'wordpoints_register_post_type_hook_events', $slug ); |
|
526 | + do_action('wordpoints_register_post_type_hook_events', $slug); |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | /** |
@@ -533,13 +533,13 @@ discard block |
||
533 | 533 | * |
534 | 534 | * @param string $slug The slug of the taxonomy. |
535 | 535 | */ |
536 | -function wordpoints_register_taxonomy_entities( $slug ) { |
|
536 | +function wordpoints_register_taxonomy_entities($slug) { |
|
537 | 537 | |
538 | 538 | $entities = wordpoints_entities(); |
539 | 539 | $children = $entities->children; |
540 | 540 | |
541 | - $entities->register( "term\\{$slug}", 'WordPoints_Entity_Term' ); |
|
542 | - $children->register( "term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id' ); |
|
541 | + $entities->register("term\\{$slug}", 'WordPoints_Entity_Term'); |
|
542 | + $children->register("term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id'); |
|
543 | 543 | |
544 | 544 | /** |
545 | 545 | * Fired when registering the entities for a taxonomy. |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * |
549 | 549 | * @param string $slug The taxonomy's slug. |
550 | 550 | */ |
551 | - do_action( 'wordpoints_register_taxonomy_entities', $slug ); |
|
551 | + do_action('wordpoints_register_taxonomy_entities', $slug); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | /** |
@@ -560,10 +560,10 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @param WordPoints_Class_RegistryI $data_types The data types registry. |
562 | 562 | */ |
563 | -function wordpoints_data_types_init( $data_types ) { |
|
563 | +function wordpoints_data_types_init($data_types) { |
|
564 | 564 | |
565 | - $data_types->register( 'integer', 'WordPoints_Data_Type_Integer' ); |
|
566 | - $data_types->register( 'text', 'WordPoints_Data_Type_Text' ); |
|
565 | + $data_types->register('integer', 'WordPoints_Data_Type_Integer'); |
|
566 | + $data_types->register('text', 'WordPoints_Data_Type_Text'); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | /** |
@@ -578,9 +578,9 @@ discard block |
||
578 | 578 | * |
579 | 579 | * @return bool Whether the user can view the points log. |
580 | 580 | */ |
581 | -function wordpoints_hooks_user_can_view_points_log( $can_view, $log ) { |
|
581 | +function wordpoints_hooks_user_can_view_points_log($can_view, $log) { |
|
582 | 582 | |
583 | - if ( ! $can_view ) { |
|
583 | + if ( ! $can_view) { |
|
584 | 584 | return $can_view; |
585 | 585 | } |
586 | 586 | |
@@ -589,11 +589,11 @@ discard block |
||
589 | 589 | $event_slug = $log->log_type; |
590 | 590 | |
591 | 591 | /** @var WordPoints_Hook_Arg $arg */ |
592 | - foreach ( wordpoints_hooks()->events->args->get_children( $event_slug ) as $slug => $arg ) { |
|
592 | + foreach (wordpoints_hooks()->events->args->get_children($event_slug) as $slug => $arg) { |
|
593 | 593 | |
594 | - $value = wordpoints_get_points_log_meta( $log->id, $slug, true ); |
|
594 | + $value = wordpoints_get_points_log_meta($log->id, $slug, true); |
|
595 | 595 | |
596 | - if ( ! $value ) { |
|
596 | + if ( ! $value) { |
|
597 | 597 | continue; |
598 | 598 | } |
599 | 599 | |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | , $value |
604 | 604 | ); |
605 | 605 | |
606 | - if ( ! $can_view ) { |
|
606 | + if ( ! $can_view) { |
|
607 | 607 | break; |
608 | 608 | } |
609 | 609 | } |
@@ -622,20 +622,20 @@ discard block |
||
622 | 622 | * |
623 | 623 | * @return bool Whether the user can view this entity. |
624 | 624 | */ |
625 | -function wordpoints_entity_user_can_view( $user_id, $entity_slug, $entity_id ) { |
|
625 | +function wordpoints_entity_user_can_view($user_id, $entity_slug, $entity_id) { |
|
626 | 626 | |
627 | - $entity = wordpoints_entities()->get( $entity_slug ); |
|
627 | + $entity = wordpoints_entities()->get($entity_slug); |
|
628 | 628 | |
629 | 629 | // If this entity type is not found, we have no way of determining whether it is |
630 | 630 | // safe for the user to view it. |
631 | - if ( ! ( $entity instanceof WordPoints_Entity ) ) { |
|
631 | + if ( ! ($entity instanceof WordPoints_Entity)) { |
|
632 | 632 | return false; |
633 | 633 | } |
634 | 634 | |
635 | 635 | $can_view = true; |
636 | 636 | |
637 | - if ( $entity instanceof WordPoints_Entity_Restricted_VisibilityI ) { |
|
638 | - $can_view = $entity->user_can_view( $user_id, $entity_id ); |
|
637 | + if ($entity instanceof WordPoints_Entity_Restricted_VisibilityI) { |
|
638 | + $can_view = $entity->user_can_view($user_id, $entity_id); |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | /** |
@@ -666,8 +666,8 @@ discard block |
||
666 | 666 | */ |
667 | 667 | function wordpoints_apps() { |
668 | 668 | |
669 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
670 | - WordPoints_App::$main = new WordPoints_App( 'apps' ); |
|
669 | + if ( ! isset(WordPoints_App::$main)) { |
|
670 | + WordPoints_App::$main = new WordPoints_App('apps'); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | return WordPoints_App::$main; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | */ |
683 | 683 | function wordpoints_hooks() { |
684 | 684 | |
685 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
685 | + if ( ! isset(WordPoints_App::$main)) { |
|
686 | 686 | wordpoints_apps(); |
687 | 687 | } |
688 | 688 | |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | */ |
699 | 699 | function wordpoints_entities() { |
700 | 700 | |
701 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
701 | + if ( ! isset(WordPoints_App::$main)) { |
|
702 | 702 | wordpoints_apps(); |
703 | 703 | } |
704 | 704 | |
@@ -714,13 +714,13 @@ discard block |
||
714 | 714 | * |
715 | 715 | * @param WordPoints_App $app The main apps app. |
716 | 716 | */ |
717 | -function wordpoints_apps_init( $app ) { |
|
717 | +function wordpoints_apps_init($app) { |
|
718 | 718 | |
719 | 719 | $apps = $app->sub_apps; |
720 | 720 | |
721 | - $apps->register( 'hooks', 'WordPoints_Hooks' ); |
|
722 | - $apps->register( 'entities', 'WordPoints_App_Registry' ); |
|
723 | - $apps->register( 'data_types', 'WordPoints_Class_Registry' ); |
|
721 | + $apps->register('hooks', 'WordPoints_Hooks'); |
|
722 | + $apps->register('entities', 'WordPoints_App_Registry'); |
|
723 | + $apps->register('data_types', 'WordPoints_Class_Registry'); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | /** |
@@ -733,19 +733,19 @@ discard block |
||
733 | 733 | * |
734 | 734 | * @return object|false The constructed object, or false if to many args were passed. |
735 | 735 | */ |
736 | -function wordpoints_construct_class_with_args( $class_name, array $args ) { |
|
736 | +function wordpoints_construct_class_with_args($class_name, array $args) { |
|
737 | 737 | |
738 | - switch ( count( $args ) ) { |
|
738 | + switch (count($args)) { |
|
739 | 739 | case 0: |
740 | 740 | return new $class_name(); |
741 | 741 | case 1: |
742 | - return new $class_name( $args[0] ); |
|
742 | + return new $class_name($args[0]); |
|
743 | 743 | case 2: |
744 | - return new $class_name( $args[0], $args[1] ); |
|
744 | + return new $class_name($args[0], $args[1]); |
|
745 | 745 | case 3: |
746 | - return new $class_name( $args[0], $args[1], $args[2] ); |
|
746 | + return new $class_name($args[0], $args[1], $args[2]); |
|
747 | 747 | case 4: |
748 | - return new $class_name( $args[0], $args[1], $args[2], $args[3] ); |
|
748 | + return new $class_name($args[0], $args[1], $args[2], $args[3]); |
|
749 | 749 | default: |
750 | 750 | return false; |
751 | 751 | } |
@@ -767,13 +767,13 @@ discard block |
||
767 | 767 | * @return array The slug parsed into the 'generic' and 'dynamic' portions. If the |
768 | 768 | * slug is not dynamic, the value of each of those keys will be false. |
769 | 769 | */ |
770 | -function wordpoints_parse_dynamic_slug( $slug ) { |
|
770 | +function wordpoints_parse_dynamic_slug($slug) { |
|
771 | 771 | |
772 | - $parsed = array( 'dynamic' => false, 'generic' => false ); |
|
772 | + $parsed = array('dynamic' => false, 'generic' => false); |
|
773 | 773 | |
774 | - $parts = explode( '\\', $slug, 2 ); |
|
774 | + $parts = explode('\\', $slug, 2); |
|
775 | 775 | |
776 | - if ( isset( $parts[1] ) ) { |
|
776 | + if (isset($parts[1])) { |
|
777 | 777 | $parsed['dynamic'] = $parts[1]; |
778 | 778 | $parsed['generic'] = $parts[0]; |
779 | 779 | } |
@@ -810,28 +810,28 @@ discard block |
||
810 | 810 | * contexts, indexed by context slug, or false if any of the |
811 | 811 | * contexts isn't current. |
812 | 812 | */ |
813 | -function wordpoints_entities_get_current_context_id( $slug ) { |
|
813 | +function wordpoints_entities_get_current_context_id($slug) { |
|
814 | 814 | |
815 | 815 | $current_context = array(); |
816 | 816 | |
817 | 817 | /** @var WordPoints_Class_Registry $contexts */ |
818 | 818 | $contexts = wordpoints_entities()->contexts; |
819 | 819 | |
820 | - while ( $slug ) { |
|
820 | + while ($slug) { |
|
821 | 821 | |
822 | - $context = $contexts->get( $slug ); |
|
822 | + $context = $contexts->get($slug); |
|
823 | 823 | |
824 | - if ( ! $context instanceof WordPoints_Entity_Context ) { |
|
824 | + if ( ! $context instanceof WordPoints_Entity_Context) { |
|
825 | 825 | return false; |
826 | 826 | } |
827 | 827 | |
828 | 828 | $id = $context->get_current_id(); |
829 | 829 | |
830 | - if ( false === $id ) { |
|
830 | + if (false === $id) { |
|
831 | 831 | return false; |
832 | 832 | } |
833 | 833 | |
834 | - $current_context[ $slug ] = $id; |
|
834 | + $current_context[$slug] = $id; |
|
835 | 835 | |
836 | 836 | $slug = $context->get_parent_slug(); |
837 | 837 | } |
@@ -852,18 +852,18 @@ discard block |
||
852 | 852 | */ |
853 | 853 | function wordpoints_is_network_context() { |
854 | 854 | |
855 | - if ( is_network_admin() ) { |
|
855 | + if (is_network_admin()) { |
|
856 | 856 | return true; |
857 | 857 | } |
858 | 858 | |
859 | 859 | // See https://core.trac.wordpress.org/ticket/22589 |
860 | 860 | if ( |
861 | - defined( 'DOING_AJAX' ) |
|
861 | + defined('DOING_AJAX') |
|
862 | 862 | && DOING_AJAX |
863 | - && isset( $_SERVER['HTTP_REFERER'] ) |
|
863 | + && isset($_SERVER['HTTP_REFERER']) |
|
864 | 864 | && preg_match( |
865 | - '#^' . preg_quote( network_admin_url(), '#' ) . '#i' |
|
866 | - , esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) |
|
865 | + '#^'.preg_quote(network_admin_url(), '#').'#i' |
|
866 | + , esc_url_raw(wp_unslash($_SERVER['HTTP_REFERER'])) |
|
867 | 867 | ) |
868 | 868 | ) { |
869 | 869 | return true; |
@@ -876,19 +876,19 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @param bool $in_network_context Whether we are in network context. |
878 | 878 | */ |
879 | - return apply_filters( 'wordpoints_is_network_context', false ); |
|
879 | + return apply_filters('wordpoints_is_network_context', false); |
|
880 | 880 | } |
881 | 881 | |
882 | -function wordpoints_hooks_get_event_signature( WordPoints_Hook_Event_Args $event_args ) { |
|
882 | +function wordpoints_hooks_get_event_signature(WordPoints_Hook_Event_Args $event_args) { |
|
883 | 883 | |
884 | 884 | $entity = $event_args->get_primary_arg(); |
885 | 885 | |
886 | 886 | // TODO what if GUID isn't set? |
887 | - if ( ! $entity ) { |
|
888 | - return str_repeat( '-', 64 ); |
|
887 | + if ( ! $entity) { |
|
888 | + return str_repeat('-', 64); |
|
889 | 889 | } |
890 | 890 | |
891 | - return wordpoints_hash( wp_json_encode( $entity->get_the_guid() ) ); |
|
891 | + return wordpoints_hash(wp_json_encode($entity->get_the_guid())); |
|
892 | 892 | } |
893 | 893 | |
894 | 894 | // EOF |