Passed
Push — dependabot/github_actions/acti... ( 7e959c )
by
unknown
07:11
created
classes/class-setup.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * Contructor
27 27
 	 */
28 28
 	public function __construct() {
29
-		add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
30
-		add_action( 'wp_head', array( $this, 'load_shortcodes' ) );
29
+		add_action('init', array($this, 'load_plugin_textdomain'));
30
+		add_action('wp_head', array($this, 'load_shortcodes'));
31 31
 		$this->load_classes();
32 32
 	}
33 33
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	public static function get_instance() {
42 42
 
43 43
 		// If the single instance hasn't been set, set it now.
44
-		if ( null === self::$instance ) {
44
+		if (null === self::$instance) {
45 45
 			self::$instance = new self();
46 46
 		}
47 47
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * Adds text domain.
54 54
 	 */
55 55
 	public function load_plugin_textdomain() {
56
-		load_plugin_textdomain( 'lsx-health-plan', false, basename( LSX_HEALTH_PLAN_PATH ) . '/languages' );
56
+		load_plugin_textdomain('lsx-health-plan', false, basename(LSX_HEALTH_PLAN_PATH) . '/languages');
57 57
 	}
58 58
 
59 59
 	/**
@@ -72,21 +72,21 @@  discard block
 block discarded – undo
72 72
 	 * @return void
73 73
 	 */
74 74
 	public function load_shortcodes() {
75
-		add_shortcode( 'lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content' );
76
-		add_shortcode( 'lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs' );
77
-		add_shortcode( 'lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box' );
78
-		add_shortcode( 'lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box' );
79
-		add_shortcode( 'lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices' );
75
+		add_shortcode('lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content');
76
+		add_shortcode('lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs');
77
+		add_shortcode('lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box');
78
+		add_shortcode('lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box');
79
+		add_shortcode('lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices');
80 80
 
81
-		if ( post_type_exists( 'video' ) ) {
82
-			add_shortcode( 'lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box' );
81
+		if (post_type_exists('video')) {
82
+			add_shortcode('lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box');
83 83
 		}
84
-		if ( post_type_exists( 'recipe' ) ) {
85
-			add_shortcode( 'lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box' );
84
+		if (post_type_exists('recipe')) {
85
+			add_shortcode('lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box');
86 86
 		}
87
-		if ( post_type_exists( 'tip' ) ) {
88
-			add_shortcode( 'lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box' );
87
+		if (post_type_exists('tip')) {
88
+			add_shortcode('lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box');
89 89
 		}
90
-		add_shortcode( 'lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box' );
90
+		add_shortcode('lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box');
91 91
 	}
92 92
 }
Please login to merge, or discard this patch.
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -8,85 +8,85 @@
 block discarded – undo
8 8
  */
9 9
 class Setup {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Setup()
17
-	 */
18
-	protected static $instance = null;
11
+     /**
12
+      * Holds class instance
13
+      *
14
+      * @since 1.0.0
15
+      *
16
+      * @var      object \lsx_health_plan\classes\Setup()
17
+      */
18
+     protected static $instance = null;
19 19
 
20
-	/**
21
-	 * @var object \lsx_health_plan\classes\Post_Type();
22
-	 */
23
-	public $post_types;
20
+     /**
21
+      * @var object \lsx_health_plan\classes\Post_Type();
22
+      */
23
+     public $post_types;
24 24
 
25
-	/**
26
-	 * Contructor
27
-	 */
28
-	public function __construct() {
29
-		add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
30
-		add_action( 'wp_head', array( $this, 'load_shortcodes' ) );
31
-		$this->load_classes();
32
-	}
25
+     /**
26
+      * Contructor
27
+      */
28
+     public function __construct() {
29
+          add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
30
+          add_action( 'wp_head', array( $this, 'load_shortcodes' ) );
31
+          $this->load_classes();
32
+     }
33 33
 
34
-	/**
35
-	 * Return an instance of this class.
36
-	 *
37
-	 * @since 1.0.0
38
-	 *
39
-	 * @return    object \lsx_health_plan\classes\Setup()    A single instance of this class.
40
-	 */
41
-	public static function get_instance() {
34
+     /**
35
+      * Return an instance of this class.
36
+      *
37
+      * @since 1.0.0
38
+      *
39
+      * @return    object \lsx_health_plan\classes\Setup()    A single instance of this class.
40
+      */
41
+     public static function get_instance() {
42 42
 
43
-		// If the single instance hasn't been set, set it now.
44
-		if ( null === self::$instance ) {
45
-			self::$instance = new self();
46
-		}
43
+          // If the single instance hasn't been set, set it now.
44
+          if ( null === self::$instance ) {
45
+               self::$instance = new self();
46
+          }
47 47
 
48
-		return self::$instance;
48
+          return self::$instance;
49 49
 
50
-	}
50
+     }
51 51
 
52
-	/**
53
-	 * Adds text domain.
54
-	 */
55
-	public function load_plugin_textdomain() {
56
-		load_plugin_textdomain( 'lsx-health-plan', false, basename( LSX_HEALTH_PLAN_PATH ) . '/languages' );
57
-	}
52
+     /**
53
+      * Adds text domain.
54
+      */
55
+     public function load_plugin_textdomain() {
56
+          load_plugin_textdomain( 'lsx-health-plan', false, basename( LSX_HEALTH_PLAN_PATH ) . '/languages' );
57
+     }
58 58
 
59
-	/**
60
-	 * Registers our shortcodes.
61
-	 *
62
-	 * @return void
63
-	 */
64
-	public function load_classes() {
65
-		require_once LSX_HEALTH_PLAN_PATH . 'classes/class-post-type.php';
66
-		$this->post_types = Post_Type::get_instance();
67
-	}
59
+     /**
60
+      * Registers our shortcodes.
61
+      *
62
+      * @return void
63
+      */
64
+     public function load_classes() {
65
+          require_once LSX_HEALTH_PLAN_PATH . 'classes/class-post-type.php';
66
+          $this->post_types = Post_Type::get_instance();
67
+     }
68 68
 
69
-	/**
70
-	 * Registers our shortcodes.
71
-	 *
72
-	 * @return void
73
-	 */
74
-	public function load_shortcodes() {
75
-		add_shortcode( 'lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content' );
76
-		add_shortcode( 'lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs' );
77
-		add_shortcode( 'lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box' );
78
-		add_shortcode( 'lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box' );
79
-		add_shortcode( 'lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices' );
69
+     /**
70
+      * Registers our shortcodes.
71
+      *
72
+      * @return void
73
+      */
74
+     public function load_shortcodes() {
75
+          add_shortcode( 'lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content' );
76
+          add_shortcode( 'lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs' );
77
+          add_shortcode( 'lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box' );
78
+          add_shortcode( 'lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box' );
79
+          add_shortcode( 'lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices' );
80 80
 
81
-		if ( post_type_exists( 'video' ) ) {
82
-			add_shortcode( 'lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box' );
83
-		}
84
-		if ( post_type_exists( 'recipe' ) ) {
85
-			add_shortcode( 'lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box' );
86
-		}
87
-		if ( post_type_exists( 'tip' ) ) {
88
-			add_shortcode( 'lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box' );
89
-		}
90
-		add_shortcode( 'lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box' );
91
-	}
81
+          if ( post_type_exists( 'video' ) ) {
82
+               add_shortcode( 'lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box' );
83
+          }
84
+          if ( post_type_exists( 'recipe' ) ) {
85
+               add_shortcode( 'lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box' );
86
+          }
87
+          if ( post_type_exists( 'tip' ) ) {
88
+               add_shortcode( 'lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box' );
89
+          }
90
+          add_shortcode( 'lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box' );
91
+     }
92 92
 }
Please login to merge, or discard this patch.
lsx-health-plan.php 2 patches
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // If this file is called directly, abort.
15
-if ( ! defined( 'WPINC' ) ) {
15
+if ( ! defined('WPINC')) {
16 16
 	die;
17 17
 }
18
-define( 'LSX_HEALTH_PLAN_PATH', plugin_dir_path( __FILE__ ) );
19
-define( 'LSX_HEALTH_PLAN_CORE', __FILE__ );
20
-define( 'LSX_HEALTH_PLAN_URL', plugin_dir_url( __FILE__ ) );
21
-define( 'LSX_HEALTH_PLAN_VER', '1.4.0' );
18
+define('LSX_HEALTH_PLAN_PATH', plugin_dir_path(__FILE__));
19
+define('LSX_HEALTH_PLAN_CORE', __FILE__);
20
+define('LSX_HEALTH_PLAN_URL', plugin_dir_url(__FILE__));
21
+define('LSX_HEALTH_PLAN_VER', '1.4.0');
22 22
 
23 23
 /* ======================= Below is the Plugin Class init ========================= */
24 24
 
@@ -31,22 +31,22 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function lsx_remove_extra_meta_box() {
33 33
 	global $wp_meta_boxes;
34
-	$all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ];
34
+	$all_post_types = ['plan', 'video', 'workout', 'tip', 'recipe', 'meal'];
35 35
 	//remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' );
36
-	remove_meta_box( 'commentsdiv', $all_post_types, 'normal' );
37
-	remove_meta_box( 'commentstatusdiv', $all_post_types, 'normal' );
38
-	remove_meta_box( 'lsx_blocks_title_meta', $all_post_types, 'side' );
36
+	remove_meta_box('commentsdiv', $all_post_types, 'normal');
37
+	remove_meta_box('commentstatusdiv', $all_post_types, 'normal');
38
+	remove_meta_box('lsx_blocks_title_meta', $all_post_types, 'side');
39 39
 }
40
-add_action( 'add_meta_boxes', 'lsx_remove_extra_meta_box', 100 );
40
+add_action('add_meta_boxes', 'lsx_remove_extra_meta_box', 100);
41 41
 
42 42
 /**
43 43
  * Create Login page with woocommerce shortcode if the page is not created
44 44
  */
45
-if ( ( isset( $_GET['activated'] ) && function_exists( 'wp_verify_nonce' ) && wp_verify_nonce( sanitize_key( $_GET['activated'] ) ) ) && is_admin() ) {
45
+if ((isset($_GET['activated']) && function_exists('wp_verify_nonce') && wp_verify_nonce(sanitize_key($_GET['activated']))) && is_admin()) {
46 46
 
47 47
 	$new_page_title = 'Login';
48 48
 	// Content to add spacing and woocommerce login shortcode
49
-	$new_page_content  = '<!-- wp:lsx-blocks/lsx-container {"containerMaxWidth":600} -->
49
+	$new_page_content = '<!-- wp:lsx-blocks/lsx-container {"containerMaxWidth":600} -->
50 50
 	<div style="background-color:transparent;padding-left:3%;padding-right:3%;padding-bottom:3%;padding-top:3%;margin-top:3%;margin-bottom:3%" class="wp-block-lsx-blocks-lsx-container aligncenter lsx-block-container"><div class="lsx-container-inside"><div class="lsx-container-content" style="max-width:600px"><!-- wp:paragraph -->
51 51
 	<p></p>
52 52
 	<!-- /wp:paragraph -->
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	<!-- /wp:lsx-blocks/lsx-container -->';
58 58
 	$new_page_template = '';
59 59
 
60
-	$page_check = get_page_by_title( $new_page_title );
60
+	$page_check = get_page_by_title($new_page_title);
61 61
 	$new_page   = array(
62 62
 		'post_type'    => 'page',
63 63
 		'post_title'   => $new_page_title,
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 		'post_status'  => 'publish',
66 66
 		'post_author'  => 1,
67 67
 	);
68
-	if ( ! isset( $page_check->ID ) ) {
69
-		$new_page_id = wp_insert_post( $new_page );
70
-		if ( ! empty( $new_page_template ) ) {
71
-			update_post_meta( $new_page_id, '_wp_page_template', $new_page_template );
68
+	if ( ! isset($page_check->ID)) {
69
+		$new_page_id = wp_insert_post($new_page);
70
+		if ( ! empty($new_page_template)) {
71
+			update_post_meta($new_page_id, '_wp_page_template', $new_page_template);
72 72
 		}
73 73
 	}
74 74
 }
@@ -80,18 +80,18 @@  discard block
 block discarded – undo
80 80
  * @param [type] $args
81 81
  * @return void
82 82
  */
83
-function lsx_add_login_logout_register_menu( $items, $args ) {
84
-	if ( 'primary' === $args->theme_location ) {
83
+function lsx_add_login_logout_register_menu($items, $args) {
84
+	if ('primary' === $args->theme_location) {
85 85
 		ob_start();
86
-		wp_loginout( get_permalink() );
86
+		wp_loginout(get_permalink());
87 87
 		$loginoutlink = ob_get_contents();
88 88
 		ob_end_clean();
89
-		if ( ! is_user_logged_in() ) {
90
-			$login_slug = \lsx_health_plan\functions\get_option( 'login_slug', false );
91
-			if ( false === $login_slug ) {
89
+		if ( ! is_user_logged_in()) {
90
+			$login_slug = \lsx_health_plan\functions\get_option('login_slug', false);
91
+			if (false === $login_slug) {
92 92
 				$login_slug = 'login';
93 93
 			}
94
-			$items .= '<li class="my-login menu-item"><a rel="nofollow" href="/' . $login_slug . '/">' . __( 'Login', 'lsx-health-plan' ) . '</a></li>';
94
+			$items .= '<li class="my-login menu-item"><a rel="nofollow" href="/' . $login_slug . '/">' . __('Login', 'lsx-health-plan') . '</a></li>';
95 95
 		} else {
96 96
 			$items .= '<li class="my-login menu-item">' . $loginoutlink . '</li>';
97 97
 		}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		return $items;
101 101
 	}
102 102
 }
103
-add_filter( 'wp_nav_menu_items', 'lsx_add_login_logout_register_menu', 199, 2 );
103
+add_filter('wp_nav_menu_items', 'lsx_add_login_logout_register_menu', 199, 2);
104 104
 
105 105
 /**
106 106
  * Redirect user after login or redirect
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
  * @return void
109 109
  */
110 110
 function lsx_login_redirect() {
111
-	$plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
112
-	if ( false === $plan_slug ) {
111
+	$plan_slug = \lsx_health_plan\functions\get_option('my_plan_slug', false);
112
+	if (false === $plan_slug) {
113 113
 		$plan_slug = 'my-plan';
114 114
 	}
115
-	return home_url( $plan_slug );
115
+	return home_url($plan_slug);
116 116
 }
117
-add_filter( 'woocommerce_login_redirect', 'lsx_login_redirect' );
117
+add_filter('woocommerce_login_redirect', 'lsx_login_redirect');
118 118
 
119 119
 /**
120 120
  * Undocumented function
@@ -131,10 +131,10 @@  discard block
 block discarded – undo
131 131
  *
132 132
  * @return void
133 133
  */
134
-function lsx_get_svg_icon( $icon ) {
134
+function lsx_get_svg_icon($icon) {
135 135
 	$path = '/assets/images/';
136 136
 
137
-	if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) {
137
+	if (file_exists(LSX_HEALTH_PLAN_PATH . $path . $icon)) {
138 138
 		// Load and return the contents of the file
139 139
 		return include LSX_HEALTH_PLAN_PATH . $path . $icon;
140 140
 	}
@@ -148,25 +148,25 @@  discard block
 block discarded – undo
148 148
  *
149 149
  * @return void
150 150
  */
151
-function lsx_workout_snacks( $snack ) {
152
-	$workout_snack = get_post_meta( get_the_ID(), $snack . '_workout_snack', true );
153
-	if ( ! empty( $workout_snack ) ) {
151
+function lsx_workout_snacks($snack) {
152
+	$workout_snack = get_post_meta(get_the_ID(), $snack . '_workout_snack', true);
153
+	if ( ! empty($workout_snack)) {
154 154
 	?>
155
-	<div class="<?php echo esc_html( $snack ); ?>-workout workout-snacks">
155
+	<div class="<?php echo esc_html($snack); ?>-workout workout-snacks">
156 156
 			<div class="content-box">
157 157
 				<?php
158
-				$snack_title = ucfirst( $snack );
159
-				if ( 'pre' === $snack ) {
158
+				$snack_title = ucfirst($snack);
159
+				if ('pre' === $snack) {
160 160
 					/* Translators: %s: snack */
161
-					$title_text = esc_attr_x( 'Pre-Workout Snack', 'pre workout', 'lsx-health-plan' );
161
+					$title_text = esc_attr_x('Pre-Workout Snack', 'pre workout', 'lsx-health-plan');
162 162
 				} else {
163 163
 					/* Translators: %s: snack */
164
-					$title_text = esc_attr_x( 'Post-Workout Snack', 'post workout', 'lsx-health-plan' );
164
+					$title_text = esc_attr_x('Post-Workout Snack', 'post workout', 'lsx-health-plan');
165 165
 				}
166
-				$title = sprintf( $title_text, $snack_title );
166
+				$title = sprintf($title_text, $snack_title);
167 167
 				?>
168
-				<h3 class="title-lined"><?php echo esc_html( $title ); ?></h3>
169
-				<?php echo wp_kses_post( apply_filters( 'the_content', $workout_snack ) ); ?>
168
+				<h3 class="title-lined"><?php echo esc_html($title); ?></h3>
169
+				<?php echo wp_kses_post(apply_filters('the_content', $workout_snack)); ?>
170 170
 			</div>
171 171
 		</div>
172 172
 	<?php
Please login to merge, or discard this patch.
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 // If this file is called directly, abort.
15 15
 if ( ! defined( 'WPINC' ) ) {
16
-	die;
16
+     die;
17 17
 }
18 18
 define( 'LSX_HEALTH_PLAN_PATH', plugin_dir_path( __FILE__ ) );
19 19
 define( 'LSX_HEALTH_PLAN_CORE', __FILE__ );
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
  * @return void
31 31
  */
32 32
 function lsx_remove_extra_meta_box() {
33
-	global $wp_meta_boxes;
34
-	$all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ];
35
-	//remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' );
36
-	remove_meta_box( 'commentsdiv', $all_post_types, 'normal' );
37
-	remove_meta_box( 'commentstatusdiv', $all_post_types, 'normal' );
38
-	remove_meta_box( 'lsx_blocks_title_meta', $all_post_types, 'side' );
33
+     global $wp_meta_boxes;
34
+     $all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ];
35
+     //remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' );
36
+     remove_meta_box( 'commentsdiv', $all_post_types, 'normal' );
37
+     remove_meta_box( 'commentstatusdiv', $all_post_types, 'normal' );
38
+     remove_meta_box( 'lsx_blocks_title_meta', $all_post_types, 'side' );
39 39
 }
40 40
 add_action( 'add_meta_boxes', 'lsx_remove_extra_meta_box', 100 );
41 41
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
  */
45 45
 if ( ( isset( $_GET['activated'] ) && function_exists( 'wp_verify_nonce' ) && wp_verify_nonce( sanitize_key( $_GET['activated'] ) ) ) && is_admin() ) {
46 46
 
47
-	$new_page_title = 'Login';
48
-	// Content to add spacing and woocommerce login shortcode
49
-	$new_page_content  = '<!-- wp:lsx-blocks/lsx-container {"containerMaxWidth":600} -->
47
+     $new_page_title = 'Login';
48
+     // Content to add spacing and woocommerce login shortcode
49
+     $new_page_content  = '<!-- wp:lsx-blocks/lsx-container {"containerMaxWidth":600} -->
50 50
 	<div style="background-color:transparent;padding-left:3%;padding-right:3%;padding-bottom:3%;padding-top:3%;margin-top:3%;margin-bottom:3%" class="wp-block-lsx-blocks-lsx-container aligncenter lsx-block-container"><div class="lsx-container-inside"><div class="lsx-container-content" style="max-width:600px"><!-- wp:paragraph -->
51 51
 	<p></p>
52 52
 	<!-- /wp:paragraph -->
@@ -55,22 +55,22 @@  discard block
 block discarded – undo
55 55
 	[woocommerce_my_account]
56 56
 	<!-- /wp:shortcode --></div></div></div>
57 57
 	<!-- /wp:lsx-blocks/lsx-container -->';
58
-	$new_page_template = '';
58
+     $new_page_template = '';
59 59
 
60
-	$page_check = get_page_by_title( $new_page_title );
61
-	$new_page   = array(
62
-		'post_type'    => 'page',
63
-		'post_title'   => $new_page_title,
64
-		'post_content' => $new_page_content,
65
-		'post_status'  => 'publish',
66
-		'post_author'  => 1,
67
-	);
68
-	if ( ! isset( $page_check->ID ) ) {
69
-		$new_page_id = wp_insert_post( $new_page );
70
-		if ( ! empty( $new_page_template ) ) {
71
-			update_post_meta( $new_page_id, '_wp_page_template', $new_page_template );
72
-		}
73
-	}
60
+     $page_check = get_page_by_title( $new_page_title );
61
+     $new_page   = array(
62
+          'post_type'    => 'page',
63
+          'post_title'   => $new_page_title,
64
+          'post_content' => $new_page_content,
65
+          'post_status'  => 'publish',
66
+          'post_author'  => 1,
67
+     );
68
+     if ( ! isset( $page_check->ID ) ) {
69
+          $new_page_id = wp_insert_post( $new_page );
70
+          if ( ! empty( $new_page_template ) ) {
71
+               update_post_meta( $new_page_id, '_wp_page_template', $new_page_template );
72
+          }
73
+     }
74 74
 }
75 75
 
76 76
 /**
@@ -81,24 +81,24 @@  discard block
 block discarded – undo
81 81
  * @return void
82 82
  */
83 83
 function lsx_add_login_logout_register_menu( $items, $args ) {
84
-	if ( 'primary' === $args->theme_location ) {
85
-		ob_start();
86
-		wp_loginout( get_permalink() );
87
-		$loginoutlink = ob_get_contents();
88
-		ob_end_clean();
89
-		if ( ! is_user_logged_in() ) {
90
-			$login_slug = \lsx_health_plan\functions\get_option( 'login_slug', false );
91
-			if ( false === $login_slug ) {
92
-				$login_slug = 'login';
93
-			}
94
-			$items .= '<li class="my-login menu-item"><a rel="nofollow" href="/' . $login_slug . '/">' . __( 'Login', 'lsx-health-plan' ) . '</a></li>';
95
-		} else {
96
-			$items .= '<li class="my-login menu-item">' . $loginoutlink . '</li>';
97
-		}
98
-		return $items;
99
-	} else {
100
-		return $items;
101
-	}
84
+     if ( 'primary' === $args->theme_location ) {
85
+          ob_start();
86
+          wp_loginout( get_permalink() );
87
+          $loginoutlink = ob_get_contents();
88
+          ob_end_clean();
89
+          if ( ! is_user_logged_in() ) {
90
+               $login_slug = \lsx_health_plan\functions\get_option( 'login_slug', false );
91
+               if ( false === $login_slug ) {
92
+                    $login_slug = 'login';
93
+               }
94
+               $items .= '<li class="my-login menu-item"><a rel="nofollow" href="/' . $login_slug . '/">' . __( 'Login', 'lsx-health-plan' ) . '</a></li>';
95
+          } else {
96
+               $items .= '<li class="my-login menu-item">' . $loginoutlink . '</li>';
97
+          }
98
+          return $items;
99
+     } else {
100
+          return $items;
101
+     }
102 102
 }
103 103
 add_filter( 'wp_nav_menu_items', 'lsx_add_login_logout_register_menu', 199, 2 );
104 104
 
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
  * @return void
109 109
  */
110 110
 function lsx_login_redirect() {
111
-	$plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
112
-	if ( false === $plan_slug ) {
113
-		$plan_slug = 'my-plan';
114
-	}
115
-	return home_url( $plan_slug );
111
+     $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
112
+     if ( false === $plan_slug ) {
113
+          $plan_slug = 'my-plan';
114
+     }
115
+     return home_url( $plan_slug );
116 116
 }
117 117
 add_filter( 'woocommerce_login_redirect', 'lsx_login_redirect' );
118 118
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
  * @return object lsx_health_plan\classes\Core::get_instance();
123 123
  */
124 124
 function lsx_health_plan() {
125
-	return \lsx_health_plan\classes\Core::get_instance();
125
+     return \lsx_health_plan\classes\Core::get_instance();
126 126
 }
127 127
 lsx_health_plan();
128 128
 
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
  * @return void
133 133
  */
134 134
 function lsx_get_svg_icon( $icon ) {
135
-	$path = '/assets/images/';
135
+     $path = '/assets/images/';
136 136
 
137
-	if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) {
138
-		// Load and return the contents of the file
139
-		return include LSX_HEALTH_PLAN_PATH . $path . $icon;
140
-	}
137
+     if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) {
138
+          // Load and return the contents of the file
139
+          return include LSX_HEALTH_PLAN_PATH . $path . $icon;
140
+     }
141 141
 
142
-	// Return a blank string if we can't find the file.
143
-	return '';
142
+     // Return a blank string if we can't find the file.
143
+     return '';
144 144
 }
145 145
 
146 146
 /**
@@ -149,26 +149,26 @@  discard block
 block discarded – undo
149 149
  * @return void
150 150
  */
151 151
 function lsx_workout_snacks( $snack ) {
152
-	$workout_snack = get_post_meta( get_the_ID(), $snack . '_workout_snack', true );
153
-	if ( ! empty( $workout_snack ) ) {
154
-	?>
152
+     $workout_snack = get_post_meta( get_the_ID(), $snack . '_workout_snack', true );
153
+     if ( ! empty( $workout_snack ) ) {
154
+     ?>
155 155
 	<div class="<?php echo esc_html( $snack ); ?>-workout workout-snacks">
156 156
 			<div class="content-box">
157 157
 				<?php
158
-				$snack_title = ucfirst( $snack );
159
-				if ( 'pre' === $snack ) {
160
-					/* Translators: %s: snack */
161
-					$title_text = esc_attr_x( 'Pre-Workout Snack', 'pre workout', 'lsx-health-plan' );
162
-				} else {
163
-					/* Translators: %s: snack */
164
-					$title_text = esc_attr_x( 'Post-Workout Snack', 'post workout', 'lsx-health-plan' );
165
-				}
166
-				$title = sprintf( $title_text, $snack_title );
167
-				?>
158
+                    $snack_title = ucfirst( $snack );
159
+                    if ( 'pre' === $snack ) {
160
+                         /* Translators: %s: snack */
161
+                         $title_text = esc_attr_x( 'Pre-Workout Snack', 'pre workout', 'lsx-health-plan' );
162
+                    } else {
163
+                         /* Translators: %s: snack */
164
+                         $title_text = esc_attr_x( 'Post-Workout Snack', 'post workout', 'lsx-health-plan' );
165
+                    }
166
+                    $title = sprintf( $title_text, $snack_title );
167
+                    ?>
168 168
 				<h3 class="title-lined"><?php echo esc_html( $title ); ?></h3>
169 169
 				<?php echo wp_kses_post( apply_filters( 'the_content', $workout_snack ) ); ?>
170 170
 			</div>
171 171
 		</div>
172 172
 	<?php
173
-	}
173
+     }
174 174
 }
Please login to merge, or discard this patch.
templates/taxonomy-muscle-group.php 3 patches
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 ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) {
23
+		if (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.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 <?php lsx_content_wrap_before(); ?>
11 11
 
12 12
 <?php
13
-	$page_id  = get_the_ID();
14
-	$redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id;
13
+     $page_id  = get_the_ID();
14
+     $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id;
15 15
 ?>
16 16
 
17 17
 	<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>">
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 
21 21
 		<!-- Begining restricted content -->
22 22
 		<?php
23
-		if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) {
24
-			?>
23
+          if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) {
24
+               ?>
25 25
 			<main id="main" role="main">
26 26
 
27 27
 				<?php lsx_content_top(); ?>
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 					<div class="row">
31 31
 						<?php if ( have_posts() ) : ?>
32 32
 							<?php
33
-							while ( have_posts() ) :
34
-								the_post();
35
-								?>
33
+                                   while ( have_posts() ) :
34
+                                        the_post();
35
+                                        ?>
36 36
 
37 37
 								<?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-exercise.php'; ?>
38 38
 
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
 			</main><!-- #main -->
52 52
 
53 53
 			<?php
54
-		} else {
55
-			wp_redirect( $redirect );
56
-			exit;
57
-		}
58
-		?>
54
+          } else {
55
+               wp_redirect( $redirect );
56
+               exit;
57
+          }
58
+          ?>
59 59
 
60 60
 <?php lsx_content_after(); ?>
61 61
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,9 +38,12 @@
 block discarded – undo
38 38
 
39 39
 							<?php endwhile; ?>
40 40
 
41
-						<?php else : ?>
41
+						<?php else {
42
+     : ?>
42 43
 
43
-							<?php get_template_part( 'partials/content', 'none' ); ?>
44
+							<?php get_template_part( 'partials/content', 'none' );
45
+}
46
+?>
44 47
 
45 48
 						<?php endif; ?>
46 49
 					</div>
Please login to merge, or discard this patch.
templates/taxonomy-exercise-type.php 3 patches
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 ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) {
23
+		if (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.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 <?php lsx_content_wrap_before(); ?>
11 11
 
12 12
 <?php
13
-	$page_id  = get_the_ID();
14
-	$redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id;
13
+     $page_id  = get_the_ID();
14
+     $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id;
15 15
 ?>
16 16
 
17 17
 	<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>">
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 
21 21
 		<!-- Begining restricted content -->
22 22
 		<?php
23
-		if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) {
24
-			?>
23
+          if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) {
24
+               ?>
25 25
 			<main id="main" role="main">
26 26
 
27 27
 				<?php lsx_content_top(); ?>
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 					<div class="row">
31 31
 						<?php if ( have_posts() ) : ?>
32 32
 							<?php
33
-							while ( have_posts() ) :
34
-								the_post();
35
-								?>
33
+                                   while ( have_posts() ) :
34
+                                        the_post();
35
+                                        ?>
36 36
 
37 37
 								<?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-exercise.php'; ?>
38 38
 
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
 			</main><!-- #main -->
52 52
 
53 53
 			<?php
54
-		} else {
55
-			wp_redirect( $redirect );
56
-			exit;
57
-		}
58
-		?>
54
+          } else {
55
+               wp_redirect( $redirect );
56
+               exit;
57
+          }
58
+          ?>
59 59
 
60 60
 <?php lsx_content_after(); ?>
61 61
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,9 +38,12 @@
 block discarded – undo
38 38
 
39 39
 							<?php endwhile; ?>
40 40
 
41
-						<?php else : ?>
41
+						<?php else {
42
+     : ?>
42 43
 
43
-							<?php get_template_part( 'partials/content', 'none' ); ?>
44
+							<?php get_template_part( 'partials/content', 'none' );
45
+}
46
+?>
44 47
 
45 48
 						<?php endif; ?>
46 49
 					</div>
Please login to merge, or discard this patch.
templates/single-recipe.php 2 patches
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
 
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 
18 18
 		<?php lsx_content_top(); ?>
19 19
 
20
-		<?php if ( have_posts() ) : ?>
20
+		<?php if (have_posts()) : ?>
21 21
 
22 22
 			<?php
23
-			while ( have_posts() ) :
23
+			while (have_posts()) :
24 24
 				the_post();
25 25
 				?>
26 26
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	<?php lsx_content_after(); ?>
38 38
 
39 39
 	<?php
40
-	if ( is_singular( 'post' ) ) {
40
+	if (is_singular('post')) {
41 41
 		lsx_post_nav();
42 42
 	}
43 43
 	?>
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 		<?php if ( have_posts() ) : ?>
21 21
 
22 22
 			<?php
23
-			while ( have_posts() ) :
24
-				the_post();
25
-				?>
23
+               while ( have_posts() ) :
24
+                    the_post();
25
+                    ?>
26 26
 
27 27
 				<?php include LSX_HEALTH_PLAN_PATH . '/templates/content-recipe.php'; ?>
28 28
 
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 	<?php lsx_content_after(); ?>
38 38
 
39 39
 	<?php
40
-	if ( is_singular( 'post' ) ) {
41
-		lsx_post_nav();
42
-	}
43
-	?>
40
+     if ( is_singular( 'post' ) ) {
41
+          lsx_post_nav();
42
+     }
43
+     ?>
44 44
 
45 45
 </div><!-- #primary -->
46 46
 
Please login to merge, or discard this patch.
classes/frontend/class-gallery.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public static function get_instance() {
81 81
 		// If the single instance hasn't been set, set it now.
82
-		if ( null === self::$instance ) {
82
+		if (null === self::$instance) {
83 83
 			self::$instance = new self();
84 84
 		}
85 85
 		return self::$instance;
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
 	 * @param  string $post_type
93 93
 	 * @return boolean
94 94
 	 */
95
-	public function has_gallery( $item_id = '', $post_type = '' ) {
95
+	public function has_gallery($item_id = '', $post_type = '') {
96 96
 		$this->gallery     = array();
97 97
 		$this->has_gallery = false;
98
-		if ( '' === $item_id ) {
98
+		if ('' === $item_id) {
99 99
 			$this->item_id = get_the_ID();
100 100
 		} else {
101 101
 			$this->item_id = $item_id;
102 102
 		}
103 103
 
104
-		if ( '' === $post_type ) {
105
-			$this->post_type = get_post_type( $this->item_id );
104
+		if ('' === $post_type) {
105
+			$this->post_type = get_post_type($this->item_id);
106 106
 		}
107
-		$gallery = get_post_meta( $this->item_id, $this->post_type . '_gallery', true );
108
-		if ( ! empty( $gallery ) ) {
107
+		$gallery = get_post_meta($this->item_id, $this->post_type . '_gallery', true);
108
+		if ( ! empty($gallery)) {
109 109
 			$this->gallery     = $gallery;
110 110
 			$this->has_gallery = true;
111
-			wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/src/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
112
-			wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-slider.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true );
111
+			wp_enqueue_script('slick', LSX_HEALTH_PLAN_URL . 'assets/js/src/slick.min.js', array('jquery'), LSX_HEALTH_PLAN_VER, true);
112
+			wp_enqueue_script('lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-slider.js', array('slick'), LSX_HEALTH_PLAN_VER, true);
113 113
 		}
114 114
 		return $this->has_gallery;
115 115
 	}
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 	 * @param  string $post_type
122 122
 	 * @return array
123 123
 	 */
124
-	public function get_defaults( $item_id = '', $post_type = '' ) {
125
-		if ( '' === $item_id ) {
124
+	public function get_defaults($item_id = '', $post_type = '') {
125
+		if ('' === $item_id) {
126 126
 			$item_id = $this->item_id;
127 127
 		}
128
-		if ( '' === $post_type ) {
128
+		if ('' === $post_type) {
129 129
 			$post_type = $this->post_type;
130 130
 		}
131 131
 		$this->defaults = array(
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 			'interval'  => false,
135 135
 			'css_class' => false,
136 136
 		);
137
-		foreach ( $this->defaults as $key => $default ) {
138
-			$override = get_post_meta( $item_id, $this->post_type . '_gallery_' . $key, true );
139
-			if ( '' !== $override && false !== $override && ! empty( $override ) ) {
140
-				$this->defaults[ $key ] = $override;
137
+		foreach ($this->defaults as $key => $default) {
138
+			$override = get_post_meta($item_id, $this->post_type . '_gallery_' . $key, true);
139
+			if ('' !== $override && false !== $override && ! empty($override)) {
140
+				$this->defaults[$key] = $override;
141 141
 			}
142 142
 		}
143 143
 		return $this->defaults;
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
 	 * @param string $post_type
151 151
 	 * @return void
152 152
 	 */
153
-	public function get_gallery( $item_id = '', $post_type = '', $args = array() ) {
153
+	public function get_gallery($item_id = '', $post_type = '', $args = array()) {
154 154
 		$return     = '';
155 155
 		$this->html = array();
156
-		$this->args = wp_parse_args( $args, $this->get_defaults( $item_id, $post_type ) );
157
-		if ( ! empty( $this->gallery ) ) {
156
+		$this->args = wp_parse_args($args, $this->get_defaults($item_id, $post_type));
157
+		if ( ! empty($this->gallery)) {
158 158
 			$this->args['count'] = 1;
159
-			if ( '' !== $post_type ) {
159
+			if ('' !== $post_type) {
160 160
 				$this->args['post_type'] = $post_type;
161 161
 			} else {
162 162
 				$this->args['post_type'] = $this->post_type;
@@ -165,20 +165,20 @@  discard block
 block discarded – undo
165 165
 			// output the opening boostrap row divs.
166 166
 			$this->before_loop();
167 167
 
168
-			foreach ( $this->gallery as $key => $gallery ) {
168
+			foreach ($this->gallery as $key => $gallery) {
169 169
 
170 170
 				$this->loop_start();
171 171
 
172
-				if ( isset( $gallery['exercise_gallery_image_id'] ) && ! empty( $gallery['exercise_gallery_image_id'] ) ) {
173
-					$this->html[] = '<img alt="' . get_the_title( $gallery['exercise_gallery_image_id'] ) . '" src="' . $gallery['exercise_gallery_image'] . '" />';
174
-				} elseif ( isset( $gallery['exercise_gallery_external'] ) && ! empty( $gallery['exercise_gallery_external'] ) ) {
172
+				if (isset($gallery['exercise_gallery_image_id']) && ! empty($gallery['exercise_gallery_image_id'])) {
173
+					$this->html[] = '<img alt="' . get_the_title($gallery['exercise_gallery_image_id']) . '" src="' . $gallery['exercise_gallery_image'] . '" />';
174
+				} elseif (isset($gallery['exercise_gallery_external']) && ! empty($gallery['exercise_gallery_external'])) {
175 175
 					$this->html[] = $gallery['exercise_gallery_external']; // WPCS: XSS OK.
176
-				} elseif ( isset( $gallery['exercise_gallery_embed'] ) && ! empty( $gallery['exercise_gallery_embed'] ) ) {
176
+				} elseif (isset($gallery['exercise_gallery_embed']) && ! empty($gallery['exercise_gallery_embed'])) {
177 177
 					$embed_args = array(
178 178
 						'width' => '530',
179 179
 					);
180
-					$embed        = wp_oembed_get( $gallery['exercise_gallery_embed'], $embed_args );
181
-					$this->html[] = str_replace( 'width="530"', 'width="100%"', $embed ); // WPCS: XSS OK.
180
+					$embed        = wp_oembed_get($gallery['exercise_gallery_embed'], $embed_args);
181
+					$this->html[] = str_replace('width="530"', 'width="100%"', $embed); // WPCS: XSS OK.
182 182
 				}
183 183
 
184 184
 				$this->loop_end();
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 		}
192 192
 
193 193
 		// Join the html output if its not empty.
194
-		if ( ! empty( $this->html ) ) {
195
-			$return = implode( '', $this->html );
194
+		if ( ! empty($this->html)) {
195
+			$return = implode('', $this->html);
196 196
 		}
197 197
 		return $return;
198 198
 	}
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 	 * Runs just after the if and before the while statement in $this->output()
214 214
 	 */
215 215
 	public function before_loop() {
216
-		if ( 'slider' === $this->args['layout'] ) {
217
-			$this->carousel_id = wp_rand( 20, 20000 );
216
+		if ('slider' === $this->args['layout']) {
217
+			$this->carousel_id = wp_rand(20, 20000);
218 218
 			$this->html[]      = "<div class='lsx-hp-widget-items slick-slider slick-dotted slick-has-arrows {$this->args['css_class']} ' data-interval='{$this->args['interval']}' data-slick='{ \"slidesToShow\": {$this->args['columns']}, \"slidesToScroll\": {$this->args['columns']} }'>";
219 219
 		} else {
220 220
 			$this->html[] = "<div class='lsx-hp-widget-items widget-item-grid-layout'>";
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function loop_start() {
228 228
 		// Get the call for the active slide.
229
-		if ( 'slider' === $this->args['layout'] ) {
229
+		if ('slider' === $this->args['layout']) {
230 230
 			$this->html[] = "<div class='lsx-hp-widget-item-wrap lsx-{$this->args['post_type']}'>";
231 231
 		} else {
232
-			if ( 1 === $this->args['count'] ) {
232
+			if (1 === $this->args['count']) {
233 233
 				$this->html[] = "<div class='row'>";
234 234
 			}
235 235
 			$this->html[] = '<div class="' . $this->column_class() . '">';
@@ -240,16 +240,16 @@  discard block
 block discarded – undo
240 240
 	 * Runs at the very end of the loop before it runs again.
241 241
 	 */
242 242
 	public function loop_end() {
243
-		if ( 'slider' !== $this->args['layout'] ) {
243
+		if ('slider' !== $this->args['layout']) {
244 244
 			$this->html[] = '</div>';
245 245
 		}
246 246
 		// Close the current slide panel.
247
-		if ( 'slider' === $this->args['layout'] ) {
247
+		if ('slider' === $this->args['layout']) {
248 248
 			$this->html[] = '</div>';
249
-		} elseif ( 0 === $this->args['count'] % $this->args['columns'] || count( $this->gallery ) === $this->args['count'] ) {
249
+		} elseif (0 === $this->args['count'] % $this->args['columns'] || count($this->gallery) === $this->args['count']) {
250 250
 			$this->html[] = '</div>';
251 251
 
252
-			if ( $this->args['count'] < count( $this->gallery ) ) {
252
+			if ($this->args['count'] < count($this->gallery)) {
253 253
 				$this->html[] = "<div class='row'>";
254 254
 			}
255 255
 		}
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function after_loop() {
262 262
 		// Slider output Closing.
263
-		if ( 'slider' === $this->args['layout'] ) {
263
+		if ('slider' === $this->args['layout']) {
264 264
 			$this->html[] = '</div>';
265 265
 		} else {
266 266
 			$this->html[] = '</div>';
Please login to merge, or discard this patch.
Indentation   +231 added lines, -231 removed lines patch added patch discarded remove patch
@@ -8,262 +8,262 @@
 block discarded – undo
8 8
  */
9 9
 class Gallery {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @var object \lsx_health_plan\classes\lib\Gallery()
15
-	 */
16
-	protected static $instance = null;
11
+     /**
12
+      * Holds class instance
13
+      *
14
+      * @var object \lsx_health_plan\classes\lib\Gallery()
15
+      */
16
+     protected static $instance = null;
17 17
 
18
-	/**
19
-	 * The current item ID.
20
-	 *
21
-	 * @var boolean | int
22
-	 */
23
-	public $item_id = false;
18
+     /**
19
+      * The current item ID.
20
+      *
21
+      * @var boolean | int
22
+      */
23
+     public $item_id = false;
24 24
 
25
-	/**
26
-	 * The current item post_type used in the custom field retrival..
27
-	 *
28
-	 * @var boolean | int
29
-	 */
30
-	public $post_type = false;
25
+     /**
26
+      * The current item post_type used in the custom field retrival..
27
+      *
28
+      * @var boolean | int
29
+      */
30
+     public $post_type = false;
31 31
 
32
-	/**
33
-	 * Holds the the default parameters for the gallery output.
34
-	 *
35
-	 * @var array
36
-	 */
37
-	public $defaults = array();
32
+     /**
33
+      * Holds the the default parameters for the gallery output.
34
+      *
35
+      * @var array
36
+      */
37
+     public $defaults = array();
38 38
 
39
-	/**
40
-	 * If the current post has a gallery.
41
-	 *
42
-	 * @var boolean
43
-	 */
44
-	public $has_gallery = false;
39
+     /**
40
+      * If the current post has a gallery.
41
+      *
42
+      * @var boolean
43
+      */
44
+     public $has_gallery = false;
45 45
 
46
-	/**
47
-	 * Holds the array of gallery images.
48
-	 *
49
-	 * @var array
50
-	 */
51
-	public $gallery = array();
46
+     /**
47
+      * Holds the array of gallery images.
48
+      *
49
+      * @var array
50
+      */
51
+     public $gallery = array();
52 52
 
53
-	/**
54
-	 * Holds the html for the current gallery being output.
55
-	 *
56
-	 * @var array
57
-	 */
58
-	public $html = array();
53
+     /**
54
+      * Holds the html for the current gallery being output.
55
+      *
56
+      * @var array
57
+      */
58
+     public $html = array();
59 59
 
60
-	/**
61
-	 * Holds the parameters for the current gallery being output.
62
-	 *
63
-	 * @var array
64
-	 */
65
-	public $args = array();
60
+     /**
61
+      * Holds the parameters for the current gallery being output.
62
+      *
63
+      * @var array
64
+      */
65
+     public $args = array();
66 66
 
67
-	/**
68
-	 * Contructor
69
-	 */
70
-	public function __construct() {
71
-	}
67
+     /**
68
+      * Contructor
69
+      */
70
+     public function __construct() {
71
+     }
72 72
 
73
-	/**
74
-	 * Return an instance of this class.
75
-	 *
76
-	 * @since 1.0.0
77
-	 *
78
-	 * @return    object \lsx_health_plan\classes\lib\Gallery()    A single instance of this class.
79
-	 */
80
-	public static function get_instance() {
81
-		// If the single instance hasn't been set, set it now.
82
-		if ( null === self::$instance ) {
83
-			self::$instance = new self();
84
-		}
85
-		return self::$instance;
86
-	}
73
+     /**
74
+      * Return an instance of this class.
75
+      *
76
+      * @since 1.0.0
77
+      *
78
+      * @return    object \lsx_health_plan\classes\lib\Gallery()    A single instance of this class.
79
+      */
80
+     public static function get_instance() {
81
+          // If the single instance hasn't been set, set it now.
82
+          if ( null === self::$instance ) {
83
+               self::$instance = new self();
84
+          }
85
+          return self::$instance;
86
+     }
87 87
 
88
-	/**
89
-	 * Check if the item has a gallery of images returns true or false.
90
-	 *
91
-	 * @param  string $item_id
92
-	 * @param  string $post_type
93
-	 * @return boolean
94
-	 */
95
-	public function has_gallery( $item_id = '', $post_type = '' ) {
96
-		$this->gallery     = array();
97
-		$this->has_gallery = false;
98
-		if ( '' === $item_id ) {
99
-			$this->item_id = get_the_ID();
100
-		} else {
101
-			$this->item_id = $item_id;
102
-		}
88
+     /**
89
+      * Check if the item has a gallery of images returns true or false.
90
+      *
91
+      * @param  string $item_id
92
+      * @param  string $post_type
93
+      * @return boolean
94
+      */
95
+     public function has_gallery( $item_id = '', $post_type = '' ) {
96
+          $this->gallery     = array();
97
+          $this->has_gallery = false;
98
+          if ( '' === $item_id ) {
99
+               $this->item_id = get_the_ID();
100
+          } else {
101
+               $this->item_id = $item_id;
102
+          }
103 103
 
104
-		if ( '' === $post_type ) {
105
-			$this->post_type = get_post_type( $this->item_id );
106
-		}
107
-		$gallery = get_post_meta( $this->item_id, $this->post_type . '_gallery', true );
108
-		if ( ! empty( $gallery ) ) {
109
-			$this->gallery     = $gallery;
110
-			$this->has_gallery = true;
111
-			wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/src/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
112
-			wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-slider.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true );
113
-		}
114
-		return $this->has_gallery;
115
-	}
104
+          if ( '' === $post_type ) {
105
+               $this->post_type = get_post_type( $this->item_id );
106
+          }
107
+          $gallery = get_post_meta( $this->item_id, $this->post_type . '_gallery', true );
108
+          if ( ! empty( $gallery ) ) {
109
+               $this->gallery     = $gallery;
110
+               $this->has_gallery = true;
111
+               wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/src/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
112
+               wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-slider.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true );
113
+          }
114
+          return $this->has_gallery;
115
+     }
116 116
 
117
-	/**
118
-	 * Returns the defaults for the gallery, after grabbing the setting from the item.
119
-	 *
120
-	 * @param  string $item_id
121
-	 * @param  string $post_type
122
-	 * @return array
123
-	 */
124
-	public function get_defaults( $item_id = '', $post_type = '' ) {
125
-		if ( '' === $item_id ) {
126
-			$item_id = $this->item_id;
127
-		}
128
-		if ( '' === $post_type ) {
129
-			$post_type = $this->post_type;
130
-		}
131
-		$this->defaults = array(
132
-			'columns'   => '3',
133
-			'layout'    => 'slider',
134
-			'interval'  => false,
135
-			'css_class' => false,
136
-		);
137
-		foreach ( $this->defaults as $key => $default ) {
138
-			$override = get_post_meta( $item_id, $this->post_type . '_gallery_' . $key, true );
139
-			if ( '' !== $override && false !== $override && ! empty( $override ) ) {
140
-				$this->defaults[ $key ] = $override;
141
-			}
142
-		}
143
-		return $this->defaults;
144
-	}
117
+     /**
118
+      * Returns the defaults for the gallery, after grabbing the setting from the item.
119
+      *
120
+      * @param  string $item_id
121
+      * @param  string $post_type
122
+      * @return array
123
+      */
124
+     public function get_defaults( $item_id = '', $post_type = '' ) {
125
+          if ( '' === $item_id ) {
126
+               $item_id = $this->item_id;
127
+          }
128
+          if ( '' === $post_type ) {
129
+               $post_type = $this->post_type;
130
+          }
131
+          $this->defaults = array(
132
+               'columns'   => '3',
133
+               'layout'    => 'slider',
134
+               'interval'  => false,
135
+               'css_class' => false,
136
+          );
137
+          foreach ( $this->defaults as $key => $default ) {
138
+               $override = get_post_meta( $item_id, $this->post_type . '_gallery_' . $key, true );
139
+               if ( '' !== $override && false !== $override && ! empty( $override ) ) {
140
+                    $this->defaults[ $key ] = $override;
141
+               }
142
+          }
143
+          return $this->defaults;
144
+     }
145 145
 
146
-	/**
147
-	 * Gets and returns the gallery html.
148
-	 *
149
-	 * @param string $item_id
150
-	 * @param string $post_type
151
-	 * @return void
152
-	 */
153
-	public function get_gallery( $item_id = '', $post_type = '', $args = array() ) {
154
-		$return     = '';
155
-		$this->html = array();
156
-		$this->args = wp_parse_args( $args, $this->get_defaults( $item_id, $post_type ) );
157
-		if ( ! empty( $this->gallery ) ) {
158
-			$this->args['count'] = 1;
159
-			if ( '' !== $post_type ) {
160
-				$this->args['post_type'] = $post_type;
161
-			} else {
162
-				$this->args['post_type'] = $this->post_type;
163
-			}
146
+     /**
147
+      * Gets and returns the gallery html.
148
+      *
149
+      * @param string $item_id
150
+      * @param string $post_type
151
+      * @return void
152
+      */
153
+     public function get_gallery( $item_id = '', $post_type = '', $args = array() ) {
154
+          $return     = '';
155
+          $this->html = array();
156
+          $this->args = wp_parse_args( $args, $this->get_defaults( $item_id, $post_type ) );
157
+          if ( ! empty( $this->gallery ) ) {
158
+               $this->args['count'] = 1;
159
+               if ( '' !== $post_type ) {
160
+                    $this->args['post_type'] = $post_type;
161
+               } else {
162
+                    $this->args['post_type'] = $this->post_type;
163
+               }
164 164
 
165
-			// output the opening boostrap row divs.
166
-			$this->before_loop();
165
+               // output the opening boostrap row divs.
166
+               $this->before_loop();
167 167
 
168
-			foreach ( $this->gallery as $key => $gallery ) {
168
+               foreach ( $this->gallery as $key => $gallery ) {
169 169
 
170
-				$this->loop_start();
170
+                    $this->loop_start();
171 171
 
172
-				if ( isset( $gallery['exercise_gallery_image_id'] ) && ! empty( $gallery['exercise_gallery_image_id'] ) ) {
173
-					$this->html[] = '<img alt="' . get_the_title( $gallery['exercise_gallery_image_id'] ) . '" src="' . $gallery['exercise_gallery_image'] . '" />';
174
-				} elseif ( isset( $gallery['exercise_gallery_external'] ) && ! empty( $gallery['exercise_gallery_external'] ) ) {
175
-					$this->html[] = $gallery['exercise_gallery_external']; // WPCS: XSS OK.
176
-				} elseif ( isset( $gallery['exercise_gallery_embed'] ) && ! empty( $gallery['exercise_gallery_embed'] ) ) {
177
-					$embed_args = array(
178
-						'width' => '530',
179
-					);
180
-					$embed        = wp_oembed_get( $gallery['exercise_gallery_embed'], $embed_args );
181
-					$this->html[] = str_replace( 'width="530"', 'width="100%"', $embed ); // WPCS: XSS OK.
182
-				}
172
+                    if ( isset( $gallery['exercise_gallery_image_id'] ) && ! empty( $gallery['exercise_gallery_image_id'] ) ) {
173
+                         $this->html[] = '<img alt="' . get_the_title( $gallery['exercise_gallery_image_id'] ) . '" src="' . $gallery['exercise_gallery_image'] . '" />';
174
+                    } elseif ( isset( $gallery['exercise_gallery_external'] ) && ! empty( $gallery['exercise_gallery_external'] ) ) {
175
+                         $this->html[] = $gallery['exercise_gallery_external']; // WPCS: XSS OK.
176
+                    } elseif ( isset( $gallery['exercise_gallery_embed'] ) && ! empty( $gallery['exercise_gallery_embed'] ) ) {
177
+                         $embed_args = array(
178
+                              'width' => '530',
179
+                         );
180
+                         $embed        = wp_oembed_get( $gallery['exercise_gallery_embed'], $embed_args );
181
+                         $this->html[] = str_replace( 'width="530"', 'width="100%"', $embed ); // WPCS: XSS OK.
182
+                    }
183 183
 
184
-				$this->loop_end();
184
+                    $this->loop_end();
185 185
 
186
-				$this->args['count']++;
187
-			}
186
+                    $this->args['count']++;
187
+               }
188 188
 
189
-			// output the closing boostrap row divs.
190
-			$this->after_loop();
191
-		}
189
+               // output the closing boostrap row divs.
190
+               $this->after_loop();
191
+          }
192 192
 
193
-		// Join the html output if its not empty.
194
-		if ( ! empty( $this->html ) ) {
195
-			$return = implode( '', $this->html );
196
-		}
197
-		return $return;
198
-	}
193
+          // Join the html output if its not empty.
194
+          if ( ! empty( $this->html ) ) {
195
+               $return = implode( '', $this->html );
196
+          }
197
+          return $return;
198
+     }
199 199
 
200
-	/**
201
-	 * Outputs the CSS class for the panels
202
-	 *
203
-	 * @param string $columns
204
-	 * @return string
205
-	 */
206
-	public function column_class() {
207
-		$cols  = 'col-xs-12 col-sm-';
208
-		$cols .= '5' === $this->args['columns'] ? '15' : 12 / $this->args['columns'];
209
-		return $cols;
210
-	}
200
+     /**
201
+      * Outputs the CSS class for the panels
202
+      *
203
+      * @param string $columns
204
+      * @return string
205
+      */
206
+     public function column_class() {
207
+          $cols  = 'col-xs-12 col-sm-';
208
+          $cols .= '5' === $this->args['columns'] ? '15' : 12 / $this->args['columns'];
209
+          return $cols;
210
+     }
211 211
 
212
-	/**
213
-	 * Runs just after the if and before the while statement in $this->output()
214
-	 */
215
-	public function before_loop() {
216
-		if ( 'slider' === $this->args['layout'] ) {
217
-			$this->carousel_id = wp_rand( 20, 20000 );
218
-			$this->html[]      = "<div class='lsx-hp-widget-items slick-slider slick-dotted slick-has-arrows {$this->args['css_class']} ' data-interval='{$this->args['interval']}' data-slick='{ \"slidesToShow\": {$this->args['columns']}, \"slidesToScroll\": {$this->args['columns']} }'>";
219
-		} else {
220
-			$this->html[] = "<div class='lsx-hp-widget-items widget-item-grid-layout'>";
221
-		}
222
-	}
212
+     /**
213
+      * Runs just after the if and before the while statement in $this->output()
214
+      */
215
+     public function before_loop() {
216
+          if ( 'slider' === $this->args['layout'] ) {
217
+               $this->carousel_id = wp_rand( 20, 20000 );
218
+               $this->html[]      = "<div class='lsx-hp-widget-items slick-slider slick-dotted slick-has-arrows {$this->args['css_class']} ' data-interval='{$this->args['interval']}' data-slick='{ \"slidesToShow\": {$this->args['columns']}, \"slidesToScroll\": {$this->args['columns']} }'>";
219
+          } else {
220
+               $this->html[] = "<div class='lsx-hp-widget-items widget-item-grid-layout'>";
221
+          }
222
+     }
223 223
 
224
-	/**
225
-	 * Runs at the very end of the loop before it runs again.
226
-	 */
227
-	public function loop_start() {
228
-		// Get the call for the active slide.
229
-		if ( 'slider' === $this->args['layout'] ) {
230
-			$this->html[] = "<div class='lsx-hp-widget-item-wrap lsx-{$this->args['post_type']}'>";
231
-		} else {
232
-			if ( 1 === $this->args['count'] ) {
233
-				$this->html[] = "<div class='row'>";
234
-			}
235
-			$this->html[] = '<div class="' . $this->column_class() . '">';
236
-		}
237
-	}
224
+     /**
225
+      * Runs at the very end of the loop before it runs again.
226
+      */
227
+     public function loop_start() {
228
+          // Get the call for the active slide.
229
+          if ( 'slider' === $this->args['layout'] ) {
230
+               $this->html[] = "<div class='lsx-hp-widget-item-wrap lsx-{$this->args['post_type']}'>";
231
+          } else {
232
+               if ( 1 === $this->args['count'] ) {
233
+                    $this->html[] = "<div class='row'>";
234
+               }
235
+               $this->html[] = '<div class="' . $this->column_class() . '">';
236
+          }
237
+     }
238 238
 
239
-	/**
240
-	 * Runs at the very end of the loop before it runs again.
241
-	 */
242
-	public function loop_end() {
243
-		if ( 'slider' !== $this->args['layout'] ) {
244
-			$this->html[] = '</div>';
245
-		}
246
-		// Close the current slide panel.
247
-		if ( 'slider' === $this->args['layout'] ) {
248
-			$this->html[] = '</div>';
249
-		} elseif ( 0 === $this->args['count'] % $this->args['columns'] || count( $this->gallery ) === $this->args['count'] ) {
250
-			$this->html[] = '</div>';
239
+     /**
240
+      * Runs at the very end of the loop before it runs again.
241
+      */
242
+     public function loop_end() {
243
+          if ( 'slider' !== $this->args['layout'] ) {
244
+               $this->html[] = '</div>';
245
+          }
246
+          // Close the current slide panel.
247
+          if ( 'slider' === $this->args['layout'] ) {
248
+               $this->html[] = '</div>';
249
+          } elseif ( 0 === $this->args['count'] % $this->args['columns'] || count( $this->gallery ) === $this->args['count'] ) {
250
+               $this->html[] = '</div>';
251 251
 
252
-			if ( $this->args['count'] < count( $this->gallery ) ) {
253
-				$this->html[] = "<div class='row'>";
254
-			}
255
-		}
256
-	}
252
+               if ( $this->args['count'] < count( $this->gallery ) ) {
253
+                    $this->html[] = "<div class='row'>";
254
+               }
255
+          }
256
+     }
257 257
 
258
-	/**
259
-	 * Runs just after the if and before the while statement in $this->output()
260
-	 */
261
-	public function after_loop() {
262
-		// Slider output Closing.
263
-		if ( 'slider' === $this->args['layout'] ) {
264
-			$this->html[] = '</div>';
265
-		} else {
266
-			$this->html[] = '</div>';
267
-		}
268
-	}
258
+     /**
259
+      * Runs just after the if and before the while statement in $this->output()
260
+      */
261
+     public function after_loop() {
262
+          // Slider output Closing.
263
+          if ( 'slider' === $this->args['layout'] ) {
264
+               $this->html[] = '</div>';
265
+          } else {
266
+               $this->html[] = '</div>';
267
+          }
268
+     }
269 269
 }
Please login to merge, or discard this patch.
includes/template-tags/exercise.php 2 patches
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
  * @return exercise_type
12 12
  */
13 13
 function lsx_health_plan_exercise_type() {
14
-	$term_obj_list = get_the_term_list( get_the_ID(), 'exercise-type', '', ', ' );
15
-	if ( ! empty( $term_obj_list ) ) {
14
+	$term_obj_list = get_the_term_list(get_the_ID(), 'exercise-type', '', ', ');
15
+	if ( ! empty($term_obj_list)) {
16 16
 		return $term_obj_list;
17 17
 	}
18 18
 }
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
  * @return muscle_group_equipment
24 24
  */
25 25
 function lsx_health_plan_muscle_group_equipment() {
26
-	$term_obj_list = get_the_term_list( get_the_ID(), 'muscle-group', '', ', ' );
27
-	if ( ! empty( $term_obj_list ) ) {
26
+	$term_obj_list = get_the_term_list(get_the_ID(), 'muscle-group', '', ', ');
27
+	if ( ! empty($term_obj_list)) {
28 28
 		return $term_obj_list;
29 29
 	}
30 30
 }
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
  * @return exercise_equipment
36 36
  */
37 37
 function lsx_health_plan_exercise_equipment() {
38
-	$term_obj_list = get_the_term_list( get_the_ID(), 'equipment', '', ', ' );
39
-	if ( ! empty( $term_obj_list ) ) {
38
+	$term_obj_list = get_the_term_list(get_the_ID(), 'equipment', '', ', ');
39
+	if ( ! empty($term_obj_list)) {
40 40
 		return $term_obj_list;
41 41
 	}
42 42
 }
@@ -59,61 +59,61 @@  discard block
 block discarded – undo
59 59
  * @param array   $args
60 60
  * @return void
61 61
  */
62
-function lsx_health_plan_workout_exercise_button( $m, $group, $echo = true, $args = array() ) {
62
+function lsx_health_plan_workout_exercise_button($m, $group, $echo = true, $args = array()) {
63 63
 	$defaults = array(
64 64
 		'modal_trigger' => 'button',
65 65
 		'modal_content' => 'excerpt',
66 66
 	);
67
-	$args     = wp_parse_args( $args, $defaults );
67
+	$args = wp_parse_args($args, $defaults);
68 68
 
69 69
 	$exercise_id = '';
70
-	if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) {
71
-		$exercise_id     = esc_html( $group['connected_exercises'] );
72
-		$content         = get_post_field( 'post_content', $exercise_id );
73
-		$url             = get_permalink( $exercise_id );
74
-		$equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' );
75
-		$muscle_group    = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' );
70
+	if (isset($group['connected_exercises']) && '' !== $group['connected_exercises']) {
71
+		$exercise_id     = esc_html($group['connected_exercises']);
72
+		$content         = get_post_field('post_content', $exercise_id);
73
+		$url             = get_permalink($exercise_id);
74
+		$equipment_group = get_the_term_list($exercise_id, 'equipment', '', ', ');
75
+		$muscle_group    = get_the_term_list($exercise_id, 'muscle-group', '', ', ');
76 76
 		$lsx_hp          = lsx_health_plan();
77 77
 
78
-		if ( 'excerpt' === $args['modal_content'] ) {
79
-			$content = wp_trim_words( $content, 40 );
78
+		if ('excerpt' === $args['modal_content']) {
79
+			$content = wp_trim_words($content, 40);
80 80
 		}
81 81
 
82
-		if ( 'link' ) {
83
-			$play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>';
82
+		if ('link') {
83
+			$play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title($exercise_id) . '</a>';
84 84
 		} else {
85 85
 			$play_button = '<button data-toggle="modal" data-target="#workout-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>';
86 86
 		}
87 87
 
88
-		$modal_body  = '';
89
-		if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) {
88
+		$modal_body = '';
89
+		if ($lsx_hp->frontend->gallery->has_gallery($exercise_id)) {
90 90
 			$gallery_args = array(
91 91
 				'css_class' => 'modal-slider',
92 92
 			);
93
-			$modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args );
93
+			$modal_body .= $lsx_hp->frontend->gallery->get_gallery('', '', $gallery_args);
94 94
 		} else {
95
-			$modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>';
95
+			$modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail($exercise_id, 'large') . '</div>';
96 96
 		}
97 97
 
98
-		$modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>';
98
+		$modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title($exercise_id) . '</h5>';
99 99
 
100
-		if ( ! empty( $equipment_group ) ) {
101
-			$modal_body .= '<span class="equipment-terms">' . __( 'Equipment', 'lsx-health-plan' ) . ': ' . $equipment_group . '</span>';
100
+		if ( ! empty($equipment_group)) {
101
+			$modal_body .= '<span class="equipment-terms">' . __('Equipment', 'lsx-health-plan') . ': ' . $equipment_group . '</span>';
102 102
 		}
103
-		if ( ! empty( $muscle_group ) ) {
104
-			$modal_body .= '<span class="muscle-terms">' . __( 'Muscle Group', 'lsx-health-plan' ) . ': ' . $muscle_group . '</span>';
103
+		if ( ! empty($muscle_group)) {
104
+			$modal_body .= '<span class="muscle-terms">' . __('Muscle Group', 'lsx-health-plan') . ': ' . $muscle_group . '</span>';
105 105
 		}
106 106
 		$modal_body .= '</div>';
107
-		if ( '' !== $args['modal_content'] ) {
107
+		if ('' !== $args['modal_content']) {
108 108
 			$modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>';
109 109
 		}
110
-		if ( 'excerpt' === $args['modal_content'] ) {
111
-			$modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-health-plan' ) . '</a>';
110
+		if ('excerpt' === $args['modal_content']) {
111
+			$modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __('Read More', 'lsx-health-plan') . '</a>';
112 112
 		}
113
-		\lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body );
113
+		\lsx_health_plan\functions\register_modal('workout-exercise-modal-' . $m, '', $modal_body);
114 114
 
115
-		if ( true === $echo ) {
116
-			echo wp_kses_post( $play_button );
115
+		if (true === $echo) {
116
+			echo wp_kses_post($play_button);
117 117
 		} else {
118 118
 			return $play_button;
119 119
 		}
@@ -127,39 +127,39 @@  discard block
 block discarded – undo
127 127
  * @param array $group
128 128
  * @return void
129 129
  */
130
-function lsx_health_plan_shortcode_exercise_button( $m, $content = true ) {
131
-	$equipment_group = get_the_term_list( $m, 'equipment', '', ', ' );
132
-	$muscle_group    = get_the_term_list( $m, 'muscle-group', '', ', ' );
130
+function lsx_health_plan_shortcode_exercise_button($m, $content = true) {
131
+	$equipment_group = get_the_term_list($m, 'equipment', '', ', ');
132
+	$muscle_group    = get_the_term_list($m, 'muscle-group', '', ', ');
133 133
 	$title           = get_the_title();
134 134
 	$lsx_hp          = lsx_health_plan();
135
-	$button     = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>';
135
+	$button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>';
136 136
 
137
-	if ( true === $content ) {
137
+	if (true === $content) {
138 138
 		$content = get_the_content();
139 139
 	}
140 140
 
141 141
 	$modal_body = '';
142
-	if ( $lsx_hp->frontend->gallery->has_gallery( $m ) ) {
142
+	if ($lsx_hp->frontend->gallery->has_gallery($m)) {
143 143
 		$gallery_args = array(
144 144
 			'css_class' => 'modal-slider',
145 145
 		);
146
-		$modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args );
146
+		$modal_body .= $lsx_hp->frontend->gallery->get_gallery('', '', $gallery_args);
147 147
 	} else {
148
-		$modal_body .= '<div class="modal-image">' . get_the_post_thumbnail( $m, 'large' ) . '</div>';
148
+		$modal_body .= '<div class="modal-image">' . get_the_post_thumbnail($m, 'large') . '</div>';
149 149
 	}
150 150
 	$modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $title . '</h5>';
151 151
 
152
-	if ( ! empty( $equipment_group ) ) {
152
+	if ( ! empty($equipment_group)) {
153 153
 		$modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>';
154 154
 	}
155
-	if ( ! empty( $muscle_group ) ) {
155
+	if ( ! empty($muscle_group)) {
156 156
 		$modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>';
157 157
 	}
158 158
 	$modal_body .= '</div>';
159 159
 	$modal_body .= $content;
160
-	\lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body );
160
+	\lsx_health_plan\functions\register_modal('exercise-modal-' . $m, '', $modal_body);
161 161
 
162
-	return ( $button );
162
+	return ($button);
163 163
 }
164 164
 
165 165
 /**
@@ -170,18 +170,18 @@  discard block
 block discarded – undo
170 170
  * @param  boolean $echo
171 171
  * @return string
172 172
  */
173
-function lsx_health_plan_exercise_title( $before = '', $after = '', $echo = true, $exercise_id = false ) {
174
-	if ( false === $exercise_id ) {
173
+function lsx_health_plan_exercise_title($before = '', $after = '', $echo = true, $exercise_id = false) {
174
+	if (false === $exercise_id) {
175 175
 		$exercise_id = get_the_ID();
176 176
 	}
177
-	$title = get_the_title( $exercise_id );
178
-	$side  = get_post_meta( $exercise_id, 'exercise_side', true );
179
-	if ( '' !== $side ) {
180
-		$title .= ' - ' . ucwords( $side );
177
+	$title = get_the_title($exercise_id);
178
+	$side  = get_post_meta($exercise_id, 'exercise_side', true);
179
+	if ('' !== $side) {
180
+		$title .= ' - ' . ucwords($side);
181 181
 	}
182
-	$title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id );
183
-	if ( true === $echo ) {
184
-		echo wp_kses_post( $title );
182
+	$title = apply_filters('lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id);
183
+	if (true === $echo) {
184
+		echo wp_kses_post($title);
185 185
 	} else {
186 186
 		return $title;
187 187
 	}
Please login to merge, or discard this patch.
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@  discard block
 block discarded – undo
11 11
  * @return exercise_type
12 12
  */
13 13
 function lsx_health_plan_exercise_type() {
14
-	$term_obj_list = get_the_term_list( get_the_ID(), 'exercise-type', '', ', ' );
15
-	if ( ! empty( $term_obj_list ) ) {
16
-		return $term_obj_list;
17
-	}
14
+     $term_obj_list = get_the_term_list( get_the_ID(), 'exercise-type', '', ', ' );
15
+     if ( ! empty( $term_obj_list ) ) {
16
+          return $term_obj_list;
17
+     }
18 18
 }
19 19
 
20 20
 /**
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
  * @return muscle_group_equipment
24 24
  */
25 25
 function lsx_health_plan_muscle_group_equipment() {
26
-	$term_obj_list = get_the_term_list( get_the_ID(), 'muscle-group', '', ', ' );
27
-	if ( ! empty( $term_obj_list ) ) {
28
-		return $term_obj_list;
29
-	}
26
+     $term_obj_list = get_the_term_list( get_the_ID(), 'muscle-group', '', ', ' );
27
+     if ( ! empty( $term_obj_list ) ) {
28
+          return $term_obj_list;
29
+     }
30 30
 }
31 31
 
32 32
 /**
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
  * @return exercise_equipment
36 36
  */
37 37
 function lsx_health_plan_exercise_equipment() {
38
-	$term_obj_list = get_the_term_list( get_the_ID(), 'equipment', '', ', ' );
39
-	if ( ! empty( $term_obj_list ) ) {
40
-		return $term_obj_list;
41
-	}
38
+     $term_obj_list = get_the_term_list( get_the_ID(), 'equipment', '', ', ' );
39
+     if ( ! empty( $term_obj_list ) ) {
40
+          return $term_obj_list;
41
+     }
42 42
 }
43 43
 
44 44
 /**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
  * @return void
48 48
  */
49 49
 function lsx_health_plan_exercise_data() {
50
-	include LSX_HEALTH_PLAN_PATH . '/templates/table-exercise-data.php';
50
+     include LSX_HEALTH_PLAN_PATH . '/templates/table-exercise-data.php';
51 51
 }
52 52
 
53 53
 /**
@@ -60,64 +60,64 @@  discard block
 block discarded – undo
60 60
  * @return void
61 61
  */
62 62
 function lsx_health_plan_workout_exercise_button( $m, $group, $echo = true, $args = array() ) {
63
-	$defaults = array(
64
-		'modal_trigger' => 'button',
65
-		'modal_content' => 'excerpt',
66
-	);
67
-	$args     = wp_parse_args( $args, $defaults );
68
-
69
-	$exercise_id = '';
70
-	if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) {
71
-		$exercise_id     = esc_html( $group['connected_exercises'] );
72
-		$content         = get_post_field( 'post_content', $exercise_id );
73
-		$url             = get_permalink( $exercise_id );
74
-		$equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' );
75
-		$muscle_group    = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' );
76
-		$lsx_hp          = lsx_health_plan();
77
-
78
-		if ( 'excerpt' === $args['modal_content'] ) {
79
-			$content = wp_trim_words( $content, 40 );
80
-		}
81
-
82
-		if ( 'link' ) {
83
-			$play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>';
84
-		} else {
85
-			$play_button = '<button data-toggle="modal" data-target="#workout-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>';
86
-		}
87
-
88
-		$modal_body  = '';
89
-		if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) {
90
-			$gallery_args = array(
91
-				'css_class' => 'modal-slider',
92
-			);
93
-			$modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args );
94
-		} else {
95
-			$modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>';
96
-		}
97
-
98
-		$modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>';
99
-
100
-		if ( ! empty( $equipment_group ) ) {
101
-			$modal_body .= '<span class="equipment-terms">' . __( 'Equipment', 'lsx-health-plan' ) . ': ' . $equipment_group . '</span>';
102
-		}
103
-		if ( ! empty( $muscle_group ) ) {
104
-			$modal_body .= '<span class="muscle-terms">' . __( 'Muscle Group', 'lsx-health-plan' ) . ': ' . $muscle_group . '</span>';
105
-		}
106
-		$modal_body .= '</div>';
107
-		if ( '' !== $args['modal_content'] ) {
108
-			$modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>';
109
-		}
110
-		if ( 'excerpt' === $args['modal_content'] ) {
111
-			$modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-health-plan' ) . '</a>';
112
-		}
113
-		\lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body );
114
-
115
-		if ( true === $echo ) {
116
-			echo wp_kses_post( $play_button );
117
-		} else {
118
-			return $play_button;
119
-		}
120
-	}
63
+     $defaults = array(
64
+          'modal_trigger' => 'button',
65
+          'modal_content' => 'excerpt',
66
+     );
67
+     $args     = wp_parse_args( $args, $defaults );
68
+
69
+     $exercise_id = '';
70
+     if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) {
71
+          $exercise_id     = esc_html( $group['connected_exercises'] );
72
+          $content         = get_post_field( 'post_content', $exercise_id );
73
+          $url             = get_permalink( $exercise_id );
74
+          $equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' );
75
+          $muscle_group    = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' );
76
+          $lsx_hp          = lsx_health_plan();
77
+
78
+          if ( 'excerpt' === $args['modal_content'] ) {
79
+               $content = wp_trim_words( $content, 40 );
80
+          }
81
+
82
+          if ( 'link' ) {
83
+               $play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>';
84
+          } else {
85
+               $play_button = '<button data-toggle="modal" data-target="#workout-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>';
86
+          }
87
+
88
+          $modal_body  = '';
89
+          if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) {
90
+               $gallery_args = array(
91
+                    'css_class' => 'modal-slider',
92
+               );
93
+               $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args );
94
+          } else {
95
+               $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>';
96
+          }
97
+
98
+          $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>';
99
+
100
+          if ( ! empty( $equipment_group ) ) {
101
+               $modal_body .= '<span class="equipment-terms">' . __( 'Equipment', 'lsx-health-plan' ) . ': ' . $equipment_group . '</span>';
102
+          }
103
+          if ( ! empty( $muscle_group ) ) {
104
+               $modal_body .= '<span class="muscle-terms">' . __( 'Muscle Group', 'lsx-health-plan' ) . ': ' . $muscle_group . '</span>';
105
+          }
106
+          $modal_body .= '</div>';
107
+          if ( '' !== $args['modal_content'] ) {
108
+               $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>';
109
+          }
110
+          if ( 'excerpt' === $args['modal_content'] ) {
111
+               $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-health-plan' ) . '</a>';
112
+          }
113
+          \lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body );
114
+
115
+          if ( true === $echo ) {
116
+               echo wp_kses_post( $play_button );
117
+          } else {
118
+               return $play_button;
119
+          }
120
+     }
121 121
 }
122 122
 
123 123
 /**
@@ -128,38 +128,38 @@  discard block
 block discarded – undo
128 128
  * @return void
129 129
  */
130 130
 function lsx_health_plan_shortcode_exercise_button( $m, $content = true ) {
131
-	$equipment_group = get_the_term_list( $m, 'equipment', '', ', ' );
132
-	$muscle_group    = get_the_term_list( $m, 'muscle-group', '', ', ' );
133
-	$title           = get_the_title();
134
-	$lsx_hp          = lsx_health_plan();
135
-	$button     = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>';
136
-
137
-	if ( true === $content ) {
138
-		$content = get_the_content();
139
-	}
140
-
141
-	$modal_body = '';
142
-	if ( $lsx_hp->frontend->gallery->has_gallery( $m ) ) {
143
-		$gallery_args = array(
144
-			'css_class' => 'modal-slider',
145
-		);
146
-		$modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args );
147
-	} else {
148
-		$modal_body .= '<div class="modal-image">' . get_the_post_thumbnail( $m, 'large' ) . '</div>';
149
-	}
150
-	$modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $title . '</h5>';
151
-
152
-	if ( ! empty( $equipment_group ) ) {
153
-		$modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>';
154
-	}
155
-	if ( ! empty( $muscle_group ) ) {
156
-		$modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>';
157
-	}
158
-	$modal_body .= '</div>';
159
-	$modal_body .= $content;
160
-	\lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body );
161
-
162
-	return ( $button );
131
+     $equipment_group = get_the_term_list( $m, 'equipment', '', ', ' );
132
+     $muscle_group    = get_the_term_list( $m, 'muscle-group', '', ', ' );
133
+     $title           = get_the_title();
134
+     $lsx_hp          = lsx_health_plan();
135
+     $button     = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>';
136
+
137
+     if ( true === $content ) {
138
+          $content = get_the_content();
139
+     }
140
+
141
+     $modal_body = '';
142
+     if ( $lsx_hp->frontend->gallery->has_gallery( $m ) ) {
143
+          $gallery_args = array(
144
+               'css_class' => 'modal-slider',
145
+          );
146
+          $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args );
147
+     } else {
148
+          $modal_body .= '<div class="modal-image">' . get_the_post_thumbnail( $m, 'large' ) . '</div>';
149
+     }
150
+     $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $title . '</h5>';
151
+
152
+     if ( ! empty( $equipment_group ) ) {
153
+          $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>';
154
+     }
155
+     if ( ! empty( $muscle_group ) ) {
156
+          $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>';
157
+     }
158
+     $modal_body .= '</div>';
159
+     $modal_body .= $content;
160
+     \lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body );
161
+
162
+     return ( $button );
163 163
 }
164 164
 
165 165
 /**
@@ -171,18 +171,18 @@  discard block
 block discarded – undo
171 171
  * @return string
172 172
  */
173 173
 function lsx_health_plan_exercise_title( $before = '', $after = '', $echo = true, $exercise_id = false ) {
174
-	if ( false === $exercise_id ) {
175
-		$exercise_id = get_the_ID();
176
-	}
177
-	$title = get_the_title( $exercise_id );
178
-	$side  = get_post_meta( $exercise_id, 'exercise_side', true );
179
-	if ( '' !== $side ) {
180
-		$title .= ' - ' . ucwords( $side );
181
-	}
182
-	$title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id );
183
-	if ( true === $echo ) {
184
-		echo wp_kses_post( $title );
185
-	} else {
186
-		return $title;
187
-	}
174
+     if ( false === $exercise_id ) {
175
+          $exercise_id = get_the_ID();
176
+     }
177
+     $title = get_the_title( $exercise_id );
178
+     $side  = get_post_meta( $exercise_id, 'exercise_side', true );
179
+     if ( '' !== $side ) {
180
+          $title .= ' - ' . ucwords( $side );
181
+     }
182
+     $title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id );
183
+     if ( true === $echo ) {
184
+          echo wp_kses_post( $title );
185
+     } else {
186
+          return $title;
187
+     }
188 188
 }
Please login to merge, or discard this patch.
classes/post-types/class-exercise.php 2 patches
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
 	 * Contructor
31 31
 	 */
32 32
 	public function __construct() {
33
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
33
+		if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
34 34
 			// Post Type and Taxonomies.
35
-			add_action( 'init', array( $this, 'register_post_type' ) );
36
-			add_action( 'init', array( $this, 'exercise_type_taxonomy_setup' ) );
37
-			add_action( 'init', array( $this, 'equipment_taxonomy_setup' ) );
38
-			add_action( 'init', array( $this, 'muscle_group_taxonomy_setup' ) );
39
-			add_action( 'admin_menu', array( $this, 'register_menus' ) );
35
+			add_action('init', array($this, 'register_post_type'));
36
+			add_action('init', array($this, 'exercise_type_taxonomy_setup'));
37
+			add_action('init', array($this, 'equipment_taxonomy_setup'));
38
+			add_action('init', array($this, 'muscle_group_taxonomy_setup'));
39
+			add_action('admin_menu', array($this, 'register_menus'));
40 40
 
41 41
 			// Settings.
42
-			add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 10, 1 );
42
+			add_action('lsx_hp_settings_page', array($this, 'register_settings'), 10, 1);
43 43
 
44 44
 			// Custom Fields.
45
-			add_action( 'cmb2_admin_init', array( $this, 'exercise_details' ), 8 );
46
-			add_action( 'cmb2_admin_init', array( $this, 'gallery_metabox' ), 9 );
47
-			add_action( 'cmb2_admin_init', array( $this, 'tips_metabox' ) );
48
-			add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
45
+			add_action('cmb2_admin_init', array($this, 'exercise_details'), 8);
46
+			add_action('cmb2_admin_init', array($this, 'gallery_metabox'), 9);
47
+			add_action('cmb2_admin_init', array($this, 'tips_metabox'));
48
+			add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1);
49 49
 
50 50
 			// Template Redirects.
51
-			add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
52
-			add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
51
+			add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1);
52
+			add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1);
53 53
 		}
54 54
 	}
55 55
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public static function get_instance() {
64 64
 		// If the single instance hasn't been set, set it now.
65
-		if ( null === self::$instance ) {
65
+		if (null === self::$instance) {
66 66
 			self::$instance = new self();
67 67
 		}
68 68
 		return self::$instance;
@@ -72,21 +72,21 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function register_post_type() {
74 74
 		$labels = array(
75
-			'name'               => esc_html__( 'Exercise', 'lsx-health-plan' ),
76
-			'singular_name'      => esc_html__( 'Exercises', 'lsx-health-plan' ),
77
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
78
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
79
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
80
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
81
-			'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
82
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
83
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
84
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
85
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
75
+			'name'               => esc_html__('Exercise', 'lsx-health-plan'),
76
+			'singular_name'      => esc_html__('Exercises', 'lsx-health-plan'),
77
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
78
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
79
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
80
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
81
+			'all_items'          => esc_html__('All', 'lsx-health-plan'),
82
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
83
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
84
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
85
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
86 86
 			'parent_item_colon'  => '',
87
-			'menu_name'          => esc_html__( 'Exercises', 'lsx-health-plan' ),
87
+			'menu_name'          => esc_html__('Exercises', 'lsx-health-plan'),
88 88
 		);
89
-		$args   = array(
89
+		$args = array(
90 90
 			'labels'             => $labels,
91 91
 			'public'             => true,
92 92
 			'publicly_queryable' => true,
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 			'menu_icon'          => 'dashicons-universal-access',
97 97
 			'query_var'          => true,
98 98
 			'rewrite'            => array(
99
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ),
99
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'),
100 100
 			),
101 101
 			'capability_type'    => 'page',
102
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercises' ),
102
+			'has_archive'        => \lsx_health_plan\functions\get_option('endpoint_exercise_archive', 'exercises'),
103 103
 			'hierarchical'       => false,
104 104
 			'menu_position'      => null,
105 105
 			'supports'           => array(
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				'excerpt',
110 110
 			),
111 111
 		);
112
-		register_post_type( 'exercise', $args );
112
+		register_post_type('exercise', $args);
113 113
 	}
114 114
 
115 115
 	/**
@@ -119,17 +119,17 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function exercise_type_taxonomy_setup() {
121 121
 		$labels = array(
122
-			'name'              => esc_html_x( 'Exercise Type', 'taxonomy general name', 'lsx-health-plan' ),
123
-			'singular_name'     => esc_html_x( 'Exercise Type', 'taxonomy singular name', 'lsx-health-plan' ),
124
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
125
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
126
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
127
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
128
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
129
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
130
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
131
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
132
-			'menu_name'         => esc_html__( 'Exercise Types', 'lsx-health-plan' ),
122
+			'name'              => esc_html_x('Exercise Type', 'taxonomy general name', 'lsx-health-plan'),
123
+			'singular_name'     => esc_html_x('Exercise Type', 'taxonomy singular name', 'lsx-health-plan'),
124
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
125
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
126
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
127
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
128
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
129
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
130
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
131
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
132
+			'menu_name'         => esc_html__('Exercise Types', 'lsx-health-plan'),
133 133
 		);
134 134
 
135 135
 		$args = array(
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 			'show_admin_column' => true,
140 140
 			'query_var'         => true,
141 141
 			'rewrite'           => array(
142
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_type', 'exercise-type' ),
142
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_type', 'exercise-type'),
143 143
 			),
144 144
 			'show_in_rest'      => true,
145 145
 		);
146 146
 
147
-		register_taxonomy( 'exercise-type', array( 'exercise' ), $args );
147
+		register_taxonomy('exercise-type', array('exercise'), $args);
148 148
 	}
149 149
 
150 150
 	/**
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function equipment_taxonomy_setup() {
156 156
 		$labels = array(
157
-			'name'              => esc_html_x( 'Equipment', 'taxonomy general name', 'lsx-health-plan' ),
158
-			'singular_name'     => esc_html_x( 'Equipment', 'taxonomy singular name', 'lsx-health-plan' ),
159
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
160
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
161
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
162
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
163
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
164
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
165
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
166
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
167
-			'menu_name'         => esc_html__( 'Equipment', 'lsx-health-plan' ),
157
+			'name'              => esc_html_x('Equipment', 'taxonomy general name', 'lsx-health-plan'),
158
+			'singular_name'     => esc_html_x('Equipment', 'taxonomy singular name', 'lsx-health-plan'),
159
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
160
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
161
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
162
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
163
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
164
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
165
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
166
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
167
+			'menu_name'         => esc_html__('Equipment', 'lsx-health-plan'),
168 168
 		);
169 169
 
170 170
 		$args = array(
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
 			'show_admin_column' => true,
175 175
 			'query_var'         => true,
176 176
 			'rewrite'           => array(
177
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_equipment', 'equipment' ),
177
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_equipment', 'equipment'),
178 178
 			),
179 179
 			'show_in_rest'      => true,
180 180
 		);
181 181
 
182
-		register_taxonomy( 'equipment', array( 'exercise' ), $args );
182
+		register_taxonomy('equipment', array('exercise'), $args);
183 183
 	}
184 184
 
185 185
 	/**
@@ -189,17 +189,17 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function muscle_group_taxonomy_setup() {
191 191
 		$labels = array(
192
-			'name'              => esc_html_x( 'Muscle Groups', 'taxonomy general name', 'lsx-health-plan' ),
193
-			'singular_name'     => esc_html_x( 'Muscle Group', 'taxonomy singular name', 'lsx-health-plan' ),
194
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
195
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
196
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
197
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
198
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
199
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
200
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
201
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
202
-			'menu_name'         => esc_html__( 'Muscle Groups', 'lsx-health-plan' ),
192
+			'name'              => esc_html_x('Muscle Groups', 'taxonomy general name', 'lsx-health-plan'),
193
+			'singular_name'     => esc_html_x('Muscle Group', 'taxonomy singular name', 'lsx-health-plan'),
194
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
195
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
196
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
197
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
198
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
199
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
200
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
201
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
202
+			'menu_name'         => esc_html__('Muscle Groups', 'lsx-health-plan'),
203 203
 		);
204 204
 
205 205
 		$args = array(
@@ -209,12 +209,12 @@  discard block
 block discarded – undo
209 209
 			'show_admin_column' => true,
210 210
 			'query_var'         => true,
211 211
 			'rewrite'           => array(
212
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_musclegroup', 'muscle-group' ),
212
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_musclegroup', 'muscle-group'),
213 213
 			),
214 214
 			'show_in_rest'      => true,
215 215
 		);
216 216
 
217
-		register_taxonomy( 'muscle-group', array( 'exercise' ), $args );
217
+		register_taxonomy('muscle-group', array('exercise'), $args);
218 218
 	}
219 219
 
220 220
 	/**
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	 * @return void
224 224
 	 */
225 225
 	public function register_menus() {
226
-		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' );
227
-		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' );
228
-		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' );
229
-		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' );
226
+		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');
227
+		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');
228
+		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');
229
+		add_submenu_page('edit.php?post_type=workout', esc_html__('Muscle Groups', 'lsx-health-plan'), esc_html__('Muscle Groups', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise');
230 230
 	}
231 231
 
232 232
 	/**
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 		$cmb = new_cmb2_box(
237 237
 			array(
238 238
 				'id'           => $this->slug . '_tips_details_metabox',
239
-				'title'        => __( 'Exercise Tips', 'lsx-health-plan' ),
240
-				'object_types' => array( $this->slug ), // Post type
239
+				'title'        => __('Exercise Tips', 'lsx-health-plan'),
240
+				'object_types' => array($this->slug), // Post type
241 241
 				'context'      => 'normal',
242 242
 				'priority'     => 'low',
243 243
 				'show_names'   => true,
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 				'id'      => $this->slug . '_tips',
251 251
 				'type'    => 'group',
252 252
 				'options' => array(
253
-					'group_title'   => __( 'Tip', 'your-text-domain' ) . ' {#}', // {#} gets replaced by row number
254
-					'add_button'    => __( 'Add another tip', 'your-text-domain' ),
255
-					'remove_button' => __( 'Remove tip', 'your-text-domain' ),
253
+					'group_title'   => __('Tip', 'your-text-domain') . ' {#}', // {#} gets replaced by row number
254
+					'add_button'    => __('Add another tip', 'your-text-domain'),
255
+					'remove_button' => __('Remove tip', 'your-text-domain'),
256 256
 					'sortable'      => true,
257 257
 				),
258 258
 				'classes' => 'lsx-admin-row',
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
 		$cmb->add_group_field(
264 264
 			$tip_group,
265 265
 			array(
266
-				'name' => __( 'Thumbnail', 'your-text-domain' ),
266
+				'name' => __('Thumbnail', 'your-text-domain'),
267 267
 				'id'   => $this->slug . '_tip_thumbnail',
268 268
 				'type' => 'file',
269 269
 				'text'        => array(
270
-					'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ),
270
+					'add_upload_file_text' => __('Add File', 'lsx-health-plan'),
271 271
 				),
272
-				'desc'        => __( 'Upload an image 300px x 300px in size.', 'lsx-health-plan' ),
272
+				'desc'        => __('Upload an image 300px x 300px in size.', 'lsx-health-plan'),
273 273
 				'query_args' => array(
274 274
 					'type' => array(
275 275
 						'image/gif',
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 		$cmb->add_group_field(
286 286
 			$tip_group,
287 287
 			array(
288
-				'name'    => __( 'Description', 'your-text-domain' ),
288
+				'name'    => __('Description', 'your-text-domain'),
289 289
 				'id'      => $this->slug . '_tip_content',
290 290
 				'type'    => 'textarea',
291 291
 				'classes' => 'lsx-field-col lsx-field-connect-field lsx-field-col-75',
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @param array $post_types
300 300
 	 * @return array
301 301
 	 */
302
-	public function enable_post_type( $post_types = array() ) {
302
+	public function enable_post_type($post_types = array()) {
303 303
 		$post_types[] = $this->slug;
304 304
 		return $post_types;
305 305
 	}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * @param array $connections
311 311
 	 * @return void
312 312
 	 */
313
-	public function enable_connections( $connections = array() ) {
313
+	public function enable_connections($connections = array()) {
314 314
 		$connections['exercise']['connected_workouts'] = 'connected_exercises';
315 315
 		$connections['workout']['connected_exercises'] = 'connected_workouts';
316 316
 		return $connections;
@@ -322,24 +322,24 @@  discard block
 block discarded – undo
322 322
 	 * @param object $cmb new_cmb2_box().
323 323
 	 * @return void
324 324
 	 */
325
-	public function register_settings( $cmb ) {
325
+	public function register_settings($cmb) {
326 326
 		$cmb->add_field(
327 327
 			array(
328 328
 				'id'          => 'exercise_archive_settings_title',
329 329
 				'type'        => 'title',
330
-				'name'        => __( 'Exercises Archive', 'lsx-health-plan' ),
331
-				'description' => __( 'All of the settings relating to the exercises post type archive.', 'lsx-health-plan' ),
330
+				'name'        => __('Exercises Archive', 'lsx-health-plan'),
331
+				'description' => __('All of the settings relating to the exercises post type archive.', 'lsx-health-plan'),
332 332
 			)
333 333
 		);
334 334
 		$cmb->add_field(
335 335
 			array(
336 336
 				'id'          => 'exercise_archive_description',
337 337
 				'type'        => 'wysiwyg',
338
-				'name'        => __( 'Archive Description', 'lsx-health-plan' ),
339
-				'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ),
338
+				'name'        => __('Archive Description', 'lsx-health-plan'),
339
+				'description' => __('This will show up on the post type archive.', 'lsx-health-plan'),
340 340
 			)
341 341
 		);
342
-		do_action( 'lsx_hp_exercise_settings_page', $cmb );
342
+		do_action('lsx_hp_exercise_settings_page', $cmb);
343 343
 		$cmb->add_field(
344 344
 			array(
345 345
 				'id'   => 'settings_exercise_archive_closing',
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 		$cmb = new_cmb2_box(
356 356
 			array(
357 357
 				'id'           => $this->slug . '_gallery_details_metabox',
358
-				'title'        => __( 'Exercise Gallery', 'lsx-health-plan' ),
359
-				'object_types' => array( $this->slug ),
358
+				'title'        => __('Exercise Gallery', 'lsx-health-plan'),
359
+				'object_types' => array($this->slug),
360 360
 				'context'      => 'normal',
361 361
 				'priority'     => 'low',
362 362
 				'show_names'   => true,
@@ -365,19 +365,19 @@  discard block
 block discarded – undo
365 365
 
366 366
 		$cmb->add_field(
367 367
 			array(
368
-				'name'    => __( 'Layout', 'lsx-health-plan' ),
368
+				'name'    => __('Layout', 'lsx-health-plan'),
369 369
 				'id'      => $this->slug . '_gallery_layout',
370 370
 				'type'    => 'radio',
371 371
 				'options' => array(
372
-					'slider' => __( 'Slider', 'your-text-domain' ) . ' {#}', // {#} gets replaced by row number
373
-					'grid'   => __( 'Grid', 'your-text-domain' ),
372
+					'slider' => __('Slider', 'your-text-domain') . ' {#}', // {#} gets replaced by row number
373
+					'grid'   => __('Grid', 'your-text-domain'),
374 374
 				),
375 375
 			)
376 376
 		);
377 377
 
378 378
 		$cmb->add_field(
379 379
 			array(
380
-				'name'    => __( 'Grid Columns', 'lsx-health-plan' ),
380
+				'name'    => __('Grid Columns', 'lsx-health-plan'),
381 381
 				'id'      => $this->slug . '_gallery_columns',
382 382
 				'type'    => 'text',
383 383
 				'default' => '3',
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
 				'id'      => $this->slug . '_gallery',
391 391
 				'type'    => 'group',
392 392
 				'options' => array(
393
-					'group_title'   => __( 'Gallery', 'your-text-domain' ) . ' {#}', // {#} gets replaced by row number
394
-					'add_button'    => __( 'Add Item', 'your-text-domain' ),
395
-					'remove_button' => __( 'Remove Item', 'your-text-domain' ),
393
+					'group_title'   => __('Gallery', 'your-text-domain') . ' {#}', // {#} gets replaced by row number
394
+					'add_button'    => __('Add Item', 'your-text-domain'),
395
+					'remove_button' => __('Remove Item', 'your-text-domain'),
396 396
 					'sortable'      => true,
397 397
 				),
398 398
 				'classes' => 'lsx-admin-row',
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
 		$cmb->add_group_field(
404 404
 			$gallery_group,
405 405
 			array(
406
-				'name'       => __( 'Image', 'your-text-domain' ),
406
+				'name'       => __('Image', 'your-text-domain'),
407 407
 				'id'         => $this->slug . '_gallery_image',
408 408
 				'type'       => 'file',
409 409
 				'text'       => array(
410
-					'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ),
410
+					'add_upload_file_text' => __('Add File', 'lsx-health-plan'),
411 411
 				),
412
-				'desc'       => __( 'Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan' ),
412
+				'desc'       => __('Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan'),
413 413
 				'query_args' => array(
414 414
 					'type' => array(
415 415
 						'image/gif',
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 		$cmb->add_group_field(
427 427
 			$gallery_group,
428 428
 			array(
429
-				'name'         => __( 'oEmbed', 'your-text-domain' ),
429
+				'name'         => __('oEmbed', 'your-text-domain'),
430 430
 				'id'           => $this->slug . '_gallery_embed',
431 431
 				'type'         => 'text',
432
-				'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' ),
432
+				'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'),
433 433
 				'classes'      => 'lsx-field-col lsx-field-connect-field  lsx-field-col-33',
434 434
 			)
435 435
 		);
@@ -437,10 +437,10 @@  discard block
 block discarded – undo
437 437
 		$cmb->add_group_field(
438 438
 			$gallery_group,
439 439
 			array(
440
-				'name'         => __( 'External Media', 'your-text-domain' ),
440
+				'name'         => __('External Media', 'your-text-domain'),
441 441
 				'id'           => $this->slug . '_gallery_external',
442 442
 				'type'         => 'textarea_code',
443
-				'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' ),
443
+				'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'),
444 444
 				'classes'      => 'lsx-field-col lsx-field-connect-field  lsx-field-col-33',
445 445
 			)
446 446
 		);
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
 		$cmb = new_cmb2_box(
456 456
 			array(
457 457
 				'id'           => $this->slug . '_general_details_metabox',
458
-				'title'        => __( 'Details', 'lsx-health-plan' ),
459
-				'object_types' => array( $this->slug ),
458
+				'title'        => __('Details', 'lsx-health-plan'),
459
+				'object_types' => array($this->slug),
460 460
 				'context'      => 'normal',
461 461
 				'priority'     => 'high',
462 462
 				'show_names'   => true,
@@ -465,15 +465,15 @@  discard block
 block discarded – undo
465 465
 
466 466
 		$cmb->add_field(
467 467
 			array(
468
-				'name'    => __( 'Side', 'lsx-health-plan' ),
468
+				'name'    => __('Side', 'lsx-health-plan'),
469 469
 				'id'      => $this->slug . '_side',
470 470
 				'type'    => 'select',
471 471
 				'options' => array(
472
-					''      => __( 'Select', 'your-text-domain' ),
473
-					'left'  => __( 'Left', 'your-text-domain' ),
474
-					'right' => __( 'Right', 'your-text-domain' ),
472
+					''      => __('Select', 'your-text-domain'),
473
+					'left'  => __('Left', 'your-text-domain'),
474
+					'right' => __('Right', 'your-text-domain'),
475 475
 				),
476
-				'desc'    => __( 'Select which side this exercise uses. ', 'lsx-health-plan' ),
476
+				'desc'    => __('Select which side this exercise uses. ', 'lsx-health-plan'),
477 477
 			)
478 478
 		);
479 479
 	}
Please login to merge, or discard this patch.
Indentation   +469 added lines, -469 removed lines patch added patch discarded remove patch
@@ -8,473 +8,473 @@
 block discarded – undo
8 8
  */
9 9
 class Exercise {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Exercise()
17
-	 */
18
-	protected static $instance = null;
19
-
20
-	/**
21
-	 * Holds post_type slug used as an index
22
-	 *
23
-	 * @since 1.0.0
24
-	 *
25
-	 * @var      string
26
-	 */
27
-	public $slug = 'exercise';
28
-
29
-	/**
30
-	 * Contructor
31
-	 */
32
-	public function __construct() {
33
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
34
-			// Post Type and Taxonomies.
35
-			add_action( 'init', array( $this, 'register_post_type' ) );
36
-			add_action( 'init', array( $this, 'exercise_type_taxonomy_setup' ) );
37
-			add_action( 'init', array( $this, 'equipment_taxonomy_setup' ) );
38
-			add_action( 'init', array( $this, 'muscle_group_taxonomy_setup' ) );
39
-			add_action( 'admin_menu', array( $this, 'register_menus' ) );
40
-
41
-			// Settings.
42
-			add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 10, 1 );
43
-
44
-			// Custom Fields.
45
-			add_action( 'cmb2_admin_init', array( $this, 'exercise_details' ), 8 );
46
-			add_action( 'cmb2_admin_init', array( $this, 'gallery_metabox' ), 9 );
47
-			add_action( 'cmb2_admin_init', array( $this, 'tips_metabox' ) );
48
-			add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
49
-
50
-			// Template Redirects.
51
-			add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
52
-			add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
53
-		}
54
-	}
55
-
56
-	/**
57
-	 * Return an instance of this class.
58
-	 *
59
-	 * @since 1.0.0
60
-	 *
61
-	 * @return    object \lsx_health_plan\classes\Exercise()    A single instance of this class.
62
-	 */
63
-	public static function get_instance() {
64
-		// If the single instance hasn't been set, set it now.
65
-		if ( null === self::$instance ) {
66
-			self::$instance = new self();
67
-		}
68
-		return self::$instance;
69
-	}
70
-	/**
71
-	 * Register the post type.
72
-	 */
73
-	public function register_post_type() {
74
-		$labels = array(
75
-			'name'               => esc_html__( 'Exercise', 'lsx-health-plan' ),
76
-			'singular_name'      => esc_html__( 'Exercises', 'lsx-health-plan' ),
77
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
78
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
79
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
80
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
81
-			'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
82
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
83
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
84
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
85
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
86
-			'parent_item_colon'  => '',
87
-			'menu_name'          => esc_html__( 'Exercises', 'lsx-health-plan' ),
88
-		);
89
-		$args   = array(
90
-			'labels'             => $labels,
91
-			'public'             => true,
92
-			'publicly_queryable' => true,
93
-			'show_ui'            => true,
94
-			'show_in_menu'       => false,
95
-			'show_in_rest'       => true,
96
-			'menu_icon'          => 'dashicons-universal-access',
97
-			'query_var'          => true,
98
-			'rewrite'            => array(
99
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ),
100
-			),
101
-			'capability_type'    => 'page',
102
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercises' ),
103
-			'hierarchical'       => false,
104
-			'menu_position'      => null,
105
-			'supports'           => array(
106
-				'title',
107
-				'thumbnail',
108
-				'editor',
109
-				'excerpt',
110
-			),
111
-		);
112
-		register_post_type( 'exercise', $args );
113
-	}
114
-
115
-	/**
116
-	 * Register the Exercise taxonomy.
117
-	 *
118
-	 * @return void
119
-	 */
120
-	public function exercise_type_taxonomy_setup() {
121
-		$labels = array(
122
-			'name'              => esc_html_x( 'Exercise Type', 'taxonomy general name', 'lsx-health-plan' ),
123
-			'singular_name'     => esc_html_x( 'Exercise Type', 'taxonomy singular name', 'lsx-health-plan' ),
124
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
125
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
126
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
127
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
128
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
129
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
130
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
131
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
132
-			'menu_name'         => esc_html__( 'Exercise Types', 'lsx-health-plan' ),
133
-		);
134
-
135
-		$args = array(
136
-			'hierarchical'      => true,
137
-			'labels'            => $labels,
138
-			'show_ui'           => true,
139
-			'show_admin_column' => true,
140
-			'query_var'         => true,
141
-			'rewrite'           => array(
142
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_type', 'exercise-type' ),
143
-			),
144
-			'show_in_rest'      => true,
145
-		);
146
-
147
-		register_taxonomy( 'exercise-type', array( 'exercise' ), $args );
148
-	}
149
-
150
-	/**
151
-	 * Register the Exercise taxonomy.
152
-	 *
153
-	 * @return void
154
-	 */
155
-	public function equipment_taxonomy_setup() {
156
-		$labels = array(
157
-			'name'              => esc_html_x( 'Equipment', 'taxonomy general name', 'lsx-health-plan' ),
158
-			'singular_name'     => esc_html_x( 'Equipment', 'taxonomy singular name', 'lsx-health-plan' ),
159
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
160
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
161
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
162
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
163
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
164
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
165
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
166
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
167
-			'menu_name'         => esc_html__( 'Equipment', 'lsx-health-plan' ),
168
-		);
169
-
170
-		$args = array(
171
-			'hierarchical'      => true,
172
-			'labels'            => $labels,
173
-			'show_ui'           => true,
174
-			'show_admin_column' => true,
175
-			'query_var'         => true,
176
-			'rewrite'           => array(
177
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_equipment', 'equipment' ),
178
-			),
179
-			'show_in_rest'      => true,
180
-		);
181
-
182
-		register_taxonomy( 'equipment', array( 'exercise' ), $args );
183
-	}
184
-
185
-	/**
186
-	 * Register the Muscle Group taxonomy.
187
-	 *
188
-	 * @return void
189
-	 */
190
-	public function muscle_group_taxonomy_setup() {
191
-		$labels = array(
192
-			'name'              => esc_html_x( 'Muscle Groups', 'taxonomy general name', 'lsx-health-plan' ),
193
-			'singular_name'     => esc_html_x( 'Muscle Group', 'taxonomy singular name', 'lsx-health-plan' ),
194
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
195
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
196
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
197
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
198
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
199
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
200
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
201
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
202
-			'menu_name'         => esc_html__( 'Muscle Groups', 'lsx-health-plan' ),
203
-		);
204
-
205
-		$args = array(
206
-			'hierarchical'      => true,
207
-			'labels'            => $labels,
208
-			'show_ui'           => true,
209
-			'show_admin_column' => true,
210
-			'query_var'         => true,
211
-			'rewrite'           => array(
212
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_musclegroup', 'muscle-group' ),
213
-			),
214
-			'show_in_rest'      => true,
215
-		);
216
-
217
-		register_taxonomy( 'muscle-group', array( 'exercise' ), $args );
218
-	}
219
-
220
-	/**
221
-	 * Registers the Recipes under the Meals Post type menu.
222
-	 *
223
-	 * @return void
224
-	 */
225
-	public function register_menus() {
226
-		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' );
227
-		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' );
228
-		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' );
229
-		add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Muscle Groups', 'lsx-health-plan' ), esc_html__( 'Muscle Groups', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise' );
230
-	}
231
-
232
-	/**
233
-	 * Define the metabox and field configurations.
234
-	 */
235
-	public function tips_metabox() {
236
-		$cmb = new_cmb2_box(
237
-			array(
238
-				'id'           => $this->slug . '_tips_details_metabox',
239
-				'title'        => __( 'Exercise Tips', 'lsx-health-plan' ),
240
-				'object_types' => array( $this->slug ), // Post type
241
-				'context'      => 'normal',
242
-				'priority'     => 'low',
243
-				'show_names'   => true,
244
-			)
245
-		);
246
-
247
-		// Repeatable group.
248
-		$tip_group = $cmb->add_field(
249
-			array(
250
-				'id'      => $this->slug . '_tips',
251
-				'type'    => 'group',
252
-				'options' => array(
253
-					'group_title'   => __( 'Tip', 'your-text-domain' ) . ' {#}', // {#} gets replaced by row number
254
-					'add_button'    => __( 'Add another tip', 'your-text-domain' ),
255
-					'remove_button' => __( 'Remove tip', 'your-text-domain' ),
256
-					'sortable'      => true,
257
-				),
258
-				'classes' => 'lsx-admin-row',
259
-			)
260
-		);
261
-
262
-		// Title.
263
-		$cmb->add_group_field(
264
-			$tip_group,
265
-			array(
266
-				'name' => __( 'Thumbnail', 'your-text-domain' ),
267
-				'id'   => $this->slug . '_tip_thumbnail',
268
-				'type' => 'file',
269
-				'text'        => array(
270
-					'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ),
271
-				),
272
-				'desc'        => __( 'Upload an image 300px x 300px in size.', 'lsx-health-plan' ),
273
-				'query_args' => array(
274
-					'type' => array(
275
-						'image/gif',
276
-						'image/jpeg',
277
-						'image/png',
278
-					),
279
-				),
280
-				'preview_size' => 'thumbnail',
281
-				'classes'      => 'lsx-field-col lsx-field-add-field  lsx-field-col-25',
282
-			)
283
-		);
284
-
285
-		$cmb->add_group_field(
286
-			$tip_group,
287
-			array(
288
-				'name'    => __( 'Description', 'your-text-domain' ),
289
-				'id'      => $this->slug . '_tip_content',
290
-				'type'    => 'textarea',
291
-				'classes' => 'lsx-field-col lsx-field-connect-field lsx-field-col-75',
292
-			)
293
-		);
294
-	}
295
-
296
-	/**
297
-	 * Adds the post type to the different arrays.
298
-	 *
299
-	 * @param array $post_types
300
-	 * @return array
301
-	 */
302
-	public function enable_post_type( $post_types = array() ) {
303
-		$post_types[] = $this->slug;
304
-		return $post_types;
305
-	}
306
-
307
-	/**
308
-	 * Enables the Bi Directional relationships
309
-	 *
310
-	 * @param array $connections
311
-	 * @return void
312
-	 */
313
-	public function enable_connections( $connections = array() ) {
314
-		$connections['exercise']['connected_workouts'] = 'connected_exercises';
315
-		$connections['workout']['connected_exercises'] = 'connected_workouts';
316
-		return $connections;
317
-	}
318
-
319
-	/**
320
-	 * Registers the lsx_search_settings
321
-	 *
322
-	 * @param object $cmb new_cmb2_box().
323
-	 * @return void
324
-	 */
325
-	public function register_settings( $cmb ) {
326
-		$cmb->add_field(
327
-			array(
328
-				'id'          => 'exercise_archive_settings_title',
329
-				'type'        => 'title',
330
-				'name'        => __( 'Exercises Archive', 'lsx-health-plan' ),
331
-				'description' => __( 'All of the settings relating to the exercises post type archive.', 'lsx-health-plan' ),
332
-			)
333
-		);
334
-		$cmb->add_field(
335
-			array(
336
-				'id'          => 'exercise_archive_description',
337
-				'type'        => 'wysiwyg',
338
-				'name'        => __( 'Archive Description', 'lsx-health-plan' ),
339
-				'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ),
340
-			)
341
-		);
342
-		do_action( 'lsx_hp_exercise_settings_page', $cmb );
343
-		$cmb->add_field(
344
-			array(
345
-				'id'   => 'settings_exercise_archive_closing',
346
-				'type' => 'tab_closing',
347
-			)
348
-		);
349
-	}
350
-
351
-	/**
352
-	 * Define the metabox and field configurations.
353
-	 */
354
-	public function gallery_metabox() {
355
-		$cmb = new_cmb2_box(
356
-			array(
357
-				'id'           => $this->slug . '_gallery_details_metabox',
358
-				'title'        => __( 'Exercise Gallery', 'lsx-health-plan' ),
359
-				'object_types' => array( $this->slug ),
360
-				'context'      => 'normal',
361
-				'priority'     => 'low',
362
-				'show_names'   => true,
363
-			)
364
-		);
365
-
366
-		$cmb->add_field(
367
-			array(
368
-				'name'    => __( 'Layout', 'lsx-health-plan' ),
369
-				'id'      => $this->slug . '_gallery_layout',
370
-				'type'    => 'radio',
371
-				'options' => array(
372
-					'slider' => __( 'Slider', 'your-text-domain' ) . ' {#}', // {#} gets replaced by row number
373
-					'grid'   => __( 'Grid', 'your-text-domain' ),
374
-				),
375
-			)
376
-		);
377
-
378
-		$cmb->add_field(
379
-			array(
380
-				'name'    => __( 'Grid Columns', 'lsx-health-plan' ),
381
-				'id'      => $this->slug . '_gallery_columns',
382
-				'type'    => 'text',
383
-				'default' => '3',
384
-			)
385
-		);
386
-
387
-		// Repeatable group.
388
-		$gallery_group = $cmb->add_field(
389
-			array(
390
-				'id'      => $this->slug . '_gallery',
391
-				'type'    => 'group',
392
-				'options' => array(
393
-					'group_title'   => __( 'Gallery', 'your-text-domain' ) . ' {#}', // {#} gets replaced by row number
394
-					'add_button'    => __( 'Add Item', 'your-text-domain' ),
395
-					'remove_button' => __( 'Remove Item', 'your-text-domain' ),
396
-					'sortable'      => true,
397
-				),
398
-				'classes' => 'lsx-admin-row',
399
-			)
400
-		);
401
-
402
-		// Title.
403
-		$cmb->add_group_field(
404
-			$gallery_group,
405
-			array(
406
-				'name'       => __( 'Image', 'your-text-domain' ),
407
-				'id'         => $this->slug . '_gallery_image',
408
-				'type'       => 'file',
409
-				'text'       => array(
410
-					'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ),
411
-				),
412
-				'desc'       => __( 'Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan' ),
413
-				'query_args' => array(
414
-					'type' => array(
415
-						'image/gif',
416
-						'image/jpeg',
417
-						'image/png',
418
-					),
419
-				),
420
-				'preview_size' => 'lsx-thumbnail-wide',
421
-				'classes'      => 'lsx-field-col lsx-field-add-field  lsx-field-col-33',
422
-			)
423
-		);
424
-
425
-		// Title.
426
-		$cmb->add_group_field(
427
-			$gallery_group,
428
-			array(
429
-				'name'         => __( 'oEmbed', 'your-text-domain' ),
430
-				'id'           => $this->slug . '_gallery_embed',
431
-				'type'         => 'text',
432
-				'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' ),
433
-				'classes'      => 'lsx-field-col lsx-field-connect-field  lsx-field-col-33',
434
-			)
435
-		);
436
-
437
-		$cmb->add_group_field(
438
-			$gallery_group,
439
-			array(
440
-				'name'         => __( 'External Media', 'your-text-domain' ),
441
-				'id'           => $this->slug . '_gallery_external',
442
-				'type'         => 'textarea_code',
443
-				'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' ),
444
-				'classes'      => 'lsx-field-col lsx-field-connect-field  lsx-field-col-33',
445
-			)
446
-		);
447
-	}
448
-
449
-	/**
450
-	 * Registers the general settings for the exercise.
451
-	 *
452
-	 * @return void
453
-	 */
454
-	public function exercise_details() {
455
-		$cmb = new_cmb2_box(
456
-			array(
457
-				'id'           => $this->slug . '_general_details_metabox',
458
-				'title'        => __( 'Details', 'lsx-health-plan' ),
459
-				'object_types' => array( $this->slug ),
460
-				'context'      => 'normal',
461
-				'priority'     => 'high',
462
-				'show_names'   => true,
463
-			)
464
-		);
465
-
466
-		$cmb->add_field(
467
-			array(
468
-				'name'    => __( 'Side', 'lsx-health-plan' ),
469
-				'id'      => $this->slug . '_side',
470
-				'type'    => 'select',
471
-				'options' => array(
472
-					''      => __( 'Select', 'your-text-domain' ),
473
-					'left'  => __( 'Left', 'your-text-domain' ),
474
-					'right' => __( 'Right', 'your-text-domain' ),
475
-				),
476
-				'desc'    => __( 'Select which side this exercise uses. ', 'lsx-health-plan' ),
477
-			)
478
-		);
479
-	}
11
+     /**
12
+      * Holds class instance
13
+      *
14
+      * @since 1.0.0
15
+      *
16
+      * @var      object \lsx_health_plan\classes\Exercise()
17
+      */
18
+     protected static $instance = null;
19
+
20
+     /**
21
+      * Holds post_type slug used as an index
22
+      *
23
+      * @since 1.0.0
24
+      *
25
+      * @var      string
26
+      */
27
+     public $slug = 'exercise';
28
+
29
+     /**
30
+      * Contructor
31
+      */
32
+     public function __construct() {
33
+          if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
34
+               // Post Type and Taxonomies.
35
+               add_action( 'init', array( $this, 'register_post_type' ) );
36
+               add_action( 'init', array( $this, 'exercise_type_taxonomy_setup' ) );
37
+               add_action( 'init', array( $this, 'equipment_taxonomy_setup' ) );
38
+               add_action( 'init', array( $this, 'muscle_group_taxonomy_setup' ) );
39
+               add_action( 'admin_menu', array( $this, 'register_menus' ) );
40
+
41
+               // Settings.
42
+               add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 10, 1 );
43
+
44
+               // Custom Fields.
45
+               add_action( 'cmb2_admin_init', array( $this, 'exercise_details' ), 8 );
46
+               add_action( 'cmb2_admin_init', array( $this, 'gallery_metabox' ), 9 );
47
+               add_action( 'cmb2_admin_init', array( $this, 'tips_metabox' ) );
48
+               add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
49
+
50
+               // Template Redirects.
51
+               add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
52
+               add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
53
+          }
54
+     }
55
+
56
+     /**
57
+      * Return an instance of this class.
58
+      *
59
+      * @since 1.0.0
60
+      *
61
+      * @return    object \lsx_health_plan\classes\Exercise()    A single instance of this class.
62
+      */
63
+     public static function get_instance() {
64
+          // If the single instance hasn't been set, set it now.
65
+          if ( null === self::$instance ) {
66
+               self::$instance = new self();
67
+          }
68
+          return self::$instance;
69
+     }
70
+     /**
71
+      * Register the post type.
72
+      */
73
+     public function register_post_type() {
74
+          $labels = array(
75
+               'name'               => esc_html__( 'Exercise', 'lsx-health-plan' ),
76
+               'singular_name'      => esc_html__( 'Exercises', 'lsx-health-plan' ),
77
+               'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
78
+               'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
79
+               'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
80
+               'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
81
+               'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
82
+               'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
83
+               'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
84
+               'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
85
+               'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
86
+               'parent_item_colon'  => '',
87
+               'menu_name'          => esc_html__( 'Exercises', 'lsx-health-plan' ),
88
+          );
89
+          $args   = array(
90
+               'labels'             => $labels,
91
+               'public'             => true,
92
+               'publicly_queryable' => true,
93
+               'show_ui'            => true,
94
+               'show_in_menu'       => false,
95
+               'show_in_rest'       => true,
96
+               'menu_icon'          => 'dashicons-universal-access',
97
+               'query_var'          => true,
98
+               'rewrite'            => array(
99
+                    'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ),
100
+               ),
101
+               'capability_type'    => 'page',
102
+               'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercises' ),
103
+               'hierarchical'       => false,
104
+               'menu_position'      => null,
105
+               'supports'           => array(
106
+                    'title',
107
+                    'thumbnail',
108
+                    'editor',
109
+                    'excerpt',
110
+               ),
111
+          );
112
+          register_post_type( 'exercise', $args );
113
+     }
114
+
115
+     /**
116
+      * Register the Exercise taxonomy.
117
+      *
118
+      * @return void
119
+      */
120
+     public function exercise_type_taxonomy_setup() {
121
+          $labels = array(
122
+               'name'              => esc_html_x( 'Exercise Type', 'taxonomy general name', 'lsx-health-plan' ),
123
+               'singular_name'     => esc_html_x( 'Exercise Type', 'taxonomy singular name', 'lsx-health-plan' ),
124
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
125
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
126
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
127
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
128
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
129
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
130
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
131
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
132
+               'menu_name'         => esc_html__( 'Exercise Types', 'lsx-health-plan' ),
133
+          );
134
+
135
+          $args = array(
136
+               'hierarchical'      => true,
137
+               'labels'            => $labels,
138
+               'show_ui'           => true,
139
+               'show_admin_column' => true,
140
+               'query_var'         => true,
141
+               'rewrite'           => array(
142
+                    'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_type', 'exercise-type' ),
143
+               ),
144
+               'show_in_rest'      => true,
145
+          );
146
+
147
+          register_taxonomy( 'exercise-type', array( 'exercise' ), $args );
148
+     }
149
+
150
+     /**
151
+      * Register the Exercise taxonomy.
152
+      *
153
+      * @return void
154
+      */
155
+     public function equipment_taxonomy_setup() {
156
+          $labels = array(
157
+               'name'              => esc_html_x( 'Equipment', 'taxonomy general name', 'lsx-health-plan' ),
158
+               'singular_name'     => esc_html_x( 'Equipment', 'taxonomy singular name', 'lsx-health-plan' ),
159
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
160
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
161
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
162
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
163
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
164
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
165
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
166
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
167
+               'menu_name'         => esc_html__( 'Equipment', 'lsx-health-plan' ),
168
+          );
169
+
170
+          $args = array(
171
+               'hierarchical'      => true,
172
+               'labels'            => $labels,
173
+               'show_ui'           => true,
174
+               'show_admin_column' => true,
175
+               'query_var'         => true,
176
+               'rewrite'           => array(
177
+                    'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_equipment', 'equipment' ),
178
+               ),
179
+               'show_in_rest'      => true,
180
+          );
181
+
182
+          register_taxonomy( 'equipment', array( 'exercise' ), $args );
183
+     }
184
+
185
+     /**
186
+      * Register the Muscle Group taxonomy.
187
+      *
188
+      * @return void
189
+      */
190
+     public function muscle_group_taxonomy_setup() {
191
+          $labels = array(
192
+               'name'              => esc_html_x( 'Muscle Groups', 'taxonomy general name', 'lsx-health-plan' ),
193
+               'singular_name'     => esc_html_x( 'Muscle Group', 'taxonomy singular name', 'lsx-health-plan' ),
194
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
195
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
196
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
197
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
198
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
199
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
200
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
201
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
202
+               'menu_name'         => esc_html__( 'Muscle Groups', 'lsx-health-plan' ),
203
+          );
204
+
205
+          $args = array(
206
+               'hierarchical'      => true,
207
+               'labels'            => $labels,
208
+               'show_ui'           => true,
209
+               'show_admin_column' => true,
210
+               'query_var'         => true,
211
+               'rewrite'           => array(
212
+                    'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_musclegroup', 'muscle-group' ),
213
+               ),
214
+               'show_in_rest'      => true,
215
+          );
216
+
217
+          register_taxonomy( 'muscle-group', array( 'exercise' ), $args );
218
+     }
219
+
220
+     /**
221
+      * Registers the Recipes under the Meals Post type menu.
222
+      *
223
+      * @return void
224
+      */
225
+     public function register_menus() {
226
+          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' );
227
+          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' );
228
+          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' );
229
+          add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Muscle Groups', 'lsx-health-plan' ), esc_html__( 'Muscle Groups', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise' );
230
+     }
231
+
232
+     /**
233
+      * Define the metabox and field configurations.
234
+      */
235
+     public function tips_metabox() {
236
+          $cmb = new_cmb2_box(
237
+               array(
238
+                    'id'           => $this->slug . '_tips_details_metabox',
239
+                    'title'        => __( 'Exercise Tips', 'lsx-health-plan' ),
240
+                    'object_types' => array( $this->slug ), // Post type
241
+                    'context'      => 'normal',
242
+                    'priority'     => 'low',
243
+                    'show_names'   => true,
244
+               )
245
+          );
246
+
247
+          // Repeatable group.
248
+          $tip_group = $cmb->add_field(
249
+               array(
250
+                    'id'      => $this->slug . '_tips',
251
+                    'type'    => 'group',
252
+                    'options' => array(
253
+                         'group_title'   => __( 'Tip', 'your-text-domain' ) . ' {#}', // {#} gets replaced by row number
254
+                         'add_button'    => __( 'Add another tip', 'your-text-domain' ),
255
+                         'remove_button' => __( 'Remove tip', 'your-text-domain' ),
256
+                         'sortable'      => true,
257
+                    ),
258
+                    'classes' => 'lsx-admin-row',
259
+               )
260
+          );
261
+
262
+          // Title.
263
+          $cmb->add_group_field(
264
+               $tip_group,
265
+               array(
266
+                    'name' => __( 'Thumbnail', 'your-text-domain' ),
267
+                    'id'   => $this->slug . '_tip_thumbnail',
268
+                    'type' => 'file',
269
+                    'text'        => array(
270
+                         'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ),
271
+                    ),
272
+                    'desc'        => __( 'Upload an image 300px x 300px in size.', 'lsx-health-plan' ),
273
+                    'query_args' => array(
274
+                         'type' => array(
275
+                              'image/gif',
276
+                              'image/jpeg',
277
+                              'image/png',
278
+                         ),
279
+                    ),
280
+                    'preview_size' => 'thumbnail',
281
+                    'classes'      => 'lsx-field-col lsx-field-add-field  lsx-field-col-25',
282
+               )
283
+          );
284
+
285
+          $cmb->add_group_field(
286
+               $tip_group,
287
+               array(
288
+                    'name'    => __( 'Description', 'your-text-domain' ),
289
+                    'id'      => $this->slug . '_tip_content',
290
+                    'type'    => 'textarea',
291
+                    'classes' => 'lsx-field-col lsx-field-connect-field lsx-field-col-75',
292
+               )
293
+          );
294
+     }
295
+
296
+     /**
297
+      * Adds the post type to the different arrays.
298
+      *
299
+      * @param array $post_types
300
+      * @return array
301
+      */
302
+     public function enable_post_type( $post_types = array() ) {
303
+          $post_types[] = $this->slug;
304
+          return $post_types;
305
+     }
306
+
307
+     /**
308
+      * Enables the Bi Directional relationships
309
+      *
310
+      * @param array $connections
311
+      * @return void
312
+      */
313
+     public function enable_connections( $connections = array() ) {
314
+          $connections['exercise']['connected_workouts'] = 'connected_exercises';
315
+          $connections['workout']['connected_exercises'] = 'connected_workouts';
316
+          return $connections;
317
+     }
318
+
319
+     /**
320
+      * Registers the lsx_search_settings
321
+      *
322
+      * @param object $cmb new_cmb2_box().
323
+      * @return void
324
+      */
325
+     public function register_settings( $cmb ) {
326
+          $cmb->add_field(
327
+               array(
328
+                    'id'          => 'exercise_archive_settings_title',
329
+                    'type'        => 'title',
330
+                    'name'        => __( 'Exercises Archive', 'lsx-health-plan' ),
331
+                    'description' => __( 'All of the settings relating to the exercises post type archive.', 'lsx-health-plan' ),
332
+               )
333
+          );
334
+          $cmb->add_field(
335
+               array(
336
+                    'id'          => 'exercise_archive_description',
337
+                    'type'        => 'wysiwyg',
338
+                    'name'        => __( 'Archive Description', 'lsx-health-plan' ),
339
+                    'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ),
340
+               )
341
+          );
342
+          do_action( 'lsx_hp_exercise_settings_page', $cmb );
343
+          $cmb->add_field(
344
+               array(
345
+                    'id'   => 'settings_exercise_archive_closing',
346
+                    'type' => 'tab_closing',
347
+               )
348
+          );
349
+     }
350
+
351
+     /**
352
+      * Define the metabox and field configurations.
353
+      */
354
+     public function gallery_metabox() {
355
+          $cmb = new_cmb2_box(
356
+               array(
357
+                    'id'           => $this->slug . '_gallery_details_metabox',
358
+                    'title'        => __( 'Exercise Gallery', 'lsx-health-plan' ),
359
+                    'object_types' => array( $this->slug ),
360
+                    'context'      => 'normal',
361
+                    'priority'     => 'low',
362
+                    'show_names'   => true,
363
+               )
364
+          );
365
+
366
+          $cmb->add_field(
367
+               array(
368
+                    'name'    => __( 'Layout', 'lsx-health-plan' ),
369
+                    'id'      => $this->slug . '_gallery_layout',
370
+                    'type'    => 'radio',
371
+                    'options' => array(
372
+                         'slider' => __( 'Slider', 'your-text-domain' ) . ' {#}', // {#} gets replaced by row number
373
+                         'grid'   => __( 'Grid', 'your-text-domain' ),
374
+                    ),
375
+               )
376
+          );
377
+
378
+          $cmb->add_field(
379
+               array(
380
+                    'name'    => __( 'Grid Columns', 'lsx-health-plan' ),
381
+                    'id'      => $this->slug . '_gallery_columns',
382
+                    'type'    => 'text',
383
+                    'default' => '3',
384
+               )
385
+          );
386
+
387
+          // Repeatable group.
388
+          $gallery_group = $cmb->add_field(
389
+               array(
390
+                    'id'      => $this->slug . '_gallery',
391
+                    'type'    => 'group',
392
+                    'options' => array(
393
+                         'group_title'   => __( 'Gallery', 'your-text-domain' ) . ' {#}', // {#} gets replaced by row number
394
+                         'add_button'    => __( 'Add Item', 'your-text-domain' ),
395
+                         'remove_button' => __( 'Remove Item', 'your-text-domain' ),
396
+                         'sortable'      => true,
397
+                    ),
398
+                    'classes' => 'lsx-admin-row',
399
+               )
400
+          );
401
+
402
+          // Title.
403
+          $cmb->add_group_field(
404
+               $gallery_group,
405
+               array(
406
+                    'name'       => __( 'Image', 'your-text-domain' ),
407
+                    'id'         => $this->slug . '_gallery_image',
408
+                    'type'       => 'file',
409
+                    'text'       => array(
410
+                         'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ),
411
+                    ),
412
+                    'desc'       => __( 'Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan' ),
413
+                    'query_args' => array(
414
+                         'type' => array(
415
+                              'image/gif',
416
+                              'image/jpeg',
417
+                              'image/png',
418
+                         ),
419
+                    ),
420
+                    'preview_size' => 'lsx-thumbnail-wide',
421
+                    'classes'      => 'lsx-field-col lsx-field-add-field  lsx-field-col-33',
422
+               )
423
+          );
424
+
425
+          // Title.
426
+          $cmb->add_group_field(
427
+               $gallery_group,
428
+               array(
429
+                    'name'         => __( 'oEmbed', 'your-text-domain' ),
430
+                    'id'           => $this->slug . '_gallery_embed',
431
+                    'type'         => 'text',
432
+                    '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' ),
433
+                    'classes'      => 'lsx-field-col lsx-field-connect-field  lsx-field-col-33',
434
+               )
435
+          );
436
+
437
+          $cmb->add_group_field(
438
+               $gallery_group,
439
+               array(
440
+                    'name'         => __( 'External Media', 'your-text-domain' ),
441
+                    'id'           => $this->slug . '_gallery_external',
442
+                    'type'         => 'textarea_code',
443
+                    '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' ),
444
+                    'classes'      => 'lsx-field-col lsx-field-connect-field  lsx-field-col-33',
445
+               )
446
+          );
447
+     }
448
+
449
+     /**
450
+      * Registers the general settings for the exercise.
451
+      *
452
+      * @return void
453
+      */
454
+     public function exercise_details() {
455
+          $cmb = new_cmb2_box(
456
+               array(
457
+                    'id'           => $this->slug . '_general_details_metabox',
458
+                    'title'        => __( 'Details', 'lsx-health-plan' ),
459
+                    'object_types' => array( $this->slug ),
460
+                    'context'      => 'normal',
461
+                    'priority'     => 'high',
462
+                    'show_names'   => true,
463
+               )
464
+          );
465
+
466
+          $cmb->add_field(
467
+               array(
468
+                    'name'    => __( 'Side', 'lsx-health-plan' ),
469
+                    'id'      => $this->slug . '_side',
470
+                    'type'    => 'select',
471
+                    'options' => array(
472
+                         ''      => __( 'Select', 'your-text-domain' ),
473
+                         'left'  => __( 'Left', 'your-text-domain' ),
474
+                         'right' => __( 'Right', 'your-text-domain' ),
475
+                    ),
476
+                    'desc'    => __( 'Select which side this exercise uses. ', 'lsx-health-plan' ),
477
+               )
478
+          );
479
+     }
480 480
 }
Please login to merge, or discard this patch.
classes/class-frontend.php 2 patches
Indentation   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -8,87 +8,87 @@  discard block
 block discarded – undo
8 8
  */
9 9
 class Frontend {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Frontend()
17
-	 */
18
-	protected static $instance = null;
19
-
20
-	/**
21
-	 * @var object \lsx_health_plan\classes\Endpoints();
22
-	 */
23
-	public $endpoints;
24
-
25
-	/**
26
-	 * @var object \lsx_health_plan\classes\Modals();
27
-	 */
28
-	public $modals;
29
-
30
-	/**
31
-	 * Contructor
32
-	 */
33
-	public function __construct() {
34
-		add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 );
35
-
36
-		require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php';
37
-		$this->endpoints = Endpoints::get_instance();
38
-
39
-		require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php';
40
-		$this->modals = Modals::get_instance();
41
-
42
-		require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php';
43
-		$this->gallery = frontend\Gallery::get_instance();
44
-
45
-		if ( is_admin() ) {
46
-			add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 );
47
-		}
48
-
49
-		// Handle the template redirects.
50
-		add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 );
51
-		add_filter( 'template_include', array( $this, 'single_template_include' ), 99 );
52
-		add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 );
53
-		add_action( 'template_redirect', array( $this, 'redirect' ) );
54
-
55
-		add_action( 'init', array( $this, 'handle_day_action' ), 100 );
56
-		add_filter( 'wp_kses_allowed_html', array( $this, 'wpkses_post_tags' ), 100, 2 );
57
-
58
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 99, 1 );
59
-	}
60
-
61
-	/**
62
-	 * Return an instance of this class.
63
-	 *
64
-	 * @since 1.0.0
65
-	 *
66
-	 * @return    object \lsx_health_plan\classes\Frontend()    A single instance of this class.
67
-	 */
68
-	public static function get_instance() {
69
-		// If the single instance hasn't been set, set it now.
70
-		if ( null === self::$instance ) {
71
-			self::$instance = new self();
72
-		}
73
-		return self::$instance;
74
-	}
75
-
76
-	/**
77
-	 * Registers the plugin frontend assets
78
-	 *
79
-	 * @return void
80
-	 */
81
-	public function assets() {
82
-		wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER );
83
-		wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' );
84
-		wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) );
85
-	}
86
-
87
-	/**
88
-	 * Handle body colours that might be change by LSX Customizer.
89
-	 */
90
-	public function customizer_body_colours_handler( $css, $colors ) {
91
-		$css .= '
11
+     /**
12
+      * Holds class instance
13
+      *
14
+      * @since 1.0.0
15
+      *
16
+      * @var      object \lsx_health_plan\classes\Frontend()
17
+      */
18
+     protected static $instance = null;
19
+
20
+     /**
21
+      * @var object \lsx_health_plan\classes\Endpoints();
22
+      */
23
+     public $endpoints;
24
+
25
+     /**
26
+      * @var object \lsx_health_plan\classes\Modals();
27
+      */
28
+     public $modals;
29
+
30
+     /**
31
+      * Contructor
32
+      */
33
+     public function __construct() {
34
+          add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 );
35
+
36
+          require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php';
37
+          $this->endpoints = Endpoints::get_instance();
38
+
39
+          require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php';
40
+          $this->modals = Modals::get_instance();
41
+
42
+          require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php';
43
+          $this->gallery = frontend\Gallery::get_instance();
44
+
45
+          if ( is_admin() ) {
46
+               add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 );
47
+          }
48
+
49
+          // Handle the template redirects.
50
+          add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 );
51
+          add_filter( 'template_include', array( $this, 'single_template_include' ), 99 );
52
+          add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 );
53
+          add_action( 'template_redirect', array( $this, 'redirect' ) );
54
+
55
+          add_action( 'init', array( $this, 'handle_day_action' ), 100 );
56
+          add_filter( 'wp_kses_allowed_html', array( $this, 'wpkses_post_tags' ), 100, 2 );
57
+
58
+          add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 99, 1 );
59
+     }
60
+
61
+     /**
62
+      * Return an instance of this class.
63
+      *
64
+      * @since 1.0.0
65
+      *
66
+      * @return    object \lsx_health_plan\classes\Frontend()    A single instance of this class.
67
+      */
68
+     public static function get_instance() {
69
+          // If the single instance hasn't been set, set it now.
70
+          if ( null === self::$instance ) {
71
+               self::$instance = new self();
72
+          }
73
+          return self::$instance;
74
+     }
75
+
76
+     /**
77
+      * Registers the plugin frontend assets
78
+      *
79
+      * @return void
80
+      */
81
+     public function assets() {
82
+          wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER );
83
+          wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' );
84
+          wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) );
85
+     }
86
+
87
+     /**
88
+      * Handle body colours that might be change by LSX Customizer.
89
+      */
90
+     public function customizer_body_colours_handler( $css, $colors ) {
91
+          $css .= '
92 92
 			@import "' . LSX_HEALTH_PLAN_PATH . '/assets/css/scss/partials/customizer-health-plan-body-colours";
93 93
 
94 94
 			/**
@@ -104,117 +104,117 @@  discard block
 block discarded – undo
104 104
 			);
105 105
 		';
106 106
 
107
-		return $css;
108
-	}
109
-
110
-	/**
111
-	 * Archive template.
112
-	 */
113
-	public function archive_template_include( $template ) {
114
-		$applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() );
115
-		if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) {
116
-			$post_type = get_post_type();
117
-			if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) {
118
-				$template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php';
119
-			}
120
-		}
121
-		return $template;
122
-	}
123
-
124
-	/**
125
-	 * Single template.
126
-	 */
127
-	public function single_template_include( $template ) {
128
-		$applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() );
129
-		if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) {
130
-			$post_type = get_post_type();
131
-			if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) {
132
-				$template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php';
133
-			}
134
-		}
135
-		return $template;
136
-	}
137
-
138
-	/**
139
-	 * Redirect WordPress to the taxonomy located in the plugin
140
-	 *
141
-	 * @param     $template string
142
-	 * @return    string
143
-	 */
144
-	public function taxonomy_template_include( $template ) {
145
-		$applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() );
146
-		if ( is_main_query() && is_tax( $applicable_taxonomies ) ) {
147
-			$current_taxonomy = get_query_var( 'taxonomy' );
148
-			if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) {
149
-				$template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php';
150
-			}
151
-		}
152
-		return $template;
153
-	}
154
-
155
-	/**
156
-	 * Redirect the user from the cart or checkout page if they have purchased the product already.
157
-	 *
158
-	 * @return void
159
-	 */
160
-	public function redirect() {
161
-		if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) {
162
-			return;
163
-		}
164
-		if ( lsx_health_plan_user_has_purchase() && ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) ) ) {
165
-			wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
166
-			die;
167
-		}
168
-
169
-		$product_id = \lsx_health_plan\functions\get_option( 'membership_product', false );
170
-		if ( false !== $product_id && is_single( $product_id ) ) {
171
-			wp_redirect( home_url() );
172
-			die;
173
-		}
174
-	}
175
-
176
-	/**
177
-	 * Registers the rewrites.
178
-	 */
179
-	public function handle_day_action() {
180
-		if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) {
181
-			update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true );
182
-			wp_safe_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
183
-		}
184
-
185
-		if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) {
186
-			delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' );
187
-		}
188
-	}
189
-
190
-	/**
191
-	 * Registers the rewrites.
192
-	 */
193
-	public function wpkses_post_tags( $tags, $context ) {
194
-		if ( 'post' === $context ) {
195
-			$tags['iframe'] = array(
196
-				'src'             => true,
197
-				'height'          => true,
198
-				'width'           => true,
199
-				'frameborder'     => true,
200
-				'allowfullscreen' => true,
201
-			);
202
-		}
203
-		return $tags;
204
-	}
205
-	/**
206
-	 * Remove the "Archives:" from the post type recipes.
207
-	 *
208
-	 * @param string $title the term title.
209
-	 * @return string
210
-	 */
211
-	public function get_the_archive_title( $title ) {
212
-		if ( is_tax() ) {
213
-			$queried_object = get_queried_object();
214
-			if ( isset( $queried_object->name ) ) {
215
-				$title = $queried_object->name;
216
-			}
217
-		}
218
-		return $title;
219
-	}
107
+          return $css;
108
+     }
109
+
110
+     /**
111
+      * Archive template.
112
+      */
113
+     public function archive_template_include( $template ) {
114
+          $applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() );
115
+          if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) {
116
+               $post_type = get_post_type();
117
+               if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) {
118
+                    $template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php';
119
+               }
120
+          }
121
+          return $template;
122
+     }
123
+
124
+     /**
125
+      * Single template.
126
+      */
127
+     public function single_template_include( $template ) {
128
+          $applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() );
129
+          if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) {
130
+               $post_type = get_post_type();
131
+               if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) {
132
+                    $template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php';
133
+               }
134
+          }
135
+          return $template;
136
+     }
137
+
138
+     /**
139
+      * Redirect WordPress to the taxonomy located in the plugin
140
+      *
141
+      * @param     $template string
142
+      * @return    string
143
+      */
144
+     public function taxonomy_template_include( $template ) {
145
+          $applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() );
146
+          if ( is_main_query() && is_tax( $applicable_taxonomies ) ) {
147
+               $current_taxonomy = get_query_var( 'taxonomy' );
148
+               if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) {
149
+                    $template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php';
150
+               }
151
+          }
152
+          return $template;
153
+     }
154
+
155
+     /**
156
+      * Redirect the user from the cart or checkout page if they have purchased the product already.
157
+      *
158
+      * @return void
159
+      */
160
+     public function redirect() {
161
+          if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) {
162
+               return;
163
+          }
164
+          if ( lsx_health_plan_user_has_purchase() && ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) ) ) {
165
+               wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
166
+               die;
167
+          }
168
+
169
+          $product_id = \lsx_health_plan\functions\get_option( 'membership_product', false );
170
+          if ( false !== $product_id && is_single( $product_id ) ) {
171
+               wp_redirect( home_url() );
172
+               die;
173
+          }
174
+     }
175
+
176
+     /**
177
+      * Registers the rewrites.
178
+      */
179
+     public function handle_day_action() {
180
+          if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) {
181
+               update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true );
182
+               wp_safe_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
183
+          }
184
+
185
+          if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) {
186
+               delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' );
187
+          }
188
+     }
189
+
190
+     /**
191
+      * Registers the rewrites.
192
+      */
193
+     public function wpkses_post_tags( $tags, $context ) {
194
+          if ( 'post' === $context ) {
195
+               $tags['iframe'] = array(
196
+                    'src'             => true,
197
+                    'height'          => true,
198
+                    'width'           => true,
199
+                    'frameborder'     => true,
200
+                    'allowfullscreen' => true,
201
+               );
202
+          }
203
+          return $tags;
204
+     }
205
+     /**
206
+      * Remove the "Archives:" from the post type recipes.
207
+      *
208
+      * @param string $title the term title.
209
+      * @return string
210
+      */
211
+     public function get_the_archive_title( $title ) {
212
+          if ( is_tax() ) {
213
+               $queried_object = get_queried_object();
214
+               if ( isset( $queried_object->name ) ) {
215
+                    $title = $queried_object->name;
216
+               }
217
+          }
218
+          return $title;
219
+     }
220 220
 }
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * Contructor
32 32
 	 */
33 33
 	public function __construct() {
34
-		add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 );
34
+		add_action('wp_enqueue_scripts', array($this, 'assets'), 5);
35 35
 
36 36
 		require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php';
37 37
 		$this->endpoints = Endpoints::get_instance();
@@ -42,20 +42,20 @@  discard block
 block discarded – undo
42 42
 		require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php';
43 43
 		$this->gallery = frontend\Gallery::get_instance();
44 44
 
45
-		if ( is_admin() ) {
46
-			add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 );
45
+		if (is_admin()) {
46
+			add_filter('lsx_customizer_colour_selectors_body', array($this, 'customizer_body_colours_handler'), 15, 2);
47 47
 		}
48 48
 
49 49
 		// Handle the template redirects.
50
-		add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 );
51
-		add_filter( 'template_include', array( $this, 'single_template_include' ), 99 );
52
-		add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 );
53
-		add_action( 'template_redirect', array( $this, 'redirect' ) );
50
+		add_filter('template_include', array($this, 'archive_template_include'), 99);
51
+		add_filter('template_include', array($this, 'single_template_include'), 99);
52
+		add_filter('template_include', array($this, 'taxonomy_template_include'), 99);
53
+		add_action('template_redirect', array($this, 'redirect'));
54 54
 
55
-		add_action( 'init', array( $this, 'handle_day_action' ), 100 );
56
-		add_filter( 'wp_kses_allowed_html', array( $this, 'wpkses_post_tags' ), 100, 2 );
55
+		add_action('init', array($this, 'handle_day_action'), 100);
56
+		add_filter('wp_kses_allowed_html', array($this, 'wpkses_post_tags'), 100, 2);
57 57
 
58
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 99, 1 );
58
+		add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 99, 1);
59 59
 	}
60 60
 
61 61
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public static function get_instance() {
69 69
 		// If the single instance hasn't been set, set it now.
70
-		if ( null === self::$instance ) {
70
+		if (null === self::$instance) {
71 71
 			self::$instance = new self();
72 72
 		}
73 73
 		return self::$instance;
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 	 * @return void
80 80
 	 */
81 81
 	public function assets() {
82
-		wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER );
83
-		wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' );
84
-		wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) );
82
+		wp_enqueue_style('lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER);
83
+		wp_style_add_data('lsx-health-plan', 'rtl', 'replace');
84
+		wp_enqueue_script('lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array('jquery'));
85 85
 	}
86 86
 
87 87
 	/**
88 88
 	 * Handle body colours that might be change by LSX Customizer.
89 89
 	 */
90
-	public function customizer_body_colours_handler( $css, $colors ) {
90
+	public function customizer_body_colours_handler($css, $colors) {
91 91
 		$css .= '
92 92
 			@import "' . LSX_HEALTH_PLAN_PATH . '/assets/css/scss/partials/customizer-health-plan-body-colours";
93 93
 
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 	/**
111 111
 	 * Archive template.
112 112
 	 */
113
-	public function archive_template_include( $template ) {
114
-		$applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() );
115
-		if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) {
113
+	public function archive_template_include($template) {
114
+		$applicable_post_types = apply_filters('lsx_health_plan_archive_template', array());
115
+		if ( ! empty($applicable_post_types) && is_main_query() && is_post_type_archive($applicable_post_types)) {
116 116
 			$post_type = get_post_type();
117
-			if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) {
117
+			if (empty(locate_template(array('archive-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php')) {
118 118
 				$template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php';
119 119
 			}
120 120
 		}
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 	/**
125 125
 	 * Single template.
126 126
 	 */
127
-	public function single_template_include( $template ) {
128
-		$applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() );
129
-		if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) {
127
+	public function single_template_include($template) {
128
+		$applicable_post_types = apply_filters('lsx_health_plan_single_template', array());
129
+		if ( ! empty($applicable_post_types) && is_main_query() && is_singular($applicable_post_types)) {
130 130
 			$post_type = get_post_type();
131
-			if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) {
131
+			if (empty(locate_template(array('single-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php')) {
132 132
 				$template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php';
133 133
 			}
134 134
 		}
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
 	 * @param     $template string
142 142
 	 * @return    string
143 143
 	 */
144
-	public function taxonomy_template_include( $template ) {
145
-		$applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() );
146
-		if ( is_main_query() && is_tax( $applicable_taxonomies ) ) {
147
-			$current_taxonomy = get_query_var( 'taxonomy' );
148
-			if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) {
144
+	public function taxonomy_template_include($template) {
145
+		$applicable_taxonomies = apply_filters('lsx_health_plan_taxonomies_template', array());
146
+		if (is_main_query() && is_tax($applicable_taxonomies)) {
147
+			$current_taxonomy = get_query_var('taxonomy');
148
+			if ('' === locate_template(array('taxonomy-' . $current_taxonomy . '.php')) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php')) {
149 149
 				$template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php';
150 150
 			}
151 151
 		}
@@ -158,17 +158,17 @@  discard block
 block discarded – undo
158 158
 	 * @return void
159 159
 	 */
160 160
 	public function redirect() {
161
-		if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) {
161
+		if ( ! is_user_logged_in() || ! function_exists('wc_get_page_id') || is_home()) {
162 162
 			return;
163 163
 		}
164
-		if ( lsx_health_plan_user_has_purchase() && ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) ) ) {
165
-			wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
164
+		if (lsx_health_plan_user_has_purchase() && (is_page(wc_get_page_id('cart')) || is_page(wc_get_page_id('checkout')))) {
165
+			wp_redirect(get_permalink(wc_get_page_id('myaccount')));
166 166
 			die;
167 167
 		}
168 168
 
169
-		$product_id = \lsx_health_plan\functions\get_option( 'membership_product', false );
170
-		if ( false !== $product_id && is_single( $product_id ) ) {
171
-			wp_redirect( home_url() );
169
+		$product_id = \lsx_health_plan\functions\get_option('membership_product', false);
170
+		if (false !== $product_id && is_single($product_id)) {
171
+			wp_redirect(home_url());
172 172
 			die;
173 173
 		}
174 174
 	}
@@ -177,21 +177,21 @@  discard block
 block discarded – undo
177 177
 	 * Registers the rewrites.
178 178
 	 */
179 179
 	public function handle_day_action() {
180
-		if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) {
181
-			update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true );
182
-			wp_safe_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
180
+		if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'complete')) {
181
+			update_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete', true);
182
+			wp_safe_redirect(get_permalink(wc_get_page_id('myaccount')));
183 183
 		}
184 184
 
185
-		if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) {
186
-			delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' );
185
+		if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'unlock')) {
186
+			delete_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete');
187 187
 		}
188 188
 	}
189 189
 
190 190
 	/**
191 191
 	 * Registers the rewrites.
192 192
 	 */
193
-	public function wpkses_post_tags( $tags, $context ) {
194
-		if ( 'post' === $context ) {
193
+	public function wpkses_post_tags($tags, $context) {
194
+		if ('post' === $context) {
195 195
 			$tags['iframe'] = array(
196 196
 				'src'             => true,
197 197
 				'height'          => true,
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
 	 * @param string $title the term title.
209 209
 	 * @return string
210 210
 	 */
211
-	public function get_the_archive_title( $title ) {
212
-		if ( is_tax() ) {
211
+	public function get_the_archive_title($title) {
212
+		if (is_tax()) {
213 213
 			$queried_object = get_queried_object();
214
-			if ( isset( $queried_object->name ) ) {
214
+			if (isset($queried_object->name)) {
215 215
 				$title = $queried_object->name;
216 216
 			}
217 217
 		}
Please login to merge, or discard this patch.