| @@ -216,8 +216,52 @@ | ||
| 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 | + | |
| 220 | 264 | $is_embed_addon_active = apply_filters( 'is_wpvr_embed_addon_premium', false ); |
| 221 | 265 | if ( $is_embed_addon_active ) { |
| 222 | 266 | if ( wp_script_is( 'custom-qrcode', 'registered' ) ) { |
| 223 | 267 | wp_enqueue_script( 'custom-qrcode' ); |
| @@ -226,23 +270,27 @@ | ||
| 226 | 270 | } |
| 227 | 271 | } |
| 228 | 272 | |
| 229 | 273 | wp_localize_script( 'wpvr-tour-editor', 'wpvrTourEditor', [ |
| 230 | - 'tourId' => $tour_id_cfg ?: null, | |
| 231 | - 'tourStatus' => $tour_status, | |
| 274 | + 'tourId' => $tour_id_cfg ?: null, | |
| 275 | + 'tourStatus' => $tour_status, | |
| 232 | 276 | 'tourTitle' => $tour_id_cfg ? get_the_title( $tour_id_cfg ) : '', |
| 233 | 277 | 'homeUrl' => home_url( '/' ), |
| 234 | 278 | 'isEmbedAddonActive' => $is_embed_addon_active, |
| 235 | - 'nonce' => wp_create_nonce( 'wp_rest' ), | |
| 236 | - 'apiBase' => rest_url( 'wpvr/v1' ), | |
| 237 | - 'mediaUrl' => rest_url( 'wp/v2/media' ), | |
| 238 | - 'isPro' => wpvr_is_pro_active(), | |
| 239 | - 'pluginUrl' => $plugin_url, | |
| 240 | - 'listUrl' => admin_url( 'edit.php?post_type=' . self::POST_TYPE ), | |
| 241 | - 'postEditUrl' => admin_url( 'post.php' ), | |
| 242 | - 'faIcons' => $fa_icons, | |
| 243 | - 'ajaxUrl' => admin_url( 'admin-ajax.php' ), | |
| 244 | - 'exportNonce' => wp_create_nonce( 'wpvr_export_tour' ), | |
| 279 | + 'nonce' => wp_create_nonce( 'wp_rest' ), | |
| 280 | + 'apiBase' => rest_url( 'wpvr/v1' ), | |
| 281 | + 'mediaUrl' => rest_url( 'wp/v2/media' ), | |
| 282 | + 'isPro' => wpvr_is_pro_active(), | |
| 283 | + 'pluginUrl' => $plugin_url, | |
| 284 | + 'listUrl' => admin_url( 'edit.php?post_type=' . self::POST_TYPE ), | |
| 285 | + 'postEditUrl' => admin_url( 'post.php' ), | |
| 286 | + 'faIcons' => $fa_icons, | |
| 287 | + 'ajaxUrl' => admin_url( 'admin-ajax.php' ), | |
| 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' ), | |
| 245 | 293 | 'imageResizeWarning' => [ |
| 246 | 294 | 'ajaxNonce' => wp_create_nonce( 'wpvr' ), |
| 247 | 295 | 'canManageSettings' => current_user_can( 'manage_options' ), |
| 248 | 296 | 'settingEnabled' => get_option( 'high_res_image' ) === 'true', |
| @@ -492,13 +540,19 @@ | ||
| 492 | 540 | $style_dependencies[] = 'wpvr-create-tour-modal'; |
| 493 | 541 | $script_dependencies[] = 'wpvr-create-tour-modal'; |
| 494 | 542 | } |
| 495 | 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 | + | |
| 496 | 550 | wp_enqueue_style( |
| 497 | 551 | 'wpvr-tour-listing', |
| 498 | 552 | $plugin_url . 'app/admin/tour-listing.css', |
| 499 | 553 | $style_dependencies, |
| 500 | - WPVR_VERSION | |
| 554 | + $tour_listing_css_ver | |
| 501 | 555 | ); |
| 502 | 556 | |
| 503 | 557 | wp_enqueue_script( |
| 504 | 558 | 'wpvr-tour-listing', |
| @@ -503,9 +557,9 @@ | ||
| 503 | 557 | wp_enqueue_script( |
| 504 | 558 | 'wpvr-tour-listing', |
| 505 | 559 | $plugin_url . 'app/admin/tour-listing.js', |
| 506 | 560 | $script_dependencies, |
| 507 | - WPVR_VERSION, | |
| 561 | + $tour_listing_js_ver, | |
| 508 | 562 | true |
| 509 | 563 | ); |
| 510 | 564 | } |
| 511 | 565 | |