PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
← All changes | admin/helpers/geocoding.php +15 -4 1.7.2 → 1.8.16 View file →
@@ -115,15 +115,22 @@
115 115 *
116 116 * @param mixed string or array values values to append to the URL.
117 117 *
118 118 * @return self
119 + *
120 + * @since 1.18.3 (J) - 1.8.3 (WP) loaded file gmaps-utils.js.
119 121 */
120 122 public function loadAssets($params = null)
121 123 {
122 - if (empty($this->gmaps_apikey)) {
124 + static $loaded = null;
125 +
126 + if (empty($this->gmaps_apikey) || $loaded) {
123 127 return $this;
124 128 }
125 129
130 + // turn flag on
131 + $loaded = true;
132 +
126 133 // values like &callback=initMap could be passed as argument
127 134 $qstring = '';
128 135
129 136 if (!empty($params)) {
@@ -128,16 +135,20 @@
128 135
129 136 if (!empty($params)) {
130 137 if (is_string($params)) {
131 138 $qstring = (substr($params, 0, 1) != '&' ? '&' : '') . $params;
132 - }
133 - if (is_array($params)) {
139 + } elseif (!is_scalar($params)) {
134 140 $qstring = '&' . http_build_query($params);
135 141 }
136 142 }
137 143
144 + $document = JFactory::getDocument();
145 +
146 + // load the Google Maps Utils file within VikBooking
147 + $document->addScript(VBO_SITE_URI . 'resources/gmaps-utils.js', ['version' => VIKBOOKING_SOFTWARE_VERSION]);
148 +
138 149 // load Google Maps API JS
139 - JFactory::getDocument()->addScript('https://maps.googleapis.com/maps/api/js?key=' . $this->gmaps_apikey . $qstring);
150 + $document->addScript('https://maps.googleapis.com/maps/api/js?key=' . $this->gmaps_apikey . $qstring);
140 151
141 152 return $this;
142 153 }
143 154