| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) exit; // Exit if accessed directly |
| 3 |
/** |
| 4 |
* Responsible for managing streetview content on Setup metabox |
| 5 |
* |
| 6 |
* @link http://rextheme.com/ |
| 7 |
* @since 8.0.0 |
| 8 |
* |
| 9 |
* @package Wpvr |
| 10 |
* @subpackage Wpvr/admin/classes |
| 11 |
*/ |
| 12 |
|
| 13 |
class WPVR_StreetView { |
| 14 |
|
| 15 |
/** |
| 16 |
* Instance of WPVR_Validator class |
| 17 |
* |
| 18 |
* @var object |
| 19 |
* @since 8.0.0 |
| 20 |
*/ |
| 21 |
protected $validator; |
| 22 |
|
| 23 |
function __construct() |
| 24 |
{ |
| 25 |
$this->validator = new WPVR_Validator(); |
| 26 |
} |
| 27 |
|
| 28 |
|
| 29 |
/** |
| 30 |
* Render shortcode while post has streetview data |
| 31 |
* |
| 32 |
* @param array $postdata |
| 33 |
* |
| 34 |
* @return array |
| 35 |
* @since 8.0.0 |
| 36 |
*/ |
| 37 |
public function render_streetview_shortcode($postdata, $width, $height) |
| 38 |
{ |
| 39 |
if (empty($width)) { |
| 40 |
$width = '600px'; |
| 41 |
} |
| 42 |
if (empty($height)) { |
| 43 |
$height = '400px'; |
| 44 |
} |
| 45 |
$streetviewurl = $postdata['streetviewurl']; |
| 46 |
$html = ''; |
| 47 |
$html .= '<div class="vr-streetview" style="text-align: center; max-width:100%; width:'.$width.'; height:'.$height.'; margin: 0 auto;">'; |
| 48 |
$html .= '<iframe src="'.$streetviewurl.'" frameborder="0" style="border:0; width:100px; height:100%;" allowfullscreen=""></iframe>'; |
| 49 |
$html .= '</div>'; |
| 50 |
return $html; |
| 51 |
} |
| 52 |
|
| 53 |
} |