PluginProbe
Property Hive / 2.4.0
Property Hive v2.4.0
2.4.0 2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 All 262 releases
propertyhive / includes / salient-widgets / property-embedded-virtual-tours-html.php

property-embedded-virtual-tours-html.php in Property Hive 2.4.0, at includes/salient-widgets/property-embedded-virtual-tours-html.php

73 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
5 extract(shortcode_atts(array(
6 "show_title" => "yes",
7 "oembed" => "",
8 ), $atts));
9
10 global $property;
11
12 if ( !isset($property->id) ) {
13 return;
14 }
15
16 if ( isset($atts['show_title']) && $atts['show_title'] != 'yes' )
17 {
18 ?>
19 <style type="text/css">
20 .embedded-virtual-tours h4 { display:none; }
21 </style>
22 <?php
23 }
24
25 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- WPBakery html_template local variable; this file is a framework-rendered view receiving $atts/$this, and PrefixAllGlobals sees it outside the framework render scope.
26 $virtual_tours = $property->get_virtual_tours();
27
28 if ( !empty($virtual_tours) )
29 {
30 echo '<div class="embedded-virtual-tours">';
31
32 echo '<h4>' . esc_html__( 'Virtual Tours', 'propertyhive' ) . '</h4>';
33
34 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- WPBakery html_template local variable; this file is a framework-rendered view receiving $atts/$this, and PrefixAllGlobals sees it outside the framework render scope.
35 foreach ( $virtual_tours as $virtual_tour )
36 {
37 if ( isset($settings['oembed']) && $settings['oembed'] == 'yes' )
38 {
39 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- WPBakery html_template local variable; this file is a framework-rendered view receiving $atts/$this, and PrefixAllGlobals sees it outside the framework render scope.
40 $embed_code = wp_oembed_get($virtual_tour['url']);
41 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- wp_oembed_get() uses WordPress provider trust and sanitization; preserve supported provider scripts and trusted PHP filters.
42 echo $embed_code;
43 }
44 else
45 {
46 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- WPBakery html_template local variable; this file is a framework-rendered view receiving $atts/$this, and PrefixAllGlobals sees it outside the framework render scope.
47 $virtual_tour['url'] = preg_replace(
48 "/\s*[a-zA-Z\/\/:\.]*youtu(be.com\/watch\?v=|.be\/)([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i",
49 "//www.youtube.com/embed/$2",
50 $virtual_tour['url']
51 );
52
53 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- WPBakery html_template local variable; this file is a framework-rendered view receiving $atts/$this, and PrefixAllGlobals sees it outside the framework render scope.
54 $virtual_tour['url'] = preg_replace(
55 '#https?://(www\.)?youtube\.com/shorts/([^/?]+)#',
56 '//www.youtube.com/embed/$2',
57 $virtual_tour['url']
58 );
59
60 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- WPBakery html_template local variable; this file is a framework-rendered view receiving $atts/$this, and PrefixAllGlobals sees it outside the framework render scope.
61 $virtual_tour['url'] = preg_replace(
62 '/(https?:\/\/)?(www\.)?(player\.)?vimeo\.com\/?(showcase\/)*([0-9))([a-z]*\/)*([0-9]{6,11})[?]?.*/i',
63 "//player.vimeo.com/video/$6",
64 $virtual_tour['url']
65 );
66
67 echo '<iframe src="' . esc_url($virtual_tour['url']) . '" height="500" width="100%" allowfullscreen frameborder="0" allow="fullscreen"></iframe>';
68 }
69 }
70
71 echo '</div>';
72 }
73