Issues (1030)

classes/class-lsx-activities-frontend.php (130 issues)

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
Expected 2 blank lines before function; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
37
			require_once( LSX_ACTIVITIES_PATH . 'classes/class-template-redirects.php' );
0 ignored issues
show
"require_once" is a statement not a function; no parentheses are required
Loading history...
38
		}
39
40
		$this->redirects = new LSX_TO_Template_Redirects( LSX_ACTIVITIES_PATH, array_keys( $this->post_types ) );
41
42
		add_action( 'lsx_to_activity_content', array( $this->redirects, 'content_part' ), 10 , 2 );
0 ignored issues
show
Space found before comma in argument list
Loading history...
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
Expected 1 space after comma in argument list; 6 found
Loading history...
47
		add_action( 'lsx_entry_bottom',   array( $this, 'archive_entry_bottom' ) );
0 ignored issues
show
Expected 1 space after comma in argument list; 3 found
Loading history...
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
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
57
			add_filter( 'lsx_to_custom_field_query',array( $this, 'price_filter' ),5,10 );
58
		}
59
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
60
61
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$classes" missing
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
68
			$lsx_to_archive = false;
69
		}
70
71
		if ( is_main_query() && is_singular( 'activity' ) && false === $lsx_to_archive ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
72
			$classes[] = 'col-xs-12 col-sm-12 col-md-6';
73
		}
74
75
		return $classes;
76
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
77
78
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$html" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$meta_key" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$value" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$before" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$after" missing
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
83
			$price_type = get_post_meta( get_the_ID(),'price_type',true );
0 ignored issues
show
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
90
91
			if ( is_object( $tour_operator ) && isset( $tour_operator->options['general'] ) && is_array( $tour_operator->options['general'] ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
92
				if ( isset( $tour_operator->options['general']['currency'] ) && ! empty( $tour_operator->options['general']['currency'] ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
123
124
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$page_links" missing
Loading history...
125
	 * Adds our navigation links to the activity single post
126
	 *
127
	 * @param $page_links array
0 ignored issues
show
Missing parameter name
Loading history...
128
	 * @return $page_links array
129
	 */
130
	public function page_links( $page_links ) {
131
		if ( is_singular( 'activity' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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 );
152
153
		if ( post_type_exists( 'tour' ) && is_array( $connected_tours ) && ! empty( $connected_tours ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
154
			$connected_tours = new \WP_Query( array(
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
155
				'post_type' => 'tour',
156
				'post__in' => $connected_tours,
157
				'post_status' => 'publish',
158
				'nopagin' => true,
159
				'posts_per_page' => '-1',
160
				'fields' => 'ids',
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.
Loading history...
162
163
			$connected_tours = $connected_tours->posts;
164
165
			if ( is_array( $connected_tours ) && ! empty( $connected_tours ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
166
				$this->page_links['tours'] = esc_html__( 'Tours', 'lsx-activities' );
167
			}
168
		}
169
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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 );
176
177
		if ( post_type_exists( 'accommodation' ) && is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
178
			$connected_accommodation = new \WP_Query( array(
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
179
				'post_type' => 'accommodation',
180
				'post__in' => $connected_accommodation,
181
				'post_status' => 'publish',
182
				'nopagin' => true,
183
				'posts_per_page' => '-1',
184
				'fields' => 'ids',
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.
Loading history...
186
187
			$connected_accommodation = $connected_accommodation->posts;
188
189
			if ( is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
190
				$this->page_links['accommodation'] = esc_html__( 'Accommodation', 'lsx-activities' );
191
			}
192
		}
193
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
200
			$this->page_links['activity-map'] = esc_html__( 'Map', 'lsx-activities' );
201
		}
202
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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
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.

Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
212
			if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
213
				// Envira Gallery
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
214
				$this->page_links['gallery'] = esc_html__( 'Gallery', 'lsx-activities' );
215
				return;
216
			} else {
217
				if ( function_exists( 'envira_dynamic' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
218
					// Envira Gallery - Dynamic
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
219
					$this->page_links['gallery'] = esc_html__( 'Gallery', 'lsx-activities' );
220
					return;
221
				} else {
222
					// WordPress Gallery
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
223
					$this->page_links['gallery'] = esc_html__( 'Gallery', 'lsx-activities' );
224
					return;
225
				}
226
			}
227
		}
228
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
237
			$videos_id = get_post_meta( get_the_ID(), 'envira_video', true );
238
		}
239
240
		if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
241
			$videos_id = get_post_meta( get_the_ID(), 'videos', true );
242
		}
243
244
		if ( ! empty( $videos_id ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
245
			$this->page_links['videos'] = esc_html__( 'Videos', 'lsx-activities' );
246
		}
247
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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 );
254
255
		if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
256
			$connected_posts = new \WP_Query( array(
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
257
				'post_type' => 'post',
258
				'post__in' => $connected_posts,
259
				'post_status' => 'publish',
260
				'nopagin' => true,
261
				'posts_per_page' => '-1',
262
				'fields' => 'ids',
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.
Loading history...
264
265
			$connected_posts = $connected_posts->posts;
266
267
			if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
268
				$this->page_links['posts'] = esc_html__( 'Posts', 'lsx-activities' );
269
			}
270
		}
271
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
280
			if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?>
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Opening PHP tag must be on a line by itself
Loading history...
293
		}
294
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
Closing PHP tag must be on a line by itself
Loading history...
303
				</div>
304
305
				<?php if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?>
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Opening PHP tag must be on a line by itself
Loading history...
326
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
Closing PHP tag must be on a line by itself
Loading history...
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
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
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
Opening PHP tag must be on a line by itself
Loading history...
351
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
358
			if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) : ?>
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
Closing PHP tag must be on a line by itself
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
386
387
}
388
389
new LSX_Activities_Frontend();
390