@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function get_value() { |
26 | 26 | |
27 | - if ( wordpoints_is_network_context() ) { |
|
27 | + if (wordpoints_is_network_context()) { |
|
28 | 28 | return false; |
29 | 29 | } |
30 | 30 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @since 1.0.0 |
36 | 36 | */ |
37 | 37 | public function get_title() { |
38 | - return __( 'Site', 'wordpoints' ); |
|
38 | + return __('Site', 'wordpoints'); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 |
@@ -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 | } |
@@ -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 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * @param WordPoints_Hook_Fire $fire The fire that might be logged as a hit. |
28 | 28 | */ |
29 | - public function __construct( WordPoints_Hook_Fire $fire ) { |
|
29 | + public function __construct(WordPoints_Hook_Fire $fire) { |
|
30 | 30 | |
31 | 31 | $this->fire = $fire; |
32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | global $wpdb; |
44 | 44 | |
45 | - $signature = wordpoints_hooks_get_event_primary_arg_guid_json( $this->fire->event_args ); |
|
45 | + $signature = wordpoints_hooks_get_event_primary_arg_guid_json($this->fire->event_args); |
|
46 | 46 | |
47 | 47 | $inserted = $wpdb->insert( |
48 | 48 | $wpdb->wordpoints_hook_hits |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | 'event' => $this->fire->reaction->get_event_slug(), |
53 | 53 | 'reactor' => $this->fire->reaction->get_reactor_slug(), |
54 | 54 | 'reaction_type' => $this->fire->reaction->get_storage_group_slug(), |
55 | - 'reaction_context_id' => wp_json_encode( $this->fire->reaction->get_context_id() ), |
|
55 | + 'reaction_context_id' => wp_json_encode($this->fire->reaction->get_context_id()), |
|
56 | 56 | 'reaction_id' => $this->fire->reaction->ID, |
57 | - 'date' => current_time( 'mysql' ), |
|
57 | + 'date' => current_time('mysql'), |
|
58 | 58 | ) |
59 | 59 | ); |
60 | 60 | |
61 | - if ( ! $inserted ) { |
|
61 | + if ( ! $inserted) { |
|
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | |
67 | 67 | $supersedes = $this->fire->get_superseded_hit(); |
68 | 68 | |
69 | - if ( $supersedes ) { |
|
69 | + if ($supersedes) { |
|
70 | 70 | $wpdb->update( |
71 | 71 | $wpdb->wordpoints_hook_hits |
72 | - , array( 'superseded_by' => $hit_id ) |
|
73 | - , array( 'id' => $supersedes->id ) |
|
74 | - , array( '%d' ) |
|
75 | - , array( '%d' ) |
|
72 | + , array('superseded_by' => $hit_id) |
|
73 | + , array('id' => $supersedes->id) |
|
74 | + , array('%d') |
|
75 | + , array('%d') |
|
76 | 76 | ); |
77 | 77 | } |
78 | 78 |
@@ -16,16 +16,16 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param WordPoints_App $app The main WordPoints app. |
18 | 18 | */ |
19 | -function wordpoints_hooks_register_admin_apps( $app ) { |
|
19 | +function wordpoints_hooks_register_admin_apps($app) { |
|
20 | 20 | |
21 | 21 | $apps = $app->sub_apps; |
22 | 22 | |
23 | - $apps->register( 'admin', 'WordPoints_App' ); |
|
23 | + $apps->register('admin', 'WordPoints_App'); |
|
24 | 24 | |
25 | 25 | /** @var WordPoints_App $admin */ |
26 | - $admin = $apps->get( 'admin' ); |
|
26 | + $admin = $apps->get('admin'); |
|
27 | 27 | |
28 | - $admin->sub_apps->register( 'screen', 'WordPoints_Admin_Screens' ); |
|
28 | + $admin->sub_apps->register('screen', 'WordPoints_Admin_Screens'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | // Hooks page. |
47 | 47 | $id = add_submenu_page( |
48 | 48 | $wordpoints_menu |
49 | - , __( 'WordPoints — Points Types', 'wordpoints' ) |
|
50 | - , __( 'Points Types', 'wordpoints' ) |
|
49 | + , __('WordPoints — Points Types', 'wordpoints') |
|
50 | + , __('Points Types', 'wordpoints') |
|
51 | 51 | , 'manage_options' |
52 | 52 | , 'wordpoints_points_types' |
53 | - , array( $admin_screens, 'display' ) |
|
53 | + , array($admin_screens, 'display') |
|
54 | 54 | ); |
55 | 55 | |
56 | - if ( $id ) { |
|
57 | - $admin_screens->register( $id, 'WordPoints_Admin_Screen_Points_Types' ); |
|
56 | + if ($id) { |
|
57 | + $admin_screens->register($id, 'WordPoints_Admin_Screen_Points_Types'); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function wordpoints_hooks_admin_register_scripts() { |
69 | 69 | |
70 | - $assets_url = wordpoints_modules_url( '/assets', dirname( __FILE__ ) ); |
|
70 | + $assets_url = wordpoints_modules_url('/assets', dirname(__FILE__)); |
|
71 | 71 | |
72 | 72 | // CSS |
73 | 73 | |
74 | 74 | wp_register_style( |
75 | 75 | 'wordpoints-hooks-admin' |
76 | - , $assets_url . '/css/hooks.css' |
|
77 | - , array( 'dashicons', 'wp-jquery-ui-dialog' ) |
|
76 | + , $assets_url.'/css/hooks.css' |
|
77 | + , array('dashicons', 'wp-jquery-ui-dialog') |
|
78 | 78 | , WORDPOINTS_VERSION |
79 | 79 | ); |
80 | 80 | |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | |
83 | 83 | wp_register_script( |
84 | 84 | 'wordpoints-hooks-models' |
85 | - , $assets_url . '/js/hooks/models.js' |
|
86 | - , array( 'backbone', 'jquery-ui-dialog', 'wp-util' ) |
|
85 | + , $assets_url.'/js/hooks/models.js' |
|
86 | + , array('backbone', 'jquery-ui-dialog', 'wp-util') |
|
87 | 87 | , WORDPOINTS_VERSION |
88 | 88 | ); |
89 | 89 | |
90 | 90 | wp_register_script( |
91 | 91 | 'wordpoints-hooks-views' |
92 | - , $assets_url . '/js/hooks/views.js' |
|
93 | - , array( 'wordpoints-hooks-models' ) |
|
92 | + , $assets_url.'/js/hooks/views.js' |
|
93 | + , array('wordpoints-hooks-models') |
|
94 | 94 | , WORDPOINTS_VERSION |
95 | 95 | ); |
96 | 96 | |
@@ -98,16 +98,16 @@ discard block |
||
98 | 98 | 'wordpoints-hooks-views' |
99 | 99 | , 'WordPointsHooksAdminL10n' |
100 | 100 | , array( |
101 | - 'unexpectedError' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ), |
|
102 | - 'changesSaved' => __( 'Your changes have been saved.', 'wordpoints' ), |
|
101 | + 'unexpectedError' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'), |
|
102 | + 'changesSaved' => __('Your changes have been saved.', 'wordpoints'), |
|
103 | 103 | /* translators: the name of the field that cannot be empty */ |
104 | - 'emptyField' => sprintf( __( '%s cannot be empty.', 'wordpoints' ), '{{ data.label }}' ), |
|
105 | - 'confirmDelete' => __( 'Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints' ), |
|
106 | - 'confirmTitle' => __( 'Are you sure?', 'wordpoints' ), |
|
107 | - 'deleteText' => __( 'Delete', 'wordpoints' ), |
|
108 | - 'cancelText' => __( 'Cancel', 'wordpoints' ), |
|
109 | - 'separator' => __( ' » ', 'wordpoints' ), |
|
110 | - 'target_label' => __( 'Target', 'wordpoints' ), |
|
104 | + 'emptyField' => sprintf(__('%s cannot be empty.', 'wordpoints'), '{{ data.label }}'), |
|
105 | + 'confirmDelete' => __('Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints'), |
|
106 | + 'confirmTitle' => __('Are you sure?', 'wordpoints'), |
|
107 | + 'deleteText' => __('Delete', 'wordpoints'), |
|
108 | + 'cancelText' => __('Cancel', 'wordpoints'), |
|
109 | + 'separator' => __(' » ', 'wordpoints'), |
|
110 | + 'target_label' => __('Target', 'wordpoints'), |
|
111 | 111 | ) |
112 | 112 | ); |
113 | 113 | |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | <div class="view"> |
120 | 120 | <div class="title"></div> |
121 | 121 | <button type="button" class="edit button-secondary"> |
122 | - ' . esc_html__( 'Edit', 'wordpoints' ) . ' |
|
122 | + ' . esc_html__('Edit', 'wordpoints').' |
|
123 | 123 | </button> |
124 | 124 | <button type="button" class="close button-secondary"> |
125 | - ' . esc_html__( 'Close', 'wordpoints' ) . ' |
|
125 | + ' . esc_html__('Close', 'wordpoints').' |
|
126 | 126 | </button> |
127 | 127 | </div> |
128 | 128 | <div class="form"> |
@@ -141,16 +141,16 @@ discard block |
||
141 | 141 | </div> |
142 | 142 | <div class="action-buttons"> |
143 | 143 | <button type="button" class="save button-primary" disabled> |
144 | - ' . esc_html__( 'Save', 'wordpoints' ) . ' |
|
144 | + ' . esc_html__('Save', 'wordpoints').' |
|
145 | 145 | </button> |
146 | 146 | <button type="button" class="cancel button-secondary"> |
147 | - ' . esc_html__( 'Cancel', 'wordpoints' ) . ' |
|
147 | + ' . esc_html__('Cancel', 'wordpoints').' |
|
148 | 148 | </button> |
149 | 149 | <button type="button" class="close button-secondary"> |
150 | - ' . esc_html__( 'Close', 'wordpoints' ) . ' |
|
150 | + ' . esc_html__('Close', 'wordpoints').' |
|
151 | 151 | </button> |
152 | 152 | <button type="button" class="delete button-secondary"> |
153 | - ' . esc_html__( 'Delete', 'wordpoints' ) . ' |
|
153 | + ' . esc_html__('Delete', 'wordpoints').' |
|
154 | 154 | </button> |
155 | 155 | </div> |
156 | 156 | </div> |
@@ -198,15 +198,15 @@ discard block |
||
198 | 198 | |
199 | 199 | wp_register_script( |
200 | 200 | 'wordpoints-hooks-reactor-points' |
201 | - , $assets_url . '/js/hooks/reactors/points.js' |
|
202 | - , array( 'wordpoints-hooks-views' ) |
|
201 | + , $assets_url.'/js/hooks/reactors/points.js' |
|
202 | + , array('wordpoints-hooks-views') |
|
203 | 203 | , WORDPOINTS_VERSION |
204 | 204 | ); |
205 | 205 | |
206 | 206 | wp_register_script( |
207 | 207 | 'wordpoints-hooks-extension-conditions' |
208 | - , $assets_url . '/js/hooks/extensions/conditions.js' |
|
209 | - , array( 'wordpoints-hooks-views' ) |
|
208 | + , $assets_url.'/js/hooks/extensions/conditions.js' |
|
209 | + , array('wordpoints-hooks-views') |
|
210 | 210 | , WORDPOINTS_VERSION |
211 | 211 | ); |
212 | 212 | |
@@ -216,25 +216,25 @@ discard block |
||
216 | 216 | , ' |
217 | 217 | <script type="text/template" id="tmpl-wordpoints-hook-condition-groups"> |
218 | 218 | <div class="conditions-title section-title"> |
219 | - <h4>' . esc_html__( 'Conditions', 'wordpoints' ) . '</h4> |
|
219 | + <h4>' . esc_html__('Conditions', 'wordpoints').'</h4> |
|
220 | 220 | <button type="button" class="add-new button-secondary button-link"> |
221 | - <span class="screen-reader-text">' . esc_html__( 'Add New Condition', 'wordpoints' ) . '</span> |
|
221 | + <span class="screen-reader-text">' . esc_html__('Add New Condition', 'wordpoints').'</span> |
|
222 | 222 | <span class="dashicons dashicons-plus"></span> |
223 | 223 | </button> |
224 | 224 | </div> |
225 | 225 | <div class="add-condition-form hidden"> |
226 | 226 | <div class="no-conditions hidden"> |
227 | - ' . esc_html__( 'No conditions available.', 'wordpoints' ) . ' |
|
227 | + ' . esc_html__('No conditions available.', 'wordpoints').' |
|
228 | 228 | </div> |
229 | 229 | <div class="condition-selectors"> |
230 | 230 | <div class="arg-selectors"></div> |
231 | 231 | <div class="condition-selector"></div> |
232 | 232 | </div> |
233 | - <button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__( 'Add Condition', 'wordpoints' ) . '"> |
|
234 | - ' . esc_html_x( 'Add', 'reaction condition', 'wordpoints' ) . ' |
|
233 | + <button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__('Add Condition', 'wordpoints').'"> |
|
234 | + ' . esc_html_x('Add', 'reaction condition', 'wordpoints').' |
|
235 | 235 | </button> |
236 | - <button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__( 'Cancel Adding New Condition', 'wordpoints' ) . '"> |
|
237 | - ' . esc_html_x( 'Cancel', 'reaction condition', 'wordpoints' ) . ' |
|
236 | + <button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__('Cancel Adding New Condition', 'wordpoints').'"> |
|
237 | + ' . esc_html_x('Cancel', 'reaction condition', 'wordpoints').' |
|
238 | 238 | </button> |
239 | 239 | </div> |
240 | 240 | <div class="condition-groups section-content"></div> |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | <div class="condition-controls"> |
249 | 249 | <div class="condition-title"></div> |
250 | 250 | <button type="button" class="delete button-secondary button-link"> |
251 | - <span class="screen-reader-text">' . esc_html__( 'Remove Condition', 'wordpoints' ) . '</span> |
|
251 | + <span class="screen-reader-text">' . esc_html__('Remove Condition', 'wordpoints').'</span> |
|
252 | 252 | <span class="dashicons dashicons-no"></span> |
253 | 253 | </button> |
254 | 254 | </div> |
@@ -266,8 +266,8 @@ discard block |
||
266 | 266 | |
267 | 267 | wp_register_script( |
268 | 268 | 'wordpoints-hooks-extension-periods' |
269 | - , $assets_url . '/js/hooks/extensions/periods.js' |
|
270 | - , array( 'wordpoints-hooks-views' ) |
|
269 | + , $assets_url.'/js/hooks/extensions/periods.js' |
|
270 | + , array('wordpoints-hooks-views') |
|
271 | 271 | , WORDPOINTS_VERSION |
272 | 272 | ); |
273 | 273 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | , ' |
278 | 278 | <script type="text/template" id="tmpl-wordpoints-hook-periods"> |
279 | 279 | <div class="periods-title section-title"> |
280 | - <h4>' . esc_html__( 'Rate Limit', 'wordpoints' ) . '</h4> |
|
280 | + <h4>' . esc_html__('Rate Limit', 'wordpoints').'</h4> |
|
281 | 281 | </div> |
282 | 282 | <div class="periods section-content"></div> |
283 | 283 | </script> |
@@ -296,27 +296,27 @@ discard block |
||
296 | 296 | |
297 | 297 | $extensions_data = array(); |
298 | 298 | |
299 | - foreach ( $hooks->extensions->get_all() as $slug => $extension ) { |
|
299 | + foreach ($hooks->extensions->get_all() as $slug => $extension) { |
|
300 | 300 | |
301 | - if ( $extension instanceof WordPoints_Hook_Extension ) { |
|
302 | - $extensions_data[ $slug ] = $extension->get_ui_script_data(); |
|
301 | + if ($extension instanceof WordPoints_Hook_Extension) { |
|
302 | + $extensions_data[$slug] = $extension->get_ui_script_data(); |
|
303 | 303 | } |
304 | 304 | |
305 | - if ( wp_script_is( "wordpoints-hooks-extension-{$slug}", 'registered' ) ) { |
|
306 | - wp_enqueue_script( "wordpoints-hooks-extension-{$slug}" ); |
|
305 | + if (wp_script_is("wordpoints-hooks-extension-{$slug}", 'registered')) { |
|
306 | + wp_enqueue_script("wordpoints-hooks-extension-{$slug}"); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
310 | 310 | $reactor_data = array(); |
311 | 311 | |
312 | - foreach ( $hooks->reactors->get_all() as $slug => $reactor ) { |
|
312 | + foreach ($hooks->reactors->get_all() as $slug => $reactor) { |
|
313 | 313 | |
314 | - if ( $reactor instanceof WordPoints_Hook_Reactor ) { |
|
315 | - $reactor_data[ $slug ] = $reactor->get_ui_script_data(); |
|
314 | + if ($reactor instanceof WordPoints_Hook_Reactor) { |
|
315 | + $reactor_data[$slug] = $reactor->get_ui_script_data(); |
|
316 | 316 | } |
317 | 317 | |
318 | - if ( wp_script_is( "wordpoints-hooks-reactor-{$slug}", 'registered' ) ) { |
|
319 | - wp_enqueue_script( "wordpoints-hooks-reactor-{$slug}" ); |
|
318 | + if (wp_script_is("wordpoints-hooks-reactor-{$slug}", 'registered')) { |
|
319 | + wp_enqueue_script("wordpoints-hooks-reactor-{$slug}"); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
@@ -328,28 +328,28 @@ discard block |
||
328 | 328 | $entity_children = $entities->children; |
329 | 329 | |
330 | 330 | /** @var WordPoints_Entity $entity */ |
331 | - foreach ( $entities->get_all() as $slug => $entity ) { |
|
331 | + foreach ($entities->get_all() as $slug => $entity) { |
|
332 | 332 | |
333 | 333 | $child_data = array(); |
334 | 334 | |
335 | 335 | /** @var WordPoints_EntityishI $child */ |
336 | - foreach ( $entity_children->get_children( $slug ) as $child_slug => $child ) { |
|
336 | + foreach ($entity_children->get_children($slug) as $child_slug => $child) { |
|
337 | 337 | |
338 | - $child_data[ $child_slug ] = array( |
|
338 | + $child_data[$child_slug] = array( |
|
339 | 339 | 'slug' => $child_slug, |
340 | 340 | 'title' => $child->get_title(), |
341 | 341 | ); |
342 | 342 | |
343 | - if ( $child instanceof WordPoints_Entity_Attr ) { |
|
343 | + if ($child instanceof WordPoints_Entity_Attr) { |
|
344 | 344 | |
345 | - $child_data[ $child_slug ]['_type'] = 'attr'; |
|
346 | - $child_data[ $child_slug ]['data_type'] = $child->get_data_type(); |
|
345 | + $child_data[$child_slug]['_type'] = 'attr'; |
|
346 | + $child_data[$child_slug]['data_type'] = $child->get_data_type(); |
|
347 | 347 | |
348 | - } elseif ( $child instanceof WordPoints_Entity_Relationship ) { |
|
348 | + } elseif ($child instanceof WordPoints_Entity_Relationship) { |
|
349 | 349 | |
350 | - $child_data[ $child_slug ]['_type'] = 'relationship'; |
|
351 | - $child_data[ $child_slug ]['primary'] = $child->get_primary_entity_slug(); |
|
352 | - $child_data[ $child_slug ]['secondary'] = $child->get_related_entity_slug(); |
|
350 | + $child_data[$child_slug]['_type'] = 'relationship'; |
|
351 | + $child_data[$child_slug]['primary'] = $child->get_primary_entity_slug(); |
|
352 | + $child_data[$child_slug]['secondary'] = $child->get_related_entity_slug(); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | * @param array $data The data for the entity child. |
361 | 361 | * @param WordPoints_Entityish $child The child's object. |
362 | 362 | */ |
363 | - $child_data[ $child_slug ] = apply_filters( 'wordpoints_hooks_ui_data_entity_child', $child_data[ $child_slug ], $child ); |
|
363 | + $child_data[$child_slug] = apply_filters('wordpoints_hooks_ui_data_entity_child', $child_data[$child_slug], $child); |
|
364 | 364 | } |
365 | 365 | |
366 | - $entities_data[ $slug ] = array( |
|
366 | + $entities_data[$slug] = array( |
|
367 | 367 | 'slug' => $slug, |
368 | 368 | 'title' => $entity->get_title(), |
369 | 369 | 'children' => $child_data, |
@@ -371,12 +371,12 @@ discard block |
||
371 | 371 | '_type' => 'entity', |
372 | 372 | ); |
373 | 373 | |
374 | - if ( $entity instanceof WordPoints_Entity_EnumerableI ) { |
|
374 | + if ($entity instanceof WordPoints_Entity_EnumerableI) { |
|
375 | 375 | |
376 | 376 | $values = array(); |
377 | 377 | |
378 | - foreach ( $entity->get_enumerated_values() as $value ) { |
|
379 | - if ( $entity->set_the_value( $value ) ) { |
|
378 | + foreach ($entity->get_enumerated_values() as $value) { |
|
379 | + if ($entity->set_the_value($value)) { |
|
380 | 380 | $values[] = array( |
381 | 381 | 'value' => $entity->get_the_id(), |
382 | 382 | 'label' => $entity->get_the_human_id(), |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
387 | - $entities_data[ $slug ]['values'] = $values; |
|
387 | + $entities_data[$slug]['values'] = $values; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | /** |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | * @param array $data The data for the entity. |
394 | 394 | * @param WordPoints_Entity $entity The entity object. |
395 | 395 | */ |
396 | - $entities_data[ $slug ] = apply_filters( 'wordpoints_hooks_ui_data_entity', $entities_data[ $slug ], $entity ); |
|
396 | + $entities_data[$slug] = apply_filters('wordpoints_hooks_ui_data_entity', $entities_data[$slug], $entity); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | $data = array( |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | * |
415 | 415 | * @param array $data The data. |
416 | 416 | */ |
417 | - $data = apply_filters( 'wordpoints_hooks_ui_data', $data ); |
|
417 | + $data = apply_filters('wordpoints_hooks_ui_data', $data); |
|
418 | 418 | |
419 | 419 | wp_localize_script( |
420 | 420 | 'wordpoints-hooks-models' |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | * |
440 | 440 | * @return string The HTML with templates appended. |
441 | 441 | */ |
442 | -function wordpoints_script_templates_filter( $html, $handle ) { |
|
442 | +function wordpoints_script_templates_filter($html, $handle) { |
|
443 | 443 | |
444 | 444 | global $wp_scripts; |
445 | 445 | |
446 | - $templates = $wp_scripts->get_data( $handle, 'wordpoints-templates' ); |
|
446 | + $templates = $wp_scripts->get_data($handle, 'wordpoints-templates'); |
|
447 | 447 | |
448 | - if ( $templates ) { |
|
448 | + if ($templates) { |
|
449 | 449 | $html .= $templates; |
450 | 450 | } |
451 | 451 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | */ |
462 | 462 | function wordpoints_hooks_admin_ajax() { |
463 | 463 | |
464 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
464 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
465 | 465 | new WordPoints_Admin_Ajax_Hooks; |
466 | 466 | } |
467 | 467 | } |