1 | <?php |
||||
2 | /** |
||||
3 | * LSX_Activities_Frontend |
||||
4 | * |
||||
5 | * @package LSX_Activities_Frontend |
||||
6 | * @author LightSpeed |
||||
7 | * @license GPL-2.0+ |
||||
8 | * @link |
||||
9 | * @copyright 2018 LightSpeedDevelopment |
||||
10 | */ |
||||
11 | |||||
12 | /** |
||||
13 | * Main plugin class. |
||||
14 | * |
||||
15 | * @package LSX_Activities_Frontend |
||||
16 | * @author LightSpeed |
||||
17 | */ |
||||
18 | class LSX_Activities_Frontend extends LSX_Activities { |
||||
19 | |||||
20 | /** |
||||
21 | * Holds the $page_links array while its being built on the single activity page. |
||||
22 | * |
||||
23 | * @var array |
||||
24 | */ |
||||
25 | public $page_links = false; |
||||
26 | |||||
27 | /** |
||||
28 | * Constructor |
||||
29 | */ |
||||
30 | public function __construct() { |
||||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||||
31 | $this->set_vars(); |
||||
32 | |||||
33 | add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); |
||||
34 | add_action( 'init',array( $this, 'init' ) ); |
||||
35 | |||||
36 | if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { |
||||
0 ignored issues
–
show
|
|||||
37 | require_once( LSX_ACTIVITIES_PATH . 'classes/class-template-redirects.php' ); |
||||
0 ignored issues
–
show
|
|||||
38 | } |
||||
39 | |||||
40 | $this->redirects = new LSX_TO_Template_Redirects( LSX_ACTIVITIES_PATH, array_keys( $this->post_types ) ); |
||||
0 ignored issues
–
show
|
|||||
41 | |||||
42 | add_action( 'lsx_to_activity_content', array( $this->redirects, 'content_part' ), 10 , 2 ); |
||||
0 ignored issues
–
show
|
|||||
43 | |||||
44 | add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); |
||||
45 | |||||
46 | add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); |
||||
0 ignored issues
–
show
|
|||||
47 | add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); |
||||
0 ignored issues
–
show
|
|||||
48 | add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); |
||||
49 | add_action( 'lsx_to_fast_facts', array( $this, 'single_fast_facts' ) ); |
||||
50 | } |
||||
0 ignored issues
–
show
|
|||||
51 | |||||
52 | /** |
||||
53 | * Runs on init after all files have been parsed. |
||||
54 | */ |
||||
55 | public function init() { |
||||
56 | if ( ! class_exists( 'LSX_Currencies' ) ) { |
||||
0 ignored issues
–
show
|
|||||
57 | add_filter( 'lsx_to_custom_field_query',array( $this, 'price_filter' ),5,10 ); |
||||
58 | } |
||||
59 | } |
||||
0 ignored issues
–
show
|
|||||
60 | |||||
61 | /** |
||||
0 ignored issues
–
show
|
|||||
62 | * A filter to set the content area to a small column on single |
||||
63 | */ |
||||
64 | public function entry_class( $classes ) { |
||||
65 | global $lsx_to_archive; |
||||
66 | |||||
67 | if ( 1 !== $lsx_to_archive ) { |
||||
0 ignored issues
–
show
|
|||||
68 | $lsx_to_archive = false; |
||||
69 | } |
||||
70 | |||||
71 | if ( is_main_query() && is_singular( 'activity' ) && false === $lsx_to_archive ) { |
||||
0 ignored issues
–
show
|
|||||
72 | $classes[] = 'col-xs-12 col-sm-12 col-md-6'; |
||||
73 | } |
||||
74 | |||||
75 | return $classes; |
||||
76 | } |
||||
0 ignored issues
–
show
|
|||||
77 | |||||
78 | /** |
||||
0 ignored issues
–
show
|
|||||
79 | * Adds in additional info for the price custom field |
||||
80 | */ |
||||
81 | public function price_filter( $html = '', $meta_key = false, $value = false, $before = '', $after = '' ) { |
||||
82 | if ( get_post_type() === 'activity' && 'price' === $meta_key ) { |
||||
0 ignored issues
–
show
|
|||||
83 | $price_type = get_post_meta( get_the_ID(),'price_type',true ); |
||||
0 ignored issues
–
show
It seems like
get_the_ID() can also be of type false ; however, parameter $post_id of get_post_meta() does only seem to accept integer , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||||
84 | $value = preg_replace( '/[^0-9,.]/', '', $value ); |
||||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||||
85 | $value = ltrim( $value, '.' ); |
||||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||||
86 | $value = str_replace( ',','',$value ); |
||||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||||
87 | $value = number_format( (int) $value,2 ); |
||||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||||
88 | $tour_operator = tour_operator(); |
||||
89 | $currency = ''; |
||||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||||
90 | |||||
91 | if ( is_object( $tour_operator ) && isset( $tour_operator->options['general'] ) && is_array( $tour_operator->options['general'] ) ) { |
||||
0 ignored issues
–
show
|
|||||
92 | if ( isset( $tour_operator->options['general']['currency'] ) && ! empty( $tour_operator->options['general']['currency'] ) ) { |
||||
0 ignored issues
–
show
|
|||||
93 | $currency = $tour_operator->options['general']['currency']; |
||||
94 | $currency = '<span class="currency-icon ' . mb_strtolower( $currency ) . '">' . $currency . '</span>'; |
||||
95 | } |
||||
96 | } |
||||
97 | |||||
98 | switch ( $price_type ) { |
||||
0 ignored issues
–
show
|
|||||
99 | case 'per_person': |
||||
100 | case 'per_person_per_night': |
||||
101 | case 'per_person_sharing': |
||||
102 | case 'per_person_sharing_per_night': |
||||
103 | $value = $currency . $value . ' ' . ucwords( str_replace( '_',' ',$price_type ) ) . ''; |
||||
104 | $value = str_replace( 'Per Person', 'P/P', $value ); |
||||
105 | break; |
||||
106 | |||||
107 | case 'total_percentage': |
||||
108 | $value .= '% ' . __( 'Off','to-specials' ) . ''; |
||||
109 | $before = str_replace( 'from price', '', $before ); |
||||
110 | break; |
||||
111 | |||||
112 | case 'none': |
||||
113 | default: |
||||
114 | $value = $currency . $value; |
||||
115 | break; |
||||
116 | } |
||||
117 | |||||
118 | $html = $before . $value . $after; |
||||
119 | } |
||||
120 | |||||
121 | return $html; |
||||
122 | } |
||||
0 ignored issues
–
show
|
|||||
123 | |||||
124 | /** |
||||
0 ignored issues
–
show
|
|||||
125 | * Adds our navigation links to the activity single post |
||||
126 | * |
||||
127 | * @param $page_links array |
||||
0 ignored issues
–
show
|
|||||
128 | * @return $page_links array |
||||
0 ignored issues
–
show
|
|||||
129 | */ |
||||
130 | public function page_links( $page_links ) { |
||||
131 | if ( is_singular( 'activity' ) ) { |
||||
0 ignored issues
–
show
|
|||||
132 | $this->page_links = $page_links; |
||||
133 | |||||
134 | $this->get_map_link(); |
||||
135 | $this->get_related_tours_link(); |
||||
136 | $this->get_related_accommodation_link(); |
||||
137 | $this->get_gallery_link(); |
||||
138 | $this->get_videos_link(); |
||||
139 | $this->get_related_posts_link(); |
||||
140 | |||||
141 | $page_links = $this->page_links; |
||||
142 | } |
||||
143 | |||||
144 | return $page_links; |
||||
145 | } |
||||
0 ignored issues
–
show
|
|||||
146 | |||||
147 | /** |
||||
148 | * Tests for the Related Tours and returns a link for the section |
||||
149 | */ |
||||
150 | public function get_related_tours_link() { |
||||
151 | $connected_tours = get_post_meta( get_the_ID(), 'tour_to_activity', false ); |
||||
0 ignored issues
–
show
It seems like
get_the_ID() can also be of type false ; however, parameter $post_id of get_post_meta() does only seem to accept integer , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
152 | |||||
153 | if ( post_type_exists( 'tour' ) && is_array( $connected_tours ) && ! empty( $connected_tours ) ) { |
||||
0 ignored issues
–
show
|
|||||
154 | $connected_tours = new \WP_Query( array( |
||||
0 ignored issues
–
show
|
|||||
155 | 'post_type' => 'tour', |
||||
0 ignored issues
–
show
|
|||||
156 | 'post__in' => $connected_tours, |
||||
0 ignored issues
–
show
|
|||||
157 | 'post_status' => 'publish', |
||||
0 ignored issues
–
show
|
|||||
158 | 'nopagin' => true, |
||||
0 ignored issues
–
show
|
|||||
159 | 'posts_per_page' => '-1', |
||||
160 | 'fields' => 'ids', |
||||
0 ignored issues
–
show
|
|||||
161 | ) ); |
||||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||||
162 | |||||
163 | $connected_tours = $connected_tours->posts; |
||||
164 | |||||
165 | if ( is_array( $connected_tours ) && ! empty( $connected_tours ) ) { |
||||
0 ignored issues
–
show
|
|||||
166 | $this->page_links['tours'] = esc_html__( 'Tours', 'lsx-activities' ); |
||||
167 | } |
||||
168 | } |
||||
169 | } |
||||
0 ignored issues
–
show
|
|||||
170 | |||||
171 | /** |
||||
172 | * Tests for the Related Accommodation and returns a link for the section |
||||
173 | */ |
||||
174 | public function get_related_accommodation_link() { |
||||
175 | $connected_accommodation = get_post_meta( get_the_ID(), 'accommodation_to_activity', false ); |
||||
0 ignored issues
–
show
It seems like
get_the_ID() can also be of type false ; however, parameter $post_id of get_post_meta() does only seem to accept integer , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
176 | |||||
177 | if ( post_type_exists( 'accommodation' ) && is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { |
||||
0 ignored issues
–
show
|
|||||
178 | $connected_accommodation = new \WP_Query( array( |
||||
0 ignored issues
–
show
|
|||||
179 | 'post_type' => 'accommodation', |
||||
0 ignored issues
–
show
|
|||||
180 | 'post__in' => $connected_accommodation, |
||||
0 ignored issues
–
show
|
|||||
181 | 'post_status' => 'publish', |
||||
0 ignored issues
–
show
|
|||||
182 | 'nopagin' => true, |
||||
0 ignored issues
–
show
|
|||||
183 | 'posts_per_page' => '-1', |
||||
184 | 'fields' => 'ids', |
||||
0 ignored issues
–
show
|
|||||
185 | ) ); |
||||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||||
186 | |||||
187 | $connected_accommodation = $connected_accommodation->posts; |
||||
188 | |||||
189 | if ( is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { |
||||
0 ignored issues
–
show
|
|||||
190 | $this->page_links['accommodation'] = esc_html__( 'Accommodation', 'lsx-activities' ); |
||||
191 | } |
||||
192 | } |
||||
193 | } |
||||
0 ignored issues
–
show
|
|||||
194 | |||||
195 | /** |
||||
196 | * Tests for the Google Map and returns a link for the section |
||||
197 | */ |
||||
198 | public function get_map_link() { |
||||
199 | if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) { |
||||
0 ignored issues
–
show
|
|||||
200 | $this->page_links['activity-map'] = esc_html__( 'Map', 'lsx-activities' ); |
||||
201 | } |
||||
202 | } |
||||
0 ignored issues
–
show
|
|||||
203 | |||||
204 | /** |
||||
205 | * Tests for the Gallery and returns a link for the section |
||||
206 | */ |
||||
207 | public function get_gallery_link() { |
||||
208 | $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false ); |
||||
0 ignored issues
–
show
It seems like
get_the_ID() can also be of type false ; however, parameter $post_id of get_post_meta() does only seem to accept integer , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||||
209 | $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); |
||||
210 | |||||
211 | if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) { |
||||
0 ignored issues
–
show
|
|||||
212 | if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { |
||||
0 ignored issues
–
show
|
|||||
213 | // Envira Gallery |
||||
0 ignored issues
–
show
|
|||||
214 | $this->page_links['gallery'] = esc_html__( 'Gallery', 'lsx-activities' ); |
||||
215 | return; |
||||
216 | } else { |
||||
217 | if ( function_exists( 'envira_dynamic' ) ) { |
||||
0 ignored issues
–
show
|
|||||
218 | // Envira Gallery - Dynamic |
||||
0 ignored issues
–
show
|
|||||
219 | $this->page_links['gallery'] = esc_html__( 'Gallery', 'lsx-activities' ); |
||||
220 | return; |
||||
221 | } else { |
||||
222 | // WordPress Gallery |
||||
0 ignored issues
–
show
|
|||||
223 | $this->page_links['gallery'] = esc_html__( 'Gallery', 'lsx-activities' ); |
||||
224 | return; |
||||
225 | } |
||||
226 | } |
||||
227 | } |
||||
228 | } |
||||
0 ignored issues
–
show
|
|||||
229 | |||||
230 | /** |
||||
231 | * Tests for the Videos and returns a link for the section |
||||
232 | */ |
||||
233 | public function get_videos_link() { |
||||
234 | $videos_id = false; |
||||
235 | |||||
236 | if ( class_exists( 'Envira_Videos' ) ) { |
||||
0 ignored issues
–
show
|
|||||
237 | $videos_id = get_post_meta( get_the_ID(), 'envira_video', true ); |
||||
0 ignored issues
–
show
It seems like
get_the_ID() can also be of type false ; however, parameter $post_id of get_post_meta() does only seem to accept integer , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
238 | } |
||||
239 | |||||
240 | if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { |
||||
0 ignored issues
–
show
|
|||||
241 | $videos_id = get_post_meta( get_the_ID(), 'videos', true ); |
||||
242 | } |
||||
243 | |||||
244 | if ( ! empty( $videos_id ) ) { |
||||
0 ignored issues
–
show
|
|||||
245 | $this->page_links['videos'] = esc_html__( 'Videos', 'lsx-activities' ); |
||||
246 | } |
||||
247 | } |
||||
0 ignored issues
–
show
|
|||||
248 | |||||
249 | /** |
||||
250 | * Tests for the Related Posts and returns a link for the section |
||||
251 | */ |
||||
252 | public function get_related_posts_link() { |
||||
253 | $connected_posts = get_post_meta( get_the_ID(), 'post_to_activity', false ); |
||||
0 ignored issues
–
show
It seems like
get_the_ID() can also be of type false ; however, parameter $post_id of get_post_meta() does only seem to accept integer , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
254 | |||||
255 | if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { |
||||
0 ignored issues
–
show
|
|||||
256 | $connected_posts = new \WP_Query( array( |
||||
0 ignored issues
–
show
|
|||||
257 | 'post_type' => 'post', |
||||
0 ignored issues
–
show
|
|||||
258 | 'post__in' => $connected_posts, |
||||
0 ignored issues
–
show
|
|||||
259 | 'post_status' => 'publish', |
||||
0 ignored issues
–
show
|
|||||
260 | 'nopagin' => true, |
||||
0 ignored issues
–
show
|
|||||
261 | 'posts_per_page' => '-1', |
||||
262 | 'fields' => 'ids', |
||||
0 ignored issues
–
show
|
|||||
263 | ) ); |
||||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||||
264 | |||||
265 | $connected_posts = $connected_posts->posts; |
||||
266 | |||||
267 | if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { |
||||
0 ignored issues
–
show
|
|||||
268 | $this->page_links['posts'] = esc_html__( 'Posts', 'lsx-activities' ); |
||||
269 | } |
||||
270 | } |
||||
271 | } |
||||
0 ignored issues
–
show
|
|||||
272 | |||||
273 | /** |
||||
274 | * Adds the template tags to the top of the archive activity |
||||
275 | */ |
||||
276 | public function archive_entry_top() { |
||||
277 | global $lsx_to_archive; |
||||
278 | |||||
279 | if ( 'activity' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { |
||||
0 ignored issues
–
show
|
|||||
280 | if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> |
||||
0 ignored issues
–
show
|
|||||
281 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-grid-mode"> |
||||
282 | <?php |
||||
283 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
||||
284 | |||||
285 | lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
286 | lsx_to_accommodation_activity_friendly( '<span class="' . $meta_class . 'friendly"><span class="lsx-to-meta-data-key">' . __( 'Friendly', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
287 | lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ','</span>' ); |
||||
288 | lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
289 | lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
290 | ?> |
||||
291 | </div> |
||||
292 | <?php } |
||||
0 ignored issues
–
show
|
|||||
293 | } |
||||
294 | } |
||||
0 ignored issues
–
show
|
|||||
295 | |||||
296 | /** |
||||
297 | * Adds the template tags to the bottom of the archive activity |
||||
298 | */ |
||||
299 | public function archive_entry_bottom() { |
||||
300 | global $lsx_to_archive; |
||||
301 | |||||
302 | if ( 'activity' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { ?> |
||||
0 ignored issues
–
show
|
|||||
303 | </div> |
||||
304 | |||||
305 | <?php if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> |
||||
0 ignored issues
–
show
|
|||||
306 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-list-mode"> |
||||
307 | <?php |
||||
308 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
||||
309 | |||||
310 | lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
311 | lsx_to_accommodation_activity_friendly( '<span class="' . $meta_class . 'friendly"><span class="lsx-to-meta-data-key">' . __( 'Friendly', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
312 | lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ','</span>' ); |
||||
313 | lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
314 | lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
315 | ?> |
||||
316 | </div> |
||||
317 | <?php } ?> |
||||
318 | </div> |
||||
319 | |||||
320 | <?php $has_single = ! lsx_to_is_single_disabled(); ?> |
||||
321 | |||||
322 | <?php if ( $has_single && 'grid' === tour_operator()->archive_layout ) : ?> |
||||
0 ignored issues
–
show
|
|||||
323 | <a href="<?php the_permalink(); ?>" class="moretag"><?php esc_html_e( 'View more', 'lsx-activities' ); ?></a> |
||||
324 | <?php endif; ?> |
||||
325 | <?php } |
||||
0 ignored issues
–
show
|
|||||
326 | } |
||||
0 ignored issues
–
show
|
|||||
327 | |||||
328 | /** |
||||
329 | * Adds the template tags fast facts |
||||
330 | */ |
||||
331 | public function single_fast_facts() { |
||||
332 | if ( is_singular( 'activity' ) ) { ?> |
||||
0 ignored issues
–
show
|
|||||
333 | <section id="fast-facts"> |
||||
334 | <div class="lsx-to-section-inner"> |
||||
335 | <h3 class="lsx-to-section-title"><?php esc_html_e( 'Activity Summary', 'lsx-activities' ); ?></h3> |
||||
336 | |||||
337 | <div class="lsx-to-single-meta-data"> |
||||
338 | <?php |
||||
339 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
||||
340 | |||||
341 | // lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
42% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||||
342 | lsx_to_accommodation_activity_friendly( '<span class="' . $meta_class . 'friendly"><span class="lsx-to-meta-data-key">' . __( 'Friendly', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
343 | lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
344 | lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
345 | lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
||||
346 | ?> |
||||
347 | </div> |
||||
348 | </div> |
||||
349 | </section> |
||||
350 | <?php } |
||||
0 ignored issues
–
show
|
|||||
351 | } |
||||
0 ignored issues
–
show
|
|||||
352 | |||||
353 | /** |
||||
354 | * Adds the template tags to the bottom of the single activity |
||||
355 | */ |
||||
356 | public function single_content_bottom() { |
||||
357 | if ( is_singular( 'activity' ) ) { |
||||
0 ignored issues
–
show
|
|||||
358 | if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) : ?> |
||||
0 ignored issues
–
show
|
|||||
359 | <section id="activity-map" class="lsx-to-section lsx-to-collapse-section"> |
||||
360 | <h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title hidden-lg" data-toggle="collapse" data-target="#collapse-activity-map"><?php esc_html_e( 'Map', 'lsx-activities' ); ?></h2> |
||||
361 | |||||
362 | <div id="collapse-activity-map" class="collapse in"> |
||||
363 | <div class="collapse-inner"> |
||||
364 | <?php lsx_to_map(); ?> |
||||
365 | </div> |
||||
366 | </div> |
||||
367 | </section> |
||||
368 | <?php |
||||
369 | endif; |
||||
370 | |||||
371 | lsx_to_activity_tours(); |
||||
372 | |||||
373 | lsx_to_activity_accommodation(); |
||||
374 | |||||
375 | lsx_to_gallery( '<section id="gallery" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-gallery">' . esc_html__( 'Gallery', 'lsx-activities' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
||||
376 | |||||
377 | if ( function_exists( 'lsx_to_videos' ) ) { |
||||
0 ignored issues
–
show
|
|||||
378 | lsx_to_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'lsx-activities' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
||||
379 | } elseif ( class_exists( 'Envira_Videos' ) ) { |
||||
0 ignored issues
–
show
|
|||||
380 | lsx_to_envira_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'lsx-activities' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
||||
381 | } |
||||
382 | |||||
383 | lsx_to_activity_posts(); |
||||
384 | } |
||||
385 | } |
||||
0 ignored issues
–
show
|
|||||
386 | |||||
387 | } |
||||
388 | |||||
389 | new LSX_Activities_Frontend(); |
||||
390 |