Completed
Branch BUG-8511-spco-revisit-oversell... (e98bb2)
by
unknown
508:36 queued 493:55
created
core/helpers/EEH_Maps.helper.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 	 * @param  array $ee_gmaps_opts array of attributes required for the map link generation
22 22
 	 * @return string (link to map!)
23 23
 	 */
24
-	public static function google_map( $ee_gmaps_opts ){
25
-
26
-		$ee_map_width = isset( $ee_gmaps_opts['ee_map_width'] ) && ! empty( $ee_gmaps_opts['ee_map_width'] ) ? $ee_gmaps_opts['ee_map_width'] : '300';
27
-		$ee_map_height = isset( $ee_gmaps_opts['ee_map_height'] ) && ! empty( $ee_gmaps_opts['ee_map_height'] ) ? $ee_gmaps_opts['ee_map_height'] : '185';
28
-		$ee_map_zoom = isset( $ee_gmaps_opts['ee_map_zoom'] ) && ! empty( $ee_gmaps_opts['ee_map_zoom'] ) ? $ee_gmaps_opts['ee_map_zoom'] : '12';
29
-		$ee_map_nav_display = isset( $ee_gmaps_opts['ee_map_nav_display'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_display'] ) ? 'true' : 'false';
30
-		$ee_map_nav_size =  isset( $ee_gmaps_opts['ee_map_nav_size'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_size'] )? $ee_gmaps_opts['ee_map_nav_size'] : 'default';
31
-		$ee_map_type_control =  isset( $ee_gmaps_opts['ee_map_type_control'] ) && ! empty( $ee_gmaps_opts['ee_map_type_control'] )? $ee_gmaps_opts['ee_map_type_control'] : 'default';
32
-		$static_url =  isset( $ee_gmaps_opts['ee_static_url'] ) && ! empty( $ee_gmaps_opts['ee_static_url'] )? $ee_gmaps_opts['ee_static_url'] : FALSE;
33
-
34
-		if( isset( $ee_gmaps_opts['ee_map_align'] ) && ! empty( $ee_gmaps_opts['ee_map_align'] )){
35
-			switch( $ee_gmaps_opts['ee_map_align'] ){
24
+	public static function google_map($ee_gmaps_opts) {
25
+
26
+		$ee_map_width = isset($ee_gmaps_opts['ee_map_width']) && ! empty($ee_gmaps_opts['ee_map_width']) ? $ee_gmaps_opts['ee_map_width'] : '300';
27
+		$ee_map_height = isset($ee_gmaps_opts['ee_map_height']) && ! empty($ee_gmaps_opts['ee_map_height']) ? $ee_gmaps_opts['ee_map_height'] : '185';
28
+		$ee_map_zoom = isset($ee_gmaps_opts['ee_map_zoom']) && ! empty($ee_gmaps_opts['ee_map_zoom']) ? $ee_gmaps_opts['ee_map_zoom'] : '12';
29
+		$ee_map_nav_display = isset($ee_gmaps_opts['ee_map_nav_display']) && ! empty($ee_gmaps_opts['ee_map_nav_display']) ? 'true' : 'false';
30
+		$ee_map_nav_size = isset($ee_gmaps_opts['ee_map_nav_size']) && ! empty($ee_gmaps_opts['ee_map_nav_size']) ? $ee_gmaps_opts['ee_map_nav_size'] : 'default';
31
+		$ee_map_type_control = isset($ee_gmaps_opts['ee_map_type_control']) && ! empty($ee_gmaps_opts['ee_map_type_control']) ? $ee_gmaps_opts['ee_map_type_control'] : 'default';
32
+		$static_url = isset($ee_gmaps_opts['ee_static_url']) && ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : FALSE;
33
+
34
+		if (isset($ee_gmaps_opts['ee_map_align']) && ! empty($ee_gmaps_opts['ee_map_align'])) {
35
+			switch ($ee_gmaps_opts['ee_map_align']) {
36 36
 				case "left":
37 37
 					$map_align = 'ee-gmap-align-left left';
38 38
 					break;
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
 
54 54
 		// Determine whether user has set a hardoded url to use and
55 55
 		// if so display a Google static iframe map else run V3 api
56
-		if( $static_url ) {
56
+		if ($static_url) {
57 57
 
58
-			$html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">';
59
-			$html .= '<iframe src="' . $static_url . '&output=embed" style="width: ' . $ee_map_width  .'px; height: ' . $ee_map_height . 'px;" frameborder="0" scrolling="no">';
58
+			$html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper '.$map_align.'">';
59
+			$html .= '<iframe src="'.$static_url.'&output=embed" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;" frameborder="0" scrolling="no">';
60 60
 			$html .= '</iframe>';
61
-			$html .= '<a href="' . $static_url . '">View Large map</a>';
61
+			$html .= '<a href="'.$static_url.'">View Large map</a>';
62 62
 			$html .= '</div>';
63 63
 			return $html;
64 64
 
65 65
 		 } else {
66 66
 
67
-			EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array(
67
+			EEH_Maps::$gmap_vars[$ee_gmaps_opts['map_ID']] = array(
68 68
 				'map_ID' => $ee_gmaps_opts['map_ID'],
69 69
 				'ee_map_zoom' => $ee_map_zoom,
70 70
 				'ee_map_nav_display' => $ee_map_nav_display,
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 			);
75 75
 
76 76
 			$html = '<div class="ee-gmap-wrapper '.$map_align.';">';
77
-			$html .= '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] .'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>';  //
77
+			$html .= '<div class="ee-gmap" id="map_canvas_'.$ee_gmaps_opts['map_ID'].'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>'; //
78 78
 			$html .= '</div>';
79 79
 
80
-			wp_enqueue_script( 'gmap_api' );
81
-			wp_enqueue_script( 'ee_gmap' );
82
-			add_action( 'wp_footer', array( 'EEH_Maps', 'footer_enqueue_script' ));
80
+			wp_enqueue_script('gmap_api');
81
+			wp_enqueue_script('ee_gmap');
82
+			add_action('wp_footer', array('EEH_Maps', 'footer_enqueue_script'));
83 83
 
84 84
 			return $html;
85 85
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @return void
95 95
 	 */
96 96
 	public static function footer_enqueue_script() {
97
-		wp_localize_script( 'ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars );
97
+		wp_localize_script('ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars);
98 98
 	}
99 99
 
100 100
 
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 	public static function espresso_google_map_js() {
106 106
 		$api_url = sprintf(
107 107
 			"https://maps.googleapis.com/maps/api/js?key=%s",
108
-			apply_filters( 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key )
108
+			apply_filters('FHEE__EEH_Maps__espresso_google_maps_js__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key)
109 109
 		);
110
-		wp_register_script( 'gmap_api', $api_url, array('jquery'), NULL, TRUE );
111
-		wp_register_script( 'ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE );
110
+		wp_register_script('gmap_api', $api_url, array('jquery'), NULL, TRUE);
111
+		wp_register_script('ee_gmap', plugin_dir_url(__FILE__).'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE);
112 112
 	}
113 113
 
114 114
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @return string (link to map!)
118 118
 	 */
119 119
 	public static function google_map_link($atts) {
120
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
120
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
121 121
 		extract($atts);
122 122
 		/** @var string $address */
123 123
 		/** @var string $city */
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 		$id = isset($id) ? $id : 'not_set';
137 137
 		$map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view';
138 138
 
139
-		$address_string = ($address != '' ? $address : '') . ($city != '' ? ',' . $city : '') . ($state != '' ? ',' . $state : '') . ($zip != '' ? ',' . $zip : '') . ($country != '' ? ',' . $country : '');
139
+		$address_string = ($address != '' ? $address : '').($city != '' ? ','.$city : '').($state != '' ? ','.$state : '').($zip != '' ? ','.$zip : '').($country != '' ? ','.$country : '');
140 140
 
141
-		$google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode( $address_string ));
141
+		$google_map = htmlentities2('http://maps.google.com/maps?q='.urlencode($address_string));
142 142
 
143 143
 		switch ($type) {
144 144
 			case 'text':
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
 
153 153
 			case 'map':
154 154
 				$scheme = is_ssl() ? 'https://' : 'http://';
155
-				return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2( $scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode( $address_string ) . '&amp;zoom=14&amp;size=' . $map_w . 'x' . $map_h . '&amp;markers=color:green|label:|' . urlencode( $address_string ) . '&amp;sensor=false' ) . '" /></a>';
155
+				return '<a class="a_map_image_link" href="'.$google_map.'" target="_blank">'.'<img class="map_image_link" id="venue_map_'.$id.'" '.$map_image_class.' src="'.htmlentities2($scheme.'maps.googleapis.com/maps/api/staticmap?center='.urlencode($address_string).'&amp;zoom=14&amp;size='.$map_w.'x'.$map_h.'&amp;markers=color:green|label:|'.urlencode($address_string).'&amp;sensor=false').'" /></a>';
156 156
 		}
157 157
 
158
-		return '<a href="' . $google_map . '" target="_blank">' . $text . '</a>';
158
+		return '<a href="'.$google_map.'" target="_blank">'.$text.'</a>';
159 159
 	}
160 160
 
161 161
 
Please login to merge, or discard this patch.