| @@ -178,8 +178,15 @@ | ||
| 178 | 178 | wp_enqueue_style( 'wpvr-pannellum-css', $pano_base . 'css/pannellum.css', [], WPVR_VERSION ); |
| 179 | 179 | wp_enqueue_script( 'wpvr-libpannellum', $pano_base . 'js/libpannellum.js', [], WPVR_VERSION, true ); |
| 180 | 180 | wp_enqueue_script( 'wpvr-pannellum', $pano_base . 'js/pannellum.js', [ 'wpvr-libpannellum' ], WPVR_VERSION, true ); |
| 181 | 181 | |
| 182 | + // Load Video.js & VideoJS-VR (for 360 video tours). | |
| 183 | + $public_base = $plugin_url . 'legacy/public/'; | |
| 184 | + wp_enqueue_style( 'wpvr-videojs-css', $public_base . 'lib/pannellum/src/css/video-js.css', [], WPVR_VERSION ); | |
| 185 | + wp_enqueue_style( 'wpvr-videojs-vr-css', $public_base . 'lib/videojs-vr/videojs-vr.css', [], WPVR_VERSION ); | |
| 186 | + wp_enqueue_script( 'wpvr-videojs', $public_base . 'js/video.js', [], WPVR_VERSION, true ); | |
| 187 | + wp_enqueue_script( 'wpvr-videojs-vr', $public_base . 'lib/videojs-vr/videojs-vr.js', [ 'wpvr-videojs' ], WPVR_VERSION, true ); | |
| 188 | + | |
| 182 | 189 | wp_enqueue_style( 'wpvr-fontawesome', $plugin_url . 'legacy/admin/lib/fontawesome/css/all.min.css', [], WPVR_VERSION ); |
| 183 | 190 | |
| 184 | 191 | // Tour editor React bundle. |
| 185 | 192 | $js_file = $build_dir . 'index.js'; |
| @@ -196,9 +203,9 @@ | ||
| 196 | 203 | |
| 197 | 204 | wp_enqueue_script( |
| 198 | 205 | 'wpvr-tour-editor', |
| 199 | 206 | $plugin_url . 'build/tour-editor/index.js', |
| 200 | - array_merge( $asset['dependencies'], [ 'wpvr-pannellum' ] ), | |
| 207 | + array_merge( $asset['dependencies'], [ 'wpvr-pannellum', 'wpvr-videojs-vr' ] ), | |
| 201 | 208 | $asset['version'], |
| 202 | 209 | true |
| 203 | 210 | ); |
| 204 | 211 | |
| @@ -209,21 +216,33 @@ | ||
| 209 | 216 | if ( class_exists( 'Wpvr_fontawesome_icons' ) ) { |
| 210 | 217 | $fa_icons = ( new \Wpvr_fontawesome_icons() )->icon; |
| 211 | 218 | } |
| 212 | 219 | |
| 220 | + $is_embed_addon_active = apply_filters( 'is_wpvr_embed_addon_premium', false ); | |
| 221 | + if ( $is_embed_addon_active ) { | |
| 222 | + if ( wp_script_is( 'custom-qrcode', 'registered' ) ) { | |
| 223 | + wp_enqueue_script( 'custom-qrcode' ); | |
| 224 | + } elseif ( defined( 'WPVR_PRO_PLUGIN_DIR_URL' ) ) { | |
| 225 | + wp_enqueue_script( 'custom-qrcode', trailingslashit( WPVR_PRO_PLUGIN_DIR_URL ) . 'admin/lib/qr-code/custom-qrcode.js', [ 'jquery' ], null, true ); | |
| 226 | + } | |
| 227 | + } | |
| 228 | + | |
| 213 | 229 | wp_localize_script( 'wpvr-tour-editor', 'wpvrTourEditor', [ |
| 214 | - 'tourId' => $tour_id_cfg ?: null, | |
| 215 | - 'tourStatus' => $tour_status, | |
| 216 | - 'nonce' => wp_create_nonce( 'wp_rest' ), | |
| 217 | - 'apiBase' => rest_url( 'wpvr/v1' ), | |
| 218 | - 'mediaUrl' => rest_url( 'wp/v2/media' ), | |
| 219 | - 'isPro' => wpvr_is_pro_active(), | |
| 220 | - 'pluginUrl' => $plugin_url, | |
| 221 | - 'listUrl' => admin_url( 'edit.php?post_type=' . self::POST_TYPE ), | |
| 222 | - 'postEditUrl' => admin_url( 'post.php' ), | |
| 223 | - 'faIcons' => $fa_icons, | |
| 224 | - 'ajaxUrl' => admin_url( 'admin-ajax.php' ), | |
| 225 | - 'exportNonce' => wp_create_nonce( 'wpvr_export_tour' ), | |
| 230 | + 'tourId' => $tour_id_cfg ?: null, | |
| 231 | + 'tourStatus' => $tour_status, | |
| 232 | + 'tourTitle' => $tour_id_cfg ? get_the_title( $tour_id_cfg ) : '', | |
| 233 | + 'homeUrl' => home_url( '/' ), | |
| 234 | + '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' ), | |
| 226 | 245 | 'imageResizeWarning' => [ |
| 227 | 246 | 'ajaxNonce' => wp_create_nonce( 'wpvr' ), |
| 228 | 247 | 'canManageSettings' => current_user_can( 'manage_options' ), |
| 229 | 248 | 'settingEnabled' => get_option( 'high_res_image' ) === 'true', |