@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @return string |
39 | 39 | */ |
40 | - public function google_maps_shortcode( $atts ) { |
|
40 | + public function google_maps_shortcode($atts) { |
|
41 | 41 | |
42 | 42 | $atts = shortcode_atts( |
43 | 43 | array( |
@@ -48,26 +48,26 @@ discard block |
||
48 | 48 | ); |
49 | 49 | |
50 | 50 | //gather data for this shortcode |
51 | - $post = get_post( $atts['id'] ); |
|
52 | - $all_meta = get_post_custom( $atts['id'] ); |
|
51 | + $post = get_post($atts['id']); |
|
52 | + $all_meta = get_post_custom($atts['id']); |
|
53 | 53 | |
54 | - $visual_info = maybe_unserialize( $all_meta['gmb_width_height'][0] ); |
|
55 | - $lat_lng = maybe_unserialize( $all_meta['gmb_lat_lng'][0] ); |
|
54 | + $visual_info = maybe_unserialize($all_meta['gmb_width_height'][0]); |
|
55 | + $lat_lng = maybe_unserialize($all_meta['gmb_lat_lng'][0]); |
|
56 | 56 | |
57 | 57 | //Put markers into an array for JS usage |
58 | 58 | $map_marker_array = array(); |
59 | - $markers_repeatable = isset( $all_meta['gmb_markers_group'][0] ) ? maybe_unserialize( $all_meta['gmb_markers_group'][0] ) : ''; |
|
59 | + $markers_repeatable = isset($all_meta['gmb_markers_group'][0]) ? maybe_unserialize($all_meta['gmb_markers_group'][0]) : ''; |
|
60 | 60 | |
61 | - if ( is_array( $markers_repeatable ) ) { |
|
62 | - foreach ( $markers_repeatable as $marker ) { |
|
63 | - array_push( $map_marker_array, $marker ); |
|
61 | + if (is_array($markers_repeatable)) { |
|
62 | + foreach ($markers_repeatable as $marker) { |
|
63 | + array_push($map_marker_array, $marker); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | 67 | //Send data for AJAX usage |
68 | 68 | //Add params to AJAX for Shortcode Usage |
69 | 69 | //@see: http://benjaminrojas.net/using-wp_localize_script-dynamically/ |
70 | - $localized_data = apply_filters( 'gmb_localized_data', array( |
|
70 | + $localized_data = apply_filters('gmb_localized_data', array( |
|
71 | 71 | $post->ID => array( |
72 | 72 | 'id' => $atts['id'], |
73 | 73 | 'map_params' => array( |
@@ -76,41 +76,41 @@ discard block |
||
76 | 76 | 'height' => $visual_info['height'], |
77 | 77 | 'latitude' => $lat_lng['latitude'], |
78 | 78 | 'longitude' => $lat_lng['longitude'], |
79 | - 'zoom' => ! empty( $all_meta['gmb_zoom'][0] ) ? $all_meta['gmb_zoom'][0] : '15', |
|
80 | - 'default_marker' => apply_filters( 'gmb_default_marker', GMB_PLUGIN_URL . 'assets/img/spotlight-poi.png' ), |
|
79 | + 'zoom' => ! empty($all_meta['gmb_zoom'][0]) ? $all_meta['gmb_zoom'][0] : '15', |
|
80 | + 'default_marker' => apply_filters('gmb_default_marker', GMB_PLUGIN_URL.'assets/img/spotlight-poi.png'), |
|
81 | 81 | ), |
82 | 82 | 'map_controls' => array( |
83 | - 'zoom_control' => ! empty( $all_meta['gmb_zoom_control'][0] ) ? strtoupper( $all_meta['gmb_zoom_control'][0] ) : 'STANDARD', |
|
84 | - 'pan_control' => ! empty( $all_meta['gmb_pan'][0] ) ? $all_meta['gmb_pan'][0] : 'none', |
|
85 | - 'map_type_control' => ! empty( $all_meta['gmb_map_type_control'][0] ) ? $all_meta['gmb_map_type_control'][0] : 'none', |
|
86 | - 'draggable' => ! empty( $all_meta['gmb_draggable'][0] ) ? $all_meta['gmb_draggable'][0] : 'none', |
|
87 | - 'double_click_zoom' => ! empty( $all_meta['gmb_double_click'][0] ) ? $all_meta['gmb_double_click'][0] : 'none', |
|
88 | - 'wheel_zoom' => ! empty( $all_meta['gmb_wheel_zoom'][0] ) ? $all_meta['gmb_wheel_zoom'][0] : 'none', |
|
89 | - 'street_view' => ! empty( $all_meta['gmb_street_view'][0] ) ? $all_meta['gmb_street_view'][0] : 'none', |
|
83 | + 'zoom_control' => ! empty($all_meta['gmb_zoom_control'][0]) ? strtoupper($all_meta['gmb_zoom_control'][0]) : 'STANDARD', |
|
84 | + 'pan_control' => ! empty($all_meta['gmb_pan'][0]) ? $all_meta['gmb_pan'][0] : 'none', |
|
85 | + 'map_type_control' => ! empty($all_meta['gmb_map_type_control'][0]) ? $all_meta['gmb_map_type_control'][0] : 'none', |
|
86 | + 'draggable' => ! empty($all_meta['gmb_draggable'][0]) ? $all_meta['gmb_draggable'][0] : 'none', |
|
87 | + 'double_click_zoom' => ! empty($all_meta['gmb_double_click'][0]) ? $all_meta['gmb_double_click'][0] : 'none', |
|
88 | + 'wheel_zoom' => ! empty($all_meta['gmb_wheel_zoom'][0]) ? $all_meta['gmb_wheel_zoom'][0] : 'none', |
|
89 | + 'street_view' => ! empty($all_meta['gmb_street_view'][0]) ? $all_meta['gmb_street_view'][0] : 'none', |
|
90 | 90 | ), |
91 | 91 | 'map_theme' => array( |
92 | - 'map_type' => ! empty( $all_meta['gmb_type'][0] ) ? $all_meta['gmb_type'][0] : 'RoadMap', |
|
93 | - 'map_theme_json' => ! empty( $all_meta['gmb_theme_json'][0] ) ? $all_meta['gmb_theme_json'][0] : 'none', |
|
92 | + 'map_type' => ! empty($all_meta['gmb_type'][0]) ? $all_meta['gmb_type'][0] : 'RoadMap', |
|
93 | + 'map_theme_json' => ! empty($all_meta['gmb_theme_json'][0]) ? $all_meta['gmb_theme_json'][0] : 'none', |
|
94 | 94 | |
95 | 95 | ), |
96 | 96 | 'map_markers' => $map_marker_array, |
97 | 97 | 'plugin_url' => GMB_PLUGIN_URL, |
98 | 98 | 'places_api' => array( |
99 | - 'show_places' => ! empty( $all_meta['gmb_show_places'][0] ) ? $all_meta['gmb_show_places'][0] : 'no', |
|
100 | - 'search_radius' => ! empty( $all_meta['gmb_search_radius'][0] ) ? $all_meta['gmb_search_radius'][0] : '3000', |
|
101 | - 'search_places' => ! empty( $all_meta['gmb_places_search_multicheckbox'][0] ) ? maybe_unserialize( $all_meta['gmb_places_search_multicheckbox'][0] ) : '', |
|
99 | + 'show_places' => ! empty($all_meta['gmb_show_places'][0]) ? $all_meta['gmb_show_places'][0] : 'no', |
|
100 | + 'search_radius' => ! empty($all_meta['gmb_search_radius'][0]) ? $all_meta['gmb_search_radius'][0] : '3000', |
|
101 | + 'search_places' => ! empty($all_meta['gmb_places_search_multicheckbox'][0]) ? maybe_unserialize($all_meta['gmb_places_search_multicheckbox'][0]) : '', |
|
102 | 102 | ), |
103 | - 'map_markers_icon' => ! empty( $all_meta['gmb_map_marker'] ) ? $all_meta['gmb_map_marker'][0] : 'none', |
|
103 | + 'map_markers_icon' => ! empty($all_meta['gmb_map_marker']) ? $all_meta['gmb_map_marker'][0] : 'none', |
|
104 | 104 | ) |
105 | - ) ); |
|
105 | + )); |
|
106 | 106 | |
107 | - $this->array_push_localized_script( $localized_data ); |
|
107 | + $this->array_push_localized_script($localized_data); |
|
108 | 108 | |
109 | 109 | ob_start(); |
110 | 110 | |
111 | - include $this->get_google_maps_template( 'public.php' ); |
|
111 | + include $this->get_google_maps_template('public.php'); |
|
112 | 112 | |
113 | - return apply_filters( 'gmb_shortcode_output', ob_get_clean() ); |
|
113 | + return apply_filters('gmb_shortcode_output', ob_get_clean()); |
|
114 | 114 | |
115 | 115 | } |
116 | 116 |