@@ -7,12 +7,12 @@ |
||
7 | 7 | |
8 | 8 | lsx_entry_before(); |
9 | 9 | $tip_id = get_the_id(); |
10 | -$featured_image = get_the_post_thumbnail( $tip_id, array( 600, 300 ) ); |
|
10 | +$featured_image = get_the_post_thumbnail($tip_id, array(600, 300)); |
|
11 | 11 | ?> |
12 | 12 | <div class="content-box diet-tip-wrapper quick-tip"> |
13 | 13 | <div class="row"> |
14 | 14 | <div class="col-lg-1 col-md-1 col-sm-1 col-xs-2"> |
15 | - <?php lsx_get_svg_icon( 'tips-icon.svg' ); ?> |
|
15 | + <?php lsx_get_svg_icon('tips-icon.svg'); ?> |
|
16 | 16 | </div> |
17 | 17 | <div class="col-lg-11 col-md-11 col-sm-11 col-xs-10"> |
18 | 18 | <h3 class="tip-title"><?php the_title(); ?></h3> |
@@ -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 |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | * Contructor |
31 | 31 | */ |
32 | 32 | public function __construct() { |
33 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
33 | + add_action('init', array($this, 'register_post_type')); |
|
34 | 34 | |
35 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
36 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
35 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
36 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
37 | 37 | |
38 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
38 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes')); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function get_instance() { |
49 | 49 | // If the single instance hasn't been set, set it now. |
50 | - if ( null === self::$instance ) { |
|
50 | + if (null === self::$instance) { |
|
51 | 51 | self::$instance = new self(); |
52 | 52 | } |
53 | 53 | return self::$instance; |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function register_post_type() { |
59 | 59 | $labels = array( |
60 | - 'name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
61 | - 'singular_name' => esc_html__( 'Meal', 'lsx-health-plan' ), |
|
62 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
63 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
64 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
65 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
66 | - 'all_items' => esc_html__( 'All Meals', 'lsx-health-plan' ), |
|
67 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
68 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
69 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
70 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
60 | + 'name' => esc_html__('Meals', 'lsx-health-plan'), |
|
61 | + 'singular_name' => esc_html__('Meal', 'lsx-health-plan'), |
|
62 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
63 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
64 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
65 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
66 | + 'all_items' => esc_html__('All Meals', 'lsx-health-plan'), |
|
67 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
68 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
69 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
70 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
71 | 71 | 'parent_item_colon' => '', |
72 | - 'menu_name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
72 | + 'menu_name' => esc_html__('Meals', 'lsx-health-plan'), |
|
73 | 73 | ); |
74 | - $args = array( |
|
74 | + $args = array( |
|
75 | 75 | 'labels' => $labels, |
76 | 76 | 'public' => true, |
77 | 77 | 'publicly_queryable' => true, |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | 'menu_icon' => 'dashicons-carrot', |
82 | 82 | 'query_var' => true, |
83 | 83 | 'rewrite' => array( |
84 | - 'slug' => \lsx_health_plan\functions\get_option( 'meal_single_slug', 'meal' ), |
|
84 | + 'slug' => \lsx_health_plan\functions\get_option('meal_single_slug', 'meal'), |
|
85 | 85 | ), |
86 | 86 | 'capability_type' => 'post', |
87 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ), |
|
87 | + 'has_archive' => \lsx_health_plan\functions\get_option('endpoint_meal_archive', 'meals'), |
|
88 | 88 | 'hierarchical' => true, |
89 | 89 | 'menu_position' => null, |
90 | 90 | 'supports' => array( |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'custom-fields', |
96 | 96 | ), |
97 | 97 | ); |
98 | - register_post_type( 'meal', $args ); |
|
98 | + register_post_type('meal', $args); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param array $post_types |
105 | 105 | * @return array |
106 | 106 | */ |
107 | - public function enable_post_type( $post_types = array() ) { |
|
107 | + public function enable_post_type($post_types = array()) { |
|
108 | 108 | $post_types[] = $this->slug; |
109 | 109 | return $post_types; |
110 | 110 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param array $connections |
116 | 116 | * @return void |
117 | 117 | */ |
118 | - public function enable_connections( $connections = array() ) { |
|
118 | + public function enable_connections($connections = array()) { |
|
119 | 119 | $connections['meal']['connected_plans'] = 'connected_meals'; |
120 | 120 | $connections['plan']['connected_meals'] = 'connected_plans'; |
121 | 121 | return $connections; |
@@ -125,66 +125,66 @@ discard block |
||
125 | 125 | * Define the metabox and field configurations. |
126 | 126 | */ |
127 | 127 | public function details_metaboxes() { |
128 | - $cmb = new_cmb2_box( array( |
|
128 | + $cmb = new_cmb2_box(array( |
|
129 | 129 | 'id' => $this->slug . '_shopping_list_metabox', |
130 | - 'title' => __( 'Shopping List', 'lsx-health-plan' ), |
|
131 | - 'object_types' => array( $this->slug ), // Post type |
|
130 | + 'title' => __('Shopping List', 'lsx-health-plan'), |
|
131 | + 'object_types' => array($this->slug), // Post type |
|
132 | 132 | 'context' => 'normal', |
133 | 133 | 'priority' => 'high', |
134 | 134 | 'show_names' => true, |
135 | - ) ); |
|
136 | - $cmb->add_field( array( |
|
137 | - 'name' => __( 'Shopping List', 'lsx-health-plan' ), |
|
138 | - 'desc' => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ), |
|
135 | + )); |
|
136 | + $cmb->add_field(array( |
|
137 | + 'name' => __('Shopping List', 'lsx-health-plan'), |
|
138 | + 'desc' => __('Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.'), |
|
139 | 139 | 'id' => $this->slug . '_shopping_list', |
140 | 140 | 'type' => 'post_search_ajax', |
141 | 141 | // Optional : |
142 | - 'limit' => 1, // Limit selection to X items only (default 1) |
|
142 | + 'limit' => 1, // Limit selection to X items only (default 1) |
|
143 | 143 | 'sortable' => true, // Allow selected items to be sortable (default false) |
144 | 144 | 'query_args' => array( |
145 | - 'post_type' => array( 'page' ), |
|
146 | - 'post_status' => array( 'publish' ), |
|
145 | + 'post_type' => array('page'), |
|
146 | + 'post_status' => array('publish'), |
|
147 | 147 | 'posts_per_page' => -1, |
148 | 148 | ), |
149 | - ) ); |
|
150 | - $cmb = new_cmb2_box( array( |
|
149 | + )); |
|
150 | + $cmb = new_cmb2_box(array( |
|
151 | 151 | 'id' => $this->slug . '_details_metabox', |
152 | - 'title' => __( 'Meal Details', 'lsx-health-plan' ), |
|
153 | - 'object_types' => array( $this->slug ), // Post type |
|
152 | + 'title' => __('Meal Details', 'lsx-health-plan'), |
|
153 | + 'object_types' => array($this->slug), // Post type |
|
154 | 154 | 'context' => 'normal', |
155 | 155 | 'priority' => 'high', |
156 | 156 | 'show_names' => true, |
157 | - ) ); |
|
157 | + )); |
|
158 | 158 | |
159 | - $cmb->add_field( array( |
|
160 | - 'name' => __( 'Meal Short Description', 'lsx-health-plan' ), |
|
159 | + $cmb->add_field(array( |
|
160 | + 'name' => __('Meal Short Description', 'lsx-health-plan'), |
|
161 | 161 | 'id' => $this->slug . '_short_description', |
162 | 162 | 'type' => 'textarea_small', |
163 | - 'desc' => __( 'Add a small description for this meal (optional)', 'lsx-health-plan' ), |
|
164 | - ) ); |
|
163 | + 'desc' => __('Add a small description for this meal (optional)', 'lsx-health-plan'), |
|
164 | + )); |
|
165 | 165 | |
166 | - $cmb->add_field( array( |
|
167 | - 'name' => __( 'Pre Breakfast Snack', 'lsx-health-plan' ), |
|
166 | + $cmb->add_field(array( |
|
167 | + 'name' => __('Pre Breakfast Snack', 'lsx-health-plan'), |
|
168 | 168 | 'id' => $this->slug . '_pre_breakfast_snack', |
169 | 169 | 'type' => 'wysiwyg', |
170 | 170 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
171 | 171 | 'options' => array( |
172 | 172 | 'textarea_rows' => 5, |
173 | 173 | ), |
174 | - ) ); |
|
175 | - $cmb->add_field( array( |
|
176 | - 'name' => __( 'Breakfast', 'lsx-health-plan' ), |
|
174 | + )); |
|
175 | + $cmb->add_field(array( |
|
176 | + 'name' => __('Breakfast', 'lsx-health-plan'), |
|
177 | 177 | 'id' => $this->slug . '_breakfast', |
178 | 178 | 'type' => 'wysiwyg', |
179 | 179 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
180 | 180 | 'options' => array( |
181 | 181 | 'textarea_rows' => 5, |
182 | 182 | ), |
183 | - ) ); |
|
183 | + )); |
|
184 | 184 | |
185 | 185 | $cmb->add_field( |
186 | 186 | array( |
187 | - 'name' => __( 'Post Breakfast Snack', 'lsx-health-plan' ), |
|
187 | + 'name' => __('Post Breakfast Snack', 'lsx-health-plan'), |
|
188 | 188 | 'id' => $this->slug . '_breakfast_snack', |
189 | 189 | 'type' => 'wysiwyg', |
190 | 190 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -194,19 +194,19 @@ discard block |
||
194 | 194 | ) |
195 | 195 | ); |
196 | 196 | |
197 | - if ( post_type_exists( 'recipe' ) ) { |
|
197 | + if (post_type_exists('recipe')) { |
|
198 | 198 | $cmb->add_field( |
199 | 199 | array( |
200 | - 'name' => __( 'Breakfast Recipes', 'lsx-health-plan' ), |
|
201 | - 'desc' => __( 'Connect additional recipes options for breakfast.', 'lsx-health-plan' ), |
|
200 | + 'name' => __('Breakfast Recipes', 'lsx-health-plan'), |
|
201 | + 'desc' => __('Connect additional recipes options for breakfast.', 'lsx-health-plan'), |
|
202 | 202 | 'id' => 'breakfast_recipes', |
203 | 203 | 'type' => 'post_search_ajax', |
204 | 204 | // Optional : |
205 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
205 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
206 | 206 | 'sortable' => true, // Allow selected items to be sortable (default false) |
207 | 207 | 'query_args' => array( |
208 | - 'post_type' => array( 'recipe' ), |
|
209 | - 'post_status' => array( 'publish' ), |
|
208 | + 'post_type' => array('recipe'), |
|
209 | + 'post_status' => array('publish'), |
|
210 | 210 | 'posts_per_page' => -1, |
211 | 211 | ), |
212 | 212 | ) |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | $cmb->add_field( |
217 | 217 | array( |
218 | - 'name' => __( 'Pre Lunch Snack', 'lsx-health-plan' ), |
|
218 | + 'name' => __('Pre Lunch Snack', 'lsx-health-plan'), |
|
219 | 219 | 'id' => $this->slug . '_pre_lunch_snack', |
220 | 220 | 'type' => 'wysiwyg', |
221 | 221 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | ); |
227 | 227 | $cmb->add_field( |
228 | 228 | array( |
229 | - 'name' => __( 'Lunch', 'lsx-health-plan' ), |
|
229 | + 'name' => __('Lunch', 'lsx-health-plan'), |
|
230 | 230 | 'id' => $this->slug . '_lunch', |
231 | 231 | 'type' => 'wysiwyg', |
232 | 232 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ); |
238 | 238 | $cmb->add_field( |
239 | 239 | array( |
240 | - 'name' => __( 'Post Lunch Snack', 'lsx-health-plan' ), |
|
240 | + 'name' => __('Post Lunch Snack', 'lsx-health-plan'), |
|
241 | 241 | 'id' => $this->slug . '_lunch_snack', |
242 | 242 | 'type' => 'wysiwyg', |
243 | 243 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -247,19 +247,19 @@ discard block |
||
247 | 247 | ) |
248 | 248 | ); |
249 | 249 | |
250 | - if ( post_type_exists( 'recipe' ) ) { |
|
250 | + if (post_type_exists('recipe')) { |
|
251 | 251 | $cmb->add_field( |
252 | 252 | array( |
253 | - 'name' => __( 'Lunch Recipes', 'lsx-health-plan' ), |
|
254 | - 'desc' => __( 'Connect additional recipes options for lunch.', 'lsx-health-plan' ), |
|
253 | + 'name' => __('Lunch Recipes', 'lsx-health-plan'), |
|
254 | + 'desc' => __('Connect additional recipes options for lunch.', 'lsx-health-plan'), |
|
255 | 255 | 'id' => 'lunch_recipes', |
256 | 256 | 'type' => 'post_search_ajax', |
257 | 257 | // Optional : |
258 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
258 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
259 | 259 | 'sortable' => true, // Allow selected items to be sortable (default false) |
260 | 260 | 'query_args' => array( |
261 | - 'post_type' => array( 'recipe' ), |
|
262 | - 'post_status' => array( 'publish' ), |
|
261 | + 'post_type' => array('recipe'), |
|
262 | + 'post_status' => array('publish'), |
|
263 | 263 | 'posts_per_page' => -1, |
264 | 264 | ), |
265 | 265 | ) |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | $cmb->add_field( |
270 | 270 | array( |
271 | - 'name' => __( 'Pre Dinner Snack', 'lsx-health-plan' ), |
|
271 | + 'name' => __('Pre Dinner Snack', 'lsx-health-plan'), |
|
272 | 272 | 'id' => $this->slug . '_pre_dinner_snack', |
273 | 273 | 'type' => 'wysiwyg', |
274 | 274 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | ); |
280 | 280 | $cmb->add_field( |
281 | 281 | array( |
282 | - 'name' => __( 'Dinner', 'lsx-health-plan' ), |
|
282 | + 'name' => __('Dinner', 'lsx-health-plan'), |
|
283 | 283 | 'id' => $this->slug . '_dinner', |
284 | 284 | 'type' => 'wysiwyg', |
285 | 285 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | ); |
291 | 291 | $cmb->add_field( |
292 | 292 | array( |
293 | - 'name' => __( 'Post Dinner Snack', 'lsx-health-plan' ), |
|
293 | + 'name' => __('Post Dinner Snack', 'lsx-health-plan'), |
|
294 | 294 | 'id' => $this->slug . '_dinner_snack', |
295 | 295 | 'type' => 'wysiwyg', |
296 | 296 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -300,19 +300,19 @@ discard block |
||
300 | 300 | ) |
301 | 301 | ); |
302 | 302 | |
303 | - if ( post_type_exists( 'recipe' ) ) { |
|
303 | + if (post_type_exists('recipe')) { |
|
304 | 304 | $cmb->add_field( |
305 | 305 | array( |
306 | - 'name' => __( 'Dinner Recipes', 'lsx-health-plan' ), |
|
307 | - 'desc' => __( 'Connect additional recipes options for dinner.', 'lsx-health-plan' ), |
|
306 | + 'name' => __('Dinner Recipes', 'lsx-health-plan'), |
|
307 | + 'desc' => __('Connect additional recipes options for dinner.', 'lsx-health-plan'), |
|
308 | 308 | 'id' => 'dinner_recipes', |
309 | 309 | 'type' => 'post_search_ajax', |
310 | 310 | // Optional : |
311 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
311 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
312 | 312 | 'sortable' => true, // Allow selected items to be sortable (default false) |
313 | 313 | 'query_args' => array( |
314 | - 'post_type' => array( 'recipe' ), |
|
315 | - 'post_status' => array( 'publish' ), |
|
314 | + 'post_type' => array('recipe'), |
|
315 | + 'post_status' => array('publish'), |
|
316 | 316 | 'posts_per_page' => -1, |
317 | 317 | ), |
318 | 318 | ) |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | * Contructor |
33 | 33 | */ |
34 | 34 | public function __construct() { |
35 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
36 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
37 | - add_action( 'init', array( $this, 'recipe_type_taxonomy_setup' ) ); |
|
38 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
39 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
40 | - add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 8, 1 ); |
|
41 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
35 | + add_action('init', array($this, 'register_post_type')); |
|
36 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
37 | + add_action('init', array($this, 'recipe_type_taxonomy_setup')); |
|
38 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
39 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes')); |
|
40 | + add_action('lsx_hp_settings_page', array($this, 'register_settings'), 8, 1); |
|
41 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100); |
|
42 | 42 | |
43 | 43 | // Template Redirects. |
44 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
44 | + add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public static function get_instance() { |
55 | 55 | // If the single instance hasn't been set, set it now. |
56 | - if ( null === self::$instance ) { |
|
56 | + if (null === self::$instance) { |
|
57 | 57 | self::$instance = new self(); |
58 | 58 | } |
59 | 59 | return self::$instance; |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function register_post_type() { |
65 | 65 | $labels = array( |
66 | - 'name' => esc_html__( 'Workouts', 'lsx-health-plan' ), |
|
67 | - 'singular_name' => esc_html__( 'Workout', 'lsx-health-plan' ), |
|
68 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
69 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
70 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
71 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
72 | - 'all_items' => esc_html__( 'All Workouts', 'lsx-health-plan' ), |
|
73 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
74 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
75 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
76 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
66 | + 'name' => esc_html__('Workouts', 'lsx-health-plan'), |
|
67 | + 'singular_name' => esc_html__('Workout', 'lsx-health-plan'), |
|
68 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
69 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
70 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
71 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
72 | + 'all_items' => esc_html__('All Workouts', 'lsx-health-plan'), |
|
73 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
74 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
75 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
76 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
77 | 77 | 'parent_item_colon' => '', |
78 | - 'menu_name' => esc_html__( 'Workouts', 'lsx-health-plan' ), |
|
78 | + 'menu_name' => esc_html__('Workouts', 'lsx-health-plan'), |
|
79 | 79 | ); |
80 | 80 | $args = array( |
81 | 81 | 'labels' => $labels, |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | 'menu_icon' => 'dashicons-universal-access', |
88 | 88 | 'query_var' => true, |
89 | 89 | 'rewrite' => array( |
90 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
90 | + 'slug' => \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'), |
|
91 | 91 | ), |
92 | 92 | 'capability_type' => 'page', |
93 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_workout_archive', 'workouts' ), |
|
93 | + 'has_archive' => \lsx_health_plan\functions\get_option('endpoint_workout_archive', 'workouts'), |
|
94 | 94 | 'hierarchical' => true, |
95 | 95 | 'menu_position' => null, |
96 | 96 | 'supports' => array( |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | 'custom-fields', |
103 | 103 | ), |
104 | 104 | ); |
105 | - register_post_type( 'workout', $args ); |
|
105 | + register_post_type('workout', $args); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -110,17 +110,17 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function recipe_type_taxonomy_setup() { |
112 | 112 | $labels = array( |
113 | - 'name' => esc_html_x( 'Workout Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
114 | - 'singular_name' => esc_html_x( 'Workout Type', 'taxonomy singular name', 'lsx-health-plan' ), |
|
115 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
116 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
117 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
118 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
119 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
120 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
121 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
122 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
123 | - 'menu_name' => esc_html__( 'Workout Types', 'lsx-health-plan' ), |
|
113 | + 'name' => esc_html_x('Workout Type', 'taxonomy general name', 'lsx-health-plan'), |
|
114 | + 'singular_name' => esc_html_x('Workout Type', 'taxonomy singular name', 'lsx-health-plan'), |
|
115 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
116 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
117 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
118 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
119 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
120 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
121 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
122 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
123 | + 'menu_name' => esc_html__('Workout Types', 'lsx-health-plan'), |
|
124 | 124 | ); |
125 | 125 | |
126 | 126 | $args = array( |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | ), |
135 | 135 | ); |
136 | 136 | |
137 | - register_taxonomy( 'workout-type', array( 'workout' ), $args ); |
|
137 | + register_taxonomy('workout-type', array('workout'), $args); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param array $post_types |
144 | 144 | * @return array |
145 | 145 | */ |
146 | - public function enable_post_type( $post_types = array() ) { |
|
146 | + public function enable_post_type($post_types = array()) { |
|
147 | 147 | $post_types[] = $this->slug; |
148 | 148 | return $post_types; |
149 | 149 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param array $connections |
155 | 155 | * @return void |
156 | 156 | */ |
157 | - public function enable_connections( $connections = array() ) { |
|
157 | + public function enable_connections($connections = array()) { |
|
158 | 158 | $connections['workout']['connected_plans'] = 'connected_workouts'; |
159 | 159 | $connections['plan']['connected_workouts'] = 'connected_plans'; |
160 | 160 | |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | * @param string $title the term title. |
173 | 173 | * @return string |
174 | 174 | */ |
175 | - public function get_the_archive_title( $title ) { |
|
176 | - if ( is_post_type_archive( 'workout' ) ) { |
|
177 | - $title = __( 'Workouts', 'lsx-health-plan' ); |
|
175 | + public function get_the_archive_title($title) { |
|
176 | + if (is_post_type_archive('workout')) { |
|
177 | + $title = __('Workouts', 'lsx-health-plan'); |
|
178 | 178 | } |
179 | 179 | return $title; |
180 | 180 | } |
@@ -184,43 +184,43 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function details_metaboxes() { |
186 | 186 | |
187 | - $cmb = new_cmb2_box( array( |
|
187 | + $cmb = new_cmb2_box(array( |
|
188 | 188 | 'id' => $this->slug . '_details_metabox', |
189 | - 'title' => __( 'Workout Details', 'lsx-health-plan' ), |
|
190 | - 'object_types' => array( $this->slug ), // Post type |
|
189 | + 'title' => __('Workout Details', 'lsx-health-plan'), |
|
190 | + 'object_types' => array($this->slug), // Post type |
|
191 | 191 | 'context' => 'normal', |
192 | 192 | 'priority' => 'high', |
193 | 193 | 'show_names' => true, |
194 | - ) ); |
|
194 | + )); |
|
195 | 195 | |
196 | - $cmb->add_field( array( |
|
197 | - 'name' => __( 'Workout Short Description', 'lsx-health-plan' ), |
|
196 | + $cmb->add_field(array( |
|
197 | + 'name' => __('Workout Short Description', 'lsx-health-plan'), |
|
198 | 198 | 'id' => $this->slug . '_short_description', |
199 | 199 | 'type' => 'textarea_small', |
200 | - 'desc' => __( 'Add a small description for this workout (optional)', 'lsx-health-plan' ), |
|
201 | - ) ); |
|
200 | + 'desc' => __('Add a small description for this workout (optional)', 'lsx-health-plan'), |
|
201 | + )); |
|
202 | 202 | |
203 | - $workout_sections = apply_filters( 'lsx_health_plan_workout_sections_amount', 6 ); |
|
204 | - if ( false !== $workout_sections && null !== $workout_sections ) { |
|
203 | + $workout_sections = apply_filters('lsx_health_plan_workout_sections_amount', 6); |
|
204 | + if (false !== $workout_sections && null !== $workout_sections) { |
|
205 | 205 | $i = 1; |
206 | - while ( $i <= $workout_sections ) { |
|
206 | + while ($i <= $workout_sections) { |
|
207 | 207 | |
208 | - $cmb_group = new_cmb2_box( array( |
|
208 | + $cmb_group = new_cmb2_box(array( |
|
209 | 209 | 'id' => $this->slug . '_section_' . $i . '_metabox', |
210 | - 'title' => esc_html__( 'Exercise Group ', 'lsx-health-plan' ) . $i, |
|
211 | - 'object_types' => array( $this->slug ), |
|
212 | - ) ); |
|
210 | + 'title' => esc_html__('Exercise Group ', 'lsx-health-plan') . $i, |
|
211 | + 'object_types' => array($this->slug), |
|
212 | + )); |
|
213 | 213 | |
214 | - $cmb_group->add_field( array( |
|
215 | - 'name' => __( 'Title', 'lsx-health-plan' ), |
|
214 | + $cmb_group->add_field(array( |
|
215 | + 'name' => __('Title', 'lsx-health-plan'), |
|
216 | 216 | 'id' => $this->slug . '_section_' . $i . '_title', |
217 | 217 | 'type' => 'text', |
218 | 218 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
219 | - ) ); |
|
219 | + )); |
|
220 | 220 | |
221 | 221 | $cmb_group->add_field( |
222 | 222 | array( |
223 | - 'name' => __( 'Description', 'lsx-health-plan' ), |
|
223 | + 'name' => __('Description', 'lsx-health-plan'), |
|
224 | 224 | 'id' => $this->slug . '_section_' . $i . '_description', |
225 | 225 | 'type' => 'wysiwyg', |
226 | 226 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -239,27 +239,27 @@ discard block |
||
239 | 239 | 'id' => $this->slug . '_section_' . $i, |
240 | 240 | 'type' => 'group', |
241 | 241 | 'options' => array( |
242 | - 'group_title' => esc_html__( 'Exercise {#}', 'lsx-health-plan' ), // {#} gets replaced by row number |
|
243 | - 'add_button' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
244 | - 'remove_button' => esc_html__( 'Delete', 'lsx-health-plan' ), |
|
242 | + 'group_title' => esc_html__('Exercise {#}', 'lsx-health-plan'), // {#} gets replaced by row number |
|
243 | + 'add_button' => esc_html__('Add New', 'lsx-health-plan'), |
|
244 | + 'remove_button' => esc_html__('Delete', 'lsx-health-plan'), |
|
245 | 245 | 'sortable' => true, |
246 | 246 | ), |
247 | 247 | ) |
248 | 248 | ); |
249 | 249 | |
250 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
250 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
251 | 251 | $cmb_group->add_group_field( |
252 | 252 | $group_field_id, |
253 | 253 | array( |
254 | - 'name' => __( 'Exercise related to this workout', 'lsx-health-plan' ), |
|
254 | + 'name' => __('Exercise related to this workout', 'lsx-health-plan'), |
|
255 | 255 | 'id' => 'connected_exercises', |
256 | 256 | 'type' => 'post_search_ajax', |
257 | 257 | // Optional : |
258 | 258 | 'limit' => 1, // Limit selection to X items only (default 1) |
259 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
259 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
260 | 260 | 'query_args' => array( |
261 | - 'post_type' => array( 'exercise' ), |
|
262 | - 'post_status' => array( 'publish' ), |
|
261 | + 'post_type' => array('exercise'), |
|
262 | + 'post_status' => array('publish'), |
|
263 | 263 | 'posts_per_page' => -1, |
264 | 264 | ), |
265 | 265 | ) |
@@ -268,15 +268,15 @@ discard block |
||
268 | 268 | $cmb_group->add_group_field( |
269 | 269 | $group_field_id, |
270 | 270 | array( |
271 | - 'name' => __( 'Video related to this workout', 'lsx-health-plan' ), |
|
271 | + 'name' => __('Video related to this workout', 'lsx-health-plan'), |
|
272 | 272 | 'id' => 'connected_videos', |
273 | 273 | 'type' => 'post_search_ajax', |
274 | 274 | // Optional : |
275 | 275 | 'limit' => 1, // Limit selection to X items only (default 1) |
276 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
276 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
277 | 277 | 'query_args' => array( |
278 | - 'post_type' => array( 'video' ), |
|
279 | - 'post_status' => array( 'publish' ), |
|
278 | + 'post_type' => array('video'), |
|
279 | + 'post_status' => array('publish'), |
|
280 | 280 | 'posts_per_page' => -1, |
281 | 281 | ), |
282 | 282 | ) |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $cmb_group->add_group_field( |
285 | 285 | $group_field_id, |
286 | 286 | array( |
287 | - 'name' => esc_html__( 'Workout Name', 'lsx-health-plan' ), |
|
287 | + 'name' => esc_html__('Workout Name', 'lsx-health-plan'), |
|
288 | 288 | 'id' => 'name', |
289 | 289 | 'type' => 'text', |
290 | 290 | // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types) |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | $cmb_group->add_group_field( |
295 | 295 | $group_field_id, |
296 | 296 | array( |
297 | - 'name' => __( 'Description', 'lsx-health-plan' ), |
|
297 | + 'name' => __('Description', 'lsx-health-plan'), |
|
298 | 298 | 'id' => 'description', |
299 | 299 | 'type' => 'wysiwyg', |
300 | 300 | 'options' => array( |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $cmb_group->add_group_field( |
308 | 308 | $group_field_id, |
309 | 309 | array( |
310 | - 'name' => esc_html__( 'Exercise title (Optional)', 'lsx-health-plan' ), |
|
310 | + 'name' => esc_html__('Exercise title (Optional)', 'lsx-health-plan'), |
|
311 | 311 | 'id' => 'alt_title', |
312 | 312 | 'type' => 'text', |
313 | 313 | ) |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $cmb_group->add_group_field( |
316 | 316 | $group_field_id, |
317 | 317 | array( |
318 | - 'name' => esc_html__( 'Exercise Description (Optional)', 'lsx-health-plan' ), |
|
318 | + 'name' => esc_html__('Exercise Description (Optional)', 'lsx-health-plan'), |
|
319 | 319 | 'id' => 'alt_description', |
320 | 320 | 'type' => 'textarea_small', |
321 | 321 | ) |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $cmb_group->add_group_field( |
324 | 324 | $group_field_id, |
325 | 325 | array( |
326 | - 'name' => esc_html__( 'Reps / Time / Distance', 'lsx-health-plan' ), |
|
326 | + 'name' => esc_html__('Reps / Time / Distance', 'lsx-health-plan'), |
|
327 | 327 | 'id' => 'reps', |
328 | 328 | 'type' => 'text', |
329 | 329 | // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types) |
@@ -332,13 +332,13 @@ discard block |
||
332 | 332 | $cmb_group->add_group_field( |
333 | 333 | $group_field_id, |
334 | 334 | array( |
335 | - 'name' => __( 'Exercise Image (Optional)', 'lsx-health-plan' ), |
|
335 | + 'name' => __('Exercise Image (Optional)', 'lsx-health-plan'), |
|
336 | 336 | 'id' => 'exercise_alt_thumbnail', |
337 | 337 | 'type' => 'file', |
338 | 338 | 'text' => array( |
339 | - 'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ), |
|
339 | + 'add_upload_file_text' => __('Add File', 'lsx-health-plan'), |
|
340 | 340 | ), |
341 | - 'desc' => __( 'Upload an image 300px x 300px in size.', 'lsx-health-plan' ), |
|
341 | + 'desc' => __('Upload an image 300px x 300px in size.', 'lsx-health-plan'), |
|
342 | 342 | 'query_args' => array( |
343 | 343 | 'type' => array( |
344 | 344 | 'image/gif', |
@@ -362,14 +362,14 @@ discard block |
||
362 | 362 | * @param object $cmb new_cmb2_box(). |
363 | 363 | * @return void |
364 | 364 | */ |
365 | - public function register_settings( $cmb ) { |
|
366 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
365 | + public function register_settings($cmb) { |
|
366 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
367 | 367 | $cmb->add_field( |
368 | 368 | array( |
369 | 369 | 'id' => 'workout_settings_title', |
370 | 370 | 'type' => 'title', |
371 | - 'name' => __( 'Workout Settings', 'lsx-health-plan' ), |
|
372 | - 'description' => __( 'Choose the layout, content and link settings for your exercises.', 'lsx-health-plan' ), |
|
371 | + 'name' => __('Workout Settings', 'lsx-health-plan'), |
|
372 | + 'description' => __('Choose the layout, content and link settings for your exercises.', 'lsx-health-plan'), |
|
373 | 373 | ) |
374 | 374 | ); |
375 | 375 | |
@@ -377,12 +377,12 @@ discard block |
||
377 | 377 | array( |
378 | 378 | 'id' => 'workout_tab_layout', |
379 | 379 | 'type' => 'select', |
380 | - 'name' => __( 'Workout Tab Layout', 'lsx-health-plan' ), |
|
381 | - 'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ), |
|
380 | + 'name' => __('Workout Tab Layout', 'lsx-health-plan'), |
|
381 | + 'description' => __('Choose the layout for the workouts.', 'lsx-health-plan'), |
|
382 | 382 | 'options' => array( |
383 | - 'table' => __( 'Table', 'lsx-health-plan' ), |
|
384 | - 'list' => __( 'List', 'lsx-health-plan' ), |
|
385 | - 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
383 | + 'table' => __('Table', 'lsx-health-plan'), |
|
384 | + 'list' => __('List', 'lsx-health-plan'), |
|
385 | + 'grid' => __('Grid', 'lsx-health-plan'), |
|
386 | 386 | ), |
387 | 387 | ) |
388 | 388 | ); |
@@ -390,12 +390,12 @@ discard block |
||
390 | 390 | array( |
391 | 391 | 'id' => 'workout_tab_link', |
392 | 392 | 'type' => 'select', |
393 | - 'name' => __( 'Workout Tab Link', 'lsx-health-plan' ), |
|
394 | - 'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ), |
|
393 | + 'name' => __('Workout Tab Link', 'lsx-health-plan'), |
|
394 | + 'description' => __('Choose to show the excerpt, full content or nothing.', 'lsx-health-plan'), |
|
395 | 395 | 'options' => array( |
396 | - '' => __( 'None', 'lsx-health-plan' ), |
|
397 | - 'single' => __( 'Single', 'lsx-health-plan' ), |
|
398 | - 'modal' => __( 'Modal', 'lsx-health-plan' ), |
|
396 | + '' => __('None', 'lsx-health-plan'), |
|
397 | + 'single' => __('Single', 'lsx-health-plan'), |
|
398 | + 'modal' => __('Modal', 'lsx-health-plan'), |
|
399 | 399 | ), |
400 | 400 | 'default' => 'modal', |
401 | 401 | ) |
@@ -404,12 +404,12 @@ discard block |
||
404 | 404 | array( |
405 | 405 | 'id' => 'workout_tab_modal_content', |
406 | 406 | 'type' => 'select', |
407 | - 'name' => __( 'Modal Content', 'lsx-health-plan' ), |
|
408 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ), |
|
407 | + 'name' => __('Modal Content', 'lsx-health-plan'), |
|
408 | + 'description' => __('Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan'), |
|
409 | 409 | 'options' => array( |
410 | - '' => __( 'None', 'lsx-health-plan' ), |
|
411 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
412 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
410 | + '' => __('None', 'lsx-health-plan'), |
|
411 | + 'excerpt' => __('Excerpt', 'lsx-health-plan'), |
|
412 | + 'full' => __('Full Content', 'lsx-health-plan'), |
|
413 | 413 | ), |
414 | 414 | 'default' => '', |
415 | 415 | ) |
@@ -418,14 +418,14 @@ discard block |
||
418 | 418 | array( |
419 | 419 | 'id' => 'workout_tab_columns', |
420 | 420 | 'type' => 'select', |
421 | - 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
422 | - 'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ), |
|
421 | + 'name' => __('Grid Columns', 'lsx-health-plan'), |
|
422 | + 'description' => __('If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan'), |
|
423 | 423 | 'options' => array( |
424 | - '12' => __( '1', 'lsx-health-plan' ), |
|
425 | - '6' => __( '2', 'lsx-health-plan' ), |
|
426 | - '4' => __( '3', 'lsx-health-plan' ), |
|
427 | - '3' => __( '4', 'lsx-health-plan' ), |
|
428 | - '2' => __( '6', 'lsx-health-plan' ), |
|
424 | + '12' => __('1', 'lsx-health-plan'), |
|
425 | + '6' => __('2', 'lsx-health-plan'), |
|
426 | + '4' => __('3', 'lsx-health-plan'), |
|
427 | + '3' => __('4', 'lsx-health-plan'), |
|
428 | + '2' => __('6', 'lsx-health-plan'), |
|
429 | 429 | ), |
430 | 430 | 'default' => '4', |
431 | 431 | ) |
@@ -434,18 +434,18 @@ discard block |
||
434 | 434 | array( |
435 | 435 | 'id' => 'workout_tab_content', |
436 | 436 | 'type' => 'select', |
437 | - 'name' => __( 'Grid Content', 'lsx-health-plan' ), |
|
438 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ), |
|
437 | + 'name' => __('Grid Content', 'lsx-health-plan'), |
|
438 | + 'description' => __('Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan'), |
|
439 | 439 | 'options' => array( |
440 | - '' => __( 'None', 'lsx-health-plan' ), |
|
441 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
442 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
440 | + '' => __('None', 'lsx-health-plan'), |
|
441 | + 'excerpt' => __('Excerpt', 'lsx-health-plan'), |
|
442 | + 'full' => __('Full Content', 'lsx-health-plan'), |
|
443 | 443 | ), |
444 | 444 | 'default' => '', |
445 | 445 | ) |
446 | 446 | ); |
447 | 447 | |
448 | - do_action( 'lsx_hp_workout_settings_page', $cmb ); |
|
448 | + do_action('lsx_hp_workout_settings_page', $cmb); |
|
449 | 449 | |
450 | 450 | $cmb->add_field( |
451 | 451 | array( |
@@ -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 | } |
@@ -33,35 +33,35 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function __construct() { |
35 | 35 | |
36 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
37 | - add_action( 'init', array( $this, 'plan_type_taxonomy_setup' ) ); |
|
38 | - add_action( 'init', array( $this, 'week_taxonomy_setup' ) ); |
|
36 | + add_action('init', array($this, 'register_post_type')); |
|
37 | + add_action('init', array($this, 'plan_type_taxonomy_setup')); |
|
38 | + add_action('init', array($this, 'week_taxonomy_setup')); |
|
39 | 39 | |
40 | 40 | // Icons for the plan types. |
41 | - add_action( 'create_term', array( $this, 'save_meta' ), 10, 2 ); |
|
42 | - add_action( 'edit_term', array( $this, 'save_meta' ), 10, 2 ); |
|
41 | + add_action('create_term', array($this, 'save_meta'), 10, 2); |
|
42 | + add_action('edit_term', array($this, 'save_meta'), 10, 2); |
|
43 | 43 | $prefix_taxonomy = 'plan-type'; |
44 | - add_action( sprintf( '%s_edit_form_fields', $prefix_taxonomy ), array( $this, 'add_thumbnail_form_field' ), 3, 1 ); |
|
44 | + add_action(sprintf('%s_edit_form_fields', $prefix_taxonomy), array($this, 'add_thumbnail_form_field'), 3, 1); |
|
45 | 45 | |
46 | 46 | // Register the Metaboxes. |
47 | - add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 ); |
|
48 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ), 5 ); |
|
49 | - add_action( 'cmb2_admin_init', array( $this, 'plan_connections' ), 5 ); |
|
50 | - add_action( 'cmb2_admin_init', array( $this, 'sections_metabox_loop' ), 1 ); |
|
47 | + add_action('cmb2_admin_init', array($this, 'featured_metabox'), 5); |
|
48 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes'), 5); |
|
49 | + add_action('cmb2_admin_init', array($this, 'plan_connections'), 5); |
|
50 | + add_action('cmb2_admin_init', array($this, 'sections_metabox_loop'), 1); |
|
51 | 51 | |
52 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
52 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100); |
|
53 | 53 | //add_filter( 'lsx_global_header_title', array( $this, 'hp_recipe_header_title' ), 200, 1 ); |
54 | 54 | |
55 | 55 | // Template Redirects. |
56 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
57 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
56 | + add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1); |
|
57 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
58 | 58 | |
59 | 59 | // Plan Archive Actions. |
60 | - add_action( 'pre_get_posts', array( $this, 'set_parent_only' ), 10, 1 ); |
|
61 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
62 | - add_action( 'lsx_content_top', 'lsx_hp_plan_archive_filters', 10, 1 ); |
|
63 | - add_filter( 'lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_search_enabled', 10, 1 ); |
|
64 | - add_filter( 'lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_filters_disabled', 10, 1 ); |
|
60 | + add_action('pre_get_posts', array($this, 'set_parent_only'), 10, 1); |
|
61 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100); |
|
62 | + add_action('lsx_content_top', 'lsx_hp_plan_archive_filters', 10, 1); |
|
63 | + add_filter('lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_search_enabled', 10, 1); |
|
64 | + add_filter('lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_filters_disabled', 10, 1); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public static function get_instance() { |
75 | 75 | // If the single instance hasn't been set, set it now. |
76 | - if ( null === self::$instance ) { |
|
76 | + if (null === self::$instance) { |
|
77 | 77 | self::$instance = new self(); |
78 | 78 | } |
79 | 79 | return self::$instance; |
@@ -83,21 +83,21 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function register_post_type() { |
85 | 85 | $labels = array( |
86 | - 'name' => esc_html__( 'Plans', 'lsx-health-plan' ), |
|
87 | - 'singular_name' => esc_html__( 'Plan', 'lsx-health-plan' ), |
|
88 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
89 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
90 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
91 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
92 | - 'all_items' => esc_html__( 'All Plans', 'lsx-health-plan' ), |
|
93 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
94 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
95 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
96 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
86 | + 'name' => esc_html__('Plans', 'lsx-health-plan'), |
|
87 | + 'singular_name' => esc_html__('Plan', 'lsx-health-plan'), |
|
88 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
89 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
90 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
91 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
92 | + 'all_items' => esc_html__('All Plans', 'lsx-health-plan'), |
|
93 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
94 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
95 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
96 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
97 | 97 | 'parent_item_colon' => '', |
98 | - 'menu_name' => esc_html__( 'Plans', 'lsx-health-plan' ), |
|
98 | + 'menu_name' => esc_html__('Plans', 'lsx-health-plan'), |
|
99 | 99 | ); |
100 | - $args = array( |
|
100 | + $args = array( |
|
101 | 101 | 'labels' => $labels, |
102 | 102 | 'public' => true, |
103 | 103 | 'publicly_queryable' => true, |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | 'menu_icon' => 'dashicons-welcome-write-blog', |
108 | 108 | 'query_var' => true, |
109 | 109 | 'rewrite' => array( |
110 | - 'slug' => \lsx_health_plan\functions\get_option( 'plan_single_slug', 'plan' ), |
|
110 | + 'slug' => \lsx_health_plan\functions\get_option('plan_single_slug', 'plan'), |
|
111 | 111 | ), |
112 | 112 | 'capability_type' => 'page', |
113 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plans' ), |
|
113 | + 'has_archive' => \lsx_health_plan\functions\get_option('endpoint_plan_archive', 'plans'), |
|
114 | 114 | 'hierarchical' => false, |
115 | 115 | 'menu_position' => null, |
116 | 116 | 'supports' => array( |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'custom-fields', |
122 | 122 | ), |
123 | 123 | ); |
124 | - register_post_type( 'plan', $args ); |
|
124 | + register_post_type('plan', $args); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -129,17 +129,17 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function plan_type_taxonomy_setup() { |
131 | 131 | $labels = array( |
132 | - 'name' => esc_html_x( 'Plan Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
133 | - 'singular_name' => esc_html_x( 'Plan Type', 'taxonomy singular name', 'lsx-health-plan' ), |
|
134 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
135 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
136 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
137 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
138 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
139 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
140 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
141 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
142 | - 'menu_name' => esc_html__( 'Plan Types', 'lsx-health-plan' ), |
|
132 | + 'name' => esc_html_x('Plan Type', 'taxonomy general name', 'lsx-health-plan'), |
|
133 | + 'singular_name' => esc_html_x('Plan Type', 'taxonomy singular name', 'lsx-health-plan'), |
|
134 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
135 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
136 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
137 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
138 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
139 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
140 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
141 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
142 | + 'menu_name' => esc_html__('Plan Types', 'lsx-health-plan'), |
|
143 | 143 | ); |
144 | 144 | |
145 | 145 | $args = array( |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | ), |
154 | 154 | ); |
155 | 155 | |
156 | - register_taxonomy( 'plan-type', array( 'plan' ), $args ); |
|
156 | + register_taxonomy('plan-type', array('plan'), $args); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function week_taxonomy_setup() { |
163 | 163 | $labels = array( |
164 | - 'name' => esc_html_x( 'Week', 'taxonomy general name', 'lsx-health-plan' ), |
|
165 | - 'singular_name' => esc_html_x( 'Week', 'taxonomy singular name', 'lsx-health-plan' ), |
|
166 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
167 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
168 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
169 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
170 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
171 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
172 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
173 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
174 | - 'menu_name' => esc_html__( 'Weeks', 'lsx-health-plan' ), |
|
164 | + 'name' => esc_html_x('Week', 'taxonomy general name', 'lsx-health-plan'), |
|
165 | + 'singular_name' => esc_html_x('Week', 'taxonomy singular name', 'lsx-health-plan'), |
|
166 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
167 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
168 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
169 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
170 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
171 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
172 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
173 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
174 | + 'menu_name' => esc_html__('Weeks', 'lsx-health-plan'), |
|
175 | 175 | ); |
176 | 176 | |
177 | 177 | $args = array( |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | ), |
187 | 187 | ); |
188 | 188 | |
189 | - register_taxonomy( 'week', array( 'plan' ), $args ); |
|
189 | + register_taxonomy('week', array('plan'), $args); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @since 0.1.0 |
196 | 196 | */ |
197 | - public function add_thumbnail_form_field( $term = false ) { |
|
198 | - if ( is_object( $term ) ) { |
|
199 | - $value = get_term_meta( $term->term_id, 'thumbnail', true ); |
|
200 | - $image_preview = wp_get_attachment_image_src( $value, 'thumbnail' ); |
|
197 | + public function add_thumbnail_form_field($term = false) { |
|
198 | + if (is_object($term)) { |
|
199 | + $value = get_term_meta($term->term_id, 'thumbnail', true); |
|
200 | + $image_preview = wp_get_attachment_image_src($value, 'thumbnail'); |
|
201 | 201 | |
202 | - if ( is_array( $image_preview ) ) { |
|
203 | - $image_preview = '<img style="height: 50px; width: 50px;" src="' . esc_url( $image_preview[0] ) . '" width="' . $image_preview[1] . '" height="' . $image_preview[2] . '" class="alignnone size-thumbnail d wp-image-' . $value . '" />'; |
|
202 | + if (is_array($image_preview)) { |
|
203 | + $image_preview = '<img style="height: 50px; width: 50px;" src="' . esc_url($image_preview[0]) . '" width="' . $image_preview[1] . '" height="' . $image_preview[2] . '" class="alignnone size-thumbnail d wp-image-' . $value . '" />'; |
|
204 | 204 | } |
205 | 205 | } else { |
206 | 206 | $image_preview = false; |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | } |
209 | 209 | ?> |
210 | 210 | <tr class="form-field form-required term-thumbnail-wrap"> |
211 | - <th scope="row"><label for="thumbnail"><?php esc_html_e( 'Icon Image', 'lsx-health-plan' ); ?></label></th> |
|
211 | + <th scope="row"><label for="thumbnail"><?php esc_html_e('Icon Image', 'lsx-health-plan'); ?></label></th> |
|
212 | 212 | <td> |
213 | - <input class="input_image_id" type="hidden" name="thumbnail" value="<?php echo wp_kses_post( $value ); ?>"> |
|
213 | + <input class="input_image_id" type="hidden" name="thumbnail" value="<?php echo wp_kses_post($value); ?>"> |
|
214 | 214 | <div class="thumbnail-preview"> |
215 | - <?php echo wp_kses_post( $image_preview ); ?> |
|
215 | + <?php echo wp_kses_post($image_preview); ?> |
|
216 | 216 | </div> |
217 | - <a style="<?php if ( '' !== $value && false !== $value ) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-add"><?php esc_html_e( 'Choose Image', 'lsx-health-plan' ); ?></a> |
|
218 | - <a style="<?php if ( '' === $value || false === $value ) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-remove"><?php esc_html_e( 'Remove Image', 'lsx-health-plan' ); ?></a> |
|
219 | - <?php wp_nonce_field( 'lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce' ); ?> |
|
217 | + <a style="<?php if ('' !== $value && false !== $value) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-add"><?php esc_html_e('Choose Image', 'lsx-health-plan'); ?></a> |
|
218 | + <a style="<?php if ('' === $value || false === $value) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-remove"><?php esc_html_e('Remove Image', 'lsx-health-plan'); ?></a> |
|
219 | + <?php wp_nonce_field('lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce'); ?> |
|
220 | 220 | </td> |
221 | 221 | </tr> |
222 | 222 | <?php |
@@ -230,27 +230,27 @@ discard block |
||
230 | 230 | * @param int $term_id |
231 | 231 | * @param string $taxonomy |
232 | 232 | */ |
233 | - public function save_meta( $term_id = 0, $taxonomy = '' ) { |
|
234 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
233 | + public function save_meta($term_id = 0, $taxonomy = '') { |
|
234 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
235 | 235 | return; |
236 | 236 | } |
237 | 237 | |
238 | - if ( ! isset( $_POST['thumbnail'] ) ) { |
|
238 | + if ( ! isset($_POST['thumbnail'])) { |
|
239 | 239 | return; |
240 | 240 | } |
241 | 241 | |
242 | - if ( check_admin_referer( 'lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce' ) ) { |
|
243 | - if ( ! isset( $_POST['thumbnail'] ) ) { |
|
242 | + if (check_admin_referer('lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce')) { |
|
243 | + if ( ! isset($_POST['thumbnail'])) { |
|
244 | 244 | return; |
245 | 245 | } |
246 | 246 | |
247 | - $thumbnail_meta = sanitize_text_field( $_POST['thumbnail'] ); |
|
248 | - $thumbnail_meta = ! empty( $thumbnail_meta ) ? $thumbnail_meta : ''; |
|
247 | + $thumbnail_meta = sanitize_text_field($_POST['thumbnail']); |
|
248 | + $thumbnail_meta = ! empty($thumbnail_meta) ? $thumbnail_meta : ''; |
|
249 | 249 | |
250 | - if ( empty( $thumbnail_meta ) ) { |
|
251 | - delete_term_meta( $term_id, 'thumbnail' ); |
|
250 | + if (empty($thumbnail_meta)) { |
|
251 | + delete_term_meta($term_id, 'thumbnail'); |
|
252 | 252 | } else { |
253 | - update_term_meta( $term_id, 'thumbnail', $thumbnail_meta ); |
|
253 | + update_term_meta($term_id, 'thumbnail', $thumbnail_meta); |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
@@ -259,33 +259,33 @@ discard block |
||
259 | 259 | * Define the metabox and field configurations. |
260 | 260 | */ |
261 | 261 | public function details_metaboxes() { |
262 | - $cmb = new_cmb2_box( array( |
|
262 | + $cmb = new_cmb2_box(array( |
|
263 | 263 | 'id' => $this->slug . '_details_metabox', |
264 | - 'title' => __( 'Details', 'lsx-health-plan' ), |
|
265 | - 'object_types' => array( $this->slug ), // Post type |
|
264 | + 'title' => __('Details', 'lsx-health-plan'), |
|
265 | + 'object_types' => array($this->slug), // Post type |
|
266 | 266 | 'context' => 'normal', |
267 | 267 | 'priority' => 'high', |
268 | 268 | 'show_names' => true, |
269 | - ) ); |
|
269 | + )); |
|
270 | 270 | |
271 | 271 | $warmup_type = 'page'; |
272 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
273 | - $warmup_type = array( 'page', 'workout' ); |
|
272 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
273 | + $warmup_type = array('page', 'workout'); |
|
274 | 274 | } |
275 | - $cmb->add_field( array( |
|
276 | - 'name' => __( 'Warmup', 'lsx-health-plan' ), |
|
277 | - 'desc' => __( 'Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan' ), |
|
275 | + $cmb->add_field(array( |
|
276 | + 'name' => __('Warmup', 'lsx-health-plan'), |
|
277 | + 'desc' => __('Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan'), |
|
278 | 278 | 'id' => $this->slug . '_warmup', |
279 | 279 | 'type' => 'post_search_ajax', |
280 | 280 | // Optional : |
281 | - 'limit' => 3, // Limit selection to X items only (default 1) |
|
281 | + 'limit' => 3, // Limit selection to X items only (default 1) |
|
282 | 282 | 'sortable' => true, // Allow selected items to be sortable (default false) |
283 | 283 | 'query_args' => array( |
284 | 284 | 'post_type' => $warmup_type, |
285 | - 'post_status' => array( 'publish' ), |
|
285 | + 'post_status' => array('publish'), |
|
286 | 286 | 'posts_per_page' => -1, |
287 | 287 | ), |
288 | - ) ); |
|
288 | + )); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param array $post_types |
295 | 295 | * @return array |
296 | 296 | */ |
297 | - public function enable_post_type( $post_types = array() ) { |
|
297 | + public function enable_post_type($post_types = array()) { |
|
298 | 298 | $post_types[] = $this->slug; |
299 | 299 | return $post_types; |
300 | 300 | } |
@@ -308,8 +308,8 @@ discard block |
||
308 | 308 | $cmb = new_cmb2_box( |
309 | 309 | array( |
310 | 310 | 'id' => $this->slug . '_connections_metabox', |
311 | - 'title' => __( 'Plans', 'lsx-health-plan' ), |
|
312 | - 'object_types' => array( 'workout', 'meal', 'tip', 'recipe' ), |
|
311 | + 'title' => __('Plans', 'lsx-health-plan'), |
|
312 | + 'object_types' => array('workout', 'meal', 'tip', 'recipe'), |
|
313 | 313 | 'context' => 'normal', |
314 | 314 | 'priority' => 'high', |
315 | 315 | 'show_names' => true, |
@@ -317,15 +317,15 @@ discard block |
||
317 | 317 | ); |
318 | 318 | $cmb->add_field( |
319 | 319 | array( |
320 | - 'name' => __( 'Plan', 'lsx-health-plan' ), |
|
320 | + 'name' => __('Plan', 'lsx-health-plan'), |
|
321 | 321 | 'id' => 'connected_plans', |
322 | - 'desc' => __( 'Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan' ), |
|
322 | + 'desc' => __('Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan'), |
|
323 | 323 | 'type' => 'post_search_ajax', |
324 | 324 | 'limit' => 15, |
325 | 325 | 'sortable' => true, |
326 | 326 | 'query_args' => array( |
327 | - 'post_type' => array( 'plan' ), |
|
328 | - 'post_status' => array( 'publish' ), |
|
327 | + 'post_type' => array('plan'), |
|
328 | + 'post_status' => array('publish'), |
|
329 | 329 | 'posts_per_page' => -1, |
330 | 330 | ), |
331 | 331 | ) |
@@ -338,9 +338,9 @@ discard block |
||
338 | 338 | * @param string $title the term title. |
339 | 339 | * @return string |
340 | 340 | */ |
341 | - public function get_the_archive_title( $title ) { |
|
342 | - if ( is_post_type_archive( 'plan' ) ) { |
|
343 | - $title = __( 'Our health plans', 'lsx-health-plan' ); |
|
341 | + public function get_the_archive_title($title) { |
|
342 | + if (is_post_type_archive('plan')) { |
|
343 | + $title = __('Our health plans', 'lsx-health-plan'); |
|
344 | 344 | } |
345 | 345 | return $title; |
346 | 346 | } |
@@ -351,9 +351,9 @@ discard block |
||
351 | 351 | * @param object $wp_query |
352 | 352 | * @return array |
353 | 353 | */ |
354 | - public function set_parent_only( $wp_query ) { |
|
355 | - if ( ! is_admin() && $wp_query->is_main_query() && ( $wp_query->is_post_type_archive( 'plan' ) || $wp_query->is_tax( 'plan-type' ) ) ) { |
|
356 | - $wp_query->set( 'post_parent', '0' ); |
|
354 | + public function set_parent_only($wp_query) { |
|
355 | + if ( ! is_admin() && $wp_query->is_main_query() && ($wp_query->is_post_type_archive('plan') || $wp_query->is_tax('plan-type'))) { |
|
356 | + $wp_query->set('post_parent', '0'); |
|
357 | 357 | } |
358 | 358 | } |
359 | 359 | |
@@ -364,8 +364,8 @@ discard block |
||
364 | 364 | $cmb = new_cmb2_box( |
365 | 365 | array( |
366 | 366 | 'id' => $this->slug . '_featured_metabox_plan', |
367 | - 'title' => __( 'Featured Plan', 'lsx-health-plan' ), |
|
368 | - 'object_types' => array( $this->slug ), // Post type |
|
367 | + 'title' => __('Featured Plan', 'lsx-health-plan'), |
|
368 | + 'object_types' => array($this->slug), // Post type |
|
369 | 369 | 'context' => 'side', |
370 | 370 | 'priority' => 'high', |
371 | 371 | 'show_names' => true, |
@@ -373,8 +373,8 @@ discard block |
||
373 | 373 | ); |
374 | 374 | $cmb->add_field( |
375 | 375 | array( |
376 | - 'name' => __( 'Featured Plan', 'lsx-health-plan' ), |
|
377 | - 'desc' => __( 'Enable a featured plan' ), |
|
376 | + 'name' => __('Featured Plan', 'lsx-health-plan'), |
|
377 | + 'desc' => __('Enable a featured plan'), |
|
378 | 378 | 'id' => $this->slug . '_featured_plan', |
379 | 379 | 'type' => 'checkbox', |
380 | 380 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | $cmb = new_cmb2_box( |
390 | 390 | array( |
391 | 391 | 'id' => $this->slug . '_sections_metabox', |
392 | - 'title' => __( 'Sections', 'lsx-health-plan' ), |
|
393 | - 'object_types' => array( $this->slug ), // Post type. |
|
392 | + 'title' => __('Sections', 'lsx-health-plan'), |
|
393 | + 'object_types' => array($this->slug), // Post type. |
|
394 | 394 | 'context' => 'normal', |
395 | 395 | 'priority' => 'low', |
396 | 396 | 'show_names' => true, |
@@ -406,9 +406,9 @@ discard block |
||
406 | 406 | 'id' => $this->slug . '_sections', |
407 | 407 | 'type' => 'group', |
408 | 408 | 'options' => array( |
409 | - 'group_title' => __( 'Section', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number |
|
410 | - 'add_button' => __( 'Add section', 'lsx-health-plan' ), |
|
411 | - 'remove_button' => __( 'Remove section', 'lsx-health-plan' ), |
|
409 | + 'group_title' => __('Section', 'lsx-health-plan') . ' {#}', // {#} gets replaced by row number |
|
410 | + 'add_button' => __('Add section', 'lsx-health-plan'), |
|
411 | + 'remove_button' => __('Remove section', 'lsx-health-plan'), |
|
412 | 412 | 'sortable' => true, |
413 | 413 | 'closed' => true, // true to have the groups closed by default |
414 | 414 | ), |
@@ -420,10 +420,10 @@ discard block |
||
420 | 420 | $cmb->add_group_field( |
421 | 421 | $group, |
422 | 422 | array( |
423 | - 'name' => __( 'Title', 'lsx-health-plan' ), |
|
423 | + 'name' => __('Title', 'lsx-health-plan'), |
|
424 | 424 | 'id' => 'title', |
425 | 425 | 'type' => 'text', |
426 | - 'desc' => __( 'e.g Day 1 / Week 1', 'lsx-health-plan' ), |
|
426 | + 'desc' => __('e.g Day 1 / Week 1', 'lsx-health-plan'), |
|
427 | 427 | 'classes' => 'lsx-field-col lsx-field-col-50', |
428 | 428 | ) |
429 | 429 | ); |
@@ -431,10 +431,10 @@ discard block |
||
431 | 431 | $cmb->add_group_field( |
432 | 432 | $group, |
433 | 433 | array( |
434 | - 'name' => __( 'Group', 'lsx-health-plan' ), |
|
434 | + 'name' => __('Group', 'lsx-health-plan'), |
|
435 | 435 | 'id' => 'group', |
436 | 436 | 'type' => 'text', |
437 | - 'desc' => __( 'e.g Week 1 / January', 'lsx-health-plan' ), |
|
437 | + 'desc' => __('e.g Week 1 / January', 'lsx-health-plan'), |
|
438 | 438 | 'classes' => 'lsx-field-col lsx-field-col-50', |
439 | 439 | ) |
440 | 440 | ); |
@@ -442,25 +442,25 @@ discard block |
||
442 | 442 | $cmb->add_group_field( |
443 | 443 | $group, |
444 | 444 | array( |
445 | - 'name' => __( 'Overview', 'lsx-health-plan' ), |
|
445 | + 'name' => __('Overview', 'lsx-health-plan'), |
|
446 | 446 | 'id' => 'description', |
447 | 447 | 'type' => 'wysiwyg', |
448 | 448 | ) |
449 | 449 | ); |
450 | 450 | |
451 | - if ( post_type_exists( 'workout' ) ) { |
|
451 | + if (post_type_exists('workout')) { |
|
452 | 452 | $cmb->add_group_field( |
453 | 453 | $group, |
454 | 454 | array( |
455 | - 'name' => __( 'Workouts', 'lsx-health-plan' ), |
|
455 | + 'name' => __('Workouts', 'lsx-health-plan'), |
|
456 | 456 | 'id' => 'connected_workouts', |
457 | - 'desc' => __( 'Connect the workout(s) that apply to this section.', 'lsx-health-plan' ), |
|
457 | + 'desc' => __('Connect the workout(s) that apply to this section.', 'lsx-health-plan'), |
|
458 | 458 | 'type' => 'post_search_ajax', |
459 | 459 | 'limit' => 15, |
460 | 460 | 'sortable' => true, |
461 | 461 | 'query_args' => array( |
462 | - 'post_type' => array( 'workout' ), |
|
463 | - 'post_status' => array( 'publish' ), |
|
462 | + 'post_type' => array('workout'), |
|
463 | + 'post_status' => array('publish'), |
|
464 | 464 | 'posts_per_page' => -1, |
465 | 465 | ), |
466 | 466 | 'classes' => 'lsx-field-col lsx-field-add-field lsx-field-col-33', |
@@ -468,40 +468,40 @@ discard block |
||
468 | 468 | ); |
469 | 469 | } |
470 | 470 | |
471 | - if ( post_type_exists( 'meal' ) ) { |
|
471 | + if (post_type_exists('meal')) { |
|
472 | 472 | $cmb->add_group_field( |
473 | 473 | $group, |
474 | 474 | array( |
475 | - 'name' => __( 'Meals', 'lsx-health-plan' ), |
|
476 | - 'desc' => __( 'Connect the meal(s) that apply to this section.', 'lsx-health-plan' ), |
|
475 | + 'name' => __('Meals', 'lsx-health-plan'), |
|
476 | + 'desc' => __('Connect the meal(s) that apply to this section.', 'lsx-health-plan'), |
|
477 | 477 | 'id' => 'connected_meals', |
478 | 478 | 'type' => 'post_search_ajax', |
479 | 479 | // Optional : |
480 | 480 | 'limit' => 15, // Limit selection to X items only (default 1) |
481 | 481 | 'sortable' => true, // Allow selected items to be sortable (default false) |
482 | 482 | 'query_args' => array( |
483 | - 'post_type' => array( 'meal' ), |
|
484 | - 'post_status' => array( 'publish' ), |
|
483 | + 'post_type' => array('meal'), |
|
484 | + 'post_status' => array('publish'), |
|
485 | 485 | 'posts_per_page' => -1, |
486 | 486 | ), |
487 | 487 | 'classes' => 'lsx-field-col lsx-field-add-field lsx-field-col-33', |
488 | 488 | ) |
489 | 489 | ); |
490 | 490 | } |
491 | - if ( post_type_exists( 'tip' ) ) { |
|
491 | + if (post_type_exists('tip')) { |
|
492 | 492 | $cmb->add_group_field( |
493 | 493 | $group, |
494 | 494 | array( |
495 | - 'name' => __( 'Tips', 'lsx-health-plan' ), |
|
495 | + 'name' => __('Tips', 'lsx-health-plan'), |
|
496 | 496 | 'id' => 'connected_tips', |
497 | - 'desc' => __( 'Connect the tip(s) that apply to this section.', 'lsx-health-plan' ), |
|
497 | + 'desc' => __('Connect the tip(s) that apply to this section.', 'lsx-health-plan'), |
|
498 | 498 | 'type' => 'post_search_ajax', |
499 | 499 | // Optional : |
500 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
501 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
500 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
501 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
502 | 502 | 'query_args' => array( |
503 | - 'post_type' => array( 'tip' ), |
|
504 | - 'post_status' => array( 'publish' ), |
|
503 | + 'post_type' => array('tip'), |
|
504 | + 'post_status' => array('publish'), |
|
505 | 505 | 'posts_per_page' => -1, |
506 | 506 | ), |
507 | 507 | 'classes' => 'lsx-field-col lsx-field-add-field lsx-field-col-33', |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function __construct() { |
56 | 56 | $this->load_classes(); |
57 | - add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
58 | - add_action( 'lsx_hp_settings_page', array( $this, 'generate_tabs' ), 1, 1 ); |
|
59 | - |
|
60 | - add_action( 'lsx_hp_settings_page_general_top', array( $this, 'general_settings' ), 1, 1 ); |
|
61 | - add_action( 'lsx_hp_settings_page', array( $this, 'global_defaults' ), 3, 1 ); |
|
62 | - add_action( 'lsx_hp_settings_page', array( $this, 'global_downloads' ), 5, 1 ); |
|
63 | - add_action( 'lsx_hp_settings_page', array( $this, 'stat_disable' ), 6, 1 ); |
|
64 | - add_action( 'lsx_hp_settings_page', array( $this, 'endpoint_translations' ), 7, 1 ); |
|
65 | - add_action( 'lsx_hp_settings_page', array( $this, 'exercise_translations' ), 7, 1 ); |
|
66 | - add_action( 'lsx_hp_settings_page', array( $this, 'post_type_toggles' ), 9, 1 ); |
|
57 | + add_action('cmb2_admin_init', array($this, 'register_settings_page')); |
|
58 | + add_action('lsx_hp_settings_page', array($this, 'generate_tabs'), 1, 1); |
|
59 | + |
|
60 | + add_action('lsx_hp_settings_page_general_top', array($this, 'general_settings'), 1, 1); |
|
61 | + add_action('lsx_hp_settings_page', array($this, 'global_defaults'), 3, 1); |
|
62 | + add_action('lsx_hp_settings_page', array($this, 'global_downloads'), 5, 1); |
|
63 | + add_action('lsx_hp_settings_page', array($this, 'stat_disable'), 6, 1); |
|
64 | + add_action('lsx_hp_settings_page', array($this, 'endpoint_translations'), 7, 1); |
|
65 | + add_action('lsx_hp_settings_page', array($this, 'exercise_translations'), 7, 1); |
|
66 | + add_action('lsx_hp_settings_page', array($this, 'post_type_toggles'), 9, 1); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public static function get_instance() { |
77 | 77 | // If the single instance hasn't been set, set it now. |
78 | - if ( null === self::$instance ) { |
|
78 | + if (null === self::$instance) { |
|
79 | 79 | self::$instance = new self(); |
80 | 80 | } |
81 | 81 | return self::$instance; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | //'tip', |
96 | 96 | ); |
97 | 97 | |
98 | - foreach ( $this->post_types as $post_type ) { |
|
98 | + foreach ($this->post_types as $post_type) { |
|
99 | 99 | $this->$post_type = require_once LSX_HEALTH_PLAN_PATH . 'classes/admin/settings/class-' . $post_type . '.php'; |
100 | 100 | } |
101 | 101 | } |
@@ -107,124 +107,124 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function set_vars() { |
109 | 109 | |
110 | - $this->default_types = array( |
|
110 | + $this->default_types = array( |
|
111 | 111 | 'page' => array( |
112 | - 'title' => __( 'Warm Up', 'lsx-health-plan' ), |
|
113 | - 'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ), |
|
112 | + 'title' => __('Warm Up', 'lsx-health-plan'), |
|
113 | + 'description' => __('Set a default warm up routine.', 'lsx-health-plan'), |
|
114 | 114 | 'limit' => 1, |
115 | 115 | 'id' => 'plan_warmup', |
116 | 116 | ), |
117 | 117 | ); |
118 | 118 | $this->download_types = array( |
119 | 119 | 'page' => array( |
120 | - 'title' => __( 'Warm Up', 'lsx-health-plan' ), |
|
121 | - 'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ), |
|
120 | + 'title' => __('Warm Up', 'lsx-health-plan'), |
|
121 | + 'description' => __('Set a default warm up routine.', 'lsx-health-plan'), |
|
122 | 122 | 'limit' => 1, |
123 | 123 | ), |
124 | 124 | ); |
125 | - $this->endpoints = array( |
|
125 | + $this->endpoints = array( |
|
126 | 126 | 'endpoint_warm_up' => array( |
127 | - 'title' => __( 'Warm Up Endpoint', 'lsx-health-plan' ), |
|
127 | + 'title' => __('Warm Up Endpoint', 'lsx-health-plan'), |
|
128 | 128 | 'default' => 'warm-up', |
129 | 129 | ), |
130 | 130 | ); |
131 | 131 | |
132 | - if ( post_type_exists( 'meal' ) ) { |
|
133 | - $this->download_types['meal'] = array( |
|
134 | - 'title' => __( 'Meal Plan', 'lsx-health-plan' ), |
|
135 | - 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
132 | + if (post_type_exists('meal')) { |
|
133 | + $this->download_types['meal'] = array( |
|
134 | + 'title' => __('Meal Plan', 'lsx-health-plan'), |
|
135 | + 'description' => __('Set a default meal plan.', 'lsx-health-plan'), |
|
136 | 136 | ); |
137 | - $this->default_types['meal'] = array( |
|
138 | - 'title' => __( 'Meal Plan', 'lsx-health-plan' ), |
|
139 | - 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
137 | + $this->default_types['meal'] = array( |
|
138 | + 'title' => __('Meal Plan', 'lsx-health-plan'), |
|
139 | + 'description' => __('Set a default meal plan.', 'lsx-health-plan'), |
|
140 | 140 | 'id' => 'connected_meals', |
141 | 141 | ); |
142 | 142 | $this->endpoints['endpoint_meal'] = array( |
143 | - 'title' => __( 'Meal Endpoint', 'lsx-health-plan' ), |
|
143 | + 'title' => __('Meal Endpoint', 'lsx-health-plan'), |
|
144 | 144 | 'default' => 'meal', |
145 | - 'description' => __( 'Define the tab slug which shows on the single plan page.', 'lsx-health-plan' ), |
|
145 | + 'description' => __('Define the tab slug which shows on the single plan page.', 'lsx-health-plan'), |
|
146 | 146 | ); |
147 | 147 | $this->endpoints['endpoint_meal_archive'] = array( |
148 | - 'title' => __( 'Meals Archive Endpoint', 'lsx-health-plan' ), |
|
148 | + 'title' => __('Meals Archive Endpoint', 'lsx-health-plan'), |
|
149 | 149 | 'default' => 'meals', |
150 | 150 | ); |
151 | 151 | $this->endpoints['meal_single_slug'] = array( |
152 | - 'title' => __( 'Single Meal Slug', 'lsx-health-plan' ), |
|
152 | + 'title' => __('Single Meal Slug', 'lsx-health-plan'), |
|
153 | 153 | 'default' => 'meal', |
154 | 154 | ); |
155 | 155 | } |
156 | - if ( post_type_exists( 'recipe' ) ) { |
|
156 | + if (post_type_exists('recipe')) { |
|
157 | 157 | $this->download_types['recipe'] = array( |
158 | - 'title' => __( 'Recipe', 'lsx-health-plan' ), |
|
159 | - 'description' => __( 'Set a default recipe.', 'lsx-health-plan' ), |
|
158 | + 'title' => __('Recipe', 'lsx-health-plan'), |
|
159 | + 'description' => __('Set a default recipe.', 'lsx-health-plan'), |
|
160 | 160 | ); |
161 | 161 | $this->default_types['recipe'] = array( |
162 | - 'title' => __( 'Recipe', 'lsx-health-plan' ), |
|
163 | - 'description' => __( 'Set a default recipe.', 'lsx-health-plan' ), |
|
162 | + 'title' => __('Recipe', 'lsx-health-plan'), |
|
163 | + 'description' => __('Set a default recipe.', 'lsx-health-plan'), |
|
164 | 164 | 'id' => 'connected_recipes', |
165 | 165 | ); |
166 | 166 | $this->endpoints['endpoint_recipe'] = array( |
167 | - 'title' => __( 'Recipes Endpoint', 'lsx-health-plan' ), |
|
167 | + 'title' => __('Recipes Endpoint', 'lsx-health-plan'), |
|
168 | 168 | 'default' => 'recipe', |
169 | 169 | ); |
170 | 170 | } |
171 | - if ( post_type_exists( 'workout' ) ) { |
|
171 | + if (post_type_exists('workout')) { |
|
172 | 172 | $this->download_types['workout'] = array( |
173 | - 'title' => __( 'Workout', 'lsx-health-plan' ), |
|
174 | - 'description' => __( 'Set a default workout routine PDF.', 'lsx-health-plan' ), |
|
173 | + 'title' => __('Workout', 'lsx-health-plan'), |
|
174 | + 'description' => __('Set a default workout routine PDF.', 'lsx-health-plan'), |
|
175 | 175 | ); |
176 | 176 | $this->default_types['workout'] = array( |
177 | - 'title' => __( 'Workout', 'lsx-health-plan' ), |
|
178 | - 'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ), |
|
177 | + 'title' => __('Workout', 'lsx-health-plan'), |
|
178 | + 'description' => __('Set a default workout routine.', 'lsx-health-plan'), |
|
179 | 179 | 'id' => 'connected_workouts', |
180 | 180 | ); |
181 | 181 | $this->endpoints['endpoint_workout_archive'] = array( |
182 | - 'title' => __( 'Workouts Archive Endpoint', 'lsx-health-plan' ), |
|
182 | + 'title' => __('Workouts Archive Endpoint', 'lsx-health-plan'), |
|
183 | 183 | 'default' => '', |
184 | 184 | ); |
185 | 185 | $this->endpoints['endpoint_workout'] = array( |
186 | - 'title' => __( 'Single Workout Endpoint', 'lsx-health-plan' ), |
|
186 | + 'title' => __('Single Workout Endpoint', 'lsx-health-plan'), |
|
187 | 187 | 'default' => 'workout', |
188 | 188 | ); |
189 | 189 | } |
190 | 190 | |
191 | 191 | $this->endpoints['login_slug'] = array( |
192 | - 'title' => __( 'Login Slug', 'lsx-health-plan' ), |
|
192 | + 'title' => __('Login Slug', 'lsx-health-plan'), |
|
193 | 193 | 'default' => 'login', |
194 | 194 | ); |
195 | 195 | $this->endpoints['my_plan_slug'] = array( |
196 | - 'title' => __( 'My Plan Slug', 'lsx-health-plan' ), |
|
196 | + 'title' => __('My Plan Slug', 'lsx-health-plan'), |
|
197 | 197 | 'default' => 'my-plan', |
198 | 198 | ); |
199 | 199 | $this->endpoints['plan_single_slug'] = array( |
200 | - 'title' => __( 'Single Plan Slug', 'lsx-health-plan' ), |
|
200 | + 'title' => __('Single Plan Slug', 'lsx-health-plan'), |
|
201 | 201 | 'default' => 'plan', |
202 | 202 | ); |
203 | 203 | $this->endpoints['endpoint_plan_archive'] = array( |
204 | - 'title' => __( 'Plans Archive Endpoint', 'lsx-health-plan' ), |
|
204 | + 'title' => __('Plans Archive Endpoint', 'lsx-health-plan'), |
|
205 | 205 | 'default' => 'plans', |
206 | 206 | ); |
207 | 207 | |
208 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
208 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
209 | 209 | $this->endpoints['exercise'] = array( |
210 | 210 | 'exercise_single' => array( |
211 | - 'title' => __( 'Single Exercise Slug', 'lsx-health-plan' ), |
|
211 | + 'title' => __('Single Exercise Slug', 'lsx-health-plan'), |
|
212 | 212 | 'default' => 'exercise', |
213 | 213 | ), |
214 | 214 | 'exercise_archive' => array( |
215 | - 'title' => __( 'Archive Exercise Slug', 'lsx-health-plan' ), |
|
215 | + 'title' => __('Archive Exercise Slug', 'lsx-health-plan'), |
|
216 | 216 | 'default' => 'exercises', |
217 | 217 | ), |
218 | 218 | 'exercise_type' => array( |
219 | - 'title' => __( 'Exercise Type Slug', 'lsx-health-plan' ), |
|
219 | + 'title' => __('Exercise Type Slug', 'lsx-health-plan'), |
|
220 | 220 | 'default' => 'exercise-type', |
221 | 221 | ), |
222 | 222 | 'exercise_equipment' => array( |
223 | - 'title' => __( 'Equipment Slug', 'lsx-health-plan' ), |
|
223 | + 'title' => __('Equipment Slug', 'lsx-health-plan'), |
|
224 | 224 | 'default' => 'equipment', |
225 | 225 | ), |
226 | 226 | 'exercise_musclegroup' => array( |
227 | - 'title' => __( 'Muscle Group Slug', 'lsx-health-plan' ), |
|
227 | + 'title' => __('Muscle Group Slug', 'lsx-health-plan'), |
|
228 | 228 | 'default' => 'muscle-group', |
229 | 229 | ), |
230 | 230 | ); |
@@ -239,14 +239,14 @@ discard block |
||
239 | 239 | $cmb = new_cmb2_box( |
240 | 240 | array( |
241 | 241 | 'id' => $this->screen_id, |
242 | - 'title' => esc_html__( 'Settings', 'lsx-health-plan' ), |
|
243 | - 'object_types' => array( 'options-page' ), |
|
242 | + 'title' => esc_html__('Settings', 'lsx-health-plan'), |
|
243 | + 'object_types' => array('options-page'), |
|
244 | 244 | 'option_key' => 'lsx_health_plan_options', // The option key and admin menu page slug. |
245 | 245 | 'parent_slug' => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu. |
246 | 246 | 'capability' => 'manage_options', // Cap required to view options-page. |
247 | 247 | ) |
248 | 248 | ); |
249 | - do_action( 'lsx_hp_settings_page', $cmb ); |
|
249 | + do_action('lsx_hp_settings_page', $cmb); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -255,17 +255,17 @@ discard block |
||
255 | 255 | * @param object $cmb new_cmb2_box(). |
256 | 256 | * @return void |
257 | 257 | */ |
258 | - public function general_settings( $cmb ) { |
|
258 | + public function general_settings($cmb) { |
|
259 | 259 | $cmb->add_field( |
260 | 260 | array( |
261 | - 'name' => __( 'Membership Product', 'lsx-health-plan' ), |
|
261 | + 'name' => __('Membership Product', 'lsx-health-plan'), |
|
262 | 262 | 'id' => 'membership_product', |
263 | 263 | 'type' => 'post_search_ajax', |
264 | 264 | 'limit' => 1, |
265 | 265 | 'sortable' => false, |
266 | 266 | 'query_args' => array( |
267 | - 'post_type' => array( 'product' ), |
|
268 | - 'post_status' => array( 'publish' ), |
|
267 | + 'post_type' => array('product'), |
|
268 | + 'post_status' => array('publish'), |
|
269 | 269 | 'posts_per_page' => -1, |
270 | 270 | ), |
271 | 271 | ) |
@@ -273,43 +273,43 @@ discard block |
||
273 | 273 | |
274 | 274 | $cmb->add_field( |
275 | 275 | array( |
276 | - 'name' => __( 'Your Warm-up Intro', 'lsx-health-plan' ), |
|
276 | + 'name' => __('Your Warm-up Intro', 'lsx-health-plan'), |
|
277 | 277 | 'id' => 'warmup_intro', |
278 | 278 | 'type' => 'textarea_small', |
279 | 279 | 'value' => '', |
280 | - 'default' => __( "Don't forget your warm-up! It's a vital part of your daily workout routine.", 'lsx-health-plan' ), |
|
280 | + 'default' => __("Don't forget your warm-up! It's a vital part of your daily workout routine.", 'lsx-health-plan'), |
|
281 | 281 | ) |
282 | 282 | ); |
283 | - if ( post_type_exists( 'workout' ) ) { |
|
283 | + if (post_type_exists('workout')) { |
|
284 | 284 | $cmb->add_field( |
285 | 285 | array( |
286 | - 'name' => __( 'Your Workout Intro', 'lsx-health-plan' ), |
|
286 | + 'name' => __('Your Workout Intro', 'lsx-health-plan'), |
|
287 | 287 | 'id' => 'workout_intro', |
288 | 288 | 'type' => 'textarea_small', |
289 | 289 | 'value' => '', |
290 | - 'default' => __( "Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan' ), |
|
290 | + 'default' => __("Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan'), |
|
291 | 291 | ) |
292 | 292 | ); |
293 | 293 | } |
294 | - if ( post_type_exists( 'meal' ) ) { |
|
294 | + if (post_type_exists('meal')) { |
|
295 | 295 | $cmb->add_field( |
296 | 296 | array( |
297 | - 'name' => __( 'Your Meal Plan Intro', 'lsx-health-plan' ), |
|
297 | + 'name' => __('Your Meal Plan Intro', 'lsx-health-plan'), |
|
298 | 298 | 'id' => 'meal_plan_intro', |
299 | 299 | 'type' => 'textarea_small', |
300 | 300 | 'value' => '', |
301 | - 'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ), |
|
301 | + 'default' => __('Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan'), |
|
302 | 302 | ) |
303 | 303 | ); |
304 | 304 | } |
305 | - if ( post_type_exists( 'recipe' ) ) { |
|
305 | + if (post_type_exists('recipe')) { |
|
306 | 306 | $cmb->add_field( |
307 | 307 | array( |
308 | - 'name' => __( 'Recipes Intro', 'lsx-health-plan' ), |
|
308 | + 'name' => __('Recipes Intro', 'lsx-health-plan'), |
|
309 | 309 | 'id' => 'recipes_intro', |
310 | 310 | 'type' => 'textarea_small', |
311 | 311 | 'value' => '', |
312 | - 'default' => __( "Let's get cooking! Delicious and easy to follow recipes.", 'lsx-health-plan' ), |
|
312 | + 'default' => __("Let's get cooking! Delicious and easy to follow recipes.", 'lsx-health-plan'), |
|
313 | 313 | ) |
314 | 314 | ); |
315 | 315 | } |
@@ -321,27 +321,27 @@ discard block |
||
321 | 321 | * @param object $cmb new_cmb2_box(). |
322 | 322 | * @return void |
323 | 323 | */ |
324 | - public function global_defaults( $cmb ) { |
|
324 | + public function global_defaults($cmb) { |
|
325 | 325 | $cmb->add_field( |
326 | 326 | array( |
327 | 327 | 'id' => 'global_defaults_title', |
328 | 328 | 'type' => 'title', |
329 | - 'name' => __( 'Global Defaults', 'lsx-health-plan' ), |
|
330 | - 'default' => __( 'Global Defaults', 'lsx-health-plan' ), |
|
331 | - 'description' => __( 'If you have not connected a specific post to your day plan, set a default option below.', 'lsx-health-plan' ), |
|
329 | + 'name' => __('Global Defaults', 'lsx-health-plan'), |
|
330 | + 'default' => __('Global Defaults', 'lsx-health-plan'), |
|
331 | + 'description' => __('If you have not connected a specific post to your day plan, set a default option below.', 'lsx-health-plan'), |
|
332 | 332 | ) |
333 | 333 | ); |
334 | 334 | |
335 | - foreach ( $this->default_types as $type => $default_type ) { |
|
335 | + foreach ($this->default_types as $type => $default_type) { |
|
336 | 336 | $limit = 5; |
337 | 337 | $sortable = false; |
338 | - if ( isset( $default_type['limit'] ) ) { |
|
338 | + if (isset($default_type['limit'])) { |
|
339 | 339 | $limit = $default_type['limit']; |
340 | 340 | $sortable = true; |
341 | 341 | } |
342 | 342 | |
343 | - if ( 'page' === $type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
344 | - $type = array( 'page', 'workout' ); |
|
343 | + if ('page' === $type && false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
344 | + $type = array('page', 'workout'); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | $cmb->add_field( |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | 'sortable' => $sortable, |
355 | 355 | 'query_args' => array( |
356 | 356 | 'post_type' => $type, |
357 | - 'post_status' => array( 'publish' ), |
|
357 | + 'post_status' => array('publish'), |
|
358 | 358 | 'posts_per_page' => -1, |
359 | 359 | ), |
360 | 360 | ) |
@@ -375,20 +375,20 @@ discard block |
||
375 | 375 | * @param object $cmb new_cmb2_box(). |
376 | 376 | * @return void |
377 | 377 | */ |
378 | - public function global_downloads( $cmb ) { |
|
378 | + public function global_downloads($cmb) { |
|
379 | 379 | $cmb->add_field( |
380 | 380 | array( |
381 | 381 | 'id' => 'global_downloads_title', |
382 | 382 | 'type' => 'title', |
383 | - 'name' => __( 'Global Downloads', 'lsx-health-plan' ), |
|
384 | - 'default' => __( 'Global Downloads', 'lsx-health-plan' ), |
|
383 | + 'name' => __('Global Downloads', 'lsx-health-plan'), |
|
384 | + 'default' => __('Global Downloads', 'lsx-health-plan'), |
|
385 | 385 | ) |
386 | 386 | ); |
387 | 387 | |
388 | - foreach ( $this->download_types as $type => $download_type ) { |
|
388 | + foreach ($this->download_types as $type => $download_type) { |
|
389 | 389 | $limit = 5; |
390 | 390 | $sortable = false; |
391 | - if ( isset( $download_type['limit'] ) ) { |
|
391 | + if (isset($download_type['limit'])) { |
|
392 | 392 | $limit = $download_type['limit']; |
393 | 393 | $sortable = true; |
394 | 394 | } |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | 'limit' => $limit, |
402 | 402 | 'sortable' => $sortable, |
403 | 403 | 'query_args' => array( |
404 | - 'post_type' => array( 'dlm_download' ), |
|
405 | - 'post_status' => array( 'publish' ), |
|
404 | + 'post_type' => array('dlm_download'), |
|
405 | + 'post_status' => array('publish'), |
|
406 | 406 | 'posts_per_page' => -1, |
407 | 407 | ), |
408 | 408 | ) |
@@ -422,18 +422,18 @@ discard block |
||
422 | 422 | * @param object $cmb new_cmb2_box(). |
423 | 423 | * @return void |
424 | 424 | */ |
425 | - public function endpoint_translations( $cmb ) { |
|
425 | + public function endpoint_translations($cmb) { |
|
426 | 426 | $cmb->add_field( |
427 | 427 | array( |
428 | 428 | 'id' => 'endpoints_title', |
429 | 429 | 'type' => 'title', |
430 | - 'name' => __( 'Set Endpoint Translations', 'lsx-health-plan' ), |
|
431 | - 'default' => __( 'Set Endpoint Translations', 'lsx-health-plan' ), |
|
432 | - 'description' => __( 'Endpoint is a web address (URL) at which the user can gain access to it. You need to resave your permalinks after changing the endpoint settings.', 'lsx-health-plan' ), |
|
430 | + 'name' => __('Set Endpoint Translations', 'lsx-health-plan'), |
|
431 | + 'default' => __('Set Endpoint Translations', 'lsx-health-plan'), |
|
432 | + 'description' => __('Endpoint is a web address (URL) at which the user can gain access to it. You need to resave your permalinks after changing the endpoint settings.', 'lsx-health-plan'), |
|
433 | 433 | ) |
434 | 434 | ); |
435 | - foreach ( $this->endpoints as $slug => $endpoint_vars ) { |
|
436 | - if ( 'exercise' === $slug ) { |
|
435 | + foreach ($this->endpoints as $slug => $endpoint_vars) { |
|
436 | + if ('exercise' === $slug) { |
|
437 | 437 | continue; |
438 | 438 | } |
439 | 439 | |
@@ -461,19 +461,19 @@ discard block |
||
461 | 461 | * @param object $cmb new_cmb2_box(). |
462 | 462 | * @return void |
463 | 463 | */ |
464 | - public function exercise_translations( $cmb ) { |
|
465 | - if ( isset( $this->endpoints['exercise'] ) && '' !== $this->endpoints['exercise'] && ! empty( $this->endpoints['exercise'] ) ) { |
|
464 | + public function exercise_translations($cmb) { |
|
465 | + if (isset($this->endpoints['exercise']) && '' !== $this->endpoints['exercise'] && ! empty($this->endpoints['exercise'])) { |
|
466 | 466 | $cmb->add_field( |
467 | 467 | array( |
468 | 468 | 'id' => 'exercise_endpoints_title', |
469 | 469 | 'type' => 'title', |
470 | - 'name' => __( 'Set Exercise Translations', 'lsx-health-plan' ), |
|
471 | - 'default' => __( 'Set Exercise Translations', 'lsx-health-plan' ), |
|
472 | - 'description' => __( 'You need to resave your permalinks after changing the endpoint settings.', 'lsx-health-plan' ), |
|
470 | + 'name' => __('Set Exercise Translations', 'lsx-health-plan'), |
|
471 | + 'default' => __('Set Exercise Translations', 'lsx-health-plan'), |
|
472 | + 'description' => __('You need to resave your permalinks after changing the endpoint settings.', 'lsx-health-plan'), |
|
473 | 473 | ) |
474 | 474 | ); |
475 | 475 | |
476 | - foreach ( $this->endpoints['exercise'] as $slug => $endpoint_vars ) { |
|
476 | + foreach ($this->endpoints['exercise'] as $slug => $endpoint_vars) { |
|
477 | 477 | $cmb->add_field( |
478 | 478 | array( |
479 | 479 | 'name' => $endpoint_vars['title'], |
@@ -499,27 +499,27 @@ discard block |
||
499 | 499 | * @param object $cmb new_cmb2_box(). |
500 | 500 | * @return void |
501 | 501 | */ |
502 | - public function post_type_toggles( $cmb ) { |
|
503 | - $post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) ); |
|
502 | + public function post_type_toggles($cmb) { |
|
503 | + $post_types = apply_filters('lsx_health_plan_post_types', isset($this->post_types)); |
|
504 | 504 | |
505 | 505 | $cmb->add_field( |
506 | 506 | array( |
507 | 507 | 'id' => 'post_type_toggles_title', |
508 | 508 | 'type' => 'title', |
509 | - 'name' => __( 'Disable Post Types', 'lsx-health-plan' ), |
|
510 | - 'default' => __( 'Disable Post Types', 'lsx-health-plan' ), |
|
511 | - 'description' => __( 'Disable post types if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
509 | + 'name' => __('Disable Post Types', 'lsx-health-plan'), |
|
510 | + 'default' => __('Disable Post Types', 'lsx-health-plan'), |
|
511 | + 'description' => __('Disable post types if you are wanting a minimal site.', 'lsx-health-plan'), |
|
512 | 512 | ) |
513 | 513 | ); |
514 | 514 | |
515 | - foreach ( $post_types as $post_type ) { |
|
516 | - if ( 'plan' === $post_type || 'exercise' === $post_type || ( 'video' === $post_type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) ) { |
|
515 | + foreach ($post_types as $post_type) { |
|
516 | + if ('plan' === $post_type || 'exercise' === $post_type || ('video' === $post_type && false !== \lsx_health_plan\functions\get_option('exercise_enabled', false))) { |
|
517 | 517 | continue; |
518 | 518 | } |
519 | 519 | |
520 | 520 | $cmb->add_field( |
521 | 521 | array( |
522 | - 'name' => ucwords( $post_type ), |
|
522 | + 'name' => ucwords($post_type), |
|
523 | 523 | 'id' => $post_type . '_disabled', |
524 | 524 | 'type' => 'checkbox', |
525 | 525 | 'value' => 1, |
@@ -539,19 +539,19 @@ discard block |
||
539 | 539 | array( |
540 | 540 | 'id' => 'post_type_toggles_enable_title', |
541 | 541 | 'type' => 'title', |
542 | - 'name' => __( 'Enable Post Types', 'lsx-health-plan' ), |
|
543 | - 'default' => __( 'Enable Post Types', 'lsx-health-plan' ), |
|
544 | - 'description' => __( 'Enable new functionailty like the "exercise" post type.', 'lsx-health-plan' ), |
|
542 | + 'name' => __('Enable Post Types', 'lsx-health-plan'), |
|
543 | + 'default' => __('Enable Post Types', 'lsx-health-plan'), |
|
544 | + 'description' => __('Enable new functionailty like the "exercise" post type.', 'lsx-health-plan'), |
|
545 | 545 | ) |
546 | 546 | ); |
547 | 547 | $cmb->add_field( |
548 | 548 | array( |
549 | - 'name' => __( 'Exercises', 'lsx-health-plan' ), |
|
549 | + 'name' => __('Exercises', 'lsx-health-plan'), |
|
550 | 550 | 'id' => 'exercise_enabled', |
551 | 551 | 'type' => 'checkbox', |
552 | 552 | 'value' => 1, |
553 | 553 | 'default' => 0, |
554 | - 'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ), |
|
554 | + 'description' => __('Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan'), |
|
555 | 555 | ) |
556 | 556 | ); |
557 | 557 | $cmb->add_field( |
@@ -568,18 +568,18 @@ discard block |
||
568 | 568 | * @return void |
569 | 569 | */ |
570 | 570 | |
571 | - public function stat_disable( $cmb ) { |
|
571 | + public function stat_disable($cmb) { |
|
572 | 572 | $cmb->add_field( |
573 | 573 | array( |
574 | 574 | 'id' => 'stat_disable_title', |
575 | 575 | 'type' => 'title', |
576 | - 'name' => __( 'Disable Profile Stats', 'lsx-health-plan' ), |
|
577 | - 'default' => __( 'Disable Profile Stats', 'lsx-health-plan' ), |
|
576 | + 'name' => __('Disable Profile Stats', 'lsx-health-plan'), |
|
577 | + 'default' => __('Disable Profile Stats', 'lsx-health-plan'), |
|
578 | 578 | ) |
579 | 579 | ); |
580 | 580 | $cmb->add_field( |
581 | 581 | array( |
582 | - 'name' => __( 'Disable All Stats', 'lsx-health-plan' ), |
|
582 | + 'name' => __('Disable All Stats', 'lsx-health-plan'), |
|
583 | 583 | 'desc' => 'Disable All Stats', |
584 | 584 | 'id' => 'disable_all_stats', |
585 | 585 | 'type' => 'checkbox', |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | ); |
590 | 590 | $cmb->add_field( |
591 | 591 | array( |
592 | - 'name' => __( 'Disable Weight', 'lsx-health-plan' ), |
|
592 | + 'name' => __('Disable Weight', 'lsx-health-plan'), |
|
593 | 593 | 'id' => 'disable_weight_checkbox', |
594 | 594 | 'type' => 'checkbox', |
595 | 595 | 'value' => 1, |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | ); |
599 | 599 | $cmb->add_field( |
600 | 600 | array( |
601 | - 'name' => __( 'Disable Waist', 'lsx-health-plan' ), |
|
601 | + 'name' => __('Disable Waist', 'lsx-health-plan'), |
|
602 | 602 | 'id' => 'disable_waist_checkbox', |
603 | 603 | 'type' => 'checkbox', |
604 | 604 | 'value' => 1, |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | ); |
608 | 608 | $cmb->add_field( |
609 | 609 | array( |
610 | - 'name' => __( 'Disable Fitness', 'lsx-health-plan' ), |
|
610 | + 'name' => __('Disable Fitness', 'lsx-health-plan'), |
|
611 | 611 | 'id' => 'disable_fitness_checkbox', |
612 | 612 | 'type' => 'checkbox', |
613 | 613 | 'value' => 1, |
@@ -629,10 +629,10 @@ discard block |
||
629 | 629 | * @param string $section either engine,archive or single. |
630 | 630 | * @return void |
631 | 631 | */ |
632 | - public function generate_tabs( $cmb ) { |
|
632 | + public function generate_tabs($cmb) { |
|
633 | 633 | $tabs = $this->get_settings_tabs(); |
634 | 634 | |
635 | - foreach ( $tabs as $tab_key => $tab ) { |
|
635 | + foreach ($tabs as $tab_key => $tab) { |
|
636 | 636 | $cmb->add_field( |
637 | 637 | array( |
638 | 638 | 'id' => 'settings_' . $tab_key . '_title', |
@@ -642,11 +642,11 @@ discard block |
||
642 | 642 | 'description' => $tab['desc'], |
643 | 643 | ) |
644 | 644 | ); |
645 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb ); |
|
645 | + do_action('lsx_hp_settings_page_' . $tab_key . '_top', $cmb); |
|
646 | 646 | |
647 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb ); |
|
647 | + do_action('lsx_hp_settings_page_' . $tab_key . '_middle', $cmb); |
|
648 | 648 | |
649 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb ); |
|
649 | + do_action('lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb); |
|
650 | 650 | |
651 | 651 | $cmb->add_field( |
652 | 652 | array( |
@@ -666,26 +666,26 @@ discard block |
||
666 | 666 | public function get_settings_tabs() { |
667 | 667 | $tabs = array( |
668 | 668 | 'general' => array( |
669 | - 'title' => __( 'General', 'lsx-health-plan' ), |
|
670 | - 'desc' => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ), |
|
669 | + 'title' => __('General', 'lsx-health-plan'), |
|
670 | + 'desc' => __('Control the sitewide settings for the LSX HP site.', 'lsx-health-plan'), |
|
671 | 671 | ), |
672 | 672 | ); |
673 | 673 | |
674 | - foreach ( $this->post_types as $post_type ) { |
|
675 | - switch ( $post_type ) { |
|
674 | + foreach ($this->post_types as $post_type) { |
|
675 | + switch ($post_type) { |
|
676 | 676 | default: |
677 | - if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) { |
|
678 | - $temp_post_type = get_post_type_object( $post_type ); |
|
679 | - if ( ! is_wp_error( $temp_post_type ) ) { |
|
680 | - $page_url = get_post_type_archive_link( $temp_post_type->name ); |
|
677 | + if ( ! in_array($post_type, \lsx\search\includes\get_restricted_post_types())) { |
|
678 | + $temp_post_type = get_post_type_object($post_type); |
|
679 | + if ( ! is_wp_error($temp_post_type)) { |
|
680 | + $page_url = get_post_type_archive_link($temp_post_type->name); |
|
681 | 681 | $description = sprintf( |
682 | 682 | /* translators: %s: The subscription info */ |
683 | - __( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ), |
|
683 | + __('Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search'), |
|
684 | 684 | $page_url, |
685 | 685 | $temp_post_type->label |
686 | 686 | ); |
687 | 687 | |
688 | - $tabs[ $post_type ] = array( |
|
688 | + $tabs[$post_type] = array( |
|
689 | 689 | 'title' => $temp_post_type->label, |
690 | 690 | 'desc' => $description, |
691 | 691 | ); |
@@ -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 | } |
@@ -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 | } |