| @@ -170,8 +170,9 @@ | ||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | $plugin_url = plugin_dir_url( WPVR_FILE ); |
| 173 | 173 | $plugin_path = plugin_dir_path( WPVR_FILE ); |
| 174 | + \RexTheme\WPVR\Content\VideoSource::enqueue_verifier(); | |
| 174 | 175 | $build_dir = $plugin_path . 'build/tour-editor/'; |
| 175 | 176 | |
| 176 | 177 | // Load Pannellum (from legacy bundle). |
| 177 | 178 | $pano_base = $plugin_url . 'legacy/admin/lib/pannellum/src/'; |
| @@ -203,9 +204,9 @@ | ||
| 203 | 204 | |
| 204 | 205 | wp_enqueue_script( |
| 205 | 206 | 'wpvr-tour-editor', |
| 206 | 207 | $plugin_url . 'build/tour-editor/index.js', |
| 207 | - array_merge( $asset['dependencies'], [ 'wpvr-pannellum', 'wpvr-videojs-vr' ] ), | |
| 208 | + array_merge( $asset['dependencies'], [ 'wpvr-pannellum', 'wpvr-videojs-vr', 'wpvr-video-url' ] ), | |
| 208 | 209 | $asset['version'], |
| 209 | 210 | true |
| 210 | 211 | ); |
| 211 | 212 | |
| @@ -216,8 +217,52 @@ | ||
| 216 | 217 | if ( class_exists( 'Wpvr_fontawesome_icons' ) ) { |
| 217 | 218 | $fa_icons = ( new \Wpvr_fontawesome_icons() )->icon; |
| 218 | 219 | } |
| 219 | 220 | |
| 221 | + $raw_hotspot_types = apply_filters( 'wpvr_hotspot_types', [ | |
| 222 | + 'info' => __( 'Info', 'wpvr' ), | |
| 223 | + 'scene' => __( 'Scene', 'wpvr' ), | |
| 224 | + ] ); | |
| 225 | + | |
| 226 | + $hotspot_types = []; | |
| 227 | + if ( isset( $raw_hotspot_types['info'] ) ) { | |
| 228 | + $hotspot_types[] = [ 'value' => 'info', 'label' => $raw_hotspot_types['info'] ]; | |
| 229 | + unset( $raw_hotspot_types['info'] ); | |
| 230 | + } else { | |
| 231 | + $hotspot_types[] = [ 'value' => 'info', 'label' => __( 'Info', 'wpvr' ) ]; | |
| 232 | + } | |
| 233 | + | |
| 234 | + if ( isset( $raw_hotspot_types['scene'] ) ) { | |
| 235 | + $hotspot_types[] = [ 'value' => 'scene', 'label' => $raw_hotspot_types['scene'] ]; | |
| 236 | + unset( $raw_hotspot_types['scene'] ); | |
| 237 | + } else { | |
| 238 | + $hotspot_types[] = [ 'value' => 'scene', 'label' => __( 'Scene', 'wpvr' ) ]; | |
| 239 | + } | |
| 240 | + | |
| 241 | + $hotspot_types[] = [ 'value' => 'url', 'label' => __( 'External URL', 'wpvr' ) ]; | |
| 242 | + if ( isset( $raw_hotspot_types['url'] ) ) { | |
| 243 | + unset( $raw_hotspot_types['url'] ); | |
| 244 | + } | |
| 245 | + | |
| 246 | + foreach ( $raw_hotspot_types as $type_key => $type_label ) { | |
| 247 | + $hotspot_types[] = [ 'value' => $type_key, 'label' => $type_label ]; | |
| 248 | + } | |
| 249 | + | |
| 250 | + $fluent_forms = []; | |
| 251 | + if ( defined( 'FLUENTFORM' ) ) { | |
| 252 | + global $wpdb; | |
| 253 | + $fluent_form_table = $wpdb->prefix . 'fluentform_forms'; | |
| 254 | + $forms = $wpdb->get_results( "SELECT id, title FROM {$fluent_form_table} WHERE status = 'published' ORDER BY title ASC" ); | |
| 255 | + if ( ! empty( $forms ) && is_array( $forms ) ) { | |
| 256 | + foreach ( $forms as $form ) { | |
| 257 | + $fluent_forms[] = [ | |
| 258 | + 'id' => (string) $form->id, | |
| 259 | + 'title' => $form->title, | |
| 260 | + ]; | |
| 261 | + } | |
| 262 | + } | |
| 263 | + } | |
| 264 | + | |
| 220 | 265 | $is_embed_addon_active = apply_filters( 'is_wpvr_embed_addon_premium', false ); |
| 221 | 266 | if ( $is_embed_addon_active ) { |
| 222 | 267 | if ( wp_script_is( 'custom-qrcode', 'registered' ) ) { |
| 223 | 268 | wp_enqueue_script( 'custom-qrcode' ); |
| @@ -226,23 +271,27 @@ | ||
| 226 | 271 | } |
| 227 | 272 | } |
| 228 | 273 | |
| 229 | 274 | wp_localize_script( 'wpvr-tour-editor', 'wpvrTourEditor', [ |
| 230 | - 'tourId' => $tour_id_cfg ?: null, | |
| 231 | - 'tourStatus' => $tour_status, | |
| 275 | + 'tourId' => $tour_id_cfg ?: null, | |
| 276 | + 'tourStatus' => $tour_status, | |
| 232 | 277 | 'tourTitle' => $tour_id_cfg ? get_the_title( $tour_id_cfg ) : '', |
| 233 | 278 | 'homeUrl' => home_url( '/' ), |
| 234 | 279 | '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' ), | |
| 280 | + 'nonce' => wp_create_nonce( 'wp_rest' ), | |
| 281 | + 'apiBase' => rest_url( 'wpvr/v1' ), | |
| 282 | + 'mediaUrl' => rest_url( 'wp/v2/media' ), | |
| 283 | + 'isPro' => wpvr_is_pro_active(), | |
| 284 | + 'pluginUrl' => $plugin_url, | |
| 285 | + 'listUrl' => admin_url( 'edit.php?post_type=' . self::POST_TYPE ), | |
| 286 | + 'postEditUrl' => admin_url( 'post.php' ), | |
| 287 | + 'faIcons' => $fa_icons, | |
| 288 | + 'ajaxUrl' => admin_url( 'admin-ajax.php' ), | |
| 289 | + 'exportNonce' => wp_create_nonce( 'wpvr_export_tour' ), | |
| 290 | + 'hotspotTypes' => $hotspot_types, | |
| 291 | + 'fluentForms' => $fluent_forms, | |
| 292 | + 'isFluentFormActive' => defined( 'FLUENTFORM' ), | |
| 293 | + 'isWcActive' => class_exists( 'WooCommerce' ), | |
| 245 | 294 | 'imageResizeWarning' => [ |
| 246 | 295 | 'ajaxNonce' => wp_create_nonce( 'wpvr' ), |
| 247 | 296 | 'canManageSettings' => current_user_can( 'manage_options' ), |
| 248 | 297 | 'settingEnabled' => get_option( 'high_res_image' ) === 'true', |
| @@ -253,13 +302,17 @@ | ||
| 253 | 302 | 'close' => __( 'Close', 'wpvr' ), |
| 254 | 303 | ], |
| 255 | 304 | ] ); |
| 256 | 305 | |
| 306 | + $inter_font_path = $plugin_path . 'legacy/public/css/inter.css'; | |
| 307 | + $inter_font_ver = file_exists( $inter_font_path ) ? filemtime( $inter_font_path ) : WPVR_VERSION; | |
| 308 | + wp_enqueue_style( 'wpvr-inter-font', $public_base . 'css/inter.css', [], $inter_font_ver, 'all' ); | |
| 309 | + | |
| 257 | 310 | if ( file_exists( $css_file ) ) { |
| 258 | 311 | wp_enqueue_style( |
| 259 | 312 | 'wpvr-tour-editor', |
| 260 | 313 | $plugin_url . 'build/tour-editor/style-index.css', |
| 261 | - [ 'wpvr-pannellum-css' ], | |
| 314 | + [ 'wpvr-pannellum-css', 'wpvr-inter-font' ], | |
| 262 | 315 | $asset['version'] |
| 263 | 316 | ); |
| 264 | 317 | } |
| 265 | 318 | } |
| @@ -492,13 +545,19 @@ | ||
| 492 | 545 | $style_dependencies[] = 'wpvr-create-tour-modal'; |
| 493 | 546 | $script_dependencies[] = 'wpvr-create-tour-modal'; |
| 494 | 547 | } |
| 495 | 548 | |
| 549 | + $tour_listing_css = plugin_dir_path( WPVR_FILE ) . 'app/admin/tour-listing.css'; | |
| 550 | + $tour_listing_css_ver = file_exists( $tour_listing_css ) ? (string) filemtime( $tour_listing_css ) : WPVR_VERSION; | |
| 551 | + | |
| 552 | + $tour_listing_js = plugin_dir_path( WPVR_FILE ) . 'app/admin/tour-listing.js'; | |
| 553 | + $tour_listing_js_ver = file_exists( $tour_listing_js ) ? (string) filemtime( $tour_listing_js ) : WPVR_VERSION; | |
| 554 | + | |
| 496 | 555 | wp_enqueue_style( |
| 497 | 556 | 'wpvr-tour-listing', |
| 498 | 557 | $plugin_url . 'app/admin/tour-listing.css', |
| 499 | 558 | $style_dependencies, |
| 500 | - WPVR_VERSION | |
| 559 | + $tour_listing_css_ver | |
| 501 | 560 | ); |
| 502 | 561 | |
| 503 | 562 | wp_enqueue_script( |
| 504 | 563 | 'wpvr-tour-listing', |
| @@ -503,9 +562,9 @@ | ||
| 503 | 562 | wp_enqueue_script( |
| 504 | 563 | 'wpvr-tour-listing', |
| 505 | 564 | $plugin_url . 'app/admin/tour-listing.js', |
| 506 | 565 | $script_dependencies, |
| 507 | - WPVR_VERSION, | |
| 566 | + $tour_listing_js_ver, | |
| 508 | 567 | true |
| 509 | 568 | ); |
| 510 | 569 | } |
| 511 | 570 | |