| @@ -216,11 +216,67 @@ | ||
| 216 | 216 | if ( class_exists( 'Wpvr_fontawesome_icons' ) ) { |
| 217 | 217 | $fa_icons = ( new \Wpvr_fontawesome_icons() )->icon; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | + $raw_hotspot_types = apply_filters( 'wpvr_hotspot_types', [ | |
| 221 | + 'info' => __( 'Info', 'wpvr' ), | |
| 222 | + 'scene' => __( 'Scene', 'wpvr' ), | |
| 223 | + ] ); | |
| 224 | + | |
| 225 | + $hotspot_types = []; | |
| 226 | + if ( isset( $raw_hotspot_types['info'] ) ) { | |
| 227 | + $hotspot_types[] = [ 'value' => 'info', 'label' => $raw_hotspot_types['info'] ]; | |
| 228 | + unset( $raw_hotspot_types['info'] ); | |
| 229 | + } else { | |
| 230 | + $hotspot_types[] = [ 'value' => 'info', 'label' => __( 'Info', 'wpvr' ) ]; | |
| 231 | + } | |
| 232 | + | |
| 233 | + if ( isset( $raw_hotspot_types['scene'] ) ) { | |
| 234 | + $hotspot_types[] = [ 'value' => 'scene', 'label' => $raw_hotspot_types['scene'] ]; | |
| 235 | + unset( $raw_hotspot_types['scene'] ); | |
| 236 | + } else { | |
| 237 | + $hotspot_types[] = [ 'value' => 'scene', 'label' => __( 'Scene', 'wpvr' ) ]; | |
| 238 | + } | |
| 239 | + | |
| 240 | + $hotspot_types[] = [ 'value' => 'url', 'label' => __( 'External URL', 'wpvr' ) ]; | |
| 241 | + if ( isset( $raw_hotspot_types['url'] ) ) { | |
| 242 | + unset( $raw_hotspot_types['url'] ); | |
| 243 | + } | |
| 244 | + | |
| 245 | + foreach ( $raw_hotspot_types as $type_key => $type_label ) { | |
| 246 | + $hotspot_types[] = [ 'value' => $type_key, 'label' => $type_label ]; | |
| 247 | + } | |
| 248 | + | |
| 249 | + $fluent_forms = []; | |
| 250 | + if ( defined( 'FLUENTFORM' ) ) { | |
| 251 | + global $wpdb; | |
| 252 | + $fluent_form_table = $wpdb->prefix . 'fluentform_forms'; | |
| 253 | + $forms = $wpdb->get_results( "SELECT id, title FROM {$fluent_form_table} WHERE status = 'published' ORDER BY title ASC" ); | |
| 254 | + if ( ! empty( $forms ) && is_array( $forms ) ) { | |
| 255 | + foreach ( $forms as $form ) { | |
| 256 | + $fluent_forms[] = [ | |
| 257 | + 'id' => (string) $form->id, | |
| 258 | + 'title' => $form->title, | |
| 259 | + ]; | |
| 260 | + } | |
| 261 | + } | |
| 262 | + } | |
| 263 | + | |
| 264 | + $is_embed_addon_active = apply_filters( 'is_wpvr_embed_addon_premium', false ); | |
| 265 | + if ( $is_embed_addon_active ) { | |
| 266 | + if ( wp_script_is( 'custom-qrcode', 'registered' ) ) { | |
| 267 | + wp_enqueue_script( 'custom-qrcode' ); | |
| 268 | + } elseif ( defined( 'WPVR_PRO_PLUGIN_DIR_URL' ) ) { | |
| 269 | + wp_enqueue_script( 'custom-qrcode', trailingslashit( WPVR_PRO_PLUGIN_DIR_URL ) . 'admin/lib/qr-code/custom-qrcode.js', [ 'jquery' ], null, true ); | |
| 270 | + } | |
| 271 | + } | |
| 272 | + | |
| 220 | 273 | wp_localize_script( 'wpvr-tour-editor', 'wpvrTourEditor', [ |
| 221 | 274 | 'tourId' => $tour_id_cfg ?: null, |
| 222 | 275 | 'tourStatus' => $tour_status, |
| 276 | + 'tourTitle' => $tour_id_cfg ? get_the_title( $tour_id_cfg ) : '', | |
| 277 | + 'homeUrl' => home_url( '/' ), | |
| 278 | + 'isEmbedAddonActive' => $is_embed_addon_active, | |
| 223 | 279 | 'nonce' => wp_create_nonce( 'wp_rest' ), |
| 224 | 280 | 'apiBase' => rest_url( 'wpvr/v1' ), |
| 225 | 281 | 'mediaUrl' => rest_url( 'wp/v2/media' ), |
| 226 | 282 | 'isPro' => wpvr_is_pro_active(), |
| @@ -229,8 +285,12 @@ | ||
| 229 | 285 | 'postEditUrl' => admin_url( 'post.php' ), |
| 230 | 286 | 'faIcons' => $fa_icons, |
| 231 | 287 | 'ajaxUrl' => admin_url( 'admin-ajax.php' ), |
| 232 | 288 | 'exportNonce' => wp_create_nonce( 'wpvr_export_tour' ), |
| 289 | + 'hotspotTypes' => $hotspot_types, | |
| 290 | + 'fluentForms' => $fluent_forms, | |
| 291 | + 'isFluentFormActive' => defined( 'FLUENTFORM' ), | |
| 292 | + 'isWcActive' => class_exists( 'WooCommerce' ), | |
| 233 | 293 | 'imageResizeWarning' => [ |
| 234 | 294 | 'ajaxNonce' => wp_create_nonce( 'wpvr' ), |
| 235 | 295 | 'canManageSettings' => current_user_can( 'manage_options' ), |
| 236 | 296 | 'settingEnabled' => get_option( 'high_res_image' ) === 'true', |
| @@ -480,13 +540,19 @@ | ||
| 480 | 540 | $style_dependencies[] = 'wpvr-create-tour-modal'; |
| 481 | 541 | $script_dependencies[] = 'wpvr-create-tour-modal'; |
| 482 | 542 | } |
| 483 | 543 | |
| 544 | + $tour_listing_css = plugin_dir_path( WPVR_FILE ) . 'app/admin/tour-listing.css'; | |
| 545 | + $tour_listing_css_ver = file_exists( $tour_listing_css ) ? (string) filemtime( $tour_listing_css ) : WPVR_VERSION; | |
| 546 | + | |
| 547 | + $tour_listing_js = plugin_dir_path( WPVR_FILE ) . 'app/admin/tour-listing.js'; | |
| 548 | + $tour_listing_js_ver = file_exists( $tour_listing_js ) ? (string) filemtime( $tour_listing_js ) : WPVR_VERSION; | |
| 549 | + | |
| 484 | 550 | wp_enqueue_style( |
| 485 | 551 | 'wpvr-tour-listing', |
| 486 | 552 | $plugin_url . 'app/admin/tour-listing.css', |
| 487 | 553 | $style_dependencies, |
| 488 | - WPVR_VERSION | |
| 554 | + $tour_listing_css_ver | |
| 489 | 555 | ); |
| 490 | 556 | |
| 491 | 557 | wp_enqueue_script( |
| 492 | 558 | 'wpvr-tour-listing', |
| @@ -491,9 +557,9 @@ | ||
| 491 | 557 | wp_enqueue_script( |
| 492 | 558 | 'wpvr-tour-listing', |
| 493 | 559 | $plugin_url . 'app/admin/tour-listing.js', |
| 494 | 560 | $script_dependencies, |
| 495 | - WPVR_VERSION, | |
| 561 | + $tour_listing_js_ver, | |
| 496 | 562 | true |
| 497 | 563 | ); |
| 498 | 564 | } |
| 499 | 565 | |