1
|
|
|
<?php |
|
|
|
|
2
|
|
|
namespace lsx_health_plan\shortcodes; |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* LSX Health Plan Conditional Helpers. |
6
|
|
|
* |
7
|
|
|
* @package lsx-health-plan |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Only display the my account page is the user is logged out. |
12
|
|
|
* |
13
|
|
|
* @return string |
14
|
|
|
*/ |
15
|
|
|
function restricted_content() { |
|
|
|
|
16
|
|
|
$content = ''; |
17
|
|
|
if ( ! is_user_logged_in() ) { |
|
|
|
|
18
|
|
|
ob_start(); |
19
|
|
|
echo do_shortcode( '[woocommerce_my_account]' ); |
20
|
|
|
$content = ob_get_clean(); |
21
|
|
|
} |
|
|
|
|
22
|
|
|
return $content; |
23
|
|
|
} |
|
|
|
|
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Outputs the my profile tabs on the frontpage, |
27
|
|
|
* |
28
|
|
|
* @return void |
|
|
|
|
29
|
|
|
*/ |
30
|
|
|
function my_profile_tabs() { |
31
|
|
|
ob_start(); |
32
|
|
|
echo lsx_health_plan_my_profile_tabs(); // WPCS: XSS OK. |
|
|
|
|
33
|
|
|
$content = ob_get_clean(); |
34
|
|
|
return $content; |
35
|
|
|
} |
|
|
|
|
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Outputs the my profile box on the frontpage. |
39
|
|
|
* |
40
|
|
|
* @return void |
|
|
|
|
41
|
|
|
*/ |
42
|
|
|
function my_profile_box() { |
43
|
|
|
ob_start(); |
44
|
|
|
echo lsx_health_plan_my_profile_box(); // WPCS: XSS OK. |
|
|
|
|
45
|
|
|
$content = ob_get_clean(); |
46
|
|
|
return $content; |
47
|
|
|
} |
|
|
|
|
48
|
|
|
|
49
|
|
|
/** |
|
|
|
|
50
|
|
|
* Outputs all the plans on the frontpage. |
51
|
|
|
* |
52
|
|
|
* @return void |
|
|
|
|
53
|
|
|
*/ |
54
|
|
|
function all_plans_box( $args = array() ) { |
|
|
|
|
55
|
|
|
|
56
|
|
|
ob_start(); |
57
|
|
|
echo lsx_health_plan_all_plans_block(); // WPCS: XSS OK. |
|
|
|
|
58
|
|
|
$content = ob_get_clean(); |
59
|
|
|
return $content; |
60
|
|
|
} |
|
|
|
|
61
|
|
|
|
62
|
|
|
/** |
|
|
|
|
63
|
|
|
* Outputs the my profile box on the frontpage. |
64
|
|
|
* |
65
|
|
|
* @return void |
|
|
|
|
66
|
|
|
*/ |
67
|
|
|
function day_plan_box( $args = array() ) { |
68
|
|
|
$defaults = array( |
69
|
|
|
'week_view' => false, |
70
|
|
|
'show_downloads' => false, |
71
|
|
|
'plan' => '', |
72
|
|
|
); |
73
|
|
|
$args = wp_parse_args( $args, $defaults ); |
74
|
|
|
ob_start(); |
75
|
|
|
if ( false === $args['week_view'] ) { |
|
|
|
|
76
|
|
|
echo lsx_health_plan_day_plan_block( $args ); // WPCS: XSS OK. |
|
|
|
|
77
|
|
|
} else { |
78
|
|
|
echo lsx_health_plan_week_plan_block( $args ); // WPCS: XSS OK. |
|
|
|
|
79
|
|
|
} |
|
|
|
|
80
|
|
|
$content = ob_get_clean(); |
81
|
|
|
return $content; |
82
|
|
|
} |
|
|
|
|
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Outputs the my exercise shortcode box on the frontpage |
86
|
|
|
* |
87
|
|
|
* @param array $args |
|
|
|
|
88
|
|
|
* @return void |
|
|
|
|
89
|
|
|
*/ |
90
|
|
|
function exercise_box( $args = array() ) { |
91
|
|
|
$defaults = array( |
92
|
|
|
'include' => '', |
93
|
|
|
'term' => '', |
94
|
|
|
'taxonomy' => '', |
95
|
|
|
'view_more' => false, |
96
|
|
|
'columns' => 3, |
97
|
|
|
'limit' => 4, |
98
|
|
|
'post_type' => 'exercise', |
99
|
|
|
'orderby' => 'date', |
100
|
|
|
'order' => 'DESC', |
101
|
|
|
'description' => 'none', |
102
|
|
|
'link' => 'item', |
103
|
|
|
'link_class' => 'btn border-btn', |
104
|
|
|
'layout' => 'grid', |
105
|
|
|
'image_size' => 'lsx-thumbnail-square', |
106
|
|
|
'parent' => false, |
107
|
|
|
'modal_content' => 'excerpt', |
108
|
|
|
); |
109
|
|
|
$args = wp_parse_args( $args, $defaults ); |
110
|
|
|
ob_start(); |
111
|
|
|
echo lsx_health_plan_items( $args ); // WPCS: XSS OK. |
|
|
|
|
112
|
|
|
$content = ob_get_clean(); |
113
|
|
|
return $content; |
114
|
|
|
} |
|
|
|
|
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Outputs the my featured video box on the frontpage. |
118
|
|
|
* |
119
|
|
|
* @return void |
|
|
|
|
120
|
|
|
*/ |
121
|
|
|
function feature_video_box() { |
122
|
|
|
ob_start(); |
123
|
|
|
echo lsx_health_plan_featured_video_block(); // WPCS: XSS OK. |
|
|
|
|
124
|
|
|
$content = ob_get_clean(); |
125
|
|
|
|
126
|
|
|
wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true ); |
127
|
|
|
wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
128
|
|
|
return $content; |
129
|
|
|
} |
|
|
|
|
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Outputs the my featured recipes box on the frontpage. |
133
|
|
|
* |
134
|
|
|
* @return void |
|
|
|
|
135
|
|
|
*/ |
136
|
|
|
function feature_recipes_box() { |
137
|
|
|
ob_start(); |
138
|
|
|
echo lsx_health_plan_featured_recipes_block(); // WPCS: XSS OK. |
|
|
|
|
139
|
|
|
$content = ob_get_clean(); |
140
|
|
|
wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true ); |
141
|
|
|
wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
142
|
|
|
return $content; |
143
|
|
|
} |
|
|
|
|
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Outputs the my featured tips box on the frontpage. |
147
|
|
|
* |
148
|
|
|
* @return void |
|
|
|
|
149
|
|
|
*/ |
150
|
|
|
function feature_tips_box() { |
151
|
|
|
ob_start(); |
152
|
|
|
echo lsx_health_plan_featured_tips_block(); // WPCS: XSS OK. |
|
|
|
|
153
|
|
|
$content = ob_get_clean(); |
154
|
|
|
wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true ); |
155
|
|
|
wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
156
|
|
|
return $content; |
157
|
|
|
} |
|
|
|
|
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* Prints out the WooCommerce My Account Notices. |
161
|
|
|
* |
162
|
|
|
* @return string |
163
|
|
|
*/ |
164
|
|
|
function account_notices() { |
165
|
|
|
$content = ''; |
166
|
|
|
if ( function_exists( 'wc_print_notices' ) ) { |
|
|
|
|
167
|
|
|
$content = wc_print_notices( true ); |
168
|
|
|
} |
|
|
|
|
169
|
|
|
return $content; |
170
|
|
|
} |
|
|
|
|
171
|
|
|
|