@@ -79,7 +79,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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>'; |