Passed
Push — add/multiplan ( e2cb64...80e770 )
by Virginia
07:47
created
classes/frontend/class-general.php 1 patch
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -8,169 +8,169 @@
 block discarded – undo
8 8
  */
9 9
 class General {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\frontend\General()
17
-	 */
18
-	protected static $instance = null;
19
-
20
-	/**
21
-	 * Constructor
22
-	 */
23
-	public function __construct() {
24
-		// Before Output.
25
-		add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 );
26
-		add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 );
27
-
28
-		// Output.
29
-		add_action( 'body_class', array( $this, 'body_classes' ) );
30
-		add_filter( 'lsx_global_header_title',  array( $this, 'single_title' ), 200, 1 );
31
-		add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 );
32
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 9 );
33
-	}
34
-
35
-	/**
36
-	 * Return an instance of this class.
37
-	 *
38
-	 * @since 1.0.0
39
-	 *
40
-	 * @return    object \lsx_health_plan\classes\frontend\General()    A single instance of this class.
41
-	 */
42
-	public static function get_instance() {
43
-		// If the single instance hasn't been set, set it now.
44
-		if ( null === self::$instance ) {
45
-			self::$instance = new self();
46
-		}
47
-		return self::$instance;
48
-	}
49
-
50
-	/**
51
-	 * Registers the plugin frontend assets
52
-	 *
53
-	 * @return void
54
-	 */
55
-	public function assets() {
56
-
57
-		if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) {
58
-			wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true );
59
-		}
60
-
61
-		wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER );
62
-		wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' );
63
-		wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) );
64
-
65
-	}
66
-
67
-	/**
68
-	 * Adds the iframe and the progress HTML tags to the allowed WordPress list.
69
-	 */
70
-	public function allow_html_tags_attributes( $tags, $context ) {
71
-		if ( 'post' === $context ) {
72
-			$tags['iframe'] = array(
73
-				'src'             => true,
74
-				'height'          => true,
75
-				'width'           => true,
76
-				'frameborder'     => true,
77
-				'allowfullscreen' => true,
78
-			);
79
-		}
80
-		$tags['progress'] = array(
81
-			'id'    => true,
82
-			'value' => true,
83
-			'max'   => true,
84
-		);
85
-		return $tags;
86
-	}
87
-
88
-	/**
89
-	 * Add body classes to body.
90
-	 *
91
-	 * @param array $classes
92
-	 * @return void
93
-	 */
94
-	public function body_classes( $classes = array() ) {
95
-		global $post;
96
-
97
-		if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) {
98
-			$classes[] = 'my-plan-shortcode';
99
-		}
100
-
101
-		if ( is_single() && is_singular( 'plan' ) ) {
102
-			$args = array(
103
-				'post_parent' => get_the_ID(),
104
-				'post_type'   => 'plan',
105
-			);
106
-
107
-			$post_id      = get_the_ID();
108
-			$has_children = get_children( $args );
109
-			$has_parent   = wp_get_post_parent_id( $post_id );
110
-
111
-			if ( ! empty( $has_children ) ) {
112
-				$plan_type_class = 'parent-plan-page';
113
-				if ( 0 !== $has_parent ) {
114
-					$plan_type_class = 'parent-sub-plan-page';
115
-				}
116
-			} else {
117
-				$plan_type_class = 'unique-plan-page';
118
-				if ( 0 !== $has_parent ) {
119
-					$plan_type_class = 'child-plan-page';
120
-				}
121
-			}
122
-			$classes[] = $plan_type_class;
123
-		}
124
-		return $classes;
125
-	}
126
-
127
-	/**
128
-	 * Remove the single recipe and exercise title
129
-	 */
130
-	public function single_title( $title ) {
131
-
132
-		if ( is_single() && is_singular( 'recipe' ) ) {
133
-
134
-			$title = __( 'Recipe', 'lsx-health-plan' );
135
-		}
136
-
137
-		if ( is_single() && is_singular( 'exercise' ) ) {
138
-
139
-			$title = __( 'Exercise', 'lsx-health-plan' );
140
-		}
141
-
142
-		return $title;
143
-	}
144
-
145
-	/**
146
-	 * Removing footer for HP single pages.
147
-	 *
148
-	 * @return void
149
-	 */
150
-	public function remove_single_footer() {
151
-		if ( ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) || ( is_archive() && is_post_type_archive( array( 'exercise', 'recipe', 'workout', 'meal' ) ) )) {
152
-			remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' );
153
-		}
154
-	}
155
-	/**
156
-	 * Remove the "Archives:" from the post type recipes.
157
-	 *
158
-	 * @param string $title the term title.
159
-	 * @return string
160
-	 */
161
-	public function get_the_archive_title( $title ) {
162
-		if ( is_post_type_archive( 'recipe' ) ) {
163
-			$title = __( 'Recipes', 'lsx-health-plan' );
164
-		}
165
-		if ( is_post_type_archive( 'exercise' ) ) {
166
-			$title = __( 'Exercises', 'lsx-health-plan' );
167
-		}
168
-		if ( is_tax() ) {
169
-			$queried_object = get_queried_object();
170
-			if ( isset( $queried_object->name ) ) {
171
-				$title = $queried_object->name;
172
-			}
173
-		}
174
-		return $title;
175
-	}
11
+     /**
12
+      * Holds class instance
13
+      *
14
+      * @since 1.0.0
15
+      *
16
+      * @var      object \lsx_health_plan\classes\frontend\General()
17
+      */
18
+     protected static $instance = null;
19
+
20
+     /**
21
+      * Constructor
22
+      */
23
+     public function __construct() {
24
+          // Before Output.
25
+          add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 );
26
+          add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 );
27
+
28
+          // Output.
29
+          add_action( 'body_class', array( $this, 'body_classes' ) );
30
+          add_filter( 'lsx_global_header_title',  array( $this, 'single_title' ), 200, 1 );
31
+          add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 );
32
+          add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 9 );
33
+     }
34
+
35
+     /**
36
+      * Return an instance of this class.
37
+      *
38
+      * @since 1.0.0
39
+      *
40
+      * @return    object \lsx_health_plan\classes\frontend\General()    A single instance of this class.
41
+      */
42
+     public static function get_instance() {
43
+          // If the single instance hasn't been set, set it now.
44
+          if ( null === self::$instance ) {
45
+               self::$instance = new self();
46
+          }
47
+          return self::$instance;
48
+     }
49
+
50
+     /**
51
+      * Registers the plugin frontend assets
52
+      *
53
+      * @return void
54
+      */
55
+     public function assets() {
56
+
57
+          if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) {
58
+               wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true );
59
+          }
60
+
61
+          wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER );
62
+          wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' );
63
+          wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) );
64
+
65
+     }
66
+
67
+     /**
68
+      * Adds the iframe and the progress HTML tags to the allowed WordPress list.
69
+      */
70
+     public function allow_html_tags_attributes( $tags, $context ) {
71
+          if ( 'post' === $context ) {
72
+               $tags['iframe'] = array(
73
+                    'src'             => true,
74
+                    'height'          => true,
75
+                    'width'           => true,
76
+                    'frameborder'     => true,
77
+                    'allowfullscreen' => true,
78
+               );
79
+          }
80
+          $tags['progress'] = array(
81
+               'id'    => true,
82
+               'value' => true,
83
+               'max'   => true,
84
+          );
85
+          return $tags;
86
+     }
87
+
88
+     /**
89
+      * Add body classes to body.
90
+      *
91
+      * @param array $classes
92
+      * @return void
93
+      */
94
+     public function body_classes( $classes = array() ) {
95
+          global $post;
96
+
97
+          if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) {
98
+               $classes[] = 'my-plan-shortcode';
99
+          }
100
+
101
+          if ( is_single() && is_singular( 'plan' ) ) {
102
+               $args = array(
103
+                    'post_parent' => get_the_ID(),
104
+                    'post_type'   => 'plan',
105
+               );
106
+
107
+               $post_id      = get_the_ID();
108
+               $has_children = get_children( $args );
109
+               $has_parent   = wp_get_post_parent_id( $post_id );
110
+
111
+               if ( ! empty( $has_children ) ) {
112
+                    $plan_type_class = 'parent-plan-page';
113
+                    if ( 0 !== $has_parent ) {
114
+                         $plan_type_class = 'parent-sub-plan-page';
115
+                    }
116
+               } else {
117
+                    $plan_type_class = 'unique-plan-page';
118
+                    if ( 0 !== $has_parent ) {
119
+                         $plan_type_class = 'child-plan-page';
120
+                    }
121
+               }
122
+               $classes[] = $plan_type_class;
123
+          }
124
+          return $classes;
125
+     }
126
+
127
+     /**
128
+      * Remove the single recipe and exercise title
129
+      */
130
+     public function single_title( $title ) {
131
+
132
+          if ( is_single() && is_singular( 'recipe' ) ) {
133
+
134
+               $title = __( 'Recipe', 'lsx-health-plan' );
135
+          }
136
+
137
+          if ( is_single() && is_singular( 'exercise' ) ) {
138
+
139
+               $title = __( 'Exercise', 'lsx-health-plan' );
140
+          }
141
+
142
+          return $title;
143
+     }
144
+
145
+     /**
146
+      * Removing footer for HP single pages.
147
+      *
148
+      * @return void
149
+      */
150
+     public function remove_single_footer() {
151
+          if ( ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) || ( is_archive() && is_post_type_archive( array( 'exercise', 'recipe', 'workout', 'meal' ) ) )) {
152
+               remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' );
153
+          }
154
+     }
155
+     /**
156
+      * Remove the "Archives:" from the post type recipes.
157
+      *
158
+      * @param string $title the term title.
159
+      * @return string
160
+      */
161
+     public function get_the_archive_title( $title ) {
162
+          if ( is_post_type_archive( 'recipe' ) ) {
163
+               $title = __( 'Recipes', 'lsx-health-plan' );
164
+          }
165
+          if ( is_post_type_archive( 'exercise' ) ) {
166
+               $title = __( 'Exercises', 'lsx-health-plan' );
167
+          }
168
+          if ( is_tax() ) {
169
+               $queried_object = get_queried_object();
170
+               if ( isset( $queried_object->name ) ) {
171
+                    $title = $queried_object->name;
172
+               }
173
+          }
174
+          return $title;
175
+     }
176 176
 }
Please login to merge, or discard this patch.
templates/table-exercise-data.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,47 +9,47 @@
 block discarded – undo
9 9
 <table class="exercise-table">
10 10
 	<tbody>
11 11
 		<?php
12
-		if ( ! empty( $type ) ) {
13
-		?>
12
+          if ( ! empty( $type ) ) {
13
+          ?>
14 14
 			<tr class="types">
15 15
 				<td><?php esc_html_e( 'Type:', 'lsx-health-plan' ); ?>&nbsp;</td>
16 16
 				<td>
17 17
 				<?php
18
-					echo wp_kses_post( $type );
19
-				?>
18
+                         echo wp_kses_post( $type );
19
+                    ?>
20 20
 				</td>
21 21
 			</tr>
22 22
 		<?php
23
-		}
24
-		?>
23
+          }
24
+          ?>
25 25
 		<?php
26
-		if ( ! empty( $muscle_group ) ) {
27
-		?>
26
+          if ( ! empty( $muscle_group ) ) {
27
+          ?>
28 28
 			<tr class="muscle-group">
29 29
 				<td><?php esc_html_e( 'Muscle Group:', 'lsx-health-plan' ); ?>&nbsp;</td>
30 30
 				<td>
31 31
 				<?php
32
-					echo wp_kses_post( $muscle_group );
33
-				?>
32
+                         echo wp_kses_post( $muscle_group );
33
+                    ?>
34 34
 				</td>
35 35
 			</tr>
36 36
 		<?php
37
-		}
38
-		?>
37
+          }
38
+          ?>
39 39
 		<?php
40
-		if ( ! empty( $equipment ) ) {
41
-		?>
40
+          if ( ! empty( $equipment ) ) {
41
+          ?>
42 42
 			<tr class="equipment">
43 43
 				<td><?php esc_html_e( 'Equipment:', 'lsx-health-plan' ); ?>&nbsp;</td>
44 44
 				<td>
45 45
 				<?php
46
-					echo wp_kses_post( $equipment );
47
-				?>
46
+                         echo wp_kses_post( $equipment );
47
+                    ?>
48 48
 				</td>
49 49
 			</tr>
50 50
 		<?php
51
-		}
52
-		?>
51
+          }
52
+          ?>
53 53
 	</tbody>
54 54
 </table>
55 55
 <?php } ?>
Please login to merge, or discard this patch.
templates/table-recipe-data.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -20,63 +20,63 @@  discard block
 block discarded – undo
20 20
 	<?php } ?>
21 21
 	<tbody>
22 22
 		<?php
23
-		if ( 1 >= (int) $serves ) {
24
-			$serves       = '1';
25
-			$serves_label = __( 'Person', 'lsx-health-plan' );
26
-		} else {
27
-			$serves_label = __( 'People', 'lsx-health-plan' );
28
-		}
29
-		?>
23
+          if ( 1 >= (int) $serves ) {
24
+               $serves       = '1';
25
+               $serves_label = __( 'Person', 'lsx-health-plan' );
26
+          } else {
27
+               $serves_label = __( 'People', 'lsx-health-plan' );
28
+          }
29
+          ?>
30 30
 		<tr class="serves">
31 31
 			<td><?php esc_html_e( 'Serves:', 'lsx-health-plan' ); ?>&nbsp;</td>
32 32
 			<td>
33 33
 			<?php
34
-				echo wp_kses_post( $serves ) . ' ' . esc_html( $serves_label );
35
-			?>
34
+                    echo wp_kses_post( $serves ) . ' ' . esc_html( $serves_label );
35
+               ?>
36 36
 			</td>
37 37
 		</tr>
38 38
 		<?php
39
-		if ( ! empty( $prep_time ) ) {
40
-		?>
39
+          if ( ! empty( $prep_time ) ) {
40
+          ?>
41 41
 		<tr class="prep-time">
42 42
 		<td><?php esc_html_e( 'Prep time: ', 'lsx-health-plan' ); ?>&nbsp;</td>
43 43
 			<td>
44 44
 			<?php
45
-				echo wp_kses_post( $prep_time );
46
-			?>
45
+                    echo wp_kses_post( $prep_time );
46
+               ?>
47 47
 			</td>
48 48
 		</tr>
49 49
 		<?php
50
-		}
51
-		?>
50
+          }
51
+          ?>
52 52
 		<?php
53
-		if ( ! empty( $cooking_time ) ) {
54
-		?>
53
+          if ( ! empty( $cooking_time ) ) {
54
+          ?>
55 55
 		<tr class="cooking-time">
56 56
 			<td><?php esc_html_e( 'Cooking time: ', 'lsx-health-plan' ); ?>&nbsp;</td>
57 57
 			<td>
58 58
 			<?php
59
-				echo wp_kses_post( $cooking_time );
60
-			?>
59
+                    echo wp_kses_post( $cooking_time );
60
+               ?>
61 61
 			</td>
62 62
 		</tr>
63 63
 		<?php
64
-		}
65
-		?>
64
+          }
65
+          ?>
66 66
 		<?php
67
-		if ( ! empty( $portion ) ) {
68
-		?>
67
+          if ( ! empty( $portion ) ) {
68
+          ?>
69 69
 		<tr class="portion-size">
70 70
 			<td><?php esc_html_e( 'Portion size: ', 'lsx-health-plan' ); ?>&nbsp;</td>
71 71
 			<td>
72 72
 			<?php
73
-				echo wp_kses_post( $portion );
74
-			?>
73
+                    echo wp_kses_post( $portion );
74
+               ?>
75 75
 			</td>
76 76
 		</tr>
77 77
 		<?php
78
-		}
79
-		?>
78
+          }
79
+          ?>
80 80
 	</tbody>
81 81
 </table>
82 82
 <?php } ?>
@@ -89,75 +89,75 @@  discard block
 block discarded – undo
89 89
 		</thead>
90 90
 		<tbody>
91 91
 			<?php
92
-			if ( ! empty( $energy ) ) {
93
-			?>
92
+               if ( ! empty( $energy ) ) {
93
+               ?>
94 94
 			<tr class="energy">
95 95
 			<td><?php esc_html_e( 'Energy: ', 'lsx-health-plan' ); ?>&nbsp;</td>
96 96
 				<td>
97 97
 				<?php
98
-					echo wp_kses_post( $energy );
99
-				?>
98
+                         echo wp_kses_post( $energy );
99
+                    ?>
100 100
 				</td>
101 101
 			</tr>
102 102
 			<?php
103
-			}
104
-			?>
103
+               }
104
+               ?>
105 105
 			<?php
106
-			if ( ! empty( $protein ) ) {
107
-			?>
106
+               if ( ! empty( $protein ) ) {
107
+               ?>
108 108
 			<tr class="protein">
109 109
 			<td><?php esc_html_e( 'Protein: ', 'lsx-health-plan' ); ?>&nbsp;</td>
110 110
 				<td>
111 111
 				<?php
112
-					echo wp_kses_post( $protein );
113
-				?>
112
+                         echo wp_kses_post( $protein );
113
+                    ?>
114 114
 				</td>
115 115
 			</tr>
116 116
 			<?php
117
-			}
118
-			?>
117
+               }
118
+               ?>
119 119
 			<?php
120
-			if ( ! empty( $carbohydrates ) ) {
121
-			?>
120
+               if ( ! empty( $carbohydrates ) ) {
121
+               ?>
122 122
 			<tr class="carbohydrates">
123 123
 			<td><?php esc_html_e( 'Carbohydrates: ', 'lsx-health-plan' ); ?>&nbsp;</td>
124 124
 				<td>
125 125
 				<?php
126
-					echo wp_kses_post( $carbohydrates );
127
-				?>
126
+                         echo wp_kses_post( $carbohydrates );
127
+                    ?>
128 128
 				</td>
129 129
 			</tr>
130 130
 			<?php
131
-			}
132
-			?>
131
+               }
132
+               ?>
133 133
 			<?php
134
-			if ( ! empty( $fibre ) ) {
135
-			?>
134
+               if ( ! empty( $fibre ) ) {
135
+               ?>
136 136
 			<tr class="fibre">
137 137
 			<td><?php esc_html_e( 'Fibre: ', 'lsx-health-plan' ); ?>&nbsp;</td>
138 138
 				<td>
139 139
 				<?php
140
-					echo wp_kses_post( $fibre );
141
-				?>
140
+                         echo wp_kses_post( $fibre );
141
+                    ?>
142 142
 				</td>
143 143
 			</tr>
144 144
 			<?php
145
-			}
146
-			?>
145
+               }
146
+               ?>
147 147
 			<?php
148
-			if ( ! empty( $fat ) ) {
149
-			?>
148
+               if ( ! empty( $fat ) ) {
149
+               ?>
150 150
 			<tr class="fat">
151 151
 			<td><?php esc_html_e( 'Fat: ', 'lsx-health-plan' ); ?>&nbsp;</td>
152 152
 				<td>
153 153
 				<?php
154
-					echo wp_kses_post( $fat );
155
-				?>
154
+                         echo wp_kses_post( $fat );
155
+                    ?>
156 156
 				</td>
157 157
 			</tr>
158 158
 			<?php
159
-			}
160
-			?>
159
+               }
160
+               ?>
161 161
 		</tbody>
162 162
 	</table>
163 163
 <?php } ?>
Please login to merge, or discard this patch.