Issues (4138)

lsx-health-plan.php (27 issues)

1
<?php
2
/*
0 ignored issues
show
You must use "/**" style comments for a file comment
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
16
	die;
17
}
0 ignored issues
show
No blank line found after control structure
Loading history...
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
Expected 2 blank lines before function; 1 found
Loading history...
33
	global $wp_meta_boxes;
34
	$all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ];
0 ignored issues
show
Short array syntax is not allowed
Loading history...
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.

Loading history...
No space found before comment text; expected "// remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' );" but found "//remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' );"
Loading history...
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
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
Expected 2 blank lines after function; 0 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
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
Function return type is void, but function contains return statement
Loading history...
46
 */
47
function lsx_login_redirect() {
0 ignored issues
show
Expected 2 blank lines before function; 1 found
Loading history...
48
	$plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
49
	if ( false === $plan_slug ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
50
		$plan_slug = 'my-plan';
51
	}
0 ignored issues
show
No blank line found after control structure
Loading history...
52
	return home_url( $plan_slug );
53
}
0 ignored issues
show
Expected 2 blank lines after function; 0 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
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
Expected 2 blank lines before function; 1 found
Loading history...
62
	return \lsx_health_plan\classes\Core::get_instance();
63
}
0 ignored issues
show
Expected 2 blank lines after function; 0 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
64
lsx_health_plan();
65
66
/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$icon" missing
Loading history...
67
 * Creates the svg path
68
 *
69
 * @return void
0 ignored issues
show
Function return type is void, but function contains return statement
Loading history...
70
 */
71
function lsx_get_svg_icon( $icon ) {
0 ignored issues
show
Expected 2 blank lines before function; 1 found
Loading history...
72
	$path = '/assets/images/';
73
74
	if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Expected 1 blank line before closing function brace; 0 found
Loading history...
82