jetpack_vr_viewer_get_viewer_url_params

Scrub URL paramaters for VR viewer.

Description

(url_params) jetpack_vr_viewer_get_viewer_url_params( (url_params) $params ); 

Returns (url_params)

array or false

Parameters (1)

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

Usage

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

Defined (1)

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

/modules/shortcodes/vr.php  
  1. function jetpack_vr_viewer_get_viewer_url_params( $params ) { 
  2. $url_params = array(); 
  3.  
  4. if ( isset( $params['rotation'] ) ) { 
  5. $url_params['rotation'] = intval( $params['rotation'], 10 ); 
  6.  
  7. if ( isset( $params['view'] ) && in_array( $params['view'], array( 'cinema', '360' ), true ) ) { 
  8. $url_params['view'] = $params['view']; 
  9.  
  10. if ( isset( $params['preview'] ) && $params['preview'] ) { 
  11. $url_params['preview'] = 1; 
  12.  
  13. if ( isset( $params['url'] ) ) { 
  14. return array_merge( $url_params, array( 'url' => $params['url'] ) ); 
  15. } else if ( isset( $params['guid'] ) ) { 
  16. return array_merge( $url_params, array( 'guid' => $params['guid'] ) ); 
  17.  
  18. return false;