@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
15 | 15 | ?> |
16 | 16 | |
17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
18 | 18 | |
19 | 19 | <?php lsx_content_before(); ?> |
20 | 20 | |
21 | 21 | <!-- Begining restricted content --> |
22 | 22 | <?php |
23 | - if ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
23 | + if (current_user_can('administrator', $page_id) || current_user_can('wc_memberships_view_restricted_post_content', $page_id)) { |
|
24 | 24 | ?> |
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <div class="post-wrapper workout-archive-plan archive-plan"> |
30 | 30 | <div class="row"> |
31 | - <?php if ( have_posts() ) : ?> |
|
31 | + <?php if (have_posts()) : ?> |
|
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
33 | + while (have_posts()) : |
|
34 | 34 | the_post(); |
35 | 35 | ?> |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | <?php else : ?> |
42 | 42 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php |
54 | 54 | } else { |
55 | - wp_redirect( $redirect ); |
|
55 | + wp_redirect($redirect); |
|
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | ?> |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
15 | 15 | ?> |
16 | 16 | |
17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
18 | 18 | |
19 | 19 | <?php lsx_content_before(); ?> |
20 | 20 | |
21 | 21 | <!-- Begining restricted content --> |
22 | 22 | <?php |
23 | - if ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
23 | + if (current_user_can('administrator', $page_id) || current_user_can('wc_memberships_view_restricted_post_content', $page_id)) { |
|
24 | 24 | ?> |
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <div class="post-wrapper archive-plan"> |
30 | 30 | <div class="row"> |
31 | - <?php if ( have_posts() ) : ?> |
|
31 | + <?php if (have_posts()) : ?> |
|
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
33 | + while (have_posts()) : |
|
34 | 34 | the_post(); |
35 | 35 | ?> |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | <?php else : ?> |
42 | 42 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php |
54 | 54 | } else { |
55 | - wp_redirect( $redirect ); |
|
55 | + wp_redirect($redirect); |
|
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | ?> |
@@ -31,25 +31,25 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function __construct() { |
33 | 33 | |
34 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
34 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
35 | 35 | // Post Type and Taxonomies. |
36 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
37 | - add_action( 'init', array( $this, 'exercise_type_taxonomy_setup' ) ); |
|
38 | - add_action( 'init', array( $this, 'equipment_taxonomy_setup' ) ); |
|
39 | - add_action( 'init', array( $this, 'muscle_group_taxonomy_setup' ) ); |
|
40 | - add_action( 'admin_menu', array( $this, 'register_menus' ) ); |
|
36 | + add_action('init', array($this, 'register_post_type')); |
|
37 | + add_action('init', array($this, 'exercise_type_taxonomy_setup')); |
|
38 | + add_action('init', array($this, 'equipment_taxonomy_setup')); |
|
39 | + add_action('init', array($this, 'muscle_group_taxonomy_setup')); |
|
40 | + add_action('admin_menu', array($this, 'register_menus')); |
|
41 | 41 | |
42 | 42 | // Custom Fields. |
43 | - add_action( 'cmb2_admin_init', array( $this, 'exercise_details' ), 8 ); |
|
44 | - add_action( 'cmb2_admin_init', array( $this, 'gallery_metabox' ), 9 ); |
|
45 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
43 | + add_action('cmb2_admin_init', array($this, 'exercise_details'), 8); |
|
44 | + add_action('cmb2_admin_init', array($this, 'gallery_metabox'), 9); |
|
45 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
46 | 46 | |
47 | 47 | // Template Redirects. |
48 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
49 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
48 | + add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1); |
|
49 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
50 | 50 | |
51 | 51 | //Breadcrumbs |
52 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'exercise_breadcrumb_filter' ), 30, 1 ); |
|
52 | + add_filter('woocommerce_get_breadcrumb', array($this, 'exercise_breadcrumb_filter'), 30, 1); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public static function get_instance() { |
67 | 67 | // If the single instance hasn't been set, set it now. |
68 | - if ( null === self::$instance ) { |
|
68 | + if (null === self::$instance) { |
|
69 | 69 | self::$instance = new self(); |
70 | 70 | } |
71 | 71 | return self::$instance; |
@@ -75,21 +75,21 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function register_post_type() { |
77 | 77 | $labels = array( |
78 | - 'name' => esc_html__( 'Exercises', 'lsx-health-plan' ), |
|
79 | - 'singular_name' => esc_html__( 'Exercise', 'lsx-health-plan' ), |
|
80 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
81 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
82 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
83 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
84 | - 'all_items' => esc_html__( 'All Exercises', 'lsx-health-plan' ), |
|
85 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
86 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
87 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
88 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
78 | + 'name' => esc_html__('Exercises', 'lsx-health-plan'), |
|
79 | + 'singular_name' => esc_html__('Exercise', 'lsx-health-plan'), |
|
80 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
81 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
82 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
83 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
84 | + 'all_items' => esc_html__('All Exercises', 'lsx-health-plan'), |
|
85 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
86 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
87 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
88 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
89 | 89 | 'parent_item_colon' => '', |
90 | - 'menu_name' => esc_html__( 'Exercises', 'lsx-health-plan' ), |
|
90 | + 'menu_name' => esc_html__('Exercises', 'lsx-health-plan'), |
|
91 | 91 | ); |
92 | - $args = array( |
|
92 | + $args = array( |
|
93 | 93 | 'labels' => $labels, |
94 | 94 | 'public' => true, |
95 | 95 | 'publicly_queryable' => true, |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | 'menu_icon' => 'dashicons-universal-access', |
100 | 100 | 'query_var' => true, |
101 | 101 | 'rewrite' => array( |
102 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
102 | + 'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'), |
|
103 | 103 | ), |
104 | 104 | 'capability_type' => 'page', |
105 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercises' ), |
|
105 | + 'has_archive' => \lsx_health_plan\functions\get_option('endpoint_exercise_archive', 'exercises'), |
|
106 | 106 | 'hierarchical' => false, |
107 | 107 | 'menu_position' => null, |
108 | 108 | 'supports' => array( |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | 'custom-fields', |
114 | 114 | ), |
115 | 115 | ); |
116 | - register_post_type( 'exercise', $args ); |
|
116 | + register_post_type('exercise', $args); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function exercise_type_taxonomy_setup() { |
125 | 125 | $labels = array( |
126 | - 'name' => esc_html_x( 'Exercise Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
127 | - 'singular_name' => esc_html_x( 'Exercise Type', 'taxonomy singular name', 'lsx-health-plan' ), |
|
128 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
129 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
130 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
131 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
132 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
133 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
134 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
135 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
136 | - 'menu_name' => esc_html__( 'Exercise Types', 'lsx-health-plan' ), |
|
126 | + 'name' => esc_html_x('Exercise Type', 'taxonomy general name', 'lsx-health-plan'), |
|
127 | + 'singular_name' => esc_html_x('Exercise Type', 'taxonomy singular name', 'lsx-health-plan'), |
|
128 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
129 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
130 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
131 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
132 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
133 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
134 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
135 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
136 | + 'menu_name' => esc_html__('Exercise Types', 'lsx-health-plan'), |
|
137 | 137 | ); |
138 | 138 | |
139 | 139 | $args = array( |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | 'show_admin_column' => true, |
144 | 144 | 'query_var' => true, |
145 | 145 | 'rewrite' => array( |
146 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_type', 'exercise-type' ), |
|
146 | + 'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_type', 'exercise-type'), |
|
147 | 147 | ), |
148 | 148 | 'show_in_rest' => true, |
149 | 149 | ); |
150 | 150 | |
151 | - register_taxonomy( 'exercise-type', array( 'exercise' ), $args ); |
|
151 | + register_taxonomy('exercise-type', array('exercise'), $args); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -158,17 +158,17 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function equipment_taxonomy_setup() { |
160 | 160 | $labels = array( |
161 | - 'name' => esc_html_x( 'Equipment', 'taxonomy general name', 'lsx-health-plan' ), |
|
162 | - 'singular_name' => esc_html_x( 'Equipment', 'taxonomy singular name', 'lsx-health-plan' ), |
|
163 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
164 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
165 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
166 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
167 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
168 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
169 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
170 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
171 | - 'menu_name' => esc_html__( 'Equipment', 'lsx-health-plan' ), |
|
161 | + 'name' => esc_html_x('Equipment', 'taxonomy general name', 'lsx-health-plan'), |
|
162 | + 'singular_name' => esc_html_x('Equipment', 'taxonomy singular name', 'lsx-health-plan'), |
|
163 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
164 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
165 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
166 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
167 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
168 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
169 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
170 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
171 | + 'menu_name' => esc_html__('Equipment', 'lsx-health-plan'), |
|
172 | 172 | ); |
173 | 173 | |
174 | 174 | $args = array( |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | 'show_admin_column' => true, |
179 | 179 | 'query_var' => true, |
180 | 180 | 'rewrite' => array( |
181 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_equipment', 'equipment' ), |
|
181 | + 'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_equipment', 'equipment'), |
|
182 | 182 | ), |
183 | 183 | 'show_in_rest' => true, |
184 | 184 | ); |
185 | 185 | |
186 | - register_taxonomy( 'equipment', array( 'exercise' ), $args ); |
|
186 | + register_taxonomy('equipment', array('exercise'), $args); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -193,17 +193,17 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function muscle_group_taxonomy_setup() { |
195 | 195 | $labels = array( |
196 | - 'name' => esc_html_x( 'Muscle Groups', 'taxonomy general name', 'lsx-health-plan' ), |
|
197 | - 'singular_name' => esc_html_x( 'Muscle Group', 'taxonomy singular name', 'lsx-health-plan' ), |
|
198 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
199 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
200 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
201 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
202 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
203 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
204 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
205 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
206 | - 'menu_name' => esc_html__( 'Muscle Groups', 'lsx-health-plan' ), |
|
196 | + 'name' => esc_html_x('Muscle Groups', 'taxonomy general name', 'lsx-health-plan'), |
|
197 | + 'singular_name' => esc_html_x('Muscle Group', 'taxonomy singular name', 'lsx-health-plan'), |
|
198 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
199 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
200 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
201 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
202 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
203 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
204 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
205 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
206 | + 'menu_name' => esc_html__('Muscle Groups', 'lsx-health-plan'), |
|
207 | 207 | ); |
208 | 208 | |
209 | 209 | $args = array( |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | 'show_admin_column' => true, |
214 | 214 | 'query_var' => true, |
215 | 215 | 'rewrite' => array( |
216 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_muscle_group', 'muscle-group' ), |
|
216 | + 'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_muscle_group', 'muscle-group'), |
|
217 | 217 | ), |
218 | 218 | 'show_in_rest' => true, |
219 | 219 | ); |
220 | 220 | |
221 | - register_taxonomy( 'muscle-group', array( 'exercise' ), $args ); |
|
221 | + register_taxonomy('muscle-group', array('exercise'), $args); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -227,10 +227,10 @@ discard block |
||
227 | 227 | * @return void |
228 | 228 | */ |
229 | 229 | public function register_menus() { |
230 | - add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercises', 'lsx-health-plan' ), esc_html__( 'Exercises', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=exercise' ); |
|
231 | - add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercise Types', 'lsx-health-plan' ), esc_html__( 'Exercise Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=exercise-type&post_type=exercise' ); |
|
232 | - add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Equipment', 'lsx-health-plan' ), esc_html__( 'Equipment', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=equipment&post_type=exercise' ); |
|
233 | - add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Muscle Groups', 'lsx-health-plan' ), esc_html__( 'Muscle Groups', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise' ); |
|
230 | + add_submenu_page('edit.php?post_type=workout', esc_html__('Exercises', 'lsx-health-plan'), esc_html__('Exercises', 'lsx-health-plan'), 'edit_posts', 'edit.php?post_type=exercise'); |
|
231 | + add_submenu_page('edit.php?post_type=workout', esc_html__('Exercise Types', 'lsx-health-plan'), esc_html__('Exercise Types', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=exercise-type&post_type=exercise'); |
|
232 | + add_submenu_page('edit.php?post_type=workout', esc_html__('Equipment', 'lsx-health-plan'), esc_html__('Equipment', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=equipment&post_type=exercise'); |
|
233 | + add_submenu_page('edit.php?post_type=workout', esc_html__('Muscle Groups', 'lsx-health-plan'), esc_html__('Muscle Groups', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @param array $post_types |
240 | 240 | * @return array |
241 | 241 | */ |
242 | - public function enable_post_type( $post_types = array() ) { |
|
242 | + public function enable_post_type($post_types = array()) { |
|
243 | 243 | $post_types[] = $this->slug; |
244 | 244 | return $post_types; |
245 | 245 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * @param array $connections |
251 | 251 | * @return void |
252 | 252 | */ |
253 | - public function enable_connections( $connections = array() ) { |
|
253 | + public function enable_connections($connections = array()) { |
|
254 | 254 | $connections['exercise']['connected_workouts'] = 'connected_exercises'; |
255 | 255 | $connections['workout']['connected_exercises'] = 'connected_workouts'; |
256 | 256 | return $connections; |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | $cmb = new_cmb2_box( |
264 | 264 | array( |
265 | 265 | 'id' => $this->slug . '_gallery_details_metabox', |
266 | - 'title' => __( 'Exercise Gallery', 'lsx-health-plan' ), |
|
267 | - 'object_types' => array( $this->slug ), |
|
266 | + 'title' => __('Exercise Gallery', 'lsx-health-plan'), |
|
267 | + 'object_types' => array($this->slug), |
|
268 | 268 | 'context' => 'normal', |
269 | 269 | 'priority' => 'low', |
270 | 270 | 'show_names' => true, |
@@ -273,12 +273,12 @@ discard block |
||
273 | 273 | |
274 | 274 | $cmb->add_field( |
275 | 275 | array( |
276 | - 'name' => __( 'Layout', 'lsx-health-plan' ), |
|
276 | + 'name' => __('Layout', 'lsx-health-plan'), |
|
277 | 277 | 'id' => $this->slug . '_gallery_layout', |
278 | 278 | 'type' => 'radio', |
279 | 279 | 'options' => array( |
280 | - 'slider' => __( 'Slider', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number |
|
281 | - 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
280 | + 'slider' => __('Slider', 'lsx-health-plan') . ' {#}', // {#} gets replaced by row number |
|
281 | + 'grid' => __('Grid', 'lsx-health-plan'), |
|
282 | 282 | ), |
283 | 283 | 'default' => 'grid', |
284 | 284 | ) |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | $cmb->add_field( |
288 | 288 | array( |
289 | - 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
289 | + 'name' => __('Grid Columns', 'lsx-health-plan'), |
|
290 | 290 | 'id' => $this->slug . '_gallery_columns', |
291 | 291 | 'type' => 'text', |
292 | 292 | 'default' => '1', |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | 'id' => $this->slug . '_gallery', |
300 | 300 | 'type' => 'group', |
301 | 301 | 'options' => array( |
302 | - 'group_title' => __( 'Gallery', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number |
|
303 | - 'add_button' => __( 'Add Item', 'lsx-health-plan' ), |
|
304 | - 'remove_button' => __( 'Remove Item', 'lsx-health-plan' ), |
|
302 | + 'group_title' => __('Gallery', 'lsx-health-plan') . ' {#}', // {#} gets replaced by row number |
|
303 | + 'add_button' => __('Add Item', 'lsx-health-plan'), |
|
304 | + 'remove_button' => __('Remove Item', 'lsx-health-plan'), |
|
305 | 305 | 'sortable' => true, |
306 | 306 | ), |
307 | 307 | 'classes' => 'lsx-admin-row', |
@@ -312,13 +312,13 @@ discard block |
||
312 | 312 | $cmb->add_group_field( |
313 | 313 | $gallery_group, |
314 | 314 | array( |
315 | - 'name' => __( 'Image', 'lsx-health-plan' ), |
|
315 | + 'name' => __('Image', 'lsx-health-plan'), |
|
316 | 316 | 'id' => $this->slug . '_gallery_image', |
317 | 317 | 'type' => 'file', |
318 | 318 | 'text' => array( |
319 | - 'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ), |
|
319 | + 'add_upload_file_text' => __('Add File', 'lsx-health-plan'), |
|
320 | 320 | ), |
321 | - 'desc' => __( 'Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan' ), |
|
321 | + 'desc' => __('Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan'), |
|
322 | 322 | 'query_args' => array( |
323 | 323 | 'type' => array( |
324 | 324 | 'image/gif', |
@@ -334,20 +334,20 @@ discard block |
||
334 | 334 | $cmb->add_group_field( |
335 | 335 | $gallery_group, |
336 | 336 | array( |
337 | - 'name' => __( 'oEmbed', 'lsx-health-plan' ), |
|
337 | + 'name' => __('oEmbed', 'lsx-health-plan'), |
|
338 | 338 | 'id' => $this->slug . '_gallery_embed', |
339 | 339 | 'type' => 'text', |
340 | - 'desc' => __( 'Drop in the embed url for your video from YouTube, Vimeo or DailyMotion, e.g: "https://www.youtube.com/watch?v=9xwazD5SyVg". A full list of supports formats can be found at <a href="https://make.wordpress.org/support/user-manual/content/media/adding-media-to-your-pages-and-posts/embedding-media-from-other-sites/">WordPress</a>', 'lsx-health-plan' ), |
|
340 | + 'desc' => __('Drop in the embed url for your video from YouTube, Vimeo or DailyMotion, e.g: "https://www.youtube.com/watch?v=9xwazD5SyVg". A full list of supports formats can be found at <a href="https://make.wordpress.org/support/user-manual/content/media/adding-media-to-your-pages-and-posts/embedding-media-from-other-sites/">WordPress</a>', 'lsx-health-plan'), |
|
341 | 341 | ) |
342 | 342 | ); |
343 | 343 | |
344 | 344 | $cmb->add_group_field( |
345 | 345 | $gallery_group, |
346 | 346 | array( |
347 | - 'name' => __( 'External Media', 'lsx-health-plan' ), |
|
347 | + 'name' => __('External Media', 'lsx-health-plan'), |
|
348 | 348 | 'id' => $this->slug . '_gallery_external', |
349 | 349 | 'type' => 'textarea_code', |
350 | - 'desc' => __( 'Drop in the iFrame embed code from Giphy in this field, i.e: <iframe src="https://giphy.com/embed/3o7527Rn1HxXWqgxuo" width="480" height="270" frameborder="0" class="giphy-embed" allowfullscreen></iframe>', 'lsx-health-plan' ), |
|
350 | + 'desc' => __('Drop in the iFrame embed code from Giphy in this field, i.e: <iframe src="https://giphy.com/embed/3o7527Rn1HxXWqgxuo" width="480" height="270" frameborder="0" class="giphy-embed" allowfullscreen></iframe>', 'lsx-health-plan'), |
|
351 | 351 | ) |
352 | 352 | ); |
353 | 353 | } |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | $cmb = new_cmb2_box( |
362 | 362 | array( |
363 | 363 | 'id' => $this->slug . '_general_details_metabox', |
364 | - 'title' => __( 'Details', 'lsx-health-plan' ), |
|
365 | - 'object_types' => array( $this->slug ), |
|
364 | + 'title' => __('Details', 'lsx-health-plan'), |
|
365 | + 'object_types' => array($this->slug), |
|
366 | 366 | 'context' => 'normal', |
367 | 367 | 'priority' => 'high', |
368 | 368 | 'show_names' => true, |
@@ -371,15 +371,15 @@ discard block |
||
371 | 371 | |
372 | 372 | $cmb->add_field( |
373 | 373 | array( |
374 | - 'name' => __( 'Side', 'lsx-health-plan' ), |
|
374 | + 'name' => __('Side', 'lsx-health-plan'), |
|
375 | 375 | 'id' => $this->slug . '_side', |
376 | 376 | 'type' => 'select', |
377 | 377 | 'options' => array( |
378 | - '' => __( 'Select', 'lsx-health-plan' ), |
|
379 | - 'left' => __( 'Left', 'lsx-health-plan' ), |
|
380 | - 'right' => __( 'Right', 'lsx-health-plan' ), |
|
378 | + '' => __('Select', 'lsx-health-plan'), |
|
379 | + 'left' => __('Left', 'lsx-health-plan'), |
|
380 | + 'right' => __('Right', 'lsx-health-plan'), |
|
381 | 381 | ), |
382 | - 'desc' => __( 'Select which side this exercise uses. ', 'lsx-health-plan' ), |
|
382 | + 'desc' => __('Select which side this exercise uses. ', 'lsx-health-plan'), |
|
383 | 383 | ) |
384 | 384 | ); |
385 | 385 | } |
@@ -390,16 +390,16 @@ discard block |
||
390 | 390 | * @var array $crumbs |
391 | 391 | * @return array |
392 | 392 | */ |
393 | - public function exercise_breadcrumb_filter( $crumbs ) { |
|
394 | - $exercise = \lsx_health_plan\functions\get_option( 'endpoint_exercise', 'exercise' ); |
|
395 | - $exercises = \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercise' ); |
|
396 | - $url = get_post_type_archive_link( $exercise ); |
|
393 | + public function exercise_breadcrumb_filter($crumbs) { |
|
394 | + $exercise = \lsx_health_plan\functions\get_option('endpoint_exercise', 'exercise'); |
|
395 | + $exercises = \lsx_health_plan\functions\get_option('endpoint_exercise_archive', 'exercise'); |
|
396 | + $url = get_post_type_archive_link($exercise); |
|
397 | 397 | |
398 | - if ( is_singular( 'exercise' ) ) { |
|
398 | + if (is_singular('exercise')) { |
|
399 | 399 | $exercise_name = get_the_title(); |
400 | - $term_obj_list = get_the_terms( get_the_ID(), 'exercise-type' ); |
|
400 | + $term_obj_list = get_the_terms(get_the_ID(), 'exercise-type'); |
|
401 | 401 | $exercise_type = $term_obj_list[0]->name; |
402 | - $exercise_type_url = get_term_link( $term_obj_list[0]->term_id ); |
|
402 | + $exercise_type_url = get_term_link($term_obj_list[0]->term_id); |
|
403 | 403 | |
404 | 404 | $crumbs[1] = array( |
405 | 405 | 0 => $exercises, |
@@ -413,10 +413,10 @@ discard block |
||
413 | 413 | 0 => $exercise_name, |
414 | 414 | ); |
415 | 415 | } |
416 | - if ( is_tax( 'exercise-type' ) || is_tax( 'muscle-group' ) || is_tax( 'equipment' ) ) { |
|
417 | - $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); |
|
416 | + if (is_tax('exercise-type') || is_tax('muscle-group') || is_tax('equipment')) { |
|
417 | + $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
|
418 | 418 | |
419 | - $single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name; |
|
419 | + $single_term_title = str_replace('-', ' ', $term->taxonomy) . ': ' . $term->name; |
|
420 | 420 | |
421 | 421 | $crumbs[1] = array( |
422 | 422 | 0 => $exercises, |
@@ -39,24 +39,24 @@ discard block |
||
39 | 39 | * Constructor |
40 | 40 | */ |
41 | 41 | public function __construct() { |
42 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
43 | - add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
44 | - add_action( 'admin_menu', array( $this, 'register_menus' ) ); |
|
42 | + add_action('init', array($this, 'register_post_type')); |
|
43 | + add_action('init', array($this, 'taxonomy_setup')); |
|
44 | + add_action('admin_menu', array($this, 'register_menus')); |
|
45 | 45 | |
46 | 46 | // Frontend Actions and Filters. |
47 | - add_action( 'wp_head', array( $this, 'remove_archive_original_header' ), 99 ); |
|
48 | - add_action( 'lsx_content_wrap_before', array( $this, 'hp_lsx_archive_header' ) ); |
|
47 | + add_action('wp_head', array($this, 'remove_archive_original_header'), 99); |
|
48 | + add_action('lsx_content_wrap_before', array($this, 'hp_lsx_archive_header')); |
|
49 | 49 | |
50 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
51 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
52 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
53 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
54 | - add_filter( 'lsx_display_global_header_description', array( $this, 'disable_global_header_description' ), 100 ); |
|
55 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 ); |
|
50 | + add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1); |
|
51 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
52 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
53 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100); |
|
54 | + add_filter('lsx_display_global_header_description', array($this, 'disable_global_header_description'), 100); |
|
55 | + add_filter('woocommerce_get_breadcrumb', array($this, 'recipes_breadcrumb_filter'), 30, 1); |
|
56 | 56 | |
57 | 57 | // Backend Actions and Filters. |
58 | - add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) ); |
|
59 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
58 | + add_action('cmb2_admin_init', array($this, 'featured_metabox')); |
|
59 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public static function get_instance() { |
70 | 70 | |
71 | 71 | // If the single instance hasn't been set, set it now. |
72 | - if ( null === self::$instance ) { |
|
72 | + if (null === self::$instance) { |
|
73 | 73 | self::$instance = new self(); |
74 | 74 | } |
75 | 75 | |
@@ -82,21 +82,21 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function register_post_type() { |
84 | 84 | $this->labels = array( |
85 | - 'name' => esc_html__( 'Recipes', 'lsx-health-plan' ), |
|
86 | - 'singular_name' => esc_html__( 'Recipe', 'lsx-health-plan' ), |
|
87 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
88 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
89 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
90 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
91 | - 'all_items' => esc_html__( 'All Recipes', 'lsx-health-plan' ), |
|
92 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
93 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
94 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
95 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
85 | + 'name' => esc_html__('Recipes', 'lsx-health-plan'), |
|
86 | + 'singular_name' => esc_html__('Recipe', 'lsx-health-plan'), |
|
87 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
88 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
89 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
90 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
91 | + 'all_items' => esc_html__('All Recipes', 'lsx-health-plan'), |
|
92 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
93 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
94 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
95 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
96 | 96 | 'parent_item_colon' => '', |
97 | - 'menu_name' => esc_html__( 'Recipes', 'lsx-health-plan' ), |
|
97 | + 'menu_name' => esc_html__('Recipes', 'lsx-health-plan'), |
|
98 | 98 | ); |
99 | - $args = array( |
|
99 | + $args = array( |
|
100 | 100 | 'labels' => $this->labels, |
101 | 101 | 'public' => true, |
102 | 102 | 'publicly_queryable' => true, |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | 'custom-fields', |
120 | 120 | ), |
121 | 121 | ); |
122 | - register_post_type( 'recipe', $args ); |
|
122 | + register_post_type('recipe', $args); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | * @return void |
129 | 129 | */ |
130 | 130 | public function register_menus() { |
131 | - add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipes', 'lsx-health-plan' ), esc_html__( 'Recipes', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=recipe' ); |
|
132 | - add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipe Types', 'lsx-health-plan' ), esc_html__( 'Recipe Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe' ); |
|
133 | - add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Cuisines', 'lsx-health-plan' ), esc_html__( 'Cuisines', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe' ); |
|
131 | + add_submenu_page('edit.php?post_type=meal', esc_html__('Recipes', 'lsx-health-plan'), esc_html__('Recipes', 'lsx-health-plan'), 'edit_posts', 'edit.php?post_type=recipe'); |
|
132 | + add_submenu_page('edit.php?post_type=meal', esc_html__('Recipe Types', 'lsx-health-plan'), esc_html__('Recipe Types', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe'); |
|
133 | + add_submenu_page('edit.php?post_type=meal', esc_html__('Cuisines', 'lsx-health-plan'), esc_html__('Cuisines', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe'); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -138,19 +138,19 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function taxonomy_setup() { |
140 | 140 | $labels = array( |
141 | - 'name' => esc_html_x( 'Cuisine', 'taxonomy general name', 'lsx-health-plan' ), |
|
142 | - 'singular_name' => esc_html_x( 'Cuisines', 'taxonomy singular name', 'lsx-health-plan' ), |
|
143 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
144 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
145 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
146 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
147 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
148 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
149 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
150 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
151 | - 'menu_name' => esc_html__( 'Cuisines', 'lsx-health-plan' ), |
|
141 | + 'name' => esc_html_x('Cuisine', 'taxonomy general name', 'lsx-health-plan'), |
|
142 | + 'singular_name' => esc_html_x('Cuisines', 'taxonomy singular name', 'lsx-health-plan'), |
|
143 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
144 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
145 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
146 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
147 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
148 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
149 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
150 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
151 | + 'menu_name' => esc_html__('Cuisines', 'lsx-health-plan'), |
|
152 | 152 | ); |
153 | - $args = array( |
|
153 | + $args = array( |
|
154 | 154 | 'hierarchical' => true, |
155 | 155 | 'labels' => $labels, |
156 | 156 | 'show_ui' => true, |
@@ -161,22 +161,22 @@ discard block |
||
161 | 161 | 'slug' => 'recipe-cuisine', |
162 | 162 | ), |
163 | 163 | ); |
164 | - register_taxonomy( 'recipe-cuisine', array( $this->slug ), $args ); |
|
164 | + register_taxonomy('recipe-cuisine', array($this->slug), $args); |
|
165 | 165 | |
166 | 166 | $labels = array( |
167 | - 'name' => esc_html_x( 'Recipe Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
168 | - 'singular_name' => esc_html_x( 'Recipe Types', 'taxonomy singular name', 'lsx-health-plan' ), |
|
169 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
170 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
171 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
172 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
173 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
174 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
175 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
176 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
177 | - 'menu_name' => esc_html__( 'Types', 'lsx-health-plan' ), |
|
167 | + 'name' => esc_html_x('Recipe Type', 'taxonomy general name', 'lsx-health-plan'), |
|
168 | + 'singular_name' => esc_html_x('Recipe Types', 'taxonomy singular name', 'lsx-health-plan'), |
|
169 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
170 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
171 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
172 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
173 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
174 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
175 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
176 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
177 | + 'menu_name' => esc_html__('Types', 'lsx-health-plan'), |
|
178 | 178 | ); |
179 | - $args = array( |
|
179 | + $args = array( |
|
180 | 180 | 'hierarchical' => true, |
181 | 181 | 'labels' => $labels, |
182 | 182 | 'show_ui' => true, |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | 'slug' => 'recipe-type', |
188 | 188 | ), |
189 | 189 | ); |
190 | - register_taxonomy( 'recipe-type', array( $this->slug ), $args ); |
|
190 | + register_taxonomy('recipe-type', array($this->slug), $args); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @param array $post_types |
197 | 197 | * @return array |
198 | 198 | */ |
199 | - public function enable_post_type( $post_types = array() ) { |
|
199 | + public function enable_post_type($post_types = array()) { |
|
200 | 200 | $post_types[] = $this->slug; |
201 | 201 | return $post_types; |
202 | 202 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @param array $connections |
208 | 208 | * @return void |
209 | 209 | */ |
210 | - public function enable_connections( $connections = array() ) { |
|
210 | + public function enable_connections($connections = array()) { |
|
211 | 211 | $connections['recipe']['connected_plans'] = 'connected_recipes'; |
212 | 212 | $connections['plan']['connected_recipes'] = 'connected_plans'; |
213 | 213 | return $connections; |
@@ -219,42 +219,42 @@ discard block |
||
219 | 219 | * @param string $title the term title. |
220 | 220 | * @return string |
221 | 221 | */ |
222 | - public function get_the_archive_title( $title ) { |
|
223 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
224 | - $title = __( 'Recipes', 'lsx-health-plan' ); |
|
222 | + public function get_the_archive_title($title) { |
|
223 | + if (is_post_type_archive('recipe')) { |
|
224 | + $title = __('Recipes', 'lsx-health-plan'); |
|
225 | 225 | } |
226 | - if ( is_post_type_archive( 'exercise' ) ) { |
|
227 | - $title = __( 'Exercises', 'lsx-health-plan' ); |
|
226 | + if (is_post_type_archive('exercise')) { |
|
227 | + $title = __('Exercises', 'lsx-health-plan'); |
|
228 | 228 | } |
229 | - if ( is_tax( 'recipe-type' ) ) { |
|
229 | + if (is_tax('recipe-type')) { |
|
230 | 230 | $queried_object = get_queried_object(); |
231 | - if ( isset( $queried_object->name ) ) { |
|
232 | - $title = $queried_object->name . ' ' . __( 'Recipes', 'lsx-health-plan' ); |
|
231 | + if (isset($queried_object->name)) { |
|
232 | + $title = $queried_object->name . ' ' . __('Recipes', 'lsx-health-plan'); |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | return $title; |
236 | 236 | } |
237 | 237 | |
238 | 238 | public function remove_archive_original_header() { |
239 | - if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) { |
|
240 | - remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
239 | + if (is_post_type_archive('recipe') || is_post_type_archive('exercise')) { |
|
240 | + remove_action('lsx_content_wrap_before', 'lsx_global_header'); |
|
241 | 241 | } |
242 | - if ( ! is_post_type_archive() ) { |
|
243 | - add_action( 'lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11 ); |
|
242 | + if ( ! is_post_type_archive()) { |
|
243 | + add_action('lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
247 | 247 | public function hp_lsx_archive_header() { |
248 | - if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) { |
|
248 | + if (is_post_type_archive('recipe') || is_post_type_archive('exercise')) { |
|
249 | 249 | ?> |
250 | 250 | <div class="archive-header-wrapper banner-archive"> |
251 | 251 | <?php lsx_global_header_inner_bottom(); ?> |
252 | 252 | <header class="archive-header"> |
253 | 253 | <h1 class="archive-title"> |
254 | - <?php if ( has_post_format() && ! is_category() && ! is_tag() && ! is_date() && ! is_tax( 'post_format' ) ) { ?> |
|
255 | - <?php the_archive_title( esc_html__( 'Type:', 'lsx' ) ); ?> |
|
254 | + <?php if (has_post_format() && ! is_category() && ! is_tag() && ! is_date() && ! is_tax('post_format')) { ?> |
|
255 | + <?php the_archive_title(esc_html__('Type:', 'lsx')); ?> |
|
256 | 256 | <?php } else { ?> |
257 | - <?php echo wp_kses_post( apply_filters( 'lsx_global_header_title', get_the_archive_title() ) ); ?> |
|
257 | + <?php echo wp_kses_post(apply_filters('lsx_global_header_title', get_the_archive_title())); ?> |
|
258 | 258 | <?php } ?> |
259 | 259 | </h1> |
260 | 260 | |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | * @param boolean $disable |
274 | 274 | * @return boolean |
275 | 275 | */ |
276 | - public function disable_global_header_description( $disable ) { |
|
277 | - if ( is_tax( 'recipe-type' ) ) { |
|
276 | + public function disable_global_header_description($disable) { |
|
277 | + if (is_tax('recipe-type')) { |
|
278 | 278 | $disable = true; |
279 | 279 | } |
280 | 280 | return $disable; |
@@ -286,16 +286,16 @@ discard block |
||
286 | 286 | * @var array $crumbs |
287 | 287 | * @return array |
288 | 288 | */ |
289 | - public function recipes_breadcrumb_filter( $crumbs ) { |
|
290 | - $recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe', 'recipe' ); |
|
291 | - $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe_archive', 'recipes' ); |
|
292 | - $url = get_post_type_archive_link( 'recipe' ); |
|
289 | + public function recipes_breadcrumb_filter($crumbs) { |
|
290 | + $recipe = \lsx_health_plan\functions\get_option('endpoint_recipe', 'recipe'); |
|
291 | + $recipes = \lsx_health_plan\functions\get_option('endpoint_recipe_archive', 'recipes'); |
|
292 | + $url = get_post_type_archive_link('recipe'); |
|
293 | 293 | |
294 | - if ( is_singular( 'recipe' ) ) { |
|
294 | + if (is_singular('recipe')) { |
|
295 | 295 | $recipe_name = get_the_title(); |
296 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
296 | + $term_obj_list = get_the_terms(get_the_ID(), 'recipe-type'); |
|
297 | 297 | $recipe_type = $term_obj_list[0]->name; |
298 | - $recipe_type_url = get_term_link( $term_obj_list[0]->term_id ); |
|
298 | + $recipe_type_url = get_term_link($term_obj_list[0]->term_id); |
|
299 | 299 | |
300 | 300 | $crumbs[1] = array( |
301 | 301 | 0 => $recipes, |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | 0 => $recipe_name, |
310 | 310 | ); |
311 | 311 | } |
312 | - if ( is_tax( 'recipe-type' ) || is_tax( 'recipe-cuisine' ) ) { |
|
313 | - $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); |
|
312 | + if (is_tax('recipe-type') || is_tax('recipe-cuisine')) { |
|
313 | + $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
|
314 | 314 | |
315 | - $single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name; |
|
315 | + $single_term_title = str_replace('-', ' ', $term->taxonomy) . ': ' . $term->name; |
|
316 | 316 | |
317 | 317 | $crumbs[1] = array( |
318 | 318 | 0 => $recipes, |
@@ -332,8 +332,8 @@ discard block |
||
332 | 332 | $cmb = new_cmb2_box( |
333 | 333 | array( |
334 | 334 | 'id' => $this->slug . '_featured_metabox', |
335 | - 'title' => __( 'Featured', 'lsx-health-plan' ), |
|
336 | - 'object_types' => array( $this->slug ), |
|
335 | + 'title' => __('Featured', 'lsx-health-plan'), |
|
336 | + 'object_types' => array($this->slug), |
|
337 | 337 | 'context' => 'side', |
338 | 338 | 'priority' => 'high', |
339 | 339 | 'show_names' => true, |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | ); |
342 | 342 | $cmb->add_field( |
343 | 343 | array( |
344 | - 'name' => __( 'Featured', 'lsx-health-plan' ), |
|
345 | - 'desc' => __( 'Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan' ), |
|
344 | + 'name' => __('Featured', 'lsx-health-plan'), |
|
345 | + 'desc' => __('Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan'), |
|
346 | 346 | 'id' => $this->slug . '_featured', |
347 | 347 | 'type' => 'checkbox', |
348 | 348 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -357,8 +357,8 @@ discard block |
||
357 | 357 | $cmb = new_cmb2_box( |
358 | 358 | array( |
359 | 359 | 'id' => $this->slug . '_details_metabox', |
360 | - 'title' => __( 'Cooking Info', 'lsx-health-plan' ), |
|
361 | - 'object_types' => array( $this->slug ), // Post type |
|
360 | + 'title' => __('Cooking Info', 'lsx-health-plan'), |
|
361 | + 'object_types' => array($this->slug), // Post type |
|
362 | 362 | 'context' => 'normal', |
363 | 363 | 'priority' => 'high', |
364 | 364 | 'show_names' => true, |
@@ -366,27 +366,27 @@ discard block |
||
366 | 366 | ); |
367 | 367 | $cmb->add_field( |
368 | 368 | array( |
369 | - 'name' => __( 'Prep Time', 'lsx-health-plan' ), |
|
369 | + 'name' => __('Prep Time', 'lsx-health-plan'), |
|
370 | 370 | 'id' => $this->slug . '_prep_time', |
371 | - 'desc' => __( 'Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan' ), |
|
371 | + 'desc' => __('Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan'), |
|
372 | 372 | 'type' => 'text', |
373 | 373 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
374 | 374 | ) |
375 | 375 | ); |
376 | 376 | $cmb->add_field( |
377 | 377 | array( |
378 | - 'name' => __( 'Cooking Time', 'lsx-health-plan' ), |
|
378 | + 'name' => __('Cooking Time', 'lsx-health-plan'), |
|
379 | 379 | 'id' => $this->slug . '_cooking_time', |
380 | - 'desc' => __( 'Add the cooking time i.e: 15 mins', 'lsx-health-plan' ), |
|
380 | + 'desc' => __('Add the cooking time i.e: 15 mins', 'lsx-health-plan'), |
|
381 | 381 | 'type' => 'text', |
382 | 382 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
383 | 383 | ) |
384 | 384 | ); |
385 | 385 | $cmb->add_field( |
386 | 386 | array( |
387 | - 'name' => __( 'Serves', 'lsx-health-plan' ), |
|
387 | + 'name' => __('Serves', 'lsx-health-plan'), |
|
388 | 388 | 'id' => $this->slug . '_serves', |
389 | - 'desc' => __( 'Add the recommended serving size i.e: 6', 'lsx-health-plan' ), |
|
389 | + 'desc' => __('Add the recommended serving size i.e: 6', 'lsx-health-plan'), |
|
390 | 390 | 'type' => 'text', |
391 | 391 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
392 | 392 | 'attributes' => array( |
@@ -397,8 +397,8 @@ discard block |
||
397 | 397 | ); |
398 | 398 | $cmb->add_field( |
399 | 399 | array( |
400 | - 'name' => __( 'Portion', 'lsx-health-plan' ), |
|
401 | - 'desc' => __( 'Add the recommended portion size i.e: 200mg', 'lsx-health-plan' ), |
|
400 | + 'name' => __('Portion', 'lsx-health-plan'), |
|
401 | + 'desc' => __('Add the recommended portion size i.e: 200mg', 'lsx-health-plan'), |
|
402 | 402 | 'id' => $this->slug . '_portion', |
403 | 403 | 'type' => 'text', |
404 | 404 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | $cmb = new_cmb2_box( |
408 | 408 | array( |
409 | 409 | 'id' => $this->slug . '_nutritional_metabox', |
410 | - 'title' => __( 'Nutritional Info', 'lsx-health-plan' ), |
|
411 | - 'object_types' => array( $this->slug ), // Post type |
|
410 | + 'title' => __('Nutritional Info', 'lsx-health-plan'), |
|
411 | + 'object_types' => array($this->slug), // Post type |
|
412 | 412 | 'context' => 'normal', |
413 | 413 | 'priority' => 'high', |
414 | 414 | 'show_names' => true, |
@@ -416,45 +416,45 @@ discard block |
||
416 | 416 | ); |
417 | 417 | $cmb->add_field( |
418 | 418 | array( |
419 | - 'name' => __( 'Energy', 'lsx-health-plan' ), |
|
419 | + 'name' => __('Energy', 'lsx-health-plan'), |
|
420 | 420 | 'id' => $this->slug . '_energy', |
421 | - 'desc' => __( 'Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan' ), |
|
421 | + 'desc' => __('Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan'), |
|
422 | 422 | 'type' => 'text', |
423 | 423 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
424 | 424 | ) |
425 | 425 | ); |
426 | 426 | $cmb->add_field( |
427 | 427 | array( |
428 | - 'name' => __( 'Protein', 'lsx-health-plan' ), |
|
428 | + 'name' => __('Protein', 'lsx-health-plan'), |
|
429 | 429 | 'id' => $this->slug . '_protein', |
430 | - 'desc' => __( 'Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan' ), |
|
430 | + 'desc' => __('Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan'), |
|
431 | 431 | 'type' => 'text', |
432 | 432 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
433 | 433 | ) |
434 | 434 | ); |
435 | 435 | $cmb->add_field( |
436 | 436 | array( |
437 | - 'name' => __( 'Carbohydrates', 'lsx-health-plan' ), |
|
437 | + 'name' => __('Carbohydrates', 'lsx-health-plan'), |
|
438 | 438 | 'id' => $this->slug . '_carbohydrates', |
439 | - 'desc' => __( 'Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan' ), |
|
439 | + 'desc' => __('Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan'), |
|
440 | 440 | 'type' => 'text', |
441 | 441 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
442 | 442 | ) |
443 | 443 | ); |
444 | 444 | $cmb->add_field( |
445 | 445 | array( |
446 | - 'name' => __( 'Fibre', 'lsx-health-plan' ), |
|
446 | + 'name' => __('Fibre', 'lsx-health-plan'), |
|
447 | 447 | 'id' => $this->slug . '_fibre', |
448 | - 'desc' => __( 'Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan' ), |
|
448 | + 'desc' => __('Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan'), |
|
449 | 449 | 'type' => 'text', |
450 | 450 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
451 | 451 | ) |
452 | 452 | ); |
453 | 453 | $cmb->add_field( |
454 | 454 | array( |
455 | - 'name' => __( 'Fat', 'lsx-health-plan' ), |
|
455 | + 'name' => __('Fat', 'lsx-health-plan'), |
|
456 | 456 | 'id' => $this->slug . '_fat', |
457 | - 'desc' => __( 'Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan' ), |
|
457 | + 'desc' => __('Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan'), |
|
458 | 458 | 'type' => 'text', |
459 | 459 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
460 | 460 | ) |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
15 | 15 | ?> |
16 | 16 | |
17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
18 | 18 | |
19 | 19 | <?php lsx_content_before(); ?> |
20 | 20 | |
21 | 21 | <!-- Begining restricted content --> |
22 | 22 | <?php |
23 | - if ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
23 | + if (current_user_can('administrator', $page_id) || current_user_can('wc_memberships_view_restricted_post_content', $page_id)) { |
|
24 | 24 | ?> |
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <div class="post-wrapper workout-archive-plan archive-plan"> |
30 | 30 | <div class="row"> |
31 | - <?php if ( have_posts() ) : ?> |
|
31 | + <?php if (have_posts()) : ?> |
|
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
33 | + while (have_posts()) : |
|
34 | 34 | the_post(); |
35 | 35 | ?> |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | <?php else : ?> |
42 | 42 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php |
54 | 54 | } else { |
55 | - wp_redirect( $redirect ); |
|
55 | + wp_redirect($redirect); |
|
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | ?> |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
15 | 15 | ?> |
16 | 16 | |
17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
18 | 18 | |
19 | 19 | <?php lsx_content_before(); ?> |
20 | 20 | |
21 | 21 | <!-- Begining restricted content --> |
22 | 22 | <?php |
23 | - if ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
23 | + if (current_user_can('administrator', $page_id) || current_user_can('wc_memberships_view_restricted_post_content', $page_id)) { |
|
24 | 24 | ?> |
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <div class="post-wrapper exercise-archive-plan archive-plan"> |
30 | 30 | <div class="row"> |
31 | - <?php if ( have_posts() ) : ?> |
|
31 | + <?php if (have_posts()) : ?> |
|
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
33 | + while (have_posts()) : |
|
34 | 34 | the_post(); |
35 | 35 | ?> |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | <?php else : ?> |
42 | 42 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php |
54 | 54 | } else { |
55 | - wp_redirect( $redirect ); |
|
55 | + wp_redirect($redirect); |
|
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | ?> |
@@ -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,15 +375,15 @@ discard block |
||
375 | 375 | * @param object $cmb new_cmb2_box(). |
376 | 376 | * @return void |
377 | 377 | */ |
378 | - public function global_downloads( $cmb ) { |
|
379 | - if ( ! function_exists( 'download_monitor' ) ) { |
|
378 | + public function global_downloads($cmb) { |
|
379 | + if ( ! function_exists('download_monitor')) { |
|
380 | 380 | return; |
381 | 381 | } |
382 | 382 | $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
383 | 383 | $plugin_name = 'Download Monitor'; |
384 | 384 | $description = sprintf( |
385 | 385 | /* translators: %s: The subscription info */ |
386 | - __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your plan here.', 'lsx-search' ), |
|
386 | + __('If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your plan here.', 'lsx-search'), |
|
387 | 387 | $page_url, |
388 | 388 | $plugin_name |
389 | 389 | ); |
@@ -391,16 +391,16 @@ discard block |
||
391 | 391 | array( |
392 | 392 | 'id' => 'global_downloads_title', |
393 | 393 | 'type' => 'title', |
394 | - 'name' => __( 'Global Downloads', 'lsx-health-plan' ), |
|
395 | - 'default' => __( 'Global Downloads', 'lsx-health-plan' ), |
|
394 | + 'name' => __('Global Downloads', 'lsx-health-plan'), |
|
395 | + 'default' => __('Global Downloads', 'lsx-health-plan'), |
|
396 | 396 | 'description' => $description, |
397 | 397 | ) |
398 | 398 | ); |
399 | 399 | |
400 | - foreach ( $this->download_types as $type => $download_type ) { |
|
400 | + foreach ($this->download_types as $type => $download_type) { |
|
401 | 401 | $limit = 5; |
402 | 402 | $sortable = false; |
403 | - if ( isset( $download_type['limit'] ) ) { |
|
403 | + if (isset($download_type['limit'])) { |
|
404 | 404 | $limit = $download_type['limit']; |
405 | 405 | $sortable = true; |
406 | 406 | } |
@@ -413,8 +413,8 @@ discard block |
||
413 | 413 | 'limit' => $limit, |
414 | 414 | 'sortable' => $sortable, |
415 | 415 | 'query_args' => array( |
416 | - 'post_type' => array( 'dlm_download' ), |
|
417 | - 'post_status' => array( 'publish' ), |
|
416 | + 'post_type' => array('dlm_download'), |
|
417 | + 'post_status' => array('publish'), |
|
418 | 418 | 'posts_per_page' => -1, |
419 | 419 | ), |
420 | 420 | ) |
@@ -434,17 +434,17 @@ discard block |
||
434 | 434 | * @param object $cmb new_cmb2_box(). |
435 | 435 | * @return void |
436 | 436 | */ |
437 | - public function endpoint_translations( $cmb ) { |
|
437 | + public function endpoint_translations($cmb) { |
|
438 | 438 | $cmb->add_field( |
439 | 439 | array( |
440 | 440 | 'id' => 'endpoints_title', |
441 | 441 | 'type' => 'title', |
442 | - 'name' => __( 'Set Endpoint Translations', 'lsx-health-plan' ), |
|
443 | - 'default' => __( 'Set Endpoint Translations', 'lsx-health-plan' ), |
|
442 | + 'name' => __('Set Endpoint Translations', 'lsx-health-plan'), |
|
443 | + 'default' => __('Set Endpoint Translations', 'lsx-health-plan'), |
|
444 | 444 | ) |
445 | 445 | ); |
446 | - foreach ( $this->endpoints as $slug => $endpoint_vars ) { |
|
447 | - if ( 'exercise' === $slug ) { |
|
446 | + foreach ($this->endpoints as $slug => $endpoint_vars) { |
|
447 | + if ('exercise' === $slug) { |
|
448 | 448 | continue; |
449 | 449 | } |
450 | 450 | |
@@ -473,19 +473,19 @@ discard block |
||
473 | 473 | * @param object $cmb new_cmb2_box(). |
474 | 474 | * @return void |
475 | 475 | */ |
476 | - public function exercise_translations( $cmb ) { |
|
477 | - if ( isset( $this->endpoints['exercise'] ) && '' !== $this->endpoints['exercise'] && ! empty( $this->endpoints['exercise'] ) ) { |
|
476 | + public function exercise_translations($cmb) { |
|
477 | + if (isset($this->endpoints['exercise']) && '' !== $this->endpoints['exercise'] && ! empty($this->endpoints['exercise'])) { |
|
478 | 478 | $cmb->add_field( |
479 | 479 | array( |
480 | 480 | 'id' => 'exercise_endpoints_title', |
481 | 481 | 'type' => 'title', |
482 | - 'name' => __( 'Set Exercise Translations', 'lsx-health-plan' ), |
|
483 | - 'default' => __( 'Set Exercise Translations', 'lsx-health-plan' ), |
|
484 | - 'description' => __( 'Change the exercise endpoints.', 'lsx-health-plan' ), |
|
482 | + 'name' => __('Set Exercise Translations', 'lsx-health-plan'), |
|
483 | + 'default' => __('Set Exercise Translations', 'lsx-health-plan'), |
|
484 | + 'description' => __('Change the exercise endpoints.', 'lsx-health-plan'), |
|
485 | 485 | ) |
486 | 486 | ); |
487 | 487 | |
488 | - foreach ( $this->endpoints['exercise'] as $slug => $endpoint_vars ) { |
|
488 | + foreach ($this->endpoints['exercise'] as $slug => $endpoint_vars) { |
|
489 | 489 | $cmb->add_field( |
490 | 490 | array( |
491 | 491 | 'name' => $endpoint_vars['title'], |
@@ -513,27 +513,27 @@ discard block |
||
513 | 513 | * @param object $cmb new_cmb2_box(). |
514 | 514 | * @return void |
515 | 515 | */ |
516 | - public function post_type_toggles( $cmb ) { |
|
517 | - $post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) ); |
|
516 | + public function post_type_toggles($cmb) { |
|
517 | + $post_types = apply_filters('lsx_health_plan_post_types', isset($this->post_types)); |
|
518 | 518 | |
519 | 519 | $cmb->add_field( |
520 | 520 | array( |
521 | 521 | 'id' => 'post_type_toggles_title', |
522 | 522 | 'type' => 'title', |
523 | - 'name' => __( 'Disable Post Types', 'lsx-health-plan' ), |
|
524 | - 'default' => __( 'Disable Post Types', 'lsx-health-plan' ), |
|
525 | - 'description' => __( 'Disable post types if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
523 | + 'name' => __('Disable Post Types', 'lsx-health-plan'), |
|
524 | + 'default' => __('Disable Post Types', 'lsx-health-plan'), |
|
525 | + 'description' => __('Disable post types if you are wanting a minimal site.', 'lsx-health-plan'), |
|
526 | 526 | ) |
527 | 527 | ); |
528 | 528 | |
529 | - foreach ( $post_types as $post_type ) { |
|
530 | - if ( 'plan' === $post_type || 'exercise' === $post_type || ( 'video' === $post_type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) ) { |
|
529 | + foreach ($post_types as $post_type) { |
|
530 | + if ('plan' === $post_type || 'exercise' === $post_type || ('video' === $post_type && false !== \lsx_health_plan\functions\get_option('exercise_enabled', false))) { |
|
531 | 531 | continue; |
532 | 532 | } |
533 | 533 | |
534 | 534 | $cmb->add_field( |
535 | 535 | array( |
536 | - 'name' => ucwords( $post_type ), |
|
536 | + 'name' => ucwords($post_type), |
|
537 | 537 | 'id' => $post_type . '_disabled', |
538 | 538 | 'type' => 'checkbox', |
539 | 539 | 'value' => 1, |
@@ -553,19 +553,19 @@ discard block |
||
553 | 553 | array( |
554 | 554 | 'id' => 'post_type_toggles_enable_title', |
555 | 555 | 'type' => 'title', |
556 | - 'name' => __( 'Enable Post Types', 'lsx-health-plan' ), |
|
557 | - 'default' => __( 'Enable Post Types', 'lsx-health-plan' ), |
|
558 | - 'description' => __( 'Enable new functionality like the "exercise" post type.', 'lsx-health-plan' ), |
|
556 | + 'name' => __('Enable Post Types', 'lsx-health-plan'), |
|
557 | + 'default' => __('Enable Post Types', 'lsx-health-plan'), |
|
558 | + 'description' => __('Enable new functionality like the "exercise" post type.', 'lsx-health-plan'), |
|
559 | 559 | ) |
560 | 560 | ); |
561 | 561 | $cmb->add_field( |
562 | 562 | array( |
563 | - 'name' => __( 'Exercises', 'lsx-health-plan' ), |
|
563 | + 'name' => __('Exercises', 'lsx-health-plan'), |
|
564 | 564 | 'id' => 'exercise_enabled', |
565 | 565 | 'type' => 'checkbox', |
566 | 566 | 'value' => 1, |
567 | 567 | 'default' => 0, |
568 | - 'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ), |
|
568 | + 'description' => __('Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan'), |
|
569 | 569 | ) |
570 | 570 | ); |
571 | 571 | $cmb->add_field( |
@@ -582,18 +582,18 @@ discard block |
||
582 | 582 | * @return void |
583 | 583 | */ |
584 | 584 | |
585 | - public function stat_disable( $cmb ) { |
|
585 | + public function stat_disable($cmb) { |
|
586 | 586 | $cmb->add_field( |
587 | 587 | array( |
588 | 588 | 'id' => 'stat_disable_title', |
589 | 589 | 'type' => 'title', |
590 | - 'name' => __( 'Disable Profile Stats', 'lsx-health-plan' ), |
|
591 | - 'default' => __( 'Disable Profile Stats', 'lsx-health-plan' ), |
|
590 | + 'name' => __('Disable Profile Stats', 'lsx-health-plan'), |
|
591 | + 'default' => __('Disable Profile Stats', 'lsx-health-plan'), |
|
592 | 592 | ) |
593 | 593 | ); |
594 | 594 | $cmb->add_field( |
595 | 595 | array( |
596 | - 'name' => __( 'Disable All Stats', 'lsx-health-plan' ), |
|
596 | + 'name' => __('Disable All Stats', 'lsx-health-plan'), |
|
597 | 597 | 'desc' => 'Disable All Stats', |
598 | 598 | 'id' => 'disable_all_stats', |
599 | 599 | 'type' => 'checkbox', |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | ); |
604 | 604 | $cmb->add_field( |
605 | 605 | array( |
606 | - 'name' => __( 'Disable Weight', 'lsx-health-plan' ), |
|
606 | + 'name' => __('Disable Weight', 'lsx-health-plan'), |
|
607 | 607 | 'id' => 'disable_weight_checkbox', |
608 | 608 | 'type' => 'checkbox', |
609 | 609 | 'value' => 1, |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | ); |
613 | 613 | $cmb->add_field( |
614 | 614 | array( |
615 | - 'name' => __( 'Disable Height', 'lsx-health-plan' ), |
|
615 | + 'name' => __('Disable Height', 'lsx-health-plan'), |
|
616 | 616 | 'id' => 'disable_height_checkbox', |
617 | 617 | 'type' => 'checkbox', |
618 | 618 | 'value' => 1, |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | ); |
622 | 622 | $cmb->add_field( |
623 | 623 | array( |
624 | - 'name' => __( 'Disable Waist', 'lsx-health-plan' ), |
|
624 | + 'name' => __('Disable Waist', 'lsx-health-plan'), |
|
625 | 625 | 'id' => 'disable_waist_checkbox', |
626 | 626 | 'type' => 'checkbox', |
627 | 627 | 'value' => 1, |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | ); |
631 | 631 | $cmb->add_field( |
632 | 632 | array( |
633 | - 'name' => __( 'Disable BMI', 'lsx-health-plan' ), |
|
633 | + 'name' => __('Disable BMI', 'lsx-health-plan'), |
|
634 | 634 | 'id' => 'disable_bmi_checkbox', |
635 | 635 | 'type' => 'checkbox', |
636 | 636 | 'value' => 1, |
@@ -652,10 +652,10 @@ discard block |
||
652 | 652 | * @param string $section either engine,archive or single. |
653 | 653 | * @return void |
654 | 654 | */ |
655 | - public function generate_tabs( $cmb ) { |
|
655 | + public function generate_tabs($cmb) { |
|
656 | 656 | $tabs = $this->get_settings_tabs(); |
657 | 657 | |
658 | - foreach ( $tabs as $tab_key => $tab ) { |
|
658 | + foreach ($tabs as $tab_key => $tab) { |
|
659 | 659 | $cmb->add_field( |
660 | 660 | array( |
661 | 661 | 'id' => 'settings_' . $tab_key . '_title', |
@@ -665,11 +665,11 @@ discard block |
||
665 | 665 | 'description' => $tab['desc'], |
666 | 666 | ) |
667 | 667 | ); |
668 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb ); |
|
668 | + do_action('lsx_hp_settings_page_' . $tab_key . '_top', $cmb); |
|
669 | 669 | |
670 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb ); |
|
670 | + do_action('lsx_hp_settings_page_' . $tab_key . '_middle', $cmb); |
|
671 | 671 | |
672 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb ); |
|
672 | + do_action('lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb); |
|
673 | 673 | |
674 | 674 | $cmb->add_field( |
675 | 675 | array( |
@@ -689,26 +689,26 @@ discard block |
||
689 | 689 | public function get_settings_tabs() { |
690 | 690 | $tabs = array( |
691 | 691 | 'general' => array( |
692 | - 'title' => __( 'General', 'lsx-health-plan' ), |
|
693 | - 'desc' => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ), |
|
692 | + 'title' => __('General', 'lsx-health-plan'), |
|
693 | + 'desc' => __('Control the sitewide settings for the LSX HP site.', 'lsx-health-plan'), |
|
694 | 694 | ), |
695 | 695 | ); |
696 | 696 | |
697 | - foreach ( $this->post_types as $post_type ) { |
|
698 | - switch ( $post_type ) { |
|
697 | + foreach ($this->post_types as $post_type) { |
|
698 | + switch ($post_type) { |
|
699 | 699 | default: |
700 | 700 | //if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) { |
701 | - $temp_post_type = get_post_type_object( $post_type ); |
|
702 | - if ( ! is_wp_error( $temp_post_type ) ) { |
|
703 | - $page_url = get_post_type_archive_link( $temp_post_type->name ); |
|
701 | + $temp_post_type = get_post_type_object($post_type); |
|
702 | + if ( ! is_wp_error($temp_post_type)) { |
|
703 | + $page_url = get_post_type_archive_link($temp_post_type->name); |
|
704 | 704 | $description = sprintf( |
705 | 705 | /* translators: %s: The subscription info */ |
706 | - __( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ), |
|
706 | + __('Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search'), |
|
707 | 707 | $page_url, |
708 | 708 | $temp_post_type->label |
709 | 709 | ); |
710 | 710 | |
711 | - $tabs[ $post_type ] = array( |
|
711 | + $tabs[$post_type] = array( |
|
712 | 712 | 'title' => $temp_post_type->label, |
713 | 713 | 'desc' => $description, |
714 | 714 | ); |
@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | global $shortcode_args; |
9 | 9 | |
10 | 10 | // Getting translated endpoint. |
11 | -$archive_workout = \lsx_health_plan\functions\get_option( 'endpoint_workout_archive', 'workout' ); |
|
12 | -$workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
11 | +$archive_workout = \lsx_health_plan\functions\get_option('endpoint_workout_archive', 'workout'); |
|
12 | +$workout = \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'); |
|
13 | 13 | |
14 | -$connected_articles = get_post_meta( get_the_ID(), ( $workout . '_connected_articles' ), true ); |
|
14 | +$connected_articles = get_post_meta(get_the_ID(), ($workout . '_connected_articles'), true); |
|
15 | 15 | |
16 | 16 | ?> |
17 | 17 | |
@@ -37,29 +37,29 @@ discard block |
||
37 | 37 | ?> |
38 | 38 | <div class="single-plan-inner workout-content"> |
39 | 39 | <?php |
40 | - if ( is_singular( 'workout' ) ) { ?> |
|
40 | + if (is_singular('workout')) { ?> |
|
41 | 41 | <div class="single-plan-section-title workout title-lined"> |
42 | - <?php lsx_get_svg_icon( 'work.svg' ); ?> |
|
42 | + <?php lsx_get_svg_icon('work.svg'); ?> |
|
43 | 43 | <h2><?php the_title(); ?></h2> |
44 | - <?php if ( class_exists( 'LSX_Sharing' ) ) { |
|
44 | + <?php if (class_exists('LSX_Sharing')) { |
|
45 | 45 | lsx_content_sharing(); |
46 | 46 | } ?> |
47 | 47 | </div> |
48 | 48 | <?php } else { ?> |
49 | 49 | <div class="single-plan-section-title workout title-lined"> |
50 | - <?php lsx_get_svg_icon( 'work.svg' ); ?> |
|
51 | - <h2><?php esc_html_e( 'My Workout', 'lsx-health-plan' ); ?></h2> |
|
50 | + <?php lsx_get_svg_icon('work.svg'); ?> |
|
51 | + <h2><?php esc_html_e('My Workout', 'lsx-health-plan'); ?></h2> |
|
52 | 52 | </div> |
53 | 53 | <?php } ?> |
54 | 54 | <?php |
55 | - if ( lsx_health_plan_has_warmup() && ( ! is_singular( 'workout' ) ) ) { |
|
55 | + if (lsx_health_plan_has_warmup() && ( ! is_singular('workout'))) { |
|
56 | 56 | ?> |
57 | 57 | <div class="workout-instructions"> |
58 | 58 | <div class="row"> |
59 | 59 | <div class="col-md-12"> |
60 | 60 | <div class="content-intro"> |
61 | - <h3><?php esc_html_e( "Don't forget your warm up!", 'lsx-health-plan' ); ?></h3> |
|
62 | - <p><?php esc_html_e( 'Be sure to do the warm-up before every workout session.', 'lsx-health-plan' ); ?></p> |
|
61 | + <h3><?php esc_html_e("Don't forget your warm up!", 'lsx-health-plan'); ?></h3> |
|
62 | + <p><?php esc_html_e('Be sure to do the warm-up before every workout session.', 'lsx-health-plan'); ?></p> |
|
63 | 63 | </div> |
64 | 64 | </div> |
65 | 65 | </div> |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | <?php lsx_entry_bottom(); ?> |
76 | 76 | |
77 | 77 | </article><!-- #post-## --> |
78 | -<?php if ( is_singular( $workout ) ) { ?> |
|
78 | +<?php if (is_singular($workout)) { ?> |
|
79 | 79 | <div class="back-plan-btn"> |
80 | - <a class="btn" href="/<?php echo $archive_workout; ?>"><?php esc_html_e( 'Back to workouts', 'lsx-health-plan' ); ?></a> |
|
80 | + <a class="btn" href="/<?php echo $archive_workout; ?>"><?php esc_html_e('Back to workouts', 'lsx-health-plan'); ?></a> |
|
81 | 81 | </div> |
82 | 82 | <?php } ?> |
83 | 83 | <?php |
84 | -if ( ! empty( $connected_articles ) ) { |
|
85 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
84 | +if ( ! empty($connected_articles)) { |
|
85 | + lsx_hp_single_related($connected_articles, __('Related articles', 'lsx-health-plan')); |
|
86 | 86 | } |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | |
8 | 8 | // Getting translated endpoint. |
9 | 9 | |
10 | -$archive_meals = \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ); |
|
11 | -$meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
10 | +$archive_meals = \lsx_health_plan\functions\get_option('endpoint_meal_archive', 'meals'); |
|
11 | +$meal = \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'); |
|
12 | 12 | |
13 | -$connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
14 | -$connected_articles = get_post_meta( get_the_ID(), ( $meal . '_connected_articles' ), true ); |
|
13 | +$connected_members = get_post_meta(get_the_ID(), ($meal . '_connected_team_member'), true); |
|
14 | +$connected_articles = get_post_meta(get_the_ID(), ($meal . '_connected_articles'), true); |
|
15 | 15 | |
16 | 16 | ?> |
17 | 17 | |
@@ -26,18 +26,18 @@ discard block |
||
26 | 26 | <div class="entry-content"> |
27 | 27 | <div class="single-plan-inner meal-content"> |
28 | 28 | <?php |
29 | - if ( is_singular( 'meal' ) ) { ?> |
|
29 | + if (is_singular('meal')) { ?> |
|
30 | 30 | <div class="single-plan-section-title meal-plan title-lined"> |
31 | - <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
|
31 | + <?php lsx_get_svg_icon('meal.svg'); ?> |
|
32 | 32 | <h2><?php the_title(); ?></h2> |
33 | - <?php if ( class_exists( 'LSX_Sharing' ) ) { |
|
33 | + <?php if (class_exists('LSX_Sharing')) { |
|
34 | 34 | lsx_content_sharing(); |
35 | 35 | } ?> |
36 | 36 | </div> |
37 | 37 | <?php } else { ?> |
38 | 38 | <div class="single-plan-section-title meal-plan title-lined"> |
39 | - <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
|
40 | - <h2><?php esc_html_e( 'My Meal Plan', 'lsx-health-plan' ); ?> <?php the_title(); ?></h2> |
|
39 | + <?php lsx_get_svg_icon('meal.svg'); ?> |
|
40 | + <h2><?php esc_html_e('My Meal Plan', 'lsx-health-plan'); ?> <?php the_title(); ?></h2> |
|
41 | 41 | </div> |
42 | 42 | <?php } ?> |
43 | 43 | |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | </article><!-- #post-## --> |
51 | 51 | |
52 | 52 | <div class="back-plan-btn"> |
53 | - <?php if ( is_single() && is_singular( 'meal' ) ) { ?> |
|
54 | - <a class="btn border-btn" href="/<?php echo $archive_meals; ?>"><?php esc_html_e( 'Back to meals', 'lsx-health-plan' ); ?></a> |
|
53 | + <?php if (is_single() && is_singular('meal')) { ?> |
|
54 | + <a class="btn border-btn" href="/<?php echo $archive_meals; ?>"><?php esc_html_e('Back to meals', 'lsx-health-plan'); ?></a> |
|
55 | 55 | <?php } ?> |
56 | 56 | |
57 | 57 | <?php |
58 | 58 | // Shoping list |
59 | - $shopping_list = get_post_meta( get_the_ID(), 'meal_shopping_list', true ); |
|
60 | - if ( ! empty( $shopping_list ) ) { |
|
59 | + $shopping_list = get_post_meta(get_the_ID(), 'meal_shopping_list', true); |
|
60 | + if ( ! empty($shopping_list)) { |
|
61 | 61 | ?> |
62 | - <a class="btn border-btn btn-shopping" href="<?php echo esc_url( get_page_link( $shopping_list ) ); ?>" target="_blank"><?php esc_html_e( 'Download Shopping List', 'lsx-health-plan' ); ?><i class="fa fa-download" aria-hidden="true"></i></a> |
|
62 | + <a class="btn border-btn btn-shopping" href="<?php echo esc_url(get_page_link($shopping_list)); ?>" target="_blank"><?php esc_html_e('Download Shopping List', 'lsx-health-plan'); ?><i class="fa fa-download" aria-hidden="true"></i></a> |
|
63 | 63 | <?php |
64 | 64 | } |
65 | 65 | |
@@ -67,6 +67,6 @@ discard block |
||
67 | 67 | </div> |
68 | 68 | |
69 | 69 | <?php |
70 | -if ( ! empty( $connected_articles ) ) { |
|
71 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
70 | +if ( ! empty($connected_articles)) { |
|
71 | + lsx_hp_single_related($connected_articles, __('Related articles', 'lsx-health-plan')); |
|
72 | 72 | } |