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 | libraries/adapter/mvc/model.php +28 -18 1.6.6 → 1.8.16 View file →
@@ -165,33 +165,32 @@
165 165 // specified include paths
166 166 self::addIncludePath()
167 167 );
168 168
169 - // iterate paths until we find an existing file (or till the list is empty)
170 - for ($i = 0, $path = null; $i < count($paths) && !$path; $i++)
169 + /**
170 + * Iterate paths until we find an existing file (or till the list is empty).
171 + *
172 + * @since 10.1.54 Keep iterating until we find a compatible class instead of
173 + * a compatible file, since different plugins might support the
174 + * same file name.
175 + */
176 + for ($i = 0, $path = null; $i < count($paths) && !static::$instances[$sign]; $i++)
171 177 {
172 178 // create path
173 179 $path = $paths[$i] . DIRECTORY_SEPARATOR . strtolower($type) . '.php';
174 180
175 181 // make sure the file exists
176 - if (!is_file($path))
182 + if (is_file($path))
177 183 {
178 - // unset path to keep iterating
179 - $path = null;
180 - }
181 - }
184 + // include model
185 + require_once $path;
182 186
183 - // make sure we have a path
184 - if ($path)
185 - {
186 - // include model
187 - require_once $path;
188 -
189 - // make sure the class exists
190 - if (class_exists($classname))
191 - {
192 - // cache model instance
193 - static::$instances[$sign] = new $classname($config);
187 + // make sure the class exists
188 + if (class_exists($classname))
189 + {
190 + // cache model instance
191 + static::$instances[$sign] = new $classname($config);
192 + }
194 193 }
195 194 }
196 195 }
197 196
@@ -259,8 +258,19 @@
259 258 $option = $this->getComponentName();
260 259
261 260 if (!array_key_exists('table_path', $config) && $option)
262 261 {
262 + /**
263 + * In case the client hasn't been provided, assume we should load the models
264 + * from the same path of the current application client (admin or site).
265 + *
266 + * @since 10.1.55
267 + */
268 + if (empty($config['client']))
269 + {
270 + $config['client'] = JFactory::getApplication()->isAdmin() ? 'admin' : 'site';
271 + }
272 +
263 273 $config['table_path'] = [
264 274 JPath::clean(WP_PLUGIN_DIR . '/' . $option . '/libraries/mvc/' . $config['client'] . '/tables'),
265 275 JPath::clean(WP_PLUGIN_DIR . '/' . $option . '/' . $config['client'] . '/tables'),
266 276 ];