| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) exit; // Exit if accessed directly |
| 3 |
/** |
| 4 |
* Responsible for managing General tab content |
| 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_General extends WPVR_Tour_setting { |
| 14 |
|
| 15 |
/** |
| 16 |
* Instance of WPVR_Advanced_control class |
| 17 |
* |
| 18 |
* @var object |
| 19 |
* @since 8.0.0 |
| 20 |
*/ |
| 21 |
private $advanced_control; |
| 22 |
|
| 23 |
/** |
| 24 |
* Instance of WPVR_Basic_Setting class |
| 25 |
* |
| 26 |
* @var object |
| 27 |
* @since 8.0.0 |
| 28 |
*/ |
| 29 |
private $basic_setting; |
| 30 |
|
| 31 |
function __construct() |
| 32 |
{ |
| 33 |
$this->advanced_control = WPVR_Advanced_Control::get_instance(); |
| 34 |
|
| 35 |
$this->basic_setting = new WPVR_Basic_Setting(); |
| 36 |
|
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Render General Tab Content |
| 41 |
* @param mixed $preview |
| 42 |
* @param mixed $previewtext |
| 43 |
* @param mixed $autoload |
| 44 |
* @param mixed $control |
| 45 |
* @param mixed $postdata |
| 46 |
* @param mixed $autorotation |
| 47 |
* @param mixed $autorotationinactivedelay |
| 48 |
* @param mixed $autorotationstopdelay |
| 49 |
* |
| 50 |
* @return void |
| 51 |
*/ |
| 52 |
public function render_setting($postdata) |
| 53 |
{ |
| 54 |
ob_start(); |
| 55 |
?> |
| 56 |
|
| 57 |
<!-- start inner tab --> |
| 58 |
<div class="general-inner-tab"> |
| 59 |
<!-- start inner nav --> |
| 60 |
<?php WPVR_Meta_Field::render_general_inner_navigation() ?> |
| 61 |
<!-- end inner nav --> |
| 62 |
|
| 63 |
<!-- start inner tab content --> |
| 64 |
<div class="inner-nav-content"> |
| 65 |
|
| 66 |
<?php $this->basic_setting->render_basic_setting($postdata); ?> |
| 67 |
|
| 68 |
<?php WPVR_Advanced_Control::render($postdata); ?> |
| 69 |
|
| 70 |
</div> |
| 71 |
<!-- end inner tab content --> |
| 72 |
|
| 73 |
<!-- Embed Iframe --> |
| 74 |
<?php if (apply_filters('is_wpvr_embed_addon_premium', false)) { $post = get_post(); $id = $post->ID;?> |
| 75 |
|
| 76 |
<div class="wpvr-use-shortcode"> |
| 77 |
<h4 class="area-title"><?php echo __('Using this Tour','wpvr');?></h4> |
| 78 |
|
| 79 |
<div class="wpvr-shortcode-wrapper"> |
| 80 |
|
| 81 |
<div class="wpvr-single-shortcode gutenberg"> |
| 82 |
|
| 83 |
<span class="shortcode-title"><?php echo __('To Embed on External Page:','wpvr')?></span> |
| 84 |
|
| 85 |
<div class="field-wapper"> |
| 86 |
|
| 87 |
<span><?php echo __('Use the iframe below to share this tour on an external page.','wpvr')?></span><br> |
| 88 |
<span style="color:red;"> |
| 89 |
<?php echo __('Note: WooCommerce & Fluent Forms hotspots will not be supported on embedded tours.','wpvr') ?> |
| 90 |
</span> |
| 91 |
|
| 92 |
<div class="wpvr-shortcode-field"> |
| 93 |
<p class="copycode"><iframe src="<?= home_url() ?>/?embed_page=<?= $id ?>" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen width="100%" height="400" title="<?php echo $post->post_title ?>" description="Take a realistic tour within Lupos Bistro as if you are actually there - powered by WPVR."></iframe></p> |
| 94 |
</div> |
| 95 |
|
| 96 |
</div> |
| 97 |
<!-- .field-wrapper end --> |
| 98 |
|
| 99 |
</div> |
| 100 |
<!-- wpvr-single-shortcode gutenberg end --> |
| 101 |
<div class="wpvr-embaded-share-wrapper"> |
| 102 |
<div class="wpvr-social-share-area"> |
| 103 |
|
| 104 |
<h4><?php echo __('Share your tour','wpvr')?></h4> |
| 105 |
|
| 106 |
<div class="wpvr-social-share-btn-area"> |
| 107 |
|
| 108 |
<div class="single-settings autoload"> |
| 109 |
<span> <?php echo __('Enable Social Media Share','wpvr')?>: </span> |
| 110 |
<span class="wpvr-switcher"> |
| 111 |
<input id="wpvr_social_share" class="vr-switcher-check" name="wpvr_social_share" type="checkbox" value="<?php echo WPVR_Helper::is_enable_social_share($postdata) ?>" <?php echo WPVR_Helper::is_enable_social_share($postdata) == 'on' ? 'checked' : '' ?> > |
| 112 |
<label for="wpvr_social_share"></label> |
| 113 |
</span> |
| 114 |
</div> |
| 115 |
<div class="wpvr-share-buttons-container"> |
| 116 |
<div class="share-list"> |
| 117 |
<?php WPVR_Helper::social_media_share_links_display(home_url().'/?embed_page='. $id); ?> |
| 118 |
</div> |
| 119 |
</div> |
| 120 |
</div> |
| 121 |
|
| 122 |
</div> |
| 123 |
|
| 124 |
<div class="wpvr-qrcode-area"> |
| 125 |
|
| 126 |
<h4><?php echo __('Create a tour use this QR code','wpvr')?></h4> |
| 127 |
|
| 128 |
<div class="wpvr-qrcode-btn-area"> |
| 129 |
<div class="wpvr-qrcode-btn-section"> |
| 130 |
<div id="qrcode" class="wpvr-qrcode"></div> |
| 131 |
<button id="downloadBtn" class="wpvr-download-btn"><?php echo __('Download QR Code','wpvr') ?></button> |
| 132 |
</div> |
| 133 |
|
| 134 |
</div> |
| 135 |
|
| 136 |
</div> |
| 137 |
</div> |
| 138 |
<!-- .wpvr-qrcode-area end --> |
| 139 |
</div> |
| 140 |
<!-- wpvr-shortcode-wrapper end --> |
| 141 |
|
| 142 |
</div> |
| 143 |
<!-- wpvr-use-shortcode end --> |
| 144 |
|
| 145 |
<script> |
| 146 |
jQuery(document).ready(function($) { |
| 147 |
// Generate QR code |
| 148 |
var qr = new QRCode(document.getElementById("qrcode"), { |
| 149 |
text: "<?= home_url() ?>/?embed_page=<?= $id ?>",// Replace with your desired URL or data |
| 150 |
width: 128, |
| 151 |
height: 128 |
| 152 |
}); |
| 153 |
|
| 154 |
// Handle download button click |
| 155 |
$("#downloadBtn").on("click", function(e) { |
| 156 |
e.preventDefault(); // Prevent the default behavior of the button |
| 157 |
|
| 158 |
// Convert the QR code to a data URL |
| 159 |
var dataURL = $("#qrcode canvas")[0].toDataURL("image/jpeg"); |
| 160 |
|
| 161 |
// Create a download link dynamically |
| 162 |
var downloadLink = document.createElement("a"); |
| 163 |
downloadLink.href = dataURL; |
| 164 |
downloadLink.download = "qrcode.jpg"; |
| 165 |
|
| 166 |
// Append the link to the body and trigger a click event |
| 167 |
document.body.appendChild(downloadLink); |
| 168 |
downloadLink.click(); |
| 169 |
|
| 170 |
// Remove the link from the body |
| 171 |
document.body.removeChild(downloadLink); |
| 172 |
|
| 173 |
}); |
| 174 |
}); |
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
</script> |
| 179 |
<?php } ?> |
| 180 |
<!-- End Embed Iframe --> |
| 181 |
</div> |
| 182 |
<!-- end inner tab --> |
| 183 |
|
| 184 |
<?php |
| 185 |
ob_end_flush(); |
| 186 |
} |
| 187 |
|
| 188 |
} |