Passed
Push — master ( 89fb2a...19937e )
by Virginia
05:10
created
templates/content-recipe.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -41,36 +41,36 @@  discard block
 block discarded – undo
41 41
 			<div class="post-sharing-wrapper">
42 42
 
43 43
 				<?php
44
-				if ( class_exists( 'LSX_Sharing' ) ) {
45
-					lsx_content_sharing();
46
-				} else {
47
-					if ( function_exists( 'sharing_display' ) ) {
48
-						sharing_display( '', true );
49
-					}
50
-
51
-					if ( class_exists( 'Jetpack_Likes' ) ) {
52
-						$custom_likes = new Jetpack_Likes();
53
-						echo wp_kses_post( $custom_likes->post_likes( '' ) );
54
-					}
55
-				}
56
-				?>
44
+                    if ( class_exists( 'LSX_Sharing' ) ) {
45
+                         lsx_content_sharing();
46
+                    } else {
47
+                         if ( function_exists( 'sharing_display' ) ) {
48
+                              sharing_display( '', true );
49
+                         }
50
+
51
+                         if ( class_exists( 'Jetpack_Likes' ) ) {
52
+                              $custom_likes = new Jetpack_Likes();
53
+                              echo wp_kses_post( $custom_likes->post_likes( '' ) );
54
+                         }
55
+                    }
56
+                    ?>
57 57
 		<?php endif ?>
58 58
 		</h2>
59 59
 		<?php echo wp_kses_post( lsx_hp_member_connected( $connected_members, 'recipe' ) ); ?>
60 60
 		<div class="row">
61 61
 			<div class="col-md-6 recipe-image lsx-hp-shadow">
62 62
 				<?php
63
-				$featured_image = get_the_post_thumbnail();
64
-				if ( ! empty( $featured_image ) && '' !== $featured_image ) {
65
-					the_post_thumbnail( 'large', array(
66
-						'class' => 'aligncenter',
67
-					) );
68
-				} else {
69
-					?>
63
+                    $featured_image = get_the_post_thumbnail();
64
+                    if ( ! empty( $featured_image ) && '' !== $featured_image ) {
65
+                         the_post_thumbnail( 'large', array(
66
+                              'class' => 'aligncenter',
67
+                         ) );
68
+                    } else {
69
+                         ?>
70 70
 					<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>">
71 71
 					<?php
72
-				}
73
-				?>
72
+                    }
73
+                    ?>
74 74
 				<?php if ( ( ! empty( $prep_time ) ) || ( ! empty( $cooking_time ) ) || ( ! empty( $serves ) ) || ( ! empty( $portion ) ) || ( ! empty( $energy ) ) || ( ! empty( $protein ) ) || ( ! empty( $carbohydrates ) ) || ( ! empty( $fibre ) ) || ( ! empty( $fat ) ) ) { ?>
75 75
 				<div class="recipe-data">
76 76
 					<?php lsx_health_plan_recipe_data(); ?>
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
 				<?php echo do_shortcode( '[lsx_health_plan_featured_tips_block]' ); ?>
83 83
 				<div class="back-plan-btn">
84 84
 				<?php
85
-				if ( function_exists( 'wc_get_page_id' ) ) {
86
-					?>
85
+                    if ( function_exists( 'wc_get_page_id' ) ) {
86
+                         ?>
87 87
 					<a class="btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'Back To My Plan', 'lsx-health-plan' ); ?></a>
88 88
 					<?php
89
-				}
90
-				?>
89
+                    }
90
+                    ?>
91 91
 				</div>
92 92
 			</div>
93 93
 		</div>
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
 <?php
102 102
 if ( ! empty( $connected_articles ) ) {
103
-	lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) );
103
+     lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) );
104 104
 }
105 105
 ?>
106 106
 
Please login to merge, or discard this patch.
includes/functions/woocommerce.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
  * @return boolean
14 14
  */
15 15
 function plan_has_products() {
16
-	$lsx_hp       = lsx_health_plan();
17
-	$has_products = false;
18
-	if ( ! empty( $lsx_hp->integrations->woocommerce->plans->product_ids ) ) {
19
-		$has_products = true;
20
-	}
21
-	return $has_products;
16
+     $lsx_hp       = lsx_health_plan();
17
+     $has_products = false;
18
+     if ( ! empty( $lsx_hp->integrations->woocommerce->plans->product_ids ) ) {
19
+          $has_products = true;
20
+     }
21
+     return $has_products;
22 22
 }
23 23
 
24 24
 /**
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
  * @return array
28 28
  */
29 29
 function get_plan_products() {
30
-	$lsx_hp       = lsx_health_plan();
31
-	$has_products = array();
32
-	if ( ! empty( $lsx_hp->integrations->woocommerce->plans->product_ids ) ) {
33
-		$has_products = $lsx_hp->integrations->woocommerce->plans->product_ids;
34
-	}
35
-	return $has_products;
30
+     $lsx_hp       = lsx_health_plan();
31
+     $has_products = array();
32
+     if ( ! empty( $lsx_hp->integrations->woocommerce->plans->product_ids ) ) {
33
+          $has_products = $lsx_hp->integrations->woocommerce->plans->product_ids;
34
+     }
35
+     return $has_products;
36 36
 }
37 37
 
38 38
 /**
@@ -41,21 +41,21 @@  discard block
 block discarded – undo
41 41
  * @return array
42 42
  */
43 43
 function get_membership_products() {
44
-	$product_ids = array();
45
-	if ( function_exists( 'wc_memberships_get_user_memberships' ) ) {
46
-		$user_memberships = wc_memberships_get_user_memberships();
44
+     $product_ids = array();
45
+     if ( function_exists( 'wc_memberships_get_user_memberships' ) ) {
46
+          $user_memberships = wc_memberships_get_user_memberships();
47 47
 
48
-		if ( ! empty( $user_memberships ) ) {
49
-			foreach ( $user_memberships as $membership ) {
50
-				$current_products = $membership->plan->get_product_ids();
51
-				if ( ! empty( $current_products ) ) {
52
-					$product_ids = array_merge( $product_ids, $current_products );
53
-				}
54
-			}
55
-		}
56
-	}
57
-	if ( ! empty( $product_ids ) ) {
58
-		$product_ids = array_unique( $product_ids );
59
-	}
60
-	return $product_ids;
48
+          if ( ! empty( $user_memberships ) ) {
49
+               foreach ( $user_memberships as $membership ) {
50
+                    $current_products = $membership->plan->get_product_ids();
51
+                    if ( ! empty( $current_products ) ) {
52
+                         $product_ids = array_merge( $product_ids, $current_products );
53
+                    }
54
+               }
55
+          }
56
+     }
57
+     if ( ! empty( $product_ids ) ) {
58
+          $product_ids = array_unique( $product_ids );
59
+     }
60
+     return $product_ids;
61 61
 }
Please login to merge, or discard this patch.
includes/functions/recipes.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@
 block discarded – undo
14 14
  * @return boolean
15 15
  */
16 16
 function register_recipe_modal() {
17
-	remove_action( 'lsx_content_sharing', 'lsx_sharing_output', 20 );
18
-	ob_start();
19
-	include LSX_HEALTH_PLAN_PATH . '/templates/content-recipe.php';
20
-	$modal_body = ob_get_clean();
21
-	add_action( 'lsx_content_sharing', 'lsx_sharing_output', 20 );
22
-	\lsx_health_plan\functions\register_modal( 'recipe-modal-' . get_the_ID(), '', $modal_body );
17
+     remove_action( 'lsx_content_sharing', 'lsx_sharing_output', 20 );
18
+     ob_start();
19
+     include LSX_HEALTH_PLAN_PATH . '/templates/content-recipe.php';
20
+     $modal_body = ob_get_clean();
21
+     add_action( 'lsx_content_sharing', 'lsx_sharing_output', 20 );
22
+     \lsx_health_plan\functions\register_modal( 'recipe-modal-' . get_the_ID(), '', $modal_body );
23 23
 }
Please login to merge, or discard this patch.
includes/shortcodes.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
  * @return string
14 14
  */
15 15
 function restricted_content() {
16
-	$content = '';
17
-	if ( ! is_user_logged_in() ) {
18
-		ob_start();
19
-		echo do_shortcode( '[woocommerce_my_account]' );
20
-		$content = ob_get_clean();
21
-	}
22
-	return $content;
16
+     $content = '';
17
+     if ( ! is_user_logged_in() ) {
18
+          ob_start();
19
+          echo do_shortcode( '[woocommerce_my_account]' );
20
+          $content = ob_get_clean();
21
+     }
22
+     return $content;
23 23
 }
24 24
 
25 25
 /**
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
  * @return void
29 29
  */
30 30
 function my_profile_tabs() {
31
-	ob_start();
32
-	echo lsx_health_plan_my_profile_tabs(); // WPCS: XSS OK.
33
-	$content = ob_get_clean();
34
-	return $content;
31
+     ob_start();
32
+     echo lsx_health_plan_my_profile_tabs(); // WPCS: XSS OK.
33
+     $content = ob_get_clean();
34
+     return $content;
35 35
 }
36 36
 
37 37
 /**
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
  * @return void
41 41
  */
42 42
 function my_profile_box() {
43
-	ob_start();
44
-	echo lsx_health_plan_my_profile_box(); // WPCS: XSS OK.
45
-	$content = ob_get_clean();
46
-	return $content;
43
+     ob_start();
44
+     echo lsx_health_plan_my_profile_box(); // WPCS: XSS OK.
45
+     $content = ob_get_clean();
46
+     return $content;
47 47
 }
48 48
 
49 49
 /**
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
  */
54 54
 function all_plans_box( $args = array() ) {
55 55
 
56
-	ob_start();
57
-	echo lsx_health_plan_all_plans_block(); // WPCS: XSS OK.
58
-	$content = ob_get_clean();
59
-	return $content;
56
+     ob_start();
57
+     echo lsx_health_plan_all_plans_block(); // WPCS: XSS OK.
58
+     $content = ob_get_clean();
59
+     return $content;
60 60
 }
61 61
 
62 62
 /**
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
  * @return void
66 66
  */
67 67
 function day_plan_box( $args = array() ) {
68
-	$defaults = array(
69
-		'week_view'      => false,
70
-		'show_downloads' => false,
71
-		'plan'           => '',
72
-	);
73
-	$args     = wp_parse_args( $args, $defaults );
74
-	ob_start();
75
-	if ( false === $args['week_view'] ) {
76
-		echo lsx_health_plan_day_plan_block( $args ); // WPCS: XSS OK.
77
-	} else {
78
-		echo lsx_health_plan_week_plan_block( $args ); // WPCS: XSS OK.
79
-	}
80
-	$content = ob_get_clean();
81
-	return $content;
68
+     $defaults = array(
69
+          'week_view'      => false,
70
+          'show_downloads' => false,
71
+          'plan'           => '',
72
+     );
73
+     $args     = wp_parse_args( $args, $defaults );
74
+     ob_start();
75
+     if ( false === $args['week_view'] ) {
76
+          echo lsx_health_plan_day_plan_block( $args ); // WPCS: XSS OK.
77
+     } else {
78
+          echo lsx_health_plan_week_plan_block( $args ); // WPCS: XSS OK.
79
+     }
80
+     $content = ob_get_clean();
81
+     return $content;
82 82
 }
83 83
 
84 84
 /**
@@ -88,29 +88,29 @@  discard block
 block discarded – undo
88 88
  * @return void
89 89
  */
90 90
 function exercise_box( $args = array() ) {
91
-	$defaults = array(
92
-		'include'       => '',
93
-		'term'          => '',
94
-		'taxonomy'      => '',
95
-		'view_more'     => false,
96
-		'columns'       => 3,
97
-		'limit'         => 4,
98
-		'post_type'     => 'exercise',
99
-		'orderby'       => 'date',
100
-		'order'         => 'DESC',
101
-		'description'   => 'none',
102
-		'link'          => 'item',
103
-		'link_class'    => 'btn border-btn',
104
-		'layout'        => 'grid',
105
-		'image_size'    => 'lsx-thumbnail-square',
106
-		'parent'        => false,
107
-		'modal_content' => 'excerpt',
108
-	);
109
-	$args     = wp_parse_args( $args, $defaults );
110
-	ob_start();
111
-	echo lsx_health_plan_items( $args ); // WPCS: XSS OK.
112
-	$content = ob_get_clean();
113
-	return $content;
91
+     $defaults = array(
92
+          'include'       => '',
93
+          'term'          => '',
94
+          'taxonomy'      => '',
95
+          'view_more'     => false,
96
+          'columns'       => 3,
97
+          'limit'         => 4,
98
+          'post_type'     => 'exercise',
99
+          'orderby'       => 'date',
100
+          'order'         => 'DESC',
101
+          'description'   => 'none',
102
+          'link'          => 'item',
103
+          'link_class'    => 'btn border-btn',
104
+          'layout'        => 'grid',
105
+          'image_size'    => 'lsx-thumbnail-square',
106
+          'parent'        => false,
107
+          'modal_content' => 'excerpt',
108
+     );
109
+     $args     = wp_parse_args( $args, $defaults );
110
+     ob_start();
111
+     echo lsx_health_plan_items( $args ); // WPCS: XSS OK.
112
+     $content = ob_get_clean();
113
+     return $content;
114 114
 }
115 115
 
116 116
 /**
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
  * @return void
120 120
  */
121 121
 function feature_video_box() {
122
-	ob_start();
123
-	echo lsx_health_plan_featured_video_block(); // WPCS: XSS OK.
124
-	$content = ob_get_clean();
122
+     ob_start();
123
+     echo lsx_health_plan_featured_video_block(); // WPCS: XSS OK.
124
+     $content = ob_get_clean();
125 125
 
126
-	wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
127
-	wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true );
128
-	return $content;
126
+     wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
127
+     wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true );
128
+     return $content;
129 129
 }
130 130
 
131 131
 /**
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
  * @return void
135 135
  */
136 136
 function feature_recipes_box() {
137
-	ob_start();
138
-	echo lsx_health_plan_featured_recipes_block(); // WPCS: XSS OK.
139
-	$content = ob_get_clean();
140
-	wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
141
-	wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true );
142
-	return $content;
137
+     ob_start();
138
+     echo lsx_health_plan_featured_recipes_block(); // WPCS: XSS OK.
139
+     $content = ob_get_clean();
140
+     wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
141
+     wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true );
142
+     return $content;
143 143
 }
144 144
 
145 145
 /**
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
  * @return void
149 149
  */
150 150
 function feature_tips_box() {
151
-	ob_start();
152
-	echo lsx_health_plan_featured_tips_block(); // WPCS: XSS OK.
153
-	$content = ob_get_clean();
154
-	wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
155
-	wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true );
156
-	return $content;
151
+     ob_start();
152
+     echo lsx_health_plan_featured_tips_block(); // WPCS: XSS OK.
153
+     $content = ob_get_clean();
154
+     wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
155
+     wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true );
156
+     return $content;
157 157
 }
158 158
 
159 159
 /**
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
  * @return string
163 163
  */
164 164
 function account_notices() {
165
-	$content = '';
166
-	if ( function_exists( 'wc_print_notices' ) ) {
167
-		$content = wc_print_notices( true );
168
-	}
169
-	return $content;
165
+     $content = '';
166
+     if ( function_exists( 'wc_print_notices' ) ) {
167
+          $content = wc_print_notices( true );
168
+     }
169
+     return $content;
170 170
 }
Please login to merge, or discard this patch.
includes/template-tags/woocommerce.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -7,38 +7,38 @@  discard block
 block discarded – undo
7 7
 
8 8
 
9 9
 function lsx_hp_single_plan_products() {
10
-	global $product;
10
+     global $product;
11 11
 
12
-	$restricted = false;
13
-	if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) {
14
-		$restricted = wc_memberships_is_post_content_restricted() && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() );
15
-	}
16
-	if ( true === $restricted && \lsx_health_plan\functions\woocommerce\plan_has_products() ) {
17
-		$products      = \lsx_health_plan\functions\woocommerce\get_plan_products();
18
-		$product_count = count( $products );
19
-		if ( 1 === (int) $product_count ) {
20
-			$class = 'col-md-12';
21
-		} else {
22
-			$class = 'col-md-6';
23
-		}
24
-		?>
12
+     $restricted = false;
13
+     if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) {
14
+          $restricted = wc_memberships_is_post_content_restricted() && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() );
15
+     }
16
+     if ( true === $restricted && \lsx_health_plan\functions\woocommerce\plan_has_products() ) {
17
+          $products      = \lsx_health_plan\functions\woocommerce\get_plan_products();
18
+          $product_count = count( $products );
19
+          if ( 1 === (int) $product_count ) {
20
+               $class = 'col-md-12';
21
+          } else {
22
+               $class = 'col-md-6';
23
+          }
24
+          ?>
25 25
 			<div class="plans-products-wrapper row">
26 26
 				<?php
27
-				foreach ( $products as $product ) {
28
-					$product = wc_get_product( $product );
29
-					?>
27
+                    foreach ( $products as $product ) {
28
+                         $product = wc_get_product( $product );
29
+                         ?>
30 30
 						<div class="plan-product <?php echo esc_attr( $class ); ?>">
31 31
 							<h3 class="title"><a href="<?php echo esc_html( $product->get_permalink() ); ?>"><?php echo esc_html( $product->get_title() ); ?></a></h3>
32 32
 							<?php
33
-							$description = $product->is_type( 'variation' ) ? $product->get_description() : $product->get_short_description();
34
-							if ( '' !== $description ) {
35
-								?>
33
+                                   $description = $product->is_type( 'variation' ) ? $product->get_description() : $product->get_short_description();
34
+                                   if ( '' !== $description ) {
35
+                                        ?>
36 36
 									<div class="description">
37 37
 										<?php echo esc_html( $description ); ?>
38 38
 									</div>
39 39
 								<?php
40
-							}
41
-							?>
40
+                                   }
41
+                                   ?>
42 42
 							<?php echo wp_kses_post( $product->get_price_html() ); ?>
43 43
 
44 44
 							<div class="add-to-cart">
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 							</div>
47 47
 						</div>
48 48
 					<?php
49
-				}
50
-				?>
49
+                    }
50
+                    ?>
51 51
 			</div>
52 52
 		<?php
53
-	}
53
+     }
54 54
 }
Please login to merge, or discard this patch.
templates/content-archive-workout.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 			<?php } ?>
23 23
 			<a href="<?php echo esc_url( get_permalink() ); ?>">
24 24
 			<?php
25
-			$featured_image = get_the_post_thumbnail();
26
-			if ( ! empty( $featured_image ) && '' !== $featured_image ) {
27
-				the_post_thumbnail( 'lsx-thumbnail-square', array(
28
-					'class' => 'aligncenter',
29
-				) );
30
-			} else {
31
-				?>
25
+               $featured_image = get_the_post_thumbnail();
26
+               if ( ! empty( $featured_image ) && '' !== $featured_image ) {
27
+                    the_post_thumbnail( 'lsx-thumbnail-square', array(
28
+                         'class' => 'aligncenter',
29
+                    ) );
30
+               } else {
31
+                    ?>
32 32
 				<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>">
33 33
 				<?php
34
-			}
35
-			?>
34
+               }
35
+               ?>
36 36
 			</a>
37 37
 		</div>
38 38
 		<div class="content-box workout-content-box white-bg">
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 				<?php the_title( '<h3 class="workout-title">', '</h3>' ); ?>
41 41
 			</a>
42 42
 			<?php
43
-			if ( ! has_excerpt() ) {
44
-				$content = wp_trim_words( get_the_content(), 20 );
45
-				$content = '<p>' . $content . '</p>';
46
-			} else {
47
-				$content = apply_filters( 'the_excerpt', get_the_excerpt() );
48
-			}
49
-			echo wp_kses_post( $content );
50
-			?>
43
+               if ( ! has_excerpt() ) {
44
+                    $content = wp_trim_words( get_the_content(), 20 );
45
+                    $content = '<p>' . $content . '</p>';
46
+               } else {
47
+                    $content = apply_filters( 'the_excerpt', get_the_excerpt() );
48
+               }
49
+               echo wp_kses_post( $content );
50
+               ?>
51 51
 			<a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See workout', 'lsx-health-plan' ); ?></a>
52 52
 		</div>
53 53
 		<?php lsx_entry_bottom(); ?>
Please login to merge, or discard this patch.
includes/functions/plan.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
  * @return boolean
15 15
  */
16 16
 function is_search_enabled() {
17
-	$enabled = false;
18
-	if ( function_exists( 'lsx_search' ) ) {
19
-		$search_instance = \LSX_Search::get_instance();
20
-		if ( null !== $search_instance ) {
21
-			$enabled = $search_instance->frontend->is_search_enabled();
22
-		}
23
-	}
24
-	return $enabled;
17
+     $enabled = false;
18
+     if ( function_exists( 'lsx_search' ) ) {
19
+          $search_instance = \LSX_Search::get_instance();
20
+          if ( null !== $search_instance ) {
21
+               $enabled = $search_instance->frontend->is_search_enabled();
22
+          }
23
+     }
24
+     return $enabled;
25 25
 }
26 26
 
27 27
 /**
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  * @return boolean
32 32
  */
33 33
 function has_sections( $plan_id = 0 ) {
34
-	$sections = false;
35
-	if ( 0 === $plan_id ) {
36
-		$plan_id = get_the_ID();
37
-	}
38
-	$lsx_hp   = lsx_health_plan();
39
-	$sections = $lsx_hp->frontend->plan_query->query_sections( $plan_id );
40
-	return $sections;
34
+     $sections = false;
35
+     if ( 0 === $plan_id ) {
36
+          $plan_id = get_the_ID();
37
+     }
38
+     $lsx_hp   = lsx_health_plan();
39
+     $sections = $lsx_hp->frontend->plan_query->query_sections( $plan_id );
40
+     return $sections;
41 41
 }
42 42
 
43 43
 /**
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
  * @return array
49 49
  */
50 50
 function get_sections( $group_sections = false ) {
51
-	$lsx_hp   = lsx_health_plan();
52
-	$sections = $lsx_hp->frontend->plan_query->get_sections( $group_sections );
53
-	return $sections;
51
+     $lsx_hp   = lsx_health_plan();
52
+     $sections = $lsx_hp->frontend->plan_query->get_sections( $group_sections );
53
+     return $sections;
54 54
 }
55 55
 
56 56
 /**
@@ -60,18 +60,18 @@  discard block
 block discarded – undo
60 60
  * @return array
61 61
  */
62 62
 function get_section_info( $section_key = '' ) {
63
-	$section_info = array();
63
+     $section_info = array();
64 64
 
65
-	$sections = get_sections();
66
-	if ( ! empty( $sections ) ) {
67
-		foreach ( $sections as $key => $values ) {
68
-			$current_key = sanitize_title( $values['title'] );
69
-			if ( $current_key === $section_key ) {
70
-				return $values;
71
-			}
72
-		}
73
-	}
74
-	return $section_info;
65
+     $sections = get_sections();
66
+     if ( ! empty( $sections ) ) {
67
+          foreach ( $sections as $key => $values ) {
68
+               $current_key = sanitize_title( $values['title'] );
69
+               if ( $current_key === $section_key ) {
70
+                    return $values;
71
+               }
72
+          }
73
+     }
74
+     return $section_info;
75 75
 }
76 76
 
77 77
 /**
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
  * @return array
82 82
  */
83 83
 function get_group_title( $sections = array() ) {
84
-	$group_title = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) );
85
-	if ( ! empty( $sections ) ) {
86
-		$first_section = reset( $sections );
87
-		if ( isset( $first_section['group'] ) && '' !== $first_section['group'] ) {
88
-			$group_title = $first_section['group'];
89
-		}
90
-	}
91
-	return $group_title;
84
+     $group_title = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) );
85
+     if ( ! empty( $sections ) ) {
86
+          $first_section = reset( $sections );
87
+          if ( isset( $first_section['group'] ) && '' !== $first_section['group'] ) {
88
+               $group_title = $first_section['group'];
89
+          }
90
+     }
91
+     return $group_title;
92 92
 }
93 93
 
94 94
 /**
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
  * @return array
100 100
  */
101 101
 function get_permalink( $plan_id = 0, $title = '' ) {
102
-	if ( 0 === $plan_id ) {
103
-		$plan_id = get_the_ID();
104
-	}
105
-	$url = \get_permalink( $plan_id );
106
-	if ( '' !== $title ) {
107
-		$url .= sanitize_title( $title ) . '/';
108
-	}
109
-	return $url;
102
+     if ( 0 === $plan_id ) {
103
+          $plan_id = get_the_ID();
104
+     }
105
+     $url = \get_permalink( $plan_id );
106
+     if ( '' !== $title ) {
107
+          $url .= sanitize_title( $title ) . '/';
108
+     }
109
+     return $url;
110 110
 }
111 111
 
112 112
 /**
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
  * @return boolean
116 116
  */
117 117
 function is_filters_disabled( $disabled = false ) {
118
-	$is_disabled = \lsx_health_plan\functions\get_option( 'plan_filters_disabled', false );
119
-	if ( false !== $is_disabled ) {
120
-		$disabled = true;
121
-	}
122
-	return $disabled;
118
+     $is_disabled = \lsx_health_plan\functions\get_option( 'plan_filters_disabled', false );
119
+     if ( false !== $is_disabled ) {
120
+          $disabled = true;
121
+     }
122
+     return $disabled;
123 123
 }
124 124
 
125 125
 /**
@@ -130,17 +130,17 @@  discard block
 block discarded – undo
130 130
  * @return string
131 131
  */
132 132
 function generate_section_id( $section_key = '' ) {
133
-	$key          = get_the_ID();
134
-	if ( '' === $section_key ) {
135
-		$section_key  = get_query_var( 'section' );
136
-	}
133
+     $key          = get_the_ID();
134
+     if ( '' === $section_key ) {
135
+          $section_key  = get_query_var( 'section' );
136
+     }
137 137
 
138
-	$section_key = sanitize_title( $section_key );
138
+     $section_key = sanitize_title( $section_key );
139 139
 	
140
-	if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) {
141
-		$group_title  = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) );
142
-		$section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key );
143
-		$key         .= '_' . sanitize_key( $group_title ) . '_' . sanitize_key( $section_info['title'] );
144
-	}
145
-	return $key;
140
+     if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) {
141
+          $group_title  = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) );
142
+          $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key );
143
+          $key         .= '_' . sanitize_key( $group_title ) . '_' . sanitize_key( $section_info['title'] );
144
+     }
145
+     return $key;
146 146
 }
Please login to merge, or discard this patch.
classes/frontend/class-endpoints.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -8,88 +8,88 @@
 block discarded – undo
8 8
  */
9 9
 class Endpoints {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\frontend\Endpoints()
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\frontend\Endpoints()
17
+      */
18
+     protected static $instance = null;
19 19
 
20
-	/**
21
-	 * Constructor
22
-	 */
23
-	public function __construct() {
24
-		add_action( 'init', array( $this, 'setup' ) );
25
-	}
20
+     /**
21
+      * Constructor
22
+      */
23
+     public function __construct() {
24
+          add_action( 'init', array( $this, 'setup' ) );
25
+     }
26 26
 
27
-	/**
28
-	 * Return an instance of this class.
29
-	 *
30
-	 * @since 1.0.0
31
-	 *
32
-	 * @return    object \lsx_health_plan\classes\frontend\Endpoints()    A single instance of this class.
33
-	 */
34
-	public static function get_instance() {
35
-		// If the single instance hasn't been set, set it now.
36
-		if ( null === self::$instance ) {
37
-			self::$instance = new self();
38
-		}
39
-		return self::$instance;
40
-	}
27
+     /**
28
+      * Return an instance of this class.
29
+      *
30
+      * @since 1.0.0
31
+      *
32
+      * @return    object \lsx_health_plan\classes\frontend\Endpoints()    A single instance of this class.
33
+      */
34
+     public static function get_instance() {
35
+          // If the single instance hasn't been set, set it now.
36
+          if ( null === self::$instance ) {
37
+               self::$instance = new self();
38
+          }
39
+          return self::$instance;
40
+     }
41 41
 
42
-	/**
43
-	 * Runs on init
44
-	 */
45
-	public function setup() {
46
-		$this->add_rewrite_rules();
47
-	}
42
+     /**
43
+      * Runs on init
44
+      */
45
+     public function setup() {
46
+          $this->add_rewrite_rules();
47
+     }
48 48
 
49
-	/**
50
-	 * Registers the rewrites.
51
-	 */
52
-	public function add_rewrite_rules() {
53
-		// Here is where we add in the rewrite rules above the normal WP ones.
54
-		add_rewrite_tag( '%endpoint%', '([^&]+)' );
55
-		add_rewrite_tag( '%section%', '([^&]+)' );
49
+     /**
50
+      * Registers the rewrites.
51
+      */
52
+     public function add_rewrite_rules() {
53
+          // Here is where we add in the rewrite rules above the normal WP ones.
54
+          add_rewrite_tag( '%endpoint%', '([^&]+)' );
55
+          add_rewrite_tag( '%section%', '([^&]+)' );
56 56
 
57
-		// Plan Sections.
58
-		add_rewrite_rule( 'plan/([^/]+)/([^/]+)/?$', 'index.php?plan=$matches[1]&section=$matches[2]', 'top' );
57
+          // Plan Sections.
58
+          add_rewrite_rule( 'plan/([^/]+)/([^/]+)/?$', 'index.php?plan=$matches[1]&section=$matches[2]', 'top' );
59 59
 
60
-		// Warm up.
61
-		$warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false );
62
-		if ( false === $warm_up ) {
63
-			$warm_up = 'warm-up';
64
-		}
60
+          // Warm up.
61
+          $warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false );
62
+          if ( false === $warm_up ) {
63
+               $warm_up = 'warm-up';
64
+          }
65 65
 
66
-		add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $warm_up . '/?$', 'index.php?plan=$matches[1]&section=$matches[2]&endpoint=warm-up', 'top' );
66
+          add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $warm_up . '/?$', 'index.php?plan=$matches[1]&section=$matches[2]&endpoint=warm-up', 'top' );
67 67
 
68
-		// Workout.
69
-		if ( post_type_exists( 'workout' ) ) {
70
-			$workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false );
71
-			if ( false === $workout ) {
72
-				$workout = 'workout';
73
-			}
74
-		}
75
-		add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $workout . '/?$', 'index.php?plan=$matches[1]&section=$matches[2]&endpoint=workout', 'top' );
68
+          // Workout.
69
+          if ( post_type_exists( 'workout' ) ) {
70
+               $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false );
71
+               if ( false === $workout ) {
72
+                    $workout = 'workout';
73
+               }
74
+          }
75
+          add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $workout . '/?$', 'index.php?plan=$matches[1]&section=$matches[2]&endpoint=workout', 'top' );
76 76
 
77
-		// Meal.
78
-		if ( post_type_exists( 'meal' ) ) {
79
-			$meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false );
80
-			if ( false === $meal ) {
81
-				$meal = 'meal';
82
-			}
83
-		}
84
-		add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $meal . '/?$', 'index.php?plan=$matches[1]&section=$matches[2]&endpoint=meal', 'top' );
77
+          // Meal.
78
+          if ( post_type_exists( 'meal' ) ) {
79
+               $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false );
80
+               if ( false === $meal ) {
81
+                    $meal = 'meal';
82
+               }
83
+          }
84
+          add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $meal . '/?$', 'index.php?plan=$matches[1]&section=$matches[2]&endpoint=meal', 'top' );
85 85
 
86
-		// Recipe.
87
-		if ( post_type_exists( 'recipe' ) ) {
88
-			$recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false );
89
-			if ( false === $recipe ) {
90
-				$recipe = 'recipes';
91
-			}
92
-		}
93
-		add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $recipe . '/?$', 'index.php?plan=$matches[1]&section=$matches[2]&endpoint=recipes', 'top' );
94
-	}
86
+          // Recipe.
87
+          if ( post_type_exists( 'recipe' ) ) {
88
+               $recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false );
89
+               if ( false === $recipe ) {
90
+                    $recipe = 'recipes';
91
+               }
92
+          }
93
+          add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $recipe . '/?$', 'index.php?plan=$matches[1]&section=$matches[2]&endpoint=recipes', 'top' );
94
+     }
95 95
 }
Please login to merge, or discard this patch.
classes/frontend/class-plan-status.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -8,53 +8,53 @@
 block discarded – undo
8 8
  */
9 9
 class Plan_Status {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\frontend\Plan_Status()
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\frontend\Plan_Status()
17
+      */
18
+     protected static $instance = null;
19 19
 
20
-	/**
21
-	 * Constructor
22
-	 */
23
-	public function __construct() {
24
-		add_action( 'init', array( $this, 'handle_day_action' ), 100 );
25
-	}
20
+     /**
21
+      * Constructor
22
+      */
23
+     public function __construct() {
24
+          add_action( 'init', array( $this, 'handle_day_action' ), 100 );
25
+     }
26 26
 
27
-	/**
28
-	 * Return an instance of this class.
29
-	 *
30
-	 * @since 1.0.0
31
-	 *
32
-	 * @return    object \lsx_health_plan\classes\frontend\Plan_Status()    A single instance of this class.
33
-	 */
34
-	public static function get_instance() {
35
-		// If the single instance hasn't been set, set it now.
36
-		if ( null === self::$instance ) {
37
-			self::$instance = new self();
38
-		}
39
-		return self::$instance;
40
-	}
27
+     /**
28
+      * Return an instance of this class.
29
+      *
30
+      * @since 1.0.0
31
+      *
32
+      * @return    object \lsx_health_plan\classes\frontend\Plan_Status()    A single instance of this class.
33
+      */
34
+     public static function get_instance() {
35
+          // If the single instance hasn't been set, set it now.
36
+          if ( null === self::$instance ) {
37
+               self::$instance = new self();
38
+          }
39
+          return self::$instance;
40
+     }
41 41
 
42
-	/**
43
-	 * Registers the rewrites.
44
-	 */
45
-	public function handle_day_action() {
46
-		if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) {
47
-			update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true );
48
-			$plan_id     = sanitize_key( $_POST['lsx-health-plan-id'] );
49
-			$plan_parent = wp_get_post_parent_id( $plan_id );
50
-			if ( 0 !== $plan_parent ) {
51
-				$plan_id = $plan_parent;
52
-			}
53
-			wp_safe_redirect( get_permalink( $plan_id ) );
54
-		}
42
+     /**
43
+      * Registers the rewrites.
44
+      */
45
+     public function handle_day_action() {
46
+          if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) {
47
+               update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true );
48
+               $plan_id     = sanitize_key( $_POST['lsx-health-plan-id'] );
49
+               $plan_parent = wp_get_post_parent_id( $plan_id );
50
+               if ( 0 !== $plan_parent ) {
51
+                    $plan_id = $plan_parent;
52
+               }
53
+               wp_safe_redirect( get_permalink( $plan_id ) );
54
+          }
55 55
 
56
-		if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) {
57
-			delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' );
58
-		}
59
-	}
56
+          if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) {
57
+               delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' );
58
+          }
59
+     }
60 60
 }
Please login to merge, or discard this patch.