Passed
Push — dependabot/github_actions/acti... ( 833a24 )
by
unknown
16:56 queued 10:40
created
classes/post-types/class-exercise.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -31,26 +31,26 @@  discard block
 block discarded – undo
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( 'wpseo_breadcrumb_links', array( $this, 'exercise_breadcrumb_filter' ), 30, 1 );
53
-			add_filter( 'woocommerce_get_breadcrumb', array( $this, 'exercise_breadcrumb_filter' ), 30, 1 );
52
+			add_filter('wpseo_breadcrumb_links', array($this, 'exercise_breadcrumb_filter'), 30, 1);
53
+			add_filter('woocommerce_get_breadcrumb', array($this, 'exercise_breadcrumb_filter'), 30, 1);
54 54
 
55 55
 		}
56 56
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public static function get_instance() {
68 68
 		// If the single instance hasn't been set, set it now.
69
-		if ( null === self::$instance ) {
69
+		if (null === self::$instance) {
70 70
 			self::$instance = new self();
71 71
 		}
72 72
 		return self::$instance;
@@ -76,21 +76,21 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function register_post_type() {
78 78
 		$labels = array(
79
-			'name'               => esc_html__( 'Exercises', 'lsx-health-plan' ),
80
-			'singular_name'      => esc_html__( 'Exercise', 'lsx-health-plan' ),
81
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
82
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
83
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
84
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
85
-			'all_items'          => esc_html__( 'All Exercises', 'lsx-health-plan' ),
86
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
87
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
88
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
89
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
79
+			'name'               => esc_html__('Exercises', 'lsx-health-plan'),
80
+			'singular_name'      => esc_html__('Exercise', 'lsx-health-plan'),
81
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
82
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
83
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
84
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
85
+			'all_items'          => esc_html__('All Exercises', 'lsx-health-plan'),
86
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
87
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
88
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
89
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
90 90
 			'parent_item_colon'  => '',
91
-			'menu_name'          => esc_html__( 'Exercises', 'lsx-health-plan' ),
91
+			'menu_name'          => esc_html__('Exercises', 'lsx-health-plan'),
92 92
 		);
93
-		$args   = array(
93
+		$args = array(
94 94
 			'labels'             => $labels,
95 95
 			'public'             => true,
96 96
 			'publicly_queryable' => true,
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 			'menu_icon'          => 'dashicons-universal-access',
101 101
 			'query_var'          => true,
102 102
 			'rewrite'            => array(
103
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ),
103
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'),
104 104
 			),
105 105
 			'capability_type'    => 'page',
106
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercises' ),
106
+			'has_archive'        => \lsx_health_plan\functions\get_option('endpoint_exercise_archive', 'exercises'),
107 107
 			'hierarchical'       => false,
108 108
 			'menu_position'      => null,
109 109
 			'supports'           => array(
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 				'custom-fields',
115 115
 			),
116 116
 		);
117
-		register_post_type( 'exercise', $args );
117
+		register_post_type('exercise', $args);
118 118
 	}
119 119
 
120 120
 	/**
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function exercise_type_taxonomy_setup() {
126 126
 		$labels = array(
127
-			'name'              => esc_html_x( 'Exercise Type', 'taxonomy general name', 'lsx-health-plan' ),
128
-			'singular_name'     => esc_html_x( 'Exercise Type', 'taxonomy singular name', 'lsx-health-plan' ),
129
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
130
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
131
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
132
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
133
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
134
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
135
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
136
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
137
-			'menu_name'         => esc_html__( 'Exercise Types', 'lsx-health-plan' ),
127
+			'name'              => esc_html_x('Exercise Type', 'taxonomy general name', 'lsx-health-plan'),
128
+			'singular_name'     => esc_html_x('Exercise Type', 'taxonomy singular name', 'lsx-health-plan'),
129
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
130
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
131
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
132
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
133
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
134
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
135
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
136
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
137
+			'menu_name'         => esc_html__('Exercise Types', 'lsx-health-plan'),
138 138
 		);
139 139
 
140 140
 		$args = array(
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
 			'show_admin_column' => true,
145 145
 			'query_var'         => true,
146 146
 			'rewrite'           => array(
147
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_type', 'exercise-type' ),
147
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_type', 'exercise-type'),
148 148
 			),
149 149
 			'show_in_rest'      => true,
150 150
 		);
151 151
 
152
-		register_taxonomy( 'exercise-type', array( 'exercise' ), $args );
152
+		register_taxonomy('exercise-type', array('exercise'), $args);
153 153
 	}
154 154
 
155 155
 	/**
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function equipment_taxonomy_setup() {
161 161
 		$labels = array(
162
-			'name'              => esc_html_x( 'Equipment', 'taxonomy general name', 'lsx-health-plan' ),
163
-			'singular_name'     => esc_html_x( 'Equipment', 'taxonomy singular name', 'lsx-health-plan' ),
164
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
165
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
166
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
167
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
168
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
169
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
170
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
171
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
172
-			'menu_name'         => esc_html__( 'Equipment', 'lsx-health-plan' ),
162
+			'name'              => esc_html_x('Equipment', 'taxonomy general name', 'lsx-health-plan'),
163
+			'singular_name'     => esc_html_x('Equipment', 'taxonomy singular name', 'lsx-health-plan'),
164
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
165
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
166
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
167
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
168
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
169
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
170
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
171
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
172
+			'menu_name'         => esc_html__('Equipment', 'lsx-health-plan'),
173 173
 		);
174 174
 
175 175
 		$args = array(
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
 			'show_admin_column' => true,
180 180
 			'query_var'         => true,
181 181
 			'rewrite'           => array(
182
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_equipment', 'equipment' ),
182
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_equipment', 'equipment'),
183 183
 			),
184 184
 			'show_in_rest'      => true,
185 185
 		);
186 186
 
187
-		register_taxonomy( 'equipment', array( 'exercise' ), $args );
187
+		register_taxonomy('equipment', array('exercise'), $args);
188 188
 	}
189 189
 
190 190
 	/**
@@ -194,17 +194,17 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	public function muscle_group_taxonomy_setup() {
196 196
 		$labels = array(
197
-			'name'              => esc_html_x( 'Muscle Groups', 'taxonomy general name', 'lsx-health-plan' ),
198
-			'singular_name'     => esc_html_x( 'Muscle Group', 'taxonomy singular name', 'lsx-health-plan' ),
199
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
200
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
201
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
202
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
203
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
204
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
205
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
206
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
207
-			'menu_name'         => esc_html__( 'Muscle Groups', 'lsx-health-plan' ),
197
+			'name'              => esc_html_x('Muscle Groups', 'taxonomy general name', 'lsx-health-plan'),
198
+			'singular_name'     => esc_html_x('Muscle Group', 'taxonomy singular name', 'lsx-health-plan'),
199
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
200
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
201
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
202
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
203
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
204
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
205
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
206
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
207
+			'menu_name'         => esc_html__('Muscle Groups', 'lsx-health-plan'),
208 208
 		);
209 209
 
210 210
 		$args = array(
@@ -214,12 +214,12 @@  discard block
 block discarded – undo
214 214
 			'show_admin_column' => true,
215 215
 			'query_var'         => true,
216 216
 			'rewrite'           => array(
217
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_musclegroup', 'muscle-group' ),
217
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_musclegroup', 'muscle-group'),
218 218
 			),
219 219
 			'show_in_rest'      => true,
220 220
 		);
221 221
 
222
-		register_taxonomy( 'muscle-group', array( 'exercise' ), $args );
222
+		register_taxonomy('muscle-group', array('exercise'), $args);
223 223
 	}
224 224
 
225 225
 	/**
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 	 * @return void
229 229
 	 */
230 230
 	public function register_menus() {
231
-		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' );
232
-		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' );
233
-		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' );
234
-		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' );
231
+		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');
232
+		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');
233
+		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');
234
+		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');
235 235
 	}
236 236
 
237 237
 	/**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * @param array $post_types
241 241
 	 * @return array
242 242
 	 */
243
-	public function enable_post_type( $post_types = array() ) {
243
+	public function enable_post_type($post_types = array()) {
244 244
 		$post_types[] = $this->slug;
245 245
 		return $post_types;
246 246
 	}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * @param array $connections
252 252
 	 * @return void
253 253
 	 */
254
-	public function enable_connections( $connections = array() ) {
254
+	public function enable_connections($connections = array()) {
255 255
 		$connections['exercise']['connected_workouts'] = 'connected_exercises';
256 256
 		$connections['workout']['connected_exercises'] = 'connected_workouts';
257 257
 		return $connections;
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 		$cmb = new_cmb2_box(
265 265
 			array(
266 266
 				'id'           => $this->slug . '_gallery_details_metabox',
267
-				'title'        => __( 'Exercise Gallery', 'lsx-health-plan' ),
268
-				'object_types' => array( $this->slug ),
267
+				'title'        => __('Exercise Gallery', 'lsx-health-plan'),
268
+				'object_types' => array($this->slug),
269 269
 				'context'      => 'normal',
270 270
 				'priority'     => 'low',
271 271
 				'show_names'   => true,
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 
275 275
 		$cmb->add_field(
276 276
 			array(
277
-				'name'    => __( 'Layout', 'lsx-health-plan' ),
277
+				'name'    => __('Layout', 'lsx-health-plan'),
278 278
 				'id'      => $this->slug . '_gallery_layout',
279 279
 				'type'    => 'radio',
280 280
 				'options' => array(
281
-					'slider' => __( 'Slider', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number
282
-					'grid'   => __( 'Grid', 'lsx-health-plan' ),
281
+					'slider' => __('Slider', 'lsx-health-plan') . ' {#}', // {#} gets replaced by row number
282
+					'grid'   => __('Grid', 'lsx-health-plan'),
283 283
 				),
284 284
 				'default' => 'grid',
285 285
 			)
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
 
288 288
 		$cmb->add_field(
289 289
 			array(
290
-				'name'    => __( 'Grid Columns', 'lsx-health-plan' ),
290
+				'name'    => __('Grid Columns', 'lsx-health-plan'),
291 291
 				'id'      => $this->slug . '_gallery_columns',
292 292
 				'type'    => 'select',
293 293
 				'options' => array(
294
-					'3' => __( '2 Columns', 'lsx-health-plan' ),
295
-					'4' => __( '3 Columns', 'lsx-health-plan' ),
294
+					'3' => __('2 Columns', 'lsx-health-plan'),
295
+					'4' => __('3 Columns', 'lsx-health-plan'),
296 296
 				),
297 297
 				'default' => '1',
298 298
 			)
@@ -304,12 +304,12 @@  discard block
 block discarded – undo
304 304
 				'id'      => $this->slug . '_gallery',
305 305
 				'type'    => 'group',
306 306
 				'options' => array(
307
-					'group_title'   => __( 'Gallery', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number
308
-					'add_button'    => __( 'Add Item', 'lsx-health-plan' ),
309
-					'remove_button' => __( 'Remove Item', 'lsx-health-plan' ),
307
+					'group_title'   => __('Gallery', 'lsx-health-plan') . ' {#}', // {#} gets replaced by row number
308
+					'add_button'    => __('Add Item', 'lsx-health-plan'),
309
+					'remove_button' => __('Remove Item', 'lsx-health-plan'),
310 310
 					'sortable'      => true,
311 311
 				),
312
-				'desc'    => __( 'Upload only one image, video or gif per gallery group, each group will only display 1 item.', 'lsx-health-plan' ),
312
+				'desc'    => __('Upload only one image, video or gif per gallery group, each group will only display 1 item.', 'lsx-health-plan'),
313 313
 				'classes' => 'lsx-admin-row',
314 314
 			)
315 315
 		);
@@ -318,13 +318,13 @@  discard block
 block discarded – undo
318 318
 		$cmb->add_group_field(
319 319
 			$gallery_group,
320 320
 			array(
321
-				'name'       => __( 'Image', 'lsx-health-plan' ),
321
+				'name'       => __('Image', 'lsx-health-plan'),
322 322
 				'id'         => $this->slug . '_gallery_image',
323 323
 				'type'       => 'file',
324 324
 				'text'       => array(
325
-					'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ),
325
+					'add_upload_file_text' => __('Add File', 'lsx-health-plan'),
326 326
 				),
327
-				'desc'       => __( 'Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan' ),
327
+				'desc'       => __('Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan'),
328 328
 				'query_args' => array(
329 329
 					'type' => array(
330 330
 						'image/gif',
@@ -341,10 +341,10 @@  discard block
 block discarded – undo
341 341
 		$cmb->add_group_field(
342 342
 			$gallery_group,
343 343
 			array(
344
-				'name'    => __( 'oEmbed', 'lsx-health-plan' ),
344
+				'name'    => __('oEmbed', 'lsx-health-plan'),
345 345
 				'id'      => $this->slug . '_gallery_embed',
346 346
 				'type'    => 'text',
347
-				'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' ),
347
+				'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'),
348 348
 				'classes' => 'test-apply-form lsx-field-col lsx-field-col-50',
349 349
 			)
350 350
 		);
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
 		$cmb->add_group_field(
353 353
 			$gallery_group,
354 354
 			array(
355
-				'name'    => __( 'External Media', 'lsx-health-plan' ),
355
+				'name'    => __('External Media', 'lsx-health-plan'),
356 356
 				'id'      => $this->slug . '_gallery_external',
357 357
 				'type'    => 'textarea_code',
358
-				'desc'    => __( 'Drop in the iFrame embed code from Giphy in this field, i.e: &lt;iframe src="https://giphy.com/embed/3o7527Rn1HxXWqgxuo" width="480" height="270" frameborder="0" class="giphy-embed" allowfullscreen&gt;&lt;/iframe&gt;', 'lsx-health-plan' ),
358
+				'desc'    => __('Drop in the iFrame embed code from Giphy in this field, i.e: &lt;iframe src="https://giphy.com/embed/3o7527Rn1HxXWqgxuo" width="480" height="270" frameborder="0" class="giphy-embed" allowfullscreen&gt;&lt;/iframe&gt;', 'lsx-health-plan'),
359 359
 				'classes' => 'lsx-field-col lsx-field-col-50',
360 360
 			)
361 361
 		);
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 		$cmb = new_cmb2_box(
371 371
 			array(
372 372
 				'id'           => $this->slug . '_general_details_metabox',
373
-				'title'        => __( 'Details', 'lsx-health-plan' ),
374
-				'object_types' => array( $this->slug ),
373
+				'title'        => __('Details', 'lsx-health-plan'),
374
+				'object_types' => array($this->slug),
375 375
 				'context'      => 'normal',
376 376
 				'priority'     => 'high',
377 377
 				'show_names'   => true,
@@ -380,15 +380,15 @@  discard block
 block discarded – undo
380 380
 
381 381
 		$cmb->add_field(
382 382
 			array(
383
-				'name'    => __( 'Side', 'lsx-health-plan' ),
383
+				'name'    => __('Side', 'lsx-health-plan'),
384 384
 				'id'      => $this->slug . '_side',
385 385
 				'type'    => 'select',
386 386
 				'options' => array(
387
-					''      => __( 'Select', 'lsx-health-plan' ),
388
-					'left'  => __( 'Left', 'lsx-health-plan' ),
389
-					'right' => __( 'Right', 'lsx-health-plan' ),
387
+					''      => __('Select', 'lsx-health-plan'),
388
+					'left'  => __('Left', 'lsx-health-plan'),
389
+					'right' => __('Right', 'lsx-health-plan'),
390 390
 				),
391
-				'desc'    => __( 'Select which side this exercise uses. ', 'lsx-health-plan' ),
391
+				'desc'    => __('Select which side this exercise uses. ', 'lsx-health-plan'),
392 392
 			)
393 393
 		);
394 394
 	}
@@ -399,21 +399,21 @@  discard block
 block discarded – undo
399 399
 	 * @var array $crumbs
400 400
 	 * @return array
401 401
 	 */
402
-	public function exercise_breadcrumb_filter( $crumbs ) {
403
-		$exercise  = \lsx_health_plan\functions\get_option( 'endpoint_exercise', 'exercise' );
404
-		$exercises = \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercise' );
405
-		$url       = get_post_type_archive_link( $exercise );
402
+	public function exercise_breadcrumb_filter($crumbs) {
403
+		$exercise  = \lsx_health_plan\functions\get_option('endpoint_exercise', 'exercise');
404
+		$exercises = \lsx_health_plan\functions\get_option('endpoint_exercise_archive', 'exercise');
405
+		$url       = get_post_type_archive_link($exercise);
406 406
 
407
-		if ( is_singular( 'exercise' ) ) {
407
+		if (is_singular('exercise')) {
408 408
 			$exercise_name     = get_the_title();	
409
-			$term_obj_list     = get_the_terms( get_the_ID(), 'exercise-type' );
409
+			$term_obj_list     = get_the_terms(get_the_ID(), 'exercise-type');
410 410
 			$exercise_type     = $term_obj_list[0]->name;
411
-			$exercise_type_url = get_term_link( $term_obj_list[0]->term_id );
411
+			$exercise_type_url = get_term_link($term_obj_list[0]->term_id);
412 412
 
413 413
 			$new_crumbs    = array();
414 414
 			$new_crumbs[0] = $crumbs[0];
415 415
 
416
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
416
+			if (function_exists('woocommerce_breadcrumb')) {
417 417
 				$new_crumbs[1] = array(
418 418
 					0 => $exercises,
419 419
 					1 => $url,
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
 			$crumbs = $new_crumbs;
442 442
 		
443 443
 		}
444
-		if ( is_tax( 'exercise-type' ) || is_tax( 'muscle-group' ) || is_tax( 'equipment' ) ) {
445
-			$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
444
+		if (is_tax('exercise-type') || is_tax('muscle-group') || is_tax('equipment')) {
445
+			$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); 
446 446
 
447
-			$single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name;
447
+			$single_term_title = str_replace('-', ' ', $term->taxonomy) . ': ' . $term->name;
448 448
 
449 449
 			$new_crumbs    = array();
450 450
 			$new_crumbs[0] = $crumbs[0];
451 451
 
452
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
452
+			if (function_exists('woocommerce_breadcrumb')) {
453 453
 				$new_crumbs[1] = array(
454 454
 					0 => $exercises,
455 455
 					1 => $url,
@@ -469,12 +469,12 @@  discard block
 block discarded – undo
469 469
 			$crumbs = $new_crumbs;
470 470
 
471 471
 		}
472
-		if ( is_post_type_archive( 'exercise' ) ) {
472
+		if (is_post_type_archive('exercise')) {
473 473
 
474 474
 			$new_crumbs    = array();
475 475
 			$new_crumbs[0] = $crumbs[0];
476 476
 
477
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
477
+			if (function_exists('woocommerce_breadcrumb')) {
478 478
 				$new_crumbs[1] = array(
479 479
 					0 => $exercises,
480 480
 				);
Please login to merge, or discard this patch.
classes/post-types/class-workout.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -32,21 +32,21 @@  discard block
 block discarded – undo
32 32
 	 * Constructor
33 33
 	 */
34 34
 	public function __construct() {
35
-		add_action( 'init', array( $this, 'register_post_type' ) );
36
-		add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
37
-		add_action( 'init', array( $this, 'workout_type_taxonomy_setup' ) );
38
-		add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
39
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 );
40
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
41
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
35
+		add_action('init', array($this, 'register_post_type'));
36
+		add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1);
37
+		add_action('init', array($this, 'workout_type_taxonomy_setup'));
38
+		add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1);
39
+		add_action('cmb2_admin_init', array($this, 'featured_metabox'), 5);
40
+		add_action('cmb2_admin_init', array($this, 'details_metaboxes'));
41
+		add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100);
42 42
 
43 43
 		// Template Redirects.
44
-		add_action( 'pre_get_posts', array( $this, 'set_parent_only' ), 10, 1 );
45
-		add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
44
+		add_action('pre_get_posts', array($this, 'set_parent_only'), 10, 1);
45
+		add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1);
46 46
 
47 47
 		//Breadcrumbs
48
-		add_filter( 'wpseo_breadcrumb_links', array( $this, 'workout_breadcrumb_filter' ), 30, 1 );
49
-		add_filter( 'woocommerce_get_breadcrumb', array( $this, 'workout_breadcrumb_filter' ), 30, 1 );
48
+		add_filter('wpseo_breadcrumb_links', array($this, 'workout_breadcrumb_filter'), 30, 1);
49
+		add_filter('woocommerce_get_breadcrumb', array($this, 'workout_breadcrumb_filter'), 30, 1);
50 50
 	}
51 51
 
52 52
 	/**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public static function get_instance() {
60 60
 		// If the single instance hasn't been set, set it now.
61
-		if ( null === self::$instance ) {
61
+		if (null === self::$instance) {
62 62
 			self::$instance = new self();
63 63
 		}
64 64
 		return self::$instance;
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function register_post_type() {
70 70
 		$labels = array(
71
-			'name'               => esc_html__( 'Workouts', 'lsx-health-plan' ),
72
-			'singular_name'      => esc_html__( 'Workout', 'lsx-health-plan' ),
73
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
74
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
75
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
76
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
77
-			'all_items'          => esc_html__( 'All Workouts', 'lsx-health-plan' ),
78
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
79
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
80
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
81
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
82
-			'parent_item_colon'  => esc_html__( 'Parent:', 'lsx-health-plan' ),
83
-			'menu_name'          => esc_html__( 'Workouts', 'lsx-health-plan' ),
71
+			'name'               => esc_html__('Workouts', 'lsx-health-plan'),
72
+			'singular_name'      => esc_html__('Workout', 'lsx-health-plan'),
73
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
74
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
75
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
76
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
77
+			'all_items'          => esc_html__('All Workouts', 'lsx-health-plan'),
78
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
79
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
80
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
81
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
82
+			'parent_item_colon'  => esc_html__('Parent:', 'lsx-health-plan'),
83
+			'menu_name'          => esc_html__('Workouts', 'lsx-health-plan'),
84 84
 		);
85 85
 		$args = array(
86 86
 			'labels'             => $labels,
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 			'menu_icon'          => 'dashicons-universal-access',
93 93
 			'query_var'          => true,
94 94
 			'rewrite'            => array(
95
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ),
95
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'),
96 96
 			),
97 97
 			'capability_type'    => 'page',
98
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_workout_archive', 'workouts' ),
98
+			'has_archive'        => \lsx_health_plan\functions\get_option('endpoint_workout_archive', 'workouts'),
99 99
 			'hierarchical'       => true,
100 100
 			'menu_position'      => null,
101 101
 			'supports'           => array(
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 				'custom-fields',
108 108
 			),
109 109
 		);
110
-		register_post_type( 'workout', $args );
110
+		register_post_type('workout', $args);
111 111
 	}
112 112
 
113 113
 	/**
@@ -115,17 +115,17 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function workout_type_taxonomy_setup() {
117 117
 		$labels = array(
118
-			'name'              => esc_html_x( 'Workout Type', 'taxonomy general name', 'lsx-health-plan' ),
119
-			'singular_name'     => esc_html_x( 'Workout Type', 'taxonomy singular name', 'lsx-health-plan' ),
120
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
121
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
122
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
123
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
124
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
125
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
126
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
127
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
128
-			'menu_name'         => esc_html__( 'Workout Types', 'lsx-health-plan' ),
118
+			'name'              => esc_html_x('Workout Type', 'taxonomy general name', 'lsx-health-plan'),
119
+			'singular_name'     => esc_html_x('Workout Type', 'taxonomy singular name', 'lsx-health-plan'),
120
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
121
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
122
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
123
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
124
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
125
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
126
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
127
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
128
+			'menu_name'         => esc_html__('Workout Types', 'lsx-health-plan'),
129 129
 		);
130 130
 
131 131
 		$args = array(
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 			),
140 140
 		);
141 141
 
142
-		register_taxonomy( 'workout-type', array( 'workout' ), $args );
142
+		register_taxonomy('workout-type', array('workout'), $args);
143 143
 	}
144 144
 
145 145
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param array $post_types
149 149
 	 * @return array
150 150
 	 */
151
-	public function enable_post_type( $post_types = array() ) {
151
+	public function enable_post_type($post_types = array()) {
152 152
 		$post_types[] = $this->slug;
153 153
 		return $post_types;
154 154
 	}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param array $connections
160 160
 	 * @return void
161 161
 	 */
162
-	public function enable_connections( $connections = array() ) {
162
+	public function enable_connections($connections = array()) {
163 163
 		$connections['workout']['connected_plans'] = 'connected_workouts';
164 164
 		$connections['plan']['connected_workouts'] = 'connected_plans';
165 165
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 	 * @param string $title the term title.
178 178
 	 * @return string
179 179
 	 */
180
-	public function get_the_archive_title( $title ) {
181
-		if ( is_post_type_archive( 'workout' ) ) {
182
-			$title = __( 'Workouts', 'lsx-health-plan' );
180
+	public function get_the_archive_title($title) {
181
+		if (is_post_type_archive('workout')) {
182
+			$title = __('Workouts', 'lsx-health-plan');
183 183
 		}
184 184
 		return $title;
185 185
 	}
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 		$cmb = new_cmb2_box(
192 192
 			array(
193 193
 				'id'           => $this->slug . '_featured_metabox_workout',
194
-				'title'        => __( 'Featured Workout', 'lsx-health-plan' ),
195
-				'object_types' => array( $this->slug ), // Post type
194
+				'title'        => __('Featured Workout', 'lsx-health-plan'),
195
+				'object_types' => array($this->slug), // Post type
196 196
 				'context'      => 'side',
197 197
 				'priority'     => 'high',
198 198
 				'show_names'   => true,
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 		);
201 201
 		$cmb->add_field(
202 202
 			array(
203
-				'name'       => __( 'Featured Workout', 'lsx-health-plan' ),
204
-				'desc'       => __( 'Enable a featured workout' ),
203
+				'name'       => __('Featured Workout', 'lsx-health-plan'),
204
+				'desc'       => __('Enable a featured workout'),
205 205
 				'id'         => $this->slug . '_featured_workout',
206 206
 				'type'       => 'checkbox',
207 207
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -214,43 +214,43 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	public function details_metaboxes() {
216 216
 
217
-		$cmb = new_cmb2_box( array(
217
+		$cmb = new_cmb2_box(array(
218 218
 			'id'           => $this->slug . '_details_metabox',
219
-			'title'        => __( 'Workout Details', 'lsx-health-plan' ),
220
-			'object_types' => array( $this->slug ), // Post type
219
+			'title'        => __('Workout Details', 'lsx-health-plan'),
220
+			'object_types' => array($this->slug), // Post type
221 221
 			'context'      => 'normal',
222 222
 			'priority'     => 'high',
223 223
 			'show_names'   => true,
224
-		) );
224
+		));
225 225
 
226
-		$cmb->add_field( array(
227
-			'name' => __( 'Workout Short Description', 'lsx-health-plan' ),
226
+		$cmb->add_field(array(
227
+			'name' => __('Workout Short Description', 'lsx-health-plan'),
228 228
 			'id'   => $this->slug . '_short_description',
229 229
 			'type' => 'textarea_small',
230
-			'desc' => __( 'Add a small description for this workout (optional)', 'lsx-health-plan' ),
231
-		) );
230
+			'desc' => __('Add a small description for this workout (optional)', 'lsx-health-plan'),
231
+		));
232 232
 
233
-		$workout_sections = apply_filters( 'lsx_health_plan_workout_sections_amount', 6 );
234
-		if ( false !== $workout_sections && null !== $workout_sections ) {
233
+		$workout_sections = apply_filters('lsx_health_plan_workout_sections_amount', 6);
234
+		if (false !== $workout_sections && null !== $workout_sections) {
235 235
 			$i = 1;
236
-			while ( $i <= $workout_sections ) {
236
+			while ($i <= $workout_sections) {
237 237
 
238
-				$cmb_group = new_cmb2_box( array(
238
+				$cmb_group = new_cmb2_box(array(
239 239
 					'id'           => $this->slug . '_section_' . $i . '_metabox',
240
-					'title'        => esc_html__( 'Exercise Group ', 'lsx-health-plan' ) . $i,
241
-					'object_types' => array( $this->slug ),
242
-				) );
240
+					'title'        => esc_html__('Exercise Group ', 'lsx-health-plan') . $i,
241
+					'object_types' => array($this->slug),
242
+				));
243 243
 
244
-				$cmb_group->add_field( array(
245
-					'name'       => __( 'Title', 'lsx-health-plan' ),
244
+				$cmb_group->add_field(array(
245
+					'name'       => __('Title', 'lsx-health-plan'),
246 246
 					'id'         => $this->slug . '_section_' . $i . '_title',
247 247
 					'type'       => 'text',
248 248
 					'show_on_cb' => 'cmb2_hide_if_no_cats',
249
-				) );
249
+				));
250 250
 
251 251
 				$cmb_group->add_field(
252 252
 					array(
253
-						'name'       => __( 'Description', 'lsx-health-plan' ),
253
+						'name'       => __('Description', 'lsx-health-plan'),
254 254
 						'id'         => $this->slug . '_section_' . $i . '_description',
255 255
 						'type'       => 'wysiwyg',
256 256
 						'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -269,28 +269,28 @@  discard block
 block discarded – undo
269 269
 						'id'      => $this->slug . '_section_' . $i,
270 270
 						'type'    => 'group',
271 271
 						'options' => array(
272
-							'group_title'   => esc_html__( 'Exercise {#}', 'lsx-health-plan' ), // {#} gets replaced by row number
273
-							'add_button'    => esc_html__( 'Add New', 'lsx-health-plan' ),
274
-							'remove_button' => esc_html__( 'Delete', 'lsx-health-plan' ),
272
+							'group_title'   => esc_html__('Exercise {#}', 'lsx-health-plan'), // {#} gets replaced by row number
273
+							'add_button'    => esc_html__('Add New', 'lsx-health-plan'),
274
+							'remove_button' => esc_html__('Delete', 'lsx-health-plan'),
275 275
 							'sortable'      => true,
276 276
 							'closed'        => true, // true to have the groups closed by default
277 277
 						),
278 278
 					)
279 279
 				);
280 280
 
281
-				if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
281
+				if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
282 282
 					$cmb_group->add_group_field(
283 283
 						$group_field_id,
284 284
 						array(
285
-							'name'       => __( 'Exercise related to this workout', 'lsx-health-plan' ),
285
+							'name'       => __('Exercise related to this workout', 'lsx-health-plan'),
286 286
 							'id'         => 'connected_exercises',
287 287
 							'type'       => 'post_search_ajax',
288 288
 							// Optional :
289 289
 							'limit'      => 1, // Limit selection to X items only (default 1)
290
-							'sortable'   => true,  // Allow selected items to be sortable (default false)
290
+							'sortable'   => true, // Allow selected items to be sortable (default false)
291 291
 							'query_args' => array(
292
-								'post_type'      => array( 'exercise' ),
293
-								'post_status'    => array( 'publish' ),
292
+								'post_type'      => array('exercise'),
293
+								'post_status'    => array('publish'),
294 294
 								'posts_per_page' => -1,
295 295
 							),
296 296
 						)
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 					$cmb_group->add_group_field(
300 300
 						$group_field_id,
301 301
 						array(
302
-							'name'       => __( 'Video related to this workout', 'lsx-health-plan' ),
302
+							'name'       => __('Video related to this workout', 'lsx-health-plan'),
303 303
 							'id'         => 'connected_videos',
304 304
 							'type'       => 'post_search_ajax',
305 305
 							// Optional :
306 306
 							'limit'      => 1, // Limit selection to X items only (default 1)
307
-							'sortable'   => true,  // Allow selected items to be sortable (default false)
307
+							'sortable'   => true, // Allow selected items to be sortable (default false)
308 308
 							'query_args' => array(
309
-								'post_type'      => array( 'video' ),
310
-								'post_status'    => array( 'publish' ),
309
+								'post_type'      => array('video'),
310
+								'post_status'    => array('publish'),
311 311
 								'posts_per_page' => -1,
312 312
 							),
313 313
 						)
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 					$cmb_group->add_group_field(
316 316
 						$group_field_id,
317 317
 						array(
318
-							'name' => esc_html__( 'Workout Name', 'lsx-health-plan' ),
318
+							'name' => esc_html__('Workout Name', 'lsx-health-plan'),
319 319
 							'id'   => 'name',
320 320
 							'type' => 'text',
321 321
 							// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 					$cmb_group->add_group_field(
326 326
 						$group_field_id,
327 327
 						array(
328
-							'name'    => __( 'Description', 'lsx-health-plan' ),
328
+							'name'    => __('Description', 'lsx-health-plan'),
329 329
 							'id'      => 'description',
330 330
 							'type'    => 'wysiwyg',
331 331
 							'options' => array(
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 				$cmb_group->add_group_field(
339 339
 					$group_field_id,
340 340
 					array(
341
-						'name' => esc_html__( 'Exercise title (Optional)', 'lsx-health-plan' ),
341
+						'name' => esc_html__('Exercise title (Optional)', 'lsx-health-plan'),
342 342
 						'id'   => 'alt_title',
343 343
 						'type' => 'text',
344 344
 					)
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 				$cmb_group->add_group_field(
347 347
 					$group_field_id,
348 348
 					array(
349
-						'name' => esc_html__( 'Exercise Description (Optional)', 'lsx-health-plan' ),
349
+						'name' => esc_html__('Exercise Description (Optional)', 'lsx-health-plan'),
350 350
 						'id'   => 'alt_description',
351 351
 						'type' => 'textarea_small',
352 352
 					)
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 				$cmb_group->add_group_field(
355 355
 					$group_field_id,
356 356
 					array(
357
-						'name' => esc_html__( 'Reps / Time / Distance', 'lsx-health-plan' ),
357
+						'name' => esc_html__('Reps / Time / Distance', 'lsx-health-plan'),
358 358
 						'id'   => 'reps',
359 359
 						'type' => 'text',
360 360
 						// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
@@ -363,13 +363,13 @@  discard block
 block discarded – undo
363 363
 				$cmb_group->add_group_field(
364 364
 					$group_field_id,
365 365
 					array(
366
-						'name'         => __( 'Exercise Image (Optional)', 'lsx-health-plan' ),
366
+						'name'         => __('Exercise Image (Optional)', 'lsx-health-plan'),
367 367
 						'id'           => 'exercise_alt_thumbnail',
368 368
 						'type'         => 'file',
369 369
 						'text'         => array(
370
-							'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ),
370
+							'add_upload_file_text' => __('Add File', 'lsx-health-plan'),
371 371
 						),
372
-						'desc'         => __( 'Upload an image 300px x 300px in size.', 'lsx-health-plan' ),
372
+						'desc'         => __('Upload an image 300px x 300px in size.', 'lsx-health-plan'),
373 373
 						'query_args'   => array(
374 374
 							'type' => array(
375 375
 								'image/gif',
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 	 * @param object $wp_query
393 393
 	 * @return array
394 394
 	 */
395
-	public function set_parent_only( $wp_query ) {
396
-		if ( ! is_admin() && $wp_query->is_main_query() && ( $wp_query->is_post_type_archive( 'workout' ) || $wp_query->is_tax( array( 'workout-type' ) ) ) ) {
397
-			$wp_query->set( 'post_parent', '0' );
395
+	public function set_parent_only($wp_query) {
396
+		if ( ! is_admin() && $wp_query->is_main_query() && ($wp_query->is_post_type_archive('workout') || $wp_query->is_tax(array('workout-type')))) {
397
+			$wp_query->set('post_parent', '0');
398 398
 		}
399 399
 	}
400 400
 
@@ -404,24 +404,24 @@  discard block
 block discarded – undo
404 404
 	 * @var array $crumbs
405 405
 	 * @return array
406 406
 	 */
407
-	public function workout_breadcrumb_filter( $crumbs ) {
408
-		$workout  = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' );
409
-		$workouts = \lsx_health_plan\functions\get_option( 'endpoint_workout_archive', 'workout' );
407
+	public function workout_breadcrumb_filter($crumbs) {
408
+		$workout  = \lsx_health_plan\functions\get_option('endpoint_workout', 'workout');
409
+		$workouts = \lsx_health_plan\functions\get_option('endpoint_workout_archive', 'workout');
410 410
 
411
-		if ( is_singular( 'workout' ) ) {	
411
+		if (is_singular('workout')) {	
412 412
 			$workout_name  = get_the_title();
413
-			$url           = get_post_type_archive_link( $workout );
414
-			$term_obj_list = get_the_terms( get_the_ID(), 'workout-type' );
413
+			$url           = get_post_type_archive_link($workout);
414
+			$term_obj_list = get_the_terms(get_the_ID(), 'workout-type');
415 415
 			$workout_type  = $term_obj_list[0]->name;
416
-			if ( empty( $workout_type ) ) {
417
-				$workout_type = __( 'Workout', 'lsx-health-plan' );
416
+			if (empty($workout_type)) {
417
+				$workout_type = __('Workout', 'lsx-health-plan');
418 418
 			}
419
-			$workout_type_url = get_term_link( $term_obj_list[0]->term_id );
419
+			$workout_type_url = get_term_link($term_obj_list[0]->term_id);
420 420
 
421 421
 			$new_crumbs    = array();
422 422
 			$new_crumbs[0] = $crumbs[0];
423 423
 
424
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
424
+			if (function_exists('woocommerce_breadcrumb')) {
425 425
 				$new_crumbs[1] = array(
426 426
 					0 => $workouts,
427 427
 					1 => $url,
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
 			$crumbs = $new_crumbs;
450 450
 
451 451
 		}
452
-		if ( is_post_type_archive( 'workout' ) ) {
452
+		if (is_post_type_archive('workout')) {
453 453
 
454 454
 			$new_crumbs    = array();
455 455
 			$new_crumbs[0] = $crumbs[0];
456 456
 
457
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
457
+			if (function_exists('woocommerce_breadcrumb')) {
458 458
 				$new_crumbs[1] = array(
459 459
 					0 => $workouts,
460 460
 				);
Please login to merge, or discard this patch.
classes/post-types/class-recipe.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -39,27 +39,27 @@  discard block
 block discarded – undo
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 );
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 55
 
56 56
 		//Breadcrumbs
57
-		add_filter( 'wpseo_breadcrumb_links', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 );
58
-		add_filter( 'woocommerce_get_breadcrumb', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 );
57
+		add_filter('wpseo_breadcrumb_links', array($this, 'recipes_breadcrumb_filter'), 30, 1);
58
+		add_filter('woocommerce_get_breadcrumb', array($this, 'recipes_breadcrumb_filter'), 30, 1);
59 59
 
60 60
 		// Backend Actions and Filters.
61
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) );
62
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
61
+		add_action('cmb2_admin_init', array($this, 'featured_metabox'));
62
+		add_action('cmb2_admin_init', array($this, 'details_metaboxes'));
63 63
 	}
64 64
 
65 65
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	public static function get_instance() {
73 73
 
74 74
 		// If the single instance hasn't been set, set it now.
75
-		if ( null === self::$instance ) {
75
+		if (null === self::$instance) {
76 76
 			self::$instance = new self();
77 77
 		}
78 78
 
@@ -85,21 +85,21 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function register_post_type() {
87 87
 		$this->labels = array(
88
-			'name'               => esc_html__( 'Recipes', 'lsx-health-plan' ),
89
-			'singular_name'      => esc_html__( 'Recipe', 'lsx-health-plan' ),
90
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
91
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
92
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
93
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
94
-			'all_items'          => esc_html__( 'All Recipes', 'lsx-health-plan' ),
95
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
96
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
97
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
98
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
88
+			'name'               => esc_html__('Recipes', 'lsx-health-plan'),
89
+			'singular_name'      => esc_html__('Recipe', 'lsx-health-plan'),
90
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
91
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
92
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
93
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
94
+			'all_items'          => esc_html__('All Recipes', 'lsx-health-plan'),
95
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
96
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
97
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
98
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
99 99
 			'parent_item_colon'  => '',
100
-			'menu_name'          => esc_html__( 'Recipes', 'lsx-health-plan' ),
100
+			'menu_name'          => esc_html__('Recipes', 'lsx-health-plan'),
101 101
 		);
102
-		$args         = array(
102
+		$args = array(
103 103
 			'labels'             => $this->labels,
104 104
 			'public'             => true,
105 105
 			'publicly_queryable' => true,
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 				'custom-fields',
123 123
 			),
124 124
 		);
125
-		register_post_type( 'recipe', $args );
125
+		register_post_type('recipe', $args);
126 126
 	}
127 127
 
128 128
 	/**
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 	 * @return void
132 132
 	 */
133 133
 	public function register_menus() {
134
-		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' );
135
-		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' );
136
-		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
+		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');
135
+		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');
136
+		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');
137 137
 	}
138 138
 
139 139
 	/**
@@ -141,19 +141,19 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function taxonomy_setup() {
143 143
 		$labels = array(
144
-			'name'              => esc_html_x( 'Cuisine', 'taxonomy general name', 'lsx-health-plan' ),
145
-			'singular_name'     => esc_html_x( 'Cuisines', 'taxonomy singular name', 'lsx-health-plan' ),
146
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
147
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
148
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
149
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
150
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
151
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
152
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
153
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
154
-			'menu_name'         => esc_html__( 'Cuisines', 'lsx-health-plan' ),
144
+			'name'              => esc_html_x('Cuisine', 'taxonomy general name', 'lsx-health-plan'),
145
+			'singular_name'     => esc_html_x('Cuisines', 'taxonomy singular name', 'lsx-health-plan'),
146
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
147
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
148
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
149
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
150
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
151
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
152
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
153
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
154
+			'menu_name'         => esc_html__('Cuisines', 'lsx-health-plan'),
155 155
 		);
156
-		$args   = array(
156
+		$args = array(
157 157
 			'hierarchical'      => true,
158 158
 			'labels'            => $labels,
159 159
 			'show_ui'           => true,
@@ -164,22 +164,22 @@  discard block
 block discarded – undo
164 164
 				'slug' => 'recipe-cuisine',
165 165
 			),
166 166
 		);
167
-		register_taxonomy( 'recipe-cuisine', array( $this->slug ), $args );
167
+		register_taxonomy('recipe-cuisine', array($this->slug), $args);
168 168
 
169 169
 		$labels = array(
170
-			'name'              => esc_html_x( 'Recipe Type', 'taxonomy general name', 'lsx-health-plan' ),
171
-			'singular_name'     => esc_html_x( 'Recipe Types', 'taxonomy singular name', 'lsx-health-plan' ),
172
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
173
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
174
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
175
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
176
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
177
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
178
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
179
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
180
-			'menu_name'         => esc_html__( 'Types', 'lsx-health-plan' ),
170
+			'name'              => esc_html_x('Recipe Type', 'taxonomy general name', 'lsx-health-plan'),
171
+			'singular_name'     => esc_html_x('Recipe Types', 'taxonomy singular name', 'lsx-health-plan'),
172
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
173
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
174
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
175
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
176
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
177
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
178
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
179
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
180
+			'menu_name'         => esc_html__('Types', 'lsx-health-plan'),
181 181
 		);
182
-		$args   = array(
182
+		$args = array(
183 183
 			'hierarchical'      => true,
184 184
 			'labels'            => $labels,
185 185
 			'show_ui'           => true,
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				'slug' => 'recipe-type',
191 191
 			),
192 192
 		);
193
-		register_taxonomy( 'recipe-type', array( $this->slug ), $args );
193
+		register_taxonomy('recipe-type', array($this->slug), $args);
194 194
 	}
195 195
 
196 196
 	/**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @param array $post_types
200 200
 	 * @return array
201 201
 	 */
202
-	public function enable_post_type( $post_types = array() ) {
202
+	public function enable_post_type($post_types = array()) {
203 203
 		$post_types[] = $this->slug;
204 204
 		return $post_types;
205 205
 	}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @param array $connections
211 211
 	 * @return void
212 212
 	 */
213
-	public function enable_connections( $connections = array() ) {
213
+	public function enable_connections($connections = array()) {
214 214
 		$connections['recipe']['connected_plans'] = 'connected_recipes';
215 215
 		$connections['plan']['connected_recipes'] = 'connected_plans';
216 216
 		return $connections;
@@ -222,45 +222,45 @@  discard block
 block discarded – undo
222 222
 	 * @param string $title the term title.
223 223
 	 * @return string
224 224
 	 */
225
-	public function get_the_archive_title( $title ) {
226
-		if ( is_post_type_archive( 'recipe' ) ) {
227
-			$title = __( 'Recipes', 'lsx-health-plan' );
225
+	public function get_the_archive_title($title) {
226
+		if (is_post_type_archive('recipe')) {
227
+			$title = __('Recipes', 'lsx-health-plan');
228 228
 		}
229
-		if ( is_post_type_archive( 'exercise' ) ) {
230
-			$title = __( 'Exercises', 'lsx-health-plan' );
229
+		if (is_post_type_archive('exercise')) {
230
+			$title = __('Exercises', 'lsx-health-plan');
231 231
 		}
232
-		if ( is_tax( 'recipe-type' ) ) {
232
+		if (is_tax('recipe-type')) {
233 233
 			$queried_object = get_queried_object();
234
-			if ( isset( $queried_object->name ) ) {
235
-				$title = $queried_object->name . ' ' . __( 'Recipes', 'lsx-health-plan' );
234
+			if (isset($queried_object->name)) {
235
+				$title = $queried_object->name . ' ' . __('Recipes', 'lsx-health-plan');
236 236
 			}
237 237
 		}
238 238
 		return $title;
239 239
 	}
240 240
 
241 241
 	public function remove_archive_original_header() {
242
-		if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) {
243
-			remove_action( 'lsx_content_wrap_before', 'lsx_global_header' );
242
+		if (is_post_type_archive('recipe') || is_post_type_archive('exercise')) {
243
+			remove_action('lsx_content_wrap_before', 'lsx_global_header');
244 244
 		}
245
-		if ( is_singular( 'recipe' ) || is_singular( 'exercise' ) ) {
246
-			remove_action( 'lsx_content_wrap_before', 'lsx_global_header' );
245
+		if (is_singular('recipe') || is_singular('exercise')) {
246
+			remove_action('lsx_content_wrap_before', 'lsx_global_header');
247 247
 		}
248
-		if ( ! is_post_type_archive() ) {
249
-			add_action( 'lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11 );
248
+		if ( ! is_post_type_archive()) {
249
+			add_action('lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11);
250 250
 		}
251 251
 	}
252 252
 
253 253
 	public function hp_lsx_archive_header() {
254
-		if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) {
254
+		if (is_post_type_archive('recipe') || is_post_type_archive('exercise')) {
255 255
 		?>
256 256
 			<div class="archive-header-wrapper banner-archive">
257 257
 				<?php lsx_global_header_inner_bottom(); ?>
258 258
 				<header class="archive-header">
259 259
 					<h1 class="archive-title">
260
-						<?php if ( has_post_format() && ! is_category() && ! is_tag() && ! is_date() && ! is_tax( 'post_format' ) ) { ?>
261
-							<?php the_archive_title( esc_html__( 'Type:', 'lsx' ) ); ?>
260
+						<?php if (has_post_format() && ! is_category() && ! is_tag() && ! is_date() && ! is_tax('post_format')) { ?>
261
+							<?php the_archive_title(esc_html__('Type:', 'lsx')); ?>
262 262
 						<?php } else { ?>
263
-							<?php echo wp_kses_post( apply_filters( 'lsx_global_header_title', get_the_archive_title() ) ); ?>
263
+							<?php echo wp_kses_post(apply_filters('lsx_global_header_title', get_the_archive_title())); ?>
264 264
 						<?php } ?>
265 265
 					</h1>
266 266
 
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
 	 * @param boolean $disable
280 280
 	 * @return boolean
281 281
 	 */
282
-	public function disable_global_header_description( $disable ) {
283
-		if ( is_tax( 'recipe-type' ) ) {
282
+	public function disable_global_header_description($disable) {
283
+		if (is_tax('recipe-type')) {
284 284
 			$disable = true;
285 285
 		}
286 286
 		return $disable;
@@ -292,21 +292,21 @@  discard block
 block discarded – undo
292 292
 	 * @var array $crumbs
293 293
 	 * @return array
294 294
 	 */
295
-	public function recipes_breadcrumb_filter( $crumbs ) {
296
-		$recipe  = \lsx_health_plan\functions\get_option( 'endpoint_recipe', 'recipe' );
297
-		$recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe_archive', 'recipes' );
298
-		$url     = get_post_type_archive_link( 'recipe' );
295
+	public function recipes_breadcrumb_filter($crumbs) {
296
+		$recipe  = \lsx_health_plan\functions\get_option('endpoint_recipe', 'recipe');
297
+		$recipes = \lsx_health_plan\functions\get_option('endpoint_recipe_archive', 'recipes');
298
+		$url     = get_post_type_archive_link('recipe');
299 299
 
300
-		if ( is_singular( 'recipe' ) ) {
300
+		if (is_singular('recipe')) {
301 301
 			$recipe_name     = get_the_title();
302
-			$term_obj_list   = get_the_terms( get_the_ID(), 'recipe-type' );
302
+			$term_obj_list   = get_the_terms(get_the_ID(), 'recipe-type');
303 303
 			$recipe_type     = $term_obj_list[0]->name;
304
-			$recipe_type_url = get_term_link( $term_obj_list[0]->term_id );
304
+			$recipe_type_url = get_term_link($term_obj_list[0]->term_id);
305 305
 
306 306
 			$new_crumbs    = array();
307 307
 			$new_crumbs[0] = $crumbs[0];
308 308
 
309
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
309
+			if (function_exists('woocommerce_breadcrumb')) {
310 310
 				$new_crumbs[1] = array(
311 311
 					0 => $recipes,
312 312
 					1 => $url,
@@ -333,15 +333,15 @@  discard block
 block discarded – undo
333 333
 			}
334 334
 			$crumbs = $new_crumbs;
335 335
 		}
336
-		if ( is_tax( 'recipe-type' ) || is_tax( 'recipe-cuisine' ) ) {
337
-			$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
336
+		if (is_tax('recipe-type') || is_tax('recipe-cuisine')) {
337
+			$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); 
338 338
 
339
-			$single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name;
339
+			$single_term_title = str_replace('-', ' ', $term->taxonomy) . ': ' . $term->name;
340 340
 
341 341
 			$new_crumbs    = array();
342 342
 			$new_crumbs[0] = $crumbs[0];
343 343
 
344
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
344
+			if (function_exists('woocommerce_breadcrumb')) {
345 345
 				$new_crumbs[1] = array(
346 346
 					0 => $recipes,
347 347
 					1 => $url,
@@ -360,12 +360,12 @@  discard block
 block discarded – undo
360 360
 			}
361 361
 			$crumbs = $new_crumbs;
362 362
 		}
363
-		if ( is_post_type_archive( 'recipe' ) ) {
363
+		if (is_post_type_archive('recipe')) {
364 364
 
365 365
 			$new_crumbs    = array();
366 366
 			$new_crumbs[0] = $crumbs[0];
367 367
 
368
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
368
+			if (function_exists('woocommerce_breadcrumb')) {
369 369
 				$new_crumbs[1] = array(
370 370
 					0 => $recipes,
371 371
 				);
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
 		$cmb = new_cmb2_box(
387 387
 			array(
388 388
 				'id'           => $this->slug . '_featured_metabox',
389
-				'title'        => __( 'Featured', 'lsx-health-plan' ),
390
-				'object_types' => array( $this->slug ),
389
+				'title'        => __('Featured', 'lsx-health-plan'),
390
+				'object_types' => array($this->slug),
391 391
 				'context'      => 'side',
392 392
 				'priority'     => 'high',
393 393
 				'show_names'   => true,
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 		);
396 396
 		$cmb->add_field(
397 397
 			array(
398
-				'name'       => __( 'Featured', 'lsx-health-plan' ),
399
-				'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' ),
398
+				'name'       => __('Featured', 'lsx-health-plan'),
399
+				'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'),
400 400
 				'id'         => $this->slug . '_featured',
401 401
 				'type'       => 'checkbox',
402 402
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
 		$cmb = new_cmb2_box(
412 412
 			array(
413 413
 				'id'           => $this->slug . '_details_metabox',
414
-				'title'        => __( 'Cooking Info', 'lsx-health-plan' ),
415
-				'object_types' => array( $this->slug ), // Post type
414
+				'title'        => __('Cooking Info', 'lsx-health-plan'),
415
+				'object_types' => array($this->slug), // Post type
416 416
 				'context'      => 'normal',
417 417
 				'priority'     => 'high',
418 418
 				'show_names'   => true,
@@ -420,27 +420,27 @@  discard block
 block discarded – undo
420 420
 		);
421 421
 		$cmb->add_field(
422 422
 			array(
423
-				'name'       => __( 'Prep Time', 'lsx-health-plan' ),
423
+				'name'       => __('Prep Time', 'lsx-health-plan'),
424 424
 				'id'         => $this->slug . '_prep_time',
425
-				'desc'       => __( 'Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan' ),
425
+				'desc'       => __('Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan'),
426 426
 				'type'       => 'text',
427 427
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
428 428
 			)
429 429
 		);
430 430
 		$cmb->add_field(
431 431
 			array(
432
-				'name'       => __( 'Cooking Time', 'lsx-health-plan' ),
432
+				'name'       => __('Cooking Time', 'lsx-health-plan'),
433 433
 				'id'         => $this->slug . '_cooking_time',
434
-				'desc'       => __( 'Add the cooking time i.e: 15 mins', 'lsx-health-plan' ),
434
+				'desc'       => __('Add the cooking time i.e: 15 mins', 'lsx-health-plan'),
435 435
 				'type'       => 'text',
436 436
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
437 437
 			)
438 438
 		);
439 439
 		$cmb->add_field(
440 440
 			array(
441
-				'name'       => __( 'Serves', 'lsx-health-plan' ),
441
+				'name'       => __('Serves', 'lsx-health-plan'),
442 442
 				'id'         => $this->slug . '_serves',
443
-				'desc'       => __( 'Add the recommended serving size i.e: 6', 'lsx-health-plan' ),
443
+				'desc'       => __('Add the recommended serving size i.e: 6', 'lsx-health-plan'),
444 444
 				'type'       => 'text',
445 445
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
446 446
 				'attributes' => array(
@@ -451,8 +451,8 @@  discard block
 block discarded – undo
451 451
 		);
452 452
 		$cmb->add_field(
453 453
 			array(
454
-				'name'       => __( 'Portion', 'lsx-health-plan' ),
455
-				'desc'       => __( 'Add the recommended portion size i.e: 200mg', 'lsx-health-plan' ),
454
+				'name'       => __('Portion', 'lsx-health-plan'),
455
+				'desc'       => __('Add the recommended portion size i.e: 200mg', 'lsx-health-plan'),
456 456
 				'id'         => $this->slug . '_portion',
457 457
 				'type'       => 'text',
458 458
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
 		$cmb = new_cmb2_box(
462 462
 			array(
463 463
 				'id'           => $this->slug . '_nutritional_metabox',
464
-				'title'        => __( 'Nutritional Info', 'lsx-health-plan' ),
465
-				'object_types' => array( $this->slug ), // Post type
464
+				'title'        => __('Nutritional Info', 'lsx-health-plan'),
465
+				'object_types' => array($this->slug), // Post type
466 466
 				'context'      => 'normal',
467 467
 				'priority'     => 'high',
468 468
 				'show_names'   => true,
@@ -470,45 +470,45 @@  discard block
 block discarded – undo
470 470
 		);
471 471
 		$cmb->add_field(
472 472
 			array(
473
-				'name'       => __( 'Energy', 'lsx-health-plan' ),
473
+				'name'       => __('Energy', 'lsx-health-plan'),
474 474
 				'id'         => $this->slug . '_energy',
475
-				'desc'       => __( 'Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan' ),
475
+				'desc'       => __('Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan'),
476 476
 				'type'       => 'text',
477 477
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
478 478
 			)
479 479
 		);
480 480
 		$cmb->add_field(
481 481
 			array(
482
-				'name'       => __( 'Protein', 'lsx-health-plan' ),
482
+				'name'       => __('Protein', 'lsx-health-plan'),
483 483
 				'id'         => $this->slug . '_protein',
484
-				'desc'       => __( 'Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan' ),
484
+				'desc'       => __('Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan'),
485 485
 				'type'       => 'text',
486 486
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
487 487
 			)
488 488
 		);
489 489
 		$cmb->add_field(
490 490
 			array(
491
-				'name'       => __( 'Carbohydrates', 'lsx-health-plan' ),
491
+				'name'       => __('Carbohydrates', 'lsx-health-plan'),
492 492
 				'id'         => $this->slug . '_carbohydrates',
493
-				'desc'       => __( 'Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
493
+				'desc'       => __('Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan'),
494 494
 				'type'       => 'text',
495 495
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
496 496
 			)
497 497
 		);
498 498
 		$cmb->add_field(
499 499
 			array(
500
-				'name'       => __( 'Fibre', 'lsx-health-plan' ),
500
+				'name'       => __('Fibre', 'lsx-health-plan'),
501 501
 				'id'         => $this->slug . '_fibre',
502
-				'desc'       => __( 'Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
502
+				'desc'       => __('Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan'),
503 503
 				'type'       => 'text',
504 504
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
505 505
 			)
506 506
 		);
507 507
 		$cmb->add_field(
508 508
 			array(
509
-				'name'       => __( 'Fat', 'lsx-health-plan' ),
509
+				'name'       => __('Fat', 'lsx-health-plan'),
510 510
 				'id'         => $this->slug . '_fat',
511
-				'desc'       => __( 'Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan' ),
511
+				'desc'       => __('Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan'),
512 512
 				'type'       => 'text',
513 513
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
514 514
 			)
Please login to merge, or discard this patch.
classes/post-types/class-plan.php 1 patch
Spacing   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -33,39 +33,39 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public function __construct() {
35 35
 
36
-		add_action( 'init', array( $this, 'register_post_type' ) );
37
-		add_action( 'init', array( $this, 'plan_type_taxonomy_setup' ) );
38
-		add_action( 'init', array( $this, 'week_taxonomy_setup' ) );
36
+		add_action('init', array($this, 'register_post_type'));
37
+		add_action('init', array($this, 'plan_type_taxonomy_setup'));
38
+		add_action('init', array($this, 'week_taxonomy_setup'));
39 39
 
40 40
 		// Icons for the plan types.
41
-		add_action( 'create_term', array( $this, 'save_meta' ), 10, 2 );
42
-		add_action( 'edit_term', array( $this, 'save_meta' ), 10, 2 );
41
+		add_action('create_term', array($this, 'save_meta'), 10, 2);
42
+		add_action('edit_term', array($this, 'save_meta'), 10, 2);
43 43
 		$prefix_taxonomy = 'plan-type';
44
-		add_action( sprintf( '%s_edit_form_fields', $prefix_taxonomy ), array( $this, 'add_thumbnail_form_field' ), 3, 1 );
44
+		add_action(sprintf('%s_edit_form_fields', $prefix_taxonomy), array($this, 'add_thumbnail_form_field'), 3, 1);
45 45
 
46 46
 		// Register the Metaboxes.
47
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 );
48
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ), 5 );
49
-		add_action( 'cmb2_admin_init', array( $this, 'plan_connections' ), 5 );
50
-		add_action( 'cmb2_admin_init', array( $this, 'sections_metabox_loop' ), 1 );
47
+		add_action('cmb2_admin_init', array($this, 'featured_metabox'), 5);
48
+		add_action('cmb2_admin_init', array($this, 'details_metaboxes'), 5);
49
+		add_action('cmb2_admin_init', array($this, 'plan_connections'), 5);
50
+		add_action('cmb2_admin_init', array($this, 'sections_metabox_loop'), 1);
51 51
 
52
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
52
+		add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100);
53 53
 		//add_filter( 'lsx_global_header_title', array( $this, 'hp_recipe_header_title' ), 200, 1 );
54 54
 
55 55
 		// Template Redirects.
56
-		add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
57
-		add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
56
+		add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1);
57
+		add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1);
58 58
 
59 59
 		// Plan Archive Actions.
60
-		add_action( 'pre_get_posts', array( $this, 'set_parent_only' ), 10, 1 );
61
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
62
-		add_action( 'lsx_content_top', 'lsx_hp_plan_archive_filters', 10, 1 );
63
-		add_filter( 'lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_search_enabled', 10, 1 );
64
-		add_filter( 'lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_filters_disabled', 10, 1 );
60
+		add_action('pre_get_posts', array($this, 'set_parent_only'), 10, 1);
61
+		add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100);
62
+		add_action('lsx_content_top', 'lsx_hp_plan_archive_filters', 10, 1);
63
+		add_filter('lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_search_enabled', 10, 1);
64
+		add_filter('lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_filters_disabled', 10, 1);
65 65
 
66 66
 		//Breadcrumbs
67
-		add_filter( 'wpseo_breadcrumb_links', array( $this, 'plan_breadcrumb_filter' ), 30, 1 );
68
-		add_filter( 'woocommerce_get_breadcrumb', array( $this, 'plan_breadcrumb_filter' ), 30, 1 );
67
+		add_filter('wpseo_breadcrumb_links', array($this, 'plan_breadcrumb_filter'), 30, 1);
68
+		add_filter('woocommerce_get_breadcrumb', array($this, 'plan_breadcrumb_filter'), 30, 1);
69 69
 		
70 70
 	}
71 71
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public static function get_instance() {
80 80
 		// If the single instance hasn't been set, set it now.
81
-		if ( null === self::$instance ) {
81
+		if (null === self::$instance) {
82 82
 			self::$instance = new self();
83 83
 		}
84 84
 		return self::$instance;
@@ -88,21 +88,21 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function register_post_type() {
90 90
 		$labels = array(
91
-			'name'               => esc_html__( 'Plans', 'lsx-health-plan' ),
92
-			'singular_name'      => esc_html__( 'Plan', 'lsx-health-plan' ),
93
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
94
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
95
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
96
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
97
-			'all_items'          => esc_html__( 'All Plans', 'lsx-health-plan' ),
98
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
99
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
100
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
101
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
102
-			'parent_item_colon'  => esc_html__( 'Parent:', 'lsx-health-plan' ),
103
-			'menu_name'          => esc_html__( 'Plans', 'lsx-health-plan' ),
91
+			'name'               => esc_html__('Plans', 'lsx-health-plan'),
92
+			'singular_name'      => esc_html__('Plan', 'lsx-health-plan'),
93
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
94
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
95
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
96
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
97
+			'all_items'          => esc_html__('All Plans', 'lsx-health-plan'),
98
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
99
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
100
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
101
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
102
+			'parent_item_colon'  => esc_html__('Parent:', 'lsx-health-plan'),
103
+			'menu_name'          => esc_html__('Plans', 'lsx-health-plan'),
104 104
 		);
105
-		$args   = array(
105
+		$args = array(
106 106
 			'labels'             => $labels,
107 107
 			'public'             => true,
108 108
 			'publicly_queryable' => true,
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
 			'menu_icon'          => 'dashicons-welcome-write-blog',
113 113
 			'query_var'          => true,
114 114
 			'rewrite'            => array(
115
-				'slug' => \lsx_health_plan\functions\get_option( 'plan_single_slug', 'plan' ),
115
+				'slug' => \lsx_health_plan\functions\get_option('plan_single_slug', 'plan'),
116 116
 			),
117 117
 			'capability_type'    => 'page',
118
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plans' ),
118
+			'has_archive'        => \lsx_health_plan\functions\get_option('endpoint_plan_archive', 'plans'),
119 119
 			'hierarchical'       => false,
120 120
 			'menu_position'      => null,
121 121
 			'supports'           => array(
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 				'custom-fields',
127 127
 			),
128 128
 		);
129
-		register_post_type( 'plan', $args );
129
+		register_post_type('plan', $args);
130 130
 	}
131 131
 
132 132
 	/**
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function plan_type_taxonomy_setup() {
136 136
 		$labels = array(
137
-			'name'              => esc_html_x( 'Plan Type', 'taxonomy general name', 'lsx-health-plan' ),
138
-			'singular_name'     => esc_html_x( 'Plan Type', 'taxonomy singular name', 'lsx-health-plan' ),
139
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
140
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
141
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
142
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
143
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
144
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
145
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
146
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
147
-			'menu_name'         => esc_html__( 'Plan Types', 'lsx-health-plan' ),
137
+			'name'              => esc_html_x('Plan Type', 'taxonomy general name', 'lsx-health-plan'),
138
+			'singular_name'     => esc_html_x('Plan Type', 'taxonomy singular name', 'lsx-health-plan'),
139
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
140
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
141
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
142
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
143
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
144
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
145
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
146
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
147
+			'menu_name'         => esc_html__('Plan Types', 'lsx-health-plan'),
148 148
 		);
149 149
 
150 150
 		$args = array(
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			),
159 159
 		);
160 160
 
161
-		register_taxonomy( 'plan-type', array( 'plan' ), $args );
161
+		register_taxonomy('plan-type', array('plan'), $args);
162 162
 	}
163 163
 
164 164
 	/**
@@ -166,17 +166,17 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	public function week_taxonomy_setup() {
168 168
 		$labels = array(
169
-			'name'              => esc_html_x( 'Week', 'taxonomy general name', 'lsx-health-plan' ),
170
-			'singular_name'     => esc_html_x( 'Week', 'taxonomy singular name', 'lsx-health-plan' ),
171
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
172
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
173
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
174
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
175
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
176
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
177
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
178
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
179
-			'menu_name'         => esc_html__( 'Weeks', 'lsx-health-plan' ),
169
+			'name'              => esc_html_x('Week', 'taxonomy general name', 'lsx-health-plan'),
170
+			'singular_name'     => esc_html_x('Week', 'taxonomy singular name', 'lsx-health-plan'),
171
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
172
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
173
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
174
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
175
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
176
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
177
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
178
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
179
+			'menu_name'         => esc_html__('Weeks', 'lsx-health-plan'),
180 180
 		);
181 181
 
182 182
 		$args = array(
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 			),
192 192
 		);
193 193
 
194
-		register_taxonomy( 'week', array( 'plan' ), $args );
194
+		register_taxonomy('week', array('plan'), $args);
195 195
 	}
196 196
 
197 197
 	/**
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @since 0.1.0
201 201
 	 */
202
-	public function add_thumbnail_form_field( $term = false ) {
203
-		if ( is_object( $term ) ) {
204
-			$value         = get_term_meta( $term->term_id, 'thumbnail', true );
205
-			$image_preview = wp_get_attachment_image_src( $value, 'thumbnail' );
202
+	public function add_thumbnail_form_field($term = false) {
203
+		if (is_object($term)) {
204
+			$value         = get_term_meta($term->term_id, 'thumbnail', true);
205
+			$image_preview = wp_get_attachment_image_src($value, 'thumbnail');
206 206
 
207
-			if ( is_array( $image_preview ) ) {
208
-				$image_preview = '<img style="height: 50px; width: 50px;" src="' . esc_url( $image_preview[0] ) . '" width="' . $image_preview[1] . '" height="' . $image_preview[2] . '" class="alignnone size-thumbnail d wp-image-' . $value . '" />';
207
+			if (is_array($image_preview)) {
208
+				$image_preview = '<img style="height: 50px; width: 50px;" src="' . esc_url($image_preview[0]) . '" width="' . $image_preview[1] . '" height="' . $image_preview[2] . '" class="alignnone size-thumbnail d wp-image-' . $value . '" />';
209 209
 			}
210 210
 		} else {
211 211
 			$image_preview = false;
@@ -213,15 +213,15 @@  discard block
 block discarded – undo
213 213
 		}
214 214
 		?>
215 215
 		<tr class="form-field form-required term-thumbnail-wrap">
216
-			<th scope="row"><label for="thumbnail"><?php esc_html_e( 'Icon Image', 'lsx-health-plan' ); ?></label></th>
216
+			<th scope="row"><label for="thumbnail"><?php esc_html_e('Icon Image', 'lsx-health-plan'); ?></label></th>
217 217
 			<td>
218
-				<input class="input_image_id" type="hidden" name="thumbnail" value="<?php echo wp_kses_post( $value ); ?>">
218
+				<input class="input_image_id" type="hidden" name="thumbnail" value="<?php echo wp_kses_post($value); ?>">
219 219
 				<div class="thumbnail-preview">
220
-					<?php echo wp_kses_post( $image_preview ); ?>
220
+					<?php echo wp_kses_post($image_preview); ?>
221 221
 				</div>
222
-				<a style="<?php if ( '' !== $value && false !== $value ) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-add"><?php esc_html_e( 'Choose Image', 'lsx-health-plan' ); ?></a>
223
-				<a style="<?php if ( '' === $value || false === $value ) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-remove"><?php esc_html_e( 'Remove Image', 'lsx-health-plan' ); ?></a>
224
-				<?php wp_nonce_field( 'lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce' ); ?>
222
+				<a style="<?php if ('' !== $value && false !== $value) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-add"><?php esc_html_e('Choose Image', 'lsx-health-plan'); ?></a>
223
+				<a style="<?php if ('' === $value || false === $value) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-remove"><?php esc_html_e('Remove Image', 'lsx-health-plan'); ?></a>
224
+				<?php wp_nonce_field('lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce'); ?>
225 225
 			</td>
226 226
 		</tr>
227 227
 		<?php
@@ -235,27 +235,27 @@  discard block
 block discarded – undo
235 235
 	 * @param  int    $term_id
236 236
 	 * @param  string $taxonomy
237 237
 	 */
238
-	public function save_meta( $term_id = 0, $taxonomy = '' ) {
239
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
238
+	public function save_meta($term_id = 0, $taxonomy = '') {
239
+		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
240 240
 			return;
241 241
 		}
242 242
 
243
-		if ( ! isset( $_POST['thumbnail'] ) ) {
243
+		if ( ! isset($_POST['thumbnail'])) {
244 244
 			return;
245 245
 		}
246 246
 
247
-		if ( check_admin_referer( 'lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce' ) ) {
248
-			if ( ! isset( $_POST['thumbnail'] ) ) {
247
+		if (check_admin_referer('lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce')) {
248
+			if ( ! isset($_POST['thumbnail'])) {
249 249
 				return;
250 250
 			}
251 251
 
252
-			$thumbnail_meta = sanitize_text_field( $_POST['thumbnail'] );
253
-			$thumbnail_meta = ! empty( $thumbnail_meta ) ? $thumbnail_meta : '';
252
+			$thumbnail_meta = sanitize_text_field($_POST['thumbnail']);
253
+			$thumbnail_meta = ! empty($thumbnail_meta) ? $thumbnail_meta : '';
254 254
 
255
-			if ( empty( $thumbnail_meta ) ) {
256
-				delete_term_meta( $term_id, 'thumbnail' );
255
+			if (empty($thumbnail_meta)) {
256
+				delete_term_meta($term_id, 'thumbnail');
257 257
 			} else {
258
-				update_term_meta( $term_id, 'thumbnail', $thumbnail_meta );
258
+				update_term_meta($term_id, 'thumbnail', $thumbnail_meta);
259 259
 			}
260 260
 		}
261 261
 	}
@@ -264,40 +264,40 @@  discard block
 block discarded – undo
264 264
 	 * Define the metabox and field configurations.
265 265
 	 */
266 266
 	public function details_metaboxes() {
267
-		$cmb = new_cmb2_box( array(
267
+		$cmb = new_cmb2_box(array(
268 268
 			'id'           => $this->slug . '_details_metabox',
269
-			'title'        => __( 'Details', 'lsx-health-plan' ),
270
-			'object_types' => array( $this->slug ), // Post type
269
+			'title'        => __('Details', 'lsx-health-plan'),
270
+			'object_types' => array($this->slug), // Post type
271 271
 			'context'      => 'normal',
272 272
 			'priority'     => 'high',
273 273
 			'show_names'   => true,
274
-		) );
274
+		));
275 275
 
276
-		$cmb->add_field( array(
277
-			'name' => __( 'Plan Short Description', 'lsx-health-plan' ),
276
+		$cmb->add_field(array(
277
+			'name' => __('Plan Short Description', 'lsx-health-plan'),
278 278
 			'id'   => $this->slug . '_short_description',
279 279
 			'type' => 'textarea_small',
280
-			'desc' => __( 'Add a small description for this plan (optional)', 'lsx-health-plan' ),
281
-		) );
280
+			'desc' => __('Add a small description for this plan (optional)', 'lsx-health-plan'),
281
+		));
282 282
 
283 283
 		$warmup_type = 'page';
284
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
285
-			$warmup_type = array( 'page', 'workout' );
284
+		if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
285
+			$warmup_type = array('page', 'workout');
286 286
 		}
287
-		$cmb->add_field( array(
288
-			'name'       => __( 'Warmup', 'lsx-health-plan' ),
289
-			'desc'       => __( 'Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan' ),
287
+		$cmb->add_field(array(
288
+			'name'       => __('Warmup', 'lsx-health-plan'),
289
+			'desc'       => __('Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan'),
290 290
 			'id'         => $this->slug . '_warmup',
291 291
 			'type'       => 'post_search_ajax',
292 292
 			// Optional :
293
-			'limit'      => 3,  // Limit selection to X items only (default 1)
293
+			'limit'      => 3, // Limit selection to X items only (default 1)
294 294
 			'sortable'   => true, // Allow selected items to be sortable (default false)
295 295
 			'query_args' => array(
296 296
 				'post_type'      => $warmup_type,
297
-				'post_status'    => array( 'publish' ),
297
+				'post_status'    => array('publish'),
298 298
 				'posts_per_page' => -1,
299 299
 			),
300
-		) );
300
+		));
301 301
 	}
302 302
 
303 303
 	/**
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * @param array $post_types
307 307
 	 * @return array
308 308
 	 */
309
-	public function enable_post_type( $post_types = array() ) {
309
+	public function enable_post_type($post_types = array()) {
310 310
 		$post_types[] = $this->slug;
311 311
 		return $post_types;
312 312
 	}
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 		$cmb = new_cmb2_box(
321 321
 			array(
322 322
 				'id'           => $this->slug . '_connections_metabox',
323
-				'title'        => __( 'Plans', 'lsx-health-plan' ),
324
-				'object_types' => array( 'workout', 'meal', 'tip', 'recipe' ),
323
+				'title'        => __('Plans', 'lsx-health-plan'),
324
+				'object_types' => array('workout', 'meal', 'tip', 'recipe'),
325 325
 				'context'      => 'normal',
326 326
 				'priority'     => 'high',
327 327
 				'show_names'   => true,
@@ -329,15 +329,15 @@  discard block
 block discarded – undo
329 329
 		);
330 330
 		$cmb->add_field(
331 331
 			array(
332
-				'name'       => __( 'Plan', 'lsx-health-plan' ),
332
+				'name'       => __('Plan', 'lsx-health-plan'),
333 333
 				'id'         => 'connected_plans',
334
-				'desc'       => __( 'Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan' ),
334
+				'desc'       => __('Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan'),
335 335
 				'type'       => 'post_search_ajax',
336 336
 				'limit'      => 15,
337 337
 				'sortable'   => true,
338 338
 				'query_args' => array(
339
-					'post_type'      => array( 'plan' ),
340
-					'post_status'    => array( 'publish' ),
339
+					'post_type'      => array('plan'),
340
+					'post_status'    => array('publish'),
341 341
 					'posts_per_page' => -1,
342 342
 				),
343 343
 			)
@@ -350,9 +350,9 @@  discard block
 block discarded – undo
350 350
 	 * @param string $title the term title.
351 351
 	 * @return string
352 352
 	 */
353
-	public function get_the_archive_title( $title ) {
354
-		if ( is_post_type_archive( 'plan' ) ) {
355
-			$title = __( 'Our health plans', 'lsx-health-plan' );
353
+	public function get_the_archive_title($title) {
354
+		if (is_post_type_archive('plan')) {
355
+			$title = __('Our health plans', 'lsx-health-plan');
356 356
 		}
357 357
 		return $title;
358 358
 	}
@@ -363,9 +363,9 @@  discard block
 block discarded – undo
363 363
 	 * @param object $wp_query
364 364
 	 * @return array
365 365
 	 */
366
-	public function set_parent_only( $wp_query ) {
367
-		if ( ! is_admin() && $wp_query->is_main_query() && ( $wp_query->is_post_type_archive( 'plan' ) || $wp_query->is_tax( 'plan-type' ) ) ) {
368
-			$wp_query->set( 'post_parent', '0' );
366
+	public function set_parent_only($wp_query) {
367
+		if ( ! is_admin() && $wp_query->is_main_query() && ($wp_query->is_post_type_archive('plan') || $wp_query->is_tax('plan-type'))) {
368
+			$wp_query->set('post_parent', '0');
369 369
 		}
370 370
 	}
371 371
 
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 		$cmb = new_cmb2_box(
377 377
 			array(
378 378
 				'id'           => $this->slug . '_featured_metabox_plan',
379
-				'title'        => __( 'Featured Plan', 'lsx-health-plan' ),
380
-				'object_types' => array( $this->slug ), // Post type
379
+				'title'        => __('Featured Plan', 'lsx-health-plan'),
380
+				'object_types' => array($this->slug), // Post type
381 381
 				'context'      => 'side',
382 382
 				'priority'     => 'high',
383 383
 				'show_names'   => true,
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
 		);
386 386
 		$cmb->add_field(
387 387
 			array(
388
-				'name'       => __( 'Featured Plan', 'lsx-health-plan' ),
389
-				'desc'       => __( 'Enable a featured plan' ),
388
+				'name'       => __('Featured Plan', 'lsx-health-plan'),
389
+				'desc'       => __('Enable a featured plan'),
390 390
 				'id'         => $this->slug . '_featured_plan',
391 391
 				'type'       => 'checkbox',
392 392
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
 		$cmb = new_cmb2_box(
402 402
 			array(
403 403
 				'id'           => $this->slug . '_sections_metabox',
404
-				'title'        => __( 'Sections', 'lsx-health-plan' ),
405
-				'object_types' => array( $this->slug ), // Post type.
404
+				'title'        => __('Sections', 'lsx-health-plan'),
405
+				'object_types' => array($this->slug), // Post type.
406 406
 				'context'      => 'normal',
407 407
 				'priority'     => 'low',
408 408
 				'show_names'   => true,
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
 				'id'      => $this->slug . '_sections',
419 419
 				'type'    => 'group',
420 420
 				'options' => array(
421
-					'group_title'   => __( 'Section', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number
422
-					'add_button'    => __( 'Add section', 'lsx-health-plan' ),
423
-					'remove_button' => __( 'Remove section', 'lsx-health-plan' ),
421
+					'group_title'   => __('Section', 'lsx-health-plan') . ' {#}', // {#} gets replaced by row number
422
+					'add_button'    => __('Add section', 'lsx-health-plan'),
423
+					'remove_button' => __('Remove section', 'lsx-health-plan'),
424 424
 					'sortable'      => true,
425 425
 					'closed'        => true, // true to have the groups closed by default
426 426
 				),
@@ -432,10 +432,10 @@  discard block
 block discarded – undo
432 432
 		$cmb->add_group_field(
433 433
 			$group,
434 434
 			array(
435
-				'name'       => __( 'Title', 'lsx-health-plan' ),
435
+				'name'       => __('Title', 'lsx-health-plan'),
436 436
 				'id'         => 'title',
437 437
 				'type'       => 'text',
438
-				'desc'       => __( 'e.g Day 1 / Week 1', 'lsx-health-plan' ),
438
+				'desc'       => __('e.g Day 1 / Week 1', 'lsx-health-plan'),
439 439
 				'classes'    => 'lsx-field-col  lsx-field-col-50',
440 440
 			)
441 441
 		);
@@ -443,10 +443,10 @@  discard block
 block discarded – undo
443 443
 		$cmb->add_group_field(
444 444
 			$group,
445 445
 			array(
446
-				'name'       => __( 'Group', 'lsx-health-plan' ),
446
+				'name'       => __('Group', 'lsx-health-plan'),
447 447
 				'id'         => 'group',
448 448
 				'type'       => 'text',
449
-				'desc'       => __( 'e.g Week 1 / January', 'lsx-health-plan' ),
449
+				'desc'       => __('e.g Week 1 / January', 'lsx-health-plan'),
450 450
 				'classes'    => 'lsx-field-col  lsx-field-col-50',
451 451
 			)
452 452
 		);
@@ -454,25 +454,25 @@  discard block
 block discarded – undo
454 454
 		$cmb->add_group_field(
455 455
 			$group,
456 456
 			array(
457
-				'name' => __( 'Overview', 'lsx-health-plan' ),
457
+				'name' => __('Overview', 'lsx-health-plan'),
458 458
 				'id'   => 'description',
459 459
 				'type' => 'wysiwyg',
460 460
 			)
461 461
 		);
462 462
 
463
-		if ( post_type_exists( 'workout' ) ) {
463
+		if (post_type_exists('workout')) {
464 464
 			$cmb->add_group_field(
465 465
 				$group,
466 466
 				array(
467
-					'name'       => __( 'Workouts', 'lsx-health-plan' ),
467
+					'name'       => __('Workouts', 'lsx-health-plan'),
468 468
 					'id'         => 'connected_workouts',
469
-					'desc'       => __( 'Connect the workout(s) that apply to this section.', 'lsx-health-plan' ),
469
+					'desc'       => __('Connect the workout(s) that apply to this section.', 'lsx-health-plan'),
470 470
 					'type'       => 'post_search_ajax',
471 471
 					'limit'      => 15,
472 472
 					'sortable'   => true,
473 473
 					'query_args' => array(
474
-						'post_type'      => array( 'workout' ),
475
-						'post_status'    => array( 'publish' ),
474
+						'post_type'      => array('workout'),
475
+						'post_status'    => array('publish'),
476 476
 						'posts_per_page' => -1,
477 477
 					),
478 478
 					'classes'    => 'lsx-field-col lsx-field-add-field lsx-field-col-50',
@@ -481,51 +481,51 @@  discard block
 block discarded – undo
481 481
 			$cmb->add_group_field(
482 482
 				$group,
483 483
 				array(
484
-					'name'        => __( 'Rest day', 'lsx-health-plan' ),
484
+					'name'        => __('Rest day', 'lsx-health-plan'),
485 485
 					'id'          => 'rest_day_enabled',
486 486
 					'type'        => 'checkbox',
487 487
 					'value'       => 1,
488 488
 					'default'     => 0,
489
-					'description' => __( 'Enabling the rest day will add an item called "Rest" with no links.', 'lsx-health-plan' ),
489
+					'description' => __('Enabling the rest day will add an item called "Rest" with no links.', 'lsx-health-plan'),
490 490
 					'classes'     => 'lsx-field-col lsx-field-add-field lsx-field-col-50',
491 491
 				)
492 492
 			);
493 493
 		}
494 494
 
495
-		if ( post_type_exists( 'meal' ) ) {
495
+		if (post_type_exists('meal')) {
496 496
 			$cmb->add_group_field(
497 497
 				$group,
498 498
 				array(
499
-					'name'       => __( 'Meals', 'lsx-health-plan' ),
500
-					'desc'       => __( 'Connect the meal(s) that apply to this section.', 'lsx-health-plan' ),
499
+					'name'       => __('Meals', 'lsx-health-plan'),
500
+					'desc'       => __('Connect the meal(s) that apply to this section.', 'lsx-health-plan'),
501 501
 					'id'         => 'connected_meals',
502 502
 					'type'       => 'post_search_ajax',
503 503
 					// Optional :
504 504
 					'limit'      => 15, // Limit selection to X items only (default 1)
505 505
 					'sortable'   => true, // Allow selected items to be sortable (default false)
506 506
 					'query_args' => array(
507
-						'post_type'      => array( 'meal' ),
508
-						'post_status'    => array( 'publish' ),
507
+						'post_type'      => array('meal'),
508
+						'post_status'    => array('publish'),
509 509
 						'posts_per_page' => -1,
510 510
 					),
511 511
 					'classes'    => 'lsx-field-col lsx-field-add-field  lsx-field-col-50',
512 512
 				)
513 513
 			);
514 514
 		}
515
-		if ( post_type_exists( 'tip' ) ) {
515
+		if (post_type_exists('tip')) {
516 516
 			$cmb->add_group_field(
517 517
 				$group,
518 518
 				array(
519
-					'name'       => __( 'Tips', 'lsx-health-plan' ),
519
+					'name'       => __('Tips', 'lsx-health-plan'),
520 520
 					'id'         => 'connected_tips',
521
-					'desc'       => __( 'Connect the tip(s) that apply to this section.', 'lsx-health-plan' ),
521
+					'desc'       => __('Connect the tip(s) that apply to this section.', 'lsx-health-plan'),
522 522
 					'type'       => 'post_search_ajax',
523 523
 					// Optional :
524
-					'limit'      => 15,  // Limit selection to X items only (default 1)
525
-					'sortable'   => true,  // Allow selected items to be sortable (default false)
524
+					'limit'      => 15, // Limit selection to X items only (default 1)
525
+					'sortable'   => true, // Allow selected items to be sortable (default false)
526 526
 					'query_args' => array(
527
-						'post_type'      => array( 'tip' ),
528
-						'post_status'    => array( 'publish' ),
527
+						'post_type'      => array('tip'),
528
+						'post_status'    => array('publish'),
529 529
 						'posts_per_page' => -1,
530 530
 					),
531 531
 					'classes'    => 'lsx-field-col lsx-field-add-field  lsx-field-col-50',
@@ -540,21 +540,21 @@  discard block
 block discarded – undo
540 540
 	 * @var array $crumbs
541 541
 	 * @return array
542 542
 	 */
543
-	public function plan_breadcrumb_filter( $crumbs ) {
544
-		$plan  = \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' );
545
-		$plans = \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plan' );
543
+	public function plan_breadcrumb_filter($crumbs) {
544
+		$plan  = \lsx_health_plan\functions\get_option('endpoint_plan', 'plan');
545
+		$plans = \lsx_health_plan\functions\get_option('endpoint_plan_archive', 'plan');
546 546
 
547
-		if ( is_singular( 'plan' ) ) {	
547
+		if (is_singular('plan')) {	
548 548
 			$plan_name     = get_the_title();
549
-			$url           = get_post_type_archive_link( $plan );
550
-			$term_obj_list = get_the_terms( get_the_ID(), 'plan-type' );
549
+			$url           = get_post_type_archive_link($plan);
550
+			$term_obj_list = get_the_terms(get_the_ID(), 'plan-type');
551 551
 			$plan_type     = $term_obj_list[0]->name;
552
-			$plan_type_url = get_term_link( $term_obj_list[0]->term_id );
552
+			$plan_type_url = get_term_link($term_obj_list[0]->term_id);
553 553
 
554 554
 			$new_crumbs    = array();
555 555
 			$new_crumbs[0] = $crumbs[0];
556 556
 
557
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
557
+			if (function_exists('woocommerce_breadcrumb')) {
558 558
 				$new_crumbs[1] = array(
559 559
 					0 => $plans,
560 560
 					1 => $url,
@@ -582,12 +582,12 @@  discard block
 block discarded – undo
582 582
 			$crumbs = $new_crumbs;
583 583
 
584 584
 		}
585
-		if ( is_post_type_archive( 'plan' ) ) {
585
+		if (is_post_type_archive('plan')) {
586 586
 
587 587
 			$new_crumbs    = array();
588 588
 			$new_crumbs[0] = $crumbs[0];
589 589
 
590
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
590
+			if (function_exists('woocommerce_breadcrumb')) {
591 591
 				$new_crumbs[1] = array(
592 592
 					0 => $plans,
593 593
 				);
Please login to merge, or discard this patch.
classes/integrations/woocommerce/class-plans.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function __construct() {
45 45
 		// Remove the default restrictions, as we will add our own.
46
-		add_action( 'wp', array( $this, 'set_screen' ), 1 );
47
-		add_action( 'wp', array( $this, 'disable_parent_plan_restrictions' ), 2 );
48
-		add_action( 'wp', array( $this, 'child_plan_redirect_restrictions' ), 2 );
46
+		add_action('wp', array($this, 'set_screen'), 1);
47
+		add_action('wp', array($this, 'disable_parent_plan_restrictions'), 2);
48
+		add_action('wp', array($this, 'child_plan_redirect_restrictions'), 2);
49 49
 
50 50
 		// Initiate the WP Head functions.
51
-		add_action( 'wp_head', array( $this, 'set_screen' ) );
52
-		add_action( 'lsx_content_top', 'lsx_hp_single_plan_products' );
51
+		add_action('wp_head', array($this, 'set_screen'));
52
+		add_action('lsx_content_top', 'lsx_hp_single_plan_products');
53 53
 
54 54
 		// Plan Archive Actions.
55
-		add_action( 'lsx_entry_before', array( $this, 'set_product_ids' ) );
55
+		add_action('lsx_entry_before', array($this, 'set_product_ids'));
56 56
 	}
57 57
 
58 58
 	/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public static function get_instance() {
66 66
 		// If the single instance hasn't been set, set it now.
67
-		if ( null === self::$instance ) {
67
+		if (null === self::$instance) {
68 68
 			self::$instance = new self();
69 69
 		}
70 70
 		return self::$instance;
@@ -74,27 +74,27 @@  discard block
 block discarded – undo
74 74
 	 * Define the product metabox on the plan post type
75 75
 	 */
76 76
 	public function set_screen() {
77
-		if ( is_singular( array( 'plan' ) ) ) {
78
-			$section = get_query_var( 'section' );
79
-			if ( ! empty( $section ) ) {
77
+		if (is_singular(array('plan'))) {
78
+			$section = get_query_var('section');
79
+			if ( ! empty($section)) {
80 80
 				$this->screen = 'child_plan';
81 81
 			} else {
82 82
 				$this->screen = 'parent_plan';
83 83
 			}
84
-			$product_ids = get_post_meta( get_the_ID(), 'plan_product', true );
85
-			if ( false !== $product_ids && ! empty( $product_ids ) ) {
84
+			$product_ids = get_post_meta(get_the_ID(), 'plan_product', true);
85
+			if (false !== $product_ids && ! empty($product_ids)) {
86 86
 				$this->product_ids = $product_ids;
87 87
 			}
88 88
 		}
89
-		if ( is_singular( array( 'workout', 'meal' ) ) ) {
90
-			$parent_id = wp_get_post_parent_id( get_the_ID() );
91
-			if ( 0 === $parent_id || false === $parent_id ) {
89
+		if (is_singular(array('workout', 'meal'))) {
90
+			$parent_id = wp_get_post_parent_id(get_the_ID());
91
+			if (0 === $parent_id || false === $parent_id) {
92 92
 				$this->screen = 'parent_plan';
93 93
 			} else {
94 94
 				$this->screen = 'child_plan';
95 95
 			}
96 96
 		}
97
-		if ( is_post_type_archive( array( 'plan', 'workout', 'meal' ) ) || is_tax( array( 'plan-type', 'workout-type', 'meal-type' ) ) ) {
97
+		if (is_post_type_archive(array('plan', 'workout', 'meal')) || is_tax(array('plan-type', 'workout-type', 'meal-type'))) {
98 98
 			$this->screen = 'plan_archive';
99 99
 		}
100 100
 	}
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function set_product_ids() {
108 108
 		$this->product_ids = false;
109
-		if ( 'plan' === get_post_type() ) {
110
-			$product_ids = get_post_meta( get_the_ID(), 'plan_product', true );
111
-			if ( false !== $product_ids && ! empty( $product_ids ) ) {
109
+		if ('plan' === get_post_type()) {
110
+			$product_ids = get_post_meta(get_the_ID(), 'plan_product', true);
111
+			if (false !== $product_ids && ! empty($product_ids)) {
112 112
 				$this->product_ids = $product_ids;
113 113
 			}
114 114
 		}
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
 	 * restriction functionality elsewhere.
120 120
 	 */
121 121
 	public function disable_parent_plan_restrictions() {
122
-		if ( '' === $this->screen || ! function_exists( 'wc_memberships' ) ) {
122
+		if ('' === $this->screen || ! function_exists('wc_memberships')) {
123 123
 			return;
124 124
 		}
125 125
 
126 126
 		$restrictions = wc_memberships()->get_restrictions_instance()->get_posts_restrictions_instance();
127
-		remove_action( 'wp', array( $restrictions, 'handle_restriction_modes' ) );
127
+		remove_action('wp', array($restrictions, 'handle_restriction_modes'));
128 128
 	}
129 129
 
130 130
 	/**
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 	 * restriction functionality elsewhere.
133 133
 	 */
134 134
 	public function child_plan_redirect_restrictions() {
135
-		if ( ! function_exists( 'wc_memberships' ) || ! is_singular( 'plan' ) || 'child_plan' !== $this->screen || ! function_exists( 'wc_memberships_is_post_content_restricted' ) ) {
135
+		if ( ! function_exists('wc_memberships') || ! is_singular('plan') || 'child_plan' !== $this->screen || ! function_exists('wc_memberships_is_post_content_restricted')) {
136 136
 			return;
137 137
 		}
138
-		$restricted = wc_memberships_is_post_content_restricted() && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() );
139
-		if ( true === $restricted ) {
140
-			wp_redirect( get_permalink( get_the_ID() ) );
138
+		$restricted = wc_memberships_is_post_content_restricted() && ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID());
139
+		if (true === $restricted) {
140
+			wp_redirect(get_permalink(get_the_ID()));
141 141
 			exit;
142 142
 		}
143 143
 	}
Please login to merge, or discard this patch.
templates/archive-meal.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
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 ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) {
23
+		if ( ! function_exists('wc_memberships_view_restricted_post_content') || 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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
52 52
 
53 53
 			<?php
54 54
 		} else {
55
-			wp_redirect( $redirect );
55
+			wp_redirect($redirect);
56 56
 			exit;
57 57
 		}
58 58
 		?>
Please login to merge, or discard this patch.
templates/taxonomy-muscle-group.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
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 ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) {
23
+		if ( ! function_exists('wc_memberships_view_restricted_post_content') || current_user_can('wc_memberships_view_restricted_post_content', $post_id)) {
24 24
 			?>
25 25
 			<main id="main" role="main">
26 26
 
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
52 52
 
53 53
 			<?php
54 54
 		} else {
55
-			wp_redirect( $redirect );
55
+			wp_redirect($redirect);
56 56
 			exit;
57 57
 		}
58 58
 		?>
Please login to merge, or discard this patch.
templates/taxonomy-recipe-cuisine.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 <?php lsx_content_wrap_before(); ?>
11 11
 
12
-	<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>">
12
+	<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>">
13 13
 
14 14
 		<?php lsx_content_before(); ?>
15 15
 
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 			<div class="post-wrapper archive-plan">
21 21
 				<div class="row">
22
-					<?php if ( have_posts() ) : ?>
22
+					<?php if (have_posts()) : ?>
23 23
 						<?php
24
-						while ( have_posts() ) :
24
+						while (have_posts()) :
25 25
 							the_post();
26 26
 							?>
27 27
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 					<?php else : ?>
33 33
 
34
-						<?php get_template_part( 'partials/content', 'none' ); ?>
34
+						<?php get_template_part('partials/content', 'none'); ?>
35 35
 
36 36
 					<?php endif; ?>
37 37
 				</div>
Please login to merge, or discard this patch.
templates/archive-exercise.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
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 ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) {
23
+		if ( ! function_exists('wc_memberships_view_restricted_post_content') || 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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
52 52
 
53 53
 			<?php
54 54
 		} else {
55
-			wp_redirect( $redirect );
55
+			wp_redirect($redirect);
56 56
 			exit;
57 57
 		}
58 58
 		?>
Please login to merge, or discard this patch.