lsx_vehicle_features()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 18
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 18
nc 4
nop 0
dl 0
loc 18
rs 9.6666
c 1
b 0
f 0
1
<?php
2
/**
3
 * Template Tags
4
 *
5
 * @package   LSX_Vehicles
6
 * @license   GPL-2.0+
7
 */
8
9
/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$slug" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$name" missing
Loading history...
10
 * Find the content part in the plugin
11
 *
12
 * @package     to-vehicles
13
 * @subpackage  template-tag
14
 * @category    content
15
 */
16
function lsx_vehicle_content( $slug, $name = null ) {
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
17
	do_action( 'lsx_vehicle_content', $slug, $name );
18
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
19
20
/* ================  VEHICLES =========================== */
21
/**
0 ignored issues
show
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...
Coding Style Documentation introduced by
Doc comment for parameter "$echo" missing
Loading history...
22
 * Outputs the current vehicles code.
23
 *
24
 * @param       $before | string
0 ignored issues
show
Documentation Bug introduced by
The doc comment | string at position 0 could not be parsed: Unknown type name '|' at position 0 in | string.
Loading history...
Coding Style introduced by
Missing parameter name
Loading history...
25
 * @param       $after  | string
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
26
 * @param       $echo   | boolean
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
27
 * @return      string
0 ignored issues
show
Coding Style introduced by
Function return type is not void, but function has no return statement
Loading history...
28
 *
29
 * @package     lsx-tour-operators
30
 * @subpackage  template-tags
31
 * @category    vehicle
32
 */
33
function lsx_vehicle_code( $before = '', $after = '', $echo = true ) {
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
34
	lsx_to_custom_field_query( 'code', $before, $after, $echo );
35
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
36
/**
0 ignored issues
show
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...
Coding Style Documentation introduced by
Doc comment for parameter "$echo" missing
Loading history...
37
 * Outputs the current vehicles vehicle_type.
38
 *
39
 * @param       $before | string
0 ignored issues
show
Documentation Bug introduced by
The doc comment | string at position 0 could not be parsed: Unknown type name '|' at position 0 in | string.
Loading history...
Coding Style introduced by
Missing parameter name
Loading history...
40
 * @param       $after  | string
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
41
 * @param       $echo   | boolean
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
42
 * @return      string
0 ignored issues
show
Coding Style introduced by
Function return type is not void, but function has no return statement
Loading history...
43
 *
44
 * @package     lsx-tour-operators
45
 * @subpackage  template-tags
46
 * @category    vehicle
47
 */
48
function lsx_vehicle_type( $before = '', $after = '', $echo = true ) {
49
	lsx_to_custom_field_query( 'vehicle_type', $before, $after, $echo );
50
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
51
/**
0 ignored issues
show
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...
Coding Style Documentation introduced by
Doc comment for parameter "$echo" missing
Loading history...
52
 * Outputs the current vehicles price.
53
 *
54
 * @param       $before | string
0 ignored issues
show
Documentation Bug introduced by
The doc comment | string at position 0 could not be parsed: Unknown type name '|' at position 0 in | string.
Loading history...
Coding Style introduced by
Missing parameter name
Loading history...
55
 * @param       $after  | string
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
56
 * @param       $echo   | boolean
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
57
 * @return      string
0 ignored issues
show
Coding Style introduced by
Function return type is not void, but function has no return statement
Loading history...
58
 *
59
 * @package     lsx-tour-operators
60
 * @subpackage  template-tags
61
 * @category    vehicle
62
 */
63
function lsx_vehicle_price( $before = '', $after = '', $echo = true ) {
64
	lsx_to_custom_field_query( 'price', $before, $after, $echo );
65
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
66
/**
0 ignored issues
show
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...
Coding Style Documentation introduced by
Doc comment for parameter "$echo" missing
Loading history...
67
 * Outputs the current vehicles engine_type.
68
 *
69
 * @param       $before | string
0 ignored issues
show
Documentation Bug introduced by
The doc comment | string at position 0 could not be parsed: Unknown type name '|' at position 0 in | string.
Loading history...
Coding Style introduced by
Missing parameter name
Loading history...
70
 * @param       $after  | string
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
71
 * @param       $echo   | boolean
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
72
 * @return      string
0 ignored issues
show
Coding Style introduced by
Function return type is not void, but function has no return statement
Loading history...
73
 *
74
 * @package     lsx-tour-operators
75
 * @subpackage  template-tags
76
 * @category    vehicle
77
 */
78
function lsx_vehicle_engine_type( $before = '', $after = '', $echo = true ) {
79
	lsx_to_custom_field_query( 'engine_type', $before, $after, $echo );
80
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
81
/**
0 ignored issues
show
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...
Coding Style Documentation introduced by
Doc comment for parameter "$echo" missing
Loading history...
82
 * Outputs the current vehicles gearbox.
83
 *
84
 * @param       $before | string
0 ignored issues
show
Documentation Bug introduced by
The doc comment | string at position 0 could not be parsed: Unknown type name '|' at position 0 in | string.
Loading history...
Coding Style introduced by
Missing parameter name
Loading history...
85
 * @param       $after  | string
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
86
 * @param       $echo   | boolean
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
87
 * @return      string
0 ignored issues
show
Coding Style introduced by
Function return type is not void, but function has no return statement
Loading history...
88
 *
89
 * @package     lsx-tour-operators
90
 * @subpackage  template-tags
91
 * @category    vehicle
92
 */
93
function lsx_vehicle_gearbox( $before = '', $after = '', $echo = true ) {
94
	lsx_to_custom_field_query( 'gearbox', $before, $after, $echo );
95
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
96
/**
0 ignored issues
show
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...
Coding Style Documentation introduced by
Doc comment for parameter "$echo" missing
Loading history...
97
 * Outputs the current vehicles engine_size.
98
 *
99
 * @param       $before | string
0 ignored issues
show
Documentation Bug introduced by
The doc comment | string at position 0 could not be parsed: Unknown type name '|' at position 0 in | string.
Loading history...
Coding Style introduced by
Missing parameter name
Loading history...
100
 * @param       $after  | string
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
101
 * @param       $echo   | boolean
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
102
 * @return      string
0 ignored issues
show
Coding Style introduced by
Function return type is not void, but function has no return statement
Loading history...
103
 *
104
 * @package     lsx-tour-operators
105
 * @subpackage  template-tags
106
 * @category    vehicle
107
 */
108
function lsx_vehicle_engine_size( $before = '', $after = '', $echo = true ) {
109
	lsx_to_custom_field_query( 'engine_size', $before, $after, $echo );
110
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
111
/**
0 ignored issues
show
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...
Coding Style Documentation introduced by
Doc comment for parameter "$echo" missing
Loading history...
112
 * Outputs the current vehicles gears.
113
 *
114
 * @param       $before | string
0 ignored issues
show
Documentation Bug introduced by
The doc comment | string at position 0 could not be parsed: Unknown type name '|' at position 0 in | string.
Loading history...
Coding Style introduced by
Missing parameter name
Loading history...
115
 * @param       $after  | string
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
116
 * @param       $echo   | boolean
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
117
 * @return      string
0 ignored issues
show
Coding Style introduced by
Function return type is not void, but function has no return statement
Loading history...
118
 *
119
 * @package     lsx-tour-operators
120
 * @subpackage  template-tags
121
 * @category    vehicle
122
 */
123
function lsx_vehicle_gears( $before = '', $after = '', $echo = true ) {
124
	lsx_to_custom_field_query( 'gears', $before, $after, $echo );
125
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
126
/**
0 ignored issues
show
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...
Coding Style Documentation introduced by
Doc comment for parameter "$echo" missing
Loading history...
127
 * Outputs the current vehicles seating.
128
 *
129
 * @param       $before | string
0 ignored issues
show
Documentation Bug introduced by
The doc comment | string at position 0 could not be parsed: Unknown type name '|' at position 0 in | string.
Loading history...
Coding Style introduced by
Missing parameter name
Loading history...
130
 * @param       $after  | string
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
131
 * @param       $echo   | boolean
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
132
 * @return      string
0 ignored issues
show
Coding Style introduced by
Function return type is not void, but function has no return statement
Loading history...
133
 *
134
 * @package     lsx-tour-operators
135
 * @subpackage  template-tags
136
 * @category    vehicle
137
 */
138
function lsx_vehicle_seating( $before = '', $after = '', $echo = true ) {
139
	lsx_to_custom_field_query( 'seating', $before, $after, $echo );
140
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
141
142
/**
143
 * Checks if the current vehicle has featured
144
 * @return      string
0 ignored issues
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
145
 *
146
 * @package     lsx-tour-operators
147
 * @subpackage  template-tags
148
 * @category    vehicle
149
 */
150
function lsx_has_vehicle_features() {
151
	return lsx_to_has_custom_field_query( 'features', get_the_ID() );
152
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
153
/**
154
 * Outputs the Vehicles Custom Fields on the Single Vehicle Templates
155
 *
156
 * @package     lsx-tour-operators
157
 * @subpackage  template-tags
158
 * @category    vehicle
159
 */
160
function lsx_vehicle_features() {
161
	if ( is_singular( 'vehicle' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
162
		$features = lsx_to_custom_field_query( 'features', '', '', false );
163
		if ( null !== $features ) { ?>
0 ignored issues
show
introduced by
The condition null !== $features is always true.
Loading history...
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
164
			<section id="features">
165
				<div class="row">						
166
					<?php if ( null !== $features ) { ?>
0 ignored issues
show
introduced by
The condition null !== $features is always true.
Loading history...
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
167
						<div class=" col-sm-12">
168
							<h3 class="section-title"><?php esc_html_e( 'Features', 'to-vehicles' ); ?></h3>
169
							<div class="entry-content">
170
								<?php
171
									$the_feature = apply_filters( 'the_content', $features );
172
								?>
173
								<?php echo wp_kses_post( $the_feature ); ?>
174
							</div>
175
						</div>
176
					<?php } ?>
177
				</div>
178
			</section>
179
			<?php
180
		}
181
	}
182
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
183
184
/**
185
 * Outputs the connected accommodation for a vehicle
186
 *
187
 * @package     lsx-tour-operators
188
 * @subpackage  template-tags
189
 * @category    vehicle
190
 */
191
function lsx_vehicle_accommodation() {
192
	global $lsx_archive;
193
	if ( post_type_exists( 'accommodation' ) && is_singular( 'vehicle' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
194
		$args = array(
195
			'from'   => 'accommodation',
196
			'to'     => 'vehicle',
197
			'column' => '3',
198
			'before' => '<section id="accommodation"><h2 class="section-title">' . lsx_to_get_post_type_section_title( 'accommodation', '', 'Featured Accommodations' ) . '</h2>',
199
			'after'  => '</section>',
200
		);
201
		lsx_to_connected_panel_query( $args );
202
	}
203
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
204
205
/**
206
 * Outputs the connected vehicles for a destination
207
 *
208
 * @package 	lsx-tour-operators
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
209
 * @subpackage	template-tags
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
210
 * @category 	vehicle
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
211
 */
212
function lsx_to_destination_vehicles() {
213
	global $lsx_archive;
214
215
	if ( post_type_exists( 'vehicle' ) && is_singular( 'destination' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
216
		$args = array(
217
			'from'		=> 'vehicle',
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
introduced by
Array double arrow not aligned correctly; expected 3 space(s) between "'from'" and double arrow, but found 6.
Loading history...
218
			'to'		=> 'destination',
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
introduced by
Array double arrow not aligned correctly; expected 5 space(s) between "'to'" and double arrow, but found 8.
Loading history...
219
			'column'	=> '3',
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
introduced by
Array double arrow not aligned correctly; expected 1 space(s) between "'column'" and double arrow, but found 4.
Loading history...
220
			'before'	=> '<section id="vehicle" 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-special">' . lsx_to_get_post_type_section_title( 'vehicle', '', __( 'Featured Vehicles', 'to-vehicles' ) ) . '</h2><div id="collapse-vehicle" class="collapse in"><div class="collapse-inner">',
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
introduced by
Array double arrow not aligned correctly; expected 1 space(s) between "'before'" and double arrow, but found 4.
Loading history...
221
			'after'		=> '</div></div></section>',
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
introduced by
Array double arrow not aligned correctly; expected 2 space(s) between "'after'" and double arrow, but found 5.
Loading history...
222
		);
223
224
		lsx_to_connected_panel_query( $args );
225
	}
226
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
227
228
/**
229
 * Outputs the connected tours only a vehicle
230
 *
231
 * @package     lsx-tour-operators
232
 * @subpackage  template-tags
233
 * @category    vehicle
234
 */
235
function lsx_vehicle_tours() {
236
	global $lsx_archive;
237
	if ( post_type_exists( 'tour' ) && is_singular( 'vehicle' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
238
		$args = array(
239
			'from'   => 'tour',
240
			'to'     => 'vehicle',
241
			'column' => '3',
242
			'before' => '<section id="tours"><h2 class="section-title">' . lsx_to_get_post_type_section_title( 'tour', '', 'Featured Tours' ) . '</h2>',
243
			'after'  => '</section>',
244
		);
245
		lsx_to_connected_panel_query( $args );
246
	}
247
}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
248