1 | <?php |
||||
2 | /** |
||||
3 | * LSX_TO_Team_Frontend |
||||
4 | * |
||||
5 | * @package LSX_TO_Team_Frontend |
||||
6 | * @author LightSpeed |
||||
7 | * @license GPL-2.0+ |
||||
8 | * @link |
||||
9 | * @copyright 2017 LightSpeedDevelopment |
||||
10 | */ |
||||
11 | |||||
12 | /** |
||||
13 | * Main plugin class. |
||||
14 | * |
||||
15 | * @package LSX_TO_Team_Frontend |
||||
16 | * @author LightSpeed |
||||
17 | */ |
||||
18 | class LSX_TO_Team_Frontend extends LSX_TO_Team { |
||||
19 | |||||
20 | /** |
||||
21 | * Holds the $page_links array while its being built on the single team page. |
||||
22 | * |
||||
23 | * @var array |
||||
24 | */ |
||||
25 | public $page_links = false; |
||||
26 | |||||
27 | /** |
||||
28 | * Holds the array of options. |
||||
29 | * |
||||
30 | * @var array |
||||
31 | */ |
||||
32 | public $options = false; |
||||
33 | |||||
34 | /** |
||||
35 | * Constructor |
||||
36 | */ |
||||
37 | public function __construct() { |
||||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||||
38 | $this->options = get_option( '_lsx-to_settings', false ); |
||||
0 ignored issues
–
show
It seems like
get_option('_lsx-to_settings', false) can also be of type false . However, the property $options is declared as type array . Maybe add an additional type check?
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly. For example, imagine you have a variable Either this assignment is in error or a type check should be added for that assignment. class Id
{
public $id;
public function __construct($id)
{
$this->id = $id;
}
}
class Account
{
/** @var Id $id */
public $id;
}
$account_id = false;
if (starsAreRight()) {
$account_id = new Id(42);
}
$account = new Account();
if ($account instanceof Id)
{
$account->id = $account_id;
}
![]() |
|||||
39 | |||||
40 | add_action( 'wp_head', array( $this, 'change_single_team_layout' ), 20, 1 ); |
||||
41 | |||||
42 | if ( ! is_admin() ) { |
||||
0 ignored issues
–
show
|
|||||
43 | add_filter( 'posts_orderby', array( $this, 'enable_role_taxonomy_order' ), 10, 2 ); |
||||
44 | } |
||||
45 | |||||
46 | add_filter( 'lsx_to_archive_class', array( $this, 'archive_class' ), 10, 3 ); |
||||
47 | add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); |
||||
48 | add_action( 'lsx_to_settings_current_tab', array( $this, 'set_settings_current_tab' ) ); |
||||
49 | |||||
50 | if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { |
||||
0 ignored issues
–
show
|
|||||
51 | require_once( LSX_TO_TEAM_PATH . 'classes/class-lsx-to-template-redirects.php' ); |
||||
0 ignored issues
–
show
|
|||||
52 | } |
||||
53 | |||||
54 | $this->redirects = new LSX_TO_Template_Redirects( LSX_TO_TEAM_PATH, array( 'team' ), array( 'role' ) ); |
||||
0 ignored issues
–
show
|
|||||
55 | |||||
56 | add_action( 'lsx_to_team_content', array( $this->redirects, 'content_part' ), 10, 2 ); |
||||
57 | |||||
58 | add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); |
||||
59 | |||||
60 | add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); |
||||
61 | add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); |
||||
62 | add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); |
||||
63 | |||||
64 | add_filter( 'lsx_to_maps_args', array( $this, 'lsx_to_maps_args' ), 10, 2 ); |
||||
65 | add_filter( 'lsx_to_has_maps_location', array( $this, 'lsx_to_has_maps_location' ), 50, 2 ); |
||||
66 | } |
||||
0 ignored issues
–
show
|
|||||
67 | |||||
68 | /** |
||||
69 | * Change single team layout. |
||||
70 | */ |
||||
71 | public function change_single_team_layout() { |
||||
72 | global $lsx_to_archive; |
||||
73 | |||||
74 | if ( is_singular( 'team' ) && 1 !== $lsx_to_archive ) { |
||||
0 ignored issues
–
show
|
|||||
75 | remove_action( 'lsx_entry_bottom', 'lsx_to_single_entry_bottom' ); |
||||
76 | add_action( 'lsx_entry_top', array( $this, 'lsx_to_single_entry_bottom' ) ); |
||||
77 | } |
||||
78 | } |
||||
0 ignored issues
–
show
|
|||||
79 | |||||
80 | /** |
||||
81 | * Change single team layout. |
||||
82 | */ |
||||
83 | public function lsx_to_single_entry_bottom() { |
||||
84 | if ( is_singular( 'team' ) ) { ?> |
||||
0 ignored issues
–
show
|
|||||
85 | <div class="col-xs-12 col-sm-5 col-md-4"> |
||||
86 | <figure class="lsx-to-team-thumb"> |
||||
87 | <?php lsx_thumbnail( 'lsx-thumbnail-square' ); ?> |
||||
88 | </figure> |
||||
89 | |||||
90 | <?php |
||||
91 | lsx_to_team_social_profiles( '<span class="lsx-to-team-socials-header">' . esc_html__( 'Follow', 'to-team' ) . ':</span><div class="lsx-to-team-socials">', '</div>' ); |
||||
92 | lsx_to_enquire_modal( esc_html__( 'Get in touch', 'to-team' ) ); |
||||
93 | ?> |
||||
94 | </div> |
||||
95 | <?php |
||||
96 | } |
||||
97 | } |
||||
0 ignored issues
–
show
|
|||||
98 | |||||
99 | /** |
||||
0 ignored issues
–
show
|
|||||
100 | * Enable role taxonomy order. |
||||
101 | */ |
||||
102 | public function enable_role_taxonomy_order( $orderby, $query ) { |
||||
103 | global $wpdb; |
||||
104 | |||||
105 | if ( $query->is_main_query() && $query->is_post_type_archive( 'team' ) ) { |
||||
0 ignored issues
–
show
|
|||||
106 | if ( isset( $this->options['team'] ) && isset( $this->options['team']['group_items_by_role'] ) ) { |
||||
0 ignored issues
–
show
|
|||||
107 | $new_orderby = "( |
||||
108 | SELECT GROUP_CONCAT(lsx_to_term_order ORDER BY lsx_to_term_order ASC) |
||||
109 | FROM $wpdb->term_relationships |
||||
110 | INNER JOIN $wpdb->term_taxonomy USING (term_taxonomy_id) |
||||
111 | INNER JOIN $wpdb->terms USING (term_id) |
||||
112 | WHERE $wpdb->posts.ID = object_id |
||||
113 | AND taxonomy = 'role' |
||||
114 | GROUP BY object_id |
||||
115 | ) "; |
||||
116 | |||||
117 | $new_orderby .= ( 'ASC' == strtoupper( $query->get( 'order' ) ) ) ? 'ASC' : 'DESC'; |
||||
0 ignored issues
–
show
|
|||||
118 | $orderby = $new_orderby . ', ' . $orderby; |
||||
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. ![]() |
|||||
119 | } |
||||
120 | } |
||||
121 | |||||
122 | return $orderby; |
||||
123 | } |
||||
0 ignored issues
–
show
|
|||||
124 | |||||
125 | /** |
||||
0 ignored issues
–
show
|
|||||
126 | * A filter to set the content area to a small column on single |
||||
127 | */ |
||||
128 | public function archive_class( $new_classes, $classes, $layout ) { |
||||
129 | if ( is_post_type_archive( 'team' ) ) { |
||||
0 ignored issues
–
show
|
|||||
130 | $new_classes = $classes; |
||||
131 | |||||
132 | if ( 'grid' === $layout ) { |
||||
0 ignored issues
–
show
|
|||||
133 | $new_classes[] = 'col-xs-12 col-sm-6 col-md-3'; |
||||
134 | } else { |
||||
135 | $new_classes[] = 'col-xs-12'; |
||||
136 | } |
||||
137 | } |
||||
138 | |||||
139 | return $new_classes; |
||||
140 | } |
||||
0 ignored issues
–
show
|
|||||
141 | |||||
142 | /** |
||||
0 ignored issues
–
show
|
|||||
143 | * A filter to set the content area to a small column on single |
||||
144 | */ |
||||
145 | public function entry_class( $classes ) { |
||||
146 | global $lsx_to_archive; |
||||
147 | |||||
148 | if ( 1 !== $lsx_to_archive ) { |
||||
0 ignored issues
–
show
|
|||||
149 | $lsx_to_archive = false; |
||||
150 | } |
||||
151 | |||||
152 | if ( is_main_query() && is_singular( 'team' ) && false === $lsx_to_archive ) { |
||||
0 ignored issues
–
show
|
|||||
153 | if ( lsx_to_has_enquiry_contact() ) { |
||||
0 ignored issues
–
show
|
|||||
154 | $classes[] = 'col-xs-12 col-sm-7 col-md-8'; |
||||
155 | } else { |
||||
156 | $classes[] = 'col-xs-12'; |
||||
157 | } |
||||
158 | } |
||||
159 | |||||
160 | return $classes; |
||||
161 | } |
||||
0 ignored issues
–
show
|
|||||
162 | |||||
163 | /** |
||||
0 ignored issues
–
show
|
|||||
164 | * Sets the current tab selected. |
||||
165 | */ |
||||
166 | public function set_settings_current_tab( $settings_tab ) { |
||||
167 | if ( is_tax( 'role' ) ) { |
||||
0 ignored issues
–
show
|
|||||
168 | $taxonomy = get_query_var( 'taxonomy' ); |
||||
169 | |||||
170 | if ( 'role' === $taxonomy ) { |
||||
0 ignored issues
–
show
|
|||||
171 | $settings_tab = 'team'; |
||||
172 | } |
||||
173 | } |
||||
174 | |||||
175 | return $settings_tab; |
||||
176 | } |
||||
0 ignored issues
–
show
|
|||||
177 | |||||
178 | /** |
||||
0 ignored issues
–
show
|
|||||
179 | * Adds our navigation links to the team single post |
||||
180 | * |
||||
181 | * @param $page_links array |
||||
0 ignored issues
–
show
|
|||||
182 | * @return $page_links array |
||||
0 ignored issues
–
show
|
|||||
183 | */ |
||||
184 | public function page_links( $page_links ) { |
||||
185 | if ( is_singular( 'team' ) ) { |
||||
0 ignored issues
–
show
|
|||||
186 | $this->page_links = $page_links; |
||||
187 | |||||
188 | $this->get_map_link(); |
||||
189 | |||||
190 | $this->get_related_posts_link(); |
||||
191 | $this->get_related_accommodation_link(); |
||||
192 | $this->get_related_destination_link(); |
||||
193 | $this->get_related_tours_link(); |
||||
194 | $this->get_related_reviews_link(); |
||||
195 | |||||
196 | $this->get_gallery_link(); |
||||
197 | $this->get_videos_link(); |
||||
198 | |||||
199 | $page_links = $this->page_links; |
||||
200 | } |
||||
201 | |||||
202 | return $page_links; |
||||
203 | } |
||||
0 ignored issues
–
show
|
|||||
204 | |||||
205 | /** |
||||
206 | * Tests for the Related Posts and returns a link for the section |
||||
207 | */ |
||||
208 | public function get_related_posts_link() { |
||||
209 | $site_user = get_post_meta( get_the_ID(), 'site_user', 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
![]() |
|||||
210 | |||||
211 | if ( ! empty( $site_user ) ) { |
||||
0 ignored issues
–
show
|
|||||
212 | if ( is_user_member_of_blog( $site_user ) ) { |
||||
0 ignored issues
–
show
It seems like
$site_user can also be of type string ; however, parameter $user_id of is_user_member_of_blog() 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
![]() |
|||||
213 | $user_posts = count_user_posts( $site_user, 'post' ); |
||||
0 ignored issues
–
show
It seems like
$site_user can also be of type string ; however, parameter $userid of count_user_posts() 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
![]() |
|||||
214 | |||||
215 | if ( $user_posts > 0 ) { |
||||
0 ignored issues
–
show
|
|||||
216 | $this->page_links['posts'] = esc_html__( 'Posts', 'to-team' ); |
||||
217 | } |
||||
218 | } |
||||
219 | } |
||||
220 | } |
||||
0 ignored issues
–
show
|
|||||
221 | |||||
222 | /** |
||||
223 | * Tests for the Google Map and returns a link for the section |
||||
224 | */ |
||||
225 | public function get_map_link() { |
||||
226 | if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) { |
||||
0 ignored issues
–
show
|
|||||
227 | $this->page_links['team-map'] = esc_html__( 'Map', 'tour-operator' ); |
||||
228 | } |
||||
229 | } |
||||
0 ignored issues
–
show
|
|||||
230 | |||||
231 | /** |
||||
232 | * Tests for the Related Accommodation and returns a link for the section |
||||
233 | */ |
||||
234 | public function get_related_accommodation_link() { |
||||
235 | $connected_accommodation = get_post_meta( get_the_ID(), 'accommodation_to_team', 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
![]() |
|||||
236 | |||||
237 | if ( post_type_exists( 'accommodation' ) && is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { |
||||
0 ignored issues
–
show
|
|||||
238 | $connected_accommodation = new \WP_Query( array( |
||||
0 ignored issues
–
show
|
|||||
239 | 'post_type' => 'accommodation', |
||||
0 ignored issues
–
show
|
|||||
240 | 'post__in' => $connected_accommodation, |
||||
0 ignored issues
–
show
|
|||||
241 | 'post_status' => 'publish', |
||||
0 ignored issues
–
show
|
|||||
242 | 'nopagin' => true, |
||||
0 ignored issues
–
show
|
|||||
243 | 'posts_per_page' => '-1', |
||||
244 | 'fields' => 'ids', |
||||
0 ignored issues
–
show
|
|||||
245 | ) ); |
||||
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.
![]() |
|||||
246 | |||||
247 | $connected_accommodation = $connected_accommodation->posts; |
||||
248 | |||||
249 | if ( is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { |
||||
0 ignored issues
–
show
|
|||||
250 | $this->page_links['accommodation'] = esc_html__( 'Accommodation', 'to-team' ); |
||||
251 | } |
||||
252 | } |
||||
253 | } |
||||
0 ignored issues
–
show
|
|||||
254 | |||||
255 | /** |
||||
256 | * Tests for the Related Destinations and returns a link for the section |
||||
257 | */ |
||||
258 | public function get_related_destination_link() { |
||||
259 | $connected_destination = get_post_meta( get_the_ID(), 'destination_to_team', 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
![]() |
|||||
260 | |||||
261 | if ( post_type_exists( 'destination' ) && is_array( $connected_destination ) && ! empty( $connected_destination ) ) { |
||||
0 ignored issues
–
show
|
|||||
262 | $connected_destination = new \WP_Query( array( |
||||
0 ignored issues
–
show
|
|||||
263 | 'post_type' => 'destination', |
||||
0 ignored issues
–
show
|
|||||
264 | 'post__in' => $connected_destination, |
||||
0 ignored issues
–
show
|
|||||
265 | 'post_status' => 'publish', |
||||
0 ignored issues
–
show
|
|||||
266 | 'nopagin' => true, |
||||
0 ignored issues
–
show
|
|||||
267 | 'posts_per_page' => '-1', |
||||
268 | 'fields' => 'ids', |
||||
0 ignored issues
–
show
|
|||||
269 | ) ); |
||||
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.
![]() |
|||||
270 | |||||
271 | $connected_destination = $connected_destination->posts; |
||||
272 | |||||
273 | if ( is_array( $connected_destination ) && ! empty( $connected_destination ) ) { |
||||
0 ignored issues
–
show
|
|||||
274 | $this->page_links['destination'] = esc_html__( 'Destinations', 'to-team' ); |
||||
275 | } |
||||
276 | } |
||||
277 | } |
||||
0 ignored issues
–
show
|
|||||
278 | |||||
279 | /** |
||||
280 | * Tests for the Related Tours and returns a link for the section |
||||
281 | */ |
||||
282 | public function get_related_tours_link() { |
||||
283 | $connected_tours = get_post_meta( get_the_ID(), 'tour_to_team', 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
![]() |
|||||
284 | |||||
285 | if ( post_type_exists( 'tour' ) && is_array( $connected_tours ) && ! empty( $connected_tours ) ) { |
||||
0 ignored issues
–
show
|
|||||
286 | $connected_tours = new \WP_Query( array( |
||||
0 ignored issues
–
show
|
|||||
287 | 'post_type' => 'tour', |
||||
0 ignored issues
–
show
|
|||||
288 | 'post__in' => $connected_tours, |
||||
0 ignored issues
–
show
|
|||||
289 | 'post_status' => 'publish', |
||||
0 ignored issues
–
show
|
|||||
290 | 'nopagin' => true, |
||||
0 ignored issues
–
show
|
|||||
291 | 'posts_per_page' => '-1', |
||||
292 | 'fields' => 'ids', |
||||
0 ignored issues
–
show
|
|||||
293 | ) ); |
||||
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.
![]() |
|||||
294 | |||||
295 | $connected_tours = $connected_tours->posts; |
||||
296 | |||||
297 | if ( is_array( $connected_tours ) && ! empty( $connected_tours ) ) { |
||||
0 ignored issues
–
show
|
|||||
298 | $this->page_links['tours'] = esc_html__( 'Tours', 'to-team' ); |
||||
299 | } |
||||
300 | } |
||||
301 | } |
||||
0 ignored issues
–
show
|
|||||
302 | |||||
303 | /** |
||||
304 | * Tests for the Related Tours and returns a link for the section |
||||
305 | */ |
||||
306 | public function get_related_reviews_link() { |
||||
307 | $connected_reviews = get_post_meta( get_the_ID(), 'review_to_team', 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
![]() |
|||||
308 | |||||
309 | if ( post_type_exists( 'review' ) && is_array( $connected_reviews ) && ! empty( $connected_reviews ) ) { |
||||
0 ignored issues
–
show
|
|||||
310 | $connected_reviews = new \WP_Query( array( |
||||
0 ignored issues
–
show
|
|||||
311 | 'post_type' => 'review', |
||||
0 ignored issues
–
show
|
|||||
312 | 'post__in' => $connected_reviews, |
||||
0 ignored issues
–
show
|
|||||
313 | 'post_status' => 'publish', |
||||
0 ignored issues
–
show
|
|||||
314 | 'nopagin' => true, |
||||
0 ignored issues
–
show
|
|||||
315 | 'posts_per_page' => '-1', |
||||
316 | 'fields' => 'ids', |
||||
0 ignored issues
–
show
|
|||||
317 | ) ); |
||||
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.
![]() |
|||||
318 | |||||
319 | $connected_reviews = $connected_reviews->posts; |
||||
320 | |||||
321 | if ( is_array( $connected_reviews ) && ! empty( $connected_reviews ) ) { |
||||
0 ignored issues
–
show
|
|||||
322 | $this->page_links['reviews'] = esc_html__( 'Reviews', 'to-team' ); |
||||
323 | } |
||||
324 | } |
||||
325 | } |
||||
0 ignored issues
–
show
|
|||||
326 | |||||
327 | /** |
||||
328 | * Tests for the Gallery and returns a link for the section |
||||
329 | */ |
||||
330 | public function get_gallery_link() { |
||||
331 | $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. ![]() |
|||||
332 | $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); |
||||
333 | |||||
334 | 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
|
|||||
335 | if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { |
||||
0 ignored issues
–
show
|
|||||
336 | // Envira Gallery. |
||||
337 | $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-team' ); |
||||
338 | return; |
||||
339 | } else { |
||||
340 | if ( function_exists( 'envira_dynamic' ) ) { |
||||
0 ignored issues
–
show
|
|||||
341 | // Envira Gallery - Dynamic. |
||||
342 | $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-team' ); |
||||
343 | return; |
||||
344 | } else { |
||||
345 | // WordPress Gallery. |
||||
346 | $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-team' ); |
||||
347 | return; |
||||
348 | } |
||||
349 | } |
||||
350 | } |
||||
351 | } |
||||
0 ignored issues
–
show
|
|||||
352 | |||||
353 | /** |
||||
354 | * Tests for the Videos and returns a link for the section |
||||
355 | */ |
||||
356 | public function get_videos_link() { |
||||
357 | $videos_id = false; |
||||
358 | |||||
359 | if ( class_exists( 'Envira_Videos' ) ) { |
||||
0 ignored issues
–
show
|
|||||
360 | $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
![]() |
|||||
361 | } |
||||
362 | |||||
363 | if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { |
||||
0 ignored issues
–
show
|
|||||
364 | $videos_id = get_post_meta( get_the_ID(), 'videos', true ); |
||||
365 | } |
||||
366 | |||||
367 | if ( ! empty( $videos_id ) ) { |
||||
0 ignored issues
–
show
|
|||||
368 | $this->page_links['videos'] = esc_html__( 'Videos', 'to-team' ); |
||||
369 | } |
||||
370 | } |
||||
0 ignored issues
–
show
|
|||||
371 | |||||
372 | /** |
||||
373 | * Adds the template tags to the top of the archive team |
||||
374 | */ |
||||
375 | public function archive_entry_top() { |
||||
376 | global $lsx_to_archive; |
||||
377 | |||||
378 | if ( 'team' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { |
||||
0 ignored issues
–
show
|
|||||
379 | ?> |
||||
380 | <?php if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> |
||||
0 ignored issues
–
show
|
|||||
381 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-grid-mode"> |
||||
382 | <?php |
||||
383 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
||||
384 | |||||
385 | lsx_to_team_role( '<span class="' . $meta_class . 'role"><span class="lsx-to-meta-data-key">' . __( 'Role', 'to-team' ) . ':</span> ', '</span>' ); |
||||
386 | lsx_to_team_contact_number( '<span class="' . $meta_class . 'phone">', '</span>' ); |
||||
387 | lsx_to_team_contact_email( '<span class="' . $meta_class . 'email">', '</span>' ); |
||||
388 | lsx_to_team_contact_skype( '<span class="' . $meta_class . 'skype">', '</span>' ); |
||||
389 | lsx_to_team_social_profiles( '<div class="' . $meta_class . 'socials">', '</div>' ); |
||||
390 | ?> |
||||
391 | </div> |
||||
392 | <?php } ?> |
||||
393 | <?php |
||||
394 | } |
||||
395 | } |
||||
0 ignored issues
–
show
|
|||||
396 | |||||
397 | /** |
||||
398 | * Adds the template tags to the bottom of the archive team |
||||
399 | */ |
||||
400 | public function archive_entry_bottom() { |
||||
401 | global $lsx_to_archive; |
||||
402 | |||||
403 | if ( 'team' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { |
||||
0 ignored issues
–
show
|
|||||
404 | ?> |
||||
405 | </div> |
||||
406 | |||||
407 | <?php if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> |
||||
0 ignored issues
–
show
|
|||||
408 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-list-mode"> |
||||
409 | <?php |
||||
410 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
||||
411 | |||||
412 | lsx_to_team_role( '<span class="' . $meta_class . 'role"><span class="lsx-to-meta-data-key">' . __( 'Role', 'to-team' ) . ':</span> ', '</span>' ); |
||||
413 | lsx_to_team_contact_number( '<span class="' . $meta_class . 'phone">', '</span>' ); |
||||
414 | lsx_to_team_contact_email( '<span class="' . $meta_class . 'email">', '</span>' ); |
||||
415 | lsx_to_team_contact_skype( '<span class="' . $meta_class . 'skype">', '</span>' ); |
||||
416 | lsx_to_team_social_profiles( '<div class="' . $meta_class . 'socials">', '</div>' ); |
||||
417 | ?> |
||||
418 | </div> |
||||
419 | <?php } ?> |
||||
420 | |||||
421 | <?php |
||||
422 | $member_name = get_the_title(); |
||||
423 | $has_single = ! lsx_to_is_single_disabled(); |
||||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 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. ![]() |
|||||
424 | ?> |
||||
425 | |||||
426 | <?php if ( $has_single && 'grid' === tour_operator()->archive_layout ) : ?> |
||||
0 ignored issues
–
show
|
|||||
427 | <p class="text-center lsx-to-single-link"><a href="<?php the_permalink(); ?>"><?php echo esc_html__( 'More about', 'to-team' ) . ' ' . esc_html( strtok( $member_name, ' ' ) ); ?> <i class="fa fa-angle-right" aria-hidden="true"></i></a></p> |
||||
428 | <?php endif; ?> |
||||
429 | </div> |
||||
430 | <?php |
||||
431 | } |
||||
432 | } |
||||
0 ignored issues
–
show
|
|||||
433 | |||||
434 | /** |
||||
435 | * Adds the template tags to the bottom of the single team |
||||
436 | */ |
||||
437 | public function single_content_bottom() { |
||||
438 | if ( is_singular( 'team' ) ) { |
||||
0 ignored issues
–
show
|
|||||
439 | if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) : |
||||
0 ignored issues
–
show
|
|||||
440 | global $post; |
||||
441 | $map_title = $post->post_title; |
||||
442 | $map_title = $map_title . __( "'s favourite places", 'to-team' ); |
||||
443 | ?> |
||||
444 | <section id="team-map" class="lsx-to-section lsx-to-collapse-section"> |
||||
445 | <h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-team-map"><?php echo esc_html( $map_title ); ?></h2> |
||||
446 | |||||
447 | <div id="collapse-team-map" class="collapse in"> |
||||
448 | <div class="collapse-inner"> |
||||
449 | <?php lsx_to_map(); ?> |
||||
450 | </div> |
||||
451 | </div> |
||||
452 | </section> |
||||
453 | <?php |
||||
454 | endif; |
||||
455 | |||||
456 | lsx_to_team_posts(); |
||||
457 | |||||
458 | lsx_to_team_accommodation(); |
||||
459 | |||||
460 | lsx_to_team_destination(); |
||||
461 | |||||
462 | lsx_to_team_tours(); |
||||
463 | |||||
464 | lsx_to_team_reviews(); |
||||
465 | |||||
466 | 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', 'to-team' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
||||
467 | |||||
468 | if ( function_exists( 'lsx_to_videos' ) ) { |
||||
0 ignored issues
–
show
|
|||||
469 | 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', 'to-team' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
||||
470 | } elseif ( class_exists( 'Envira_Videos' ) ) { |
||||
0 ignored issues
–
show
|
|||||
471 | 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', 'to-team' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
||||
472 | } |
||||
473 | } |
||||
474 | } |
||||
0 ignored issues
–
show
|
|||||
475 | |||||
476 | public function lsx_to_maps_args( $args, $post_id ) { |
||||
0 ignored issues
–
show
|
|||||
477 | if ( is_singular( 'team' ) ) { |
||||
0 ignored issues
–
show
|
|||||
478 | $accommodation_connected = get_post_meta( get_the_ID(), 'accommodation_to_team' ); |
||||
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
![]() |
|||||
479 | if ( is_array( $accommodation_connected ) && ! empty( $accommodation_connected ) ) { |
||||
0 ignored issues
–
show
|
|||||
480 | $args = array( |
||||
481 | 'lat' => true, |
||||
0 ignored issues
–
show
|
|||||
482 | 'long' => true, |
||||
0 ignored issues
–
show
|
|||||
483 | 'connections' => $accommodation_connected, |
||||
484 | 'content' => 'excerpt', |
||||
0 ignored issues
–
show
|
|||||
485 | 'type' => 'cluster', |
||||
0 ignored issues
–
show
|
|||||
486 | 'width' => '100%', |
||||
0 ignored issues
–
show
|
|||||
487 | 'height' => '500px', |
||||
0 ignored issues
–
show
|
|||||
488 | ); |
||||
489 | } |
||||
490 | } |
||||
0 ignored issues
–
show
|
|||||
491 | return $args; |
||||
492 | } |
||||
0 ignored issues
–
show
|
|||||
493 | |||||
494 | public function lsx_to_has_maps_location( $location, $id ) { |
||||
0 ignored issues
–
show
|
|||||
495 | if ( is_singular( 'team' ) ) { |
||||
0 ignored issues
–
show
|
|||||
496 | $accommodation_connected = get_post_meta( $id, 'accommodation_to_team' ); |
||||
497 | if ( is_array( $accommodation_connected ) && ! empty( $accommodation_connected ) ) { |
||||
0 ignored issues
–
show
|
|||||
498 | $location = array( |
||||
499 | 'lat' => true, |
||||
0 ignored issues
–
show
|
|||||
500 | 'connections' => $accommodation_connected, |
||||
501 | ); |
||||
502 | } |
||||
503 | } |
||||
0 ignored issues
–
show
|
|||||
504 | return $location; |
||||
505 | } |
||||
0 ignored issues
–
show
|
|||||
506 | } |
||||
507 | |||||
508 | global $lsx_to_team_frontend; |
||||
509 | $lsx_to_team_frontend = new LSX_TO_Team_Frontend(); |
||||
510 |