embed_google_map_options_validate

The Embed Google Map embed google map options validate function.

Description

embed_google_map_options_validate( $input ); 

Parameters (1)

0. $input
The input.

Usage

  1. if ( !function_exists( 'embed_google_map_options_validate' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'embed-google-map/embed_google_map.php'; 
  3.  
  4. // The input. 
  5. $input = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = embed_google_map_options_validate($input); 
  9.  

Defined (1)

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

/embed_google_map.php  
  1. function embed_google_map_options_validate($input) { 
  2. // version is 'new', 'classic' or 'embed' 
  3. $input['version'] = ( preg_match('/^(new|classic|embed)$/i', $input['version']) ? $input['version'] : 'new' ); 
  4. // map type is 'm', 'k', 'h' or 'p' 
  5. $input['map_type'] = ( preg_match('/^(m|k|h|p)$/', $input['map_type']) ? $input['map_type'] : 'm' ); 
  6. // zoom level is between 0-21 
  7. $input['zoom_level'] = ( $input['zoom_level'] >= 0 && $input['zoom_level'] <= 21 ? $input['zoom_level'] : 14 ); 
  8. // add_link is either 0 or 1 
  9. $input['add_link'] = ( $input['add_link'] == 1 ? 1 : 0 ); 
  10. // link_full is either 0 or 1 
  11. $input['link_full'] = ( $input['link_full'] == 1 ? 1 : 0 ); 
  12. // height can contain only digits, whitespaces are stripped from the beginning and end of the value 
  13. $input['height'] = ( preg_match('/^\d+$/', trim($input['height'])) ? trim($input['height']) : 400 ); 
  14. // show_info is either 0 or 1 
  15. $input['show_info'] = ( $input['show_info'] == 1 ? 1 : 0 ); 
  16. // width can contain only digits, whitespaces are stripped from the beginning and end of the value 
  17. $input['width'] = ( preg_match('/^\d+$/', trim($input['width'])) ? trim($input['width']) : 300 ); 
  18. // border is between 0-10 
  19. $input['border'] = ( $input['border'] >= 0 && $input['border'] <= 10 ? $input['border'] : 0 ); 
  20. // border style is 'none', 'hidden', 'dotted', 'dashed', 'solid' or 'double' 
  21. $input['border_style'] = ( preg_match('/^(none|hidden|dotted|dashed|solid|double)$/i', $input['border_style']) ? $input['border_style'] : 'solid' ); 
  22. // border color is a hex color 
  23. $input['border_color'] = ( preg_match('/^#[a-f0-9]{6}$/i', $input['border_color']) ? $input['border_color'] : '#000000' ); 
  24. // https is either 0 or 1 
  25. $input['https'] = ( $input['https'] == 1 ? 1 : 0 );  
  26.  
  27. return $input;