| @@ -577,8 +577,50 @@ | ||
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | add_filter( 'wpvr_generate_tour_layout_html', 'wpvr_render_scene_info_row', 30, 3 ); |
| 580 | 580 | |
| 581 | +if ( ! function_exists( 'wpvr_text_overlay_hex_to_rgba' ) ) { | |
| 582 | + /** | |
| 583 | + * Convert HEX color and opacity percentage to RGBA CSS string. | |
| 584 | + * | |
| 585 | + * Backward-compatibility wrapper for RexTheme\WPVR\Frontend\TextOverlayRenderer::hex_to_rgba(). | |
| 586 | + * | |
| 587 | + * @param string $hex Hex color code. | |
| 588 | + * @param float|int $opacity_percent Opacity 0-100. | |
| 589 | + * @return string | |
| 590 | + */ | |
| 591 | + function wpvr_text_overlay_hex_to_rgba( $hex, $opacity_percent = 55 ) { | |
| 592 | + if ( class_exists( 'RexTheme\WPVR\Frontend\TextOverlayRenderer' ) ) { | |
| 593 | + return \RexTheme\WPVR\Frontend\TextOverlayRenderer::hex_to_rgba( $hex, $opacity_percent ); | |
| 594 | + } | |
| 595 | + return 'rgba(40, 30, 25, 0.55)'; | |
| 596 | + } | |
| 597 | +} | |
| 598 | + | |
| 599 | +if ( ! function_exists( 'wpvr_render_frontend_text_overlays' ) ) { | |
| 600 | + /** | |
| 601 | + * Render the text overlay layer(s) on the frontend for each scene in the tour. | |
| 602 | + * | |
| 603 | + * Backward-compatibility wrapper for RexTheme\WPVR\Frontend\TextOverlayRenderer::render(). | |
| 604 | + * | |
| 605 | + * @param string $html Generated tour HTML. | |
| 606 | + * @param array $postdata Saved tour settings. | |
| 607 | + * @param int $id Tour post ID. | |
| 608 | + * | |
| 609 | + * @return string | |
| 610 | + */ | |
| 611 | + function wpvr_render_frontend_text_overlays( $html, $postdata, $id ) { | |
| 612 | + if ( class_exists( 'RexTheme\WPVR\Frontend\TextOverlayRenderer' ) ) { | |
| 613 | + return \RexTheme\WPVR\Frontend\TextOverlayRenderer::render( $html, $postdata, $id ); | |
| 614 | + } | |
| 615 | + return $html; | |
| 616 | + } | |
| 617 | +} | |
| 618 | + | |
| 619 | +if ( class_exists( 'RexTheme\WPVR\Frontend\TextOverlayRenderer' ) ) { | |
| 620 | + \RexTheme\WPVR\Frontend\TextOverlayRenderer::init(); | |
| 621 | +} | |
| 622 | + | |
| 581 | 623 | if ( ! function_exists( 'wpvr_render_explainer_button' ) ) { |
| 582 | 624 | /** |
| 583 | 625 | * Render the WPVR explainer button independently. |
| 584 | 626 | * |
| @@ -1092,9 +1134,10 @@ | ||
| 1092 | 1134 | } |
| 1093 | 1135 | |
| 1094 | 1136 | function wpvr_isMobileDevice() |
| 1095 | 1137 | { |
| 1096 | - return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]); | |
| 1138 | + $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; | |
| 1139 | + return (bool) preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|ipad|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $user_agent); | |
| 1097 | 1140 | } |
| 1098 | 1141 | |
| 1099 | 1142 | function wpvr_directory() |
| 1100 | 1143 | { |