Passed
Push — master ( 62b89f...cc2aaf )
by Warwick
05:05
created
classes/frontend/class-gallery.php 2 patches
Indentation   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -8,263 +8,263 @@
 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
-	 * Constructor
69
-	 */
70
-	public function __construct() {
71
-	}
67
+     /**
68
+      * Constructor
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
-		if ( '' === $item_id ) {
97
-			$this->item_id = get_the_ID();
98
-		} else {
99
-			$this->item_id = $item_id;
100
-		}
101
-		$this->has_gallery = false;
102
-		if ( '' === $post_type ) {
103
-			$this->post_type = get_post_type( $this->item_id );
104
-		}
105
-		$gallery = get_post_meta( $this->item_id, $this->post_type . '_gallery', true );
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
+          if ( '' === $item_id ) {
97
+               $this->item_id = get_the_ID();
98
+          } else {
99
+               $this->item_id = $item_id;
100
+          }
101
+          $this->has_gallery = false;
102
+          if ( '' === $post_type ) {
103
+               $this->post_type = get_post_type( $this->item_id );
104
+          }
105
+          $gallery = get_post_meta( $this->item_id, $this->post_type . '_gallery', true );
106 106
 
107
-		if ( ! empty( $gallery ) && ( '' !== $gallery ) ) {
108
-			$this->gallery     = $gallery;
109
-			$this->has_gallery = true;
110
-			wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/src/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
111
-			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 );
112
-		}
113
-		return $this->has_gallery;
114
-	}
107
+          if ( ! empty( $gallery ) && ( '' !== $gallery ) ) {
108
+               $this->gallery     = $gallery;
109
+               $this->has_gallery = true;
110
+               wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/src/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
111
+               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 );
112
+          }
113
+          return $this->has_gallery;
114
+     }
115 115
 
116
-	/**
117
-	 * Returns the defaults for the gallery, after grabbing the setting from the item.
118
-	 *
119
-	 * @param  string $item_id
120
-	 * @param  string $post_type
121
-	 * @return array
122
-	 */
123
-	public function get_defaults( $item_id = '', $post_type = '' ) {
124
-		if ( '' === $item_id ) {
125
-			$item_id = $this->item_id;
126
-		}
127
-		if ( '' === $post_type ) {
128
-			$post_type = $this->post_type;
129
-		}
130
-		$this->defaults = array(
131
-			'columns'   => '3',
132
-			'layout'    => 'slider',
133
-			'interval'  => false,
134
-			'css_class' => false,
135
-		);
136
-		foreach ( $this->defaults as $key => $default ) {
137
-			$override = get_post_meta( $item_id, $this->post_type . '_gallery_' . $key, true );
138
-			if ( '' !== $override && false !== $override && ! empty( $override ) ) {
139
-				$this->defaults[ $key ] = $override;
140
-			}
141
-		}
142
-		return $this->defaults;
143
-	}
116
+     /**
117
+      * Returns the defaults for the gallery, after grabbing the setting from the item.
118
+      *
119
+      * @param  string $item_id
120
+      * @param  string $post_type
121
+      * @return array
122
+      */
123
+     public function get_defaults( $item_id = '', $post_type = '' ) {
124
+          if ( '' === $item_id ) {
125
+               $item_id = $this->item_id;
126
+          }
127
+          if ( '' === $post_type ) {
128
+               $post_type = $this->post_type;
129
+          }
130
+          $this->defaults = array(
131
+               'columns'   => '3',
132
+               'layout'    => 'slider',
133
+               'interval'  => false,
134
+               'css_class' => false,
135
+          );
136
+          foreach ( $this->defaults as $key => $default ) {
137
+               $override = get_post_meta( $item_id, $this->post_type . '_gallery_' . $key, true );
138
+               if ( '' !== $override && false !== $override && ! empty( $override ) ) {
139
+                    $this->defaults[ $key ] = $override;
140
+               }
141
+          }
142
+          return $this->defaults;
143
+     }
144 144
 
145
-	/**
146
-	 * Gets and returns the gallery html.
147
-	 *
148
-	 * @param string $item_id
149
-	 * @param string $post_type
150
-	 * @return void
151
-	 */
152
-	public function get_gallery( $item_id = '', $post_type = '', $args = array() ) {
153
-		$return     = '';
154
-		$this->html = array();
155
-		$this->args = wp_parse_args( $args, $this->get_defaults( $item_id, $post_type ) );
156
-		if ( ! empty( $this->gallery ) ) {
157
-			$this->args['count'] = 1;
158
-			if ( '' !== $post_type ) {
159
-				$this->args['post_type'] = $post_type;
160
-			} else {
161
-				$this->args['post_type'] = $this->post_type;
162
-			}
145
+     /**
146
+      * Gets and returns the gallery html.
147
+      *
148
+      * @param string $item_id
149
+      * @param string $post_type
150
+      * @return void
151
+      */
152
+     public function get_gallery( $item_id = '', $post_type = '', $args = array() ) {
153
+          $return     = '';
154
+          $this->html = array();
155
+          $this->args = wp_parse_args( $args, $this->get_defaults( $item_id, $post_type ) );
156
+          if ( ! empty( $this->gallery ) ) {
157
+               $this->args['count'] = 1;
158
+               if ( '' !== $post_type ) {
159
+                    $this->args['post_type'] = $post_type;
160
+               } else {
161
+                    $this->args['post_type'] = $this->post_type;
162
+               }
163 163
 
164
-			// output the opening boostrap row divs.
165
-			$this->before_loop();
164
+               // output the opening boostrap row divs.
165
+               $this->before_loop();
166 166
 
167
-			foreach ( $this->gallery as $key => $gallery ) {
167
+               foreach ( $this->gallery as $key => $gallery ) {
168 168
 
169
-				$this->loop_start();
169
+                    $this->loop_start();
170 170
 
171
-				if ( isset( $gallery['exercise_gallery_image_id'] ) && ! empty( $gallery['exercise_gallery_image_id'] ) ) {
172
-					$size         = apply_filters( 'lsx_hp_exercise_gallery_size', 'full' );
173
-					$thumbnail    = wp_get_attachment_image( $gallery['exercise_gallery_image_id'], $size );
174
-					$this->html[] = $thumbnail;
175
-				} elseif ( isset( $gallery['exercise_gallery_external'] ) && ! empty( $gallery['exercise_gallery_external'] ) ) {
176
-					$this->html[] = $gallery['exercise_gallery_external']; // WPCS: XSS OK.
177
-				} elseif ( isset( $gallery['exercise_gallery_embed'] ) && ! empty( $gallery['exercise_gallery_embed'] ) ) {
178
-					$embed_args = array(
179
-						'width' => '530',
180
-					);
181
-					$embed        = wp_oembed_get( $gallery['exercise_gallery_embed'], $embed_args );
182
-					$this->html[] = str_replace( 'width="530"', 'width="100%"', $embed ); // WPCS: XSS OK.
183
-				}
171
+                    if ( isset( $gallery['exercise_gallery_image_id'] ) && ! empty( $gallery['exercise_gallery_image_id'] ) ) {
172
+                         $size         = apply_filters( 'lsx_hp_exercise_gallery_size', 'full' );
173
+                         $thumbnail    = wp_get_attachment_image( $gallery['exercise_gallery_image_id'], $size );
174
+                         $this->html[] = $thumbnail;
175
+                    } elseif ( isset( $gallery['exercise_gallery_external'] ) && ! empty( $gallery['exercise_gallery_external'] ) ) {
176
+                         $this->html[] = $gallery['exercise_gallery_external']; // WPCS: XSS OK.
177
+                    } elseif ( isset( $gallery['exercise_gallery_embed'] ) && ! empty( $gallery['exercise_gallery_embed'] ) ) {
178
+                         $embed_args = array(
179
+                              'width' => '530',
180
+                         );
181
+                         $embed        = wp_oembed_get( $gallery['exercise_gallery_embed'], $embed_args );
182
+                         $this->html[] = str_replace( 'width="530"', 'width="100%"', $embed ); // WPCS: XSS OK.
183
+                    }
184 184
 
185
-				$this->loop_end();
185
+                    $this->loop_end();
186 186
 
187
-				$this->args['count']++;
188
-			}
187
+                    $this->args['count']++;
188
+               }
189 189
 
190
-			// output the closing boostrap row divs.
191
-			$this->after_loop();
192
-		}
190
+               // output the closing boostrap row divs.
191
+               $this->after_loop();
192
+          }
193 193
 
194
-		// Join the html output if its not empty.
195
-		if ( ! empty( $this->html ) ) {
196
-			$return = implode( '', $this->html );
197
-		}
198
-		return $return;
199
-	}
194
+          // Join the html output if its not empty.
195
+          if ( ! empty( $this->html ) ) {
196
+               $return = implode( '', $this->html );
197
+          }
198
+          return $return;
199
+     }
200 200
 
201
-	/**
202
-	 * Outputs the CSS class for the panels
203
-	 *
204
-	 * @param string $columns
205
-	 * @return string
206
-	 */
207
-	public function column_class() {
208
-		$cols  = 'col-xs-12 col-sm-';
209
-		$cols .= '5' === $this->args['columns'] ? '15' : 12 / $this->args['columns'];
210
-		return $cols;
211
-	}
201
+     /**
202
+      * Outputs the CSS class for the panels
203
+      *
204
+      * @param string $columns
205
+      * @return string
206
+      */
207
+     public function column_class() {
208
+          $cols  = 'col-xs-12 col-sm-';
209
+          $cols .= '5' === $this->args['columns'] ? '15' : 12 / $this->args['columns'];
210
+          return $cols;
211
+     }
212 212
 
213
-	/**
214
-	 * Runs just after the if and before the while statement in $this->output()
215
-	 */
216
-	public function before_loop() {
217
-		if ( 'slider' === $this->args['layout'] ) {
218
-			$this->carousel_id = wp_rand( 20, 20000 );
219
-			$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\": 1, \"slidesToScroll\": 1'>";
220
-		} else {
221
-			$this->html[] = "<div class='lsx-hp-widget-items widget-item-grid-layout'>";
222
-		}
223
-	}
213
+     /**
214
+      * Runs just after the if and before the while statement in $this->output()
215
+      */
216
+     public function before_loop() {
217
+          if ( 'slider' === $this->args['layout'] ) {
218
+               $this->carousel_id = wp_rand( 20, 20000 );
219
+               $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\": 1, \"slidesToScroll\": 1'>";
220
+          } else {
221
+               $this->html[] = "<div class='lsx-hp-widget-items widget-item-grid-layout'>";
222
+          }
223
+     }
224 224
 
225
-	/**
226
-	 * Runs at the very end of the loop before it runs again.
227
-	 */
228
-	public function loop_start() {
229
-		// Get the call for the active slide.
230
-		if ( 'slider' === $this->args['layout'] ) {
231
-			$this->html[] = "<div class='lsx-hp-widget-item-wrap lsx-{$this->args['post_type']}'>";
232
-		} else {
233
-			if ( 1 === $this->args['count'] ) {
234
-				$this->html[] = "<div class='row'>";
235
-			}
236
-			$this->html[] = '<div class="' . $this->column_class() . '">';
237
-		}
238
-	}
225
+     /**
226
+      * Runs at the very end of the loop before it runs again.
227
+      */
228
+     public function loop_start() {
229
+          // Get the call for the active slide.
230
+          if ( 'slider' === $this->args['layout'] ) {
231
+               $this->html[] = "<div class='lsx-hp-widget-item-wrap lsx-{$this->args['post_type']}'>";
232
+          } else {
233
+               if ( 1 === $this->args['count'] ) {
234
+                    $this->html[] = "<div class='row'>";
235
+               }
236
+               $this->html[] = '<div class="' . $this->column_class() . '">';
237
+          }
238
+     }
239 239
 
240
-	/**
241
-	 * Runs at the very end of the loop before it runs again.
242
-	 */
243
-	public function loop_end() {
244
-		if ( 'slider' !== $this->args['layout'] ) {
245
-			$this->html[] = '</div>';
246
-		}
247
-		// Close the current slide panel.
248
-		if ( 'slider' === $this->args['layout'] ) {
249
-			$this->html[] = '</div>';
250
-		} elseif ( 0 === $this->args['count'] % $this->args['columns'] || count( $this->gallery ) === $this->args['count'] ) {
251
-			$this->html[] = '</div>';
240
+     /**
241
+      * Runs at the very end of the loop before it runs again.
242
+      */
243
+     public function loop_end() {
244
+          if ( 'slider' !== $this->args['layout'] ) {
245
+               $this->html[] = '</div>';
246
+          }
247
+          // Close the current slide panel.
248
+          if ( 'slider' === $this->args['layout'] ) {
249
+               $this->html[] = '</div>';
250
+          } elseif ( 0 === $this->args['count'] % $this->args['columns'] || count( $this->gallery ) === $this->args['count'] ) {
251
+               $this->html[] = '</div>';
252 252
 
253
-			if ( $this->args['count'] < count( $this->gallery ) ) {
254
-				$this->html[] = "<div class='row'>";
255
-			}
256
-		}
257
-	}
253
+               if ( $this->args['count'] < count( $this->gallery ) ) {
254
+                    $this->html[] = "<div class='row'>";
255
+               }
256
+          }
257
+     }
258 258
 
259
-	/**
260
-	 * Runs just after the if and before the while statement in $this->output()
261
-	 */
262
-	public function after_loop() {
263
-		// Slider output Closing.
264
-		if ( 'slider' === $this->args['layout'] ) {
265
-			$this->html[] = '</div>';
266
-		} else {
267
-			$this->html[] = '</div>';
268
-		}
269
-	}
259
+     /**
260
+      * Runs just after the if and before the while statement in $this->output()
261
+      */
262
+     public function after_loop() {
263
+          // Slider output Closing.
264
+          if ( 'slider' === $this->args['layout'] ) {
265
+               $this->html[] = '</div>';
266
+          } else {
267
+               $this->html[] = '</div>';
268
+          }
269
+     }
270 270
 }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 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,23 +92,23 @@  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 = '' ) {
96
-		if ( '' === $item_id ) {
95
+	public function has_gallery($item_id = '', $post_type = '') {
96
+		if ('' === $item_id) {
97 97
 			$this->item_id = get_the_ID();
98 98
 		} else {
99 99
 			$this->item_id = $item_id;
100 100
 		}
101 101
 		$this->has_gallery = false;
102
-		if ( '' === $post_type ) {
103
-			$this->post_type = get_post_type( $this->item_id );
102
+		if ('' === $post_type) {
103
+			$this->post_type = get_post_type($this->item_id);
104 104
 		}
105
-		$gallery = get_post_meta( $this->item_id, $this->post_type . '_gallery', true );
105
+		$gallery = get_post_meta($this->item_id, $this->post_type . '_gallery', true);
106 106
 
107
-		if ( ! empty( $gallery ) && ( '' !== $gallery ) ) {
107
+		if ( ! empty($gallery) && ('' !== $gallery)) {
108 108
 			$this->gallery     = $gallery;
109 109
 			$this->has_gallery = true;
110
-			wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/src/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
111
-			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 );
110
+			wp_enqueue_script('slick', LSX_HEALTH_PLAN_URL . 'assets/js/src/slick.min.js', array('jquery'), LSX_HEALTH_PLAN_VER, true);
111
+			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);
112 112
 		}
113 113
 		return $this->has_gallery;
114 114
 	}
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 	 * @param  string $post_type
121 121
 	 * @return array
122 122
 	 */
123
-	public function get_defaults( $item_id = '', $post_type = '' ) {
124
-		if ( '' === $item_id ) {
123
+	public function get_defaults($item_id = '', $post_type = '') {
124
+		if ('' === $item_id) {
125 125
 			$item_id = $this->item_id;
126 126
 		}
127
-		if ( '' === $post_type ) {
127
+		if ('' === $post_type) {
128 128
 			$post_type = $this->post_type;
129 129
 		}
130 130
 		$this->defaults = array(
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 			'interval'  => false,
134 134
 			'css_class' => false,
135 135
 		);
136
-		foreach ( $this->defaults as $key => $default ) {
137
-			$override = get_post_meta( $item_id, $this->post_type . '_gallery_' . $key, true );
138
-			if ( '' !== $override && false !== $override && ! empty( $override ) ) {
139
-				$this->defaults[ $key ] = $override;
136
+		foreach ($this->defaults as $key => $default) {
137
+			$override = get_post_meta($item_id, $this->post_type . '_gallery_' . $key, true);
138
+			if ('' !== $override && false !== $override && ! empty($override)) {
139
+				$this->defaults[$key] = $override;
140 140
 			}
141 141
 		}
142 142
 		return $this->defaults;
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
 	 * @param string $post_type
150 150
 	 * @return void
151 151
 	 */
152
-	public function get_gallery( $item_id = '', $post_type = '', $args = array() ) {
152
+	public function get_gallery($item_id = '', $post_type = '', $args = array()) {
153 153
 		$return     = '';
154 154
 		$this->html = array();
155
-		$this->args = wp_parse_args( $args, $this->get_defaults( $item_id, $post_type ) );
156
-		if ( ! empty( $this->gallery ) ) {
155
+		$this->args = wp_parse_args($args, $this->get_defaults($item_id, $post_type));
156
+		if ( ! empty($this->gallery)) {
157 157
 			$this->args['count'] = 1;
158
-			if ( '' !== $post_type ) {
158
+			if ('' !== $post_type) {
159 159
 				$this->args['post_type'] = $post_type;
160 160
 			} else {
161 161
 				$this->args['post_type'] = $this->post_type;
@@ -164,22 +164,22 @@  discard block
 block discarded – undo
164 164
 			// output the opening boostrap row divs.
165 165
 			$this->before_loop();
166 166
 
167
-			foreach ( $this->gallery as $key => $gallery ) {
167
+			foreach ($this->gallery as $key => $gallery) {
168 168
 
169 169
 				$this->loop_start();
170 170
 
171
-				if ( isset( $gallery['exercise_gallery_image_id'] ) && ! empty( $gallery['exercise_gallery_image_id'] ) ) {
172
-					$size         = apply_filters( 'lsx_hp_exercise_gallery_size', 'full' );
173
-					$thumbnail    = wp_get_attachment_image( $gallery['exercise_gallery_image_id'], $size );
171
+				if (isset($gallery['exercise_gallery_image_id']) && ! empty($gallery['exercise_gallery_image_id'])) {
172
+					$size         = apply_filters('lsx_hp_exercise_gallery_size', 'full');
173
+					$thumbnail    = wp_get_attachment_image($gallery['exercise_gallery_image_id'], $size);
174 174
 					$this->html[] = $thumbnail;
175
-				} elseif ( isset( $gallery['exercise_gallery_external'] ) && ! empty( $gallery['exercise_gallery_external'] ) ) {
175
+				} elseif (isset($gallery['exercise_gallery_external']) && ! empty($gallery['exercise_gallery_external'])) {
176 176
 					$this->html[] = $gallery['exercise_gallery_external']; // WPCS: XSS OK.
177
-				} elseif ( isset( $gallery['exercise_gallery_embed'] ) && ! empty( $gallery['exercise_gallery_embed'] ) ) {
177
+				} elseif (isset($gallery['exercise_gallery_embed']) && ! empty($gallery['exercise_gallery_embed'])) {
178 178
 					$embed_args = array(
179 179
 						'width' => '530',
180 180
 					);
181
-					$embed        = wp_oembed_get( $gallery['exercise_gallery_embed'], $embed_args );
182
-					$this->html[] = str_replace( 'width="530"', 'width="100%"', $embed ); // WPCS: XSS OK.
181
+					$embed        = wp_oembed_get($gallery['exercise_gallery_embed'], $embed_args);
182
+					$this->html[] = str_replace('width="530"', 'width="100%"', $embed); // WPCS: XSS OK.
183 183
 				}
184 184
 
185 185
 				$this->loop_end();
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 		}
193 193
 
194 194
 		// Join the html output if its not empty.
195
-		if ( ! empty( $this->html ) ) {
196
-			$return = implode( '', $this->html );
195
+		if ( ! empty($this->html)) {
196
+			$return = implode('', $this->html);
197 197
 		}
198 198
 		return $return;
199 199
 	}
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 * Runs just after the if and before the while statement in $this->output()
215 215
 	 */
216 216
 	public function before_loop() {
217
-		if ( 'slider' === $this->args['layout'] ) {
218
-			$this->carousel_id = wp_rand( 20, 20000 );
217
+		if ('slider' === $this->args['layout']) {
218
+			$this->carousel_id = wp_rand(20, 20000);
219 219
 			$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\": 1, \"slidesToScroll\": 1'>";
220 220
 		} else {
221 221
 			$this->html[] = "<div class='lsx-hp-widget-items widget-item-grid-layout'>";
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
 	 */
228 228
 	public function loop_start() {
229 229
 		// Get the call for the active slide.
230
-		if ( 'slider' === $this->args['layout'] ) {
230
+		if ('slider' === $this->args['layout']) {
231 231
 			$this->html[] = "<div class='lsx-hp-widget-item-wrap lsx-{$this->args['post_type']}'>";
232 232
 		} else {
233
-			if ( 1 === $this->args['count'] ) {
233
+			if (1 === $this->args['count']) {
234 234
 				$this->html[] = "<div class='row'>";
235 235
 			}
236 236
 			$this->html[] = '<div class="' . $this->column_class() . '">';
@@ -241,16 +241,16 @@  discard block
 block discarded – undo
241 241
 	 * Runs at the very end of the loop before it runs again.
242 242
 	 */
243 243
 	public function loop_end() {
244
-		if ( 'slider' !== $this->args['layout'] ) {
244
+		if ('slider' !== $this->args['layout']) {
245 245
 			$this->html[] = '</div>';
246 246
 		}
247 247
 		// Close the current slide panel.
248
-		if ( 'slider' === $this->args['layout'] ) {
248
+		if ('slider' === $this->args['layout']) {
249 249
 			$this->html[] = '</div>';
250
-		} elseif ( 0 === $this->args['count'] % $this->args['columns'] || count( $this->gallery ) === $this->args['count'] ) {
250
+		} elseif (0 === $this->args['count'] % $this->args['columns'] || count($this->gallery) === $this->args['count']) {
251 251
 			$this->html[] = '</div>';
252 252
 
253
-			if ( $this->args['count'] < count( $this->gallery ) ) {
253
+			if ($this->args['count'] < count($this->gallery)) {
254 254
 				$this->html[] = "<div class='row'>";
255 255
 			}
256 256
 		}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function after_loop() {
263 263
 		// Slider output Closing.
264
-		if ( 'slider' === $this->args['layout'] ) {
264
+		if ('slider' === $this->args['layout']) {
265 265
 			$this->html[] = '</div>';
266 266
 		} else {
267 267
 			$this->html[] = '</div>';
Please login to merge, or discard this patch.