@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | protected function init() { |
48 | 48 | |
49 | 49 | $sub_apps = $this->sub_apps; |
50 | - $sub_apps->register( 'router', 'WordPoints_Hook_Router' ); |
|
51 | - $sub_apps->register( 'actions', 'WordPoints_Hook_Actions' ); |
|
52 | - $sub_apps->register( 'events', 'WordPoints_Hook_Events' ); |
|
53 | - $sub_apps->register( 'firers', 'WordPoints_Class_Registry_Persistent' ); |
|
54 | - $sub_apps->register( 'reactors', 'WordPoints_Class_Registry_Persistent' ); |
|
55 | - $sub_apps->register( 'reaction_groups', 'WordPoints_Class_Registry_Children' ); |
|
56 | - $sub_apps->register( 'extensions', 'WordPoints_Class_Registry_Persistent' ); |
|
57 | - $sub_apps->register( 'conditions', 'WordPoints_Class_Registry_Children' ); |
|
50 | + $sub_apps->register('router', 'WordPoints_Hook_Router'); |
|
51 | + $sub_apps->register('actions', 'WordPoints_Hook_Actions'); |
|
52 | + $sub_apps->register('events', 'WordPoints_Hook_Events'); |
|
53 | + $sub_apps->register('firers', 'WordPoints_Class_Registry_Persistent'); |
|
54 | + $sub_apps->register('reactors', 'WordPoints_Class_Registry_Persistent'); |
|
55 | + $sub_apps->register('reaction_groups', 'WordPoints_Class_Registry_Children'); |
|
56 | + $sub_apps->register('extensions', 'WordPoints_Class_Registry_Persistent'); |
|
57 | + $sub_apps->register('conditions', 'WordPoints_Class_Registry_Children'); |
|
58 | 58 | |
59 | 59 | parent::init(); |
60 | 60 | } |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function get_current_mode() { |
79 | 79 | |
80 | - if ( ! isset( $this->current_mode ) ) { |
|
81 | - $this->current_mode = ( wordpoints_is_network_context() ? 'network' : 'standard' ); |
|
80 | + if ( ! isset($this->current_mode)) { |
|
81 | + $this->current_mode = (wordpoints_is_network_context() ? 'network' : 'standard'); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $this->current_mode; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @param string $mode The slug of the mode to set as the current mode. |
98 | 98 | */ |
99 | - public function set_current_mode( $mode ) { |
|
99 | + public function set_current_mode($mode) { |
|
100 | 100 | $this->current_mode = $mode; |
101 | 101 | } |
102 | 102 | } |
@@ -65,15 +65,15 @@ discard block |
||
65 | 65 | WordPoints_Hook_Event_Args $event_args |
66 | 66 | ) { |
67 | 67 | |
68 | - if ( ! isset( $settings[ $this->slug ] ) ) { |
|
68 | + if ( ! isset($settings[$this->slug])) { |
|
69 | 69 | return $settings; |
70 | 70 | } |
71 | 71 | |
72 | 72 | $this->validator = $validator; |
73 | 73 | $this->event_args = $event_args; |
74 | 74 | |
75 | - $this->validator->push_field( $this->slug ); |
|
76 | - $settings[ $this->slug ] = $this->{"validate_{$this->slug}"}( $settings[ $this->slug ] ); |
|
75 | + $this->validator->push_field($this->slug); |
|
76 | + $settings[$this->slug] = $this->{"validate_{$this->slug}"}($settings[$this->slug]); |
|
77 | 77 | $this->validator->pop_field(); |
78 | 78 | |
79 | 79 | return $settings; |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * @since 1.0.0 |
84 | 84 | */ |
85 | - public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) { |
|
85 | + public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) { |
|
86 | 86 | |
87 | - if ( isset( $settings[ $this->slug ] ) ) { |
|
88 | - $reaction->update_meta( $this->slug, $settings[ $this->slug ] ); |
|
87 | + if (isset($settings[$this->slug])) { |
|
88 | + $reaction->update_meta($this->slug, $settings[$this->slug]); |
|
89 | 89 | } else { |
90 | - $reaction->delete_meta( $this->slug ); |
|
90 | + $reaction->delete_meta($this->slug); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return bool Whether the target should be hit by this hook firing. |
102 | 102 | */ |
103 | - abstract public function should_hit( WordPoints_Hook_Fire $fire ); |
|
103 | + abstract public function should_hit(WordPoints_Hook_Fire $fire); |
|
104 | 104 | |
105 | 105 | /** |
106 | 106 | * After a reaction has hit the target. |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @param WordPoints_Hook_Fire $fire The hook fire object. |
111 | 111 | */ |
112 | - public function after_hit( WordPoints_Hook_Fire $fire ) {} |
|
112 | + public function after_hit(WordPoints_Hook_Fire $fire) {} |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * Called after a reverse action is called. |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @param WordPoints_Hook_Fire $fire The reverse fire object. |
120 | 120 | */ |
121 | - public function after_reverse( WordPoints_Hook_Fire $fire ) {} |
|
121 | + public function after_reverse(WordPoints_Hook_Fire $fire) {} |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Get the data the scripts need for the UI. |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | |
43 | 43 | $conditions_data = array(); |
44 | 44 | |
45 | - foreach ( $this->conditions->get_all() as $data_type => $conditions ) { |
|
46 | - foreach ( $conditions as $slug => $condition ) { |
|
45 | + foreach ($this->conditions->get_all() as $data_type => $conditions) { |
|
46 | + foreach ($conditions as $slug => $condition) { |
|
47 | 47 | |
48 | - if ( ! ( $condition instanceof WordPoints_Hook_Condition ) ) { |
|
48 | + if ( ! ($condition instanceof WordPoints_Hook_Condition)) { |
|
49 | 49 | continue; |
50 | 50 | } |
51 | 51 | |
52 | - $conditions_data[ $data_type ][ $slug ] = array( |
|
52 | + $conditions_data[$data_type][$slug] = array( |
|
53 | 53 | 'slug' => $slug, |
54 | 54 | 'data_type' => $data_type, |
55 | 55 | 'title' => $condition->get_title(), |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | - return array( 'conditions' => $conditions_data ); |
|
61 | + return array('conditions' => $conditions_data); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -70,31 +70,31 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return array The validated settings. |
72 | 72 | */ |
73 | - protected function validate_conditions( $args ) { |
|
73 | + protected function validate_conditions($args) { |
|
74 | 74 | |
75 | - if ( ! is_array( $args ) ) { |
|
75 | + if ( ! is_array($args)) { |
|
76 | 76 | |
77 | 77 | $this->validator->add_error( |
78 | - __( 'Conditions do not match expected format.', 'wordpoints' ) |
|
78 | + __('Conditions do not match expected format.', 'wordpoints') |
|
79 | 79 | ); |
80 | 80 | |
81 | 81 | return array(); |
82 | 82 | } |
83 | 83 | |
84 | - foreach ( $args as $arg_slug => $sub_args ) { |
|
84 | + foreach ($args as $arg_slug => $sub_args) { |
|
85 | 85 | |
86 | - if ( '_conditions' === $arg_slug ) { |
|
86 | + if ('_conditions' === $arg_slug) { |
|
87 | 87 | |
88 | - $this->validator->push_field( $arg_slug ); |
|
88 | + $this->validator->push_field($arg_slug); |
|
89 | 89 | |
90 | - foreach ( $sub_args as $index => $settings ) { |
|
90 | + foreach ($sub_args as $index => $settings) { |
|
91 | 91 | |
92 | - $this->validator->push_field( $index ); |
|
92 | + $this->validator->push_field($index); |
|
93 | 93 | |
94 | - $condition = $this->validate_condition( $settings ); |
|
94 | + $condition = $this->validate_condition($settings); |
|
95 | 95 | |
96 | - if ( $condition ) { |
|
97 | - $sub_args[ $index ] = $condition; |
|
96 | + if ($condition) { |
|
97 | + $sub_args[$index] = $condition; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $this->validator->pop_field(); |
@@ -104,18 +104,18 @@ discard block |
||
104 | 104 | |
105 | 105 | } else { |
106 | 106 | |
107 | - if ( ! $this->event_args->descend( $arg_slug ) ) { |
|
107 | + if ( ! $this->event_args->descend($arg_slug)) { |
|
108 | 108 | continue; |
109 | 109 | } |
110 | 110 | |
111 | - $sub_args = $this->validate_conditions( $sub_args ); |
|
111 | + $sub_args = $this->validate_conditions($sub_args); |
|
112 | 112 | |
113 | - $args[ $arg_slug ] = $sub_args; |
|
113 | + $args[$arg_slug] = $sub_args; |
|
114 | 114 | |
115 | 115 | $this->event_args->ascend(); |
116 | 116 | } |
117 | 117 | |
118 | - $args[ $arg_slug ] = $sub_args; |
|
118 | + $args[$arg_slug] = $sub_args; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | return $args; |
@@ -131,32 +131,32 @@ discard block |
||
131 | 131 | * @return array|false The validated conditions settings, or false if unable to |
132 | 132 | * validate. |
133 | 133 | */ |
134 | - protected function validate_condition( $settings ) { |
|
134 | + protected function validate_condition($settings) { |
|
135 | 135 | |
136 | - if ( ! isset( $settings['type'] ) ) { |
|
137 | - $this->validator->add_error( __( 'Condition type is missing.', 'wordpoints' ) ); |
|
136 | + if ( ! isset($settings['type'])) { |
|
137 | + $this->validator->add_error(__('Condition type is missing.', 'wordpoints')); |
|
138 | 138 | return false; |
139 | 139 | } |
140 | 140 | |
141 | 141 | $arg = $this->event_args->get_current(); |
142 | 142 | |
143 | - $data_type = $this->get_data_type( $arg ); |
|
143 | + $data_type = $this->get_data_type($arg); |
|
144 | 144 | |
145 | - if ( ! $data_type ) { |
|
145 | + if ( ! $data_type) { |
|
146 | 146 | $this->validator->add_error( |
147 | - __( 'This type of condition does not work for the selected attribute.', 'wordpoints' ) |
|
147 | + __('This type of condition does not work for the selected attribute.', 'wordpoints') |
|
148 | 148 | ); |
149 | 149 | |
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | |
153 | - $condition = wordpoints_hooks()->conditions->get( $data_type, $settings['type'] ); |
|
153 | + $condition = wordpoints_hooks()->conditions->get($data_type, $settings['type']); |
|
154 | 154 | |
155 | - if ( ! $condition ) { |
|
155 | + if ( ! $condition) { |
|
156 | 156 | |
157 | 157 | $this->validator->add_error( |
158 | 158 | sprintf( |
159 | - __( 'Unknown condition type “%s”.', 'wordpoints' ) |
|
159 | + __('Unknown condition type “%s”.', 'wordpoints') |
|
160 | 160 | , $settings['type'] |
161 | 161 | ) |
162 | 162 | , 'type' |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | return false; |
166 | 166 | } |
167 | 167 | |
168 | - if ( ! isset( $settings['settings'] ) ) { |
|
169 | - $this->validator->add_error( __( 'Condition settings are missing.', 'wordpoints' ) ); |
|
168 | + if ( ! isset($settings['settings'])) { |
|
169 | + $this->validator->add_error(__('Condition settings are missing.', 'wordpoints')); |
|
170 | 170 | return false; |
171 | 171 | } |
172 | 172 | |
173 | - $this->validator->push_field( 'settings' ); |
|
173 | + $this->validator->push_field('settings'); |
|
174 | 174 | |
175 | 175 | // The condition may call this object's validate_settings() method to |
176 | 176 | // validate some sub-conditions. When that happens, these properties will be |
177 | 177 | // reset, so we need to back up their values and then restore them below. |
178 | - $backup = array( $this->validator, $this->event_args ); |
|
178 | + $backup = array($this->validator, $this->event_args); |
|
179 | 179 | |
180 | 180 | $settings['settings'] = $condition->validate_settings( |
181 | 181 | $arg |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | , $this->validator |
184 | 184 | ); |
185 | 185 | |
186 | - list( $this->validator, $this->event_args ) = $backup; |
|
186 | + list($this->validator, $this->event_args) = $backup; |
|
187 | 187 | |
188 | 188 | $this->validator->pop_field(); |
189 | 189 | |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | /** |
194 | 194 | * @since 1.0.0 |
195 | 195 | */ |
196 | - public function should_hit( WordPoints_Hook_Fire $fire ) { |
|
196 | + public function should_hit(WordPoints_Hook_Fire $fire) { |
|
197 | 197 | |
198 | - $conditions = $fire->reaction->get_meta( 'conditions' ); |
|
198 | + $conditions = $fire->reaction->get_meta('conditions'); |
|
199 | 199 | |
200 | - if ( $conditions && ! $this->conditions_are_met( $conditions, $fire->event_args ) ) { |
|
200 | + if ($conditions && ! $this->conditions_are_met($conditions, $fire->event_args)) { |
|
201 | 201 | return false; |
202 | 202 | } |
203 | 203 | |
@@ -219,35 +219,35 @@ discard block |
||
219 | 219 | WordPoints_Hook_Event_Args $event_args |
220 | 220 | ) { |
221 | 221 | |
222 | - foreach ( $conditions as $arg_slug => $sub_args ) { |
|
222 | + foreach ($conditions as $arg_slug => $sub_args) { |
|
223 | 223 | |
224 | - $event_args->descend( $arg_slug ); |
|
224 | + $event_args->descend($arg_slug); |
|
225 | 225 | |
226 | - if ( isset( $sub_args['_conditions'] ) ) { |
|
226 | + if (isset($sub_args['_conditions'])) { |
|
227 | 227 | |
228 | - foreach ( $sub_args['_conditions'] as $settings ) { |
|
228 | + foreach ($sub_args['_conditions'] as $settings) { |
|
229 | 229 | |
230 | 230 | $condition = $this->conditions->get( |
231 | - $this->get_data_type( $event_args->get_current() ) |
|
231 | + $this->get_data_type($event_args->get_current()) |
|
232 | 232 | , $settings['type'] |
233 | 233 | ); |
234 | 234 | |
235 | - $is_met = $condition->is_met( $settings['settings'], $event_args ); |
|
235 | + $is_met = $condition->is_met($settings['settings'], $event_args); |
|
236 | 236 | |
237 | - if ( ! $is_met ) { |
|
237 | + if ( ! $is_met) { |
|
238 | 238 | $event_args->ascend(); |
239 | 239 | return false; |
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
243 | - unset( $sub_args['_conditions'] ); |
|
243 | + unset($sub_args['_conditions']); |
|
244 | 244 | } |
245 | 245 | |
246 | - $are_met = $this->conditions_are_met( $sub_args, $event_args ); |
|
246 | + $are_met = $this->conditions_are_met($sub_args, $event_args); |
|
247 | 247 | |
248 | 248 | $event_args->ascend(); |
249 | 249 | |
250 | - if ( ! $are_met ) { |
|
250 | + if ( ! $are_met) { |
|
251 | 251 | return false; |
252 | 252 | } |
253 | 253 | } |
@@ -264,13 +264,13 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @return string|false The data type, or false. |
266 | 266 | */ |
267 | - protected function get_data_type( $arg ) { |
|
267 | + protected function get_data_type($arg) { |
|
268 | 268 | |
269 | - if ( $arg instanceof WordPoints_Entity_Attr ) { |
|
269 | + if ($arg instanceof WordPoints_Entity_Attr) { |
|
270 | 270 | $data_type = $arg->get_data_type(); |
271 | - } elseif ( $arg instanceof WordPoints_Entity_Array ) { |
|
271 | + } elseif ($arg instanceof WordPoints_Entity_Array) { |
|
272 | 272 | $data_type = 'entity_array'; |
273 | - } elseif ( $arg instanceof WordPoints_Entity ) { |
|
273 | + } elseif ($arg instanceof WordPoints_Entity) { |
|
274 | 274 | $data_type = 'entity'; |
275 | 275 | } else { |
276 | 276 | $data_type = false; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * @since 1.0.0 |
28 | 28 | */ |
29 | - public function __construct( $slug ) { |
|
29 | + public function __construct($slug) { |
|
30 | 30 | $this->slug = $slug; |
31 | 31 | } |
32 | 32 | |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @since 1.0.0 |
42 | 42 | */ |
43 | - public function do_event( $event_slug, WordPoints_Hook_Event_Args $event_args ) { |
|
43 | + public function do_event($event_slug, WordPoints_Hook_Event_Args $event_args) { |
|
44 | 44 | |
45 | 45 | $hooks = wordpoints_hooks(); |
46 | 46 | |
47 | 47 | /** @var WordPoints_Hook_Reactor $reactor */ |
48 | - foreach ( $hooks->reactors->get_all() as $reactor ) { |
|
48 | + foreach ($hooks->reactors->get_all() as $reactor) { |
|
49 | 49 | |
50 | - foreach ( $reactor->get_all_reactions_to_event( $event_slug ) as $reaction ) { |
|
50 | + foreach ($reactor->get_all_reactions_to_event($event_slug) as $reaction) { |
|
51 | 51 | |
52 | 52 | $validator = new WordPoints_Hook_Reaction_Validator( |
53 | 53 | $reaction |
@@ -57,29 +57,29 @@ discard block |
||
57 | 57 | |
58 | 58 | $validator->validate(); |
59 | 59 | |
60 | - if ( $validator->had_errors() ) { |
|
60 | + if ($validator->had_errors()) { |
|
61 | 61 | continue; |
62 | 62 | } |
63 | 63 | |
64 | - unset( $validator ); |
|
64 | + unset($validator); |
|
65 | 65 | |
66 | - $fire = new WordPoints_Hook_Fire( $this, $event_args, $reaction ); |
|
66 | + $fire = new WordPoints_Hook_Fire($this, $event_args, $reaction); |
|
67 | 67 | |
68 | 68 | /** @var WordPoints_Hook_Extension[] $extensions */ |
69 | 69 | $extensions = $hooks->extensions->get_all(); |
70 | 70 | |
71 | - foreach ( $extensions as $extension ) { |
|
72 | - if ( ! $extension->should_hit( $fire ) ) { |
|
71 | + foreach ($extensions as $extension) { |
|
72 | + if ( ! $extension->should_hit($fire)) { |
|
73 | 73 | continue 2; |
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | 77 | $fire->hit(); |
78 | 78 | |
79 | - $reactor->hit( $fire ); |
|
79 | + $reactor->hit($fire); |
|
80 | 80 | |
81 | - foreach ( $extensions as $extension ) { |
|
82 | - $extension->after_hit( $fire ); |
|
81 | + foreach ($extensions as $extension) { |
|
82 | + $extension->after_hit($fire); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * @since 1.0.0 |
55 | 55 | */ |
56 | - public function __get( $var ) { |
|
56 | + public function __get($var) { |
|
57 | 57 | |
58 | - if ( 'reactions' !== $var ) { |
|
58 | + if ('reactions' !== $var) { |
|
59 | 59 | return null; |
60 | 60 | } |
61 | 61 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | wordpoints_hooks()->get_current_mode() |
64 | 64 | ); |
65 | 65 | |
66 | - if ( ! $reaction_group ) { |
|
66 | + if ( ! $reaction_group) { |
|
67 | 67 | return null; |
68 | 68 | } |
69 | 69 | |
@@ -79,20 +79,20 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return WordPoints_Hook_Reaction_StorageI|false The reaction storage object. |
81 | 81 | */ |
82 | - public function get_reaction_group( $slug ) { |
|
82 | + public function get_reaction_group($slug) { |
|
83 | 83 | |
84 | 84 | $reaction_group = wordpoints_hooks()->reaction_groups->get( |
85 | 85 | $this->slug |
86 | 86 | , $slug |
87 | - , array( $this ) |
|
87 | + , array($this) |
|
88 | 88 | ); |
89 | 89 | |
90 | - if ( ! $reaction_group instanceof WordPoints_Hook_Reaction_StorageI ) { |
|
90 | + if ( ! $reaction_group instanceof WordPoints_Hook_Reaction_StorageI) { |
|
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | |
94 | 94 | // Allowing access to groups out-of-context would lead to strange behavior. |
95 | - if ( false === $reaction_group->get_context_id() ) { |
|
95 | + if (false === $reaction_group->get_context_id()) { |
|
96 | 96 | return false; |
97 | 97 | } |
98 | 98 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return WordPoints_Hook_ReactionI[] All of the reaction objects. |
168 | 168 | */ |
169 | - public function get_all_reactions_to_event( $event_slug ) { |
|
169 | + public function get_all_reactions_to_event($event_slug) { |
|
170 | 170 | |
171 | 171 | $reactions = array(); |
172 | 172 | |
@@ -174,17 +174,17 @@ discard block |
||
174 | 174 | $this->slug |
175 | 175 | ); |
176 | 176 | |
177 | - foreach ( $slugs as $slug ) { |
|
177 | + foreach ($slugs as $slug) { |
|
178 | 178 | |
179 | - $storage = $this->get_reaction_group( $slug ); |
|
179 | + $storage = $this->get_reaction_group($slug); |
|
180 | 180 | |
181 | - if ( ! $storage ) { |
|
181 | + if ( ! $storage) { |
|
182 | 182 | continue; |
183 | 183 | } |
184 | 184 | |
185 | 185 | $reactions = array_merge( |
186 | 186 | $reactions |
187 | - , $storage->get_reactions_to_event( $event_slug ) |
|
187 | + , $storage->get_reactions_to_event($event_slug) |
|
188 | 188 | ); |
189 | 189 | } |
190 | 190 | |
@@ -213,15 +213,15 @@ discard block |
||
213 | 213 | $this->slug |
214 | 214 | ); |
215 | 215 | |
216 | - foreach ( $slugs as $slug ) { |
|
216 | + foreach ($slugs as $slug) { |
|
217 | 217 | |
218 | - $storage = $this->get_reaction_group( $slug ); |
|
218 | + $storage = $this->get_reaction_group($slug); |
|
219 | 219 | |
220 | - if ( ! $storage ) { |
|
220 | + if ( ! $storage) { |
|
221 | 221 | continue; |
222 | 222 | } |
223 | 223 | |
224 | - $reactions = array_merge( $reactions, $storage->get_reactions() ); |
|
224 | + $reactions = array_merge($reactions, $storage->get_reactions()); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | return $reactions; |
@@ -237,21 +237,21 @@ discard block |
||
237 | 237 | ) { |
238 | 238 | |
239 | 239 | if ( |
240 | - empty( $settings['target'] ) |
|
241 | - || ! is_array( $settings['target'] ) |
|
240 | + empty($settings['target']) |
|
241 | + || ! is_array($settings['target']) |
|
242 | 242 | ) { |
243 | 243 | |
244 | - $validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' ); |
|
244 | + $validator->add_error(__('Invalid target.', 'wordpoints'), 'target'); |
|
245 | 245 | |
246 | 246 | } else { |
247 | 247 | |
248 | - $target = $event_args->get_from_hierarchy( $settings['target'] ); |
|
248 | + $target = $event_args->get_from_hierarchy($settings['target']); |
|
249 | 249 | |
250 | 250 | if ( |
251 | 251 | ! $target instanceof WordPoints_Entity |
252 | - || ! in_array( $target->get_slug(), (array) $this->arg_types ) |
|
252 | + || ! in_array($target->get_slug(), (array) $this->arg_types) |
|
253 | 253 | ) { |
254 | - $validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' ); |
|
254 | + $validator->add_error(__('Invalid target.', 'wordpoints'), 'target'); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | /** |
262 | 262 | * @since 1.0.0 |
263 | 263 | */ |
264 | - public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) { |
|
265 | - $reaction->update_meta( 'target', $settings['target'] ); |
|
264 | + public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) { |
|
265 | + $reaction->update_meta('target', $settings['target']); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @param WordPoints_Hook_Fire $fire The hook fire object. |
274 | 274 | */ |
275 | - abstract public function hit( WordPoints_Hook_Fire $fire ); |
|
275 | + abstract public function hit(WordPoints_Hook_Fire $fire); |
|
276 | 276 | |
277 | 277 | /** |
278 | 278 | * Reverses all hits matching this event and args. |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @param WordPoints_Hook_Fire $fire The reverse fire object. |
283 | 283 | */ |
284 | - abstract public function reverse_hit( WordPoints_Hook_Fire $fire ); |
|
284 | + abstract public function reverse_hit(WordPoints_Hook_Fire $fire); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | // EOF |
@@ -10,108 +10,108 @@ |
||
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/fire.php' ); |
|
88 | -require_once( dirname( __FILE__ ) . 'hook/firer.php' ); |
|
89 | -require_once( dirname( __FILE__ ) . 'hook/firer/reverse.php' ); |
|
90 | -require_once( dirname( __FILE__ ) . 'hook/fireri.php' ); |
|
91 | -require_once( dirname( __FILE__ ) . 'hook/hit/logger.php' ); |
|
92 | -require_once( dirname( __FILE__ ) . 'hook/reaction.php' ); |
|
93 | -require_once( dirname( __FILE__ ) . 'hook/reaction/options.php' ); |
|
94 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storage.php' ); |
|
95 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storage/options.php' ); |
|
96 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storage/options/network.php' ); |
|
97 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storagei.php' ); |
|
98 | -require_once( dirname( __FILE__ ) . 'hook/reaction/validator.php' ); |
|
99 | -require_once( dirname( __FILE__ ) . 'hook/reactioni.php' ); |
|
100 | -require_once( dirname( __FILE__ ) . 'hook/reactor.php' ); |
|
101 | -require_once( dirname( __FILE__ ) . 'hook/reactor/points.php' ); |
|
102 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/conditions.php' ); |
|
103 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/query.php' ); |
|
104 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/query/modifieri.php' ); |
|
105 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/queryable.php' ); |
|
106 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/queryi.php' ); |
|
107 | -require_once( dirname( __FILE__ ) . 'hook/router.php' ); |
|
108 | -require_once( dirname( __FILE__ ) . 'hook/settings.php' ); |
|
109 | -require_once( dirname( __FILE__ ) . 'hook/settingsi.php' ); |
|
110 | -require_once( dirname( __FILE__ ) . 'hook/validator/exception.php' ); |
|
111 | -require_once( dirname( __FILE__ ) . 'hooks.php' ); |
|
112 | -require_once( dirname( __FILE__ ) . 'query/builder/db/mysql.php' ); |
|
113 | -require_once( dirname( __FILE__ ) . 'spec.php' ); |
|
114 | -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/fire.php'); |
|
88 | +require_once(dirname(__FILE__).'hook/firer.php'); |
|
89 | +require_once(dirname(__FILE__).'hook/firer/reverse.php'); |
|
90 | +require_once(dirname(__FILE__).'hook/fireri.php'); |
|
91 | +require_once(dirname(__FILE__).'hook/hit/logger.php'); |
|
92 | +require_once(dirname(__FILE__).'hook/reaction.php'); |
|
93 | +require_once(dirname(__FILE__).'hook/reaction/options.php'); |
|
94 | +require_once(dirname(__FILE__).'hook/reaction/storage.php'); |
|
95 | +require_once(dirname(__FILE__).'hook/reaction/storage/options.php'); |
|
96 | +require_once(dirname(__FILE__).'hook/reaction/storage/options/network.php'); |
|
97 | +require_once(dirname(__FILE__).'hook/reaction/storagei.php'); |
|
98 | +require_once(dirname(__FILE__).'hook/reaction/validator.php'); |
|
99 | +require_once(dirname(__FILE__).'hook/reactioni.php'); |
|
100 | +require_once(dirname(__FILE__).'hook/reactor.php'); |
|
101 | +require_once(dirname(__FILE__).'hook/reactor/points.php'); |
|
102 | +require_once(dirname(__FILE__).'hook/retroactive/conditions.php'); |
|
103 | +require_once(dirname(__FILE__).'hook/retroactive/query.php'); |
|
104 | +require_once(dirname(__FILE__).'hook/retroactive/query/modifieri.php'); |
|
105 | +require_once(dirname(__FILE__).'hook/retroactive/queryable.php'); |
|
106 | +require_once(dirname(__FILE__).'hook/retroactive/queryi.php'); |
|
107 | +require_once(dirname(__FILE__).'hook/router.php'); |
|
108 | +require_once(dirname(__FILE__).'hook/settings.php'); |
|
109 | +require_once(dirname(__FILE__).'hook/settingsi.php'); |
|
110 | +require_once(dirname(__FILE__).'hook/validator/exception.php'); |
|
111 | +require_once(dirname(__FILE__).'hooks.php'); |
|
112 | +require_once(dirname(__FILE__).'query/builder/db/mysql.php'); |
|
113 | +require_once(dirname(__FILE__).'spec.php'); |
|
114 | +require_once(dirname(__FILE__).'specedi.php'); |
|
115 | 115 | // } |
116 | 116 | |
117 | 117 | // EOF |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | global $wpdb; |
11 | 11 | |
12 | -$wpdb->wordpoints_hook_hits = $wpdb->base_prefix . 'wordpoints_hook_hits'; |
|
13 | -$wpdb->wordpoints_hook_periods = $wpdb->base_prefix . 'wordpoints_hook_periods'; |
|
12 | +$wpdb->wordpoints_hook_hits = $wpdb->base_prefix.'wordpoints_hook_hits'; |
|
13 | +$wpdb->wordpoints_hook_periods = $wpdb->base_prefix.'wordpoints_hook_periods'; |
|
14 | 14 | |
15 | 15 | // EOF |
@@ -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 | // |
@@ -231,15 +231,15 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @return string|int|float|false The human identifier for the entity, or false. |
233 | 233 | */ |
234 | - public function get_human_id( $id ) { |
|
234 | + public function get_human_id($id) { |
|
235 | 235 | |
236 | - $entity = $this->get_entity( $id ); |
|
236 | + $entity = $this->get_entity($id); |
|
237 | 237 | |
238 | - if ( ! $entity ) { |
|
238 | + if ( ! $entity) { |
|
239 | 239 | return false; |
240 | 240 | } |
241 | 241 | |
242 | - return $this->get_entity_human_id( $entity ); |
|
242 | + return $this->get_entity_human_id($entity); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -251,8 +251,8 @@ discard block |
||
251 | 251 | * |
252 | 252 | * @return bool Whether or not an entity with that ID exists. |
253 | 253 | */ |
254 | - public function exists( $id ) { |
|
255 | - return (bool) $this->get_entity( $id ); |
|
254 | + public function exists($id) { |
|
255 | + return (bool) $this->get_entity($id); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -267,17 +267,17 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @return WordPoints_Entityish|false The child's object, or false if not found. |
269 | 269 | */ |
270 | - public function get_child( $child_slug ) { |
|
270 | + public function get_child($child_slug) { |
|
271 | 271 | |
272 | 272 | $children = wordpoints_entities()->children; |
273 | 273 | |
274 | - $child = $children->get( $this->slug, $child_slug ); |
|
274 | + $child = $children->get($this->slug, $child_slug); |
|
275 | 275 | |
276 | 276 | if ( |
277 | - isset( $this->the_value ) |
|
277 | + isset($this->the_value) |
|
278 | 278 | && $child instanceof WordPoints_Entity_ChildI |
279 | 279 | ) { |
280 | - $child->set_the_value_from_entity( $this ); |
|
280 | + $child->set_the_value_from_entity($this); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | return $child; |
@@ -299,20 +299,20 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @return bool Whether the value was set. |
301 | 301 | */ |
302 | - public function set_the_value( $value ) { |
|
302 | + public function set_the_value($value) { |
|
303 | 303 | |
304 | 304 | $this->the_value = $this->the_entity = $this->the_context = null; |
305 | 305 | |
306 | - if ( $this->is_entity( $value ) ) { |
|
306 | + if ($this->is_entity($value)) { |
|
307 | 307 | |
308 | 308 | $entity = $value; |
309 | - $value = $this->get_entity_id( $value ); |
|
309 | + $value = $this->get_entity_id($value); |
|
310 | 310 | |
311 | 311 | } else { |
312 | 312 | |
313 | - $entity = $this->get_entity( $value ); |
|
313 | + $entity = $this->get_entity($value); |
|
314 | 314 | |
315 | - if ( ! $entity ) { |
|
315 | + if ( ! $entity) { |
|
316 | 316 | return false; |
317 | 317 | } |
318 | 318 | } |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @return mixed The value of the attribute. |
337 | 337 | */ |
338 | - public function get_the_attr_value( $attr ) { |
|
339 | - return $this->get_attr_value( $this->the_entity, $attr ); |
|
338 | + public function get_the_attr_value($attr) { |
|
339 | + return $this->get_attr_value($this->the_entity, $attr); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | /** |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @return string|int|float|null The human identifier for the entity, or null. |
361 | 361 | */ |
362 | 362 | public function get_the_human_id() { |
363 | - return $this->get_entity_human_id( $this->the_entity ); |
|
363 | + return $this->get_entity_human_id($this->the_entity); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | |
395 | 395 | $guid = $this->get_the_context(); |
396 | 396 | |
397 | - if ( ! is_array( $guid ) ) { |
|
397 | + if ( ! is_array($guid)) { |
|
398 | 398 | return $guid; |
399 | 399 | } |
400 | 400 | |
401 | - $guid = array( $this->slug => $this->get_the_id() ) + $guid; |
|
401 | + $guid = array($this->slug => $this->get_the_id()) + $guid; |
|
402 | 402 | |
403 | 403 | return $guid; |
404 | 404 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->firer = $firer; |
85 | 85 | $this->event_args = $event_args; |
86 | 86 | $this->reaction = $reaction; |
87 | - $this->hit_logger = new WordPoints_Hook_Hit_Logger( $this ); |
|
87 | + $this->hit_logger = new WordPoints_Hook_Hit_Logger($this); |
|
88 | 88 | $this->supersedes = $supersedes; |
89 | 89 | } |
90 | 90 | |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function hit() { |
99 | 99 | |
100 | - if ( ! $this->hit_id ) { |
|
100 | + if ( ! $this->hit_id) { |
|
101 | 101 | |
102 | 102 | $this->hit_id = $this->hit_logger->log_hit(); |
103 | 103 | |
104 | - if ( ! $this->hit_id ) { |
|
104 | + if ( ! $this->hit_id) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function get_superseded_hit() { |
122 | 122 | |
123 | - if ( isset( $this->supersedes ) ) { |
|
123 | + if (isset($this->supersedes)) { |
|
124 | 124 | return $this->supersedes; |
125 | 125 | } |
126 | 126 | |
@@ -141,16 +141,16 @@ discard block |
||
141 | 141 | AND `superseded_by` IS NULL |
142 | 142 | " |
143 | 143 | , $this->firer->get_slug() |
144 | - , wordpoints_hooks_get_event_primary_arg_guid_json( $this->event_args ) |
|
144 | + , wordpoints_hooks_get_event_primary_arg_guid_json($this->event_args) |
|
145 | 145 | , $this->reaction->get_event_slug() |
146 | 146 | , $this->reaction->get_reactor_slug() |
147 | 147 | , $this->reaction->get_storage_group_slug() |
148 | - , wp_json_encode( $this->reaction->get_context_id() ) |
|
148 | + , wp_json_encode($this->reaction->get_context_id()) |
|
149 | 149 | , $this->reaction->ID |
150 | 150 | ) |
151 | 151 | ); |
152 | 152 | |
153 | - $this->supersedes = ( $hit ) ? $hit : false; |
|
153 | + $this->supersedes = ($hit) ? $hit : false; |
|
154 | 154 | |
155 | 155 | return $this->supersedes; |
156 | 156 | } |