@@ -6,10 +6,10 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // Getting translated endpoint. |
9 | -$meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
9 | +$meal = \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'); |
|
10 | 10 | |
11 | -$connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
12 | -$connected_articles = get_post_meta( get_the_ID(), ( $meal . '_connected_articles' ), true ); |
|
11 | +$connected_members = get_post_meta(get_the_ID(), ($meal . '_connected_team_member'), true); |
|
12 | +$connected_articles = get_post_meta(get_the_ID(), ($meal . '_connected_articles'), true); |
|
13 | 13 | |
14 | 14 | ?> |
15 | 15 | |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | <div class="entry-content"> |
25 | 25 | <div class="single-plan-inner meal-content"> |
26 | 26 | <?php |
27 | - if ( is_singular( 'meal' ) ) { ?> |
|
27 | + if (is_singular('meal')) { ?> |
|
28 | 28 | <div class="single-plan-section-title meal-plan title-lined"> |
29 | - <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
|
29 | + <?php lsx_get_svg_icon('meal.svg'); ?> |
|
30 | 30 | <h2><?php the_title(); ?></h2> |
31 | 31 | |
32 | 32 | </div> |
33 | 33 | <?php } else { ?> |
34 | 34 | <div class="single-plan-section-title meal-plan title-lined"> |
35 | - <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
|
36 | - <h2><?php esc_html_e( 'My Meal Plan', 'lsx-health-plan' ); ?> <?php the_title(); ?></h2> |
|
35 | + <?php lsx_get_svg_icon('meal.svg'); ?> |
|
36 | + <h2><?php esc_html_e('My Meal Plan', 'lsx-health-plan'); ?> <?php the_title(); ?></h2> |
|
37 | 37 | </div> |
38 | 38 | <?php } ?> |
39 | 39 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | </article><!-- #post-## --> |
47 | 47 | |
48 | 48 | <?php |
49 | -if ( ! empty( $connected_articles ) ) { |
|
50 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
49 | +if ( ! empty($connected_articles)) { |
|
50 | + lsx_hp_single_related($connected_articles, __('Related articles', 'lsx-health-plan')); |
|
51 | 51 | } |
52 | 52 | ?> |
53 | 53 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | <div class="entry-content"> |
25 | 25 | <div class="single-plan-inner meal-content"> |
26 | 26 | <?php |
27 | - if ( is_singular( 'meal' ) ) { ?> |
|
27 | + if ( is_singular( 'meal' ) ) { ?> |
|
28 | 28 | <div class="single-plan-section-title meal-plan title-lined"> |
29 | 29 | <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
30 | 30 | <h2><?php the_title(); ?></h2> |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | <?php |
49 | 49 | if ( ! empty( $connected_articles ) ) { |
50 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
50 | + lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
51 | 51 | } |
52 | 52 | ?> |
53 | 53 |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // If this file is called directly, abort. |
15 | -if ( ! defined( 'WPINC' ) ) { |
|
15 | +if ( ! defined('WPINC')) { |
|
16 | 16 | die; |
17 | 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', '1.4.0' ); |
|
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', '1.4.0'); |
|
22 | 22 | |
23 | 23 | /* ======================= Below is the Plugin Class init ========================= */ |
24 | 24 | |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function lsx_remove_extra_meta_box() { |
33 | 33 | global $wp_meta_boxes; |
34 | - $all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ]; |
|
34 | + $all_post_types = ['plan', 'video', 'workout', 'tip', 'recipe', 'meal']; |
|
35 | 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' ); |
|
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 | 39 | } |
40 | -add_action( 'add_meta_boxes', 'lsx_remove_extra_meta_box', 100 ); |
|
40 | +add_action('add_meta_boxes', 'lsx_remove_extra_meta_box', 100); |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Redirect user after login or redirect |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * @return void |
46 | 46 | */ |
47 | 47 | function lsx_login_redirect() { |
48 | - $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); |
|
49 | - if ( false === $plan_slug ) { |
|
48 | + $plan_slug = \lsx_health_plan\functions\get_option('my_plan_slug', false); |
|
49 | + if (false === $plan_slug) { |
|
50 | 50 | $plan_slug = 'my-plan'; |
51 | 51 | } |
52 | - return home_url( $plan_slug ); |
|
52 | + return home_url($plan_slug); |
|
53 | 53 | } |
54 | -add_filter( 'woocommerce_login_redirect', 'lsx_login_redirect' ); |
|
54 | +add_filter('woocommerce_login_redirect', 'lsx_login_redirect'); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Undocumented function |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return void |
70 | 70 | */ |
71 | -function lsx_get_svg_icon( $icon ) { |
|
71 | +function lsx_get_svg_icon($icon) { |
|
72 | 72 | $path = '/assets/images/'; |
73 | 73 | |
74 | - if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) { |
|
74 | + if (file_exists(LSX_HEALTH_PLAN_PATH . $path . $icon)) { |
|
75 | 75 | // Load and return the contents of the file |
76 | 76 | return include LSX_HEALTH_PLAN_PATH . $path . $icon; |
77 | 77 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | // If this file is called directly, abort. |
15 | 15 | if ( ! defined( 'WPINC' ) ) { |
16 | - die; |
|
16 | + die; |
|
17 | 17 | } |
18 | 18 | define( 'LSX_HEALTH_PLAN_PATH', plugin_dir_path( __FILE__ ) ); |
19 | 19 | define( 'LSX_HEALTH_PLAN_CORE', __FILE__ ); |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | * @return void |
31 | 31 | */ |
32 | 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' ); |
|
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 | 39 | } |
40 | 40 | add_action( 'add_meta_boxes', 'lsx_remove_extra_meta_box', 100 ); |
41 | 41 | |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | * @return void |
46 | 46 | */ |
47 | 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 ); |
|
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 | 53 | } |
54 | 54 | add_filter( 'woocommerce_login_redirect', 'lsx_login_redirect' ); |
55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return object lsx_health_plan\classes\Core::get_instance(); |
60 | 60 | */ |
61 | 61 | function lsx_health_plan() { |
62 | - return \lsx_health_plan\classes\Core::get_instance(); |
|
62 | + return \lsx_health_plan\classes\Core::get_instance(); |
|
63 | 63 | } |
64 | 64 | lsx_health_plan(); |
65 | 65 | |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | * @return void |
70 | 70 | */ |
71 | 71 | function lsx_get_svg_icon( $icon ) { |
72 | - $path = '/assets/images/'; |
|
72 | + $path = '/assets/images/'; |
|
73 | 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 | - } |
|
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 | 78 | |
79 | - // Return a blank string if we can't find the file. |
|
80 | - return ''; |
|
79 | + // Return a blank string if we can't find the file. |
|
80 | + return ''; |
|
81 | 81 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * Contructor |
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | - add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 ); |
|
28 | + add_action('lsx_hp_settings_page_plan_top', array($this, 'settings'), 1, 1); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function get_instance() { |
39 | 39 | // If the single instance hasn't been set, set it now. |
40 | - if ( null === self::$instance ) { |
|
40 | + if (null === self::$instance) { |
|
41 | 41 | self::$instance = new self(); |
42 | 42 | } |
43 | 43 | return self::$instance; |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | * @param object $cmb new_cmb2_box(). |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - public function settings( $cmb ) { |
|
52 | + public function settings($cmb) { |
|
53 | 53 | $cmb->add_field( |
54 | 54 | array( |
55 | - 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
55 | + 'name' => __('Plan Filters', 'lsx-health-plan'), |
|
56 | 56 | 'id' => 'plan_filters_disabled', |
57 | 57 | 'type' => 'checkbox', |
58 | 58 | 'value' => 1, |
59 | 59 | 'default' => 0, |
60 | - 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
60 | + 'description' => __('Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan'), |
|
61 | 61 | ) |
62 | 62 | ); |
63 | 63 | } |
@@ -12,54 +12,54 @@ |
||
12 | 12 | */ |
13 | 13 | class Plan { |
14 | 14 | |
15 | - /** |
|
16 | - * Holds class instance |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - * |
|
20 | - * @var object \lsx_health_plan\classes\admin\Plan() |
|
21 | - */ |
|
22 | - protected static $instance = null; |
|
15 | + /** |
|
16 | + * Holds class instance |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + * |
|
20 | + * @var object \lsx_health_plan\classes\admin\Plan() |
|
21 | + */ |
|
22 | + protected static $instance = null; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Contructor |
|
26 | - */ |
|
27 | - public function __construct() { |
|
28 | - add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | - } |
|
24 | + /** |
|
25 | + * Contructor |
|
26 | + */ |
|
27 | + public function __construct() { |
|
28 | + add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Return an instance of this class. |
|
33 | - * |
|
34 | - * @since 1.0.0 |
|
35 | - * |
|
36 | - * @return object \lsx_health_plan\classes\admin\Plan() A single instance of this class. |
|
37 | - */ |
|
38 | - public static function get_instance() { |
|
39 | - // If the single instance hasn't been set, set it now. |
|
40 | - if ( null === self::$instance ) { |
|
41 | - self::$instance = new self(); |
|
42 | - } |
|
43 | - return self::$instance; |
|
44 | - } |
|
31 | + /** |
|
32 | + * Return an instance of this class. |
|
33 | + * |
|
34 | + * @since 1.0.0 |
|
35 | + * |
|
36 | + * @return object \lsx_health_plan\classes\admin\Plan() A single instance of this class. |
|
37 | + */ |
|
38 | + public static function get_instance() { |
|
39 | + // If the single instance hasn't been set, set it now. |
|
40 | + if ( null === self::$instance ) { |
|
41 | + self::$instance = new self(); |
|
42 | + } |
|
43 | + return self::$instance; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Registers the general settings. |
|
48 | - * |
|
49 | - * @param object $cmb new_cmb2_box(). |
|
50 | - * @return void |
|
51 | - */ |
|
52 | - public function settings( $cmb ) { |
|
53 | - $cmb->add_field( |
|
54 | - array( |
|
55 | - 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
56 | - 'id' => 'plan_filters_disabled', |
|
57 | - 'type' => 'checkbox', |
|
58 | - 'value' => 1, |
|
59 | - 'default' => 0, |
|
60 | - 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
61 | - ) |
|
62 | - ); |
|
63 | - } |
|
46 | + /** |
|
47 | + * Registers the general settings. |
|
48 | + * |
|
49 | + * @param object $cmb new_cmb2_box(). |
|
50 | + * @return void |
|
51 | + */ |
|
52 | + public function settings( $cmb ) { |
|
53 | + $cmb->add_field( |
|
54 | + array( |
|
55 | + 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
56 | + 'id' => 'plan_filters_disabled', |
|
57 | + 'type' => 'checkbox', |
|
58 | + 'value' => 1, |
|
59 | + 'default' => 0, |
|
60 | + 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
61 | + ) |
|
62 | + ); |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | Plan::get_instance(); |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | 24 | // Before Output. |
25 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
26 | - add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 ); |
|
25 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 5); |
|
26 | + add_filter('wp_kses_allowed_html', array($this, 'allow_html_tags_attributes'), 100, 2); |
|
27 | 27 | |
28 | 28 | // Output. |
29 | - add_action( 'body_class', array( $this, 'body_classes' ) ); |
|
30 | - add_filter( 'lsx_global_header_title', array( $this, 'single_title' ), 200, 1 ); |
|
31 | - add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 ); |
|
29 | + add_action('body_class', array($this, 'body_classes')); |
|
30 | + add_filter('lsx_global_header_title', array($this, 'single_title'), 200, 1); |
|
31 | + add_action('wp_head', array($this, 'remove_single_footer'), 99); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function get_instance() { |
42 | 42 | // If the single instance hasn't been set, set it now. |
43 | - if ( null === self::$instance ) { |
|
43 | + if (null === self::$instance) { |
|
44 | 44 | self::$instance = new self(); |
45 | 45 | } |
46 | 46 | return self::$instance; |
@@ -53,21 +53,21 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function assets() { |
55 | 55 | |
56 | - if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) { |
|
57 | - wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true ); |
|
56 | + if (is_post_type_archive('plan') && false === \lsx_health_plan\functions\plan\is_filters_disabled()) { |
|
57 | + wp_enqueue_script('isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array('jquery'), null, LSX_HEALTH_PLAN_URL, true); |
|
58 | 58 | } |
59 | 59 | |
60 | - wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER ); |
|
61 | - wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' ); |
|
62 | - wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) ); |
|
60 | + wp_enqueue_style('lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER); |
|
61 | + wp_style_add_data('lsx-health-plan', 'rtl', 'replace'); |
|
62 | + wp_enqueue_script('lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array('jquery')); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Adds the iframe and the progress HTML tags to the allowed WordPress list. |
68 | 68 | */ |
69 | - public function allow_html_tags_attributes( $tags, $context ) { |
|
70 | - if ( 'post' === $context ) { |
|
69 | + public function allow_html_tags_attributes($tags, $context) { |
|
70 | + if ('post' === $context) { |
|
71 | 71 | $tags['iframe'] = array( |
72 | 72 | 'src' => true, |
73 | 73 | 'height' => true, |
@@ -90,31 +90,31 @@ discard block |
||
90 | 90 | * @param array $classes |
91 | 91 | * @return void |
92 | 92 | */ |
93 | - public function body_classes( $classes = array() ) { |
|
93 | + public function body_classes($classes = array()) { |
|
94 | 94 | global $post; |
95 | 95 | |
96 | - if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) { |
|
96 | + if (isset($post->post_content) && has_shortcode($post->post_content, 'lsx_health_plan_my_profile_block')) { |
|
97 | 97 | $classes[] = 'my-plan-shortcode'; |
98 | 98 | } |
99 | 99 | |
100 | - if ( is_single() && is_singular( 'plan' ) ) { |
|
100 | + if (is_single() && is_singular('plan')) { |
|
101 | 101 | $args = array( |
102 | 102 | 'post_parent' => get_the_ID(), |
103 | 103 | 'post_type' => 'plan', |
104 | 104 | ); |
105 | 105 | |
106 | 106 | $post_id = get_the_ID(); |
107 | - $has_children = get_children( $args ); |
|
108 | - $has_parent = wp_get_post_parent_id( $post_id ); |
|
107 | + $has_children = get_children($args); |
|
108 | + $has_parent = wp_get_post_parent_id($post_id); |
|
109 | 109 | |
110 | - if ( ! empty( $has_children ) ) { |
|
110 | + if ( ! empty($has_children)) { |
|
111 | 111 | $plan_type_class = 'parent-plan-page'; |
112 | - if ( 0 !== $has_parent ) { |
|
112 | + if (0 !== $has_parent) { |
|
113 | 113 | $plan_type_class = 'parent-sub-plan-page'; |
114 | 114 | } |
115 | 115 | } else { |
116 | 116 | $plan_type_class = 'unique-plan-page'; |
117 | - if ( 0 !== $has_parent ) { |
|
117 | + if (0 !== $has_parent) { |
|
118 | 118 | $plan_type_class = 'child-plan-page'; |
119 | 119 | } |
120 | 120 | } |
@@ -126,16 +126,16 @@ discard block |
||
126 | 126 | /** |
127 | 127 | * Remove the single recipe and exercise title |
128 | 128 | */ |
129 | - public function single_title( $title ) { |
|
129 | + public function single_title($title) { |
|
130 | 130 | |
131 | - if ( is_single() && is_singular( 'recipe' ) ) { |
|
131 | + if (is_single() && is_singular('recipe')) { |
|
132 | 132 | |
133 | - $title = __( 'Recipe', 'lsx-health-plan' ); |
|
133 | + $title = __('Recipe', 'lsx-health-plan'); |
|
134 | 134 | } |
135 | 135 | |
136 | - if ( is_single() && is_singular( 'exercise' ) ) { |
|
136 | + if (is_single() && is_singular('exercise')) { |
|
137 | 137 | |
138 | - $title = __( 'Exercise', 'lsx-health-plan' ); |
|
138 | + $title = __('Exercise', 'lsx-health-plan'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | return $title; |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @return void |
148 | 148 | */ |
149 | 149 | public function remove_single_footer() { |
150 | - if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) { |
|
151 | - remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
150 | + if (is_single() && is_singular(array('exercise', 'recipe', 'workout', 'meal'))) { |
|
151 | + remove_action('lsx_footer_before', 'lsx_add_footer_sidebar_area'); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | } |
@@ -8,147 +8,147 @@ |
||
8 | 8 | */ |
9 | 9 | class General { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\frontend\General() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
19 | - |
|
20 | - /** |
|
21 | - * Contructor |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - // Before Output. |
|
25 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
26 | - add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 ); |
|
27 | - |
|
28 | - // Output. |
|
29 | - add_action( 'body_class', array( $this, 'body_classes' ) ); |
|
30 | - add_filter( 'lsx_global_header_title', array( $this, 'single_title' ), 200, 1 ); |
|
31 | - add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 ); |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * Return an instance of this class. |
|
36 | - * |
|
37 | - * @since 1.0.0 |
|
38 | - * |
|
39 | - * @return object \lsx_health_plan\classes\frontend\General() A single instance of this class. |
|
40 | - */ |
|
41 | - public static function get_instance() { |
|
42 | - // If the single instance hasn't been set, set it now. |
|
43 | - if ( null === self::$instance ) { |
|
44 | - self::$instance = new self(); |
|
45 | - } |
|
46 | - return self::$instance; |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * Registers the plugin frontend assets |
|
51 | - * |
|
52 | - * @return void |
|
53 | - */ |
|
54 | - public function assets() { |
|
55 | - |
|
56 | - if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) { |
|
57 | - wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true ); |
|
58 | - } |
|
59 | - |
|
60 | - wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER ); |
|
61 | - wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' ); |
|
62 | - wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) ); |
|
63 | - |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * Adds the iframe and the progress HTML tags to the allowed WordPress list. |
|
68 | - */ |
|
69 | - public function allow_html_tags_attributes( $tags, $context ) { |
|
70 | - if ( 'post' === $context ) { |
|
71 | - $tags['iframe'] = array( |
|
72 | - 'src' => true, |
|
73 | - 'height' => true, |
|
74 | - 'width' => true, |
|
75 | - 'frameborder' => true, |
|
76 | - 'allowfullscreen' => true, |
|
77 | - ); |
|
78 | - } |
|
79 | - $tags['progress'] = array( |
|
80 | - 'id' => true, |
|
81 | - 'value' => true, |
|
82 | - 'max' => true, |
|
83 | - ); |
|
84 | - return $tags; |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * Add body classes to body. |
|
89 | - * |
|
90 | - * @param array $classes |
|
91 | - * @return void |
|
92 | - */ |
|
93 | - public function body_classes( $classes = array() ) { |
|
94 | - global $post; |
|
95 | - |
|
96 | - if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) { |
|
97 | - $classes[] = 'my-plan-shortcode'; |
|
98 | - } |
|
99 | - |
|
100 | - if ( is_single() && is_singular( 'plan' ) ) { |
|
101 | - $args = array( |
|
102 | - 'post_parent' => get_the_ID(), |
|
103 | - 'post_type' => 'plan', |
|
104 | - ); |
|
105 | - |
|
106 | - $post_id = get_the_ID(); |
|
107 | - $has_children = get_children( $args ); |
|
108 | - $has_parent = wp_get_post_parent_id( $post_id ); |
|
109 | - |
|
110 | - if ( ! empty( $has_children ) ) { |
|
111 | - $plan_type_class = 'parent-plan-page'; |
|
112 | - if ( 0 !== $has_parent ) { |
|
113 | - $plan_type_class = 'parent-sub-plan-page'; |
|
114 | - } |
|
115 | - } else { |
|
116 | - $plan_type_class = 'unique-plan-page'; |
|
117 | - if ( 0 !== $has_parent ) { |
|
118 | - $plan_type_class = 'child-plan-page'; |
|
119 | - } |
|
120 | - } |
|
121 | - $classes[] = $plan_type_class; |
|
122 | - } |
|
123 | - return $classes; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * Remove the single recipe and exercise title |
|
128 | - */ |
|
129 | - public function single_title( $title ) { |
|
130 | - |
|
131 | - if ( is_single() && is_singular( 'recipe' ) ) { |
|
132 | - |
|
133 | - $title = __( 'Recipe', 'lsx-health-plan' ); |
|
134 | - } |
|
135 | - |
|
136 | - if ( is_single() && is_singular( 'exercise' ) ) { |
|
137 | - |
|
138 | - $title = __( 'Exercise', 'lsx-health-plan' ); |
|
139 | - } |
|
140 | - |
|
141 | - return $title; |
|
142 | - } |
|
143 | - |
|
144 | - /** |
|
145 | - * Removing footer for HP single pages. |
|
146 | - * |
|
147 | - * @return void |
|
148 | - */ |
|
149 | - public function remove_single_footer() { |
|
150 | - if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) { |
|
151 | - remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
152 | - } |
|
153 | - } |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\frontend\General() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | + |
|
20 | + /** |
|
21 | + * Contructor |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + // Before Output. |
|
25 | + add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
26 | + add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 ); |
|
27 | + |
|
28 | + // Output. |
|
29 | + add_action( 'body_class', array( $this, 'body_classes' ) ); |
|
30 | + add_filter( 'lsx_global_header_title', array( $this, 'single_title' ), 200, 1 ); |
|
31 | + add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 ); |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * Return an instance of this class. |
|
36 | + * |
|
37 | + * @since 1.0.0 |
|
38 | + * |
|
39 | + * @return object \lsx_health_plan\classes\frontend\General() A single instance of this class. |
|
40 | + */ |
|
41 | + public static function get_instance() { |
|
42 | + // If the single instance hasn't been set, set it now. |
|
43 | + if ( null === self::$instance ) { |
|
44 | + self::$instance = new self(); |
|
45 | + } |
|
46 | + return self::$instance; |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * Registers the plugin frontend assets |
|
51 | + * |
|
52 | + * @return void |
|
53 | + */ |
|
54 | + public function assets() { |
|
55 | + |
|
56 | + if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) { |
|
57 | + wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true ); |
|
58 | + } |
|
59 | + |
|
60 | + wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER ); |
|
61 | + wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' ); |
|
62 | + wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) ); |
|
63 | + |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * Adds the iframe and the progress HTML tags to the allowed WordPress list. |
|
68 | + */ |
|
69 | + public function allow_html_tags_attributes( $tags, $context ) { |
|
70 | + if ( 'post' === $context ) { |
|
71 | + $tags['iframe'] = array( |
|
72 | + 'src' => true, |
|
73 | + 'height' => true, |
|
74 | + 'width' => true, |
|
75 | + 'frameborder' => true, |
|
76 | + 'allowfullscreen' => true, |
|
77 | + ); |
|
78 | + } |
|
79 | + $tags['progress'] = array( |
|
80 | + 'id' => true, |
|
81 | + 'value' => true, |
|
82 | + 'max' => true, |
|
83 | + ); |
|
84 | + return $tags; |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * Add body classes to body. |
|
89 | + * |
|
90 | + * @param array $classes |
|
91 | + * @return void |
|
92 | + */ |
|
93 | + public function body_classes( $classes = array() ) { |
|
94 | + global $post; |
|
95 | + |
|
96 | + if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) { |
|
97 | + $classes[] = 'my-plan-shortcode'; |
|
98 | + } |
|
99 | + |
|
100 | + if ( is_single() && is_singular( 'plan' ) ) { |
|
101 | + $args = array( |
|
102 | + 'post_parent' => get_the_ID(), |
|
103 | + 'post_type' => 'plan', |
|
104 | + ); |
|
105 | + |
|
106 | + $post_id = get_the_ID(); |
|
107 | + $has_children = get_children( $args ); |
|
108 | + $has_parent = wp_get_post_parent_id( $post_id ); |
|
109 | + |
|
110 | + if ( ! empty( $has_children ) ) { |
|
111 | + $plan_type_class = 'parent-plan-page'; |
|
112 | + if ( 0 !== $has_parent ) { |
|
113 | + $plan_type_class = 'parent-sub-plan-page'; |
|
114 | + } |
|
115 | + } else { |
|
116 | + $plan_type_class = 'unique-plan-page'; |
|
117 | + if ( 0 !== $has_parent ) { |
|
118 | + $plan_type_class = 'child-plan-page'; |
|
119 | + } |
|
120 | + } |
|
121 | + $classes[] = $plan_type_class; |
|
122 | + } |
|
123 | + return $classes; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * Remove the single recipe and exercise title |
|
128 | + */ |
|
129 | + public function single_title( $title ) { |
|
130 | + |
|
131 | + if ( is_single() && is_singular( 'recipe' ) ) { |
|
132 | + |
|
133 | + $title = __( 'Recipe', 'lsx-health-plan' ); |
|
134 | + } |
|
135 | + |
|
136 | + if ( is_single() && is_singular( 'exercise' ) ) { |
|
137 | + |
|
138 | + $title = __( 'Exercise', 'lsx-health-plan' ); |
|
139 | + } |
|
140 | + |
|
141 | + return $title; |
|
142 | + } |
|
143 | + |
|
144 | + /** |
|
145 | + * Removing footer for HP single pages. |
|
146 | + * |
|
147 | + * @return void |
|
148 | + */ |
|
149 | + public function remove_single_footer() { |
|
150 | + if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) { |
|
151 | + remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
152 | + } |
|
153 | + } |
|
154 | 154 | } |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | * Contructor |
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | - add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
25 | - add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
26 | - add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); |
|
24 | + add_filter('template_include', array($this, 'archive_template_include'), 99); |
|
25 | + add_filter('template_include', array($this, 'single_template_include'), 99); |
|
26 | + add_filter('template_include', array($this, 'taxonomy_template_include'), 99); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function get_instance() { |
37 | 37 | // If the single instance hasn't been set, set it now. |
38 | - if ( null === self::$instance ) { |
|
38 | + if (null === self::$instance) { |
|
39 | 39 | self::$instance = new self(); |
40 | 40 | } |
41 | 41 | return self::$instance; |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * Archive template. |
46 | 46 | */ |
47 | - public function archive_template_include( $template ) { |
|
48 | - $applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() ); |
|
49 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) { |
|
47 | + public function archive_template_include($template) { |
|
48 | + $applicable_post_types = apply_filters('lsx_health_plan_archive_template', array()); |
|
49 | + if ( ! empty($applicable_post_types) && is_main_query() && is_post_type_archive($applicable_post_types)) { |
|
50 | 50 | $post_type = get_post_type(); |
51 | - if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) { |
|
51 | + if (empty(locate_template(array('archive-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php')) { |
|
52 | 52 | $template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php'; |
53 | 53 | } |
54 | 54 | } |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | /** |
59 | 59 | * Single template. |
60 | 60 | */ |
61 | - public function single_template_include( $template ) { |
|
62 | - $applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() ); |
|
63 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) { |
|
61 | + public function single_template_include($template) { |
|
62 | + $applicable_post_types = apply_filters('lsx_health_plan_single_template', array()); |
|
63 | + if ( ! empty($applicable_post_types) && is_main_query() && is_singular($applicable_post_types)) { |
|
64 | 64 | $post_type = get_post_type(); |
65 | - if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) { |
|
65 | + if (empty(locate_template(array('single-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php')) { |
|
66 | 66 | $template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php'; |
67 | 67 | } |
68 | 68 | } |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @param $template string |
76 | 76 | * @return string |
77 | 77 | */ |
78 | - public function taxonomy_template_include( $template ) { |
|
79 | - $applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() ); |
|
80 | - if ( is_main_query() && is_tax( $applicable_taxonomies ) ) { |
|
81 | - $current_taxonomy = get_query_var( 'taxonomy' ); |
|
82 | - if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { |
|
78 | + public function taxonomy_template_include($template) { |
|
79 | + $applicable_taxonomies = apply_filters('lsx_health_plan_taxonomies_template', array()); |
|
80 | + if (is_main_query() && is_tax($applicable_taxonomies)) { |
|
81 | + $current_taxonomy = get_query_var('taxonomy'); |
|
82 | + if ('' === locate_template(array('taxonomy-' . $current_taxonomy . '.php')) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php')) { |
|
83 | 83 | $template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php'; |
84 | 84 | } |
85 | 85 | } |
@@ -8,81 +8,81 @@ |
||
8 | 8 | */ |
9 | 9 | class Template_Redirects { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\frontend\Template_Redirects() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\frontend\Template_Redirects() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Contructor |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
25 | - add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
26 | - add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); |
|
27 | - } |
|
20 | + /** |
|
21 | + * Contructor |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
25 | + add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
26 | + add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Return an instance of this class. |
|
31 | - * |
|
32 | - * @since 1.0.0 |
|
33 | - * |
|
34 | - * @return object \lsx_health_plan\classes\frontend\Template_Redirects() A single instance of this class. |
|
35 | - */ |
|
36 | - public static function get_instance() { |
|
37 | - // If the single instance hasn't been set, set it now. |
|
38 | - if ( null === self::$instance ) { |
|
39 | - self::$instance = new self(); |
|
40 | - } |
|
41 | - return self::$instance; |
|
42 | - } |
|
29 | + /** |
|
30 | + * Return an instance of this class. |
|
31 | + * |
|
32 | + * @since 1.0.0 |
|
33 | + * |
|
34 | + * @return object \lsx_health_plan\classes\frontend\Template_Redirects() A single instance of this class. |
|
35 | + */ |
|
36 | + public static function get_instance() { |
|
37 | + // If the single instance hasn't been set, set it now. |
|
38 | + if ( null === self::$instance ) { |
|
39 | + self::$instance = new self(); |
|
40 | + } |
|
41 | + return self::$instance; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Archive template. |
|
46 | - */ |
|
47 | - public function archive_template_include( $template ) { |
|
48 | - $applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() ); |
|
49 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) { |
|
50 | - $post_type = get_post_type(); |
|
51 | - if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) { |
|
52 | - $template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php'; |
|
53 | - } |
|
54 | - } |
|
55 | - return $template; |
|
56 | - } |
|
44 | + /** |
|
45 | + * Archive template. |
|
46 | + */ |
|
47 | + public function archive_template_include( $template ) { |
|
48 | + $applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() ); |
|
49 | + if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) { |
|
50 | + $post_type = get_post_type(); |
|
51 | + if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) { |
|
52 | + $template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php'; |
|
53 | + } |
|
54 | + } |
|
55 | + return $template; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Single template. |
|
60 | - */ |
|
61 | - public function single_template_include( $template ) { |
|
62 | - $applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() ); |
|
63 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) { |
|
64 | - $post_type = get_post_type(); |
|
65 | - if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) { |
|
66 | - $template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php'; |
|
67 | - } |
|
68 | - } |
|
69 | - return $template; |
|
70 | - } |
|
58 | + /** |
|
59 | + * Single template. |
|
60 | + */ |
|
61 | + public function single_template_include( $template ) { |
|
62 | + $applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() ); |
|
63 | + if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) { |
|
64 | + $post_type = get_post_type(); |
|
65 | + if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) { |
|
66 | + $template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php'; |
|
67 | + } |
|
68 | + } |
|
69 | + return $template; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * Redirect WordPress to the taxonomy located in the plugin |
|
74 | - * |
|
75 | - * @param $template string |
|
76 | - * @return string |
|
77 | - */ |
|
78 | - public function taxonomy_template_include( $template ) { |
|
79 | - $applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() ); |
|
80 | - if ( is_main_query() && is_tax( $applicable_taxonomies ) ) { |
|
81 | - $current_taxonomy = get_query_var( 'taxonomy' ); |
|
82 | - if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { |
|
83 | - $template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php'; |
|
84 | - } |
|
85 | - } |
|
86 | - return $template; |
|
87 | - } |
|
72 | + /** |
|
73 | + * Redirect WordPress to the taxonomy located in the plugin |
|
74 | + * |
|
75 | + * @param $template string |
|
76 | + * @return string |
|
77 | + */ |
|
78 | + public function taxonomy_template_include( $template ) { |
|
79 | + $applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() ); |
|
80 | + if ( is_main_query() && is_tax( $applicable_taxonomies ) ) { |
|
81 | + $current_taxonomy = get_query_var( 'taxonomy' ); |
|
82 | + if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { |
|
83 | + $template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php'; |
|
84 | + } |
|
85 | + } |
|
86 | + return $template; |
|
87 | + } |
|
88 | 88 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * Contructor |
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | - add_action( 'init', array( $this, 'handle_day_action' ), 100 ); |
|
24 | + add_action('init', array($this, 'handle_day_action'), 100); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public static function get_instance() { |
35 | 35 | // If the single instance hasn't been set, set it now. |
36 | - if ( null === self::$instance ) { |
|
36 | + if (null === self::$instance) { |
|
37 | 37 | self::$instance = new self(); |
38 | 38 | } |
39 | 39 | return self::$instance; |
@@ -43,18 +43,18 @@ discard block |
||
43 | 43 | * Registers the rewrites. |
44 | 44 | */ |
45 | 45 | public function handle_day_action() { |
46 | - if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) { |
|
47 | - update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true ); |
|
48 | - $plan_id = sanitize_key( $_POST['lsx-health-plan-id'] ); |
|
49 | - $plan_parent = wp_get_post_parent_id( $plan_id ); |
|
50 | - if ( 0 !== $plan_parent ) { |
|
46 | + if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'complete')) { |
|
47 | + update_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete', true); |
|
48 | + $plan_id = sanitize_key($_POST['lsx-health-plan-id']); |
|
49 | + $plan_parent = wp_get_post_parent_id($plan_id); |
|
50 | + if (0 !== $plan_parent) { |
|
51 | 51 | $plan_id = $plan_parent; |
52 | 52 | } |
53 | - wp_safe_redirect( get_permalink( $plan_id ) ); |
|
53 | + wp_safe_redirect(get_permalink($plan_id)); |
|
54 | 54 | } |
55 | 55 | |
56 | - if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) { |
|
57 | - delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' ); |
|
56 | + if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'unlock')) { |
|
57 | + delete_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete'); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
@@ -8,53 +8,53 @@ |
||
8 | 8 | */ |
9 | 9 | class Plan_Status { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\frontend\Plan_Status() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\frontend\Plan_Status() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Contructor |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - add_action( 'init', array( $this, 'handle_day_action' ), 100 ); |
|
25 | - } |
|
20 | + /** |
|
21 | + * Contructor |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + add_action( 'init', array( $this, 'handle_day_action' ), 100 ); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Return an instance of this class. |
|
29 | - * |
|
30 | - * @since 1.0.0 |
|
31 | - * |
|
32 | - * @return object \lsx_health_plan\classes\frontend\Plan_Status() A single instance of this class. |
|
33 | - */ |
|
34 | - public static function get_instance() { |
|
35 | - // If the single instance hasn't been set, set it now. |
|
36 | - if ( null === self::$instance ) { |
|
37 | - self::$instance = new self(); |
|
38 | - } |
|
39 | - return self::$instance; |
|
40 | - } |
|
27 | + /** |
|
28 | + * Return an instance of this class. |
|
29 | + * |
|
30 | + * @since 1.0.0 |
|
31 | + * |
|
32 | + * @return object \lsx_health_plan\classes\frontend\Plan_Status() A single instance of this class. |
|
33 | + */ |
|
34 | + public static function get_instance() { |
|
35 | + // If the single instance hasn't been set, set it now. |
|
36 | + if ( null === self::$instance ) { |
|
37 | + self::$instance = new self(); |
|
38 | + } |
|
39 | + return self::$instance; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Registers the rewrites. |
|
44 | - */ |
|
45 | - public function handle_day_action() { |
|
46 | - if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) { |
|
47 | - update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true ); |
|
48 | - $plan_id = sanitize_key( $_POST['lsx-health-plan-id'] ); |
|
49 | - $plan_parent = wp_get_post_parent_id( $plan_id ); |
|
50 | - if ( 0 !== $plan_parent ) { |
|
51 | - $plan_id = $plan_parent; |
|
52 | - } |
|
53 | - wp_safe_redirect( get_permalink( $plan_id ) ); |
|
54 | - } |
|
42 | + /** |
|
43 | + * Registers the rewrites. |
|
44 | + */ |
|
45 | + public function handle_day_action() { |
|
46 | + if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) { |
|
47 | + update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true ); |
|
48 | + $plan_id = sanitize_key( $_POST['lsx-health-plan-id'] ); |
|
49 | + $plan_parent = wp_get_post_parent_id( $plan_id ); |
|
50 | + if ( 0 !== $plan_parent ) { |
|
51 | + $plan_id = $plan_parent; |
|
52 | + } |
|
53 | + wp_safe_redirect( get_permalink( $plan_id ) ); |
|
54 | + } |
|
55 | 55 | |
56 | - if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) { |
|
57 | - delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' ); |
|
58 | - } |
|
59 | - } |
|
56 | + if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) { |
|
57 | + delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' ); |
|
58 | + } |
|
59 | + } |
|
60 | 60 | } |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | * Contructor |
52 | 52 | */ |
53 | 53 | public function __construct() { |
54 | - if ( ! is_admin() ) { |
|
54 | + if ( ! is_admin()) { |
|
55 | 55 | $this->load_classes(); |
56 | - add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
56 | + add_action('template_redirect', array($this, 'redirect')); |
|
57 | 57 | |
58 | 58 | } |
59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public static function get_instance() { |
69 | 69 | // If the single instance hasn't been set, set it now. |
70 | - if ( null === self::$instance ) { |
|
70 | + if (null === self::$instance) { |
|
71 | 71 | self::$instance = new self(); |
72 | 72 | } |
73 | 73 | return self::$instance; |
@@ -102,17 +102,17 @@ discard block |
||
102 | 102 | * @return void |
103 | 103 | */ |
104 | 104 | public function redirect() { |
105 | - if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
105 | + if ( ! is_user_logged_in() || ! function_exists('wc_get_page_id') || is_home()) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | - if ( lsx_health_plan_user_has_purchase() && ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) ) ) { |
|
109 | - wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) ); |
|
108 | + if (lsx_health_plan_user_has_purchase() && (is_page(wc_get_page_id('cart')) || is_page(wc_get_page_id('checkout')))) { |
|
109 | + wp_redirect(get_permalink(wc_get_page_id('myaccount'))); |
|
110 | 110 | die; |
111 | 111 | } |
112 | 112 | |
113 | - $product_id = \lsx_health_plan\functions\get_option( 'membership_product', false ); |
|
114 | - if ( false !== $product_id && is_single( $product_id ) ) { |
|
115 | - wp_redirect( home_url() ); |
|
113 | + $product_id = \lsx_health_plan\functions\get_option('membership_product', false); |
|
114 | + if (false !== $product_id && is_single($product_id)) { |
|
115 | + wp_redirect(home_url()); |
|
116 | 116 | wp_die(); |
117 | 117 | } |
118 | 118 | } |
@@ -8,112 +8,112 @@ |
||
8 | 8 | */ |
9 | 9 | class Frontend { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\Frontend() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
19 | - |
|
20 | - /** |
|
21 | - * @var object \lsx_health_plan\classes\frontend\Endpoints(); |
|
22 | - */ |
|
23 | - public $endpoints; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var object \lsx_health_plan\classes\frontend\Modals(); |
|
27 | - */ |
|
28 | - public $modals; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var object \lsx_health_plan\classes\frontend\Gallery(); |
|
32 | - */ |
|
33 | - public $gallery; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var object \lsx_health_plan\classes\frontend\Plan_Status(); |
|
37 | - */ |
|
38 | - public $plan_status; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var object \lsx_health_plan\classes\frontend\General(); |
|
42 | - */ |
|
43 | - public $general; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var object \lsx_health_plan\classes\frontend\Template_Redirects(); |
|
47 | - */ |
|
48 | - public $template_redirects; |
|
49 | - |
|
50 | - /** |
|
51 | - * Contructor |
|
52 | - */ |
|
53 | - public function __construct() { |
|
54 | - if ( ! is_admin() ) { |
|
55 | - $this->load_classes(); |
|
56 | - add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\Frontend() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | + |
|
20 | + /** |
|
21 | + * @var object \lsx_health_plan\classes\frontend\Endpoints(); |
|
22 | + */ |
|
23 | + public $endpoints; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var object \lsx_health_plan\classes\frontend\Modals(); |
|
27 | + */ |
|
28 | + public $modals; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var object \lsx_health_plan\classes\frontend\Gallery(); |
|
32 | + */ |
|
33 | + public $gallery; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var object \lsx_health_plan\classes\frontend\Plan_Status(); |
|
37 | + */ |
|
38 | + public $plan_status; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var object \lsx_health_plan\classes\frontend\General(); |
|
42 | + */ |
|
43 | + public $general; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var object \lsx_health_plan\classes\frontend\Template_Redirects(); |
|
47 | + */ |
|
48 | + public $template_redirects; |
|
49 | + |
|
50 | + /** |
|
51 | + * Contructor |
|
52 | + */ |
|
53 | + public function __construct() { |
|
54 | + if ( ! is_admin() ) { |
|
55 | + $this->load_classes(); |
|
56 | + add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
57 | 57 | |
58 | - } |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Return an instance of this class. |
|
63 | - * |
|
64 | - * @since 1.0.0 |
|
65 | - * |
|
66 | - * @return object \lsx_health_plan\classes\Frontend() A single instance of this class. |
|
67 | - */ |
|
68 | - public static function get_instance() { |
|
69 | - // If the single instance hasn't been set, set it now. |
|
70 | - if ( null === self::$instance ) { |
|
71 | - self::$instance = new self(); |
|
72 | - } |
|
73 | - return self::$instance; |
|
74 | - } |
|
75 | - |
|
76 | - /** |
|
77 | - * Loads the variable classes and the static classes. |
|
78 | - */ |
|
79 | - private function load_classes() { |
|
80 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
|
81 | - $this->endpoints = frontend\Endpoints::get_instance(); |
|
82 | - |
|
83 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php'; |
|
84 | - $this->modals = Modals::get_instance(); |
|
85 | - |
|
86 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
|
87 | - $this->gallery = frontend\Gallery::get_instance(); |
|
88 | - |
|
89 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-status.php'; |
|
90 | - $this->plan_status = frontend\Plan_Status::get_instance(); |
|
91 | - |
|
92 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-general.php'; |
|
93 | - $this->general = frontend\General::get_instance(); |
|
94 | - |
|
95 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-template-redirects.php'; |
|
96 | - $this->template_redirects = frontend\Template_Redirects::get_instance(); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Redirect the user from the cart or checkout page if they have purchased the product already. |
|
101 | - * |
|
102 | - * @return void |
|
103 | - */ |
|
104 | - public function redirect() { |
|
105 | - if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
106 | - return; |
|
107 | - } |
|
108 | - if ( lsx_health_plan_user_has_purchase() && ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) ) ) { |
|
109 | - wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) ); |
|
110 | - die; |
|
111 | - } |
|
112 | - |
|
113 | - $product_id = \lsx_health_plan\functions\get_option( 'membership_product', false ); |
|
114 | - if ( false !== $product_id && is_single( $product_id ) ) { |
|
115 | - wp_redirect( home_url() ); |
|
116 | - wp_die(); |
|
117 | - } |
|
118 | - } |
|
58 | + } |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Return an instance of this class. |
|
63 | + * |
|
64 | + * @since 1.0.0 |
|
65 | + * |
|
66 | + * @return object \lsx_health_plan\classes\Frontend() A single instance of this class. |
|
67 | + */ |
|
68 | + public static function get_instance() { |
|
69 | + // If the single instance hasn't been set, set it now. |
|
70 | + if ( null === self::$instance ) { |
|
71 | + self::$instance = new self(); |
|
72 | + } |
|
73 | + return self::$instance; |
|
74 | + } |
|
75 | + |
|
76 | + /** |
|
77 | + * Loads the variable classes and the static classes. |
|
78 | + */ |
|
79 | + private function load_classes() { |
|
80 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
|
81 | + $this->endpoints = frontend\Endpoints::get_instance(); |
|
82 | + |
|
83 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php'; |
|
84 | + $this->modals = Modals::get_instance(); |
|
85 | + |
|
86 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
|
87 | + $this->gallery = frontend\Gallery::get_instance(); |
|
88 | + |
|
89 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-status.php'; |
|
90 | + $this->plan_status = frontend\Plan_Status::get_instance(); |
|
91 | + |
|
92 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-general.php'; |
|
93 | + $this->general = frontend\General::get_instance(); |
|
94 | + |
|
95 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-template-redirects.php'; |
|
96 | + $this->template_redirects = frontend\Template_Redirects::get_instance(); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Redirect the user from the cart or checkout page if they have purchased the product already. |
|
101 | + * |
|
102 | + * @return void |
|
103 | + */ |
|
104 | + public function redirect() { |
|
105 | + if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
106 | + return; |
|
107 | + } |
|
108 | + if ( lsx_health_plan_user_has_purchase() && ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) ) ) { |
|
109 | + wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) ); |
|
110 | + die; |
|
111 | + } |
|
112 | + |
|
113 | + $product_id = \lsx_health_plan\functions\get_option( 'membership_product', false ); |
|
114 | + if ( false !== $product_id && is_single( $product_id ) ) { |
|
115 | + wp_redirect( home_url() ); |
|
116 | + wp_die(); |
|
117 | + } |
|
118 | + } |
|
119 | 119 | } |
@@ -5,11 +5,11 @@ discard block |
||
5 | 5 | * @package lsx-health-plan |
6 | 6 | */ |
7 | 7 | |
8 | -$section_key = get_query_var( 'section' ); |
|
9 | -$endpoint_key = get_query_var( 'endpoint' ); |
|
10 | -if ( '' !== $section_key && '' === $endpoint && \lsx_health_plan\functions\plan\has_sections() ) { |
|
11 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
12 | - if ( isset( $section_info['description'] ) && '' !== $section_info['description'] ) { |
|
8 | +$section_key = get_query_var('section'); |
|
9 | +$endpoint_key = get_query_var('endpoint'); |
|
10 | +if ('' !== $section_key && '' === $endpoint && \lsx_health_plan\functions\plan\has_sections()) { |
|
11 | + $section_info = \lsx_health_plan\functions\plan\get_section_info($section_key); |
|
12 | + if (isset($section_info['description']) && '' !== $section_info['description']) { |
|
13 | 13 | global $shortcode_args; |
14 | 14 | ?> |
15 | 15 | <?php lsx_entry_before(); ?> |
@@ -25,22 +25,22 @@ discard block |
||
25 | 25 | <div class="entry-content"> |
26 | 26 | <div class="overview"> |
27 | 27 | <?php |
28 | - echo wp_kses_post( apply_filters( 'the_content', $section_info['description'] ) ); |
|
28 | + echo wp_kses_post(apply_filters('the_content', $section_info['description'])); |
|
29 | 29 | |
30 | - wp_link_pages( array( |
|
30 | + wp_link_pages(array( |
|
31 | 31 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
32 | 32 | 'after' => '</div></div>', |
33 | 33 | 'link_before' => '<span>', |
34 | 34 | 'link_after' => '</span>', |
35 | - ) ); |
|
35 | + )); |
|
36 | 36 | ?> |
37 | 37 | </div> |
38 | 38 | </div><!-- .entry-content --> |
39 | - <?php if ( null === $shortcode_args ) { ?> |
|
40 | - <?php if ( post_type_exists( 'tip' ) && lsx_health_plan_has_tips() ) { ?> |
|
39 | + <?php if (null === $shortcode_args) { ?> |
|
40 | + <?php if (post_type_exists('tip') && lsx_health_plan_has_tips()) { ?> |
|
41 | 41 | <div class="tip-row extras-box"> |
42 | 42 | <div class="tip-right"> |
43 | - <?php echo do_shortcode( '[lsx_health_plan_featured_tips_block]' ); ?> |
|
43 | + <?php echo do_shortcode('[lsx_health_plan_featured_tips_block]'); ?> |
|
44 | 44 | </div> |
45 | 45 | </div> |
46 | 46 | <?php } ?> |
@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | $section_key = get_query_var( 'section' ); |
9 | 9 | $endpoint_key = get_query_var( 'endpoint' ); |
10 | 10 | if ( '' !== $section_key && '' === $endpoint && \lsx_health_plan\functions\plan\has_sections() ) { |
11 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
12 | - if ( isset( $section_info['description'] ) && '' !== $section_info['description'] ) { |
|
13 | - global $shortcode_args; |
|
14 | - ?> |
|
11 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
12 | + if ( isset( $section_info['description'] ) && '' !== $section_info['description'] ) { |
|
13 | + global $shortcode_args; |
|
14 | + ?> |
|
15 | 15 | <?php lsx_entry_before(); ?> |
16 | 16 | |
17 | 17 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | <div class="entry-content"> |
26 | 26 | <div class="overview"> |
27 | 27 | <?php |
28 | - echo wp_kses_post( apply_filters( 'the_content', $section_info['description'] ) ); |
|
29 | - |
|
30 | - wp_link_pages( array( |
|
31 | - 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
32 | - 'after' => '</div></div>', |
|
33 | - 'link_before' => '<span>', |
|
34 | - 'link_after' => '</span>', |
|
35 | - ) ); |
|
36 | - ?> |
|
28 | + echo wp_kses_post( apply_filters( 'the_content', $section_info['description'] ) ); |
|
29 | + |
|
30 | + wp_link_pages( array( |
|
31 | + 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
32 | + 'after' => '</div></div>', |
|
33 | + 'link_before' => '<span>', |
|
34 | + 'link_after' => '</span>', |
|
35 | + ) ); |
|
36 | + ?> |
|
37 | 37 | </div> |
38 | 38 | </div><!-- .entry-content --> |
39 | 39 | <?php if ( null === $shortcode_args ) { ?> |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | </article><!-- #post-## --> |
52 | 52 | |
53 | 53 | <?php |
54 | - lsx_entry_after(); |
|
55 | - } |
|
54 | + lsx_entry_after(); |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | ?> |
@@ -6,10 +6,10 @@ discard block |
||
6 | 6 | */ |
7 | 7 | global $group_name, $connected_workouts, $shortcode_args; |
8 | 8 | |
9 | -$warm_up = get_post_meta( get_the_ID(), 'plan_warmup', true ); |
|
10 | -if ( false === $warm_up || '' === $warm_up ) { |
|
11 | - $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
12 | - if ( isset( $options['plan_warmup'] ) && '' !== $options['plan_warmup'] && ! empty( $options['plan_warmup'] ) ) { |
|
9 | +$warm_up = get_post_meta(get_the_ID(), 'plan_warmup', true); |
|
10 | +if (false === $warm_up || '' === $warm_up) { |
|
11 | + $options = \lsx_health_plan\functions\get_option('all'); |
|
12 | + if (isset($options['plan_warmup']) && '' !== $options['plan_warmup'] && ! empty($options['plan_warmup'])) { |
|
13 | 13 | $warm_up = $options['plan_warmup']; |
14 | 14 | } |
15 | 15 | } |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | <div class="warmup-container"> |
19 | 19 | <?php |
20 | 20 | |
21 | -if ( false !== $warm_up && '' !== $warm_up ) { |
|
22 | - if ( ! is_array( $warm_up ) ) { |
|
23 | - $warm_up = array( $warm_up ); |
|
21 | +if (false !== $warm_up && '' !== $warm_up) { |
|
22 | + if ( ! is_array($warm_up)) { |
|
23 | + $warm_up = array($warm_up); |
|
24 | 24 | } |
25 | 25 | |
26 | - $warmup_type = array( 'page', 'workout', 'exercise' ); |
|
26 | + $warmup_type = array('page', 'workout', 'exercise'); |
|
27 | 27 | $warmup_query = new WP_Query( |
28 | 28 | array( |
29 | 29 | 'post__in' => $warm_up, |
@@ -31,38 +31,38 @@ discard block |
||
31 | 31 | ) |
32 | 32 | ); |
33 | 33 | |
34 | - if ( $warmup_query->have_posts() ) { |
|
35 | - while ( $warmup_query->have_posts() ) { |
|
34 | + if ($warmup_query->have_posts()) { |
|
35 | + while ($warmup_query->have_posts()) { |
|
36 | 36 | $warmup_query->the_post(); |
37 | 37 | lsx_entry_before(); |
38 | - if ( 'workout' === get_post_type() ) { |
|
39 | - $connected_workouts = array( get_the_ID() ); |
|
38 | + if ('workout' === get_post_type()) { |
|
39 | + $connected_workouts = array(get_the_ID()); |
|
40 | 40 | ?> |
41 | 41 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
42 | 42 | <?php lsx_entry_top(); ?> |
43 | 43 | <div class="entry-content"> |
44 | 44 | <div class="single-plan-inner warmup-content"> |
45 | 45 | <div class="single-plan-section-title warmup-plan title-lined"> |
46 | - <?php lsx_get_svg_icon( 'warm.svg' ); ?> |
|
47 | - <h2><?php esc_html_e( 'Warm Up', 'lsx-health-plan' ); ?></h2> |
|
46 | + <?php lsx_get_svg_icon('warm.svg'); ?> |
|
47 | + <h2><?php esc_html_e('Warm Up', 'lsx-health-plan'); ?></h2> |
|
48 | 48 | </div> |
49 | 49 | <?php |
50 | 50 | the_content(); |
51 | - wp_link_pages( array( |
|
51 | + wp_link_pages(array( |
|
52 | 52 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
53 | 53 | 'after' => '</div></div>', |
54 | 54 | 'link_before' => '<span>', |
55 | 55 | 'link_after' => '</span>', |
56 | - ) ); |
|
56 | + )); |
|
57 | 57 | ?> |
58 | 58 | </div> |
59 | 59 | </div><!-- .entry-content --> |
60 | 60 | <?php lsx_entry_bottom(); ?> |
61 | - <?php if ( null === $shortcode_args ) { ?> |
|
61 | + <?php if (null === $shortcode_args) { ?> |
|
62 | 62 | <div class="tip-row extras-box"> |
63 | - <?php if ( post_type_exists( 'tip' ) && lsx_health_plan_has_tips() ) { ?> |
|
63 | + <?php if (post_type_exists('tip') && lsx_health_plan_has_tips()) { ?> |
|
64 | 64 | <div class="tip-right"> |
65 | - <?php echo do_shortcode( '[lsx_health_plan_featured_tips_block]' ); ?> |
|
65 | + <?php echo do_shortcode('[lsx_health_plan_featured_tips_block]'); ?> |
|
66 | 66 | </div> |
67 | 67 | <?php } ?> |
68 | 68 | </div> |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | <div class="entry-content"> |
78 | 78 | <div class="single-plan-inner warmup-content"> |
79 | 79 | <div class="single-plan-section-title warmup-plan title-lined"> |
80 | - <?php lsx_get_svg_icon( 'warm.svg' ); ?> |
|
81 | - <h2><?php esc_html_e( 'Warm Up', 'lsx-health-plan' ); ?></h2> |
|
80 | + <?php lsx_get_svg_icon('warm.svg'); ?> |
|
81 | + <h2><?php esc_html_e('Warm Up', 'lsx-health-plan'); ?></h2> |
|
82 | 82 | </div> |
83 | 83 | <?php |
84 | 84 | the_content(); |
85 | - wp_link_pages( array( |
|
85 | + wp_link_pages(array( |
|
86 | 86 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
87 | 87 | 'after' => '</div></div>', |
88 | 88 | 'link_before' => '<span>', |
89 | 89 | 'link_after' => '</span>', |
90 | - ) ); |
|
90 | + )); |
|
91 | 91 | ?> |
92 | 92 | </div> |
93 | 93 | </div><!-- .entry-content --> |
@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | |
9 | 9 | $warm_up = get_post_meta( get_the_ID(), 'plan_warmup', true ); |
10 | 10 | if ( false === $warm_up || '' === $warm_up ) { |
11 | - $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
12 | - if ( isset( $options['plan_warmup'] ) && '' !== $options['plan_warmup'] && ! empty( $options['plan_warmup'] ) ) { |
|
13 | - $warm_up = $options['plan_warmup']; |
|
14 | - } |
|
11 | + $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
12 | + if ( isset( $options['plan_warmup'] ) && '' !== $options['plan_warmup'] && ! empty( $options['plan_warmup'] ) ) { |
|
13 | + $warm_up = $options['plan_warmup']; |
|
14 | + } |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | ?> |
@@ -19,25 +19,25 @@ discard block |
||
19 | 19 | <?php |
20 | 20 | |
21 | 21 | if ( false !== $warm_up && '' !== $warm_up ) { |
22 | - if ( ! is_array( $warm_up ) ) { |
|
23 | - $warm_up = array( $warm_up ); |
|
24 | - } |
|
22 | + if ( ! is_array( $warm_up ) ) { |
|
23 | + $warm_up = array( $warm_up ); |
|
24 | + } |
|
25 | 25 | |
26 | - $warmup_type = array( 'page', 'workout', 'exercise' ); |
|
27 | - $warmup_query = new WP_Query( |
|
28 | - array( |
|
29 | - 'post__in' => $warm_up, |
|
30 | - 'post_type' => $warmup_type, |
|
31 | - ) |
|
32 | - ); |
|
26 | + $warmup_type = array( 'page', 'workout', 'exercise' ); |
|
27 | + $warmup_query = new WP_Query( |
|
28 | + array( |
|
29 | + 'post__in' => $warm_up, |
|
30 | + 'post_type' => $warmup_type, |
|
31 | + ) |
|
32 | + ); |
|
33 | 33 | |
34 | - if ( $warmup_query->have_posts() ) { |
|
35 | - while ( $warmup_query->have_posts() ) { |
|
36 | - $warmup_query->the_post(); |
|
37 | - lsx_entry_before(); |
|
38 | - if ( 'workout' === get_post_type() ) { |
|
39 | - $connected_workouts = array( get_the_ID() ); |
|
40 | - ?> |
|
34 | + if ( $warmup_query->have_posts() ) { |
|
35 | + while ( $warmup_query->have_posts() ) { |
|
36 | + $warmup_query->the_post(); |
|
37 | + lsx_entry_before(); |
|
38 | + if ( 'workout' === get_post_type() ) { |
|
39 | + $connected_workouts = array( get_the_ID() ); |
|
40 | + ?> |
|
41 | 41 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
42 | 42 | <?php lsx_entry_top(); ?> |
43 | 43 | <div class="entry-content"> |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | <h2><?php esc_html_e( 'Warm Up', 'lsx-health-plan' ); ?></h2> |
48 | 48 | </div> |
49 | 49 | <?php |
50 | - the_content(); |
|
51 | - wp_link_pages( array( |
|
52 | - 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
53 | - 'after' => '</div></div>', |
|
54 | - 'link_before' => '<span>', |
|
55 | - 'link_after' => '</span>', |
|
56 | - ) ); |
|
57 | - ?> |
|
50 | + the_content(); |
|
51 | + wp_link_pages( array( |
|
52 | + 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
53 | + 'after' => '</div></div>', |
|
54 | + 'link_before' => '<span>', |
|
55 | + 'link_after' => '</span>', |
|
56 | + ) ); |
|
57 | + ?> |
|
58 | 58 | </div> |
59 | 59 | </div><!-- .entry-content --> |
60 | 60 | <?php lsx_entry_bottom(); ?> |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | <?php } ?> |
70 | 70 | </article><!-- #post-## --> |
71 | 71 | <?php |
72 | - lsx_health_plan_workout_sets(); |
|
73 | - } else { |
|
74 | - ?> |
|
72 | + lsx_health_plan_workout_sets(); |
|
73 | + } else { |
|
74 | + ?> |
|
75 | 75 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
76 | 76 | <?php lsx_entry_top(); ?> |
77 | 77 | <div class="entry-content"> |
@@ -81,25 +81,25 @@ discard block |
||
81 | 81 | <h2><?php esc_html_e( 'Warm Up', 'lsx-health-plan' ); ?></h2> |
82 | 82 | </div> |
83 | 83 | <?php |
84 | - the_content(); |
|
85 | - wp_link_pages( array( |
|
86 | - 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
87 | - 'after' => '</div></div>', |
|
88 | - 'link_before' => '<span>', |
|
89 | - 'link_after' => '</span>', |
|
90 | - ) ); |
|
91 | - ?> |
|
84 | + the_content(); |
|
85 | + wp_link_pages( array( |
|
86 | + 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
87 | + 'after' => '</div></div>', |
|
88 | + 'link_before' => '<span>', |
|
89 | + 'link_after' => '</span>', |
|
90 | + ) ); |
|
91 | + ?> |
|
92 | 92 | </div> |
93 | 93 | </div><!-- .entry-content --> |
94 | 94 | <?php lsx_entry_bottom(); ?> |
95 | 95 | </article><!-- #post-## --> |
96 | 96 | <?php |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | - lsx_entry_after(); |
|
100 | - } |
|
101 | - wp_reset_postdata(); |
|
102 | - } |
|
99 | + lsx_entry_after(); |
|
100 | + } |
|
101 | + wp_reset_postdata(); |
|
102 | + } |
|
103 | 103 | } |
104 | 104 | ?> |
105 | 105 | </div> |