Issues (4138)

lsx-health-plan.php (1 issue)

1
<?php
2
/*
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' ) ) {
16
	die;
17
}
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() {
33
	global $wp_meta_boxes;
34
	$all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ];
35
	//remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' );
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
}
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
46
 */
47
function lsx_login_redirect() {
48
	$plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
49
	if ( false === $plan_slug ) {
50
		$plan_slug = 'my-plan';
51
	}
52
	return home_url( $plan_slug );
53
}
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() {
62
	return \lsx_health_plan\classes\Core::get_instance();
63
}
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
70
 */
71
function lsx_get_svg_icon( $icon ) {
72
	$path = '/assets/images/';
73
74
	if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) {
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
}
82