1 | <?php |
||
2 | /* |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
3 | * Plugin Name: LSX Health |
||
4 | * Plugin URI: https://github.com/lightspeeddevelopment/lsx-health-plan |
||
5 | * Description: LSX Health Plan extension adds a meal and workout plan, with recipes. |
||
6 | * Author: LightSpeed |
||
7 | * Version: 2.0.2 |
||
8 | * Author URI: https://www.lsdev.biz/ |
||
9 | * License: GPL3 |
||
10 | * Text Domain: lsx-health-plan |
||
11 | * Domain Path: /languages/ |
||
12 | */ |
||
13 | |||
14 | // If this file is called directly, abort. |
||
15 | if ( ! defined( 'WPINC' ) ) { |
||
0 ignored issues
–
show
|
|||
16 | die; |
||
17 | } |
||
0 ignored issues
–
show
|
|||
18 | define( 'LSX_HEALTH_PLAN_PATH', plugin_dir_path( __FILE__ ) ); |
||
19 | define( 'LSX_HEALTH_PLAN_CORE', __FILE__ ); |
||
20 | define( 'LSX_HEALTH_PLAN_URL', plugin_dir_url( __FILE__ ) ); |
||
21 | define( 'LSX_HEALTH_PLAN_VER', '2.0.1' ); |
||
22 | |||
23 | /* ======================= Below is the Plugin Class init ========================= */ |
||
24 | |||
25 | require_once LSX_HEALTH_PLAN_PATH . '/classes/class-core.php'; |
||
26 | |||
27 | /** |
||
28 | * Remove unnecessary custom post types |
||
29 | * |
||
30 | * @return void |
||
31 | */ |
||
32 | function lsx_remove_extra_meta_box() { |
||
0 ignored issues
–
show
|
|||
33 | global $wp_meta_boxes; |
||
34 | $all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ]; |
||
0 ignored issues
–
show
|
|||
35 | //remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' ); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
62% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
36 | remove_meta_box( 'commentsdiv', $all_post_types, 'normal' ); |
||
37 | remove_meta_box( 'commentstatusdiv', $all_post_types, 'normal' ); |
||
38 | remove_meta_box( 'lsx_blocks_title_meta', $all_post_types, 'side' ); |
||
39 | } |
||
0 ignored issues
–
show
|
|||
40 | add_action( 'add_meta_boxes', 'lsx_remove_extra_meta_box', 100 ); |
||
41 | |||
42 | /** |
||
43 | * Redirect user after login or redirect |
||
44 | * |
||
45 | * @return void |
||
0 ignored issues
–
show
|
|||
46 | */ |
||
47 | function lsx_login_redirect() { |
||
0 ignored issues
–
show
|
|||
48 | $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); |
||
49 | if ( false === $plan_slug ) { |
||
0 ignored issues
–
show
|
|||
50 | $plan_slug = 'my-plan'; |
||
51 | } |
||
0 ignored issues
–
show
|
|||
52 | return home_url( $plan_slug ); |
||
53 | } |
||
0 ignored issues
–
show
|
|||
54 | add_filter( 'woocommerce_login_redirect', 'lsx_login_redirect' ); |
||
55 | |||
56 | /** |
||
57 | * Undocumented function |
||
58 | * |
||
59 | * @return object lsx_health_plan\classes\Core::get_instance(); |
||
60 | */ |
||
61 | function lsx_health_plan() { |
||
0 ignored issues
–
show
|
|||
62 | return \lsx_health_plan\classes\Core::get_instance(); |
||
63 | } |
||
0 ignored issues
–
show
|
|||
64 | lsx_health_plan(); |
||
65 | |||
66 | /** |
||
0 ignored issues
–
show
|
|||
67 | * Creates the svg path |
||
68 | * |
||
69 | * @return void |
||
0 ignored issues
–
show
|
|||
70 | */ |
||
71 | function lsx_get_svg_icon( $icon ) { |
||
0 ignored issues
–
show
|
|||
72 | $path = '/assets/images/'; |
||
73 | |||
74 | if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) { |
||
0 ignored issues
–
show
|
|||
75 | // Load and return the contents of the file. |
||
76 | return include LSX_HEALTH_PLAN_PATH . $path . $icon; |
||
77 | } |
||
78 | |||
79 | // Return a blank string if we can't find the file. |
||
80 | return ''; |
||
81 | } |
||
0 ignored issues
–
show
|
|||
82 |