title = ucfirst($slug);
}
if (empty($post_type)) {
return;
}
$this->title = $title;
$this->slug = $slug;
$this->post_type = $post_type;
$this->context = $context;
$this->priority = $priority;
add_action('add_meta_boxes', array($this, 'register'));
}
/**
* Register review custom meta box
*
* @param string $post_type
*
* @return void
* @since 8.0.0
*/
public function register($post_type)
{
if ($post_type == $this->post_type) {
add_meta_box($this->slug, $this->title, array($this, 'render'), $post_type, $this->context, $this->priority);
}
}
/**
* Render custom meta box
*
* @param object $post
*
* @return void
* @since 8.0.0
*/
public function render($post)
{
$post = '';
$id = '';
$postdata = array();
$post = get_post();
$id = $post->ID;
$postdata = get_post_meta($id, 'panodata', true);
$panoid = 'pano' . $id;
if (isset($postdata['vidid'])) {
ob_start();
?>
isset( $postdata['autoplay'] ) ? $postdata['autoplay'] : 'off',
'loop' => isset( $postdata['loop'] ) ? $postdata['loop'] : 'off',
);
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- trusted internal preview markup includes script/style tags.
echo $format->prepare_youtube_video_preview( $postdata['vidurl'], $videodata );
} else {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- stored tour preview markup is rendered as HTML.
echo $postdata['panoviddata'];
}
?>
$default_scene, "sceneFadeDuration" => $scene_fade_duration, "hfov" => $default_global_zoom, "maxHfov" => $max_global_zoom, "minHfov" => $min_global_zoom);
} else {
$default_data = array("firstScene" => $default_scene, "sceneFadeDuration" => $scene_fade_duration);
}
$scene_data = array();
if (!empty($panodata)) {
foreach ($panodata["scene-list"] as $panoscenes) {
$scene_ititle = '';
if (isset($panoscenes["scene-ititle"])) {
$scene_ititle = sanitize_text_field($panoscenes["scene-ititle"]);
}
$scene_author = '';
if (isset($panoscenes["scene-author"])) {
$scene_author = sanitize_text_field($panoscenes["scene-author"]);
}
$scene_vaov = 180;
if (isset($panoscenes["scene-vaov"])) {
$scene_vaov = (float)$panoscenes["scene-vaov"];
}
$scene_haov = 360;
if (isset($panoscenes["scene-haov"])) {
$scene_haov = (float)$panoscenes["scene-haov"];
}
$scene_vertical_offset = 0;
if (isset($panoscenes["scene-vertical-offset"])) {
$scene_vertical_offset = (float)$panoscenes["scene-vertical-offset"];
}
$default_scene_pitch = null;
if (isset($panoscenes["scene-pitch"])) {
$default_scene_pitch = (float)$panoscenes["scene-pitch"];
}
$default_scene_yaw = null;
if (isset($panoscenes["scene-yaw"])) {
$default_scene_yaw = (float)$panoscenes["scene-yaw"];
}
$scene_max_pitch = '';
if (isset($panoscenes["scene-maxpitch"])) {
$scene_max_pitch = (float)$panoscenes["scene-maxpitch"];
}
$scene_min_pitch = '';
if (isset($panoscenes["scene-minpitch"])) {
$scene_min_pitch = (float)$panoscenes["scene-minpitch"];
}
$scene_max_yaw = '';
if (isset($panoscenes["scene-maxyaw"])) {
$scene_max_yaw = (float)$panoscenes["scene-maxyaw"];
}
$scene_min_yaw = '';
if (isset($panoscenes["scene-minyaw"])) {
$scene_min_yaw = (float)$panoscenes["scene-minyaw"];
}
$default_zoom = 100;
if (isset($panoscenes["scene-zoom"]) && $panoscenes["scene-zoom"] != '') {
$default_zoom = (int)$panoscenes["scene-zoom"];
} else {
if ($default_global_zoom != '') {
$default_zoom = (int)$default_global_zoom;
}
}
$max_zoom = 120;
if (isset($panoscenes["scene-maxzoom"]) && $panoscenes["scene-maxzoom"] != '') {
$max_zoom = (int)$panoscenes["scene-maxzoom"];
} else {
if ($max_global_zoom != '') {
$max_zoom = (int)$max_global_zoom;
}
}
$min_zoom = 50;
if (isset($panoscenes["scene-minzoom"]) && $panoscenes["scene-minzoom"] != '') {
$min_zoom = (int)$panoscenes["scene-minzoom"];
} else {
if ($min_global_zoom != '') {
$min_zoom = (int)$min_global_zoom;
}
}
$hotspot_datas = array();
if (isset($panoscenes["hotspot-list"])) {
$hotspot_datas = $panoscenes["hotspot-list"];
}
$hotspots = array();
foreach ($hotspot_datas as $hotspot_data) {
$hotspot_scene_pitch = '';
if (isset($hotspot_data["hotspot-scene-pitch"])) {
$hotspot_scene_pitch = $hotspot_data["hotspot-scene-pitch"];
}
$hotspot_scene_yaw = '';
if (isset($hotspot_data["hotspot-scene-yaw"])) {
$hotspot_scene_yaw = $hotspot_data["hotspot-scene-yaw"];
}
$hotspot_type = $hotspot_data["hotspot-type"] !== 'scene' ? 'info' : $hotspot_data["hotspot-type"];
$hotspot_content = '';
ob_start();
do_action('wpvr_hotspot_content', $hotspot_data);
$hotspot_content = ob_get_clean();
if (!$hotspot_content) $hotspot_content = $hotspot_data["hotspot-content"];
$hotspot_info = array(
"text" => esc_html($hotspot_data["hotspot-title"]),
"pitch" => $hotspot_data["hotspot-pitch"],
"yaw" => $hotspot_data["hotspot-yaw"],
"type" => $hotspot_type,
"URL" => $hotspot_data["hotspot-url"],
"clickHandlerArgs" => $hotspot_content,
"createTooltipArgs" => $hotspot_data["hotspot-hover"],
"sceneId" => $hotspot_data["hotspot-scene"],
"targetPitch" => (float)$hotspot_scene_pitch,
"targetYaw" => (float)$hotspot_scene_yaw
);
array_push($hotspots, $hotspot_info);
if (empty($hotspot_data["hotspot-scene"])) {
unset($hotspot_info['targetPitch']);
unset($hotspot_info['targetYaw']);
}
}
$scene_info = array();
if ($panoscenes["scene-type"] == 'cubemap') {
$pano_type = 'cubemap';
$pano_attachment = array(
$panoscenes["scene-attachment-url-face0"],
$panoscenes["scene-attachment-url-face1"],
$panoscenes["scene-attachment-url-face2"],
$panoscenes["scene-attachment-url-face3"],
$panoscenes["scene-attachment-url-face4"],
$panoscenes["scene-attachment-url-face5"]
);
$scene_info = array("type" => $panoscenes["scene-type"], "cubeMap" => $pano_attachment, "pitch" => $default_scene_pitch, "maxPitch" => $scene_max_pitch, "minPitch" => $scene_min_pitch, "maxYaw" => $scene_max_yaw, "minYaw" => $scene_min_yaw, "yaw" => $default_scene_yaw, "hfov" => $default_zoom, "maxHfov" => $max_zoom, "minHfov" => $min_zoom, "title" => $scene_ititle, "author" => $scene_author, "vaov" => $scene_vaov, "haov" => $scene_haov, "vOffset" => $scene_vertical_offset, "hotSpots" => $hotspots);
} else {
$scene_info = array("type" => $panoscenes["scene-type"], "panorama" => $panoscenes["scene-attachment-url"], "pitch" => $default_scene_pitch, "maxPitch" => $scene_max_pitch, "minPitch" => $scene_min_pitch, "maxYaw" => $scene_max_yaw, "minYaw" => $scene_min_yaw, "yaw" => $default_scene_yaw, "hfov" => $default_zoom, "maxHfov" => $max_zoom, "minHfov" => $min_zoom, "title" => $scene_ititle, "author" => $scene_author, "vaov" => $scene_vaov, "haov" => $scene_haov, "vOffset" => $scene_vertical_offset, "hotSpots" => $hotspots);
}
if (isset($panoscenes["ptyscene"])) {
if ($panoscenes["ptyscene"] == "off") {
unset($scene_info['pitch']);
unset($scene_info['yaw']);
}
}
if (empty($panoscenes["scene-ititle"])) {
unset($scene_info['title']);
}
if (empty($panoscenes["scene-author"])) {
unset($scene_info['author']);
}
if (empty($scene_vaov)) {
unset($scene_info['vaov']);
}
if (empty($scene_haov)) {
unset($scene_info['haov']);
}
if (empty($scene_vertical_offset)) {
unset($scene_info['vOffset']);
}
if (isset($panoscenes["cvgscene"])) {
if ($panoscenes["cvgscene"] == "off") {
unset($scene_info['maxPitch']);
unset($scene_info['minPitch']);
}
}
if (empty($panoscenes["scene-maxpitch"])) {
unset($scene_info['maxPitch']);
}
if (empty($panoscenes["scene-minpitch"])) {
unset($scene_info['minPitch']);
}
if (isset($panoscenes["chgscene"])) {
if ($panoscenes["chgscene"] == "off") {
unset($scene_info['maxYaw']);
unset($scene_info['minYaw']);
}
}
if (empty($panoscenes["scene-maxyaw"])) {
unset($scene_info['maxYaw']);
}
if (empty($panoscenes["scene-minyaw"])) {
unset($scene_info['minYaw']);
}
$scene_array = array();
$scene_array = array(
$panoscenes["scene-id"] => $scene_info
);
$scene_data[$panoscenes["scene-id"]] = $scene_info;
}
}
$pano_id_array = array();
$pano_id_array = array("panoid" => $panoid);
$pano_response = array();
$pano_response = array("autoLoad" => $autoload, "showControls" => $control, 'compass' => $compass, 'mouseZoom' => $mouseZoom, 'draggable' => $draggable, 'disableKeyboardCtrl' => $diskeyboard, 'keyboardZoom' => $keyboardzoom, "preview" => $preview, "autoRotate" => $autorotation, "autoRotateInactivityDelay" => $autorotationinactivedelay, "autoRotateStopDelay" => $autorotationstopdelay, "default" => $default_data, "scenes" => $scene_data);
if (empty($autorotation)) {
unset($pano_response['autoRotate']);
unset($pano_response['autoRotateInactivityDelay']);
unset($pano_response['autoRotateStopDelay']);
}
if (empty($autorotationinactivedelay)) {
unset($pano_response['autoRotateInactivityDelay']);
}
if (empty($autorotationstopdelay)) {
unset($pano_response['autoRotateStopDelay']);
}
$response = array();
$response = array($pano_id_array, $pano_response);
if (!empty($response)) {
$response = json_encode($response);
}
$floor_list_pointer_position = isset($postdata['floor_plan_pointer_position']) ? $postdata['floor_plan_pointer_position'] : '';
$calltoaction = isset($postdata['calltoaction']) ? $postdata['calltoaction']: 'off';
$buttontext = isset($postdata['buttontext']) ? $postdata['buttontext']: 'Click Here';
$buttonurl = isset($postdata['buttonurl']) ? $postdata['buttonurl']: '';
$calltoactionbutton_css = isset($postdata['calltoactionbutton']) ? $postdata['calltoactionbutton']: '';
$floor_list_pointer_position_object= array();
if(is_array($floor_list_pointer_position)){
foreach ($floor_list_pointer_position as $item) {
$floor_list_pointer_position_object[] = (object)$item;
}
$floor_list_pointer_position = $floor_list_pointer_position_object;
}
ob_start();
?>
; ?>)
%5$s
',
esc_attr( $pointer_position->id ),
esc_attr( $pointer_position->data_top ),
esc_attr( $pointer_position->data_left ),
esc_attr( $pointer_position->style ),
esc_html( $pointer_position->text )
);
}
?>
ID;
$slug = $post->post_name;
$postdata = get_post_meta($post->ID, 'panodata', true);
?>
[wpvr id=""]