jetpack_vr_viewer_get_html

Create HTML for VR Viewer IFRAME and wrapper The viewer code is hosted on vr.me.sh site which is then displayed within posts via an IFRAME.

Description

jetpack_vr_viewer_get_html( (url_params) $url_params ); 

This function returns the IFRAME html.

Parameters (1)

0. $url_params (url_params)
- parameter array which is passed to the jetpack_vr_viewer

Usage

  1. if ( !function_exists( 'jetpack_vr_viewer_get_html' ) ) { 
  2. require_once '/modules/shortcodes/vr.php'; 
  3.  
  4. // - parameter array which is passed to the jetpack_vr_viewer 
  5. $url_params = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = jetpack_vr_viewer_get_html($url_params); 
  9.  

Defined (1)

The function is defined in the following location(s).

/modules/shortcodes/vr.php  
  1. function jetpack_vr_viewer_get_html( $url_params ) { 
  2. global $content_width; 
  3.  
  4. $iframe = add_query_arg( $url_params, 'https://vr.me.sh/view/' ); 
  5.  
  6. // set some defaults 
  7. $maxwidth = ( isset( $content_width ) ) ? $content_width : 720; 
  8. $view = ( isset( $url_params['view'] ) ) ? $url_params['view'] : 'cinema'; 
  9.  
  10. $rtn = '<div style="position: relative; max-width: ' . $maxwidth . 'px; margin-left: auto; margin-right: auto; overflow: hidden;">'; 
  11. $rtn .= '<div style="padding-top: '. jetpack_vr_viewer_iframe_padding( $view ).';"></div>'; 
  12. $rtn .= '<iframe style="position: absolute; top: 0; right: 0; bottom: 0; left: 0; height: 100%" allowfullscreen="true" frameborder="0" width="100%" height="300" src="'.esc_url( $iframe ).'">'; 
  13. $rtn .= '</iframe>'; 
  14. $rtn .= '</div>'; 
  15.  
  16. return $rtn;