@@ -12,10 +12,10 @@ |
||
12 | 12 | * |
13 | 13 | * @since 1.0.0 |
14 | 14 | */ |
15 | -require_once( dirname( __FILE__ ) . '/includes/functions.php' ); |
|
15 | +require_once(dirname(__FILE__).'/includes/functions.php'); |
|
16 | 16 | |
17 | 17 | WordPoints_Class_Autoloader::register_dir( |
18 | - dirname( __FILE__ ) . '/includes/classes' |
|
18 | + dirname(__FILE__).'/includes/classes' |
|
19 | 19 | , 'WordPoints_Admin_' |
20 | 20 | ); |
21 | 21 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return array The hook reaction data extracted into an array. |
54 | 54 | */ |
55 | - public static function prepare_hook_reaction( $reaction ) { |
|
55 | + public static function prepare_hook_reaction($reaction) { |
|
56 | 56 | |
57 | 57 | $reactor = $reaction->get_reactor_slug(); |
58 | 58 | |
@@ -95,17 +95,17 @@ discard block |
||
95 | 95 | |
96 | 96 | add_action( |
97 | 97 | 'wp_ajax_wordpoints_admin_create_hook_reaction' |
98 | - , array( $this, 'create_hook_reaction' ) |
|
98 | + , array($this, 'create_hook_reaction') |
|
99 | 99 | ); |
100 | 100 | |
101 | 101 | add_action( |
102 | 102 | 'wp_ajax_wordpoints_admin_update_hook_reaction' |
103 | - , array( $this, 'update_hook_reaction' ) |
|
103 | + , array($this, 'update_hook_reaction') |
|
104 | 104 | ); |
105 | 105 | |
106 | 106 | add_action( |
107 | 107 | 'wp_ajax_wordpoints_admin_delete_hook_reaction' |
108 | - , array( $this, 'delete_hook_reaction' ) |
|
108 | + , array($this, 'delete_hook_reaction') |
|
109 | 109 | ); |
110 | 110 | } |
111 | 111 | |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | "wordpoints_create_hook_reaction|{$this->reactor_slug}" |
125 | 125 | ); |
126 | 126 | |
127 | - $reaction = $reactor->reactions->create_reaction( $this->get_data() ); |
|
127 | + $reaction = $reactor->reactions->create_reaction($this->get_data()); |
|
128 | 128 | |
129 | - $this->send_json_result( $reaction, 'create' ); |
|
129 | + $this->send_json_result($reaction, 'create'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | , $this->get_data() |
151 | 151 | ); |
152 | 152 | |
153 | - $this->send_json_result( $reaction, 'update' ); |
|
153 | + $this->send_json_result($reaction, 'update'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | "wordpoints_delete_hook_reaction|{$this->reactor_slug}|{$reaction->ID}" |
170 | 170 | ); |
171 | 171 | |
172 | - $result = $reactor->reactions->delete_reaction( $reaction->ID ); |
|
172 | + $result = $reactor->reactions->delete_reaction($reaction->ID); |
|
173 | 173 | |
174 | - if ( ! $result ) { |
|
175 | - wp_send_json_error( array( 'message' => __( 'There was an error deleting the reaction. Please try again.', 'wordpoints' ) ) ); |
|
174 | + if ( ! $result) { |
|
175 | + wp_send_json_error(array('message' => __('There was an error deleting the reaction. Please try again.', 'wordpoints'))); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | wp_send_json_success(); |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @param string $debug_context Context sent with the message (for debugging). |
195 | 195 | */ |
196 | - private function unexpected_error( $debug_context ) { |
|
196 | + private function unexpected_error($debug_context) { |
|
197 | 197 | |
198 | 198 | wp_send_json_error( |
199 | 199 | array( |
200 | - 'message' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ), |
|
200 | + 'message' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'), |
|
201 | 201 | 'debug' => $debug_context, |
202 | 202 | ) |
203 | 203 | ); |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | */ |
214 | 214 | private function verify_user_can() { |
215 | 215 | |
216 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
217 | - wp_send_json_error( array( 'message' => __( 'You do not have permission to perform this action. Maybe you have been logged out?', 'wordpoints' ) ) ); |
|
216 | + if ( ! current_user_can('manage_options')) { |
|
217 | + wp_send_json_error(array('message' => __('You do not have permission to perform this action. Maybe you have been logged out?', 'wordpoints'))); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -227,14 +227,14 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @param string $action The action the nonce should be for. |
229 | 229 | */ |
230 | - private function verify_request( $action ) { |
|
230 | + private function verify_request($action) { |
|
231 | 231 | |
232 | 232 | if ( |
233 | - empty( $_POST['nonce'] ) |
|
234 | - || ! wordpoints_verify_nonce( 'nonce', $action, null, 'post' ) |
|
233 | + empty($_POST['nonce']) |
|
234 | + || ! wordpoints_verify_nonce('nonce', $action, null, 'post') |
|
235 | 235 | ) { |
236 | 236 | wp_send_json_error( |
237 | - array( 'message' => __( 'Your security token for this action has expired. Refresh the page and try again.', 'wordpoints' ) ) |
|
237 | + array('message' => __('Your security token for this action has expired. Refresh the page and try again.', 'wordpoints')) |
|
238 | 238 | ); |
239 | 239 | } |
240 | 240 | } |
@@ -248,16 +248,16 @@ discard block |
||
248 | 248 | */ |
249 | 249 | protected function get_reactor() { |
250 | 250 | |
251 | - if ( ! isset( $_POST['reactor'] ) ) { // WPCS: CSRF OK. |
|
252 | - $this->unexpected_error( 'reactor' ); |
|
251 | + if ( ! isset($_POST['reactor'])) { // WPCS: CSRF OK. |
|
252 | + $this->unexpected_error('reactor'); |
|
253 | 253 | } |
254 | 254 | |
255 | - $reactor_slug = sanitize_key( $_POST['reactor'] ); // WPCS: CSRF OK. |
|
255 | + $reactor_slug = sanitize_key($_POST['reactor']); // WPCS: CSRF OK. |
|
256 | 256 | |
257 | - $reactor = wordpoints_hooks()->reactors->get( $reactor_slug ); |
|
257 | + $reactor = wordpoints_hooks()->reactors->get($reactor_slug); |
|
258 | 258 | |
259 | - if ( ! $reactor instanceof WordPoints_Hook_Reactor ) { |
|
260 | - $this->unexpected_error( 'reactor_invalid' ); |
|
259 | + if ( ! $reactor instanceof WordPoints_Hook_Reactor) { |
|
260 | + $this->unexpected_error('reactor_invalid'); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | $this->reactor_slug = $reactor_slug; |
@@ -275,16 +275,16 @@ discard block |
||
275 | 275 | */ |
276 | 276 | protected function get_reaction() { |
277 | 277 | |
278 | - if ( ! isset( $_POST['id'] ) ) { // WPCS: CSRF OK. |
|
279 | - $this->unexpected_error( 'id' ); |
|
278 | + if ( ! isset($_POST['id'])) { // WPCS: CSRF OK. |
|
279 | + $this->unexpected_error('id'); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | $reaction = $this->reactor->reactions->get_reaction( |
283 | - wordpoints_int( $_POST['id'] ) // WPCS: CSRF OK. |
|
283 | + wordpoints_int($_POST['id']) // WPCS: CSRF OK. |
|
284 | 284 | ); |
285 | 285 | |
286 | - if ( ! $reaction ) { |
|
287 | - wp_send_json_error( array( 'message' => __( 'The reaction ID passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints' ) ) ); |
|
286 | + if ( ! $reaction) { |
|
287 | + wp_send_json_error(array('message' => __('The reaction ID passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints'))); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | return $reaction; |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | */ |
300 | 300 | protected function get_data() { |
301 | 301 | |
302 | - $data = wp_unslash( $_POST ); // WPCS: CSRF OK. |
|
302 | + $data = wp_unslash($_POST); // WPCS: CSRF OK. |
|
303 | 303 | |
304 | - unset( $data['id'] ); |
|
304 | + unset($data['id']); |
|
305 | 305 | |
306 | 306 | return $data; |
307 | 307 | } |
@@ -314,30 +314,30 @@ discard block |
||
314 | 314 | * @param mixed $result The result of the action. |
315 | 315 | * @param string $action The action being performed: 'create' or 'update'. |
316 | 316 | */ |
317 | - private function send_json_result( $result, $action ) { |
|
317 | + private function send_json_result($result, $action) { |
|
318 | 318 | |
319 | - if ( ! $result ) { |
|
319 | + if ( ! $result) { |
|
320 | 320 | |
321 | - if ( 'create' === $action ) { |
|
322 | - $message = __( 'There was an error adding the reaction. Please try again.', 'wordpoints' ); |
|
321 | + if ('create' === $action) { |
|
322 | + $message = __('There was an error adding the reaction. Please try again.', 'wordpoints'); |
|
323 | 323 | } else { |
324 | - $message = __( 'There was an error updating the reaction. Please try again.', 'wordpoints' ); |
|
324 | + $message = __('There was an error updating the reaction. Please try again.', 'wordpoints'); |
|
325 | 325 | } |
326 | 326 | |
327 | - wp_send_json_error( array( 'message' => $message ) ); |
|
327 | + wp_send_json_error(array('message' => $message)); |
|
328 | 328 | |
329 | - } elseif ( $result instanceof WordPoints_Hook_Reaction_Validator ) { |
|
329 | + } elseif ($result instanceof WordPoints_Hook_Reaction_Validator) { |
|
330 | 330 | |
331 | - wp_send_json_error( array( 'errors' => $result->get_errors() ) ); |
|
331 | + wp_send_json_error(array('errors' => $result->get_errors())); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | $data = null; |
335 | 335 | |
336 | - if ( 'create' === $action ) { |
|
337 | - $data = self::prepare_hook_reaction( $result ); |
|
336 | + if ('create' === $action) { |
|
337 | + $data = self::prepare_hook_reaction($result); |
|
338 | 338 | } |
339 | 339 | |
340 | - wp_send_json_success( $data ); |
|
340 | + wp_send_json_success($data); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | public function hooks() { |
63 | 63 | |
64 | 64 | /* Load the JavaScript needed for the settings screen. */ |
65 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
66 | - add_action( "admin_footer-{$this->id}", array( $this, 'footer_scripts' ) ); |
|
65 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
66 | + add_action("admin_footer-{$this->id}", array($this, 'footer_scripts')); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | |
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | - <h1><?php echo esc_html( $this->get_title() ); ?></h1> |
|
101 | + <h1><?php echo esc_html($this->get_title()); ?></h1> |
|
102 | 102 | |
103 | 103 | <?php settings_errors(); ?> |
104 | 104 | |
105 | - <?php wordpoints_admin_show_tabs( $this->tabs, false ); ?> |
|
105 | + <?php wordpoints_admin_show_tabs($this->tabs, false); ?> |
|
106 | 106 | |
107 | 107 | <?php $this->display_content(); ?> |
108 | 108 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @since 1.0.0 |
57 | 57 | */ |
58 | 58 | protected function get_title() { |
59 | - return _x( 'Points Types', 'page title', 'wordpoints' ); |
|
59 | + return _x('Points Types', 'page title', 'wordpoints'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | |
67 | 67 | parent::hooks(); |
68 | 68 | |
69 | - add_action( 'add_meta_boxes', array( $this, 'add_points_settings_meta_box' ) ); |
|
70 | - add_action( 'add_meta_boxes', array( $this, 'add_event_meta_boxes' ) ); |
|
69 | + add_action('add_meta_boxes', array($this, 'add_points_settings_meta_box')); |
|
70 | + add_action('add_meta_boxes', array($this, 'add_event_meta_boxes')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function enqueue_scripts() { |
77 | 77 | |
78 | - wp_enqueue_style( 'wordpoints-hooks-admin' ); |
|
78 | + wp_enqueue_style('wordpoints-hooks-admin'); |
|
79 | 79 | |
80 | - wp_enqueue_script( 'postbox' ); |
|
80 | + wp_enqueue_script('postbox'); |
|
81 | 81 | |
82 | 82 | wordpoints_hooks_ui_setup_script_data(); |
83 | 83 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | .addClass( 'closed' ); |
98 | 98 | |
99 | 99 | postboxes.add_postbox_toggles( |
100 | - <?php echo wp_json_encode( $this->id ); ?> |
|
100 | + <?php echo wp_json_encode($this->id); ?> |
|
101 | 101 | ); |
102 | 102 | } ); |
103 | 103 | </script> |
@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function add_points_settings_meta_box() { |
114 | 114 | |
115 | - if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) { |
|
115 | + if ( ! current_user_can('manage_wordpoints_points_types')) { |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | |
119 | 119 | add_meta_box( |
120 | 120 | 'settings' |
121 | - , __( 'Settings', 'wordpoints' ) |
|
122 | - , array( $this, 'display_points_settings_meta_box' ) |
|
121 | + , __('Settings', 'wordpoints') |
|
122 | + , array($this, 'display_points_settings_meta_box') |
|
123 | 123 | , $this->id |
124 | 124 | , 'side' |
125 | 125 | , 'default' |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function display_points_settings_meta_box() { |
135 | 135 | |
136 | - if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) { |
|
136 | + if ( ! current_user_can('manage_wordpoints_points_types')) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | |
142 | 142 | $add_new = 0; |
143 | 143 | |
144 | - $points_type = wordpoints_get_points_type( $slug ); |
|
144 | + $points_type = wordpoints_get_points_type($slug); |
|
145 | 145 | |
146 | - if ( ! $points_type ) { |
|
146 | + if ( ! $points_type) { |
|
147 | 147 | |
148 | 148 | $points_type = array(); |
149 | - $add_new = wp_create_nonce( 'wordpoints_add_new_points_type' ); |
|
149 | + $add_new = wp_create_nonce('wordpoints_add_new_points_type'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | $points_type = array_merge( |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | ?> |
162 | 162 | |
163 | 163 | <form method="post"> |
164 | - <?php if ( $slug ) : ?> |
|
164 | + <?php if ($slug) : ?> |
|
165 | 165 | <p> |
166 | 166 | <span class="wordpoints-points-slug"> |
167 | 167 | <em> |
168 | - <?php echo esc_html( sprintf( __( 'Slug: %s', 'wordpoints' ), $slug ) ); ?> |
|
168 | + <?php echo esc_html(sprintf(__('Slug: %s', 'wordpoints'), $slug)); ?> |
|
169 | 169 | </em> |
170 | 170 | </span> |
171 | 171 | </p> |
172 | - <?php wp_nonce_field( "wordpoints_update_points_type-$slug", 'update_points_type' ); ?> |
|
172 | + <?php wp_nonce_field("wordpoints_update_points_type-$slug", 'update_points_type'); ?> |
|
173 | 173 | <?php endif; ?> |
174 | 174 | |
175 | 175 | <?php |
@@ -183,45 +183,45 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @param string $points_type The slug of the points type. |
185 | 185 | */ |
186 | - do_action( 'wordpoints_points_type_form_top', $slug ); |
|
186 | + do_action('wordpoints_points_type_form_top', $slug); |
|
187 | 187 | |
188 | - if ( $add_new ) { |
|
188 | + if ($add_new) { |
|
189 | 189 | |
190 | 190 | // Mark the prefix and suffix optional on the add new form. |
191 | - $prefix = _x( 'Prefix (optional):', 'points type', 'wordpoints' ); |
|
192 | - $suffix = _x( 'Suffix (optional):', 'points type', 'wordpoints' ); |
|
191 | + $prefix = _x('Prefix (optional):', 'points type', 'wordpoints'); |
|
192 | + $suffix = _x('Suffix (optional):', 'points type', 'wordpoints'); |
|
193 | 193 | |
194 | 194 | } else { |
195 | 195 | |
196 | - $prefix = _x( 'Prefix:', 'points type', 'wordpoints' ); |
|
197 | - $suffix = _x( 'Suffix:', 'points type', 'wordpoints' ); |
|
196 | + $prefix = _x('Prefix:', 'points type', 'wordpoints'); |
|
197 | + $suffix = _x('Suffix:', 'points type', 'wordpoints'); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | ?> |
201 | 201 | |
202 | 202 | <p> |
203 | 203 | <label |
204 | - for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label> |
|
204 | + for="points-name-<?php echo esc_attr($slug); ?>"><?php echo esc_html_x('Name:', 'points type', 'wordpoints'); ?></label> |
|
205 | 205 | <input class="widefat" type="text" |
206 | - id="points-name-<?php echo esc_attr( $slug ); ?>" |
|
206 | + id="points-name-<?php echo esc_attr($slug); ?>" |
|
207 | 207 | name="points-name" |
208 | - value="<?php echo esc_attr( $points_type['name'] ); ?>"/> |
|
208 | + value="<?php echo esc_attr($points_type['name']); ?>"/> |
|
209 | 209 | </p> |
210 | 210 | <p> |
211 | 211 | <label |
212 | - for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label> |
|
212 | + for="points-prefix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($prefix); ?></label> |
|
213 | 213 | <input class="widefat" type="text" |
214 | - id="points-prefix-<?php echo esc_attr( $slug ); ?>" |
|
214 | + id="points-prefix-<?php echo esc_attr($slug); ?>" |
|
215 | 215 | name="points-prefix" |
216 | - value="<?php echo esc_attr( $points_type['prefix'] ); ?>"/> |
|
216 | + value="<?php echo esc_attr($points_type['prefix']); ?>"/> |
|
217 | 217 | </p> |
218 | 218 | <p> |
219 | 219 | <label |
220 | - for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label> |
|
220 | + for="points-suffix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($suffix); ?></label> |
|
221 | 221 | <input class="widefat" type="text" |
222 | - id="points-suffix-<?php echo esc_attr( $slug ); ?>" |
|
222 | + id="points-suffix-<?php echo esc_attr($slug); ?>" |
|
223 | 223 | name="points-suffix" |
224 | - value="<?php echo esc_attr( $points_type['suffix'] ); ?>"/> |
|
224 | + value="<?php echo esc_attr($points_type['suffix']); ?>"/> |
|
225 | 225 | </p> |
226 | 226 | |
227 | 227 | <?php |
@@ -235,28 +235,28 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @param string $points_type The slug of the points type. |
237 | 237 | */ |
238 | - do_action( 'wordpoints_points_type_form_bottom', $slug ); |
|
238 | + do_action('wordpoints_points_type_form_bottom', $slug); |
|
239 | 239 | |
240 | 240 | ?> |
241 | 241 | |
242 | 242 | <input type="hidden" name="points-slug" |
243 | - value="<?php echo esc_attr( $slug ); ?>"/> |
|
243 | + value="<?php echo esc_attr($slug); ?>"/> |
|
244 | 244 | <input type="hidden" name="add_new" class="add_new" |
245 | - value="<?php echo esc_attr( $add_new ); ?>"/> |
|
245 | + value="<?php echo esc_attr($add_new); ?>"/> |
|
246 | 246 | |
247 | 247 | <div class="hook-control-actions"> |
248 | 248 | <div class="alignleft"> |
249 | 249 | <?php |
250 | 250 | |
251 | - if ( ! $add_new ) { |
|
252 | - wp_nonce_field( "wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce' ); |
|
253 | - submit_button( _x( 'Delete', 'points type', 'wordpoints' ), 'delete', 'delete-points-type', false, array( 'id' => "delete_points_type-{$slug}" ) ); |
|
251 | + if ( ! $add_new) { |
|
252 | + wp_nonce_field("wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce'); |
|
253 | + submit_button(_x('Delete', 'points type', 'wordpoints'), 'delete', 'delete-points-type', false, array('id' => "delete_points_type-{$slug}")); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | ?> |
257 | 257 | </div> |
258 | 258 | <div class="alignright"> |
259 | - <?php submit_button( _x( 'Save', 'points type', 'wordpoints' ), 'button-primary hook-control-save right', 'save-points-type', false, array( 'id' => "points-{$slug}-save" ) ); ?> |
|
259 | + <?php submit_button(_x('Save', 'points type', 'wordpoints'), 'button-primary hook-control-save right', 'save-points-type', false, array('id' => "points-{$slug}-save")); ?> |
|
260 | 260 | <span class="spinner"></span> |
261 | 261 | </div> |
262 | 262 | <br class="clear"/> |
@@ -273,17 +273,17 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function add_event_meta_boxes() { |
275 | 275 | |
276 | - if ( ! $this->current_points_type ) { |
|
276 | + if ( ! $this->current_points_type) { |
|
277 | 277 | return; |
278 | 278 | } |
279 | 279 | |
280 | 280 | /** @var WordPoints_Hook_EventI $event */ |
281 | - foreach ( $this->hooks->events->get_all() as $slug => $event ) { |
|
281 | + foreach ($this->hooks->events->get_all() as $slug => $event) { |
|
282 | 282 | |
283 | 283 | add_meta_box( |
284 | 284 | "{$this->current_points_type}-{$slug}" |
285 | 285 | , $event->get_title() |
286 | - , array( $this, 'display_event_meta_box' ) |
|
286 | + , array($this, 'display_event_meta_box') |
|
287 | 287 | , $this->id |
288 | 288 | , 'events' |
289 | 289 | , 'default' |
@@ -303,50 +303,50 @@ discard block |
||
303 | 303 | * @param array $points_type The points type this meta-box relates to. |
304 | 304 | * @param array $meta_box The data the meta-box was created with. |
305 | 305 | */ |
306 | - public function display_event_meta_box( $points_type, $meta_box ) { |
|
306 | + public function display_event_meta_box($points_type, $meta_box) { |
|
307 | 307 | |
308 | 308 | $event_slug = $meta_box['args']['slug']; |
309 | 309 | |
310 | 310 | /** @var WordPoints_Hook_Reactor $points_reactor */ |
311 | - $points_reactor = $this->hooks->reactors->get( 'points' ); |
|
311 | + $points_reactor = $this->hooks->reactors->get('points'); |
|
312 | 312 | |
313 | 313 | $data = array(); |
314 | 314 | |
315 | - foreach ( $points_reactor->reactions->get_reactions_to_event( $event_slug ) as $id => $reaction ) { |
|
316 | - if ( $reaction->get_meta( 'points_type' ) === $this->current_points_type ) { |
|
315 | + foreach ($points_reactor->reactions->get_reactions_to_event($event_slug) as $id => $reaction) { |
|
316 | + if ($reaction->get_meta('points_type') === $this->current_points_type) { |
|
317 | 317 | $data[] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction( |
318 | 318 | $reaction |
319 | 319 | ); |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | - $args = $this->hooks->events->args->get_children( $event_slug ); |
|
323 | + $args = $this->hooks->events->args->get_children($event_slug); |
|
324 | 324 | |
325 | - $event_data = array( 'args' => array() ); |
|
325 | + $event_data = array('args' => array()); |
|
326 | 326 | |
327 | - foreach ( $args as $slug => $arg ) { |
|
327 | + foreach ($args as $slug => $arg) { |
|
328 | 328 | |
329 | - $event_data['args'][ $slug ] = array( |
|
329 | + $event_data['args'][$slug] = array( |
|
330 | 330 | 'slug' => $slug, |
331 | 331 | ); |
332 | 332 | |
333 | - if ( $arg instanceof WordPoints_Hook_Arg ) { |
|
334 | - $event_data['args'][ $slug ]['title'] = $arg->get_title(); |
|
333 | + if ($arg instanceof WordPoints_Hook_Arg) { |
|
334 | + $event_data['args'][$slug]['title'] = $arg->get_title(); |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
338 | 338 | ?> |
339 | 339 | |
340 | 340 | <script> |
341 | - WordPointsHooksAdminData.events[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $event_data ); ?>; |
|
342 | - WordPointsHooksAdminData.reactions[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $data ); ?>; |
|
341 | + WordPointsHooksAdminData.events[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($event_data); ?>; |
|
342 | + WordPointsHooksAdminData.reactions[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($data); ?>; |
|
343 | 343 | </script> |
344 | 344 | |
345 | 345 | <div class="wordpoints-hook-reaction-group-container"> |
346 | 346 | <div class="wordpoints-hook-reaction-group" |
347 | - data-wordpoints-hooks-hook-event="<?php echo esc_attr( $event_slug ); ?>" |
|
348 | - data-wordpoints-hooks-points-type="<?php echo esc_attr( $this->current_points_type ); ?>" |
|
349 | - data-wordpoints-hooks-create-nonce="<?php echo esc_attr( wp_create_nonce( 'wordpoints_create_hook_reaction|points' ) ); ?>" |
|
347 | + data-wordpoints-hooks-hook-event="<?php echo esc_attr($event_slug); ?>" |
|
348 | + data-wordpoints-hooks-points-type="<?php echo esc_attr($this->current_points_type); ?>" |
|
349 | + data-wordpoints-hooks-create-nonce="<?php echo esc_attr(wp_create_nonce('wordpoints_create_hook_reaction|points')); ?>" |
|
350 | 350 | data-wordpoints-hooks-reactor="points"> |
351 | 351 | </div> |
352 | 352 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | <div class="controls"> |
362 | 362 | <button type="button" class="button-primary add-reaction"> |
363 | - <?php esc_html_e( 'Add New', 'wordpoints' ); ?> |
|
363 | + <?php esc_html_e('Add New', 'wordpoints'); ?> |
|
364 | 364 | </button> |
365 | 365 | </div> |
366 | 366 | </div> |
@@ -380,19 +380,19 @@ discard block |
||
380 | 380 | // Show a tab for each points type. |
381 | 381 | $tabs = array(); |
382 | 382 | |
383 | - foreach ( $points_types as $slug => $settings ) { |
|
384 | - $tabs[ $slug ] = $settings['name']; |
|
383 | + foreach ($points_types as $slug => $settings) { |
|
384 | + $tabs[$slug] = $settings['name']; |
|
385 | 385 | } |
386 | 386 | |
387 | - $tabs['add-new'] = __( 'Add New', 'wordpoints' ); |
|
387 | + $tabs['add-new'] = __('Add New', 'wordpoints'); |
|
388 | 388 | |
389 | - $tab = wordpoints_admin_get_current_tab( $tabs ); |
|
389 | + $tab = wordpoints_admin_get_current_tab($tabs); |
|
390 | 390 | |
391 | - if ( 'add-new' !== $tab ) { |
|
391 | + if ('add-new' !== $tab) { |
|
392 | 392 | $this->current_points_type = $tab; |
393 | 393 | } |
394 | 394 | |
395 | - do_action( 'add_meta_boxes', $this->id ); |
|
395 | + do_action('add_meta_boxes', $this->id); |
|
396 | 396 | |
397 | 397 | $this->tabs = $tabs; |
398 | 398 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | */ |
405 | 405 | public function save_points_type() { |
406 | 406 | |
407 | - if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) { |
|
407 | + if ( ! current_user_can('manage_wordpoints_points_types')) { |
|
408 | 408 | return; |
409 | 409 | } |
410 | 410 | |
@@ -419,43 +419,43 @@ discard block |
||
419 | 419 | |
420 | 420 | $settings = array(); |
421 | 421 | |
422 | - $settings['name'] = trim( sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) ); // WPCS: CSRF OK |
|
423 | - $settings['prefix'] = ltrim( sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) ); // WPCS: CSRF OK |
|
424 | - $settings['suffix'] = rtrim( sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) ); // WPCS: CSRF OK |
|
422 | + $settings['name'] = trim(sanitize_text_field(wp_unslash($_POST['points-name']))); // WPCS: CSRF OK |
|
423 | + $settings['prefix'] = ltrim(sanitize_text_field(wp_unslash($_POST['points-prefix']))); // WPCS: CSRF OK |
|
424 | + $settings['suffix'] = rtrim(sanitize_text_field(wp_unslash($_POST['points-suffix']))); // WPCS: CSRF OK |
|
425 | 425 | |
426 | 426 | if ( |
427 | - isset( $_POST['points-slug'] ) |
|
428 | - && wordpoints_verify_nonce( 'update_points_type', 'wordpoints_update_points_type-%s', array( 'points-slug' ), 'post' ) |
|
427 | + isset($_POST['points-slug']) |
|
428 | + && wordpoints_verify_nonce('update_points_type', 'wordpoints_update_points_type-%s', array('points-slug'), 'post') |
|
429 | 429 | ) { |
430 | 430 | |
431 | 431 | // - We are updating an existing points type. |
432 | 432 | |
433 | - $points_type = sanitize_key( $_POST['points-slug'] ); |
|
433 | + $points_type = sanitize_key($_POST['points-slug']); |
|
434 | 434 | |
435 | - $old_settings = wordpoints_get_points_type( $points_type ); |
|
435 | + $old_settings = wordpoints_get_points_type($points_type); |
|
436 | 436 | |
437 | - if ( false === $old_settings ) { |
|
437 | + if (false === $old_settings) { |
|
438 | 438 | |
439 | 439 | add_settings_error( |
440 | 440 | '' |
441 | 441 | , 'wordpoints_points_type_update' |
442 | - , __( 'Error: failed updating points type.', 'wordpoints' ) |
|
442 | + , __('Error: failed updating points type.', 'wordpoints') |
|
443 | 443 | , 'updated' |
444 | 444 | ); |
445 | 445 | |
446 | 446 | return; |
447 | 447 | } |
448 | 448 | |
449 | - if ( is_array( $old_settings ) ) { |
|
450 | - $settings = array_merge( $old_settings, $settings ); |
|
449 | + if (is_array($old_settings)) { |
|
450 | + $settings = array_merge($old_settings, $settings); |
|
451 | 451 | } |
452 | 452 | |
453 | - if ( ! wordpoints_update_points_type( $points_type, $settings ) ) { |
|
453 | + if ( ! wordpoints_update_points_type($points_type, $settings)) { |
|
454 | 454 | |
455 | 455 | add_settings_error( |
456 | 456 | '' |
457 | 457 | , 'wordpoints_points_type_update' |
458 | - , __( 'Error: failed updating points type.', 'wordpoints' ) |
|
458 | + , __('Error: failed updating points type.', 'wordpoints') |
|
459 | 459 | , 'updated' |
460 | 460 | ); |
461 | 461 | |
@@ -464,23 +464,23 @@ discard block |
||
464 | 464 | add_settings_error( |
465 | 465 | '' |
466 | 466 | , 'wordpoints_points_type_update' |
467 | - , __( 'Points type updated.', 'wordpoints' ) |
|
467 | + , __('Points type updated.', 'wordpoints') |
|
468 | 468 | , 'updated' |
469 | 469 | ); |
470 | 470 | } |
471 | 471 | |
472 | - } elseif ( wordpoints_verify_nonce( 'add_new', 'wordpoints_add_new_points_type', null, 'post' ) ) { |
|
472 | + } elseif (wordpoints_verify_nonce('add_new', 'wordpoints_add_new_points_type', null, 'post')) { |
|
473 | 473 | |
474 | 474 | // - We are creating a new points type. |
475 | 475 | |
476 | - $slug = wordpoints_add_points_type( $settings ); |
|
476 | + $slug = wordpoints_add_points_type($settings); |
|
477 | 477 | |
478 | - if ( ! $slug ) { |
|
478 | + if ( ! $slug) { |
|
479 | 479 | |
480 | 480 | add_settings_error( |
481 | 481 | '' |
482 | 482 | , 'wordpoints_points_type_create' |
483 | - , __( 'Please choose a unique name for this points type.', 'wordpoints' ) |
|
483 | + , __('Please choose a unique name for this points type.', 'wordpoints') |
|
484 | 484 | ); |
485 | 485 | |
486 | 486 | } else { |
@@ -490,26 +490,26 @@ discard block |
||
490 | 490 | add_settings_error( |
491 | 491 | '' |
492 | 492 | , 'wordpoints_points_type_create' |
493 | - , __( 'Points type created.', 'wordpoints' ) |
|
493 | + , __('Points type created.', 'wordpoints') |
|
494 | 494 | , 'updated' |
495 | 495 | ); |
496 | 496 | } |
497 | 497 | } |
498 | 498 | |
499 | 499 | } elseif ( |
500 | - ! empty( $_POST['delete-points-type'] ) |
|
501 | - && isset( $_POST['points-slug'] ) |
|
502 | - && wordpoints_verify_nonce( 'delete-points-type-nonce', 'wordpoints_delete_points_type-%s', array( 'points-slug' ), 'post' ) |
|
500 | + ! empty($_POST['delete-points-type']) |
|
501 | + && isset($_POST['points-slug']) |
|
502 | + && wordpoints_verify_nonce('delete-points-type-nonce', 'wordpoints_delete_points_type-%s', array('points-slug'), 'post') |
|
503 | 503 | ) { |
504 | 504 | |
505 | 505 | // - We are deleting a points type. |
506 | 506 | |
507 | - if ( wordpoints_delete_points_type( sanitize_key( $_POST['points-slug'] ) ) ) { |
|
507 | + if (wordpoints_delete_points_type(sanitize_key($_POST['points-slug']))) { |
|
508 | 508 | |
509 | 509 | add_settings_error( |
510 | 510 | '' |
511 | 511 | , 'wordpoints_points_type_delete' |
512 | - , __( 'Points type deleted.', 'wordpoints' ) |
|
512 | + , __('Points type deleted.', 'wordpoints') |
|
513 | 513 | , 'updated' |
514 | 514 | ); |
515 | 515 | |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | add_settings_error( |
519 | 519 | '' |
520 | 520 | , 'wordpoints_points_type_delete' |
521 | - , __( 'Error while deleting.', 'wordpoints' ) |
|
521 | + , __('Error while deleting.', 'wordpoints') |
|
522 | 522 | ); |
523 | 523 | } |
524 | 524 | } |
@@ -534,25 +534,25 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @since 1.0.0 |
536 | 536 | */ |
537 | - do_action( 'wordpoints_admin_points_events_head' ); |
|
537 | + do_action('wordpoints_admin_points_events_head'); |
|
538 | 538 | |
539 | - if ( is_network_admin() ) { |
|
540 | - $title = __( 'Network Events', 'wordpoints' ); |
|
541 | - $description = __( 'Award points when various events happen on this network.', 'wordpoints' ); |
|
539 | + if (is_network_admin()) { |
|
540 | + $title = __('Network Events', 'wordpoints'); |
|
541 | + $description = __('Award points when various events happen on this network.', 'wordpoints'); |
|
542 | 542 | } else { |
543 | - $title = __( 'Events', 'wordpoints' ); |
|
544 | - $description = __( 'Award points when various events happen on this site.', 'wordpoints' ); |
|
543 | + $title = __('Events', 'wordpoints'); |
|
544 | + $description = __('Award points when various events happen on this site.', 'wordpoints'); |
|
545 | 545 | } |
546 | 546 | |
547 | - $points_type = wordpoints_get_points_type( $this->current_points_type ); |
|
547 | + $points_type = wordpoints_get_points_type($this->current_points_type); |
|
548 | 548 | |
549 | 549 | ?> |
550 | 550 | |
551 | 551 | <div class="wordpoints-points-type-meta-box-wrap"> |
552 | 552 | |
553 | 553 | <form> |
554 | - <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> |
|
555 | - <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> |
|
554 | + <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?> |
|
555 | + <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?> |
|
556 | 556 | </form> |
557 | 557 | |
558 | 558 | <div id="poststuff"> |
@@ -560,17 +560,17 @@ discard block |
||
560 | 560 | <div id="post-body" class="metabox-holder columns-<?php echo 1 === (int) get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
561 | 561 | |
562 | 562 | <div id="postbox-container-1" class="postbox-container"> |
563 | - <?php do_meta_boxes( $this->id, 'side', $points_type ); ?> |
|
563 | + <?php do_meta_boxes($this->id, 'side', $points_type); ?> |
|
564 | 564 | </div> |
565 | 565 | |
566 | - <?php if ( isset( $this->current_points_type ) ) : ?> |
|
566 | + <?php if (isset($this->current_points_type)) : ?> |
|
567 | 567 | <div class="wordpoints-hook-events-heading"> |
568 | - <h2><?php echo esc_html( $title ); ?></h2> |
|
569 | - <p class="description"><?php echo esc_html( $description ); ?></p> |
|
568 | + <h2><?php echo esc_html($title); ?></h2> |
|
569 | + <p class="description"><?php echo esc_html($description); ?></p> |
|
570 | 570 | </div> |
571 | 571 | |
572 | 572 | <div id="postbox-container-2" class="postbox-container"> |
573 | - <?php do_meta_boxes( $this->id, 'events', $points_type ); ?> |
|
573 | + <?php do_meta_boxes($this->id, 'events', $points_type); ?> |
|
574 | 574 | </div> |
575 | 575 | <?php endif; ?> |
576 | 576 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | * |
590 | 590 | * @since 1.0.0 |
591 | 591 | */ |
592 | - do_action( 'wordpoints_admin_points_events_foot' ); |
|
592 | + do_action('wordpoints_admin_points_events_foot'); |
|
593 | 593 | } |
594 | 594 | } |
595 | 595 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @since 1.0.0 |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - add_action( 'current_screen', array( $this, 'set_current_screen' ) ); |
|
30 | + add_action('current_screen', array($this, 'set_current_screen')); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param WP_Screen $current_screen The WP_Screen object for the current screen. |
39 | 39 | */ |
40 | - public function set_current_screen( $current_screen ) { |
|
40 | + public function set_current_screen($current_screen) { |
|
41 | 41 | |
42 | - $screen = $this->get( $current_screen->id ); |
|
42 | + $screen = $this->get($current_screen->id); |
|
43 | 43 | |
44 | - if ( ! ( $screen instanceof WordPoints_Admin_Screen ) ) { |
|
44 | + if ( ! ($screen instanceof WordPoints_Admin_Screen)) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | add_action( |
51 | 51 | "load-{$current_screen->id}" |
52 | - , array( $this->current_screen, 'load' ) |
|
52 | + , array($this->current_screen, 'load') |
|
53 | 53 | ); |
54 | 54 | } |
55 | 55 |
@@ -14,18 +14,18 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @param WordPoints_App $app The main WordPoints app. |
16 | 16 | */ |
17 | -function wordpoints_hooks_register_admin_apps( $app ) { |
|
17 | +function wordpoints_hooks_register_admin_apps($app) { |
|
18 | 18 | |
19 | 19 | $apps = $app->sub_apps; |
20 | 20 | |
21 | - $apps->register( 'admin', 'WordPoints_App' ); |
|
21 | + $apps->register('admin', 'WordPoints_App'); |
|
22 | 22 | |
23 | 23 | /** @var WordPoints_App $admin */ |
24 | - $admin = $apps->get( 'admin' ); |
|
24 | + $admin = $apps->get('admin'); |
|
25 | 25 | |
26 | - $admin->sub_apps->register( 'screen', 'WordPoints_Admin_Screens' ); |
|
26 | + $admin->sub_apps->register('screen', 'WordPoints_Admin_Screens'); |
|
27 | 27 | } |
28 | -add_action( 'wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps' ); |
|
28 | +add_action('wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps'); |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Register the admin screens. |
@@ -42,19 +42,19 @@ discard block |
||
42 | 42 | // Hooks page. |
43 | 43 | $id = add_submenu_page( |
44 | 44 | $wordpoints_menu |
45 | - , __( 'WordPoints — Points Types', 'wordpoints' ) |
|
46 | - , __( 'Points Types', 'wordpoints' ) |
|
45 | + , __('WordPoints — Points Types', 'wordpoints') |
|
46 | + , __('Points Types', 'wordpoints') |
|
47 | 47 | , 'manage_options' |
48 | 48 | , 'wordpoints_points_types' |
49 | - , array( $admin_screens, 'display' ) |
|
49 | + , array($admin_screens, 'display') |
|
50 | 50 | ); |
51 | 51 | |
52 | - if ( $id ) { |
|
53 | - $admin_screens->register( $id, 'WordPoints_Admin_Screen_Points_Types' ); |
|
52 | + if ($id) { |
|
53 | + $admin_screens->register($id, 'WordPoints_Admin_Screen_Points_Types'); |
|
54 | 54 | } |
55 | 55 | } |
56 | -add_action( 'admin_menu', 'wordpoints_hooks_api_admin_menu' ); |
|
57 | -add_action( 'network_admin_menu', 'wordpoints_hooks_api_admin_menu' ); |
|
56 | +add_action('admin_menu', 'wordpoints_hooks_api_admin_menu'); |
|
57 | +add_action('network_admin_menu', 'wordpoints_hooks_api_admin_menu'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Register module admin scripts. |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | */ |
64 | 64 | function wordpoints_hooks_admin_register_scripts() { |
65 | 65 | |
66 | - $assets_url = wordpoints_modules_url( '/assets', dirname( __FILE__ ) ); |
|
66 | + $assets_url = wordpoints_modules_url('/assets', dirname(__FILE__)); |
|
67 | 67 | |
68 | 68 | // CSS |
69 | 69 | |
70 | 70 | wp_register_style( |
71 | 71 | 'wordpoints-hooks-admin' |
72 | - , $assets_url . '/css/hooks.css' |
|
73 | - , array( 'dashicons', 'wp-jquery-ui-dialog' ) |
|
72 | + , $assets_url.'/css/hooks.css' |
|
73 | + , array('dashicons', 'wp-jquery-ui-dialog') |
|
74 | 74 | , WORDPOINTS_VERSION |
75 | 75 | ); |
76 | 76 | |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | |
79 | 79 | wp_register_script( |
80 | 80 | 'wordpoints-hooks-models' |
81 | - , $assets_url . '/js/hooks/models.js' |
|
82 | - , array( 'backbone', 'jquery-ui-dialog', 'wp-util' ) |
|
81 | + , $assets_url.'/js/hooks/models.js' |
|
82 | + , array('backbone', 'jquery-ui-dialog', 'wp-util') |
|
83 | 83 | , WORDPOINTS_VERSION |
84 | 84 | ); |
85 | 85 | |
86 | 86 | wp_register_script( |
87 | 87 | 'wordpoints-hooks-views' |
88 | - , $assets_url . '/js/hooks/views.js' |
|
89 | - , array( 'wordpoints-hooks-models' ) |
|
88 | + , $assets_url.'/js/hooks/views.js' |
|
89 | + , array('wordpoints-hooks-models') |
|
90 | 90 | , WORDPOINTS_VERSION |
91 | 91 | ); |
92 | 92 | |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | 'wordpoints-hooks-views' |
95 | 95 | , 'WordPointsHooksAdminL10n' |
96 | 96 | , array( |
97 | - 'unexpectedError' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ), |
|
98 | - 'changesSaved' => __( 'Your changes have been saved.', 'wordpoints' ), |
|
97 | + 'unexpectedError' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'), |
|
98 | + 'changesSaved' => __('Your changes have been saved.', 'wordpoints'), |
|
99 | 99 | /* translators: the name of the field that cannot be empty */ |
100 | - 'emptyField' => sprintf( __( '%s cannot be empty.', 'wordpoints' ), '{{ data.label }}' ), |
|
101 | - 'confirmDelete' => __( 'Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints' ), |
|
102 | - 'confirmTitle' => __( 'Are you sure?', 'wordpoints' ), |
|
103 | - 'deleteText' => __( 'Delete', 'wordpoints' ), |
|
104 | - 'cancelText' => __( 'Cancel', 'wordpoints' ), |
|
105 | - 'separator' => __( ' » ', 'wordpoints' ), |
|
100 | + 'emptyField' => sprintf(__('%s cannot be empty.', 'wordpoints'), '{{ data.label }}'), |
|
101 | + 'confirmDelete' => __('Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints'), |
|
102 | + 'confirmTitle' => __('Are you sure?', 'wordpoints'), |
|
103 | + 'deleteText' => __('Delete', 'wordpoints'), |
|
104 | + 'cancelText' => __('Cancel', 'wordpoints'), |
|
105 | + 'separator' => __(' » ', 'wordpoints'), |
|
106 | 106 | ) |
107 | 107 | ); |
108 | 108 | |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | <div class="view"> |
115 | 115 | <div class="title"></div> |
116 | 116 | <button type="button" class="edit button-secondary"> |
117 | - ' . esc_html__( 'Edit', 'wordpoints' ) . ' |
|
117 | + ' . esc_html__('Edit', 'wordpoints').' |
|
118 | 118 | </button> |
119 | 119 | <button type="button" class="close button-secondary"> |
120 | - ' . esc_html__( 'Close', 'wordpoints' ) . ' |
|
120 | + ' . esc_html__('Close', 'wordpoints').' |
|
121 | 121 | </button> |
122 | 122 | </div> |
123 | 123 | <div class="form"> |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | </div> |
137 | 137 | <div class="action-buttons"> |
138 | 138 | <button type="button" class="save button-primary" disabled> |
139 | - ' . esc_html__( 'Save', 'wordpoints' ) . ' |
|
139 | + ' . esc_html__('Save', 'wordpoints').' |
|
140 | 140 | </button> |
141 | 141 | <button type="button" class="cancel button-secondary"> |
142 | - ' . esc_html__( 'Cancel', 'wordpoints' ) . ' |
|
142 | + ' . esc_html__('Cancel', 'wordpoints').' |
|
143 | 143 | </button> |
144 | 144 | <button type="button" class="close button-secondary"> |
145 | - ' . esc_html__( 'Close', 'wordpoints' ) . ' |
|
145 | + ' . esc_html__('Close', 'wordpoints').' |
|
146 | 146 | </button> |
147 | 147 | <button type="button" class="delete button-secondary"> |
148 | - ' . esc_html__( 'Delete', 'wordpoints' ) . ' |
|
148 | + ' . esc_html__('Delete', 'wordpoints').' |
|
149 | 149 | </button> |
150 | 150 | </div> |
151 | 151 | </div> |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | |
194 | 194 | wp_register_script( |
195 | 195 | 'wordpoints-hooks-reactor-points' |
196 | - , $assets_url . '/js/hooks/reactors/points.js' |
|
197 | - , array( 'wordpoints-hooks-views' ) |
|
196 | + , $assets_url.'/js/hooks/reactors/points.js' |
|
197 | + , array('wordpoints-hooks-views') |
|
198 | 198 | , WORDPOINTS_VERSION |
199 | 199 | ); |
200 | 200 | |
201 | 201 | wp_register_script( |
202 | 202 | 'wordpoints-hooks-extension-conditions' |
203 | - , $assets_url . '/js/hooks/extensions/conditions.js' |
|
204 | - , array( 'wordpoints-hooks-views' ) |
|
203 | + , $assets_url.'/js/hooks/extensions/conditions.js' |
|
204 | + , array('wordpoints-hooks-views') |
|
205 | 205 | , WORDPOINTS_VERSION |
206 | 206 | ); |
207 | 207 | |
@@ -211,25 +211,25 @@ discard block |
||
211 | 211 | , ' |
212 | 212 | <script type="text/template" id="tmpl-wordpoints-hook-condition-groups"> |
213 | 213 | <div class="conditions-title"> |
214 | - <h4>' . esc_html__( 'Conditions', 'wordpoints' ) . '</h4> |
|
214 | + <h4>' . esc_html__('Conditions', 'wordpoints').'</h4> |
|
215 | 215 | <button type="button" class="add-new button-secondary button-link"> |
216 | - <span class="screen-reader-text">' . esc_html__( 'Add New Condition', 'wordpoints' ) . '</span> |
|
216 | + <span class="screen-reader-text">' . esc_html__('Add New Condition', 'wordpoints').'</span> |
|
217 | 217 | <span class="dashicons dashicons-plus"></span> |
218 | 218 | </button> |
219 | 219 | </div> |
220 | 220 | <div class="add-condition-form hidden"> |
221 | 221 | <div class="no-conditions hidden"> |
222 | - ' . esc_html__( 'No conditions available.', 'wordpoints' ) . ' |
|
222 | + ' . esc_html__('No conditions available.', 'wordpoints').' |
|
223 | 223 | </div> |
224 | 224 | <div class="condition-selectors"> |
225 | 225 | <div class="arg-selectors"></div> |
226 | 226 | <div class="condition-selector"></div> |
227 | 227 | </div> |
228 | - <button type="button" class="confirm-add-new button-secondary button-link" disabled aria-label="' . esc_attr__( 'Add Condition', 'wordpoints' ) . '"> |
|
229 | - ' . esc_html_x( 'Add', 'reaction condition', 'wordpoints' ) . ' |
|
228 | + <button type="button" class="confirm-add-new button-secondary button-link" disabled aria-label="' . esc_attr__('Add Condition', 'wordpoints').'"> |
|
229 | + ' . esc_html_x('Add', 'reaction condition', 'wordpoints').' |
|
230 | 230 | </button> |
231 | - <button type="button" class="cancel-add-new button-secondary button-link" aria-label="' . esc_attr__( 'Cancel Adding New Condition', 'wordpoints' ) . '"> |
|
232 | - ' . esc_html_x( 'Cancel', 'reaction condition', 'wordpoints' ) . ' |
|
231 | + <button type="button" class="cancel-add-new button-secondary button-link" aria-label="' . esc_attr__('Cancel Adding New Condition', 'wordpoints').'"> |
|
232 | + ' . esc_html_x('Cancel', 'reaction condition', 'wordpoints').' |
|
233 | 233 | </button> |
234 | 234 | </div> |
235 | 235 | <div class="condition-groups"></div> |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | <div class="condition-controls"> |
244 | 244 | <div class="condition-title"></div> |
245 | 245 | <button type="button" class="delete button-secondary button-link"> |
246 | - <span class="screen-reader-text">' . esc_html__( 'Remove Condition', 'wordpoints' ) . '</span> |
|
246 | + <span class="screen-reader-text">' . esc_html__('Remove Condition', 'wordpoints').'</span> |
|
247 | 247 | <span class="dashicons dashicons-no"></span> |
248 | 248 | </button> |
249 | 249 | </div> |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | ' |
260 | 260 | ); |
261 | 261 | } |
262 | -add_action( 'admin_init', 'wordpoints_hooks_admin_register_scripts' ); |
|
262 | +add_action('admin_init', 'wordpoints_hooks_admin_register_scripts'); |
|
263 | 263 | |
264 | 264 | /** |
265 | 265 | * Export the data for the scripts needed to make the hooks UI work. |
@@ -272,32 +272,32 @@ discard block |
||
272 | 272 | |
273 | 273 | $extensions_data = array(); |
274 | 274 | |
275 | - foreach ( $hooks->extensions->get_all() as $slug => $extension ) { |
|
275 | + foreach ($hooks->extensions->get_all() as $slug => $extension) { |
|
276 | 276 | |
277 | - if ( $extension instanceof WordPoints_Hook_Extension ) { |
|
278 | - $extensions_data[ $slug ] = $extension->get_ui_script_data(); |
|
277 | + if ($extension instanceof WordPoints_Hook_Extension) { |
|
278 | + $extensions_data[$slug] = $extension->get_ui_script_data(); |
|
279 | 279 | } |
280 | 280 | |
281 | - if ( wp_script_is( "wordpoints-hooks-extension-{$slug}", 'registered' ) ) { |
|
282 | - wp_enqueue_script( "wordpoints-hooks-extension-{$slug}" ); |
|
281 | + if (wp_script_is("wordpoints-hooks-extension-{$slug}", 'registered')) { |
|
282 | + wp_enqueue_script("wordpoints-hooks-extension-{$slug}"); |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
286 | 286 | $reactor_data = array(); |
287 | 287 | |
288 | - foreach ( $hooks->reactors->get_all() as $slug => $reactor ) { |
|
288 | + foreach ($hooks->reactors->get_all() as $slug => $reactor) { |
|
289 | 289 | |
290 | - if ( $reactor instanceof WordPoints_Hook_Reactor ) { |
|
291 | - $reactor_data[ $slug ] = array( |
|
290 | + if ($reactor instanceof WordPoints_Hook_Reactor) { |
|
291 | + $reactor_data[$slug] = array( |
|
292 | 292 | 'slug' => $reactor->get_slug(), |
293 | 293 | 'fields' => $reactor->get_settings_fields(), |
294 | 294 | 'arg_types' => $reactor->get_arg_types(), |
295 | - 'target_label' => __( 'Award To', 'wordpoints' ), |
|
295 | + 'target_label' => __('Award To', 'wordpoints'), |
|
296 | 296 | ); |
297 | 297 | } |
298 | 298 | |
299 | - if ( wp_script_is( "wordpoints-hooks-reactor-{$slug}", 'registered' ) ) { |
|
300 | - wp_enqueue_script( "wordpoints-hooks-reactor-{$slug}" ); |
|
299 | + if (wp_script_is("wordpoints-hooks-reactor-{$slug}", 'registered')) { |
|
300 | + wp_enqueue_script("wordpoints-hooks-reactor-{$slug}"); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
@@ -309,28 +309,28 @@ discard block |
||
309 | 309 | $entity_children = $entities->children; |
310 | 310 | |
311 | 311 | /** @var WordPoints_Entity $entity */ |
312 | - foreach ( $entities->get_all() as $slug => $entity ) { |
|
312 | + foreach ($entities->get_all() as $slug => $entity) { |
|
313 | 313 | |
314 | 314 | $child_data = array(); |
315 | 315 | |
316 | 316 | /** @var WordPoints_EntityishI $child */ |
317 | - foreach ( $entity_children->get_children( $slug ) as $child_slug => $child ) { |
|
317 | + foreach ($entity_children->get_children($slug) as $child_slug => $child) { |
|
318 | 318 | |
319 | - $child_data[ $child_slug ] = array( |
|
319 | + $child_data[$child_slug] = array( |
|
320 | 320 | 'slug' => $child_slug, |
321 | 321 | 'title' => $child->get_title(), |
322 | 322 | ); |
323 | 323 | |
324 | - if ( $child instanceof WordPoints_Entity_Attr ) { |
|
324 | + if ($child instanceof WordPoints_Entity_Attr) { |
|
325 | 325 | |
326 | - $child_data[ $child_slug ]['_type'] = 'attr'; |
|
327 | - $child_data[ $child_slug ]['data_type'] = $child->get_data_type(); |
|
326 | + $child_data[$child_slug]['_type'] = 'attr'; |
|
327 | + $child_data[$child_slug]['data_type'] = $child->get_data_type(); |
|
328 | 328 | |
329 | - } elseif ( $child instanceof WordPoints_Entity_Relationship ) { |
|
329 | + } elseif ($child instanceof WordPoints_Entity_Relationship) { |
|
330 | 330 | |
331 | - $child_data[ $child_slug ]['_type'] = 'relationship'; |
|
332 | - $child_data[ $child_slug ]['primary'] = $child->get_primary_entity_slug(); |
|
333 | - $child_data[ $child_slug ]['secondary'] = $child->get_related_entity_slug(); |
|
331 | + $child_data[$child_slug]['_type'] = 'relationship'; |
|
332 | + $child_data[$child_slug]['primary'] = $child->get_primary_entity_slug(); |
|
333 | + $child_data[$child_slug]['secondary'] = $child->get_related_entity_slug(); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -341,10 +341,10 @@ discard block |
||
341 | 341 | * @param array $data The data for the entity child. |
342 | 342 | * @param WordPoints_Entityish $child The child's object. |
343 | 343 | */ |
344 | - $child_data[ $child_slug ] = apply_filters( 'wordpoints_hooks_ui_data_entity_child', $child_data[ $child_slug ], $child ); |
|
344 | + $child_data[$child_slug] = apply_filters('wordpoints_hooks_ui_data_entity_child', $child_data[$child_slug], $child); |
|
345 | 345 | } |
346 | 346 | |
347 | - $entities_data[ $slug ] = array( |
|
347 | + $entities_data[$slug] = array( |
|
348 | 348 | 'slug' => $slug, |
349 | 349 | 'title' => $entity->get_title(), |
350 | 350 | 'children' => $child_data, |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | '_type' => 'entity', |
353 | 353 | ); |
354 | 354 | |
355 | - if ( $entity instanceof WordPoints_Entity_EnumerableI ) { |
|
355 | + if ($entity instanceof WordPoints_Entity_EnumerableI) { |
|
356 | 356 | |
357 | 357 | $values = array(); |
358 | 358 | |
359 | - foreach ( $entity->get_enumerated_values() as $value ) { |
|
360 | - if ( $entity->set_the_value( $value ) ) { |
|
359 | + foreach ($entity->get_enumerated_values() as $value) { |
|
360 | + if ($entity->set_the_value($value)) { |
|
361 | 361 | $values[] = array( |
362 | 362 | 'value' => $entity->get_the_id(), |
363 | 363 | 'label' => $entity->get_the_human_id(), |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
368 | - $entities_data[ $slug ]['values'] = $values; |
|
368 | + $entities_data[$slug]['values'] = $values; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | * @param array $data The data for the entity. |
375 | 375 | * @param WordPoints_Entity $entity The entity object. |
376 | 376 | */ |
377 | - $entities_data[ $slug ] = apply_filters( 'wordpoints_hooks_ui_data_entity', $entities_data[ $slug ], $entity ); |
|
377 | + $entities_data[$slug] = apply_filters('wordpoints_hooks_ui_data_entity', $entities_data[$slug], $entity); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | $data = array( |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | * |
396 | 396 | * @param array $data The data. |
397 | 397 | */ |
398 | - $data = apply_filters( 'wordpoints_hooks_ui_data', $data ); |
|
398 | + $data = apply_filters('wordpoints_hooks_ui_data', $data); |
|
399 | 399 | |
400 | 400 | wp_localize_script( |
401 | 401 | 'wordpoints-hooks-models' |
@@ -418,19 +418,19 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @return string The HTML with templates appended. |
420 | 420 | */ |
421 | -function wordpoints_script_templates_filter( $html, $handle ) { |
|
421 | +function wordpoints_script_templates_filter($html, $handle) { |
|
422 | 422 | |
423 | 423 | global $wp_scripts; |
424 | 424 | |
425 | - $templates = $wp_scripts->get_data( $handle, 'wordpoints-templates' ); |
|
425 | + $templates = $wp_scripts->get_data($handle, 'wordpoints-templates'); |
|
426 | 426 | |
427 | - if ( $templates ) { |
|
427 | + if ($templates) { |
|
428 | 428 | $html .= $templates; |
429 | 429 | } |
430 | 430 | |
431 | 431 | return $html; |
432 | 432 | } |
433 | -add_filter( 'script_loader_tag', 'wordpoints_script_templates_filter', 10, 2 ); |
|
433 | +add_filter('script_loader_tag', 'wordpoints_script_templates_filter', 10, 2); |
|
434 | 434 | |
435 | 435 | /** |
436 | 436 | * Initialize the Ajax actions. |
@@ -439,10 +439,10 @@ discard block |
||
439 | 439 | */ |
440 | 440 | function wordpoints_hooks_admin_ajax() { |
441 | 441 | |
442 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
442 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
443 | 443 | new WordPoints_Admin_Ajax_Hooks; |
444 | 444 | } |
445 | 445 | } |
446 | -add_action( 'admin_init', 'wordpoints_hooks_admin_ajax' ); |
|
446 | +add_action('admin_init', 'wordpoints_hooks_admin_ajax'); |
|
447 | 447 | |
448 | 448 | // EOF |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @since 1.0.0 |
46 | 46 | */ |
47 | -require_once( dirname( __FILE__ ) . '/includes/constants.php' ); |
|
47 | +require_once(dirname(__FILE__).'/includes/constants.php'); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * The module's functions. |
51 | 51 | * |
52 | 52 | * @since 1.0.0 |
53 | 53 | */ |
54 | -require_once( dirname( __FILE__ ) . '/includes/functions.php' ); |
|
54 | +require_once(dirname(__FILE__).'/includes/functions.php'); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * The module's actions and filters. |
58 | 58 | * |
59 | 59 | * @since 1.0.0 |
60 | 60 | */ |
61 | -require_once( dirname( __FILE__ ) . '/includes/actions.php' ); |
|
61 | +require_once(dirname(__FILE__).'/includes/actions.php'); |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Class autoloader. |
@@ -67,22 +67,22 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.0.0 |
69 | 69 | */ |
70 | -require_once( dirname( __FILE__ ) . '/includes/classes/class/autoloader.php' ); |
|
70 | +require_once(dirname(__FILE__).'/includes/classes/class/autoloader.php'); |
|
71 | 71 | |
72 | 72 | // Register the classes to autoload. |
73 | 73 | WordPoints_Class_Autoloader::register_dir( |
74 | - dirname( __FILE__ ) . '/includes/classes' |
|
74 | + dirname(__FILE__).'/includes/classes' |
|
75 | 75 | , 'WordPoints_' |
76 | 76 | ); |
77 | 77 | |
78 | -if ( is_admin() ) { |
|
78 | +if (is_admin()) { |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Administration-side code. |
82 | 82 | * |
83 | 83 | * @since 1.0.0 |
84 | 84 | */ |
85 | - require_once( dirname( __FILE__ ) . '/admin/admin.php' ); |
|
85 | + require_once(dirname(__FILE__).'/admin/admin.php'); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | // EOF |
@@ -7,21 +7,21 @@ |
||
7 | 7 | * @since 1.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -add_action( 'wordpoints_init_app-apps', 'wordpoints_apps_init' ); |
|
11 | -add_action( 'wordpoints_init_app-entities', 'wordpoints_entities_app_init' ); |
|
10 | +add_action('wordpoints_init_app-apps', 'wordpoints_apps_init'); |
|
11 | +add_action('wordpoints_init_app-entities', 'wordpoints_entities_app_init'); |
|
12 | 12 | |
13 | -add_action( 'wordpoints_init_app_registry-apps-entities', 'wordpoints_entities_init' ); |
|
14 | -add_action( 'wordpoints_init_app_registry-apps-data_types', 'wordpoints_data_types_init' ); |
|
13 | +add_action('wordpoints_init_app_registry-apps-entities', 'wordpoints_entities_init'); |
|
14 | +add_action('wordpoints_init_app_registry-apps-data_types', 'wordpoints_data_types_init'); |
|
15 | 15 | |
16 | -add_action( 'wordpoints_init_app_registry-hooks-firers', 'wordpoints_hook_firers_init' ); |
|
17 | -add_action( 'wordpoints_init_app_registry-hooks-events', 'wordpoints_hook_events_init' ); |
|
18 | -add_action( 'wordpoints_init_app_registry-hooks-actions', 'wordpoints_hook_actions_init' ); |
|
19 | -add_action( 'wordpoints_init_app_registry-hooks-reactors', 'wordpoints_hook_reactors_init' ); |
|
20 | -add_action( 'wordpoints_init_app_registry-hooks-extensions', 'wordpoints_hook_extension_init' ); |
|
21 | -add_action( 'wordpoints_init_app_registry-hooks-conditions', 'wordpoints_hook_conditions_init' ); |
|
16 | +add_action('wordpoints_init_app_registry-hooks-firers', 'wordpoints_hook_firers_init'); |
|
17 | +add_action('wordpoints_init_app_registry-hooks-events', 'wordpoints_hook_events_init'); |
|
18 | +add_action('wordpoints_init_app_registry-hooks-actions', 'wordpoints_hook_actions_init'); |
|
19 | +add_action('wordpoints_init_app_registry-hooks-reactors', 'wordpoints_hook_reactors_init'); |
|
20 | +add_action('wordpoints_init_app_registry-hooks-extensions', 'wordpoints_hook_extension_init'); |
|
21 | +add_action('wordpoints_init_app_registry-hooks-conditions', 'wordpoints_hook_conditions_init'); |
|
22 | 22 | |
23 | -add_action( 'wordpoints_modules_loaded', 'wordpoints_init_hooks' ); |
|
23 | +add_action('wordpoints_modules_loaded', 'wordpoints_init_hooks'); |
|
24 | 24 | |
25 | -add_filter( 'wordpoints_user_can_view_points_log', 'wordpoints_hooks_user_can_view_points_log' ); |
|
25 | +add_filter('wordpoints_user_can_view_points_log', 'wordpoints_hooks_user_can_view_points_log'); |
|
26 | 26 | |
27 | 27 | // EOF |
@@ -88,16 +88,16 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * @since 1.0.0 |
90 | 90 | */ |
91 | - public function __construct( $slug, $parent = null ) { |
|
91 | + public function __construct($slug, $parent = null) { |
|
92 | 92 | |
93 | 93 | $this->slug = $slug; |
94 | 94 | $this->full_slug = $slug; |
95 | 95 | |
96 | - if ( $parent instanceof WordPoints_App ) { |
|
96 | + if ($parent instanceof WordPoints_App) { |
|
97 | 97 | $this->parent = $parent; |
98 | 98 | |
99 | - if ( 'apps' !== $this->parent->full_slug ) { |
|
100 | - $this->full_slug = $this->parent->full_slug . '-' . $this->full_slug; |
|
99 | + if ('apps' !== $this->parent->full_slug) { |
|
100 | + $this->full_slug = $this->parent->full_slug.'-'.$this->full_slug; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -109,29 +109,29 @@ discard block |
||
109 | 109 | /** |
110 | 110 | * @since 1.0.0 |
111 | 111 | */ |
112 | - public function __isset( $var ) { |
|
113 | - return $this->sub_apps->is_registered( $var ); |
|
112 | + public function __isset($var) { |
|
113 | + return $this->sub_apps->is_registered($var); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | 117 | * @since 1.0.0 |
118 | 118 | */ |
119 | - public function __get( $var ) { |
|
119 | + public function __get($var) { |
|
120 | 120 | |
121 | - if ( 'sub_apps' === $var ) { |
|
121 | + if ('sub_apps' === $var) { |
|
122 | 122 | return $this->$var; |
123 | 123 | } |
124 | 124 | |
125 | - $sub = $this->sub_apps->get( $var, array( $this ) ); |
|
125 | + $sub = $this->sub_apps->get($var, array($this)); |
|
126 | 126 | |
127 | - if ( ! $sub ) { |
|
127 | + if ( ! $sub) { |
|
128 | 128 | return null; |
129 | 129 | } |
130 | 130 | |
131 | 131 | if ( |
132 | - empty( $this->did_init[ $var ] ) |
|
132 | + empty($this->did_init[$var]) |
|
133 | 133 | && ! self::$main->silent |
134 | - && $this->should_do_registry_init( $sub ) |
|
134 | + && $this->should_do_registry_init($sub) |
|
135 | 135 | ) { |
136 | 136 | |
137 | 137 | /** |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | * @param WordPoints_Class_RegistryI|WordPoints_Class_Registry_ChildrenI |
145 | 145 | * $registry The registry object. |
146 | 146 | */ |
147 | - do_action( "wordpoints_init_app_registry-{$this->full_slug}-{$var}", $sub ); |
|
147 | + do_action("wordpoints_init_app_registry-{$this->full_slug}-{$var}", $sub); |
|
148 | 148 | |
149 | - $this->did_init[ $var ] = true; |
|
149 | + $this->did_init[$var] = true; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | return $sub; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | /** |
156 | 156 | * @since 1.0.0 |
157 | 157 | */ |
158 | - public function __set( $var, $value ) { |
|
158 | + public function __set($var, $value) { |
|
159 | 159 | |
160 | 160 | _doing_it_wrong( |
161 | 161 | __METHOD__ |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * @since 1.0.0 |
169 | 169 | */ |
170 | - public function __unset( $var ) { |
|
170 | + public function __unset($var) { |
|
171 | 171 | |
172 | 172 | _doing_it_wrong( |
173 | 173 | __METHOD__ |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @return bool Whether to call the init action or not. |
187 | 187 | */ |
188 | - protected function should_do_registry_init( $registry ) { |
|
188 | + protected function should_do_registry_init($registry) { |
|
189 | 189 | return ( |
190 | 190 | $registry instanceof WordPoints_Class_RegistryI |
191 | 191 | || $registry instanceof WordPoints_Class_Registry_ChildrenI |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @param WordPoints_App $app The app object. |
211 | 211 | */ |
212 | - do_action( "wordpoints_init_app-{$this->full_slug}", $this ); |
|
212 | + do_action("wordpoints_init_app-{$this->full_slug}", $this); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 |