@@ -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,10 +75,10 @@ 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' ); |
|
81 | - wp_enqueue_script( 'wordpoints-admin-points-types' ); |
|
80 | + wp_enqueue_script('postbox'); |
|
81 | + wp_enqueue_script('wordpoints-admin-points-types'); |
|
82 | 82 | |
83 | 83 | wordpoints_hooks_ui_setup_script_data(); |
84 | 84 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | .addClass( 'closed' ); |
99 | 99 | |
100 | 100 | postboxes.add_postbox_toggles( |
101 | - <?php echo wp_json_encode( $this->id ); ?> |
|
101 | + <?php echo wp_json_encode($this->id); ?> |
|
102 | 102 | ); |
103 | 103 | } ); |
104 | 104 | </script> |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function add_points_settings_meta_box() { |
115 | 115 | |
116 | - if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) { |
|
116 | + if ( ! current_user_can('manage_wordpoints_points_types')) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | |
120 | 120 | add_meta_box( |
121 | 121 | 'settings' |
122 | - , __( 'Settings', 'wordpoints' ) |
|
123 | - , array( $this, 'display_points_settings_meta_box' ) |
|
122 | + , __('Settings', 'wordpoints') |
|
123 | + , array($this, 'display_points_settings_meta_box') |
|
124 | 124 | , $this->id |
125 | 125 | , 'side' |
126 | 126 | , 'default' |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function display_points_settings_meta_box() { |
136 | 136 | |
137 | - if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) { |
|
137 | + if ( ! current_user_can('manage_wordpoints_points_types')) { |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | |
143 | 143 | $add_new = 0; |
144 | 144 | |
145 | - $points_type = wordpoints_get_points_type( $slug ); |
|
145 | + $points_type = wordpoints_get_points_type($slug); |
|
146 | 146 | |
147 | - if ( ! $points_type ) { |
|
147 | + if ( ! $points_type) { |
|
148 | 148 | |
149 | 149 | $points_type = array(); |
150 | - $add_new = wp_create_nonce( 'wordpoints_add_new_points_type' ); |
|
150 | + $add_new = wp_create_nonce('wordpoints_add_new_points_type'); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | $points_type = array_merge( |
@@ -162,15 +162,15 @@ discard block |
||
162 | 162 | ?> |
163 | 163 | |
164 | 164 | <form method="post"> |
165 | - <?php if ( $slug ) : ?> |
|
165 | + <?php if ($slug) : ?> |
|
166 | 166 | <p> |
167 | 167 | <span class="wordpoints-points-slug"> |
168 | 168 | <em> |
169 | - <?php echo esc_html( sprintf( __( 'Slug: %s', 'wordpoints' ), $slug ) ); ?> |
|
169 | + <?php echo esc_html(sprintf(__('Slug: %s', 'wordpoints'), $slug)); ?> |
|
170 | 170 | </em> |
171 | 171 | </span> |
172 | 172 | </p> |
173 | - <?php wp_nonce_field( "wordpoints_update_points_type-$slug", 'update_points_type' ); ?> |
|
173 | + <?php wp_nonce_field("wordpoints_update_points_type-$slug", 'update_points_type'); ?> |
|
174 | 174 | <?php endif; ?> |
175 | 175 | |
176 | 176 | <?php |
@@ -184,45 +184,45 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @param string $points_type The slug of the points type. |
186 | 186 | */ |
187 | - do_action( 'wordpoints_points_type_form_top', $slug ); |
|
187 | + do_action('wordpoints_points_type_form_top', $slug); |
|
188 | 188 | |
189 | - if ( $add_new ) { |
|
189 | + if ($add_new) { |
|
190 | 190 | |
191 | 191 | // Mark the prefix and suffix optional on the add new form. |
192 | - $prefix = _x( 'Prefix (optional):', 'points type', 'wordpoints' ); |
|
193 | - $suffix = _x( 'Suffix (optional):', 'points type', 'wordpoints' ); |
|
192 | + $prefix = _x('Prefix (optional):', 'points type', 'wordpoints'); |
|
193 | + $suffix = _x('Suffix (optional):', 'points type', 'wordpoints'); |
|
194 | 194 | |
195 | 195 | } else { |
196 | 196 | |
197 | - $prefix = _x( 'Prefix:', 'points type', 'wordpoints' ); |
|
198 | - $suffix = _x( 'Suffix:', 'points type', 'wordpoints' ); |
|
197 | + $prefix = _x('Prefix:', 'points type', 'wordpoints'); |
|
198 | + $suffix = _x('Suffix:', 'points type', 'wordpoints'); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | ?> |
202 | 202 | |
203 | 203 | <p> |
204 | 204 | <label |
205 | - for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label> |
|
205 | + for="points-name-<?php echo esc_attr($slug); ?>"><?php echo esc_html_x('Name:', 'points type', 'wordpoints'); ?></label> |
|
206 | 206 | <input class="widefat" type="text" |
207 | - id="points-name-<?php echo esc_attr( $slug ); ?>" |
|
207 | + id="points-name-<?php echo esc_attr($slug); ?>" |
|
208 | 208 | name="points-name" |
209 | - value="<?php echo esc_attr( $points_type['name'] ); ?>"/> |
|
209 | + value="<?php echo esc_attr($points_type['name']); ?>"/> |
|
210 | 210 | </p> |
211 | 211 | <p> |
212 | 212 | <label |
213 | - for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label> |
|
213 | + for="points-prefix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($prefix); ?></label> |
|
214 | 214 | <input class="widefat" type="text" |
215 | - id="points-prefix-<?php echo esc_attr( $slug ); ?>" |
|
215 | + id="points-prefix-<?php echo esc_attr($slug); ?>" |
|
216 | 216 | name="points-prefix" |
217 | - value="<?php echo esc_attr( $points_type['prefix'] ); ?>"/> |
|
217 | + value="<?php echo esc_attr($points_type['prefix']); ?>"/> |
|
218 | 218 | </p> |
219 | 219 | <p> |
220 | 220 | <label |
221 | - for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label> |
|
221 | + for="points-suffix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($suffix); ?></label> |
|
222 | 222 | <input class="widefat" type="text" |
223 | - id="points-suffix-<?php echo esc_attr( $slug ); ?>" |
|
223 | + id="points-suffix-<?php echo esc_attr($slug); ?>" |
|
224 | 224 | name="points-suffix" |
225 | - value="<?php echo esc_attr( $points_type['suffix'] ); ?>"/> |
|
225 | + value="<?php echo esc_attr($points_type['suffix']); ?>"/> |
|
226 | 226 | </p> |
227 | 227 | |
228 | 228 | <?php |
@@ -236,28 +236,28 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @param string $points_type The slug of the points type. |
238 | 238 | */ |
239 | - do_action( 'wordpoints_points_type_form_bottom', $slug ); |
|
239 | + do_action('wordpoints_points_type_form_bottom', $slug); |
|
240 | 240 | |
241 | 241 | ?> |
242 | 242 | |
243 | 243 | <input type="hidden" name="points-slug" |
244 | - value="<?php echo esc_attr( $slug ); ?>"/> |
|
244 | + value="<?php echo esc_attr($slug); ?>"/> |
|
245 | 245 | <input type="hidden" name="add_new" class="add_new" |
246 | - value="<?php echo esc_attr( $add_new ); ?>"/> |
|
246 | + value="<?php echo esc_attr($add_new); ?>"/> |
|
247 | 247 | |
248 | 248 | <div class="hook-control-actions"> |
249 | 249 | <div class="alignleft"> |
250 | 250 | <?php |
251 | 251 | |
252 | - if ( ! $add_new ) { |
|
253 | - wp_nonce_field( "wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce' ); |
|
254 | - submit_button( _x( 'Delete', 'points type', 'wordpoints' ), 'delete', 'delete-points-type', false, array( 'id' => "delete_points_type-{$slug}" ) ); |
|
252 | + if ( ! $add_new) { |
|
253 | + wp_nonce_field("wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce'); |
|
254 | + submit_button(_x('Delete', 'points type', 'wordpoints'), 'delete', 'delete-points-type', false, array('id' => "delete_points_type-{$slug}")); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | ?> |
258 | 258 | </div> |
259 | 259 | <div class="alignright"> |
260 | - <?php submit_button( _x( 'Save', 'points type', 'wordpoints' ), 'button-primary hook-control-save right', 'save-points-type', false, array( 'id' => "points-{$slug}-save" ) ); ?> |
|
260 | + <?php submit_button(_x('Save', 'points type', 'wordpoints'), 'button-primary hook-control-save right', 'save-points-type', false, array('id' => "points-{$slug}-save")); ?> |
|
261 | 261 | <span class="spinner"></span> |
262 | 262 | </div> |
263 | 263 | <br class="clear"/> |
@@ -274,18 +274,18 @@ discard block |
||
274 | 274 | */ |
275 | 275 | public function add_event_meta_boxes() { |
276 | 276 | |
277 | - if ( ! $this->current_points_type ) { |
|
277 | + if ( ! $this->current_points_type) { |
|
278 | 278 | return; |
279 | 279 | } |
280 | 280 | |
281 | 281 | /** @var WordPoints_Hook_ReactorI $reactor */ |
282 | - $reactor = $this->hooks->get_sub_app( 'reactors' )->get( 'points' ); |
|
283 | - $reactor_action_types = array_fill_keys( $reactor->get_action_types(), true ); |
|
282 | + $reactor = $this->hooks->get_sub_app('reactors')->get('points'); |
|
283 | + $reactor_action_types = array_fill_keys($reactor->get_action_types(), true); |
|
284 | 284 | |
285 | 285 | $event_action_types = wordpoints_hooks_ui_get_script_data_event_action_types(); |
286 | 286 | |
287 | 287 | /** @var WordPoints_Hook_EventI[] $events */ |
288 | - $events = $this->hooks->get_sub_app( 'events' )->get_all(); |
|
288 | + $events = $this->hooks->get_sub_app('events')->get_all(); |
|
289 | 289 | |
290 | 290 | /** |
291 | 291 | * Filter the events to show meta boxes for on the Points Types admin screen. |
@@ -305,11 +305,11 @@ discard block |
||
305 | 305 | , $this->current_points_type |
306 | 306 | ); |
307 | 307 | |
308 | - foreach ( $events as $slug => $event ) { |
|
308 | + foreach ($events as $slug => $event) { |
|
309 | 309 | |
310 | 310 | if ( |
311 | 311 | ! array_intersect_key( |
312 | - $event_action_types[ $slug ] |
|
312 | + $event_action_types[$slug] |
|
313 | 313 | , $reactor_action_types |
314 | 314 | ) |
315 | 315 | ) { |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | add_meta_box( |
320 | 320 | "{$this->current_points_type}-{$slug}" |
321 | 321 | , $event->get_title() |
322 | - , array( $this, 'display_event_meta_box' ) |
|
322 | + , array($this, 'display_event_meta_box') |
|
323 | 323 | , $this->id |
324 | 324 | , 'events' |
325 | 325 | , 'default' |
@@ -340,54 +340,54 @@ discard block |
||
340 | 340 | * @param array $points_type The points type this meta-box relates to. |
341 | 341 | * @param array $meta_box The data the meta-box was created with. |
342 | 342 | */ |
343 | - public function display_event_meta_box( $points_type, $meta_box ) { |
|
343 | + public function display_event_meta_box($points_type, $meta_box) { |
|
344 | 344 | |
345 | 345 | $event_slug = $meta_box['args']['slug']; |
346 | 346 | |
347 | 347 | $data = array(); |
348 | 348 | |
349 | - $reaction_store = wordpoints_hooks()->get_reaction_store( 'points' ); |
|
349 | + $reaction_store = wordpoints_hooks()->get_reaction_store('points'); |
|
350 | 350 | |
351 | - foreach ( $reaction_store->get_reactions_to_event( $event_slug ) as $id => $reaction ) { |
|
352 | - if ( $reaction->get_meta( 'points_type' ) === $this->current_points_type ) { |
|
351 | + foreach ($reaction_store->get_reactions_to_event($event_slug) as $id => $reaction) { |
|
352 | + if ($reaction->get_meta('points_type') === $this->current_points_type) { |
|
353 | 353 | $data[] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction( |
354 | 354 | $reaction |
355 | 355 | ); |
356 | 356 | } |
357 | 357 | } |
358 | 358 | |
359 | - $args = $this->hooks->get_sub_app( 'events' )->get_sub_app( 'args' )->get_children( $event_slug ); |
|
359 | + $args = $this->hooks->get_sub_app('events')->get_sub_app('args')->get_children($event_slug); |
|
360 | 360 | |
361 | - $event_data = array( 'args' => array() ); |
|
361 | + $event_data = array('args' => array()); |
|
362 | 362 | |
363 | - foreach ( $args as $slug => $arg ) { |
|
363 | + foreach ($args as $slug => $arg) { |
|
364 | 364 | |
365 | - $event_data['args'][ $slug ] = array( |
|
365 | + $event_data['args'][$slug] = array( |
|
366 | 366 | 'slug' => $slug, |
367 | 367 | ); |
368 | 368 | |
369 | - if ( $arg instanceof WordPoints_Hook_ArgI ) { |
|
370 | - $event_data['args'][ $slug ]['title'] = $arg->get_title(); |
|
371 | - $event_data['args'][ $slug ]['is_stateful'] = $arg->is_stateful(); |
|
369 | + if ($arg instanceof WordPoints_Hook_ArgI) { |
|
370 | + $event_data['args'][$slug]['title'] = $arg->get_title(); |
|
371 | + $event_data['args'][$slug]['is_stateful'] = $arg->is_stateful(); |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | |
375 | 375 | ?> |
376 | 376 | |
377 | 377 | <script> |
378 | - WordPointsHooksAdminData.events[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $event_data ); ?>; |
|
379 | - WordPointsHooksAdminData.reactions[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $data ); ?>; |
|
378 | + WordPointsHooksAdminData.events[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($event_data); ?>; |
|
379 | + WordPointsHooksAdminData.reactions[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($data); ?>; |
|
380 | 380 | </script> |
381 | 381 | |
382 | 382 | <div class="wordpoints-hook-reaction-group-container"> |
383 | 383 | <p class="description wordpoints-hook-reaction-group-description"> |
384 | - <?php echo esc_html( $meta_box['args']['event']->get_description() ); ?> |
|
384 | + <?php echo esc_html($meta_box['args']['event']->get_description()); ?> |
|
385 | 385 | </p> |
386 | 386 | |
387 | 387 | <div class="wordpoints-hook-reaction-group" |
388 | - data-wordpoints-hooks-hook-event="<?php echo esc_attr( $event_slug ); ?>" |
|
389 | - data-wordpoints-hooks-points-type="<?php echo esc_attr( $this->current_points_type ); ?>" |
|
390 | - data-wordpoints-hooks-create-nonce="<?php echo esc_attr( WordPoints_Admin_Ajax_Hooks::get_create_nonce( $reaction_store ) ); ?>" |
|
388 | + data-wordpoints-hooks-hook-event="<?php echo esc_attr($event_slug); ?>" |
|
389 | + data-wordpoints-hooks-points-type="<?php echo esc_attr($this->current_points_type); ?>" |
|
390 | + data-wordpoints-hooks-create-nonce="<?php echo esc_attr(WordPoints_Admin_Ajax_Hooks::get_create_nonce($reaction_store)); ?>" |
|
391 | 391 | data-wordpoints-hooks-reaction-store="points" |
392 | 392 | data-wordpoints-hooks-reactor="points"> |
393 | 393 | </div> |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | |
403 | 403 | <div class="controls"> |
404 | 404 | <button type="button" class="button-primary add-reaction"> |
405 | - <?php esc_html_e( 'Add New', 'wordpoints' ); ?> |
|
405 | + <?php esc_html_e('Add New', 'wordpoints'); ?> |
|
406 | 406 | </button> |
407 | 407 | </div> |
408 | 408 | </div> |
@@ -422,19 +422,19 @@ discard block |
||
422 | 422 | // Show a tab for each points type. |
423 | 423 | $tabs = array(); |
424 | 424 | |
425 | - foreach ( $points_types as $slug => $settings ) { |
|
426 | - $tabs[ $slug ] = $settings['name']; |
|
425 | + foreach ($points_types as $slug => $settings) { |
|
426 | + $tabs[$slug] = $settings['name']; |
|
427 | 427 | } |
428 | 428 | |
429 | - $tabs['add-new'] = __( 'Add New', 'wordpoints' ); |
|
429 | + $tabs['add-new'] = __('Add New', 'wordpoints'); |
|
430 | 430 | |
431 | - $tab = wordpoints_admin_get_current_tab( $tabs ); |
|
431 | + $tab = wordpoints_admin_get_current_tab($tabs); |
|
432 | 432 | |
433 | - if ( 'add-new' !== $tab ) { |
|
433 | + if ('add-new' !== $tab) { |
|
434 | 434 | $this->current_points_type = $tab; |
435 | 435 | } |
436 | 436 | |
437 | - do_action( 'add_meta_boxes', $this->id ); |
|
437 | + do_action('add_meta_boxes', $this->id); |
|
438 | 438 | |
439 | 439 | $this->tabs = $tabs; |
440 | 440 | } |
@@ -446,19 +446,19 @@ discard block |
||
446 | 446 | */ |
447 | 447 | public function save_points_type() { |
448 | 448 | |
449 | - if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) { |
|
449 | + if ( ! current_user_can('manage_wordpoints_points_types')) { |
|
450 | 450 | return; |
451 | 451 | } |
452 | 452 | |
453 | - if ( isset( $_POST['save-points-type'] ) ) { // WPCS: CSRF OK |
|
453 | + if (isset($_POST['save-points-type'])) { // WPCS: CSRF OK |
|
454 | 454 | |
455 | - if ( isset( $_POST['points-slug'] ) ) { // WPCS: CSRF OK |
|
455 | + if (isset($_POST['points-slug'])) { // WPCS: CSRF OK |
|
456 | 456 | $this->update_points_type(); |
457 | 457 | } else { |
458 | 458 | $this->add_points_type(); |
459 | 459 | } |
460 | 460 | |
461 | - } elseif ( ! empty( $_POST['delete-points-type'] ) ) { // WPCS: CSRF OK |
|
461 | + } elseif ( ! empty($_POST['delete-points-type'])) { // WPCS: CSRF OK |
|
462 | 462 | |
463 | 463 | $this->delete_points_type(); |
464 | 464 | } |
@@ -475,21 +475,21 @@ discard block |
||
475 | 475 | |
476 | 476 | $settings = array(); |
477 | 477 | |
478 | - if ( isset( $_POST['points-name'] ) ) { // WPCS: CSRF OK |
|
478 | + if (isset($_POST['points-name'])) { // WPCS: CSRF OK |
|
479 | 479 | $settings['name'] = trim( |
480 | - sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) // WPCS: CSRF OK |
|
480 | + sanitize_text_field(wp_unslash($_POST['points-name'])) // WPCS: CSRF OK |
|
481 | 481 | ); |
482 | 482 | } |
483 | 483 | |
484 | - if ( isset( $_POST['points-prefix'] ) ) { // WPCS: CSRF OK |
|
484 | + if (isset($_POST['points-prefix'])) { // WPCS: CSRF OK |
|
485 | 485 | $settings['prefix'] = ltrim( |
486 | - sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) // WPCS: CSRF OK |
|
486 | + sanitize_text_field(wp_unslash($_POST['points-prefix'])) // WPCS: CSRF OK |
|
487 | 487 | ); |
488 | 488 | } |
489 | 489 | |
490 | - if ( isset( $_POST['points-suffix'] ) ) { // WPCS: CSRF OK |
|
490 | + if (isset($_POST['points-suffix'])) { // WPCS: CSRF OK |
|
491 | 491 | $settings['suffix'] = rtrim( |
492 | - sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) // WPCS: CSRF OK |
|
492 | + sanitize_text_field(wp_unslash($_POST['points-suffix'])) // WPCS: CSRF OK |
|
493 | 493 | ); |
494 | 494 | } |
495 | 495 | |
@@ -507,52 +507,52 @@ discard block |
||
507 | 507 | ! wordpoints_verify_nonce( |
508 | 508 | 'update_points_type' |
509 | 509 | , 'wordpoints_update_points_type-%s' |
510 | - , array( 'points-slug' ) |
|
510 | + , array('points-slug') |
|
511 | 511 | , 'post' |
512 | 512 | ) |
513 | - || ! isset( $_POST['points-slug'] ) |
|
513 | + || ! isset($_POST['points-slug']) |
|
514 | 514 | ) { |
515 | 515 | return; |
516 | 516 | } |
517 | 517 | |
518 | 518 | $settings = $this->get_points_type_settings(); |
519 | 519 | |
520 | - if ( empty( $settings['name'] ) ) { |
|
520 | + if (empty($settings['name'])) { |
|
521 | 521 | |
522 | 522 | add_settings_error( |
523 | 523 | 'points-name' |
524 | 524 | , 'wordpoints_points_type_update' |
525 | - , __( 'Error: points type name cannot be empty.', 'wordpoints' ) |
|
525 | + , __('Error: points type name cannot be empty.', 'wordpoints') |
|
526 | 526 | ); |
527 | 527 | |
528 | 528 | return; |
529 | 529 | } |
530 | 530 | |
531 | - $points_type = sanitize_key( $_POST['points-slug'] ); |
|
531 | + $points_type = sanitize_key($_POST['points-slug']); |
|
532 | 532 | |
533 | - $old_settings = wordpoints_get_points_type( $points_type ); |
|
533 | + $old_settings = wordpoints_get_points_type($points_type); |
|
534 | 534 | |
535 | - if ( false === $old_settings ) { |
|
535 | + if (false === $old_settings) { |
|
536 | 536 | |
537 | 537 | add_settings_error( |
538 | 538 | '' |
539 | 539 | , 'wordpoints_points_type_update' |
540 | - , __( 'Error: failed updating points type.', 'wordpoints' ) |
|
540 | + , __('Error: failed updating points type.', 'wordpoints') |
|
541 | 541 | ); |
542 | 542 | |
543 | 543 | return; |
544 | 544 | } |
545 | 545 | |
546 | - if ( is_array( $old_settings ) ) { |
|
547 | - $settings = array_merge( $old_settings, $settings ); |
|
546 | + if (is_array($old_settings)) { |
|
547 | + $settings = array_merge($old_settings, $settings); |
|
548 | 548 | } |
549 | 549 | |
550 | - if ( ! wordpoints_update_points_type( $points_type, $settings ) ) { |
|
550 | + if ( ! wordpoints_update_points_type($points_type, $settings)) { |
|
551 | 551 | |
552 | 552 | add_settings_error( |
553 | 553 | '' |
554 | 554 | , 'wordpoints_points_type_update' |
555 | - , __( 'Error: failed updating points type.', 'wordpoints' ) |
|
555 | + , __('Error: failed updating points type.', 'wordpoints') |
|
556 | 556 | ); |
557 | 557 | |
558 | 558 | } else { |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | add_settings_error( |
561 | 561 | '' |
562 | 562 | , 'wordpoints_points_type_update' |
563 | - , __( 'Points type updated.', 'wordpoints' ) |
|
563 | + , __('Points type updated.', 'wordpoints') |
|
564 | 564 | , 'updated' |
565 | 565 | ); |
566 | 566 | } |
@@ -586,14 +586,14 @@ discard block |
||
586 | 586 | |
587 | 587 | $settings = $this->get_points_type_settings(); |
588 | 588 | |
589 | - $slug = wordpoints_add_points_type( $settings ); |
|
589 | + $slug = wordpoints_add_points_type($settings); |
|
590 | 590 | |
591 | - if ( ! $slug ) { |
|
591 | + if ( ! $slug) { |
|
592 | 592 | |
593 | 593 | add_settings_error( |
594 | 594 | '' |
595 | 595 | , 'wordpoints_points_type_create' |
596 | - , __( 'Please choose a unique name for this points type.', 'wordpoints' ) |
|
596 | + , __('Please choose a unique name for this points type.', 'wordpoints') |
|
597 | 597 | ); |
598 | 598 | |
599 | 599 | } else { |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | add_settings_error( |
604 | 604 | '' |
605 | 605 | , 'wordpoints_points_type_create' |
606 | - , __( 'Points type created.', 'wordpoints' ) |
|
606 | + , __('Points type created.', 'wordpoints') |
|
607 | 607 | , 'updated' |
608 | 608 | ); |
609 | 609 | } |
@@ -620,22 +620,22 @@ discard block |
||
620 | 620 | wordpoints_verify_nonce( |
621 | 621 | 'delete-points-type-nonce' |
622 | 622 | , 'wordpoints_delete_points_type-%s' |
623 | - , array( 'points-slug' ) |
|
623 | + , array('points-slug') |
|
624 | 624 | , 'post' |
625 | 625 | ) |
626 | - && isset( $_POST['points-slug'] ) |
|
626 | + && isset($_POST['points-slug']) |
|
627 | 627 | ) { |
628 | 628 | |
629 | 629 | if ( |
630 | 630 | wordpoints_delete_points_type( |
631 | - sanitize_key( $_POST['points-slug'] ) |
|
631 | + sanitize_key($_POST['points-slug']) |
|
632 | 632 | ) |
633 | 633 | ) { |
634 | 634 | |
635 | 635 | add_settings_error( |
636 | 636 | '' |
637 | 637 | , 'wordpoints_points_type_delete' |
638 | - , __( 'Points type deleted.', 'wordpoints' ) |
|
638 | + , __('Points type deleted.', 'wordpoints') |
|
639 | 639 | , 'updated' |
640 | 640 | ); |
641 | 641 | |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | add_settings_error( |
645 | 645 | '' |
646 | 646 | , 'wordpoints_points_type_delete' |
647 | - , __( 'Error while deleting.', 'wordpoints' ) |
|
647 | + , __('Error while deleting.', 'wordpoints') |
|
648 | 648 | ); |
649 | 649 | } |
650 | 650 | } |
@@ -660,25 +660,25 @@ discard block |
||
660 | 660 | * |
661 | 661 | * @since 1.0.0 |
662 | 662 | */ |
663 | - do_action( 'wordpoints_admin_points_events_head' ); |
|
663 | + do_action('wordpoints_admin_points_events_head'); |
|
664 | 664 | |
665 | - if ( is_network_admin() ) { |
|
666 | - $title = __( 'Network Events', 'wordpoints' ); |
|
667 | - $description = __( 'Award points when various events happen on this network.', 'wordpoints' ); |
|
665 | + if (is_network_admin()) { |
|
666 | + $title = __('Network Events', 'wordpoints'); |
|
667 | + $description = __('Award points when various events happen on this network.', 'wordpoints'); |
|
668 | 668 | } else { |
669 | - $title = __( 'Events', 'wordpoints' ); |
|
670 | - $description = __( 'Award points when various events happen on this site.', 'wordpoints' ); |
|
669 | + $title = __('Events', 'wordpoints'); |
|
670 | + $description = __('Award points when various events happen on this site.', 'wordpoints'); |
|
671 | 671 | } |
672 | 672 | |
673 | - $points_type = wordpoints_get_points_type( $this->current_points_type ); |
|
673 | + $points_type = wordpoints_get_points_type($this->current_points_type); |
|
674 | 674 | |
675 | 675 | ?> |
676 | 676 | |
677 | 677 | <div class="wordpoints-points-type-meta-box-wrap"> |
678 | 678 | |
679 | 679 | <form> |
680 | - <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> |
|
681 | - <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> |
|
680 | + <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?> |
|
681 | + <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?> |
|
682 | 682 | </form> |
683 | 683 | |
684 | 684 | <div id="poststuff"> |
@@ -686,17 +686,17 @@ discard block |
||
686 | 686 | <div id="post-body" class="metabox-holder columns-<?php echo 1 === (int) get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
687 | 687 | |
688 | 688 | <div id="postbox-container-1" class="postbox-container"> |
689 | - <?php do_meta_boxes( $this->id, 'side', $points_type ); ?> |
|
689 | + <?php do_meta_boxes($this->id, 'side', $points_type); ?> |
|
690 | 690 | </div> |
691 | 691 | |
692 | - <?php if ( isset( $this->current_points_type ) ) : ?> |
|
692 | + <?php if (isset($this->current_points_type)) : ?> |
|
693 | 693 | <div class="wordpoints-hook-events-heading"> |
694 | - <h2><?php echo esc_html( $title ); ?></h2> |
|
695 | - <p class="description"><?php echo esc_html( $description ); ?></p> |
|
694 | + <h2><?php echo esc_html($title); ?></h2> |
|
695 | + <p class="description"><?php echo esc_html($description); ?></p> |
|
696 | 696 | </div> |
697 | 697 | |
698 | 698 | <div id="postbox-container-2" class="postbox-container"> |
699 | - <?php do_meta_boxes( $this->id, 'events', $points_type ); ?> |
|
699 | + <?php do_meta_boxes($this->id, 'events', $points_type); ?> |
|
700 | 700 | </div> |
701 | 701 | <?php endif; ?> |
702 | 702 | |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | * |
716 | 716 | * @since 1.0.0 |
717 | 717 | */ |
718 | - do_action( 'wordpoints_admin_points_events_foot' ); |
|
718 | + do_action('wordpoints_admin_points_events_foot'); |
|
719 | 719 | } |
720 | 720 | } |
721 | 721 |