PluginProbe
Property Hive / 2.2.2
Property Hive v2.2.2
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 1.4.61 All 261 releases
propertyhive / includes / salient-widgets / property-embedded-virtual-tours-html.php

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

65 lines 1.6 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 $virtual_tours = $property->get_virtual_tours();
26
27 if ( !empty($virtual_tours) )
28 {
29 echo '<div class="embedded-virtual-tours">';
30
31 echo '<h4>' . __( 'Virtual Tours', 'propertyhive' ) . '</h4>';
32
33 foreach ( $virtual_tours as $virtual_tour )
34 {
35 if ( isset($settings['oembed']) && $settings['oembed'] == 'yes' )
36 {
37 $embed_code = wp_oembed_get($virtual_tour['url']);
38 echo $embed_code;
39 }
40 else
41 {
42 $virtual_tour['url'] = preg_replace(
43 "/\s*[a-zA-Z\/\/:\.]*youtu(be.com\/watch\?v=|.be\/)([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i",
44 "//www.youtube.com/embed/$2",
45 $virtual_tour['url']
46 );
47
48 $virtual_tour['url'] = preg_replace(
49 '#https?://(www\.)?youtube\.com/shorts/([^/?]+)#',
50 '//www.youtube.com/embed/$2',
51 $virtual_tour['url']
52 );
53
54 $virtual_tour['url'] = preg_replace(
55 '/(https?:\/\/)?(www\.)?(player\.)?vimeo\.com\/?(showcase\/)*([0-9))([a-z]*\/)*([0-9]{6,11})[?]?.*/i',
56 "//player.vimeo.com/video/$6",
57 $virtual_tour['url']
58 );
59
60 echo '<iframe src="' . esc_url($virtual_tour['url']) . '" height="500" width="100%" allowfullscreen frameborder="0" allow="fullscreen"></iframe>';
61 }
62 }
63
64 echo '</div>';
65 }