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